summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/Makefile.in10
-rw-r--r--src/plugins/console.c7
-rw-r--r--src/plugins/gui.c107
-rw-r--r--src/plugins/gui.txt15
-rw-r--r--src/plugins/pid.def (renamed from src/plugins/plugin.def)3
-rw-r--r--src/plugins/sample.def11
6 files changed, 19 insertions, 134 deletions
diff --git a/src/plugins/Makefile.in b/src/plugins/Makefile.in
index a16083981..fa74ff90d 100644
--- a/src/plugins/Makefile.in
+++ b/src/plugins/Makefile.in
@@ -5,7 +5,7 @@ COMMON_H = ../common/plugin.h ../common/cbasetypes.h \
../common/showmsg.h ../common/utils.h ../common/strlib.h \
../common/malloc.h
-PLUGINS = sample sig pid gui console
+PLUGINS = sample sig pid console
@SET_MAKE@
@@ -20,8 +20,6 @@ sig: sig@DLLEXT@
pid: pid@DLLEXT@
-gui: gui@DLLEXT@
-
console: console@DLLEXT@
clean:
@@ -32,7 +30,6 @@ help:
@echo "'sample' - sample plugin"
@echo "'sig' - signal handler plugin"
@echo "'pid' - process id plugin"
- @echo "'gui' - gui plugin"
@echo "'console' - console plugin"
@echo "'all' - builds all above targets"
@echo "'clean' - cleans builds and objects"
@@ -43,14 +40,9 @@ help:
%@DLLEXT@: %.c
@CC@ @CFLAGS@ @CPPFLAGS@ @LDFLAGS@ -shared -o ../../plugins/$@ $<
-gui@DLLEXT@: ../../plugins/gui.conf
-
sig@DLLEXT@: sig.c $(COMMON_OBJ)
@CC@ @CFLAGS@ @CPPFLAGS@ @LDFLAGS@ -shared -o ../../plugins/$@ $< $(COMMON_OBJ)
-../../plugins/%.conf: %.txt
- cp -r $< $@
-
# missing common object files
../common/obj_all/%.o: ../common/%.c $(COMMON_H)
@$(MAKE) -C ../common txt
diff --git a/src/plugins/console.c b/src/plugins/console.c
index 5056eafdc..b1307f863 100644
--- a/src/plugins/console.c
+++ b/src/plugins/console.c
@@ -32,7 +32,8 @@
#define WORKER_FUNC_END(name) } ExitThread(0); return 0; }
#define WORKER_EXECUTE(name,errvar) \
do{ \
- buf.worker = CreateThread(NULL, 0, worker_ ## name, NULL, CREATE_SUSPENDED, NULL); \
+ DWORD dwThreadId; \
+ buf.worker = CreateThread(NULL, 0, worker_ ## name, NULL, CREATE_SUSPENDED, &dwThreadId); \
if( errvar ) \
*errvar = ( buf.worker == NULL ); \
}while(0)
@@ -132,10 +133,10 @@ int (*add_timer_func_list)(TimerFunc func, char* name);
int (*add_timer_interval)(unsigned int tick, TimerFunc func, int id, intptr data, int interval);
int (*delete_timer)(int tid, TimerFunc func);
unsigned int (*gettick)(void);
-int (*parse_console)(char* buf);
+int (*parse_console)(const char* buf);
// Locals
-int tid; // timer id
+int tid = -1; // timer id
BUFFER buf; // input buffer
WORKER_FUNC_DECLARE(getinput); // worker for the input buffer
diff --git a/src/plugins/gui.c b/src/plugins/gui.c
deleted file mode 100644
index f45345341..000000000
--- a/src/plugins/gui.c
+++ /dev/null
@@ -1,107 +0,0 @@
-// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
-// For more information, see LICENCE in the main folder
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include "../common/plugin.h"
-//Needed for strcmpi
-#include "../common/mmo.h"
-
-// "I'm Alive" and "Flush stdout" Originally by Mugendai
-// Ported to plugin by Celest
-
-PLUGIN_INFO = {
- "AthenaGUI",
- PLUGIN_CORE,
- "1.0",
- PLUGIN_VERSION,
- "Core plugin for Athena GUI functions"
-};
-
-PLUGIN_EVENTS_TABLE = {
- { "gui_init", "Plugin_Init" },
- { NULL, NULL }
-};
-
-typedef int (*TimerFunc)(int tid, unsigned int tick, int id, intptr data);
-unsigned int (*gettick)();
-int (*add_timer_func_list)(TimerFunc func, char* name);
-int (*add_timer_interval)(unsigned int tick, TimerFunc func, int id, intptr data, int interval);
-
-//-----------------------------------------------------
-//I'm Alive Alert
-//Used to output 'I'm Alive' every few seconds
-//Intended to let frontends know if the app froze
-//-----------------------------------------------------
-int imalive_timer(int tid, unsigned int tick, int id, intptr data)
-{
- printf("I'm Alive\n");
- return 0;
-}
-
-//-----------------------------------------------------
-//Flush stdout
-//stdout buffer needs flushed to be seen in GUI
-//-----------------------------------------------------
-int flush_timer(int tid, unsigned int tick, int id, intptr data)
-{
- fflush(stdout);
- return 0;
-}
-
-void gui_init ()
-{
- char line[1024], w1[1024], w2[1024];
- int flush_on = 0;
- int flush_time = 100;
- int imalive_on = 0;
- int imalive_time = 30;
- char **argv;
- int *argc;
- FILE *fp;
- int i;
-
- IMPORT_SYMBOL(argc, 2);
- IMPORT_SYMBOL(argv, 3);
- IMPORT_SYMBOL(gettick, 5);
- IMPORT_SYMBOL(add_timer_interval, 8);
- IMPORT_SYMBOL(add_timer_func_list, 9);
-
- do {
- fp = fopen("plugins/gui.conf","r");
- if (fp == NULL)
- break;
-
- while(fgets(line, sizeof(line), fp))
- {
- if (line[0] == '/' && line[1] == '/')
- continue;
- if (sscanf(line, "%[^:]: %[^\r\n]", w1, w2) == 2) {
- if(strcmpi(w1,"imalive_on")==0){
- imalive_on = atoi(w2);
- } else if(strcmpi(w1,"imalive_time")==0){
- imalive_time = atoi(w2);
- } else if(strcmpi(w1,"flush_on")==0){
- flush_on = atoi(w2);
- } else if(strcmpi(w1,"flush_time")==0){
- flush_time = atoi(w2);
- }
- }
- }
- fclose(fp);
- } while (0);
-
- for (i = 1; i < *argc ; i++)
- if (strcmp(argv[i], "--gui") == 0)
- flush_on = imalive_on = 1;
-
- if (flush_on) {
- add_timer_func_list(flush_timer, "flush_timer");
- add_timer_interval(gettick()+1000,flush_timer,0,0,flush_time);
- }
- if (imalive_on) {
- add_timer_func_list(imalive_timer, "imalive_timer");
- add_timer_interval(gettick()+10, imalive_timer,0,0,imalive_time*1000);
- }
-}
diff --git a/src/plugins/gui.txt b/src/plugins/gui.txt
deleted file mode 100644
index c71b684b6..000000000
--- a/src/plugins/gui.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-//
-// GUI Plugin Configuration
-//
-
-// Enable I'm Alive?
-imalive_on: 0
-
-// How often to display I'm Alive (in seconds)
-imalive_time: 30
-
-// Enable GUI flushing for Mugendai's GUI?
-flush_on: 0
-
-// How often to flush the buffer on-screen (in seconds)
-flush_time: 60
diff --git a/src/plugins/plugin.def b/src/plugins/pid.def
index 6117bedc6..a70cf8127 100644
--- a/src/plugins/plugin.def
+++ b/src/plugins/pid.def
@@ -2,3 +2,6 @@ EXPORTS
plugin_info DATA
plugin_event_table DATA
plugin_call_table DATA
+
+ pid_create
+ pid_delete
diff --git a/src/plugins/sample.def b/src/plugins/sample.def
new file mode 100644
index 000000000..f5c4af652
--- /dev/null
+++ b/src/plugins/sample.def
@@ -0,0 +1,11 @@
+EXPORTS
+ ; common exports
+ plugin_info DATA
+ plugin_event_table DATA
+ plugin_call_table DATA
+
+ ; plugin-specific exports
+ test_me
+ do_init
+ do_final
+ some_function