Skip to content

Commit

Permalink
pkgi_install_pspgame: simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
blastrock committed May 9, 2018
1 parent 875bdc9 commit 4f65564
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions pkgi_vita.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -780,17 +780,14 @@ void pkgi_install_update(const char* contentid)

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

char dest[128];
snprintf(dest, sizeof(dest), "ux0:pspemu/PSP/GAME");
pkgi_mkdirs(dest);
const auto path = fmt::format("{}/{}", pkgi_get_temp_folder(), contentid);
const auto dest = fmt::format("ux0:pspemu/PSP/GAME/{:.9}", contentid + 7);

snprintf(dest, sizeof(dest), "ux0:pspemu/PSP/GAME/%.9s", contentid + 7);
char dir[] = "ux0:pspemu/PSP/GAME";
pkgi_mkdirs(dir);

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

0 comments on commit 4f65564

Please sign in to comment.