Skip to content

Commit

Permalink
v1.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Electric1447 committed Jun 17, 2020
1 parent 7aea30d commit f11dc5e
Show file tree
Hide file tree
Showing 23 changed files with 225 additions and 377 deletions.
16 changes: 5 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ include("${VITASDK}/share/vita.cmake" REQUIRED)

set(VITA_APP_NAME "EasyVPK")
set(VITA_TITLEID "ESVPK0009")
set(VITA_VERSION "01.21")
set(VITA_VERSION "01.22")

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,-q -Wall -O2")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-sign-compare -Wno-unused-parameter -Wno-psabi -std=c++17 -fpermissive")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-sign-compare -Wno-unused-parameter -Wno-psabi -Wunused-variable -Wwrite-strings -fpermissive -std=c++17 -Wimplicit-fallthrough")

set(VITA_MKSFOEX_FLAGS "${VITA_MKSFOEX_FLAGS} -d PARENTAL_LEVEL=7")

Expand Down Expand Up @@ -76,7 +76,6 @@ add_executable(easyvpk
src/net/download.cpp
src/utils/filesystem.cpp
src/utils/search.cpp
src/utils/format.cpp
src/utils/vitaPackage.cpp
src/utils/zip.cpp
src/utils/sha1.c
Expand All @@ -85,7 +84,6 @@ add_executable(easyvpk

target_link_libraries(easyvpk
vita2d
sqlite
${CURL_LIBRARIES}
${OPENSSL_LIBRARIES}
freetype
Expand All @@ -106,7 +104,6 @@ target_link_libraries(easyvpk
SceSsl_stub
SceIofilemgr_stub
SceHttp_stub
ScePower_stub
SceIme_stub
SceSysmodule_stub
SceShellSvc_stub
Expand All @@ -125,10 +122,7 @@ vita_create_vpk(easyvpk.vpk ${VITA_TITLEID} easyvpk.self
FILE sce_sys/livearea/contents/startup.png sce_sys/livearea/contents/startup.png
FILE sce_sys/livearea/contents/template.xml sce_sys/livearea/contents/template.xml
FILE src/graphics/bg.png resources/bg.png
FILE src/graphics/desc.png resources/desc.png
FILE src/graphics/desc1.png resources/desc1.png
FILE src/graphics/desc2.png resources/desc2.png
FILE src/graphics/desc3.png resources/desc3.png
FILE src/graphics/desc4.png resources/desc4.png
FILE src/graphics/desc5.png resources/desc5.png
FILE src/graphics/navbar0.png resources/navbar0.png
FILE src/graphics/navbar1.png resources/navbar1.png
FILE src/graphics/navbar2.png resources/navbar2.png
)
2 changes: 1 addition & 1 deletion sce_sys/livearea/contents/template.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<frame id="frame4">
<liveitem>
<text align="left" text-align="left" word-wrap="off" ellipsis="on">
<str size="18" color="#ffffff" shadow="on">v1.2.1</str>
<str size="18" color="#ffffff" shadow="on">v1.2.2</str>
</text>
</liveitem>
</frame>
Expand Down
Binary file removed src/graphics/desc2.png
Binary file not shown.
Binary file removed src/graphics/desc3.png
Binary file not shown.
Binary file removed src/graphics/desc4.png
Binary file not shown.
File renamed without changes
File renamed without changes
File renamed without changes
71 changes: 7 additions & 64 deletions src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,39 +1,21 @@
#include <vita2d.h>
#include "main.hpp"

#include <psp2/kernel/processmgr.h>
#include <psp2/power.h>
#include <psp2/io/fcntl.h>
#include <psp2/sqlite.h>
#include <psp2/apputil.h>
#include <psp2/display.h>
#include <psp2/ime_dialog.h>
#include <string>

#include "main.hpp"
#include "sqlite3.h"
#include "net/download.hpp"
#include "utils/filesystem.hpp"
#include "utils/search.hpp"
#include "utils/format.hpp"

#include "screens/list.hpp"
#include "screens/details.hpp"
#include "screens/popup.hpp"

SceCtrlData pad;

AppInfo::AppInfo(string p_appID, string p_title, string fileLocation) {
appID = p_appID;
title = p_title;
icon = fileLocation.find(".dds") == string::npos ? vita2d_load_PNG_file(fileLocation.c_str()) : NULL;
}

static int callback(void *data, int argc, char **argv, char **column_name) {
vector<AppInfo> *ret = (vector<AppInfo>*) data;

ret->emplace_back(string(argv[0]), string(argv[1]), string(argv[2]));
return 0;
}

void initSceAppUtil() {

// Init SceAppUtil
Expand All @@ -51,56 +33,25 @@ void initSceAppUtil() {
sceCommonDialogSetConfigParam(&config);
}

int getAppData(vector<AppInfo> &ret) {
SceIoDirent dirInfo;
SceUID folder;

ret.emplace_back("ALL", "All", "");
ret.emplace_back("main", "Livearea (main)", "");

sqlite3 *db = NULL;

sceSysmoduleLoadModule(SCE_SYSMODULE_SQLITE);

sqlite3_rw_init();

int rc = sqlite3_open_v2("ur0:shell/db/app.db", &db, SQLITE_OPEN_READONLY, NULL);
if (rc != SQLITE_OK)
return -1;

sqlite3_exec(db, "SELECT titleId, title, iconPath FROM tbl_appinfo_icon WHERE NOT titleId=\"NULL\" ORDER BY title ASC", callback, &ret, NULL);

if (db != NULL)
sqlite3_close(db);
sqlite3_rw_exit();

sceSysmoduleUnloadModule(SCE_SYSMODULE_SQLITE);

return 0;
}

int main() {
vita2d_init();
initSceAppUtil();

Filesystem::mkDir("ux0:data/Easy_VPK");

vita2d_set_clear_color(RGBA8(255,255,255,255));

vita2d_texture *bgIMG = vita2d_load_PNG_file("ux0:app/ESVPK0009/resources/bg.png");
vita2d_set_clear_color(WHITE);
vita2d_texture *bgIMG = vita2d_load_PNG_file("ux0:app/ESVPK0009/resources/bg.png");

httpInit();
netInit();
curlDownload("https://vitadb.rinnegatamante.it/list_hbs_json.json", "ux0:data/Easy_VPK/vpks.json");
curlDownload(HOMEBREW_URL, "ux0:data/Easy_VPK/vpks.json");

SharedData sharedData;

Filesystem::mkDir(sharedData.vpkDownloadPath);

sharedData.vpks = json::parse(Filesystem::readFile("ux0:data/Easy_VPK/vpks.json"));

getAppData(sharedData.appData);

sharedData.original = sharedData.vpks;

List listView;
Expand All @@ -117,12 +68,9 @@ int main() {
if (pad.buttons != SCE_CTRL_CROSS ) sharedData.blockCross = false;
if (pad.buttons != SCE_CTRL_SQUARE) sharedData.blockSquare = false;
if (pad.buttons != SCE_CTRL_CIRCLE) sharedData.blockCircle = false;



if (sharedData.scene == 0) listView.draw(sharedData, pad.buttons);

if (sharedData.scene == 1) detailsView.draw(sharedData, pad.buttons);

if (sharedData.scene == 2) popupView.draw(sharedData);

vita2d_end_drawing();
Expand All @@ -138,18 +86,13 @@ int main() {
netTerm();
vita2d_free_font(sharedData.font);
vita2d_free_texture(bgIMG);

for (int i = 0; i < sharedData.appData.size(); i++)
if (sharedData.appData[i].icon != NULL)
vita2d_free_texture(sharedData.appData[i].icon);

for (int i = 0; i < sharedData.screenshots.size(); i++)
if (sharedData.screenshots[i] != NULL)
vita2d_free_texture(sharedData.screenshots[i]);

listView.free();
detailsView.free();
popupView.free();
vita2d_fini();

sceKernelExitProcess(0);
Expand Down
27 changes: 15 additions & 12 deletions src/main.hpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
#pragma once

#include <vita2d.h>
#include <psp2/kernel/clib.h>
#include <psp2/ctrl.h>
#include <psp2/kernel/clib.h>
#include <psp2/sysmodule.h>
#include <vita2d.h>

#include "utils/json.hpp"

#define imageWebBase "http://rinnegatamante.it/vitadb/"

#define PARENT_URL "http://rinnegatamante.it/vitadb/"
#define HOMEBREW_URL PARENT_URL "list_hbs_json.json"

#define BLACK RGBA8( 0, 0, 0, 255)
#define WHITE RGBA8(255, 255, 255, 255)
#define LGREY RGBA8(191, 191, 191, 255)
#define LGREY2 RGBA8(215, 215, 215, 255)
#define RED RGBA8(255, 0, 0, 255)
#define GREEN RGBA8( 0, 255, 0, 255)
#define BLUE RGBA8( 0, 0, 255, 255)
#define YELLOW RGBA8(255, 255, 0, 255)
#define PURPLE RGBA8(109, 0, 252, 255)


using namespace std;

Expand All @@ -17,14 +29,6 @@ using json = nlohmann::json;
extern unsigned int basicfont_size;
extern unsigned char basicfont[];

class AppInfo {
public:
AppInfo(string p_appID, string p_title, string fileLocation);
string appID;
string title;
vita2d_texture *icon;
};

struct SharedData {
int scene = 0;
int cursorY = 0;
Expand All @@ -37,6 +41,5 @@ struct SharedData {
vector<vita2d_texture *> screenshots;
json vpks;
json original;
vector<AppInfo> appData;
vita2d_font *font = vita2d_load_font_mem(basicfont, basicfont_size);
};
36 changes: 16 additions & 20 deletions src/net/download.cpp
Original file line number Diff line number Diff line change
@@ -1,34 +1,30 @@
#define _GNU_SOURCE
#include <psp2/kernel/processmgr.h>
#include <psp2/display.h>

#include "download.hpp"

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <psp2/kernel/processmgr.h>
#include <psp2/net/net.h>
#include <psp2/net/netctl.h>
#include <psp2/net/http.h>
#include <psp2/libssl.h>

#include <psp2/io/fcntl.h>
#include <curl/curl.h>

#include <stdio.h>
#include <malloc.h>
#include <string>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <stdlib.h>

#include "../main.hpp"
#include "../utils/filesystem.hpp"


CURL *curl;
int plFD;

void netInit() {
sceSysmoduleLoadModule(SCE_SYSMODULE_NET);

SceNetInitParam netInitParam;
int size = 1*1024*1024;
int size = NET_INIT_SIZE;
netInitParam.memory = malloc(size);
netInitParam.size = size;
netInitParam.flags = 0;
Expand All @@ -46,8 +42,8 @@ void netTerm() {
void httpInit() {
sceSysmoduleLoadModule(SCE_SYSMODULE_SSL);
sceSysmoduleLoadModule(SCE_SYSMODULE_HTTPS);
sceHttpInit(1*1024*1024);
sceSslInit(1*1024*1024);
sceHttpInit(NET_INIT_SIZE);
sceSslInit(NET_INIT_SIZE);
}

void httpTerm() {
Expand All @@ -67,7 +63,7 @@ void curlDownload(const char *url, const char *dest) {

curl_global_init(CURL_GLOBAL_ALL);
curl = curl_easy_init();
if(curl) {
if (curl) {
curl_easy_reset(curl);
curl_easy_setopt(curl, CURLOPT_URL, url);
curl_easy_setopt(curl, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36");
Expand Down Expand Up @@ -117,14 +113,14 @@ std::string curlDownloadKeepName(char const*const url, std::string dst) {
std::string header = Filesystem::readFile("ux0:data/Easy_VPK/head.tmp");

if (header.find("filename=\"") != string::npos) {
header = header.substr(header.find("filename=\"")+10);
header = header.substr(header.find("filename=\"") + 10);
header = header.substr(0, header.find("\""));
} else if (header.find("location: ") != string::npos) {
header = header.substr(header.find("location: ")+10);
header = header.substr(0, header.find("\n")-1);
header = header.substr(header.find("location: ") + 10);
header = header.substr(0, header.find("\n") - 1);

while (header.find("/") != string::npos)
header = header.substr(header.find("/")+1);
header = header.substr(header.find("/") + 1);
}

Filesystem::copyFile("ux0:data/Easy_VPK/plugin.tmp", dst+header);
Expand Down
6 changes: 5 additions & 1 deletion src/net/download.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#pragma once
#include "../main.hpp"


#define NET_INIT_SIZE 1*1024*1024


void netInit();
void netTerm();
Expand Down
Loading

0 comments on commit f11dc5e

Please sign in to comment.