 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
Art
Joined: 09 Nov 2005 Posts: 647
|
Posted: Wed Aug 12, 2009 1:20 pm Post subject: sceio commands in 1.50 kernel mode |
|
|
Hi Guys,
For my current program, I had difficulty getting it to work in 1.50 kernel mode,
and found the attached code for checking & creating folders was the culprit preventing the program from starting.
Is this usual for sceio commands working with Memorysticks?
This code does work in usermode under 3.xx kernel.
/*
folderexists = 0; // check target folders exist
dfdx = sceIoDopen("ms0:/PICTURE");
if(dfdx >= 0) {folderexists = 1;}
if (folderexists == 0) {sceIoMkdir("ms0:/PICTURE", 0777);}
folderexists = 0;
dfdx = sceIoDopen("ms0:/PICTURE/Maps");
if(dfdx >= 0) {folderexists = 1;}
if (folderexists == 0) {sceIoMkdir("ms0:/PICTURE/Maps", 0777);}
highest = 0; // find highest file number
set_filenum("ms0:/PICTURE/Maps","ms0:/PICTURE/Maps");
nsaved = highest + 1;
*/ _________________ If not actually, then potentially. |
|
| Back to top |
|
 |
Torch

Joined: 28 May 2008 Posts: 842
|
Posted: Wed Aug 12, 2009 1:26 pm Post subject: |
|
|
You cannot write memory stick files in kernel mode. Get the iop.prx source and copy the surrounding code for the sceIo* functions. The setuserlevel etc...
EDIT:
Oh you're talking about 1.50... Thought you wanted to write to memory stick in 3.xx kernel mode. |
|
| Back to top |
|
 |
Art
Joined: 09 Nov 2005 Posts: 647
|
Posted: Wed Aug 12, 2009 1:39 pm Post subject: |
|
|
When I looked again I saw I missed a function "set_filenum" which checks
for the highest numbered file in a folder.
Still don't think any of this should be illegal in 1.50 kernel since
it is modified ms dumping code.
void build_path(char *output, const char *root, const char *path, int append) {
while(*root != 0) {
*output++ = *root++;
}
if(*(root-1) != '/') {
*output++ = '/';
}
while(*path != 0) {
*output++ = *path++;
}
if(append)
*output++ = '/';
*output++ = 0;
}
void check_file(const char *read_loc, const char *write_loc, const char *name) {
char readpath[256];
build_path(readpath, read_loc, name, 0);
thisfile = 0;
thisfile = thisfile + (readpath[30] - 0x30) * 100000;
thisfile = thisfile + (readpath[31] - 0x30) * 10000;
thisfile = thisfile + (readpath[32] - 0x30) * 1000;
thisfile = thisfile + (readpath[33] - 0x30) * 100;
thisfile = thisfile + (readpath[34] - 0x30) * 10;
thisfile = thisfile + readpath[35] - 0x30;
if (thisfile > highest) {highest = thisfile;}
}
void set_filenum(const char *root, const char *write_loc) {
int dfd;
char next_root[256];
char next_write[256];
dfd = sceIoDopen(root);
if(dfd > 0) {
SceIoDirent dir;
while(sceIoDread(dfd, &dir) > 0) {
if(dir.d_stat.st_attr & FIO_SO_IFDIR) {
if(dir.d_name[0] != '.') {
build_path(next_write, write_loc, dir.d_name, 0);
build_path(next_root, root, dir.d_name, 1);
set_filenum(next_root, next_write);
}
} else {
check_file(root, write_loc, dir.d_name);
}
}
sceIoDclose(dfd);
}
} _________________ If not actually, then potentially. |
|
| 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
|