mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-11 19:54:03 +00:00
b3b0118292
Renamed the resource manager's open/close methods openResource() and closeResource() to avoid confusion. (It was I who originally shortened their names to open() and close(), but I've changed my mind now.) Moved more stuff into Sword2Engine. svn-id: r11088
59 lines
1.5 KiB
C++
59 lines
1.5 KiB
C++
/* Copyright (C) 1994-2003 Revolution Software Ltd
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License
|
|
* as published by the Free Software Foundation; either version 2
|
|
* of the License, or (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
*
|
|
* $Header$
|
|
*/
|
|
|
|
// general odds and ends
|
|
|
|
#include "stdafx.h"
|
|
#include "sword2/driver/driver96.h"
|
|
#include "sword2/debug.h"
|
|
#include "sword2/memory.h"
|
|
#include "sword2/tony_gsdk.h"
|
|
#include "sword2/sword2.h"
|
|
|
|
namespace Sword2 {
|
|
|
|
uint32 Read_file(const char *name, mem **membloc, uint32 uid) {
|
|
// read the file in and place into an allocated MEM_float block
|
|
|
|
File fh;
|
|
uint32 size;
|
|
|
|
if (!fh.open(name)) {
|
|
debug(5, "Read_file cannot open %s", name);
|
|
return 0;
|
|
}
|
|
|
|
size = fh.size();
|
|
|
|
// reserve enough floating memory for the file
|
|
*membloc = memory->allocMemory(size, MEM_float, uid);
|
|
|
|
if (fh.read((*membloc)->ad, size) != size) {
|
|
debug(5, "Read_file read fail %d", name);
|
|
return 0;
|
|
}
|
|
|
|
fh.close();
|
|
|
|
// ok, done it - return bytes read
|
|
return size;
|
|
}
|
|
|
|
} // End of namespace Sword2
|