#include "quakedef.h"
-#define MAXRENDERMODULES 64
+#define MAXRENDERMODULES 20
typedef struct rendermodule_s
{
int active; // set by start, cleared by shutdown
- char *name;
+ const char *name;
void(*start)(void);
void(*shutdown)(void);
void(*newmap)(void);
+ void(*devicelost)(void);
+ void(*devicerestored)(void);
}
rendermodule_t;
Cmd_AddCommand("r_restart", R_Modules_Restart, "restarts renderer");
}
-void R_RegisterModule(char *name, void(*start)(void), void(*shutdown)(void), void(*newmap)(void))
+void R_RegisterModule(const char *name, void(*start)(void), void(*shutdown)(void), void(*newmap)(void), void(*devicelost)(void), void(*devicerestored)(void))
{
int i;
for (i = 0;i < MAXRENDERMODULES;i++)
rendermodule[i].start = start;
rendermodule[i].shutdown = shutdown;
rendermodule[i].newmap = newmap;
+ rendermodule[i].devicelost = devicelost;
+ rendermodule[i].devicerestored = devicerestored;
}
void R_Modules_Start(void)
R_SkinFrame_Purge();
}
+void R_Modules_DeviceLost(void)
+{
+ int i;
+ for (i = 0;i < MAXRENDERMODULES;i++)
+ {
+ if (rendermodule[i].name == NULL)
+ continue;
+ if (!rendermodule[i].active)
+ continue;
+ if (!rendermodule[i].devicelost)
+ continue;
+ rendermodule[i].devicelost();
+ }
+}
+
+
+void R_Modules_DeviceRestored(void)
+{
+ int i;
+ for (i = 0;i < MAXRENDERMODULES;i++)
+ {
+ if (rendermodule[i].name == NULL)
+ continue;
+ if (!rendermodule[i].active)
+ continue;
+ if (!rendermodule[i].devicerestored)
+ continue;
+ rendermodule[i].devicerestored();
+ }
+}
+