Fixed updater

This commit is contained in:
TheFloW 2018-03-14 17:11:55 +01:00
parent 2b25f22635
commit 0df158b2b7
11 changed files with 123 additions and 487 deletions

1
.gitignore vendored
View File

@ -7,5 +7,4 @@
*.elf *.elf
*.sfo *.sfo
*.velf *.velf
*.vpk
build build

View File

@ -107,6 +107,10 @@ Credits
Changelog Changelog
--------- ---------
### Changelog 1.83
- Fixed automatic network update by using rawgit. This was needed because github removed support for TLS 1.0/1.1.
- Removed changelog support, because the files at ux0:patch must now be pfs encrypted.
### Changelog 1.82 ### Changelog 1.82
- Added support for firmware 3.65/3.67. - Added support for firmware 3.65/3.67.

9
init.c
View File

@ -83,8 +83,6 @@ INCLUDE_EXTERN_RESOURCE(kernel_skprx);
INCLUDE_EXTERN_RESOURCE(umass_skprx); INCLUDE_EXTERN_RESOURCE(umass_skprx);
INCLUDE_EXTERN_RESOURCE(patch_skprx); INCLUDE_EXTERN_RESOURCE(patch_skprx);
INCLUDE_EXTERN_RESOURCE(changeinfo_txt);
#define DEFAULT_FILE(path, name, replace) { path, (void *)&_binary_resources_##name##_start, (int)&_binary_resources_##name##_size, replace } #define DEFAULT_FILE(path, name, replace) { path, (void *)&_binary_resources_##name##_start, (int)&_binary_resources_##name##_size, replace }
static DefaultFile default_files[] = { static DefaultFile default_files[] = {
@ -144,8 +142,6 @@ static DefaultFile default_files[] = {
DEFAULT_FILE("ux0:VitaShell/module/kernel.skprx", kernel_skprx, 1), DEFAULT_FILE("ux0:VitaShell/module/kernel.skprx", kernel_skprx, 1),
DEFAULT_FILE("ux0:VitaShell/module/umass.skprx", umass_skprx, 1), DEFAULT_FILE("ux0:VitaShell/module/umass.skprx", umass_skprx, 1),
DEFAULT_FILE("ux0:VitaShell/module/patch.skprx", patch_skprx, 1), DEFAULT_FILE("ux0:VitaShell/module/patch.skprx", patch_skprx, 1),
DEFAULT_FILE("ux0:patch/VITASHELL/sce_sys/changeinfo/changeinfo.xml", changeinfo_txt, 1),
}; };
char vitashell_titleid[12]; char vitashell_titleid[12];
@ -307,11 +303,6 @@ void installDefaultFiles() {
sceIoMkdir("ux0:VitaShell/theme/Default", 0777); sceIoMkdir("ux0:VitaShell/theme/Default", 0777);
sceIoMkdir("ux0:VitaShell/theme/Electron", 0777); sceIoMkdir("ux0:VitaShell/theme/Electron", 0777);
sceIoMkdir("ux0:patch", 0006);
sceIoMkdir("ux0:patch/VITASHELL", 0006);
sceIoMkdir("ux0:patch/VITASHELL/sce_sys", 0006);
sceIoMkdir("ux0:patch/VITASHELL/sce_sys/changeinfo", 0006);
// Write default files if they don't exist // Write default files if they don't exist
int i; int i;
for (i = 0; i < (sizeof(default_files) / sizeof(DefaultFile)); i++) { for (i = 0; i < (sizeof(default_files) / sizeof(DefaultFile)); i++) {

4
main.c
View File

@ -276,6 +276,9 @@ static void refreshCopyList() {
static int handleFile(const char *file, FileListEntry *entry) { static int handleFile(const char *file, FileListEntry *entry) {
int res = 0; int res = 0;
// try to fix GPU freeze
vita2d_wait_rendering_done();
int type = getFileType(file); int type = getFileType(file);
switch (type) { switch (type) {
@ -1152,6 +1155,7 @@ static int dialogSteps() {
case DIALOG_STEP_EXTRACTED: case DIALOG_STEP_EXTRACTED:
{ {
removePath("ux0:patch/VITASHELL", NULL);
launchAppByUriExit("VSUPDATER"); launchAppByUriExit("VSUPDATER");
setDialogStep(DIALOG_STEP_NONE); setDialogStep(DIALOG_STEP_NONE);
break; break;

2
main.h
View File

@ -53,7 +53,7 @@
// VitaShell version major.minor // VitaShell version major.minor
#define VITASHELL_VERSION_MAJOR 0x01 #define VITASHELL_VERSION_MAJOR 0x01
#define VITASHELL_VERSION_MINOR 0x82 #define VITASHELL_VERSION_MINOR 0x83
#define VITASHELL_VERSION ((VITASHELL_VERSION_MAJOR << 0x18) | (VITASHELL_VERSION_MINOR << 0x10)) #define VITASHELL_VERSION ((VITASHELL_VERSION_MAJOR << 0x18) | (VITASHELL_VERSION_MINOR << 0x10))

Binary file not shown.

View File

@ -1,360 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<changeinfo>
<changes app_ver="00.10">
<![CDATA[
- Initial release.<br>
]]>
</changes>
<changes app_ver="00.20">
<![CDATA[
- Added ability to sign PSP homebrews.<br>
- Added sleep prevention when using FTP, deleting and copying files.<br>
- Added a scrollbar.<br>
- Added date and time to info bar.<br>
- Added correct enter and cancel buttons assignment.<br>
- Added some cosmetic changes.<br>
- Fixed crash when deleting marked entries.<br>
- Copied entries now still rest in clipboard after pasting them.<br>
- The application now cleans itself before launching homebrews.<br>
]]>
</changes>
<changes app_ver="00.30">
<![CDATA[
- Added translation support. See translation_readme.txt for more details.<br>
- Added move ability (only possible within same partition).<br>
- Added tabulator support in text viewer.<br>
- Removed `Paste`, `Delete`, `Rename` and `New folder` in read-only partitions.<br>
- Fixed size string of files over 1GB.<br>
- Fixed alphabetical sorting.<br>
- Fixed battery percent bug being -1% on PSM Dev Assistant.<br>
]]>
</changes>
<changes app_ver="00.40">
<![CDATA[
- Added experimental feature: Holding START to force exit homebrews.<br>
- Added battery symbol by Ruben_Wolf.<br>
- Switched to official PGF font.<br>
- Changed triangle-menu animation to ease-out.<br>
- Improved mark all/unmark all feature.<br>
- Fixed percentage precision in progress bar.<br>
- Fixed small bug in move operation.<br>
]]>
</changes>
<changes app_ver="00.50">
<![CDATA[
- Increased homebrew force-exit compatbility and stability.<br>
- Added network host mountpoint.<br>
- Added ability to compile shader programs (use the _v.cg suffix for vertexes and _f.cg for fragments).<br>
- Finished photo viewer. Use the right analog stick to zoom in/out. Left analog stick to move.<br>
L/R to rotate and X/O to change display mode.<br>
- Updated to newest vita2dlib which fixed many bugs with images.<br>
- Improved `New folder` by extending to `New folder (X)`, where `X` is an increasing number.<br>
- Improved message dialog texts.<br>
- Limited filenames so it doesn't overlap with the size/folder text. <br>
- Fixed infinite loop when copying the src to its subfolder by an error result.<br>
- Fixed FTP client crashes and added support for Turboclient Android.<br>
- Fixed alphabetical sorting, finally.<br>
]]>
</changes>
<changes app_ver="00.60">
<![CDATA[
- Fixed size string of files, again.<br>
- Optimized I/O operations regarding speed.<br>
]]>
</changes>
<changes app_ver="00.70">
<![CDATA[
- Ported to HENkaku (support for renaming/creating folders and for analog stick for fast movement).<br>
- Added custom dialogs.<br>
- Added graphics by Freakler.<br>
- Added possibility to use FTP in background.<br>
- I/O operations can now be canceled.<br>
- Removed misc stuff, shader compiler, homebrew loading, PBOOT.PBP signing, network host.<br>
- Fixed various bugs.<br>
]]>
</changes>
<changes app_ver="00.80">
<![CDATA[
- Added support for >2GB zip archives (dropped support for 7zip and rar though).<br>
- Added cache system for zipfs (faster file reading when browsing in zip archives).<br>
- Added possibility to customize the application's UI.<br>
- Added possibility to translate the application.<br>
- Fixed 12h time conversion.<br>
]]>
</changes>
<changes app_ver="00.85">
<![CDATA[
- Added customization possibility for ftp icon, battery, dialog and context menu.<br>
- Added random wallpaper feature.<br>
- Changed location of themes to `ux0:VitaShell/theme/YOUR_THEME_NAME`.<br>
- Fixed russian and korean language support.<br>
]]>
</changes>
<changes app_ver="00.86">
<![CDATA[
- Added dialog box animation and aligned dialog box y to make it look better.<br>
- Fixed wrong time string for files and folders. Thanks to persona5.<br>
- Fixed INSTALL_WARNING text crash.<br>
- Added default files creating.<br>
]]>
</changes>
<changes app_ver="00.90">
<![CDATA[
- Added possibility to use specific background for file browser, hex editor, text editor, photo viewer.<br>
- Added files and folder icons by littlebalup.<br>
- Added charging battery icon by ribbid987.<br>
- Added sfo reader by theorywrong.<br>
- Added translation support for turkish (english_gb uses the same id as turkish, fix it Sony!).<br>
- Fixed bug where copied files and folders of archives didn't stay on clipboard.<br>
- Allow auto screen-off.<br>
- System information trigger combo changed to START instead of L+R+START. System information can now also be translated, thanks to littlebalup.<br>
]]>
</changes>
<changes app_ver="00.91">
<![CDATA[
- Added automatic network update. VitaShell will now notify you when there's a new update.<br>
You'll then be able to download it within the VitaShell application and it will update both<br>
molecularShell and VitaShell to the newest verison.<br>
- Added text and audio file icon by littlebalup.<br>
- Updated to latest libftpvita which fixed file size string > 2GB and added APPE command.<br>
]]>
</changes>
<changes app_ver="00.95">
<![CDATA[
- Added ability to install update files as .vpk (for Vitamin).<br>
- Added patch to make .vpk installation appearing as full version instead of test version.<br>
- Added text editor by BigBoot (WIP).<br>
- Added `More` entry to the context menu.<br>
- Added `Install all` feature to install all packages available in the folder (by ribbid987).<br>
- Added `Calculate SHA1` feature by xerpia64.<br>
- Added support for ftp promoting for https://github.com/soywiz/vitaorganizer.<br>
- Fixed `Move` operation. Now it does integrate into folders and replace files.<br>
- Dropped GENERAL_COLOR, now all colors are adjustable.<br>
]]>
</changes>
<changes app_ver="01.00">
<![CDATA[
- Added audio player with .MP3 and .OGG support (Press /\ to turn off the display while listening to music. Graphics by Valle).<br>
- Added changelog to the VitaShell bubble (press /\ or hold the bubble of VitaShell in the livearea).<br>
- Added ability to resume to the directory you've last visted before exiting VitaShell).<br>
- Added memory card free space check. A message will pop up if you don't have enough free space for copying or installing.<br>
- Leaving to livearea or suspending the device does now no longer corrupt an IO process anymore (while copying things you can leave now VitaShell and resume).<br>
- Improved text editor and added search feature to context menu (press /\).<br>
- The temporary folder `ptmp/pkg` is now cleared after cancelling or unsuccesful installation.<br>
- Fixed bug where copying to different partitions didn't work.<br>
- Fixed network update bug.<br>
]]>
</changes>
<changes app_ver="01.10">
<![CDATA[
- Added cover.jpg and folder.jpg as alternative cover image.<br>
- Fixed ID3 tag parsing.<br>
- Play and pause icons where swapped, fixed.<br>
- FTP does now show `Please wait...` until it has been connected to Wi-Fi.<br>
]]>
</changes>
<changes app_ver="01.20">
<![CDATA[
- Added ability to export photo and music files (`More` -> `Export media`).<br>
- Added battery percentage to system information (thanks to littlebalup).<br>
- Added toolbox where more features will have place, by theorywrong (press START).<br>
- Improved stability for file browser delete operation.<br>
- Pressing L in the music player will now restart the song if the song is not at the beginning.<br>
- VitaShell will now remove the unused updater bubble after successful updating.<br>
]]>
</changes>
<changes app_ver="01.30">
<![CDATA[
- Added ability to compress files and folders into a zip archive.<br>
- Added scanning for unsafe fself's and imports.<br>
- Added lrc support for audio player by Mayoshiroi.<br>
- Added partition used/total size information, thanks to littlebalup.<br>
- Added `Install folder` by soarqin.<br>
]]>
</changes>
<changes app_ver="01.31">
<![CDATA[
- Touching the screen on dialogs would abort the process, fixed.<br>
]]>
</changes>
<changes app_ver="01.40">
<![CDATA[
- Added group RW permissions on files and folders when moving.<br>
Safe homebrews like RetroArch will now recognize files and folders<br>
that you have moved from `ux0:video`.<br>
- Added scanning for dangerous functions in packages.<br>
- Added possibility to choose compression level.<br>
- Fixed time information in zip archives.<br>
]]>
</changes>
<changes app_ver="01.41">
<![CDATA[
- Added ability to sort files and folders by size and date. Press R to switch sort method.<br>
- Added the long desired `Properties` feature. You can also check whether an eboot.bin is safe or not.<br>
]]>
</changes>
<changes app_ver="01.42">
<![CDATA[
- Added a brand new settings menu which is accessible by pressing START (design by WesleyPolicena).<br>
This adds the ability to disable auto-update and power options have been added where you can<br>
reboot, enter standby or turn off your device.<br>
- Fixed local date being incorrect.<br>
- The name `molecularShell` will now be displayed if it's runned as molecularShell, otherwise `VitaShell`.<br>
This will help differentiating the two applications, as molecularShell is from now on a safe homebrew<br>
and doesn't have the full range of features like VitaShell. Additionally in molecularShell you can see<br>
the HENkaku settings section which are hidden in VitaShell (note that both still share the same eboot.bin,<br>
only the flag is different).<br>
]]>
</changes>
<changes app_ver="01.43">
<![CDATA[
- Added taiHEN config.txt reload option available in molecularShell.<br>
- Changed default HENkaku spoofed version to 3.63.<br>
- Fixed bug where you couldn't exit the application.<br>
]]>
</changes>
<changes app_ver="01.50">
<![CDATA[
- Added USB mass storage transfer support.<br>
- Added RAR archive support (by Mayoshiroi).<br>
- Added coredump viewer.<br>
]]>
</changes>
<changes app_ver="01.51">
<![CDATA[
- Fixed bug where `Please wait...` was shown instead of a specifc USB message.<br>
- Fixed VPK installation crash.<br>
- Fixed bug where `theme.txt` was always resetted.<br>
- Updated to newest libftpvita.<br>
]]>
</changes>
<changes app_ver="01.60">
<![CDATA[
- Added ability to mount uma0: and ability to use uma0: as ux0:.<br>
- Added ability to mount game card as usb device.<br>
- Added possibility to refresh the livearea.<br>
- Added scrolling text for long filenames.<br>
- Added `Sort by` option to context menu (R trigger combo removed).<br>
- Added `Electron` theme by Acemad, the winner of the VitaShell theme contest.<br>
- Added theme selector.<br>
- Improved property dialog animation.<br>
- Fixed text editor bugs.<br>
- Fixed bug where USB cable wasn't recognized.<br>
- Fixed bug where VitaShell left to livearea after deleting the updater.<br>
- Removed battery icon in status bar for PSTV.<br>
- File statistics are now inherited when copying.<br>
- I/O operations speed will now be showed in KB/s.<br>
- Made control smoother.<br>
]]>
</changes>
<changes app_ver="01.61">
<![CDATA[
- Fixed database corruption crash by inheriting `calendar`, `mms` and `mtp` when mounting USB ux0:.<br>
- Fixed bug where insufficent memory dialog appeared on uma0:.<br>
- Fixed bug where pressing triangle crashed if unsafe mode was disabled.<br>
]]>
</changes>
<changes app_ver="01.62">
<![CDATA[
- Fixed bug where the cursor was moving too fast when the headphone was plugged in.<br>
]]>
</changes>
<changes app_ver="01.63">
<![CDATA[
- Added ability to export video files.<br>
- Added support for PSVSD uma0: mounting.<br>
- Fixed bug where the right analog stick was simulated when the headphone was plugged in.<br>
]]>
</changes>
<changes app_ver="01.70">
<![CDATA[
- Added QR Code scanner and file downloader by cxziaho (press L+R to open the camera).<br>
- Added option in `More->` to open applications in decrypted mode (bypass PFS). Thanks to frangarcj.<br>
- Added ability to mount sd2vita and psvsd as usb device.<br>
- Fixed bug where `imc0:` could not be mounted if the Memory Card was not available.<br>
- Fixed bug where accessing the settings menu crashed if there was no Memory Card available.<br>
- Fixed bug where automatic usb connection was not blocked, after leaving and resuming VitaShell.<br>
- PS TV will now always open FTP when pressing SELECT.<br>
]]>
</changes>
<changes app_ver="01.71">
<![CDATA[
- Fixed pvsd usb device mounting.<br>
- Fixed bug where uma0: options were grayed out on non PS TV models.<br>
- Fixed bug where the QR code scanner showed the result twice.<br>
]]>
</changes>
<changes app_ver="01.72">
<![CDATA[
- Fixed pfs mounting bug where you could not export files from specific folders.<br>
- Fixed bug where files from https could not be downloaded using QR code.<br>
- Fixed bug with pvsd usb device mounting where microSD could not be found.<br>
]]>
</changes>
<changes app_ver="01.73">
<![CDATA[
- Fixed crash when you pressed triangle in the home menu.<br>
]]>
</changes>
<changes app_ver="01.74">
<![CDATA[
- Fixed QR download and C2-13696-5 error.<br>
]]>
</changes>
<changes app_ver="01.75">
<![CDATA[
- Fixed bug where Memory Card was umounted after closing USB (fixed `The file is corrupt` error).<br>
- Fixed QR download of URLs that link to files.<br>
]]>
</changes>
<changes app_ver="01.76">
<![CDATA[
- Added DLC refresh + restore license from Sqlite DB by VitaSmith.<br>
- Added license database refresh by VitaSmith.<br>
- Fixed C2-12828-1 error.<br>
]]>
</changes>
<changes app_ver="01.77">
<![CDATA[
- Added archive support for .7z, .tar.gz, .tar.bz2 and more by using libarchive.<br>
- Improved archive file system (opening archives should now be much faster).<br>
- Fixed keyboard freeze after using it multiple times.<br>
- Fixed file browser cursor correction.<br>
- Fixed Electron theme visual glitch and added new settings look (thanks to Acemad).<br>
]]>
</changes>
<changes app_ver="01.78">
<![CDATA[
- Fixed bug where archives > 2GB couldn't be opened.<br>
]]>
</changes>
<changes app_ver="01.79">
<![CDATA[
- Added ability to open .psarc files.<br>
- Added support for multi volume rar archives.<br>
- Added support for password encrypted zip archives.<br>
- Added support for file property in archives, now it can show size and contains.<br>
- Added natural sorting for filenames.<br>
- Fixed bug where size of files in archives over 2GB where shown as 16EB.<br>
- Fixed refresh license DB when ran from ur0:.<br>
]]>
</changes>
<changes app_ver="01.80">
<![CDATA[
- Aligned memory to 64bit for optimal I/O.<br>
- Fixed crash when using FTP.<br>
]]>
</changes>
<changes app_ver="01.81">
<![CDATA[
- Added adhoc file transfer feature.<br>
- Fixed bug where it didn't count files and folders in archives correctly.<br>
- Improved controls code.<br>
]]>
</changes>
<changes app_ver="01.82">
<![CDATA[
- Added support for firmware 3.65/3.67.<br>
]]>
</changes>
</changeinfo>

Binary file not shown.

View File

@ -1,19 +1,19 @@
/* /*
VitaShell VitaShell
Copyright (C) 2015-2018, TheFloW Copyright (C) 2015-2018, TheFloW
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <psp2/appmgr.h> #include <psp2/appmgr.h>
@ -31,138 +31,140 @@
#define HEAD_BIN PACKAGE_DIR "/sce_sys/package/head.bin" #define HEAD_BIN PACKAGE_DIR "/sce_sys/package/head.bin"
typedef struct SfoHeader { typedef struct SfoHeader {
uint32_t magic; uint32_t magic;
uint32_t version; uint32_t version;
uint32_t keyofs; uint32_t keyofs;
uint32_t valofs; uint32_t valofs;
uint32_t count; uint32_t count;
} __attribute__((packed)) SfoHeader; } __attribute__((packed)) SfoHeader;
typedef struct SfoEntry { typedef struct SfoEntry {
uint16_t nameofs; uint16_t nameofs;
uint8_t alignment; uint8_t alignment;
uint8_t type; uint8_t type;
uint32_t valsize; uint32_t valsize;
uint32_t totalsize; uint32_t totalsize;
uint32_t dataofs; uint32_t dataofs;
} __attribute__((packed)) SfoEntry; } __attribute__((packed)) SfoEntry;
int launchAppByUriExit(char *titleid) { int launchAppByUriExit(char *titleid) {
char uri[32]; char uri[32];
sprintf(uri, "psgm:play?titleid=%s", titleid); sprintf(uri, "psgm:play?titleid=%s", titleid);
sceKernelDelayThread(10000); sceAppMgrLaunchAppByUri(0xFFFFF, uri);
sceAppMgrLaunchAppByUri(0xFFFFF, uri); sceKernelExitProcess(0);
sceKernelDelayThread(10000);
sceAppMgrLaunchAppByUri(0xFFFFF, uri);
sceKernelExitProcess(0); return 0;
return 0;
} }
void loadScePaf() { static int loadScePaf() {
uint32_t ptr[0x100] = { 0 }; static uint32_t argp[] = { 0x180000, -1, -1, 1, -1, -1 };
ptr[0] = 0;
ptr[1] = (uint32_t)&ptr[0]; int result = -1;
uint32_t scepaf_argp[] = { 0x400000, 0xEA60, 0x40000, 0, 0 };
sceSysmoduleLoadModuleInternalWithArg(0x80000008, sizeof(scepaf_argp), scepaf_argp, ptr); uint32_t buf[4];
buf[0] = sizeof(buf);
buf[1] = (uint32_t)&result;
buf[2] = -1;
buf[3] = -1;
return sceSysmoduleLoadModuleInternalWithArg(SCE_SYSMODULE_INTERNAL_PAF, sizeof(argp), argp, buf);
} }
int promote(char *path) { static int unloadScePaf() {
int res; uint32_t buf = 0;
return sceSysmoduleUnloadModuleInternalWithArg(SCE_SYSMODULE_INTERNAL_PAF, 0, NULL, &buf);
}
loadScePaf(); int promoteApp(const char *path) {
int res;
res = sceSysmoduleLoadModuleInternal(SCE_SYSMODULE_PROMOTER_UTIL); res = loadScePaf();
if (res < 0) if (res < 0)
return res; return res;
res = scePromoterUtilityInit(); res = sceSysmoduleLoadModuleInternal(SCE_SYSMODULE_INTERNAL_PROMOTER_UTIL);
if (res < 0) if (res < 0)
return res; return res;
res = scePromoterUtilityPromotePkg(path, 0); res = scePromoterUtilityInit();
if (res < 0) if (res < 0)
return res; return res;
int state = 0; res = scePromoterUtilityPromotePkgWithRif(path, 1);
do { if (res < 0)
res = scePromoterUtilityGetState(&state); return res;
if (res < 0)
return res;
sceKernelDelayThread(100 * 1000); res = scePromoterUtilityExit();
} while (state); if (res < 0)
return res;
int result = 0; res = sceSysmoduleUnloadModuleInternal(SCE_SYSMODULE_INTERNAL_PROMOTER_UTIL);
res = scePromoterUtilityGetResult(&result); if (res < 0)
if (res < 0) return res;
return res;
res = scePromoterUtilityExit(); res = unloadScePaf();
if (res < 0) if (res < 0)
return res; return res;
res = sceSysmoduleUnloadModuleInternal(SCE_SYSMODULE_PROMOTER_UTIL); return res;
if (res < 0)
return res;
return result;
} }
char *get_title_id(const char *filename) { char *get_title_id(const char *filename) {
char *res = NULL; char *res = NULL;
long size = 0; long size = 0;
FILE *fin = NULL; FILE *fin = NULL;
char *buf = NULL; char *buf = NULL;
int i; int i;
SfoHeader *header; SfoHeader *header;
SfoEntry *entry; SfoEntry *entry;
fin = fopen(filename, "rb"); fin = fopen(filename, "rb");
if (!fin) if (!fin)
goto cleanup; goto cleanup;
if (fseek(fin, 0, SEEK_END) != 0) if (fseek(fin, 0, SEEK_END) != 0)
goto cleanup; goto cleanup;
if ((size = ftell(fin)) == -1) if ((size = ftell(fin)) == -1)
goto cleanup; goto cleanup;
if (fseek(fin, 0, SEEK_SET) != 0) if (fseek(fin, 0, SEEK_SET) != 0)
goto cleanup; goto cleanup;
buf = calloc(1, size + 1); buf = calloc(1, size + 1);
if (!buf) if (!buf)
goto cleanup; goto cleanup;
if (fread(buf, size, 1, fin) != 1) if (fread(buf, size, 1, fin) != 1)
goto cleanup; goto cleanup;
header = (SfoHeader*)buf; header = (SfoHeader*)buf;
entry = (SfoEntry*)(buf + sizeof(SfoHeader)); entry = (SfoEntry*)(buf + sizeof(SfoHeader));
for (i = 0; i < header->count; ++i, ++entry) { for (i = 0; i < header->count; ++i, ++entry) {
const char *name = buf + header->keyofs + entry->nameofs; const char *name = buf + header->keyofs + entry->nameofs;
const char *value = buf + header->valofs + entry->dataofs; const char *value = buf + header->valofs + entry->dataofs;
if (name >= buf + size || value >= buf + size) if (name >= buf + size || value >= buf + size)
break; break;
if (strcmp(name, "TITLE_ID") == 0) if (strcmp(name, "TITLE_ID") == 0)
res = strdup(value); res = strdup(value);
} }
cleanup: cleanup:
if (buf) if (buf)
free(buf); free(buf);
if (fin) if (fin)
fclose(fin); fclose(fin);
return res; return res;
} }
int main(int argc, const char *argv[]) { int main(int argc, const char *argv[]) {
char *titleid = get_title_id(PACKAGE_DIR "/sce_sys/param.sfo"); // Destroy other apps
if (titleid && strcmp(titleid, "VITASHELL") == 0) { sceAppMgrDestroyOtherApp();
promote(PACKAGE_DIR);
}
launchAppByUriExit("VITASHELL"); char *titleid = get_title_id(PACKAGE_DIR "/sce_sys/param.sfo");
if (titleid && strcmp(titleid, "VITASHELL") == 0) {
promoteApp(PACKAGE_DIR);
}
return 0; launchAppByUriExit("VITASHELL");
return 0;
} }

Binary file not shown.

View File

@ -400,11 +400,7 @@ int launchAppByUriExit(const char *titleid) {
char uri[32]; char uri[32];
snprintf(uri, sizeof(uri), "psgm:play?titleid=%s", titleid); snprintf(uri, sizeof(uri), "psgm:play?titleid=%s", titleid);
sceKernelDelayThread(10000);
sceAppMgrLaunchAppByUri(0xFFFFF, uri); sceAppMgrLaunchAppByUri(0xFFFFF, uri);
sceKernelDelayThread(10000);
sceAppMgrLaunchAppByUri(0xFFFFF, uri);
sceKernelExitProcess(0); sceKernelExitProcess(0);
return 0; return 0;