| 287 | } |
| 288 | |
| 289 | bool LoadPrototypeFromDDF(const char* filename, dmParticle::HPrototype* prototype) |
| 290 | { |
| 291 | char path[128]; |
| 292 | dmTestUtil::MakeHostPathf(path, sizeof(path), "build/src/test/%s", filename); |
| 293 | |
| 294 | const uint32_t MAX_FILE_SIZE = 4 * 1024; |
| 295 | unsigned char buffer[MAX_FILE_SIZE]; |
| 296 | uint32_t file_size = 0; |
| 297 | |
| 298 | FILE* f = fopen(path, "rb"); |
| 299 | if (f) |
| 300 | { |
| 301 | file_size = fread(buffer, 1, MAX_FILE_SIZE, f); |
| 302 | fclose(f); |
| 303 | dmParticleDDF::ParticleFX* ddf = 0; |
| 304 | dmDDF::Result r = dmDDF::LoadMessage<dmParticleDDF::ParticleFX>(buffer, file_size, &ddf); |
| 305 | if (r != dmDDF::RESULT_OK) |
| 306 | { |
| 307 | dmLogError("Failed to load particle data"); |
| 308 | return 0x0; |
| 309 | } |
| 310 | *prototype = dmParticle::NewPrototypeFromDDF(ddf); |
| 311 | return *prototype != 0x0; |
| 312 | } |
| 313 | else |
| 314 | { |
| 315 | dmLogWarning("Particle FX could not be loaded: %s.", path); |
| 316 | return false; |
| 317 | } |
| 318 | } |
| 319 | |
| 320 | bool ReloadPrototype(const char* filename, dmParticle::HPrototype prototype) |
| 321 | { |
no test coverage detected