allows loading some resources directly from files, bypassing res-ndx (temporary)
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@617 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -18,16 +18,25 @@
|
|||||||
|
|
||||||
#include "gfxintrn.h"
|
#include "gfxintrn.h"
|
||||||
|
|
||||||
|
extern char *_cur_resfile_name;
|
||||||
|
|
||||||
DWORD
|
DWORD
|
||||||
LoadCelFile (PVOID pStr)
|
LoadCelFile (PVOID pStr)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
|
||||||
|
// FIXME: this theoretically needs a mechanism to prevent races
|
||||||
|
if (_cur_resfile_name)
|
||||||
|
// something else is loading resources atm
|
||||||
|
return 0;
|
||||||
|
|
||||||
if ((fp = res_OpenResFile (pStr, "rb")) != NULL)
|
if ((fp = res_OpenResFile (pStr, "rb")) != NULL)
|
||||||
{
|
{
|
||||||
MEM_HANDLE hData;
|
MEM_HANDLE hData;
|
||||||
|
|
||||||
|
_cur_resfile_name = pStr;
|
||||||
hData = _GetCelData (fp, LengthResFile (fp));
|
hData = _GetCelData (fp, LengthResFile (fp));
|
||||||
|
_cur_resfile_name = 0;
|
||||||
res_CloseResFile (fp);
|
res_CloseResFile (fp);
|
||||||
return ((DWORD)hData);
|
return ((DWORD)hData);
|
||||||
}
|
}
|
||||||
@@ -40,11 +49,18 @@ LoadFontFile (PVOID pStr)
|
|||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
|
||||||
|
// FIXME: this theoretically needs a mechanism to prevent races
|
||||||
|
if (_cur_resfile_name)
|
||||||
|
// something else is loading resources atm
|
||||||
|
return 0;
|
||||||
|
|
||||||
if ((fp = res_OpenResFile (pStr, "rb")) != NULL)
|
if ((fp = res_OpenResFile (pStr, "rb")) != NULL)
|
||||||
{
|
{
|
||||||
MEM_HANDLE hData;
|
MEM_HANDLE hData;
|
||||||
|
|
||||||
|
_cur_resfile_name = pStr;
|
||||||
hData = _GetFontData (fp, LengthResFile (fp));
|
hData = _GetFontData (fp, LengthResFile (fp));
|
||||||
|
_cur_resfile_name = 0;
|
||||||
res_CloseResFile (fp);
|
res_CloseResFile (fp);
|
||||||
return ((DWORD)hData);
|
return ((DWORD)hData);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,17 +18,26 @@
|
|||||||
|
|
||||||
#include "sndintrn.h"
|
#include "sndintrn.h"
|
||||||
|
|
||||||
|
extern char *_cur_resfile_name;
|
||||||
|
|
||||||
SOUND_REF
|
SOUND_REF
|
||||||
LoadSoundFile (PVOID pStr)
|
LoadSoundFile (PVOID pStr)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
|
||||||
|
// FIXME: this theoretically needs a mechanism to prevent races
|
||||||
|
if (_cur_resfile_name)
|
||||||
|
// something else is loading resources atm
|
||||||
|
return 0;
|
||||||
|
|
||||||
fp = res_OpenResFile (pStr, "rb");
|
fp = res_OpenResFile (pStr, "rb");
|
||||||
if (fp)
|
if (fp)
|
||||||
{
|
{
|
||||||
MEM_HANDLE hData;
|
MEM_HANDLE hData;
|
||||||
|
|
||||||
|
_cur_resfile_name = pStr;
|
||||||
hData = _GetSoundBankData (fp, LengthResFile (fp));
|
hData = _GetSoundBankData (fp, LengthResFile (fp));
|
||||||
|
_cur_resfile_name = 0;
|
||||||
|
|
||||||
res_CloseResFile (fp);
|
res_CloseResFile (fp);
|
||||||
|
|
||||||
@@ -43,12 +52,19 @@ LoadMusicFile (PVOID pStr)
|
|||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
|
||||||
|
// FIXME: this theoretically needs a mechanism to prevent races
|
||||||
|
if (_cur_resfile_name)
|
||||||
|
// something else is loading resources atm
|
||||||
|
return 0;
|
||||||
|
|
||||||
fp = res_OpenResFile (pStr, "rb");
|
fp = res_OpenResFile (pStr, "rb");
|
||||||
if (fp)
|
if (fp)
|
||||||
{
|
{
|
||||||
MEM_HANDLE hData;
|
MEM_HANDLE hData;
|
||||||
|
|
||||||
|
_cur_resfile_name = pStr;
|
||||||
hData = _GetMusicData (fp, LengthResFile (fp));
|
hData = _GetMusicData (fp, LengthResFile (fp));
|
||||||
|
_cur_resfile_name = 0;
|
||||||
|
|
||||||
res_CloseResFile (fp);
|
res_CloseResFile (fp);
|
||||||
|
|
||||||
|
|||||||
@@ -18,17 +18,26 @@
|
|||||||
|
|
||||||
#include "strintrn.h"
|
#include "strintrn.h"
|
||||||
|
|
||||||
|
extern char *_cur_resfile_name;
|
||||||
|
|
||||||
STRING_TABLE
|
STRING_TABLE
|
||||||
LoadStringTableFile (PVOID pStr)
|
LoadStringTableFile (PVOID pStr)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
|
||||||
|
// FIXME: this theoretically needs a mechanism to prevent races
|
||||||
|
if (_cur_resfile_name)
|
||||||
|
// something else is loading resources atm
|
||||||
|
return 0;
|
||||||
|
|
||||||
fp = res_OpenResFile (pStr, "rb");
|
fp = res_OpenResFile (pStr, "rb");
|
||||||
if (fp)
|
if (fp)
|
||||||
{
|
{
|
||||||
MEM_HANDLE hData;
|
MEM_HANDLE hData;
|
||||||
|
|
||||||
|
_cur_resfile_name = pStr;
|
||||||
hData = _GetStringData (fp, LengthResFile (fp));
|
hData = _GetStringData (fp, LengthResFile (fp));
|
||||||
|
_cur_resfile_name = 0;
|
||||||
res_CloseResFile (fp);
|
res_CloseResFile (fp);
|
||||||
|
|
||||||
return (BUILD_STRING_TABLE (hData));
|
return (BUILD_STRING_TABLE (hData));
|
||||||
|
|||||||
Reference in New Issue
Block a user