I have a bunch of callback functions i’m using to read from a pak file, and my open callback looks something like this:
[code:32x63wbi]uint_t F_CALLBACKAPI f_open(const char *name)
tchar_t *w_name = toWide(name); // convert name to unicode
filehandle_t *handle;
pakfile_open(w_name, FS_READ, handle);

delete w_name;
//std::cout<<"f_open("<<name<<")"<<" --> "<<*handle<<std::endl;
if (!handle)
  return 0;
  return *handle;

(uint_t is typedef’d as unsigned int)

In another part of my program, I register this (and other) callback functions with fmod, then open and play a stream. With the open function as above, the program crashes right at that point. This SEEMS to be because fmod, before opening my stream, tries to open C:\WINNT\system32\d3d9.dll. As far as my pakfile_open routine is concerned, that’s an invalid filename, so f_open returns a handle of 0, signifying an error.
HOWEVER… if I uncomment the cout statement you see in the code above, THEN there is no crash and the stream plays just fine, and the following is printed to the console:
f_open(C:\WINNT\system32\d3d9.dll) –> 0
f_open(music/menu.mp3) –> 1

So what’s the deal here… why would these debugging statements change the behavior of fmod? Is there some sort of timing issue involved?

  • You must to post comments

[quote="brett":rb5zq739]sounds more like you may have caused some memory corruption or stack overflow somewhere, timing wouldnt have anything to do with it i think.[/quote:rb5zq739]

Yeah, after some extensive debugging, I think I’ve proved to myself that the problem lies somewhere in my own code, although I’m still absolutely stymied as to what and where that problem is :). Thanks, though.

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.