wkc.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #ifndef _WKC_H
  2. #define _WKC_H
  3. #include <bfc/dispatch.h>
  4. /**
  5. A callback class for the loader so it can determine which resources wasabi.dll should load.
  6. */
  7. class NOVTABLE WasabiKernelController : public Dispatchable {
  8. public:
  9. /**
  10. Check if a component should load.
  11. */
  12. int testComponent(const char *filename);
  13. int testScript(const char *filename, void *data, int datalen);
  14. int testSkin(const char *skinname);
  15. int testSkinFile(const char *filename);
  16. protected:
  17. enum {
  18. TESTCOMPONENT=1000,
  19. TESTSCRIPT=2000,
  20. TESTSKIN=3000,
  21. TESTSKINFILE=4000,
  22. };
  23. };
  24. inline
  25. int WasabiKernelController::testComponent(const char *filename) {
  26. return _call(TESTCOMPONENT, TRUE, filename);
  27. }
  28. inline
  29. int WasabiKernelController::testScript(const char *filename, void *data, int datalen) {
  30. return _call(TESTSCRIPT, TRUE, filename, data, datalen);
  31. }
  32. inline
  33. int WasabiKernelController::testSkin(const char *skinname) {
  34. return _call(TESTSKIN, TRUE, skinname);
  35. }
  36. inline
  37. int WasabiKernelController::testSkinFile(const char *filename) {
  38. return _call(TESTSKINFILE, TRUE, filename);
  39. }
  40. // implementors derive from this one
  41. class WasabiKernelControllerI : public WasabiKernelController {
  42. public:
  43. // default to OK
  44. virtual int testComponent(const char *filename) { return 1; }
  45. virtual int testScript(const char *filename, void *data, int datalen) { return 1; }
  46. virtual int testSkin(const char *skinname) { return 1; }
  47. virtual int testSkinFile(const char *filename) { return 1; }
  48. protected:
  49. RECVS_DISPATCH;
  50. };
  51. #endif