Full support for "zero-file" resources UNKNOWNRES and SHIP.

The CODE resource file type has been retired, replaced by SHIP.


git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2971 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
mcmartin
2008-05-14 06:05:58 +00:00
parent 2ddc969faf
commit 47a7575e97
35 changed files with 87 additions and 103 deletions
-1
View File
@@ -21,7 +21,6 @@
#include "reslib.h"
extern void *LoadCodeResFile (const char *pStr);
extern BOOLEAN InstallCodeResType (void);
extern void *LoadCodeResInstance (RESOURCE res);
extern void *CaptureCodeRes (void *hCode, void *pData, void **ppLocData);
+11 -18
View File
@@ -28,6 +28,7 @@
#include "libs/compiler.h"
#include "libs/log.h"
#include <stdlib.h>
#include <ctype.h>
@@ -36,15 +37,8 @@ typedef struct
RACE_DESC data _ALIGNED_ANY;
} CODERES_STRUCT;
void *
LoadCodeResFile (const char *pStr)
{
(void) pStr; /* Satisfying compiler (unused parameter) */
return NULL;
}
static void *
GetCodeResData (uio_Stream *fp, DWORD length)
GetCodeResData (const char *ship_id)
{
enum
{
@@ -82,7 +76,7 @@ enum
BYTE which_res;
void *hData;
which_res = GetResFileChar (fp);
which_res = atoi (ship_id);
hData = HMalloc (sizeof (CODERES_STRUCT));
if (hData)
{
@@ -290,6 +284,12 @@ enum
RDPtr = init_probe ();
break;
}
default:
{
log_add (log_Warning, "Unknown SHIP identifier '%d'", which_res);
RDPtr = NULL;
break;
}
}
if (RDPtr == 0)
@@ -305,7 +305,6 @@ enum
cs->data = *RDPtr; // Structure assignment.
}
}
(void) length; /* Satisfying compiler (unused parameter) */
return (hData);
}
@@ -316,17 +315,11 @@ _ReleaseCodeResData (void *data)
return TRUE;
}
static void *
GetCodeFileData (const char *pathname)
{
return LoadResourceFromPath (pathname, GetCodeResData);
}
BOOLEAN
InstallCodeResType ()
{
return (InstallResTypeVectors ("CODE",
GetCodeFileData, _ReleaseCodeResData));
return (InstallResTypeVectors ("SHIP",
GetCodeResData, _ReleaseCodeResData));
}
+3
View File
@@ -36,6 +36,9 @@ extern const char *_cur_resfile_name;
typedef void *(ResourceLoadFun) (const char *pathname);
typedef BOOLEAN (ResourceFreeFun) (void *handle);
void *UseDescriptorAsRes (const char *descriptor);
BOOLEAN NullFreeRes (void *handle);
typedef void *(ResourceLoadFileFun) (uio_Stream *fp, DWORD len);
+14 -1
View File
@@ -131,6 +131,19 @@ process_resource_desc (const char *key, const char *value)
}
}
void *
UseDescriptorAsRes (const char *descriptor)
{
return descriptor;
}
BOOLEAN
NullFreeRes (void *data)
{
(void)data;
return TRUE;
}
RESOURCE_INDEX
InitResourceSystem (void)
{
@@ -138,7 +151,7 @@ InitResourceSystem (void)
_set_current_index_header (ndx);
InstallResTypeVectors ("UNKNOWNRES", NULL, NULL);
InstallResTypeVectors ("UNKNOWNRES", UseDescriptorAsRes, NullFreeRes);
InstallGraphicResTypes ();
InstallStringTableResType ();
InstallAudioResTypes ();