dynamic_mod.c
branchSDL-1.2
changeset 865 3ffb22a2755b
parent 518 8bc9b5fd2aae
child 940 36238c70b819
equal deleted inserted replaced
864:c8dc1ec196f5 865:3ffb22a2755b
    57 		if ( mikmod.MikMod_InfoLoader == NULL ) {
    57 		if ( mikmod.MikMod_InfoLoader == NULL ) {
    58 			SDL_UnloadObject(mikmod.handle);
    58 			SDL_UnloadObject(mikmod.handle);
    59 			return -1;
    59 			return -1;
    60 		}
    60 		}
    61 		mikmod.MikMod_Init =
    61 		mikmod.MikMod_Init =
    62 			(BOOL (*)(CHAR*))
    62 			(int (*)(MIKMOD3_CONST CHAR*))
    63 			SDL_LoadFunction(mikmod.handle, "MikMod_Init");
    63 			SDL_LoadFunction(mikmod.handle, "MikMod_Init");
    64 		if ( mikmod.MikMod_Init == NULL ) {
    64 		if ( mikmod.MikMod_Init == NULL ) {
    65 			SDL_UnloadObject(mikmod.handle);
    65 			SDL_UnloadObject(mikmod.handle);
    66 			return -1;
    66 			return -1;
    67 		}
    67 		}
    85 		if ( mikmod.MikMod_errno == NULL ) {
    85 		if ( mikmod.MikMod_errno == NULL ) {
    86 			SDL_UnloadObject(mikmod.handle);
    86 			SDL_UnloadObject(mikmod.handle);
    87 			return -1;
    87 			return -1;
    88 		}
    88 		}
    89 		mikmod.MikMod_strerror =
    89 		mikmod.MikMod_strerror =
    90 			(char* (*)(int))
    90 			(MIKMOD3_CONST char* (*)(int))
    91 			SDL_LoadFunction(mikmod.handle, "MikMod_strerror");
    91 			SDL_LoadFunction(mikmod.handle, "MikMod_strerror");
    92 		if ( mikmod.MikMod_strerror == NULL ) {
    92 		if ( mikmod.MikMod_strerror == NULL ) {
    93 			SDL_UnloadObject(mikmod.handle);
    93 			SDL_UnloadObject(mikmod.handle);
    94 			return -1;
    94 			return -1;
       
    95 		}
       
    96 		mikmod.MikMod_free =
       
    97 			(void (*)(void*))
       
    98 			SDL_LoadFunction(mikmod.handle, "MikMod_free");
       
    99 		if ( mikmod.MikMod_free == NULL ) {
       
   100 			/* libmikmod 3.1 and earlier doesn't have it */
       
   101 			mikmod.MikMod_free = free;
    95 		}
   102 		}
    96 		mikmod.Player_Active =
   103 		mikmod.Player_Active =
    97 			(BOOL (*)(void))
   104 			(BOOL (*)(void))
    98 			SDL_LoadFunction(mikmod.handle, "Player_Active");
   105 			SDL_LoadFunction(mikmod.handle, "Player_Active");
    99 		if ( mikmod.Player_Active == NULL ) {
   106 		if ( mikmod.Player_Active == NULL ) {
   237 		mikmod.MikMod_Init = MikMod_Init;
   244 		mikmod.MikMod_Init = MikMod_Init;
   238 		mikmod.MikMod_RegisterAllLoaders = MikMod_RegisterAllLoaders;
   245 		mikmod.MikMod_RegisterAllLoaders = MikMod_RegisterAllLoaders;
   239 		mikmod.MikMod_RegisterDriver = MikMod_RegisterDriver;
   246 		mikmod.MikMod_RegisterDriver = MikMod_RegisterDriver;
   240 		mikmod.MikMod_errno = &MikMod_errno;
   247 		mikmod.MikMod_errno = &MikMod_errno;
   241 		mikmod.MikMod_strerror = MikMod_strerror;
   248 		mikmod.MikMod_strerror = MikMod_strerror;
       
   249 #if (LIBMIKMOD_VERSION < 0x030200) || !defined(DMODE_NOISEREDUCTION)
       
   250 		/* libmikmod 3.2.0-beta2 or older */
       
   251 		mikmod.MikMod_free = free;
       
   252 #else
       
   253 		mikmod.MikMod_free = MikMod_free;
       
   254 #endif
   242 		mikmod.Player_Active = Player_Active;
   255 		mikmod.Player_Active = Player_Active;
   243 		mikmod.Player_Free = Player_Free;
   256 		mikmod.Player_Free = Player_Free;
   244 		mikmod.Player_LoadGeneric = Player_LoadGeneric;
   257 		mikmod.Player_LoadGeneric = Player_LoadGeneric;
   245 		mikmod.Player_SetPosition = Player_SetPosition;
   258 		mikmod.Player_SetPosition = Player_SetPosition;
   246 		mikmod.Player_SetVolume = Player_SetVolume;
   259 		mikmod.Player_SetVolume = Player_SetVolume;