mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-11 15:22:16 +00:00
Use a proper, more unique, pointer formatter for the open callback
This commit is contained in:
parent
7f5b538110
commit
3d33f565a4
1 changed files with 3 additions and 5 deletions
|
@ -1621,15 +1621,13 @@ static void SetCustomLoopPts(FMOD::Sound *sound)
|
||||||
|
|
||||||
static FMOD_RESULT F_CALLBACK open_reader_callback(const char *name, int unicode, unsigned int *filesize, void **handle, void **userdata)
|
static FMOD_RESULT F_CALLBACK open_reader_callback(const char *name, int unicode, unsigned int *filesize, void **handle, void **userdata)
|
||||||
{
|
{
|
||||||
char *endptr = NULL;
|
FileReader *reader = NULL;
|
||||||
QWORD val = strtoull(name, &endptr, 0);
|
if(sscanf(name, "_FileReader_%p", &reader) != 1)
|
||||||
if(!endptr || *endptr != '\0')
|
|
||||||
{
|
{
|
||||||
Printf("Invalid name in callback: %s\n", name);
|
Printf("Invalid name in callback: %s\n", name);
|
||||||
return FMOD_ERR_FILE_NOTFOUND;
|
return FMOD_ERR_FILE_NOTFOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileReader *reader = reinterpret_cast<FileReader*>((uintptr_t)val);
|
|
||||||
*filesize = reader->GetLength();
|
*filesize = reader->GetLength();
|
||||||
*handle = reader;
|
*handle = reader;
|
||||||
*userdata = reader;
|
*userdata = reader;
|
||||||
|
@ -1702,7 +1700,7 @@ SoundStream *FMODSoundRenderer::OpenStream(std::auto_ptr<FileReader> reader, int
|
||||||
exinfo.dlsname = patches;
|
exinfo.dlsname = patches;
|
||||||
}
|
}
|
||||||
|
|
||||||
name.Format("0x%I64x", (QWORD)reader.get());
|
name.Format("_FileReader_%p", reader.get());
|
||||||
result = Sys->createSound(name, mode, &exinfo, &stream);
|
result = Sys->createSound(name, mode, &exinfo, &stream);
|
||||||
if(result == FMOD_ERR_FORMAT && exinfo.dlsname != NULL)
|
if(result == FMOD_ERR_FORMAT && exinfo.dlsname != NULL)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue