mirror of
https://git.code.sf.net/p/quake/quakeforge-old
synced 2025-02-16 16:51:16 +00:00
common/plugin.c:
add path searching. currently unix style only (ie ':') and defaults to ".:${LIBDIR}/quakeforge". */Makefile.in: fix up the clean targets a little, so they actually work
This commit is contained in:
parent
7670da27cf
commit
9ed247178f
5 changed files with 43 additions and 15 deletions
|
@ -206,9 +206,12 @@ $(CLEAN_TARGETS):
|
|||
rm -f $(BUILD_DIR)/../$(subst clean-,,$@)
|
||||
|
||||
clean-sound_lib:
|
||||
rm -rf $(BUILD_DIR)/$(subst clean-,,$@)
|
||||
rm -f $(BUILD_DIR)/$(subst clean-,,$@)/*
|
||||
|
||||
clean: clean-sound_lib $(CLEAN_TARGETS)
|
||||
clean-input_libs:
|
||||
rm -f $(BUILD_DIR)/$(subst clean-,,$@)/*
|
||||
|
||||
clean: clean-sound_lib clean-input_libs $(CLEAN_TARGETS)
|
||||
-rmdir $(BUILD_DIR)
|
||||
|
||||
install: $(targets)
|
||||
|
|
|
@ -34,33 +34,58 @@
|
|||
#include <stdio.h>
|
||||
#include <dlfcn.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/param.h>
|
||||
|
||||
#include <config.h>
|
||||
#include <net.h>
|
||||
#include <plugin.h>
|
||||
#include <cvar.h>
|
||||
|
||||
cvar_t drv_path = {"drv_path", LIBDIR "/quakeforge"};
|
||||
cvar_t drv_path = {"drv_path", ".:" LIBDIR "/quakeforge"};
|
||||
|
||||
input_pi *IN;
|
||||
|
||||
int plugin_load(char *filename)
|
||||
void *_plugin_load(const char *filename)
|
||||
{
|
||||
void *h;
|
||||
void *(*gpi) (void);
|
||||
char path_buf[MAXPATHLEN*2+1];
|
||||
char *path,*end;
|
||||
int len;
|
||||
|
||||
if ((h = dlopen(va("./%s", filename), RTLD_LAZY))) {
|
||||
for (path = drv_path.string; *path; path=end) {
|
||||
end = strchr(path,':');
|
||||
if (!end)
|
||||
end = strchr(path,0);
|
||||
len=end-path;
|
||||
if (len>MAXPATHLEN)
|
||||
len=MAXPATHLEN;
|
||||
sprintf(path_buf,"%.*s/%.*s",len,path,MAXPATHLEN,filename);
|
||||
if ((h = dlopen(path_buf, RTLD_LAZY))) {
|
||||
return h;
|
||||
}
|
||||
if (*end)
|
||||
end++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int plugin_load(char *filename)
|
||||
{
|
||||
void *(*gpi) (void);
|
||||
void *h;
|
||||
|
||||
if ((h=_plugin_load(filename))) {
|
||||
if ((gpi = dlsym(h, "get_input_plugin_info"))) {
|
||||
input_pi *p;
|
||||
|
||||
|
||||
p = (input_pi *) gpi();
|
||||
p->handle = h;
|
||||
p->filename = filename;
|
||||
|
||||
|
||||
IN = p;
|
||||
/*
|
||||
} else if (gpi = dlsym(h, "get_sound_plugin_info")) {
|
||||
sound_pi *p;
|
||||
sound_pi *p;
|
||||
|
||||
p = (sound_pi *) gpi();
|
||||
p->handle = h;
|
||||
|
|
|
@ -510,10 +510,10 @@ $(CLEAN_TARGETS):
|
|||
rm -f $(BUILD_DIR)/../$(subst clean-,,$@)
|
||||
|
||||
clean-soft clean-gl clean-client clean-common_lib:
|
||||
rm -rf $(BUILD_DIR)/$(subst clean-,,$@)
|
||||
rm -f $(BUILD_DIR)/$(subst clean-,,$@)/*
|
||||
|
||||
clean: clean-client clean-common_lib $(CLEAN_TARGETS)
|
||||
-rmdir $(BUILD_DIR)
|
||||
clean: clean-client clean-common_lib clean-gl $(CLEAN_TARGETS)
|
||||
-rm -f $(BUILD_DIR)/*
|
||||
|
||||
install: $(targets)
|
||||
$(PROJECT_DIR)/mkinstalldirs $(DESTDIR)/$(bindir)
|
||||
|
|
|
@ -126,7 +126,7 @@ clean-qw-server:
|
|||
rm -f $(BUILD_DIR)/../qw-server
|
||||
|
||||
clean: clean-qw-server
|
||||
rm -rf $(BUILD_DIR)
|
||||
-rm -f $(BUILD_DIR)/*
|
||||
|
||||
install: $(targets)
|
||||
$(PROJECT_DIR)/mkinstalldirs $(DESTDIR)/$(bindir)
|
||||
|
|
|
@ -506,10 +506,10 @@ $(CLEAN_TARGETS):
|
|||
rm -f $(BUILD_DIR)/../$(subst clean-,,$@)
|
||||
|
||||
clean-soft clean-gl clean-common_lib:
|
||||
rm -rf $(BUILD_DIR)/$(subst clean-,,$@)
|
||||
rm -f $(BUILD_DIR)/$(subst clean-,,$@)/*
|
||||
|
||||
clean: clean-soft clean-gl clean-common_lib $(CLEAN_TARGETS)
|
||||
-rmdir $(BUILD_DIR)
|
||||
-rm -f $(BUILD_DIR)/*
|
||||
|
||||
install: $(targets)
|
||||
$(PROJECT_DIR)/mkinstalldirs $(DESTDIR)/$(bindir)
|
||||
|
|
Loading…
Reference in a new issue