ME question
-
- Posts: 197
- Joined: Fri Jul 01, 2005 2:50 am
ME question
Hi, i've been trying to think of a way to solve a problem, and thought about using the ME. My problem is that I need to write a lot of data to the memory stick without freezing the PSP. I could do this by splitting up the file, but a far faster way would be to use the ME as a file manager CPU.
What I'd like to know is: can I get the ME to save a 2MB+ file to the memory stick whilst allowing the main CPU to get on with it's work unhindered?
Thanks.
What I'd like to know is: can I get the ME to save a 2MB+ file to the memory stick whilst allowing the main CPU to get on with it's work unhindered?
Thanks.
you can try with async writes (or normal writes in a different thread), this could be sufficient to have the operation at the cost of 0.
also writing 64k chunks (with data aligned to 64 bytes) should be the optimal way for psp (it's the optimal size for reading, so i assume it's the same for writing)
also writing 64k chunks (with data aligned to 64 bytes) should be the optimal way for psp (it's the optimal size for reading, so i assume it's the same for writing)
-
- Posts: 197
- Joined: Fri Jul 01, 2005 2:50 am
I'm trying to get the Async to work now, but I've never tried them before, so it's proving tricky, it just boots into a black screen with this code:
In main() before main loop:
The callback:
I know there's somthing wrong here, but I'm not sure what. It may be to do with the callback, I think.
In main() before main loop:
Code: Select all
testAsFile = sceIoOpenAsync("ms0:/textfile.txt", O_RDWR | O_CREAT, 0777);
if(testAsFile < 0){printf("ERROR!");}
int cbida;
cbida = sceKernelCreateCallback("Async Callback", async_callback, NULL);
sceKernelRegisterExitCallback(cbida);
sceKernelSleepThreadCB();
sceIoSetAsyncCallback(testAsFile, cbida, NULL);
char* dat;
dat = "blablabla";
int ret;
ret = sceIoWriteAsync(testAsFile, dat, 9);
if(ret < 0){printf("ERROR!");}
Code: Select all
int async_callback(int arg1, int arg2, void *common)
{
int vl;
vl = sceIoCloseAsync(testAsFile);
return 0;
}
The callback is a mess too. You've created an async callback but registered it as an exit callback.AnonymousTipster wrote:I'm trying to get the Async to work now, but I've never tried them before, so it's proving tricky, it just boots into a black screen with this code:
In main() before main loop:The callback:Code: Select all
testAsFile = sceIoOpenAsync("ms0:/textfile.txt", O_RDWR | O_CREAT, 0777); if(testAsFile < 0){printf("ERROR!");} int cbida; cbida = sceKernelCreateCallback("Async Callback", async_callback, NULL); sceKernelRegisterExitCallback(cbida); sceKernelSleepThreadCB(); sceIoSetAsyncCallback(testAsFile, cbida, NULL); char* dat; dat = "blablabla"; int ret; ret = sceIoWriteAsync(testAsFile, dat, 9); if(ret < 0){printf("ERROR!");}
I know there's somthing wrong here, but I'm not sure what. It may be to do with the callback, I think.Code: Select all
int async_callback(int arg1, int arg2, void *common) { int vl; vl = sceIoCloseAsync(testAsFile); return 0; }
Stick with Jonny's code, it's simpler and should do everything you need.
Got a v2.0-v2.80 firmware PSP? Download the eLoader here to run homebrew on it!
The PSP Homebrew Database needs you!
The PSP Homebrew Database needs you!
To answer to your first question, I think the answer is no, because the ME has no kernel, it can just execute raw code and user routines (but no sce[Something] call).
Sorry for my bad english
Oldschool library for PSP - PC version released
Oldschool library for PSP - PC version released
-
- Posts: 197
- Joined: Fri Jul 01, 2005 2:50 am