1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-10-12 09:22:00 +00:00

Revert "added partial VFS support - enough to read static data from any source"

This reverts commit fa3e9e7329.
This commit is contained in:
fgenesis 2011-09-15 19:18:53 +02:00
commit 56c6833220
56 changed files with 608 additions and 4023 deletions

View file

@ -21,6 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "SoundManager.h"
#include "Core.h"
#include "Base.h"
#include "PackRead.h"
#if defined(BBGE_BUILD_FMODEX)
#ifdef BBGE_BUILD_FMOD_OPENAL_BRIDGE
@ -133,14 +134,20 @@ FMOD_RESULT F_CALLBACK myopen(const char *name, int unicode, unsigned int *files
{
if (name)
{
ttvfs::VFSFile *vf = core->vfs.GetFile(name);
if(!vf)
return FMOD_ERR_FILE_NOTFOUND;
FILE *fp;
fp = fopen(name, "rb");
if (!fp)
{
return FMOD_ERR_FILE_NOTFOUND;
}
fseek(fp, 0, SEEK_END);
*filesize = ftell(fp);
fseek(fp, 0, SEEK_SET);
vf->open();
*filesize = vf->size();
*handle = (void*)vf;
*userdata = (void *)0x12345678;
*handle = fp;
}
return FMOD_OK;
@ -153,9 +160,7 @@ FMOD_RESULT F_CALLBACK myclose(void *handle, void *userdata)
return FMOD_ERR_INVALID_PARAM;
}
ttvfs::VFSFile *vf = (ttvfs::VFSFile*)handle;
vf->close();
core->addVFSFileForDrop(vf);
fclose((FILE *)handle);
return FMOD_OK;
}
@ -169,8 +174,7 @@ FMOD_RESULT F_CALLBACK myread(void *handle, void *buffer, unsigned int sizebytes
if (bytesread)
{
ttvfs::VFSFile *vf = (ttvfs::VFSFile*)handle;
*bytesread = vf->read((char*)buffer, sizebytes);
*bytesread = (int)fread(buffer, 1, sizebytes, (FILE *)handle);
if (*bytesread < sizebytes)
{
@ -188,8 +192,7 @@ FMOD_RESULT F_CALLBACK myseek(void *handle, unsigned int pos, void *userdata)
return FMOD_ERR_INVALID_PARAM;
}
ttvfs::VFSFile *vf = (ttvfs::VFSFile*)handle;
vf->seek(pos);
fseek((FILE *)handle, pos, SEEK_SET);
return FMOD_OK;
}
@ -329,7 +332,7 @@ SoundManager::SoundManager(const std::string &defaultDevice)
debugLog("err_output_createbuffer, speaker mode");
result = SoundCore::system->setSpeakerMode(FMOD_SPEAKERMODE_STEREO);
if (checkError()) goto get_out;
debugLog("init 2");
result = SoundCore::system->init(channels, FMOD_INIT_NORMAL, 0, defaultDevice); /* Replace with whatever channel count and flags you use! */
if (checkError()) goto get_out;