forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Running on recovery mode

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
manatails007



Joined: 05 Mar 2008
Posts: 13

PostPosted: Wed Feb 04, 2009 11:42 am    Post subject: Running on recovery mode Reply with quote

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
Back to top
View user's profile Send private message
ctszy



Joined: 12 Apr 2008
Posts: 18

PostPosted: Wed Feb 04, 2009 12:33 pm    Post subject: Reply with quote

\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 ? :)
Back to top
View user's profile Send private message
manatails007



Joined: 05 Mar 2008
Posts: 13

PostPosted: Thu Feb 05, 2009 1:21 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
Bubbletune



Joined: 03 Jan 2009
Posts: 28

PostPosted: Thu Feb 05, 2009 1:36 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Torch



Joined: 28 May 2008
Posts: 842

PostPosted: Thu Feb 05, 2009 1:40 am    Post subject: Reply with quote

Or simple make it VSH mode 0x800 if you don't want iop.prx.
Back to top
View user's profile Send private message
Bubbletune



Joined: 03 Jan 2009
Posts: 28

PostPosted: Thu Feb 05, 2009 5:03 am    Post subject: Reply with quote

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)..
Back to top
View user's profile Send private message
Torch



Joined: 28 May 2008
Posts: 842

PostPosted: Thu Feb 05, 2009 5:06 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Torch



Joined: 28 May 2008
Posts: 842

PostPosted: Thu Feb 05, 2009 5:16 am    Post subject: Reply with quote

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:
#include <pspkernel.h>
#include <string.h>
#include <pspdebug.h>
#define printf pspDebugScreenPrintf

PSP_MODULE_INFO("flash0w", 0x800, 1, 0);
PSP_MAIN_THREAD_ATTR(PSP_THREAD_ATTR_VSH);
PSP_HEAP_SIZE_KB(2048);

int exit_callback()
{
  sceKernelExitGame();

  return 0;
}

int CallbackThread(SceSize args, void *argp)
{
  int cbid;

  cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
  sceKernelRegisterExitCallback(cbid);

  sceKernelSleepThreadCB();

  return 0;
}

int SetupCallbacks(void)
{
  int thid = 0;

  thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0);
  if(thid >= 0)
    {
      sceKernelStartThread(thid, 0, 0);
    }

  return thid;
}

int main(int argc, char* argv[])
{
   SetupCallbacks();
   pspDebugScreenInit();
   
   char text[] = "this is a test file";
   int result;
   result = sceIoUnassign("flash0:");
   
   if(result < 0)
   {
      printf("\nError in unassign flash0.");
   }
   else
   {
      result = sceIoAssign("flash0:", "lflash0:0,0", "flashfat0:", IOASSIGN_RDWR, NULL, 0);
      if(result < 0)
      {
         printf("\nError in assigning flash0 for write.");
      }
      else
      {
         SceUID fp;
         fp = sceIoOpen("flash0:/test.txt", PSP_O_WRONLY|PSP_O_TRUNC|PSP_O_CREAT, 0777);
         
         if(fp < 0)
         {
            printf("\nError writing flash0:/test.txt.");
         }
         else
         {
            sceIoWrite(fp, &text, strlen(text));
            sceIoClose(fp);
            printf("\ntest.txt written successfully.");
         }
      }
   }
   sceKernelSleepThread();
   
   return 0;
}


Code:
TARGET = flash0w
OBJS = main.o

INCDIR =
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)

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=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
Back to top
View user's profile Send private message
manatails007



Joined: 05 Mar 2008
Posts: 13

PostPosted: Wed Feb 11, 2009 4:42 pm    Post subject: Reply with quote

I got no problems accessing flash0 but flashing pspbtcnf bin files bricks up the psp
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group