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 

copy file to Flash0

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



Joined: 14 Nov 2007
Posts: 34

PostPosted: Wed Nov 14, 2007 11:11 pm    Post subject: copy file to Flash0 Reply with quote

i was searching around and all i could find was to copy files, may i be pointed in the right direction on how to copy a file from the memorystick to flash because these havent worked for me. when it flashes stuff like .bmp's it doesnt flash :(

Code:
int fileCopy(char* inSrc, char* inDest) {
     SceUID tempSrc = sceIoOpen(inSrc, PSP_O_RDONLY, 0777);
     if(!tempSrc)
          return -1;
     SceUID tempDest = sceIoOpen(inDest, PSP_O_WRONLY | PSP_O_CREAT, 0777);
     if(!tempDest) {
          sceIoClose(tempSrc);
          return -2;
     }

     char tempData[1024];
     int tempRead = sceIoRead(tempSrc, tempData, 1024);
     int tempWritten;

     while(tempRead > 0) {
          tempWritten = sceIoWrite(tempDest, tempData, tempRead);
          if(tempWritten != tempRead) {
               sceIoClose(tempDest);
               sceIoClose(tempSrc);
               sceIoRemove(inDest);
               return -3;
          }
          tempRead = sceIoRead(tempSrc, tempData, 1024);

     }

     sceIoClose(tempDest);
     sceIoClose(tempSrc);

     return 1;
}


Code:
void CopyExecute(const char* zFileSrc , const char* zFileDest)
{
   check(zFileSrc);

   if (exist == 1)
   {
      int fd1,fd2,len;
 
      fd1 = sceIoOpen(zFileSrc, PSP_O_RDONLY, 0);
      fd2 = sceIoOpen(zFileDest,PSP_O_WRONLY | PSP_O_CREAT | PSP_O_TRUNC, 0777);
       
      if(fd1 < 0)
          {
            doBlit("Error : some files are missing.");
      }
      else
      {
         while(1)
         {
                  len = sceIoRead(fd1, buf, BUFSIZE);
                  if (len == 0) break;
                  sceIoWrite(fd2,buf,len);
            }
      }
      sceIoClose(fd1);
      sceIoClose(fd2);
   }
   else
   {
      printf("Source file does not exist.");
   }
}


thanks
Back to top
View user's profile Send private message
Cpasjuste



Joined: 29 May 2005
Posts: 214

PostPosted: Thu Nov 15, 2007 2:02 am    Post subject: Reply with quote

If you'r codiing on 3.71 kernel see here (no solution yet) => http://forums.ps2dev.org/viewtopic.php?t=9289&sid=80ebbbf839aa986394c421ee9fb45f26
Back to top
View user's profile Send private message
.::Albandu51::.



Joined: 04 Oct 2007
Posts: 12

PostPosted: Thu Nov 15, 2007 2:22 am    Post subject: Reply with quote

Yes its good that someone would find a solution and shows.

Trad by Google xD
Back to top
View user's profile Send private message
PSPfreak!



Joined: 14 Nov 2007
Posts: 34

PostPosted: Thu Nov 15, 2007 5:05 pm    Post subject: Reply with quote

sorry, but im actually using the 1.50 kernel (i think)
Back to top
View user's profile Send private message
Pyridoxine



Joined: 28 Jul 2007
Posts: 2

PostPosted: Sat Nov 17, 2007 1:46 am    Post subject: Reply with quote

Here you go... This is Flashmod it's like the second Flasher to come out... It's open source and the Write Function for it should still work...

http://www.nobis-development.com/flashmod.php
Back to top
View user's profile Send private message
Cpasjuste



Joined: 29 May 2005
Posts: 214

PostPosted: Sat Nov 17, 2007 4:13 am    Post subject: Reply with quote

This doesn't sole the 3.71 fw problem :/
Back to top
View user's profile Send private message
PSPfreak!



Joined: 14 Nov 2007
Posts: 34

PostPosted: Sat Nov 17, 2007 9:25 am    Post subject: Reply with quote

Cpasjuste wrote:
This doesn't sole the 3.71 fw problem :/


yea but i really was looking for a 1.50 kernel app, so thanks Pyridoxine, i'll see if it will work
Back to top
View user's profile Send private message
PSPfreak!



Joined: 14 Nov 2007
Posts: 34

PostPosted: Sat Nov 17, 2007 11:10 am    Post subject: Reply with quote

woohooooo it works thanks mate, umm... would you happen to know anything about were the 1.50 version is in flash becuase i would like to change it with letters in it. every time i try to decrypt something it comes up corrupt and when i try to hex-edit it, i cant find 1.50. grrrr

e.g. i want to change to something like this, just not these letters 1.50 AB, 1.50 CD

im useless ahaha
Back to top
View user's profile Send private message
PSPfreak!



Joined: 14 Nov 2007
Posts: 34

PostPosted: Mon Nov 19, 2007 5:12 pm    Post subject: Reply with quote

anybody!!!!! sorry for posting under this though. if i dont get any replies until tomorrow i'll put under a different thread, so sorry anywayz
Back to top
View user's profile Send private message
Pyridoxine



Joined: 28 Jul 2007
Posts: 2

PostPosted: Mon Nov 19, 2007 8:47 pm    Post subject: Reply with quote

You want to change your version number I'm guessing... That should be in...

flash0:\vsh\etc\version.txt

For 1.50 atleast... Later on they started to encrypt there Version number in:

flash0:\kn\vshctrl.prx
Back to top
View user's profile Send private message
PSPfreak!



Joined: 14 Nov 2007
Posts: 34

PostPosted: Wed Nov 21, 2007 4:01 pm    Post subject: Reply with quote

Pyridoxine wrote:
You want to change your version number I'm guessing... That should be in...

flash0:\vsh\etc\version.txt

For 1.50 atleast... Later on they started to encrypt there Version number in:

flash0:\kn\vshctrl.prx


thx mate i'll give it a try now
Back to top
View user's profile Send private message
PSPfreak!



Joined: 14 Nov 2007
Posts: 34

PostPosted: Thu Nov 22, 2007 5:29 pm    Post subject: Reply with quote

Pyridoxine wrote:
You want to change your version number I'm guessing... That should be in...

flash0:\vsh\etc\version.txt

For 1.50 atleast... Later on they started to encrypt there Version number in:

flash0:\kn\vshctrl.prx


ok it works.........but GRRRR when i try to flash the files they dont write/copy, i tried the codes i had before and this one

Code:
void write_file(const char *readpath, const char *writepath)
{
   int fdin;
   int fdout;

   fdin = sceIoOpen(readpath, PSP_O_RDONLY, 0777);
   if(fdin >= 0)
   {
      int bytesRead = 1;
      fdout = sceIoOpen(writepath, PSP_O_WRONLY | PSP_O_CREAT | PSP_O_TRUNC, 0777);
      bytesRead = sceIoRead(fdin, write_buffer, sizeof(write_buffer));
      while((bytesRead > 0) && (fdout >= 0))
      {
         sceIoWrite(fdout, write_buffer, bytesRead);
         bytesRead = sceIoRead(fdin, write_buffer, sizeof(write_buffer));
      }

      if(fdout >= 0)
      {
         sceIoClose(fdout);
      }

      if(fdin >= 0)
      {
         sceIoClose(fdin);
      }
   }
}


this works in the same app and flashes correctly, but doesnt flash after it finished with the other stuff.

any idea's

edit: btw im copying from ms0 to flash0 again
Back to top
View user's profile Send private message
becus25



Joined: 24 Aug 2007
Posts: 2

PostPosted: Wed Nov 28, 2007 4:07 am    Post subject: Reply with quote

On 3.7x the SceMode isn't 0777.
It is 511 or 0511 . I have reversed a small part of kernel addon but now I don't remember the value of SceMode.
Try with 511 or 0511.
Back to top
View user's profile Send private message
Mashphealh



Joined: 28 Nov 2007
Posts: 18

PostPosted: Wed Nov 28, 2007 4:50 am    Post subject: Reply with quote

becus25 wrote:
On 3.7x the SceMode isn't 0777.
It is 511 or 0511 . I have reversed a small part of kernel addon but now I don't remember the value of SceMode.
Try with 511 or 0511.

And if you want run the app on vsh mode put the eboot on /psp/game/update . If you don't put it on them, the app should run on user mode. Try first run the app from UPDATE folder using vsh mode, if it works try then on user mode.

-=Double post=-
On 3.7x you can perfectly do dumps of files using the SceMode 0777 but with this mode won't work write files on the flash {folders (kd, module, etc..)}.
Back to top
View user's profile Send private message
Cpasjuste



Joined: 29 May 2005
Posts: 214

PostPosted: Wed Nov 28, 2007 5:57 am    Post subject: Reply with quote

Hum very cool for me (for a 3.71 file manager that is in my next homebrew). I was unable to write to flash0 with all (lot of) the test i have tried. I will try this tomorow.
Back to top
View user's profile Send private message
Cpasjuste



Joined: 29 May 2005
Posts: 214

PostPosted: Sun Dec 02, 2007 9:02 am    Post subject: Reply with quote

even with the scemode set to 0511, i'm still unable to write to flash0 in my usermode homebrew (flash0 reassigned rw in kernel mode) while it's possible in the background via psplink :x
Back to top
View user's profile Send private message
PSPfreak!



Joined: 14 Nov 2007
Posts: 34

PostPosted: Wed Dec 05, 2007 5:15 pm    Post subject: Reply with quote

becus25 wrote:
On 3.7x the SceMode isn't 0777.
It is 511 or 0511 . I have reversed a small part of kernel addon but now I don't remember the value of SceMode.
Try with 511 or 0511.


im actually using the 1.50 kernel btw if that changes anything lolz
Back to top
View user's profile Send private message
PSPfreak!



Joined: 14 Nov 2007
Posts: 34

PostPosted: Thu Dec 13, 2007 7:00 pm    Post subject: Reply with quote

[quote="Mashphealh"]
becus25 wrote:

-=Double post=-
On 3.7x you can perfectly do dumps of files using the SceMode 0777 but with this mode won't work write files on the flash {folders (kd, module, etc..)}.


i had a look in Dark_AleX's / moonlight's 1.50 poc src and he had 0777 useing it to write stuff, and it works??
Back to top
View user's profile Send private message
brin_vg



Joined: 03 Oct 2007
Posts: 17
Location: A pineapple, under the sea

PostPosted: Fri Dec 14, 2007 6:03 am    Post subject: Reply with quote

[quote="PSPfreak!"]
Mashphealh wrote:
becus25 wrote:

-=Double post=-
On 3.7x you can perfectly do dumps of files using the SceMode 0777 but with this mode won't work write files on the flash {folders (kd, module, etc..)}.


i had a look in Dark_AleX's / moonlight's 1.50 poc src and he had 0777 useing it to write stuff, and it works??

That's for 1.50 kernel. 3.7X kernel the sceMode's different.
Back to top
View user's profile Send private message Visit poster's website
PSPfreak!



Joined: 14 Nov 2007
Posts: 34

PostPosted: Fri Dec 14, 2007 12:13 pm    Post subject: Reply with quote

brin_vg wrote:
i had a look in Dark_AleX's / moonlight's 1.50 poc src and he had 0777 useing it to write stuff, and it works??

That's for 1.50 kernel. 3.7X kernel the sceMode's different.[/quote]

im using the 1.50 kernel & the codes from the src, but they write only prx's & .bmp's...........i think the problem is with flashing the .dat & .txt
Back to top
View user's profile Send private message
PSPfreak!



Joined: 14 Nov 2007
Posts: 34

PostPosted: Thu Dec 20, 2007 9:55 am    Post subject: Reply with quote

anybody know how to copy .dat & .txt to flash0 ????
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