[freespace2] bigendian model loading probs

tigital tigital at mac.com
Wed Dec 18 11:24:36 EST 2002


>Ideally, you want to find where these things are originally loaded from
>disk/read from the network, and swap them there if humanly possible.

...the data that needs to be swapped is loaded at read_model_file():

pm->submodel[n].bsp_data_size = cfread_int(fp);
if ( pm->submodel[n].bsp_data_size > 0 )	{
	pm->submodel[n].bsp_data = (ubyte 
*)malloc(pm->submodel[n].bsp_data_size);
	cfread(pm->submodel[n].bsp_data,1,pm->submodel[n].bsp_data_size,fp);
} else {
	pm->submodel[n].bsp_data = NULL;
}


...So, the true weirdness is that this "bsp_data" is referenced 
differently based on what is being looked for!  This seems to leave 
only a few options:

1. swap on read would need to mimic all of the 
modeloctant/modelinterp parsing functions...and would be the obvious 
reason why no one has done this yet!

2. could it be as easy as running blindly through a loop of 
"bsp_data_size" and swap int's?

3. swap on use, which so far isn't working, because it's very complex...

>This is never fun. I've done this work for several games, and it's a total
>motherfucker if byte ordering isn't respected during development.
>
>Trying to swap on the fly (i.e. -- "will this get swapped more than
>once?!") is a last resort, and should be avoided unless it's seriously
>non-trivial to rewrite offending portions of code to behave.
>
>--ryan.

tanx for writing back,
jamie
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://icculus.org/pipermail/freespace2/attachments/20021218/c185916c/attachment.htm>


More information about the freespace2 mailing list