Skip to content

Commit

Permalink
pkgi_vita: install psp games in the right place
Browse files Browse the repository at this point in the history
Closes #60
  • Loading branch information
blastrock committed May 7, 2018
1 parent 2b0f156 commit a238780
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 31 deletions.
1 change: 0 additions & 1 deletion pkgi.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ int pkgi_psp_is_installed(const char* content);
int pkgi_psx_is_installed(const char* content);
void pkgi_install(const char* titleid);
void pkgi_install_update(const char* contentid);
void pkgi_install_pspgame(const char* contentid);
void pkgi_install_psxgame(const char* contentid);

uint32_t pkgi_time_msec();
Expand Down
2 changes: 0 additions & 2 deletions pkgi_downloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,6 @@ void Downloader::do_download(const DownloadItem& item)
pkgi_install_update(item.content.c_str());
break;
case PspGame:
pkgi_install_pspgame(item.content.c_str());
break;
case PsxGame:
pkgi_install_psxgame(item.content.c_str());
break;
Expand Down
37 changes: 9 additions & 28 deletions pkgi_vita.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -695,10 +695,17 @@ int pkgi_dlc_is_installed(const char* content)
int pkgi_psp_is_installed(const char* content)
{
char path[128];
SceIoStat stat;

snprintf(path, sizeof(path), "ux0:pspemu/ISO/%.9s.iso", content + 7);
if (sceIoGetstat(path, &stat) >= 0)
return 1;

SceIoStat stat;
return sceIoGetstat(path, &stat) >= 0;
snprintf(path, sizeof(path), "ux0:pspemu/PSP/GAME/%.9s", content + 7);
if (sceIoGetstat(path, &stat) >= 0)
return 1;

return 0;
}

int pkgi_psx_is_installed(const char* content)
Expand Down Expand Up @@ -796,32 +803,6 @@ void pkgi_install_update(const char* contentid)
"failed to rename: {:#08x}", static_cast<uint32_t>(res)));
}

void pkgi_install_pspgame(const char* contentid)
{
char path[128];
snprintf(
path,
sizeof(path),
"%s/%s/EBOOT.PBP",
pkgi_get_temp_folder(),
contentid);

char dest[128];
snprintf(dest, sizeof(dest), "ux0:pspemu/ISO");
pkgi_mkdirs(dest);

snprintf(dest, sizeof(dest), "ux0:pspemu/ISO/%.9s.iso", contentid + 7);

LOG("installing psp game at %s", path);
int res = sceIoRename(path, dest);
if (res < 0)
throw std::runtime_error(fmt::format(
"failed to rename: {:#08x}", static_cast<uint32_t>(res)));

snprintf(path, sizeof(path), "%s/%s", pkgi_get_temp_folder(), contentid);
pkgi_delete_dir(path);
}

void pkgi_install_psxgame(const char* contentid)
{
char path[128];
Expand Down

0 comments on commit a238780

Please sign in to comment.