Example #1
0
            public static void InitializeLibrary(string dllName)
            {
                IDLLHandler dllHandler = null;

#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN
                dllHandler = WindowsDLLHandler.Instance;
#elif UNITY_ANDROID
                dllHandler = AndroidDLLHandler.Instance;
#endif
                if (dllHandler == null)
                {
                    return;
                }
                string path = Application.streamingAssetsPath + "/" + "libwinpthread-1.dll";
                if (File.Exists(path))
                {
                    dllHandler.LoadCore(path);
                }

                dllHandler.LoadCore(dllName);

                RetroApiVersion          = dllHandler.GetMethod <RetroApiVersionDelegate>("retro_api_version");
                RetroInit                = dllHandler.GetMethod <RetroInitDelegate>("retro_init");
                RetroGetSystemInfo       = dllHandler.GetMethod <RetroGetSystemInfoDelegate>("retro_get_system_info");
                RetroGetSystemAVInfo     = dllHandler.GetMethod <RetroGetSystemAVInfoDelegate>("retro_get_system_av_info");
                RetroLoadGame            = dllHandler.GetMethod <RetroLoadGameDelegate>("retro_load_game");
                RetroSetVideoRefresh     = dllHandler.GetMethod <RetroSetVideoRefreshDelegate>("retro_set_video_refresh");
                RetroSetAudioSample      = dllHandler.GetMethod <RetroSetAudioSampleDelegate>("retro_set_audio_sample");
                RetroSetAudioSampleBatch = dllHandler.GetMethod <RetroSetAudioSampleBatchDelegate>("retro_set_audio_sample_batch");
                RetroSetInputPoll        = dllHandler.GetMethod <RetroSetInputPollDelegate>("retro_set_input_poll");
                RetroSetInputState       = dllHandler.GetMethod <RetroSetInputStateDelegate>("retro_set_input_state");
                RetroSetEnvironment      = dllHandler.GetMethod <RetroSetEnvironmentDelegate>("retro_set_environment");
                RetroRun    = dllHandler.GetMethod <RetroRunDelegate>("retro_run");
                RetroDeInit = dllHandler.GetMethod <RetroDeInitDelegate>("retro_deinit");
            }
Example #2
0
            public static IDLLHandler InitializeLibrary(string dllName)
            {
                IDLLHandler dllHandler = null;

#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN
                dllHandler = WindowsDLLHandler.Instance;
#elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX
                dllHandler = OSXDLLHandler.Instance;
#elif UNITY_EDITOR_LINUX || UNITY_STANDALONE_LINUX
                dllHandler = LinuxDLLHandler.Instance;
#elif UNITY_ANDROID
                dllHandler = AndroidDLLHandler.Instance;
#endif

                if (dllHandler == null)
                {
                    return(null);
                }

#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN
                dllHandler.LoadCore("libwinpthread-1");
#endif

                dllHandler.LoadCore(dllName);

                RetroApiVersion          = dllHandler.GetMethod <RetroApiVersionDelegate>("retro_api_version");
                RetroInit                = dllHandler.GetMethod <RetroInitDelegate>("retro_init");
                RetroGetSystemInfo       = dllHandler.GetMethod <RetroGetSystemInfoDelegate>("retro_get_system_info");
                RetroGetSystemAVInfo     = dllHandler.GetMethod <RetroGetSystemAVInfoDelegate>("retro_get_system_av_info");
                RetroLoadGame            = dllHandler.GetMethod <RetroLoadGameDelegate>("retro_load_game");
                RetroSetVideoRefresh     = dllHandler.GetMethod <RetroSetVideoRefreshDelegate>("retro_set_video_refresh");
                RetroSetAudioSample      = dllHandler.GetMethod <RetroSetAudioSampleDelegate>("retro_set_audio_sample");
                RetroSetAudioSampleBatch = dllHandler.GetMethod <RetroSetAudioSampleBatchDelegate>("retro_set_audio_sample_batch");
                RetroSetInputPoll        = dllHandler.GetMethod <RetroSetInputPollDelegate>("retro_set_input_poll");
                RetroSetInputState       = dllHandler.GetMethod <RetroSetInputStateDelegate>("retro_set_input_state");
                RetroSetEnvironment      = dllHandler.GetMethod <RetroSetEnvironmentDelegate>("retro_set_environment");
                RetroRun    = dllHandler.GetMethod <RetroRunDelegate>("retro_run");
                RetroDeInit = dllHandler.GetMethod <RetroDeInitDelegate>("retro_deinit");

                return(dllHandler);
            }
Example #3
0
 public Wrapper(string coreToLoad)
 {
     DLLHandler = Libretro.InitializeLibrary(coreToLoad);
 }