[API function]
To load a module from a preloaded memory handle. FMUSIC Supports loading of :
- .MOD (protracker/fasttracker modules)
- .S3M (screamtracker 3 modules)
- .XM (fasttracker 2 modules)
- .IT (impulse tracker modules)
FMUSIC_MODULE * F_API FMUSIC_LoadSongMemory(
void *data,
int length
);
Parameters
data |
Memory handle to data containing song to load.
|
Return Value
On success, a pointer to a FMUSIC_MODULE handle is returned.
On failure, NULL is returned.
Remarks
Loading a song from a memory handle is dangerous in one respect, if the data
is corrupted or truncated, then FMUSIC will crash internally trying to load it.
One XM I tested had been truncated by around 30k somehow in the past. When
FMUSIC tried to load it, it could not help but try and read that 30k, and so
it tried to read outside of memory bounds and crashed. The same file loaded
from a file handle worked ok, becuase a filereader knows where the end of the
file is, and knows to stop.
The only solution to this particular problem is to make this function accept
a length value as well, so the memory reader never tries to read past this, or
you just pass it non corrupted songs. I prefer the latter, to make it easier
on the programmer, so they do not have to make them worry about extra code to
get filesizes.
___________________
Supported on the following platforms : Win32, WinCE, Linux, Macintosh, XBox
See Also
FMUSIC_FreeSong
,
FMUSIC_LoadSong
,
FSOUND_File_SetCallbacks
This document copyright ©Firelight Technologies, Pty, Ltd, 1999-2002. All rights reserved.
Generated Fri Dec 20 16:31:08 2002
by SourceDoc v0.10, the automated source code documenter.