FreeRDP
sdl2_resource_manager.cpp
1 
18 #include "sdl2_resource_manager.hpp"
19 #include <iostream>
20 
21 SDL_RWops* SDL2ResourceManager::get(const std::string& type, const std::string& id)
22 {
23  if (useCompiledResources())
24  {
25  auto d = data(type, id);
26  if (!d)
27  return nullptr;
28 
29  auto s = d->size();
30  if (s > INT32_MAX)
31  return nullptr;
32  return SDL_RWFromConstMem(d->data(), static_cast<int>(s));
33  }
34 
35  auto name = filename(type, id);
36  return SDL_RWFromFile(name.c_str(), "rb");
37 }
static SDL_RWops * get(const std::string &type, const std::string &id)