Writing to flash0, need help!

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

Moderators: cheriff, TyRaNiD

Post Reply
reigel
Posts: 14
Joined: Fri Jul 15, 2005 10:41 pm

Writing to flash0, need help!

Post by reigel »

Kay, at first don't say "dude don't do this, this can ownz your PSP"
I relleay know what I do!

So anyone has a Idea why this not work :
(the wallpaper I copy here is not more than a test!)

Code: Select all

//placas src:
#include <pspkernel.h>
#include <pspsdk.h>
#include <pspiofilemgr.h>
#include <pspmodulemgr.h>
#include <pspdisplay.h>
#include <pspdebug.h>
#include <pspctrl.h>


#define O_RDONLY   0x0001
#define O_WRONLY   0x0002
#define O_RDWR     0x0003
#define O_NBLOCK   0x0010
#define O_APPEND   0x0100
#define O_CREAT    0x0200
#define O_TRUNC    0x0400
#define O_NOWAIT   0x8000 
#define printf	pspDebugScreenPrintf
#define BUFSIZE      65536

SceCtrlData pad_data;

PSP_MODULE_INFO&#40;"test", 0x1000, 1, 1&#41;; 
PSP_MAIN_THREAD_ATTR&#40;0&#41;; 

int ex = 1;

char   buf&#91;BUFSIZE&#93;;

void copy&#40;const char* zFileSrc , const char* zFileDest&#41; 
&#123;
   int fd1,fd2,len;
   

       fd1 = sceIoOpen&#40;zFileSrc, O_RDONLY, 0&#41;;

       fd2 = sceIoOpen&#40;zFileDest,O_WRONLY | O_CREAT | O_TRUNC, 0777&#41;; 
       
       if &#40;ex == 1&#41;
       &#123;
       if&#40;fd1 < 0&#41;
       &#123;
printf&#40;"File does not exist, all stoped\n"&#41;;	
printf&#40;"Missing file &#58; %s\n", zFileSrc&#41;;	
ex = 0;	
       &#125;else&#123;
printf&#40;"File was copied to %s \n", zFileDest&#41;;                  
     while&#40;1&#41; &#123;
      len = sceIoRead&#40;fd1, buf, BUFSIZE&#41;;
      if &#40;len == 0&#41; break;
      sceIoWrite&#40;fd2,buf,len&#41;;
   &#125;
&#125;
&#125;
   sceIoClose&#40;fd1&#41;;
   sceIoClose&#40;fd2&#41;;
&#125;

int main&#40;void&#41;
&#123;	
	pspDebugScreenInit&#40;&#41;;
	sceIoUnassign&#40;"flash0"&#41;;
  sceIoAssign&#40;"flash0", "lflash0&#58;0,0", "fatflash0&#58;", IOASSIGN_RDWR, NULL, 0&#41;;
	pspDebugScreenInit&#40;&#41;;
  copy&#40;"ms0&#58;/1.bmp", "flash0&#58;/vsh/resource/wallpaper.bmp"&#41;;
	return 0;
&#125;

Thx 4 help
Reigel!
User avatar
Agoln
Posts: 326
Joined: Wed Jun 08, 2005 3:14 am
Location: Fort Wayne, IN

Post by Agoln »

writing to flash0:// is more than just opening it up and trying to write to it.

It involves doing a handstand on a single hand, sipping coffee from the other, and balancing three elephents on each leg. But, if you are willing, check out PSPersonalize, I *believe* that writes to flash0:// and will probably give you more insite into what circus tricks need to be done.
Lego of my Ago!
reigel
Posts: 14
Joined: Fri Jul 15, 2005 10:41 pm

Post by reigel »

Thx,
the funny thing is i can write into "flash1".
PSPersonalize isn´t opensrc :( ... plz help me guys!
Vampire
Posts: 138
Joined: Tue Apr 12, 2005 8:16 am

Post by Vampire »

there was a bug in the sceIoAssign example...
the third parameter is "flashfat0:" and not "fatflash0:"
OmahaStylee
Posts: 14
Joined: Mon Aug 29, 2005 5:00 pm
Location: Los Angeles, CA
Contact:

Post by OmahaStylee »

After fixing that error, did it work?
Image
User avatar
EdwardFMA
Posts: 40
Joined: Wed Jul 06, 2005 11:47 am

Post by EdwardFMA »

Vampire wrote:there was a bug in the sceIoAssign example...
the third parameter is "flashfat0:" and not "fatflash0:"
no i tried that it dosen't fix it T_T i've been trying to access flash0: to write but sadly i can't do all this at once:
Agoln wrote:It involves doing a handstand on a single hand, sipping coffee from the other, and balancing three elephents on each leg.
EdwardFMA/IchigoKurosaki - PSP Expert
Athlon 64 - Socket 939 - 3000+
1GB 333 DDR-Ram
Geforce 6600 GT PCI-Express

Orbis PSP Development
Open-Source Development
OmahaStylee
Posts: 14
Joined: Mon Aug 29, 2005 5:00 pm
Location: Los Angeles, CA
Contact:

Post by OmahaStylee »

Arg, somebody said there is some source code floating around these forums somewhere that can write to flash0. I still havent been able to find it.

Anybody seen it?
Last edited by OmahaStylee on Mon Sep 19, 2005 11:28 am, edited 1 time in total.
Image
User avatar
EdwardFMA
Posts: 40
Joined: Wed Jul 06, 2005 11:47 am

Post by EdwardFMA »

once you find it tell me ;) lol
EdwardFMA/IchigoKurosaki - PSP Expert
Athlon 64 - Socket 939 - 3000+
1GB 333 DDR-Ram
Geforce 6600 GT PCI-Express

Orbis PSP Development
Open-Source Development
Post Reply