char *_acknex_dll = NULL;
char *_default_wrs = NULL;
void reload_defaultWRS()
{
if(!_acknex_dll)
{
// Read the acknex.dll in
FILE *file = fopen(_chr(str_printf(NULL, "%s\\%s", _chr(exe_dir), "acknex.dll")), "rb");
fseek(file, 0, SEEK_END);
long length = ftell(file);
fseek(file, 0, SEEK_SET);
_acknex_dll = malloc(length);
fread(_acknex_dll, length, 1 file);
fclose(file);
// Look for the WRS resource
char *temp = _acknex_dll;
while(1)
{
temp = strstr(temp, "WRS3");
if(!temp)
break;
if(temp[4] == '\0') // strings in the string section are terminated with a 0 byte, so if there is one, this isn't the WRS we are looking for
{
temp += 4;
continue;
}
_default_wrs = temp;
break;
}
}
if(!_default_wrs)
{
error("Couldn't find default WRS!");
return;
}
add_resource(_default_wrs);
}