Subversion Repositories Games.Carmageddon

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. #include "resreg.h"
  2. #include "harness/trace.h"
  3.  
  4. #include "CORE/FW/fwsetup.h"
  5. #include "CORE/FW/register.h"
  6. #include <stddef.h>
  7. #include <stdio.h>
  8.  
  9. // IDA: br_resource_class* __cdecl BrResClassAdd(br_resource_class *rclass)
  10. br_resource_class* BrResClassAdd(br_resource_class* rclass) {
  11.     br_resource_class* r;
  12.  
  13.     r = BrRegistryAdd(&fw.reg_resource_classes, rclass);
  14.     if (r != NULL) {
  15.         fw.resource_class_index[rclass->res_class] = r;
  16.     }
  17.     return r;
  18. }
  19.  
  20. // IDA: br_resource_class* __cdecl BrResClassRemove(br_resource_class *rclass)
  21. br_resource_class* BrResClassRemove(br_resource_class* rclass) {
  22.     br_resource_class* r;
  23.     LOG_TRACE("(%p)", rclass);
  24.  
  25.     r = BrRegistryRemove(&fw.reg_resource_classes, rclass);
  26.     if (r != NULL) {
  27.         fw.resource_class_index[rclass->res_class] = NULL;
  28.     }
  29.     return r;
  30. }
  31.  
  32. // IDA: br_resource_class* __cdecl BrResClassFind(char *pattern)
  33. br_resource_class* BrResClassFind(char* pattern) {
  34.     LOG_TRACE("(\"%s\")", pattern);
  35.  
  36.     return BrRegistryFind(&fw.reg_resource_classes, pattern);
  37. }
  38.  
  39. // IDA: br_resclass_find_cbfn* __cdecl BrResClassFindHook(br_resclass_find_cbfn *hook)
  40. br_resclass_find_cbfn* BrResClassFindHook(br_resclass_find_cbfn* hook) {
  41.     br_resclass_find_cbfn* old;
  42.     LOG_TRACE("(%p)", hook);
  43.  
  44.     old = (br_resclass_find_cbfn*)fw.reg_resource_classes.find_failed_hook;
  45.     fw.reg_resource_classes.find_failed_hook = (br_find_failed_cbfn*)hook;
  46.     return old;
  47. }
  48.  
  49. // IDA: br_uint_32 __cdecl BrResClassAddMany(br_resource_class **items, int n)
  50. br_uint_32 BrResClassAddMany(br_resource_class** items, int n) {
  51.     int i;
  52.     LOG_TRACE("(%p, %d)", items, n);
  53.  
  54.     for (i = 0; i < n; i++) {
  55.         if (BrRegistryAdd(&fw.reg_resource_classes, items[i]) != NULL) {
  56.             fw.resource_class_index[items[i]->res_class] = items[i];
  57.         }
  58.     }
  59.     return n;
  60. }
  61.  
  62. // IDA: br_uint_32 __cdecl BrResClassRemoveMany(br_resource_class **items, int n)
  63. br_uint_32 BrResClassRemoveMany(br_resource_class** items, int n) {
  64.     int i;
  65.     int r;
  66.     LOG_TRACE("(%p, %d)", items, n);
  67.  
  68.     r = 0;
  69.     for (i = 0; i < n; i++) {
  70.         if (BrRegistryRemove(&fw.reg_resource_classes, items[i]) != NULL) {
  71.             fw.resource_class_index[items[i]->res_class] = NULL;
  72.             r++;
  73.         }
  74.     }
  75.     return r;
  76. }
  77.  
  78. // IDA: br_uint_32 __cdecl BrResClassFindMany(char *pattern, br_resource_class **items, int max)
  79. br_uint_32 BrResClassFindMany(char* pattern, br_resource_class** items, int max) {
  80.     LOG_TRACE("(\"%s\", %p, %d)", pattern, items, max);
  81.  
  82.     return BrRegistryFindMany(&fw.reg_resource_classes, pattern, (void**)items, max);
  83. }
  84.  
  85. // IDA: br_uint_32 __cdecl BrResClassCount(char *pattern)
  86. br_uint_32 BrResClassCount(char* pattern) {
  87.     LOG_TRACE("(\"%s\")", pattern);
  88.  
  89.     return BrRegistryCount(&fw.reg_resource_classes, pattern);
  90. }
  91.  
  92. // IDA: br_uint_32 __cdecl BrResClassEnum(char *pattern, br_resclass_enum_cbfn *callback, void *arg)
  93. br_uint_32 BrResClassEnum(char* pattern, br_resclass_enum_cbfn* callback, void* arg) {
  94.     LOG_TRACE("(\"%s\", %p, %p)", pattern, callback, arg);
  95.  
  96.     return BrRegistryEnum(&fw.reg_resource_classes, pattern, (br_enum_cbfn*)callback, arg);
  97. }
  98.