View Single Post
Re: fread and large amounts of data
Old
  (#6)
Austin
Moderator
 
Austin's Avatar
 
Status: Offline
Posts: 403
Join Date: Nov 2003
Default Re: fread and large amounts of data - 15-01-2004

I ran into this problem also and had to do a custom build of ripent to fix it.
I was writing this up when I saw you guys just posted the soution.
It is as you say. It is caused by a too small value of DEFAULT_MAX_MAP_MIPTEX in bspfile.h

Here is my post on VERC in the ZHLT section Oct 10, 2003.

"ripent.exe has been crashing on a number of maps when I try to export the entities.

Here is the problem:
LoadBSPImage()

This line:
g_texdatasize = CopyLump(LUMP_TEXTURES, g_dtexdata, 1, header);

Crashes in CopyLump()
because the map I am loading has a size of 4,363,020
that is being copied into memory that has been allocated with the following size.

bspfile.h
#define DEFAULT_MAX_MAP_MIPTEX 0x400000
// 4Mb of textures is enough especially considering the number of people playing the game
// still with voodoo1 and 2 class cards with limited local memory.

bspfile.cpp
int g_max_map_miptex = DEFAULT_MAX_MAP_MIPTEX;

Why isn't this memory allocated by what is needed in the bsp file instead of some hardcoded size?
I bumped DEFAULT_MAX_MAP_MIPTEX up another meg and it has fixed the crash on all maps that were crashing on me.

Feedback anyone?"

I never got a response.


Actually I had to double this value to be able to load all maps.
#define DEFAULT_MAX_MAP_MIPTEX 0x800000


I good test is cs_alpin. The text area is hugh on this map for some reason.

While you are at it, why don't you change over to dynamic allocation for this memory?
That would be the correct way to go.

PM, good "educated" guess!

Last edited by Austin; 15-01-2004 at 23:45..
  
Reply With Quote