Hi!
By playing with the plugins, I realized it wasn't easy to query these for 
infos such as their capabilities or simply an identifier to get its name. 
Whether it is for inter-plugins communication (a GUI and a keyboard, for 
ex.) or simply to monitor general infos, I strongly suggest we add some 
query functionnalities. I think the OpenGL way is quite good, and can 
easily describe what I have in mind. Here are the functions that I propose:

int plugin_get_integers(int request, int *data);
int plugin_get_bools(int request, bool *data);
int plugin_get_strings(int request, char **data);
int plugin_get_function(int request, (void*) (*function) (void*));

and a general plugin finder

plugin_t *plugin_find(char *name);

These functions return a standard value (eg. 0) on success and something 
else on failure. 'request' is a constant defines in a common header, and 
'data' is a pointer to an array able to contain enough data. All of these 
functions except plugin_get_function can return many values (like port 
numbers). There is no need to hyper-optimize them as they shouldn't be 
called a lot.
The plugin_find function should be implemented as a mean for plugins to 
find others, and the plugin_get_function is used for things like asking a 
keyboard plugin a scancode to send to the VM.

Useless example:

plugin_t *floppyFD0;
floppyFD0 = plugin_find(floppy);        /* floppy = eg. "FirstFloppy" */
if (floppyFD0)
   if (! floppyFD0->plugin_get_bools(PL_FLOPPY_INSERTED, &floppyStatus))
   {
     if (floppyStatus)
        printf("Floppy %s is inserted \n", floppy);     /* "Floppy FirstFloppy 
is inserted" */
     else
        printf("Floppy %s is ejected \n", floppy);      /* "Floppy FirstFloppy 
is ejected" */
   }


I also suggest the Bochs plugin to be separated into many, as I think it is 
way too monolithic to easily add, test or update single components, like 
the GUI or the CD-ROM, or to use many instances of a single plugin, like 
two floppies. By design, Plex86 should keep modules the more independent 
possible.

Last, I propose an update to the configuration file to a more "object 
oriented" one, where users can themselves give significant names to their 
plugins and easily configure them.

Incomplete example:

[general]
memory = 16
db_syntax = at&t
prescan_depth = 3, ring3 = on

[plugins]
FirstFloppy = ./plugins/block/floppy.so
SecondFloppy = ./plugins/block/floppy.so
SuperGUI = ./plugins/gui/super-kde-interface.so
KBDevice = ./plugins/misc/keyboard.so

[FirstFloppy]
status = inserted
format = auto
file = /dev/fd0

[SecondFloppy]
status = inserted
format = auto
file = ~/floppy.img

[SuperGUI]
fullscreen = yes
keyboard = KBDevice


Most of my suggestions are trivial, and I'd feel of some use to do these.
Of course, I'd like to hear your opinions before I start coding like a mad 
in my holidays :-)

EL


Reply via email to