Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 25 additions & 5 deletions homebrew/PKGInstall/pkg_install.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, see
<http://www.gnu.org/licenses/>. */

#include <limits.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>

typedef struct pkg_metadata {
const char* uri;
Expand All @@ -23,8 +26,13 @@ typedef struct pkg_metadata {
const char* content_id;
const char* content_name;
const char* icon_url;
uint32_t slot;
uint32_t is_playgo_enabled;
} pkg_metadata_t;

_Static_assert(sizeof(pkg_metadata_t) == 0x38,
"sceAppInstUtil metadata ABI mismatch");


typedef struct pkg_info {
char content_id[48];
Expand All @@ -34,19 +42,24 @@ typedef struct pkg_info {


typedef struct playgo_info {
char lang[8][30];
char scenario_ids[3][64];
char content_ids[64];
char languages[30][8];
char scenario_ids[64][3];
char content_ids[64][48];
long unknown[810];
} playgo_info_t;

_Static_assert(sizeof(playgo_info_t) == 0x2700,
"sceAppInstUtil PlayGoInfo ABI mismatch");


int sceAppInstUtilInitialize(void);
int sceAppInstUtilInstallByPackage(const pkg_metadata_t*, pkg_info_t*, playgo_info_t*);


int
main(int argc, char** argv) {
char install_path[PATH_MAX + sizeof("/user")];
const char* uri;
playgo_info_t playgoinfo = {0};
pkg_info_t pkginfo = {0};
pkg_metadata_t metainfo = {
Expand All @@ -55,7 +68,9 @@ main(int argc, char** argv) {
.content_id = "",
.icon_url = "",
.ex_uri = "",
.uri = ""
.uri = "",
.slot = 0,
.is_playgo_enabled = 0
};

if(argc < 2) {
Expand All @@ -67,7 +82,12 @@ main(int argc, char** argv) {
return -1;
}

metainfo.uri = argv[1];
uri = argv[1];
if(!strncmp(uri, "/data/", 6)) {
snprintf(install_path, sizeof(install_path), "/user%s", uri);
uri = install_path;
}
metainfo.uri = uri;

return sceAppInstUtilInstallByPackage(&metainfo, &pkginfo, &playgoinfo);
}
Expand Down