Chronoswitch: 6.60/6.39/6.38 DowngraderRandom Homebrew: Chronoswitch: 6.60/6.39/6.38 Downgrader
Downgrade your 6.60 PSP to a lower firmware, and enjoy the world of Custom Firmwares! Compatible wit [...]
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.

Re: Copy Files into Flash0

Postby Rinnegatamante » Mon May 09, 2011 12:50 pm

Nothing is changed...

It's very strange... it freezes and crashes, file in flash0 isn't created...

P.S. I tried also:

Code: Select all
PSP_MODULE_INFO("EasyDualboot", 0x1000, 1, 2);


But nothing...

Can i post complete source codes in a RAR archive?

Here are my files:

main.c
Code: Select all
#include <pspkernel.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <pspsdk.h>
#include <pspiofilemgr.h>
#include <pspctrl.h>

PSP_MODULE_INFO("TestFlash", 0x1000, 1, 2);
PSP_MAIN_THREAD_ATTR(0);
#define MAX_THREAD 64
int language=0;

FILE *config;
    int lingua;

SceCtrlData currentPad, lastPad, Pad;
int setLanguage()
{
config=fopen("flash1:/config.db", "r");
     char buffer;
    if( config == NULL){
         lingua = 0;
    }else{
        fread ((void *)&buffer,sizeof(char),1,config);
        char buffers[100];
        sprintf(buffers,"%c",buffer);
        if (strcmp(buffers,"1")==0){
            lingua = 1;
        }else{
            lingua = 0;
        }
        fclose(config);
    }
     return lingua;
}
char write_buffer[128*1024];
void copyFile(char *basefile,char *nuovofile){
sceIoUnassign("flash0");
sceIoAssign("flash0", "lflash0:0,0", "flashfat0:", IOASSIGN_RDWR, NULL, 0);
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)){
           language=setLanguage();
           if (language == 1){
               copyFile("ms0:/test.prx", "flash0:/test.prx");
           }else{
               copyFile("ms0:/test2.prx", "flash0:/test.prx");
           }
           fclose(config);
       }
       sceKernelDelayThread(500);
    }
return 0;
}


int module_start(SceSize args, void *argp) {

   int thid;

   /* Create a high priority thread */
   thid = sceKernelCreateThread("TestFlash", main_thread, 0x18, 0x1000, 0, NULL);//8, 64*1024, PSP_THREAD_ATTR_USER, NULL);
   if(thid >= 0) sceKernelStartThread(thid, args, argp);

   return 0;
}


Makefile
Code: Select all
TARGET            = TestFlash
OBJS            = main.o
BUILD_PRX         = 1
PRX_EXPORTS         = exports.exp
#USE_PSPSDK_LIBC    = 1

INCDIR            =
LIBDIR            =
LIBS            = -lz -lm -lpspumd
LDFLAGS            =
CFLAGS            = -Os -G0 -Wall -g
CXXFLAGS         = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS            = $(CFLAGS)

PSPSDK            = $(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build_prx.mak

exports:
   psp-build-exports -s exports.exp
Rinnegatamante
 
Posts: 85
Joined: Sat Mar 26, 2011 10:02 am

Re: Copy Files into Flash0

Postby Punker69 » Mon May 09, 2011 1:25 pm

Punker69 wrote:
Code: Select all
PSP_MODULE_INFO("Installer", 0x800, 1, 2);
try this hope it works.


i said try this one. I Use this in my app called flashdumper
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 » Mon May 09, 2011 5:54 pm

I tried it with the source that i've posted but it doesn't work...
Rinnegatamante
 
Posts: 85
Joined: Sat Mar 26, 2011 10:02 am

Re: Copy Files into Flash0

Postby m0skit0 » Mon May 09, 2011 6:26 pm

Just FYI, I would never try a homebrew that messes with flash0, specially on unhackables. You should not copy anything into flashes unless you have no other way.
I wanna lots of mov al,0xb
Image
"just not into this RA stuffz"
User avatar
m0skit0
Guru
 
Posts: 4787
Joined: Mon Sep 27, 2010 6:01 pm

Re: Copy Files into Flash0

Postby Rinnegatamante » Mon May 09, 2011 6:49 pm

I must copy a file into flash0 for the good realization of the homebrew... :cry:
Rinnegatamante
 
Posts: 85
Joined: Sat Mar 26, 2011 10:02 am

Re: Copy Files into Flash0

Postby Rinnegatamante » Mon May 09, 2011 8:24 pm

I tried this:
Code: Select all
if (sceIoUnassign("flash0:") < 0){
config=fopen("ms0:/unassign.txt", "w");
char buffer[] = { 'U' };
fwrite(buffer,1,sizeof(buffer),config);
fclose(config);
}
if (sceIoAssign("flash0:", "lflash0:0,0", "flashfat0:", IOASSIGN_RDWR, NULL, 0) < 0){
config=fopen("ms0:/assign.txt", "w");
char buffer[] = { 'U' };
fwrite(buffer,1,sizeof(buffer),config);
fclose(config);
}


And when i charge my prx, i'll get error from unassign and assign function (and relative files are been created with U character). :S
Rinnegatamante
 
Posts: 85
Joined: Sat Mar 26, 2011 10:02 am

Re: Copy Files into Flash0

Postby Rinnegatamante » Wed May 11, 2011 11:33 am

I tried to load iop.prx but nothing change but if i use iop.prx in an EBOOT.PBP, it flashes normally...why?
Rinnegatamante
 
Posts: 85
Joined: Sat Mar 26, 2011 10:02 am

Re: Copy Files into Flash0

Postby m0skit0 » Wed May 11, 2011 2:02 pm

Your PRX must be kernel mode to do such thing.
I wanna lots of mov al,0xb
Image
"just not into this RA stuffz"
User avatar
m0skit0
Guru
 
Posts: 4787
Joined: Mon Sep 27, 2010 6:01 pm

Re: Copy Files into Flash0

Postby Rinnegatamante » Wed May 11, 2011 3:52 pm

Code: Select all
PSP_MODULE_INFO("Test Flash", 0x800, 1, 2);


This is my MODULE_INFO (i tried also 0x1000).
Rinnegatamante
 
Posts: 85
Joined: Sat Mar 26, 2011 10:02 am

Re: Copy Files into Flash0

Postby Yoti » Wed May 11, 2011 7:14 pm

Code: Select all
PSP_MODULE_INFO("homebrew", 0x800, 1, 0);
PSP_MAIN_THREAD_ATTR(PSP_THREAD_ATTR_VSH);

Code: Select all
BUILD_PRX = 1

+ reassign flash0 in write mode. It's for PBP.

This code works in my 5.00 m33 plugins add-on for k1.50.
Attachments
flash0.7z
(107.07 KiB) Downloaded 25 times
Last edited by Yoti on Tue May 17, 2011 7:38 pm, edited 1 time in total.
User avatar
Yoti
VIP
 
Posts: 246
Joined: Sun Oct 17, 2010 4:49 am
Location: Russia

PreviousNext

Return to Programming

Who is online

Users browsing this forum: No registered users and 0 guests