| View previous topic :: View next topic |
| Author |
Message |
pyrosama
Joined: 13 May 2005 Posts: 66
|
Posted: Sun Nov 06, 2005 4:07 pm Post subject: Wrighting to flash0 | Source |
|
|
This is the source to a tool I put together to with the help of many others to replace files in the firmware.
So let's see an updated version of PSPersonalize....
| Code: | /* This is the source to a simple flash tool based on CleanSweep's alpha code by Dot_blank, Yoshi's bricker, and alot of help from ph0rkeh.
Good work guys and thanks for all the help! - Shout out to all my m8's at irc.toc2rta.com #pspchat who have helped me with my random projects. */
//
// Bricker Sample.
//
/*Standard headers*/
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/unistd.h>
/*PSPSDK headers*/
#include <pspkernel.h>
#include <pspctrl.h>
#include <pspdebug.h>
#include <pspdisplay.h>
#include <pspiofilemgr.h>
#include <psptypes.h>
#include <pspumd.h>
/*
================================================================================
standard psp stuff
================================================================================
*/
PSP_MODULE_INFO("CleanSweep", 0x1000, 1, 1); // 0x1000 = Kernel MODE
PSP_MAIN_THREAD_ATTR(0); // 0 for kernel mode too
#define printf pspDebugScreenPrintf
/* Define buffer size */
#define BUFSIZE 65536
char buf[BUFSIZE];
/* Exit callback */
int exit_callback(int arg1, int arg2, void *common)
{
sceKernelExitGame();
return 0;
}
/* Callback thread */
int CallbackThread(SceSize args, void *argp)
{
int cbid;
cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
sceKernelRegisterExitCallback(cbid);
sceKernelSleepThreadCB();
return 0;
}
/* Sets up the callback thread and returns its thread id */
int SetupCallbacks(void)
{
int thid = 0;
thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0);
if(thid >= 0)
{
sceKernelStartThread(thid, 0, 0);
}
return thid;
}
/* Define a write buffer */
char write_buffer[128*1024];
/* This code is taken from Yoshi's bricker.*/
void CopyExecute(const char* zFileSrc , const char* zFileDest) {
int fd1,fd2,len;
//Read
fd1 = sceIoOpen(zFileSrc, PSP_O_RDONLY, 0);
//Write
fd2 = sceIoOpen(zFileDest,PSP_O_WRONLY | PSP_O_CREAT | PSP_O_TRUNC, 0777);
if(fd1 < 0)
{
printf("Error Message if the file is not there. \n");
}else{
while(1) {
len = sceIoRead(fd1, buf, BUFSIZE);
if (len == 0) break;
sceIoWrite(fd2,buf,len);
}
}
sceIoClose(fd1);
sceIoClose(fd2);
}
/* Menu */
void show_menu(void)
{
//basic description stuff
printf("This is a line that will be printed on the screen when the application is launched. \n");
//inputs for user
printf("Press Circle to replace system_plugin_bg.rco.\n");
}
/* main routine */
int main(void)
{
//assign buttons
SceCtrlData pad;
//basic psp startup stuff
pspDebugScreenSetBackColor(0xFFFFFFFF);
pspDebugScreenSetTextColor(0);
pspDebugScreenInit();
SetupCallbacks();
sceCtrlSetSamplingCycle(0);
sceCtrlSetSamplingMode(1);
/* This displays the main menu for the application */
show_menu();
/* Assign the flash device. */
sceIoUnassign("flash0:");
sceIoAssign("flash0:", "lflash0:0,0", "flashfat0:", 0, NULL, 0);
/* Main Loop */
for(;;)
{
/* Watch for Circle being pressed */
sceCtrlReadBufferPositive(&pad, 1);
if(pad.Buttons & PSP_CTRL_CIRCLE)
{
/* This is the line that deals the final blow. Be carefull I bricked my PSP with this bad boy. */
CopyExecute("ms0:/system_pluging_bg.rco","flash0:/vsh/resource/system_plugin_bg.rco");
/* Clear the screen after flashing is done. */
pspDebugScreenClear();
/* This prints a message after flashing is complete */
printf("Congratz you have just bricked your PSP.\n");
}
sceDisplayWaitVblankStart();
}
//lets go back to psp menu
sceKernelExitGame();
//just for good luck :)
return 0;
}
|
Thanks,
PyroSama aka Canti |
|
| Back to top |
|
 |
mrbrown
Joined: 17 Jan 2004 Posts: 1536
|
Posted: Mon Nov 07, 2005 2:03 am Post subject: |
|
|
| If you are writing/stealing code like this, then you definitely should not be messing with your firmware. |
|
| Back to top |
|
 |
Brunni
Joined: 08 Oct 2005 Posts: 186
|
Posted: Mon Nov 07, 2005 2:44 am Post subject: |
|
|
I am not sure I understood correctly, but it seems there are some people here who really want to kill homebrew psp development. _________________ Sorry for my bad english
Oldschool library for PSP - PC version released |
|
| Back to top |
|
 |
pyrosama
Joined: 13 May 2005 Posts: 66
|
Posted: Mon Nov 07, 2005 3:20 am Post subject: |
|
|
I just wanted to make available a working sample. Yoshi's code doesnt compile, dot's didnt work, and with those two and some help from others we made a working sample people can use...
And this isnt here to "kill homebrew psp development" it's to help it. Granted some people may attempt some not so great applications that cause damage but it's still a tool that should be made available. If a person is stupid enough to use it then they deserve a brick as I did.
Thanks,
PyroSama |
|
| Back to top |
|
 |
groepaz

Joined: 01 Sep 2005 Posts: 305
|
|
| Back to top |
|
 |
pyrosama
Joined: 13 May 2005 Posts: 66
|
Posted: Mon Nov 07, 2005 12:45 pm Post subject: |
|
|
| These forums. |
|
| Back to top |
|
 |
groepaz

Joined: 01 Sep 2005 Posts: 305
|
|
| Back to top |
|
 |
placasoft
Joined: 28 Mar 2005 Posts: 53
|
Posted: Mon Nov 07, 2005 10:52 pm Post subject: |
|
|
Next time use search function ;)
http://forums.ps2dev.org/viewtopic.php?t=2214&highlight=flash
EDIT :
Ok guys, the above code is veeerrrry dangerous! Because if a file does not exist, he just copy a file with 0 byte ... so here is a code with check function ;)
| Code: |
/*Standard headers*/
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/unistd.h>
/*PSPSDK headers*/
#include <pspkernel.h>
#include <pspctrl.h>
#include <pspdebug.h>
#include <pspdisplay.h>
#include <pspiofilemgr.h>
#include <psptypes.h>
#include <pspumd.h>
/*
================================================================================
standard psp stuff
================================================================================
*/
PSP_MODULE_INFO("CleanSweep", 0x1000, 1, 1); // 0x1000 = Kernel MODE
PSP_MAIN_THREAD_ATTR(0); // 0 for kernel mode too
#define printf pspDebugScreenPrintf
int exist = 0;
/* Define buffer size */
#define BUFSIZE 65536
char buf[BUFSIZE];
/* Exit callback */
int exit_callback(int arg1, int arg2, void *common)
{
sceKernelExitGame();
return 0;
}
/* Callback thread */
int CallbackThread(SceSize args, void *argp)
{
int cbid;
cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
sceKernelRegisterExitCallback(cbid);
sceKernelSleepThreadCB();
return 0;
}
/* Sets up the callback thread and returns its thread id */
int SetupCallbacks(void)
{
int thid = 0;
thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0);
if(thid >= 0)
{
sceKernelStartThread(thid, 0, 0);
}
return thid;
}
/* Define a write buffer */
char write_buffer[128*1024];
// Checkfunction, too look if a file exist!
void check(const char* zFile)
{
int fd3;
fd3 = sceIoOpen(zFile, PSP_O_RDONLY, 0);
if(fd3 < 0)
{
exist = 0;
}else{
exist = 1;
}
sceIoClose(fd3);
}
/* This code is taken from Yoshi's bricker + Placa check code ;)*/
void CopyExecute(const char* zFileSrc , const char* zFileDest) {
check(zFileSrc);
if (exist == 1){
int fd1,fd2,len;
//Read
fd1 = sceIoOpen(zFileSrc, PSP_O_RDONLY, 0);
//Write
fd2 = sceIoOpen(zFileDest,PSP_O_WRONLY | PSP_O_CREAT | PSP_O_TRUNC, 0777);
if(fd1 < 0)
{
printf("Error Message if the file is not there. \n");
}else{
while(1) {
len = sceIoRead(fd1, buf, BUFSIZE);
if (len == 0) break;
sceIoWrite(fd2,buf,len);
}
}
sceIoClose(fd1);
sceIoClose(fd2);
}else{
printf("%s does not exist\n", zFileSrc);
}
}
/* Menu */
void show_menu(void)
{
//basic description stuff
printf("This is a line that will be printed on the screen when the application is launched. \n");
//inputs for user
printf("Press Circle to replace system_plugin_bg.rco.\n");
}
/* main routine */
int main(void)
{
//assign buttons
SceCtrlData pad;
//basic psp startup stuff
pspDebugScreenSetBackColor(0xFFFFFFFF);
pspDebugScreenSetTextColor(0);
pspDebugScreenInit();
SetupCallbacks();
sceCtrlSetSamplingCycle(0);
sceCtrlSetSamplingMode(1);
/* This displays the main menu for the application */
show_menu();
/* Assign the flash device. */
sceIoUnassign("flash0:");
sceIoAssign("flash0:", "lflash0:0,0", "flashfat0:", 0, NULL, 0);
/* Main Loop */
for(;;)
{
/* Watch for Circle being pressed */
sceCtrlReadBufferPositive(&pad, 1);
if(pad.Buttons & PSP_CTRL_CIRCLE)
{
/* This is the line that deals the final blow. Be carefull I bricked my PSP with this bad boy. */
CopyExecute("ms0:/system_pluging_bg.rco","flash0:/vsh/resource/system_plugin_bg.rco");
/* Clear the screen after flashing is done. */
pspDebugScreenClear();
/* This prints a message after flashing is complete */
printf("Congratz you have just bricked your PSP.\n");
}
sceDisplayWaitVblankStart();
}
//lets go back to psp menu
sceKernelExitGame();
//just for good luck :)
return 0;
} |
|
|
| Back to top |
|
 |
dot_blank

Joined: 28 Sep 2005 Posts: 498 Location: Brasil
|
Posted: Tue Nov 08, 2005 7:01 am Post subject: |
|
|
i HIGHLY do not recommend
anyone to attempt any of these
sample code snippets...they are
guaranteed psp brick ...if that is what
you want then have a blast ;)
but dont start crying if not and
dont say you havent been warned _________________ 10011011 00101010 11010111 10001001 10111010 |
|
| Back to top |
|
 |
Art
Joined: 09 Nov 2005 Posts: 647
|
Posted: Tue Mar 21, 2006 2:24 am Post subject: |
|
|
There is an error in both samples:
CopyExecute("ms0:/system_pluging_bg.rco","flash0:/vsh/resource/system_plugin_bg.rco");
"system_pluging.rco"? |
|
| Back to top |
|
 |
dot_blank

Joined: 28 Sep 2005 Posts: 498 Location: Brasil
|
Posted: Tue Mar 21, 2006 4:29 am Post subject: |
|
|
well you really shouldnt follow these verbatim
the correct path is indeed flash0:/vsh/resource/system_plugin_bg.rco
but you shouldnt have to mess with that file
in fact DO NOT mess around with that file
its basically useless and only affects the wavy lines
in xmb menu of psp _________________ 10011011 00101010 11010111 10001001 10111010 |
|
| Back to top |
|
 |
Art
Joined: 09 Nov 2005 Posts: 647
|
Posted: Tue Mar 21, 2006 11:18 am Post subject: |
|
|
I was pointing out the spelling of 'plugin', not the file path.
The error would result in a definite brick with the first example without checking because the file spelled 'pluging'would not be found.
That whole first example should be edited out of this forum, it is a VIRUS.
I am messing with other flash0 files using similar example code.
I know the risks, have bricked two PSPs. |
|
| Back to top |
|
 |
groepaz

Joined: 01 Sep 2005 Posts: 305
|
|
| Back to top |
|
 |
dot_blank

Joined: 28 Sep 2005 Posts: 498 Location: Brasil
|
Posted: Wed Mar 22, 2006 9:04 am Post subject: |
|
|
it is not a virus ...no such things exist for a psp
and dont let anyone tell you otherwise
what you see above is highly incorrect code in C
shoot its not even code at all :P...its like when kids
have paint ...they have blue and red and yellow
and then they just mix around with their hands ..making a mess
and yes that typo would result in a brick ...which
is why mostly anyone will tell you to not look at
this thread any longer ;) _________________ 10011011 00101010 11010111 10001001 10111010 |
|
| Back to top |
|
 |
Art
Joined: 09 Nov 2005 Posts: 647
|
Posted: Thu Mar 23, 2006 5:43 pm Post subject: |
|
|
Ok, I guess you got me.
There's no way for any PSP program to perpetuate itself.
Do you have an example of a text (debug or graphics) menu that
you'd share with a C beginner? or a link to find one that can easily be
seperated from the rest of it's program?
Cheers, Art. |
|
| Back to top |
|
 |
Art
Joined: 09 Nov 2005 Posts: 647
|
Posted: Wed Jul 26, 2006 4:07 pm Post subject: |
|
|
I read correctly if the third poster said that the second poster wants to kill homebrew development.
There is some homebrew that has been shoved to my attention that uses
the first example, and one of them is a real screamer.
It seems this piece of work does find a way to perpetuate itself :p |
|
| Back to top |
|
 |
dot_blank

Joined: 28 Sep 2005 Posts: 498 Location: Brasil
|
Posted: Thu Jul 27, 2006 2:52 pm Post subject: |
|
|
you are the one who perpetuated it :P
this thread should not have been revived
frankly it should be locked already as
theres no more knowledge to gain from just
talking ...flash access is very common thing
these days now _________________ 10011011 00101010 11010111 10001001 10111010 |
|
| Back to top |
|
 |
|