Random Homebrew: Tuyo Kiss
Tuyo Kiss is an interactive graphic novel for the PSP
Friends: Coding 'n Cracking - Nymphaea - PS3 Forum - darkforestgroup - daxhordes.org - Tgames - coldbird - gopsp.it - pspstation.org - prometheus - hgoel.info - MakeSmartTV - ps vita

Copy Files into Flash0

Forum rules
Any post not directly related to programming will be moderated.
Do not request people to code something for you.
Avoid posting messages that do not bring anything to the conversation. We want the threads in this subforum to stay focused.

Copy Files into Flash0

Postby Rinnegatamante » Sat May 07, 2011 7:11 pm

In a PRX (for VSH), how i can copy a file from MS0/EF0 to F0? I tried this:

Code: Select all
void copyFile(char *basefile,char *nuovofile){
FILE *from, *to;
  char ch;
from = fopen(basefile, "rb");
to = fopen(nuovofile, "w");
  while(!feof(from)) {
    ch = fgetc(from);
    if(!feof(from)) fputc(ch, to);
  }


But PSP freezes...

P.S. Could a moderator move the topic? Wrong section... sorry...
Rinnegatamante
 
Posts: 85
Joined: Sat Mar 26, 2011 10:02 am

Re: Copy Files into Flash0

Postby Punker69 » Sun May 08, 2011 10:45 am

You need to load an additional kernel mode module from your usermode code.
The kernel module then needs to perform the copy process
Mobile App Developer =)
Image
Punker69
 
Posts: 1107
Joined: Sat Oct 02, 2010 2:25 am
Location: http://punker69.blogspot.com/

Re: Copy Files into Flash0

Postby Rinnegatamante » Sun May 08, 2011 12:01 pm

I'm creating a PRX, i don't need to use an another PRX...
Rinnegatamante
 
Posts: 85
Joined: Sat Mar 26, 2011 10:02 am

Re: Copy Files into Flash0

Postby JJS » Sun May 08, 2011 2:25 pm

Moved to the programming subforum.

I think you have to remount flash0 to get write access. Check this.
JJS
Big Beholder
 
Posts: 1516
Joined: Mon Sep 27, 2010 2:18 pm

Re: Copy Files into Flash0

Postby Rinnegatamante » Sun May 08, 2011 3:05 pm

I just tried to unmount and remount flash0 access but nothing is changed...

This is my code, now:

Code: Select all
void copyFile(char *basefile,char *nuovofile){
FILE *from, *to;
  char ch;
from = fopen(basefile, "rb");
to = fopen(nuovofile, "wb");
  while(!feof(from)) {
    ch = fgetc(from);
    if(!feof(from)) fputc(ch, to);
  }
fclose(from);
fclose(to);
}
int main_thread(SceSize args, void *argp) {
    sceKernelDelayThread(3000000);
   
    while(1)
    {
sceCtrlPeekBufferPositive(&currentPad,1);
       
       if ((currentPad.Buttons & PSP_CTRL_HOME) && (currentPad.Buttons & PSP_CTRL_LTRIGGER) && (currentPad.Buttons & PSP_CTRL_RTRIGGER)){
sceIoUnassign("flash0");
               sceIoAssign("flash0", "lflash0:0,0", "flashfat0:", IOASSIGN_RDWR, NULL, 0);
               copyFile("ms0:/test.txt", "flash0:/test.txt");
}
sceKernelDelayThread(500);
    }
return 0;
}

PSP freezes and after crashes.
I'm using a PSP GO with 6.20 PRO-B5
Rinnegatamante
 
Posts: 85
Joined: Sat Mar 26, 2011 10:02 am

Re: Copy Files into Flash0

Postby codestation » Sun May 08, 2011 3:42 pm

What is the return value of sceIoAssign? Your module is in vsh mode? (PSP_MODULE_INFO flags)
Plugin list
Working on: Python (django, sqlalchemy, PyQt, etc) + Lua
Repositories: github, bitbucket, google code
Just feel the code..
opencma/vitamtp for Archlinux
User avatar
codestation
Big Beholder
 
Posts: 1277
Joined: Wed Jan 19, 2011 3:45 pm
Location: /dev/negi

Re: Copy Files into Flash0

Postby Rinnegatamante » Sun May 08, 2011 4:57 pm

PRX is in seplugins/vsh.txt.

This is my PSP_MODULE_INFO:
Code: Select all
PSP_MODULE_INFO("FlashTest", 0, 1, 1);
PSP_MAIN_THREAD_ATTR(0);
Rinnegatamante
 
Posts: 85
Joined: Sat Mar 26, 2011 10:02 am

Re: Copy Files into Flash0

Postby JJS » Sun May 08, 2011 5:17 pm

Your module info is for a user mode module.

Code: Select all
0 = user mode
0x800 = vsh mode
0x1000 = kernel mode
JJS
Big Beholder
 
Posts: 1516
Joined: Mon Sep 27, 2010 2:18 pm

Re: Copy Files into Flash0

Postby Rinnegatamante » Sun May 08, 2011 5:30 pm

I trie to set the #2 value to 0x800 or 0x1000 but nothing is changed...

Code: Select all
PSP_MODULE_INFO("FlashTest", 0x1000, 1, 1);
PSP_MAIN_THREAD_ATTR(0);


Code: Select all
PSP_MODULE_INFO("FlashTest", 0x800, 1, 1);
PSP_MAIN_THREAD_ATTR(0);
Rinnegatamante
 
Posts: 85
Joined: Sat Mar 26, 2011 10:02 am

Re: Copy Files into Flash0

Postby Punker69 » Mon May 09, 2011 1:08 am

Code: Select all
PSP_MODULE_INFO("Installer", 0x800, 1, 2);
try this hope it works.
Mobile App Developer =)
Image
Punker69
 
Posts: 1107
Joined: Sat Oct 02, 2010 2:25 am
Location: http://punker69.blogspot.com/

Next

Return to Programming

Who is online

Users browsing this forum: Google Adsense [Bot], TS0SmikY and 1 guest