The hdimage, networking and sound code now also use PLUG_get_plugins_counrt()
and PLUG_get_plugin_name() in case plugin support is disabled. Removed temporary compatibility code from the self-registering stuff.
This commit is contained in:
parent
535856833c
commit
744efe9c22
@ -76,22 +76,14 @@ void bx_hdimage_ctl_c::init(void)
|
||||
{
|
||||
Bit8u count = n_hdimage_builtin_modes;
|
||||
|
||||
#if !BX_PLUGINS
|
||||
count += hdimage_locator_c::get_modules_count();
|
||||
#else
|
||||
count += PLUG_get_plugins_count(PLUGTYPE_IMG);
|
||||
#endif
|
||||
hdimage_mode_names = (const char**) malloc((count + 1) * sizeof(char*));
|
||||
for (Bit8u i = 0; i < n_hdimage_builtin_modes; i++) {
|
||||
hdimage_mode_names[i] = builtin_mode_names[i];
|
||||
}
|
||||
Bit8u n = 0;
|
||||
for (Bit8u i = n_hdimage_builtin_modes; i < count; i++) {
|
||||
#if !BX_PLUGINS
|
||||
hdimage_mode_names[i] = hdimage_locator_c::get_module_name(n);
|
||||
#else
|
||||
hdimage_mode_names[i] = PLUG_get_plugin_name(PLUGTYPE_IMG, n);
|
||||
#endif
|
||||
n++;
|
||||
}
|
||||
hdimage_mode_names[count] = NULL;
|
||||
@ -190,7 +182,6 @@ cdrom_base_c* bx_hdimage_ctl_c::init_cdrom(const char *dev)
|
||||
#endif // ifndef BXIMAGE
|
||||
|
||||
hdimage_locator_c *hdimage_locator_c::all = NULL;
|
||||
Bit8u hdimage_locator_c::count = 0;
|
||||
|
||||
//
|
||||
// Each disk image module has a static locator class that registers
|
||||
@ -209,7 +200,6 @@ hdimage_locator_c::hdimage_locator_c(const char *mode)
|
||||
while (ptr->next) ptr = ptr->next;
|
||||
ptr->next = this;
|
||||
}
|
||||
count++;
|
||||
}
|
||||
|
||||
hdimage_locator_c::~hdimage_locator_c()
|
||||
@ -233,24 +223,6 @@ hdimage_locator_c::~hdimage_locator_c()
|
||||
}
|
||||
}
|
||||
|
||||
Bit8u hdimage_locator_c::get_modules_count()
|
||||
{
|
||||
return count;
|
||||
}
|
||||
|
||||
const char* hdimage_locator_c::get_module_name(Bit8u index)
|
||||
{
|
||||
hdimage_locator_c *ptr;
|
||||
Bit8u n = 0;
|
||||
|
||||
for (ptr = all; ptr != NULL; ptr = ptr->next) {
|
||||
if (n == index)
|
||||
return ptr->mode;
|
||||
n++;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool hdimage_locator_c::module_present(const char *mode)
|
||||
{
|
||||
hdimage_locator_c *ptr;
|
||||
|
@ -638,8 +638,6 @@ BOCHSAPI extern bx_hdimage_ctl_c bx_hdimage_ctl;
|
||||
class BOCHSAPI_MSVCONLY hdimage_locator_c {
|
||||
public:
|
||||
static bool module_present(const char *mode);
|
||||
static Bit8u get_modules_count(void);
|
||||
static const char* get_module_name(Bit8u index);
|
||||
static void cleanup(void);
|
||||
static device_image_t *create(const char *mode, Bit64u disk_size, const char *journal);
|
||||
static bool detect_image_mode(int fd, Bit64u disk_size, const char **image_mode);
|
||||
@ -649,7 +647,6 @@ protected:
|
||||
virtual device_image_t *allocate(Bit64u disk_size, const char *journal) = 0;
|
||||
virtual int check_format(int fd, Bit64u disk_size) {return -1;}
|
||||
private:
|
||||
static Bit8u count;
|
||||
static hdimage_locator_c *all;
|
||||
hdimage_locator_c *next;
|
||||
const char *mode;
|
||||
|
@ -45,18 +45,10 @@ void bx_netmod_ctl_c::init(void)
|
||||
{
|
||||
Bit8u i, count = 0;
|
||||
|
||||
#if !BX_PLUGINS
|
||||
count = eth_locator_c::get_modules_count();
|
||||
#else
|
||||
count = PLUG_get_plugins_count(PLUGTYPE_NET);
|
||||
#endif
|
||||
net_module_names = (const char**) malloc((count + 1) * sizeof(char*));
|
||||
for (i = 0; i < count; i++) {
|
||||
#if !BX_PLUGINS
|
||||
net_module_names[i] = eth_locator_c::get_module_name(i);
|
||||
#else
|
||||
net_module_names[i] = PLUG_get_plugin_name(PLUGTYPE_NET, i);
|
||||
#endif
|
||||
}
|
||||
net_module_names[count] = NULL;
|
||||
// move 'null' module to the top of the list
|
||||
@ -141,7 +133,6 @@ void* bx_netmod_ctl_c::init_module(bx_list_c *base, void *rxh, void *rxstat, bx_
|
||||
}
|
||||
|
||||
eth_locator_c *eth_locator_c::all;
|
||||
Bit8u eth_locator_c::count = 0;
|
||||
|
||||
//
|
||||
// Each pktmover module has a static locator class that registers
|
||||
@ -160,7 +151,6 @@ eth_locator_c::eth_locator_c(const char *type)
|
||||
while (ptr->next) ptr = ptr->next;
|
||||
ptr->next = this;
|
||||
}
|
||||
count++;
|
||||
}
|
||||
|
||||
eth_locator_c::~eth_locator_c()
|
||||
@ -184,24 +174,6 @@ eth_locator_c::~eth_locator_c()
|
||||
}
|
||||
}
|
||||
|
||||
Bit8u eth_locator_c::get_modules_count()
|
||||
{
|
||||
return count;
|
||||
}
|
||||
|
||||
const char* eth_locator_c::get_module_name(Bit8u index)
|
||||
{
|
||||
eth_locator_c *ptr;
|
||||
Bit8u n = 0;
|
||||
|
||||
for (ptr = all; ptr != NULL; ptr = ptr->next) {
|
||||
if (n == index)
|
||||
return ptr->type;
|
||||
n++;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool eth_locator_c::module_present(const char *type)
|
||||
{
|
||||
eth_locator_c *ptr = 0;
|
||||
|
@ -119,8 +119,6 @@ protected:
|
||||
class BOCHSAPI_MSVCONLY eth_locator_c {
|
||||
public:
|
||||
static bool module_present(const char *type);
|
||||
static Bit8u get_modules_count(void);
|
||||
static const char* get_module_name(Bit8u index);
|
||||
static void cleanup();
|
||||
static eth_pktmover_c *create(const char *type, const char *netif,
|
||||
const char *macaddr,
|
||||
@ -138,7 +136,6 @@ protected:
|
||||
bx_devmodel_c *dev,
|
||||
const char *script) = 0;
|
||||
private:
|
||||
static Bit8u count;
|
||||
static eth_locator_c *all;
|
||||
eth_locator_c *next;
|
||||
const char *type;
|
||||
|
@ -595,7 +595,6 @@ int bx_soundlow_midiout_c::closemidioutput()
|
||||
return BX_SOUNDLOW_OK;
|
||||
}
|
||||
|
||||
Bit8u bx_sound_lowlevel_c::count = 0;
|
||||
bx_sound_lowlevel_c *bx_sound_lowlevel_c::all;
|
||||
|
||||
// bx_sound_lowlevel_c class implementation
|
||||
@ -618,7 +617,6 @@ bx_sound_lowlevel_c::bx_sound_lowlevel_c(const char *type)
|
||||
while (ptr->next) ptr = ptr->next;
|
||||
ptr->next = this;
|
||||
}
|
||||
count++;
|
||||
}
|
||||
|
||||
bx_sound_lowlevel_c::~bx_sound_lowlevel_c()
|
||||
@ -652,24 +650,6 @@ bx_sound_lowlevel_c::~bx_sound_lowlevel_c()
|
||||
}
|
||||
}
|
||||
|
||||
Bit8u bx_sound_lowlevel_c::get_modules_count()
|
||||
{
|
||||
return count;
|
||||
}
|
||||
|
||||
const char* bx_sound_lowlevel_c::get_module_name(Bit8u index)
|
||||
{
|
||||
bx_sound_lowlevel_c *ptr;
|
||||
Bit8u n = 0;
|
||||
|
||||
for (ptr = all; ptr != NULL; ptr = ptr->next) {
|
||||
if (n == index)
|
||||
return ptr->type;
|
||||
n++;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool bx_sound_lowlevel_c::module_present(const char *type)
|
||||
{
|
||||
bx_sound_lowlevel_c *ptr = 0;
|
||||
|
@ -174,8 +174,6 @@ public:
|
||||
class BOCHSAPI_MSVCONLY bx_sound_lowlevel_c : public logfunctions {
|
||||
public:
|
||||
static bool module_present(const char *type);
|
||||
static Bit8u get_modules_count(void);
|
||||
static const char* get_module_name(Bit8u index);
|
||||
static bx_sound_lowlevel_c* get_module(const char *type);
|
||||
static void cleanup();
|
||||
|
||||
@ -191,7 +189,6 @@ protected:
|
||||
bx_soundlow_wavein_c *wavein;
|
||||
bx_soundlow_midiout_c *midiout;
|
||||
private:
|
||||
static Bit8u count;
|
||||
static bx_sound_lowlevel_c *all;
|
||||
bx_sound_lowlevel_c *next;
|
||||
const char *type;
|
||||
|
@ -46,18 +46,10 @@ void bx_soundmod_ctl_c::init()
|
||||
{
|
||||
Bit8u i, count = 0;
|
||||
|
||||
#if !BX_PLUGINS
|
||||
count = bx_sound_lowlevel_c::get_modules_count();
|
||||
#else
|
||||
count = PLUG_get_plugins_count(PLUGTYPE_SND);
|
||||
#endif
|
||||
sound_driver_names = (const char**) malloc((count + 1) * sizeof(char*));
|
||||
for (i = 0; i < count; i++) {
|
||||
#if !BX_PLUGINS
|
||||
sound_driver_names[i] = bx_sound_lowlevel_c::get_module_name(i);
|
||||
#else
|
||||
sound_driver_names[i] = PLUG_get_plugin_name(PLUGTYPE_SND, i);
|
||||
#endif
|
||||
}
|
||||
sound_driver_names[count] = NULL;
|
||||
// move 'dummy' module to the top of the list
|
||||
|
@ -1049,13 +1049,14 @@ plugin_t bx_builtin_plugins[] = {
|
||||
#endif
|
||||
#endif
|
||||
#if BX_NETWORKING
|
||||
BUILTIN_NET_PLUGIN_ENTRY(null),
|
||||
BUILTIN_NET_PLUGIN_ENTRY(vnet),
|
||||
#if BX_NETMOD_FBSD
|
||||
BUILTIN_NET_PLUGIN_ENTRY(fbsd),
|
||||
#endif
|
||||
#if BX_NETMOD_LINUX
|
||||
BUILTIN_NET_PLUGIN_ENTRY(linux),
|
||||
#endif
|
||||
BUILTIN_NET_PLUGIN_ENTRY(null),
|
||||
#if BX_NETMOD_SLIRP
|
||||
BUILTIN_NET_PLUGIN_ENTRY(slirp),
|
||||
#endif
|
||||
@ -1071,16 +1072,15 @@ plugin_t bx_builtin_plugins[] = {
|
||||
#if BX_NETMOD_VDE
|
||||
BUILTIN_NET_PLUGIN_ENTRY(vde),
|
||||
#endif
|
||||
BUILTIN_NET_PLUGIN_ENTRY(vnet),
|
||||
#if BX_NETMOD_WIN32
|
||||
BUILTIN_NET_PLUGIN_ENTRY(win32),
|
||||
#endif
|
||||
#endif
|
||||
#if BX_SUPPORT_PCIUSB
|
||||
BUILTIN_USB_PLUGIN_ENTRY(usb_cbi),
|
||||
BUILTIN_USB_PLUGIN_ENTRY(usb_hid),
|
||||
BUILTIN_USB_PLUGIN_ENTRY(usb_hub),
|
||||
BUILTIN_USB_PLUGIN_ENTRY(usb_msd),
|
||||
BUILTIN_USB_PLUGIN_ENTRY(usb_cbi),
|
||||
BUILTIN_USB_PLUGIN_ENTRY(usb_hub),
|
||||
BUILTIN_USB_PLUGIN_ENTRY(usb_printer),
|
||||
#endif
|
||||
BUILTIN_IMG_PLUGIN_ENTRY(vmware3),
|
||||
|
Loading…
Reference in New Issue
Block a user