Running on recovery mode

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
manatails007
Posts: 13
Joined: Wed Mar 05, 2008 10:34 pm

Running on recovery mode

Post by manatails007 »

What should I do if I want to run my app on recovery mode?
I put my app to ms0:/PSP/GAME/RECOVERY/ but it wont start....

I use PSP_MODULE_INFO("manatails007", 0x1000, 1, 0)
Last edited by manatails007 on Thu Feb 05, 2009 1:23 am, edited 1 time in total.
ctszy
Posts: 18
Joined: Sat Apr 12, 2008 11:18 pm

Post by ctszy »

\PSP\GAME\RECOVERY\ is for
"Run program at /PSP/GAME/RECOVERY/EBOOT.PBP" in recovery mode.

well I think there is no "common" way to run a prx in recovery mode. maybe you can do some replacement to solve this (for example, replace the recovery.prx with yours and then load it in your prx?).

Also, why would you want to do so ? :)
manatails007
Posts: 13
Joined: Wed Mar 05, 2008 10:34 pm

Post by manatails007 »

I'm coding pspbtcnf flasher. But after flashing bin files. PSP is bricked. :/ I checked flash0 with recovery mode but there was nothing wrong with bin files. So I'm trying to flash pspbtcnf bin files before firmware loads up and see what happens. So I'm using recovery mode to do that but my app doesn't load
Bubbletune
Posts: 22
Joined: Sat Jan 03, 2009 6:51 am

Post by Bubbletune »

Your main application can't be kernel mode, only back in 1.50. Change it to usermode, and load iop.prx (included in most of Dax's releases, eg. LEDA) from the main application to be granted write access to the flash0 from user mode.
User avatar
Torch
Posts: 825
Joined: Wed May 28, 2008 2:50 am

Post by Torch »

Or simple make it VSH mode 0x800 if you don't want iop.prx.
Bubbletune
Posts: 22
Joined: Sat Jan 03, 2009 6:51 am

Post by Bubbletune »

Torch wrote:Or simple make it VSH mode 0x800 if you don't want iop.prx.
Your PBP needs to be started in updater mode for this to work, which the recovery doesn't do (and neither does the VSH if it's not in the UPDATE folder)..
User avatar
Torch
Posts: 825
Joined: Wed May 28, 2008 2:50 am

Post by Torch »

But he doesn't need to use recovery. I'm guessing he just asked about launching from recovery because he couldn't get it to work normally launching from the VSH without the 0x800 flags.

Updater mode is not required. I have a PBP sitting right here that can write to flash0 from any folder under PSP/GAME, not UPDATE. The PRX in it is 0x800. In fact it DOESN'T launch from UPDATE.

Besides, he said his application bricked his PSP, which means it actually ran, so it must have been a kernel ELF in the PBP. I'm guessing that the pspbtcnf file he flashed was corrupted.
User avatar
Torch
Posts: 825
Joined: Wed May 28, 2008 2:50 am

Post by Torch »

You can get flash0 access by launching from XMB like this:
(I wonder if it will cause problems with non-DC installed firmware that don't have 0777 stats on files you want to overwrite. But in your case the btcnf files should be 0777 set by the M33 installer anyway.)

Code: Select all

#include <pspkernel.h>
#include <string.h>
#include <pspdebug.h>
#define printf pspDebugScreenPrintf

PSP_MODULE_INFO&#40;"flash0w", 0x800, 1, 0&#41;;
PSP_MAIN_THREAD_ATTR&#40;PSP_THREAD_ATTR_VSH&#41;;
PSP_HEAP_SIZE_KB&#40;2048&#41;;

int exit_callback&#40;&#41;
&#123;
  sceKernelExitGame&#40;&#41;;

  return 0;
&#125;

int CallbackThread&#40;SceSize args, void *argp&#41;
&#123;
  int cbid;

  cbid = sceKernelCreateCallback&#40;"Exit Callback", exit_callback, NULL&#41;;
  sceKernelRegisterExitCallback&#40;cbid&#41;;

  sceKernelSleepThreadCB&#40;&#41;;

  return 0;
&#125;

int SetupCallbacks&#40;void&#41;
&#123;
  int thid = 0;

  thid = sceKernelCreateThread&#40;"update_thread", CallbackThread, 0x11, 0xFA0, 0, 0&#41;;
  if&#40;thid >= 0&#41;
    &#123;
      sceKernelStartThread&#40;thid, 0, 0&#41;;
    &#125;

  return thid;
&#125;

int main&#40;int argc, char* argv&#91;&#93;&#41;
&#123;
	SetupCallbacks&#40;&#41;;
	pspDebugScreenInit&#40;&#41;;
	
	char text&#91;&#93; = "this is a test file";
	int result;
	result = sceIoUnassign&#40;"flash0&#58;"&#41;;
	
	if&#40;result < 0&#41;
	&#123;
		printf&#40;"\nError in unassign flash0."&#41;;
	&#125;
	else
	&#123;
		result = sceIoAssign&#40;"flash0&#58;", "lflash0&#58;0,0", "flashfat0&#58;", IOASSIGN_RDWR, NULL, 0&#41;;
		if&#40;result < 0&#41;
		&#123;
			printf&#40;"\nError in assigning flash0 for write."&#41;;
		&#125;
		else
		&#123;
			SceUID fp;
			fp = sceIoOpen&#40;"flash0&#58;/test.txt", PSP_O_WRONLY|PSP_O_TRUNC|PSP_O_CREAT, 0777&#41;;
			
			if&#40;fp < 0&#41;
			&#123;
				printf&#40;"\nError writing flash0&#58;/test.txt."&#41;;
			&#125;
			else
			&#123;
				sceIoWrite&#40;fp, &text, strlen&#40;text&#41;&#41;;
				sceIoClose&#40;fp&#41;;
				printf&#40;"\ntest.txt written successfully."&#41;;
			&#125;
		&#125;
	&#125;
	sceKernelSleepThread&#40;&#41;;
	
	return 0;
&#125;

Code: Select all

TARGET = flash0w
OBJS = main.o

INCDIR =
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $&#40;CFLAGS&#41; -fno-exceptions -fno-rtti
ASFLAGS = $&#40;CFLAGS&#41;

BUILD_PRX = 1
PRX_EXPORTS =

#USE_KERNEL_LIBC=1
#USE_KERNEL_LIBS=1

PSP_FW_VERSION = 380
PSP_LARGE_MEMORY = 0

LIBDIR =
LIBS =
LDFLAGS =

EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = flash0
#PSP_EBOOT_ICON="icon0.png"
#PSP_EBOOT_PIC1="pic1.png"
#PSP_EBOOT_SND0="snd0.at3"

PSPSDK=$&#40;shell psp-config --pspsdk-path&#41;
include $&#40;PSPSDK&#41;/lib/build.mak
manatails007
Posts: 13
Joined: Wed Mar 05, 2008 10:34 pm

Post by manatails007 »

I got no problems accessing flash0 but flashing pspbtcnf bin files bricks up the psp
Post Reply