-
Notifications
You must be signed in to change notification settings - Fork 148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
What is the FOPEN_MAX of the real PSP console? #29
Comments
I was interested in this, too. Here's what I found. First, it's worth mentioning that PSPSDK's libc has a I wrote a test application which tried to open as many different files as possible via The application was able to open 56 different files simultaneously. What I think is most interesting is that the highest file descriptor value it could get was 63 (if we include 0, that makes 64 file descriptors, which makes sense to me since it's a power of two). I guess it's reasonable to assume that the kernel reserves 8 file descriptors, and supports up to 64 (per-module? system-wide? idk). These are nice power of two integers. (edit) I'm testing on a PSP SLIM 2000, with firmware version 6.35. |
Thanks so much for your reply! |
idk, hopefully an expert out there knows, but my I guess is, it could have been a copy-paste or just an educated guess.
Regardless of PPSSPP, the "real" existing PSP games do not use the PSPSDK's libc (which is unofficial), hence I'm pretty sure the limitation is not there (or is way bigger). Not even all homebrew PSP games are guaranteed to use it, because there are various alternatives (e.g newlib). When building a homebrew PSP game with the current SDK, you can set Knowing that, PPSSPP is basically a PSP kernel running on high-end platforms such as PCs. One could look at the source on GitHub if they're so inclined, but I'm guessing at some point they're just using the host's fopen() or equivalent, which has practically no limitation (what's the FOPEN_MAX on PC ? :) ). |
Thanks so much! That is very important information for me! Actually I am maintaining the PSP version of a homebrew classic RPG cross-platform reimplementation. I encountered two main problems. One of them is this FOPEN_MAX limiatation. Though I solved it with conditional compilation, but this makes my code unsuitable for being merged into the main stream (The other one is "If bpp is 8, repeated SDL_SetVideoMode calling will cause Display error." pspdev/psplibraries#37 ) . Thanks again! :) |
Sorry, I just finished a file demo: |
In addition, how do we achieve suspend-resume? If a file is being read when suspending, it seems that the pointer position can not be saved? Edit: Solved, but do I have to handle it all by myself? I am not sure whether my solution is stable. for (int i = 3; i < 13; i++) { |
Hello @PalMusicFan, I have modified your example: int main(int argc, char** argv)
{
SetupCallbacks();
atexit(sceKernelExitGame);
pspDebugScreenInit();
int fd;
char pathname[30];
for (int i = 1; i <= 69; i++) {
sprintf(pathname, "%02d.txt", i);
printf("Opening %s: ", pathname);
if ((fd = open(pathname, O_RDONLY)) < 0) {
printf("Failed\n");
break;
}
printf("OK, fd: %i\n", fd);
sceKernelDelayThread(100000);
}
sceKernelDelayThread(10000000);
sceKernelExitGame();
return 0;
} I have tried in both places Looks to be that maxium
So Having in mind that your app needs to open 56 files simultaneously, I think that your problem will be solved with the new toolchain. Thanks! |
Hello!
It seems that only 10 files could be opened simultaneously in the PSP mode of a PSV console. So, is it the limitation of a real PSP console? What is the FOPEN_MAX of a real PSP console?
BTW, in the emulator PPSSPP, much more files could be opened simultaneously.
Thanks!
The text was updated successfully, but these errors were encountered: