void PluginManager_Init() { bbplugins = NULL; PluginManager_FT.dwLowDateTime = PluginManager_FT.dwHighDateTime = 0; const char *path=plugrcPath(); get_filetime(path, &PluginManager_FT); FILE *fp = fopen(path,"rb"); if (fp) { char szBuffer[MAX_PATH]; while (read_next_line(fp, szBuffer, sizeof szBuffer)) parse_plugin(szBuffer); fclose(fp); } load_all_plugins(); }
static void load_plugin(char * path, int wait) { char linebuf[256]; int fd; char *read_alloc_buf; if (path == NULL) return; if(wait && 0 == strncmp(path, "ms", 2)) { wait_memory_stick_ready_timeout(wait); } fd = sceIoOpen(path, PSP_O_RDONLY, 0777); if(fd < 0) { printk("%s: open %s failed 0x%08X\n", __func__, path, fd); return; } read_alloc_buf = oe_malloc(READ_BUF_SIZE + 64); if(read_alloc_buf == NULL) { sceIoClose(fd); return; } read_buf = (void*)(((u32)read_alloc_buf & (~(64-1))) + 64); linebuf[sizeof(linebuf)-1] = '\0'; while(read_lines(fd, linebuf, sizeof(linebuf)-1) >= 0) { parse_plugin(linebuf); } sceIoClose(fd); oe_free(read_alloc_buf); }