mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-28 23:11:58 +00:00
- added a few more FileRdr replacements
- fixed: The streaming music player must return the file reader if it fails to open, so that the next player can still use it. - fixed: Timidity++'s Instruments class did not delete the sound font when it was destroyed. ..-
This commit is contained in:
parent
56991a9ace
commit
b315bc3be0
9 changed files with 25 additions and 21 deletions
|
@ -2492,11 +2492,11 @@ bool D_LoadDehLump(int lumpnum)
|
||||||
|
|
||||||
bool D_LoadDehFile(const char *patchfile)
|
bool D_LoadDehFile(const char *patchfile)
|
||||||
{
|
{
|
||||||
FileReader fr;
|
FileRdr fr;
|
||||||
|
|
||||||
if (fr.Open(patchfile))
|
if (fr.OpenFile(patchfile))
|
||||||
{
|
{
|
||||||
PatchSize = fr.GetLength();
|
PatchSize = (int)fr.GetLength();
|
||||||
|
|
||||||
PatchName = copystring(patchfile);
|
PatchName = copystring(patchfile);
|
||||||
PatchFile = new char[PatchSize + 1];
|
PatchFile = new char[PatchSize + 1];
|
||||||
|
|
|
@ -2801,8 +2801,8 @@ void G_DoPlayDemo (void)
|
||||||
{
|
{
|
||||||
FixPathSeperator (defdemoname);
|
FixPathSeperator (defdemoname);
|
||||||
DefaultExtension (defdemoname, ".lmp");
|
DefaultExtension (defdemoname, ".lmp");
|
||||||
FileReader fr;
|
FileRdr fr;
|
||||||
if (!fr.Open(defdemoname))
|
if (!fr.OpenFile(defdemoname))
|
||||||
{
|
{
|
||||||
I_Error("Unable to open demo '%s'", defdemoname.GetChars());
|
I_Error("Unable to open demo '%s'", defdemoname.GetChars());
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,15 +121,15 @@ void M_FindResponseFile (void)
|
||||||
if (added_stuff < limit)
|
if (added_stuff < limit)
|
||||||
{
|
{
|
||||||
// READ THE RESPONSE FILE INTO MEMORY
|
// READ THE RESPONSE FILE INTO MEMORY
|
||||||
FileReader fr;
|
FileRdr fr;
|
||||||
if (!fr.Open(Args->GetArg(i) + 1))
|
if (!fr.OpenFile(Args->GetArg(i) + 1))
|
||||||
{ // [RH] Make this a warning, not an error.
|
{ // [RH] Make this a warning, not an error.
|
||||||
Printf ("No such response file (%s)!\n", Args->GetArg(i) + 1);
|
Printf ("No such response file (%s)!\n", Args->GetArg(i) + 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Printf ("Found response file %s!\n", Args->GetArg(i) + 1);
|
Printf ("Found response file %s!\n", Args->GetArg(i) + 1);
|
||||||
size = fr.GetLength();
|
size = (int)fr.GetLength();
|
||||||
file = new char[size+1];
|
file = new char[size+1];
|
||||||
fr.Read (file, size);
|
fr.Read (file, size);
|
||||||
file[size] = 0;
|
file[size] = 0;
|
||||||
|
|
|
@ -248,8 +248,8 @@ bool FScanner::OpenFile (const char *name)
|
||||||
{
|
{
|
||||||
Close ();
|
Close ();
|
||||||
|
|
||||||
FileReader fr;
|
FileRdr fr;
|
||||||
if (!fr.Open(name)) return false;
|
if (!fr.OpenFile(name)) return false;
|
||||||
auto filesize = fr.GetLength();
|
auto filesize = fr.GetLength();
|
||||||
auto filebuf = new uint8_t[filesize];
|
auto filebuf = new uint8_t[filesize];
|
||||||
if (fr.Read(filebuf, filesize) != filesize)
|
if (fr.Read(filebuf, filesize) != filesize)
|
||||||
|
|
|
@ -291,8 +291,8 @@ void FSoundFontManager::ProcessOneFile(const FString &fn)
|
||||||
if (!sfi.mName.CompareNoCase(fb)) return;
|
if (!sfi.mName.CompareNoCase(fb)) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileReader fr;
|
FileRdr fr;
|
||||||
if (fr.Open(fn))
|
if (fr.OpenFile(fn))
|
||||||
{
|
{
|
||||||
// Try to identify. We only accept .sf2 and .zip by content. All other archives are intentionally ignored.
|
// Try to identify. We only accept .sf2 and .zip by content. All other archives are intentionally ignored.
|
||||||
char head[16] = { 0};
|
char head[16] = { 0};
|
||||||
|
@ -433,8 +433,8 @@ FSoundFontReader *FSoundFontManager::OpenSoundFont(const char *name, int allowed
|
||||||
// Next check if the file is a .sf file
|
// Next check if the file is a .sf file
|
||||||
if (allowed & SF_SF2)
|
if (allowed & SF_SF2)
|
||||||
{
|
{
|
||||||
FileReader fr;
|
FileRdr fr;
|
||||||
if (fr.Open(name))
|
if (fr.OpenFile(name))
|
||||||
{
|
{
|
||||||
char head[16] = { 0};
|
char head[16] = { 0};
|
||||||
fr.Read(head, 16);
|
fr.Read(head, 16);
|
||||||
|
@ -447,8 +447,8 @@ FSoundFontReader *FSoundFontManager::OpenSoundFont(const char *name, int allowed
|
||||||
}
|
}
|
||||||
if (allowed & SF_GUS)
|
if (allowed & SF_GUS)
|
||||||
{
|
{
|
||||||
FileReader fr;
|
FileRdr fr;
|
||||||
if (fr.Open(name))
|
if (fr.OpenFile(name))
|
||||||
{
|
{
|
||||||
char head[16] = { 0 };
|
char head[16] = { 0 };
|
||||||
fr.Read(head, 2);
|
fr.Read(head, 2);
|
||||||
|
|
|
@ -145,6 +145,7 @@ bool MPG123Decoder::open(FileRdr &reader)
|
||||||
MPG123 = 0;
|
MPG123 = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reader = std::move(Reader); // need to give it back.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -127,6 +127,7 @@ bool SndFileDecoder::open(FileRdr &reader)
|
||||||
sf_close(SndFile);
|
sf_close(SndFile);
|
||||||
SndFile = 0;
|
SndFile = 0;
|
||||||
}
|
}
|
||||||
|
reader = std::move(Reader); // need to give it back.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -75,6 +75,8 @@ Instruments::~Instruments()
|
||||||
|
|
||||||
free_tone_bank();
|
free_tone_bank();
|
||||||
free_instrument_map();
|
free_instrument_map();
|
||||||
|
|
||||||
|
if (sfreader != nullptr) delete sfreader;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Instruments::free_instrument(Instrument *ip)
|
void Instruments::free_instrument(Instrument *ip)
|
||||||
|
|
|
@ -306,14 +306,14 @@ int FTextureManager::CountBuildTiles ()
|
||||||
FString artpath = rffpath;
|
FString artpath = rffpath;
|
||||||
artpath += artfile;
|
artpath += artfile;
|
||||||
|
|
||||||
FileReader fr;
|
FileRdr fr;
|
||||||
|
|
||||||
if (!fr.Open(artpath))
|
if (!fr.OpenFile(artpath))
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
long len = fr.GetLength();
|
auto len = fr.GetLength();
|
||||||
uint8_t *art = new uint8_t[len];
|
uint8_t *art = new uint8_t[len];
|
||||||
if (fr.Read (art, len) != len || (numtiles = CountTiles(art)) == 0)
|
if (fr.Read (art, len) != len || (numtiles = CountTiles(art)) == 0)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue