 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
Red_Squirrel
Joined: 03 Oct 2007 Posts: 11
|
Posted: Mon Jan 14, 2008 10:41 pm Post subject: 3.71M33-4 and Flash0 access refused... |
|
|
Hi, I'm an Italian developer (so sorry for my bad english :P).
I have a problem with a my PSP program. I can't access to Flash0 to write or delete files...
For example:
| Code: | #include <pspkernel.h>
#include <pspiofilemgr.h>
PSP_MODULE_INFO("TEST", 0, 1, 1);
int main() {
pspDebugScreenInit();
pspDebugScreenPrintf("Result");
sceIoUnassign("flash0:");
sceIoAssign("flash0:", "lflash0:0,0", "flashfat0:", IOASSIGN_RDWR, NULL, 0);
int ok = sceIoRemove("flash0:/dog.txt");
if (ok<0) pspDebugScreenPrintf("FAILURE");
else pspDebugScreenPrintf("SUCCESS");
return 0;
}
|
Even this simple code does not work! O.O
I tried the same code with the Flash1 and it works good... but with Flash0 it does not work in any way...
Do anyone know why?! Please help me :(
P.s.: File "dog.txt" exists, because I created it on Flash0 before running program ;)
I'm on CF 3.71M33-4. |
|
| Back to top |
|
 |
hibbyware
Joined: 28 Mar 2007 Posts: 78
|
Posted: Mon Jan 14, 2008 11:23 pm Post subject: |
|
|
It will work if you do it like this,
| Code: |
PSP_MODULE_INFO("MyAppName", 0x800, 1, 0);
PSP_MAIN_THREAD_ATTR(PSP_THREAD_ATTR_VSH);
|
|
|
| Back to top |
|
 |
Red_Squirrel
Joined: 03 Oct 2007 Posts: 11
|
Posted: Mon Jan 14, 2008 11:38 pm Post subject: |
|
|
| hibbyware wrote: | It will work if you do it like this,
| Code: |
PSP_MODULE_INFO("MyAppName", 0x800, 1, 0);
PSP_MAIN_THREAD_ATTR(PSP_THREAD_ATTR_VSH);
|
|
Thank you :)
But if I use that code, program works only if I insert it in PSP/GAME150...
I wanted to make it compatible with PSP Slim too.
Is there an alternative way, please? :( |
|
| Back to top |
|
 |
hibbyware
Joined: 28 Mar 2007 Posts: 78
|
Posted: Mon Jan 14, 2008 11:41 pm Post subject: |
|
|
Well that's how I've been doing it and it works on Fat / Slim,
I have been putting it in GAME on the Fat PSP, |
|
| Back to top |
|
 |
Red_Squirrel
Joined: 03 Oct 2007 Posts: 11
|
Posted: Mon Jan 14, 2008 11:47 pm Post subject: |
|
|
| hibbyware wrote: | Well that's how I've been doing it and it works on Fat / Slim,
I have been putting it in GAME on the Fat PSP, |
If I put the eboot in GAME (on my PSP Fat) I obtain the error: 80020148...
It works only in GAME150 (I'm using 3.71 Kernel from recovery).
This is my Makefile:
| Code: | TARGET = hello
OBJS = main.o
INCDIR =
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
LIBDIR =
LDFLAGS =
LIBS =
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = Hello World
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak |
It's wrong? |
|
| Back to top |
|
 |
moonlight
Joined: 26 Oct 2005 Posts: 567
|
Posted: Mon Jan 14, 2008 11:51 pm Post subject: |
|
|
Add BUILD_PRX = 1 to the makefile.
VSH elf's are rejected in 3.XX kernel. |
|
| Back to top |
|
 |
hibbyware
Joined: 28 Mar 2007 Posts: 78
|
Posted: Mon Jan 14, 2008 11:53 pm Post subject: |
|
|
This is my makefile,
I'm also using the 371SDK that came with 371m33-1
| Code: |
TARGET = flasher4V1
OBJS = main.o cfg.o
INCDIR = ../include
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS) -c
LIBDIR = ../lib
LDFLAGS =
LIBS = -lpspkubridge
PSP_FW_VERSION = 371
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = flasher4V1
BUILD_PRX = 1
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
|
|
|
| Back to top |
|
 |
Red_Squirrel
Joined: 03 Oct 2007 Posts: 11
|
Posted: Tue Jan 15, 2008 12:05 am Post subject: |
|
|
Sorry, but it still does not work.
If I insert the eboot in GAME150 program works very good.
But in GAME and GAME371 PSP gives me the error "Impossible to..... (80020148)"
My main.c is:
| Code: | #include <pspkernel.h>
#include <pspiofilemgr.h>
PSP_MODULE_INFO("TEST", 0x800, 1, 0);
PSP_MAIN_THREAD_ATTR(PSP_THREAD_ATTR_VSH);
int main() {
pspDebugScreenInit();
pspDebugScreenPrintf("Result");
sceIoUnassign("flash0:");
sceIoAssign("flash0:", "lflash0:0,0", "flashfat0:", IOASSIGN_RDWR, NULL, 0);
int ok = sceIoRemove("flash0:/cane.txt");
if (ok<0) pspDebugScreenPrintf("FAILURE");
else pspDebugScreenPrintf("SUCCESS");
return 0;
} |
And Makefile used is:
| Code: | TARGET = flasher4V1
OBJS = main.o
INCDIR = ../include
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS) -c
LIBDIR = ../lib
LDFLAGS =
LIBS = -lpspkubridge
PSP_FW_VERSION = 371
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = flasher4V1
BUILD_PRX = 1
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak |
It works only in GAME150.
My PSP is set on Kernel 3.71 from Recovery... :([/code] |
|
| Back to top |
|
 |
hibbyware
Joined: 28 Mar 2007 Posts: 78
|
Posted: Tue Jan 15, 2008 1:40 am Post subject: |
|
|
This is a quick example of flashing a "test.txt" to "flash0:/vsh/resource"
It uses the 371SDK that came with 371m33-1
Works on 371m33 Slim/Fat,
Also works on 380m33 Fat but not yet tested on Slim but should work,
main.c
| Code: |
#include <pspsdk.h>
#include <pspkernel.h>
#include <pspdebug.h>
#include <kubridge.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdarg.h>
PSP_MODULE_INFO("MyAppName", 0x800, 1, 0);
PSP_MAIN_THREAD_ATTR(PSP_THREAD_ATTR_VSH);
#define printf pspDebugScreenPrintf
int status;
int exist = 0;
char write_buffer[128*1024];
void check(const char* zFile) {
int fd3;
fd3 = sceIoOpen(zFile, PSP_O_RDONLY, 0);
if(fd3 < 0) {
exist = 0;
}else{
exist = 1;
}
sceIoClose(fd3);
}
int write_file(const char *readpath, const char *writepath) {
check(readpath);
if(exist == 1) {
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);
}
}
return 1;
}else{
return 0;
}
}
void Reassign() {
sceIoUnassign("flash0:");
sceIoAssign("flash0:", "lflash0:0,0", "flashfat0:", IOASSIGN_RDWR, NULL, 0);
}
int main(void) {
pspDebugScreenInit();
pspDebugScreenClear();
Reassign();
status = write_file("./test.txt","flash0:/vsh/resource/test.txt");
if (status == 0) {
printf("Source File Does Not Exist...\n");
}
if (status == 1) {
printf("Flash Complete...\n");
}
printf("Exiting...\n");
sceKernelDelayThread(1000000);
sceKernelExitGame();
return 0;
}
|
makefile
| Code: |
TARGET = FlasherExample
OBJS = main.o
INCDIR = ../include
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS) -c
LIBDIR = ../lib
LDFLAGS =
LIBS = -lpspkubridge
PSP_FW_VERSION = 371
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = FlasherExample
BUILD_PRX = 1
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
|
-edit-
I did not need all those headers but too lazy to remove them, |
|
| Back to top |
|
 |
Pirata Nervo
Joined: 09 Oct 2007 Posts: 409
|
Posted: Sun Jan 20, 2008 10:35 pm Post subject: |
|
|
Use this:
PSP_MODULE_INFO("Flasher", 0x1000, 1, 0);
PSP_MAIN_THREAD_ATTR(0);
You can run under kernel mode on 3.80 m33-4 (I tested it on 3.80 m33-4)
Tested on:
fat psp
3.80 m33-4
no 1.50 kernel add on
GAME folder
3.80 Homebrew Game folder on recovery.
AND
slim psp
3.71 m33-4
GAME folder
3.71 Homebrew Game folder on recovery |
|
| Back to top |
|
 |
|
|
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
|