Skip to content

Commit

Permalink
release 1.1, fixed pkgdec file handle close issue, added h-encore-ful…
Browse files Browse the repository at this point in the history
…l.zip check for smaller package support
  • Loading branch information
soarqin committed Jul 15, 2018
1 parent d7c933c commit 583b863
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 72 deletions.
2 changes: 2 additions & 0 deletions deps/psvlib/pkg/pkg.c
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,8 @@ int pkg_dec(const char *pkgname, const char *target_dir, const char *zrif)
out_end_file();
}

sys_close(pkg);

if (type == PKG_TYPE_VITA_APP || type == PKG_TYPE_VITA_PATCH)
{
_output_func(_output_arg, "[*] minimum fw version required: %s\n", min_version);
Expand Down
2 changes: 1 addition & 1 deletion src/finalhe.ui
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
</font>
</property>
<property name="windowTitle">
<string>Final h-encore v1.0</string>
<string>Final h-encore v1.1</string>
</property>
<property name="locale">
<locale language="C" country="AnyCountry"/>
Expand Down
96 changes: 55 additions & 41 deletions src/package.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
#include <QDir>
#include <QDebug>

const char *HENCORE_FULL_FILE = "h-encore-full.zip";
const char *HENCORE_FULL_SHA256 = "3ea59bdf6e7d8f5aa96cabd4f0577fcf78822970f463680b0758a5aaa332452d";

const char *HENCORE_URL = "https://github.com/TheOfficialFloW/h-encore/releases/download/v1.0/h-encore.zip";
const char *HENCORE_FILE = "h-encore.zip";
const char *HENCORE_SHA256 = "65a5eee6654bb7889e4c0543d09fa4e9eced53c76b25d23e12d23e7a28846b0a";
Expand All @@ -23,7 +26,8 @@ Package::Package(const QString &basePath, QObject *obj_parent): QObject(obj_pare
connect(&downloader, SIGNAL(finishedFile(QFile*)), this, SLOT(downloadFinished(QFile*)));
connect(&downloader, SIGNAL(finishedGet(void*)), this, SLOT(fetchFinished(void*)));
connect(&downloader, SIGNAL(downloadProgress(uint64_t, uint64_t)), this, SLOT(downloadProg(uint64_t, uint64_t)));
connect(this, SIGNAL(startDownload()), SLOT(downloadDemo()));
connect(this, SIGNAL(startDownload()), SLOT(checkHencoreFull()));
connect(this, SIGNAL(noHencoreFull()), SLOT(downloadDemo()));
connect(this, SIGNAL(unpackedDemo()), SLOT(downloadHencore()));
connect(this, SIGNAL(unpackedHencore()), SLOT(createPsvImgs()));
}
Expand Down Expand Up @@ -105,7 +109,7 @@ void _output_progress(void *arg, uint64_t progress) {
emit ((Package*)arg)->setPercent((int)(progress * 100ULL / demoSize));
}

bool Package::startUnpackDemo(const char *filename) {
void Package::startUnpackDemo(const char *filename) {
static bool succ = false;
Worker::start(this, [this, filename](void *arg) {
*(bool*)arg = false;
Expand Down Expand Up @@ -138,10 +142,9 @@ bool Package::startUnpackDemo(const char *filename) {
emit unpackedDemo();
}
}, &succ);
return true;
}

bool Package::startUnpackHencore(const char *filename) {
void Package::startUnpackHencore(const char *filename) {
static bool succ = false;
Worker::start(this, [this, filename](void *arg) {
emit setPercent(0);
Expand Down Expand Up @@ -195,7 +198,6 @@ bool Package::startUnpackHencore(const char *filename) {
emit unpackedHencore();
}
}, &succ);
return true;
}

bool Package::verify(const QString &filepath, const char *sha256sum) {
Expand Down Expand Up @@ -236,6 +238,15 @@ bool Package::verify(const QString &filepath, const char *sha256sum) {
return false;
}

void Package::getBackupKey(const QString &aid) {
if (accountId != aid) {
accountId = aid;
get(QString("http://cma.henkaku.xyz/?aid=%1").arg(aid), backupKey);
qDebug("Fetching backup key from cma.henkaku.xyz...");
emit setStatusText(tr("Fetching backup key from cma.henkaku.xyz"));
}
}

void Package::finishBuildData() {
emit setPercent(100);
emit setStatusText(tr("Everything is ready, now follow below steps on your PS Vita:\n"
Expand All @@ -245,13 +256,19 @@ void Package::finishBuildData() {
"4. Run \"h-encore\" and... Yay, that's it!"));
}

void Package::getBackupKey(const QString &aid) {
if (accountId != aid) {
accountId = aid;
get(QString("http://cma.henkaku.xyz/?aid=%1").arg(aid), backupKey);
qDebug("Fetching backup key from cma.henkaku.xyz...");
emit setStatusText(tr("Fetching backup key from cma.henkaku.xyz"));
}
void Package::checkHencoreFull() {
static bool succ = false;
Worker::start(this, [this](void *arg) {
QDir dir(pkgBasePath);
QString filename = dir.filePath(HENCORE_FULL_FILE);
*(bool*)arg = verify(filename, HENCORE_FULL_SHA256);
}, [this](void *arg) {
if (*(bool*)arg) {
startUnpackHencore(HENCORE_FULL_FILE);
} else {
emit noHencoreFull();
}
}, &succ);
}

void Package::downloadDemo() {
Expand All @@ -271,35 +288,32 @@ void Package::createPsvImgs() {
if (trimApp) {
qDebug("Trimming package...");
emit setStatusText(tr("Trimming package"));
curr.cd("app");
curr.cd("ux0_temp_game_PCSG90096_app_PCSG90096");
curr.cd("resource");
curr.cd("movie");
curr.removeRecursively();
curr.cdUp();
curr.cd("sound");
curr.removeRecursively();
curr.cdUp();
curr.cd("text");
curr.cd("01");
curr.removeRecursively();
curr.cdUp();
curr.cdUp();
curr.cd("image");
curr.cd("bg");
curr.removeRecursively();
curr.cdUp();
curr.cd("ev");
curr.removeRecursively();
curr.cdUp();
curr.cd("icon");
curr.removeRecursively();
curr.cdUp();
curr.cd("stitle");
curr.removeRecursively();
curr.cdUp();
curr.cd("tachie");
curr.removeRecursively();
if (curr.cd("app") && curr.cd("ux0_temp_game_PCSG90096_app_PCSG90096")) {
QDir cdir = curr;
if (cdir.cd("resource") && cdir.cd("movie"))
cdir.removeRecursively();
cdir = curr;
if (cdir.cd("resource") && cdir.cd("sound"))
cdir.removeRecursively();
cdir = curr;
if (cdir.cd("resource") && cdir.cd("text") && cdir.cd("01"))
cdir.removeRecursively();
cdir = curr;
if (cdir.cd("resource") && cdir.cd("image") && cdir.cd("bg"))
cdir.removeRecursively();
cdir = curr;
if (cdir.cd("resource") && cdir.cd("image") && cdir.cd("ev"))
cdir.removeRecursively();
cdir = curr;
if (cdir.cd("resource") && cdir.cd("image") && cdir.cd("icon"))
cdir.removeRecursively();
cdir = curr;
if (cdir.cd("resource") && cdir.cd("image") && cdir.cd("stitle"))
cdir.removeRecursively();
cdir = curr;
if (cdir.cd("resource") && cdir.cd("image") && cdir.cd("tachie"))
cdir.removeRecursively();
}
qDebug("Done trimming.");
}
qDebug("Creating psvimg's...");
Expand Down
6 changes: 4 additions & 2 deletions src/package.hh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public:

signals:
void startDownload();
void noHencoreFull();
void unpackedDemo();
void unpackedHencore();
void createdPsvImgs();
Expand All @@ -27,15 +28,16 @@ private:
void get(const QString &url, QString &result);
void download(const QString &url, const QString &localFilename, const char *sha256sum);
void startDownload(const QString &url, const QString &localFilename);
bool startUnpackDemo(const char *filename);
bool startUnpackHencore(const char *filename);
void startUnpackDemo(const char *filename);
void startUnpackHencore(const char *filename);
bool verify(const QString &filepath, const char *sha256sum);

public slots:
void getBackupKey(const QString &aid);
void finishBuildData();

private slots:
void checkHencoreFull();
void downloadDemo();
void downloadHencore();
void createPsvImgs();
Expand Down
28 changes: 14 additions & 14 deletions src/translations/zh_CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<name>FinalHEClass</name>
<message>
<location filename="../finalhe.ui" line="25"/>
<source>Final h-encore v1.0</source>
<source>Final h-encore v1.1</source>
<translation type="unfinished"></translation>
</message>
<message>
Expand All @@ -51,37 +51,37 @@
<context>
<name>Package</name>
<message>
<location filename="../package.cc" line="92"/>
<location filename="../package.cc" line="96"/>
<source>Downloading %1</source>
<translation>正在下载 %1</translation>
</message>
<message>
<location filename="../package.cc" line="113"/>
<location filename="../package.cc" line="117"/>
<source>Unpacking %1</source>
<translation>正在解包 %1</translation>
</message>
<message>
<location filename="../package.cc" line="127"/>
<location filename="../package.cc" line="131"/>
<source>Failed to unpack %1</source>
<translation>无法解包 %1</translation>
</message>
<message>
<location filename="../package.cc" line="150"/>
<location filename="../package.cc" line="153"/>
<source>Decompressing %1</source>
<translation>正在解压 %1</translation>
</message>
<message>
<location filename="../package.cc" line="165"/>
<location filename="../package.cc" line="168"/>
<source>Failed to decompress %1</source>
<translation>无法解压 %1</translation>
</message>
<message>
<location filename="../package.cc" line="205"/>
<location filename="../package.cc" line="207"/>
<source>Verifying %1</source>
<translation>正在校验 %1</translation>
</message>
<message>
<location filename="../package.cc" line="241"/>
<location filename="../package.cc" line="252"/>
<source>Everything is ready, now follow below steps on your PS Vita:
1. Launch Content Manager and connect to your computer.
2. Select &quot;PC -&gt; PS Vita System&quot; -&gt; &quot;Applications&quot; -&gt; &quot;PS Vita&quot;.
Expand All @@ -94,34 +94,34 @@
4. 在PSV上运行 &quot;h-encore&quot;,大功告成!</translation>
</message>
<message>
<location filename="../package.cc" line="253"/>
<location filename="../package.cc" line="246"/>
<source>Fetching backup key from cma.henkaku.xyz</source>
<translation>正在从cma.henkaku.xyz获得备份密钥</translation>
</message>
<message>
<location filename="../package.cc" line="336"/>
<location filename="../package.cc" line="350"/>
<source>Fetched backup key.
Click button to START!</source>
<translation>已获得备份密钥
现在点击按钮开始!</translation>
</message>
<message>
<location filename="../package.cc" line="273"/>
<location filename="../package.cc" line="290"/>
<source>Trimming package</source>
<translation>正在瘦身</translation>
</message>
<message>
<location filename="../package.cc" line="36"/>
<location filename="../package.cc" line="40"/>
<source>Launch Content Manager on PS Vita and connect to computer.</source>
<translation>在PSV上运行内容管理器并连接到计算机</translation>
</message>
<message>
<location filename="../package.cc" line="306"/>
<location filename="../package.cc" line="320"/>
<source>Createing psvimg&apos;s</source>
<translation>正在创建psvimg</translation>
</message>
<message>
<location filename="../package.cc" line="333"/>
<location filename="../package.cc" line="347"/>
<source>Cannot get backup key from your AID.
Please check your network connection!</source>
<translation>无法从用户ID获取备份密钥,请检查计算机的网络连接</translation>
Expand Down
28 changes: 14 additions & 14 deletions src/translations/zh_TW.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<name>FinalHEClass</name>
<message>
<location filename="../finalhe.ui" line="25"/>
<source>Final h-encore v1.0</source>
<source>Final h-encore v1.1</source>
<translation type="unfinished"></translation>
</message>
<message>
Expand All @@ -51,37 +51,37 @@
<context>
<name>Package</name>
<message>
<location filename="../package.cc" line="92"/>
<location filename="../package.cc" line="96"/>
<source>Downloading %1</source>
<translation>正在下載 %1</translation>
</message>
<message>
<location filename="../package.cc" line="113"/>
<location filename="../package.cc" line="117"/>
<source>Unpacking %1</source>
<translation>正在解開 %1</translation>
</message>
<message>
<location filename="../package.cc" line="127"/>
<location filename="../package.cc" line="131"/>
<source>Failed to unpack %1</source>
<translation>無法解開 %1</translation>
</message>
<message>
<location filename="../package.cc" line="150"/>
<location filename="../package.cc" line="153"/>
<source>Decompressing %1</source>
<translation>正在解開壓縮檔案 %1</translation>
</message>
<message>
<location filename="../package.cc" line="165"/>
<location filename="../package.cc" line="168"/>
<source>Failed to decompress %1</source>
<translation>無法解開壓縮檔案 %1</translation>
</message>
<message>
<location filename="../package.cc" line="205"/>
<location filename="../package.cc" line="207"/>
<source>Verifying %1</source>
<translation>正在校驗 %1</translation>
</message>
<message>
<location filename="../package.cc" line="241"/>
<location filename="../package.cc" line="252"/>
<source>Everything is ready, now follow below steps on your PS Vita:
1. Launch Content Manager and connect to your computer.
2. Select &quot;PC -&gt; PS Vita System&quot; -&gt; &quot;Applications&quot; -&gt; &quot;PS Vita&quot;.
Expand All @@ -94,34 +94,34 @@
4. 在PSV上執行 &quot;h-encore&quot;,大功告成!</translation>
</message>
<message>
<location filename="../package.cc" line="253"/>
<location filename="../package.cc" line="246"/>
<source>Fetching backup key from cma.henkaku.xyz</source>
<translation>正在從cma.henkaku.xyz獲得備份密鑰</translation>
</message>
<message>
<location filename="../package.cc" line="336"/>
<location filename="../package.cc" line="350"/>
<source>Fetched backup key.
Click button to START!</source>
<translation>已獲得備份密鑰
現在點擊按鈕開始!</translation>
</message>
<message>
<location filename="../package.cc" line="273"/>
<location filename="../package.cc" line="290"/>
<source>Trimming package</source>
<translation>正在縮減容量</translation>
</message>
<message>
<location filename="../package.cc" line="36"/>
<location filename="../package.cc" line="40"/>
<source>Launch Content Manager on PS Vita and connect to computer.</source>
<translation>在PS Vita上執行內容管理器並連接到個人電腦</translation>
</message>
<message>
<location filename="../package.cc" line="306"/>
<location filename="../package.cc" line="320"/>
<source>Createing psvimg&apos;s</source>
<translation>正在製作psvimg</translation>
</message>
<message>
<location filename="../package.cc" line="333"/>
<location filename="../package.cc" line="347"/>
<source>Cannot get backup key from your AID.
Please check your network connection!</source>
<translation>無法從用戶ID獲取備份密鑰,請檢查個人電腦的網絡連接</translation>
Expand Down

0 comments on commit 583b863

Please sign in to comment.