Skip to content
This repository has been archived by the owner on Oct 31, 2021. It is now read-only.

Commit

Permalink
Use sceClibSnprintf instead of snprintf
Browse files Browse the repository at this point in the history
  • Loading branch information
joel16 committed Mar 13, 2018
1 parent 93ab8c9 commit 431c3ac
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
40 changes: 20 additions & 20 deletions source/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ SceInt Config_SaveMenuConfig(SceBool batteryPercent, SceBool batteryLifeTime, Sc
SceInt ret = 0;

char *menu_config_path = (char *)Utils_SceMalloc(25);
snprintf(menu_config_path, 25, "ur0:/data/vsh/config.cfg");
sceClibSnprintf(menu_config_path, 25, "ur0:/data/vsh/config.cfg");

char *buf = (char *)Utils_SceMalloc(128);
SceInt len = snprintf(buf, 128, menuConfig, batteryPercent, batteryLifeTime, batteryTemp, colour);
SceInt len = sceClibSnprintf(buf, 128, menuConfig, batteryPercent, batteryLifeTime, batteryTemp, colour);

if (R_FAILED(ret = FS_WriteFile(menu_config_path, buf, len)))
{
Expand All @@ -49,10 +49,10 @@ SceInt Config_SaveClockConfig(int cpuClock, int gpuClock)
SceInt ret = 0;

char *game_config_path = (char *)Utils_SceMalloc(35);
snprintf(game_config_path, 35, "ur0:/data/vsh/titles/%s.cfg", titleID);
sceClibSnprintf(game_config_path, 35, "ur0:/data/vsh/titles/%s.cfg", titleID);

char *buf = (char *)Utils_SceMalloc(64);
SceInt len = snprintf(buf, 64, clockConfig, cpuClock, gpuClock);
SceInt len = sceClibSnprintf(buf, 64, clockConfig, cpuClock, gpuClock);

if (R_FAILED(ret = FS_WriteFile(game_config_path, buf, len)))
{
Expand All @@ -71,23 +71,23 @@ static SceInt Config_SaveLauncherConfig()
SceInt ret = 0;

char *launcher_config_path = (char *)Utils_SceMalloc(27);
snprintf(launcher_config_path, 27, "ur0:/data/vsh/launcher.cfg");
sceClibSnprintf(launcher_config_path, 27, "ur0:/data/vsh/launcher.cfg");

char *buf = (char *)Utils_SceMalloc(256);

// set these to the following by default:
snprintf(app_title[0], 9, "Settings");
snprintf(app_titleID[0], 14, "settings_dlg:");
snprintf(app_title[1], 10, "VitaShell");
snprintf(app_titleID[1], 10, "VITASHELL");
snprintf(app_title[2], 11, "Adrenaline");
snprintf(app_titleID[2], 10, "PSPEMUCFW");
snprintf(app_title[3], 5, "VHBB");
snprintf(app_titleID[3], 10, "VHBB00001");
snprintf(app_title[4], 10, "VITAident");
snprintf(app_titleID[4], 10, "VID000162");

SceInt len = snprintf(buf, 256, launcherConfig, app_title[0], app_titleID[0], app_title[1], app_titleID[1],
sceClibSnprintf(app_title[0], 9, "Settings");
sceClibSnprintf(app_titleID[0], 14, "settings_dlg:");
sceClibSnprintf(app_title[1], 10, "VitaShell");
sceClibSnprintf(app_titleID[1], 10, "VITASHELL");
sceClibSnprintf(app_title[2], 11, "Adrenaline");
sceClibSnprintf(app_titleID[2], 10, "PSPEMUCFW");
sceClibSnprintf(app_title[3], 5, "VHBB");
sceClibSnprintf(app_titleID[3], 10, "VHBB00001");
sceClibSnprintf(app_title[4], 10, "VITAident");
sceClibSnprintf(app_titleID[4], 10, "VID000162");

SceInt len = sceClibSnprintf(buf, 256, launcherConfig, app_title[0], app_titleID[0], app_title[1], app_titleID[1],
app_title[2], app_titleID[2], app_title[3], app_titleID[3], app_title[4], app_titleID[4]);

if (R_FAILED(ret = FS_WriteFile(launcher_config_path, buf, len)))
Expand All @@ -110,9 +110,9 @@ SceInt Config_LoadConfig(SceVoid)
char *menu_config_path = (char *)Utils_SceMalloc(25);
char *launcher_config_path = (char *)Utils_SceMalloc(27);

snprintf(game_config_path, 35, "ur0:/data/vsh/titles/%s.cfg", titleID);
snprintf(menu_config_path, 25, "ur0:/data/vsh/config.cfg");
snprintf(launcher_config_path, 27, "ur0:/data/vsh/launcher.cfg");
sceClibSnprintf(game_config_path, 35, "ur0:/data/vsh/titles/%s.cfg", titleID);
sceClibSnprintf(menu_config_path, 25, "ur0:/data/vsh/config.cfg");
sceClibSnprintf(launcher_config_path, 27, "ur0:/data/vsh/launcher.cfg");

if (!(FS_FileExists(game_config_path)))
{
Expand Down
2 changes: 1 addition & 1 deletion source/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ SceInt Utils_LaunchAppByUriExit(char *titleid)

if (strlen(titleid) == 9) // Game or App titleID
{
sprintf(uri, "psgm:play?titleid=%s", titleid);
sceClibPrintf(uri, "psgm:play?titleid=%s", titleid);

if (R_FAILED(ret = sceAppMgrLaunchAppByUri(0xFFFFF, uri)))
return ret;
Expand Down

0 comments on commit 431c3ac

Please sign in to comment.