BGE Blend file loading was using BLO_read_from_memory which meant relative linked libraries could not be found.

This is odd because BLO_read_from_file was commented out with """//this doesn't work anymore for relative paths, so use BLO_read_from_memory instead"""
Undoing Erwins changes from r7497, just use normal file loading. From the commit log its not clear if he means relative filenames or relative linked libs but from testing both work now.
This commit is contained in:
Campbell Barton 2008-08-18 23:48:59 +00:00
parent deadd5ee01
commit a7f5109f23

@ -90,33 +90,10 @@ void update_for_newframe();
static BlendFileData *load_game_data(char *filename) {
BlendReadError error;
//this doesn't work anymore for relative paths, so use BLO_read_from_memory instead
//BlendFileData *bfd= BLO_read_from_file(filename, &error);
FILE* file = fopen(filename,"rb");
BlendFileData *bfd = 0;
if (file)
{
fseek(file, 0L, SEEK_END);
int len= ftell(file);
fseek(file, 0L, SEEK_SET);
char* filebuffer= new char[len];//MEM_mallocN(len, "text_buffer");
int sizeread = fread(filebuffer,len,1,file);
if (sizeread==1){
bfd = BLO_read_from_memory(filebuffer, len, &error);
} else {
error = BRE_UNABLE_TO_READ;
}
fclose(file);
// the memory is not released in BLO_read_from_memory, must do it here
delete filebuffer;
} else {
error = BRE_UNABLE_TO_OPEN;
}
BlendFileData *bfd= BLO_read_from_file(filename, &error);
if (!bfd) {
printf("Loading %s failed: %s\n", filename, BLO_bre_as_string(error));
}
return bfd;
}