add some plugin control from the menu, include spunull
[pcsx_rearmed.git] / frontend / main.c
index 23ed7b1..643d6fe 100644 (file)
@@ -54,6 +54,7 @@ static void CheckSubDir() {
        create_profile_dir(PLUGINS_CFG_DIR);
        create_profile_dir(CHEATS_DIR);
        create_profile_dir(PATCHES_DIR);
+       create_profile_dir(PCSX_DOT_DIR "cfg");
 }
 
 void set_cd_image(const char *fname)
@@ -162,7 +163,6 @@ int main(int argc, char *argv[])
        strcpy(Config.Net, "Disabled");
 
        CheckSubDir();
-//     ScanAllPlugins();
 
        MAKE_PATH(Config.Mcd1, MEMCARD_DIR, "card1.mcd");
        MAKE_PATH(Config.Mcd2, MEMCARD_DIR, "card2.mcd");
@@ -208,8 +208,8 @@ int main(int argc, char *argv[])
                return 1;
        }
 
-       SysReset();
        CheckCdrom();
+       SysReset();
 
        if (file[0] != '\0') {
                if (Load(file) != -1)
@@ -422,9 +422,11 @@ static const int builtin_plugin_ids[] = {
 
 void *SysLoadLibrary(const char *lib) {
        const char *tmp = strrchr(lib, '/');
+       void *ret;
        int i;
 
-       printf("dlopen %s\n", lib);
+       printf("plugin: %s\n", lib);
+
        if (tmp != NULL) {
                tmp++;
                for (i = 0; i < ARRAY_SIZE(builtin_plugins); i++)
@@ -439,7 +441,10 @@ void *SysLoadLibrary(const char *lib) {
        lib = name;
 #endif
 
-       return dlopen(lib, RTLD_NOW);
+       ret = dlopen(lib, RTLD_NOW);
+       if (ret == NULL)
+               fprintf(stderr, "dlopen: %s\n", dlerror());
+       return ret;
 }
 
 void *SysLoadSym(void *lib, const char *sym) {