I've tried to create my own ResourceProvider for CEGUI to integrate into my own Resource System.
Some of the functions may appear to look like OGRE, but it far from is...
Code: Select all
void CEGUIResourceProvider::loadRawDataContainer(const CEGUI::String& filename, CEGUI::RawDataContainer& output, const CEGUI::String& resourceGroup)
{
DataStream* stream = m_Resources->openResource(filename.c_str(), resourceGroup.c_str());
if(stream == NULL)
{
m_Root->log()->writeLog("Error! Could not load " + String(filename.c_str()) + " from group " + String(resourceGroup.c_str()) + "!");
return;
}
m_Root->log()->debugLog("CEGUIResourceProvider::loadRawDataContainer: Opened file " + String(filename.c_str()) + " successfully!");
CEGUI::uint8* buf = new CEGUI::uint8;
stream->read(buf, stream->getSize());
output.setData(buf);
output.setSize(stream->getSize());
m_Root->log()->debugLog("CEGUIResourceProvider::loadRawDataContainer: Provided " + String(filename.c_str()) + " with size " + StringConverter::toString(int(stream->getSize())) + " successfully!");
}
void CEGUIResourceProvider::unloadRawDataContainer(CEGUI::RawDataContainer& c)
{
}
size_t CEGUIResourceProvider::getResourceGroupFileNames(std::vector<CEGUI::String>& out_vec, const CEGUI::String& file_pattern, const CEGUI::String& resource_group)
{
ResourceGroup* group = m_Resources->getGroup(String(resource_group.c_str()));
if(group == NULL)
{
m_Root->log()->writeLog("CEGUIResourceProvider::getResourceGroupFileNames: No such group (" + String(resource_group.c_str()) + ")!");
return 0;
}
const Stringvector v = group->getResourceFileNames();
for(Stringvector::const_iterator it = v.begin(); it != v.end(); ++it)
{
out_vec.push_back(*it);
}
m_Root->log()->debugLog("CEGUIResourceProvider::getResourceGroupFilenames: Read " + StringConverter::toString(int(out_vec.size())) + " of " + StringConverter::toString(int(v.size())) + " files from resource group " + resource_group.c_str());
return v.size();
}
Really strange things happen in run-time... And worst of all - each time I start it up, a new issue appears.
Just one of them, a segmentation fault (also had Sigabort)
CEGUITinyXMLParser.cpp:69 - Segmentation fault here... Debugger resolves size to 1957 which is matching the file being loaded.
Code: Select all
char* buf = new char[size + 2];
Any clues ? :/
My Log doesn't tell anything, but heres the 'essential part' anyway:
Code: Select all
16/04/2010 19:03:10 (Std) ---- Version 0.7.1 (Build: Apr 16 2010 GNU/Linux g++ 4.4.1 64 bit) ----
16/04/2010 19:03:10 (Std) ---- Renderer module is: CEGUI::OgreRenderer - Official OGRE based 2nd generation renderer module. ----
16/04/2010 19:03:10 (Std) ---- XML Parser module is: CEGUI::TinyXMLParser - Official tinyXML based parser module for CEGUI ----
16/04/2010 19:03:10 (Std) ---- Image Codec module is: TGAImageCodec - Official TGA image codec ----
16/04/2010 19:03:10 (Std) ---- Scripting module is: None ----