This repository has been archived on 2022-06-27. You can view files and clone it, but cannot push or open issues or pull requests.
Xash3DArchive/baserc/rc_main.c

69 lines
1.5 KiB
C

//=======================================================================
// Copyright XashXT Group 2008 ©
// rc_main.c - resource library
//=======================================================================
#include <windows.h>
#include "launch_api.h"
#include "baserc_api.h"
// resources
#include "images.h"
stdlib_api_t com;
typedef struct loadres_s
{
const char *intname;
const byte *buffer;
const size_t filesize;
} loadres_t;
loadres_t load_resources[] =
{
// add new resource description here
{"blank.bmp", blank_bmp, sizeof(blank_bmp)},
{"default.dds", deffont_dds, sizeof(deffont_dds)},
{"net.png", net_png, sizeof(net_png)},
{NULL, NULL, 0 }
};
byte *RC_FindFile( const char *filename, fs_offset_t *size )
{
loadres_t *res;
// now try all the formats in the selected list
for( res = load_resources; res->intname; res++ )
{
if(!com.stricmp( filename, res->intname ))
{
MsgDev( D_LOAD, "RC_FindFile: %s\n", res->intname );
if( size ) *size = res->filesize;
return ( byte *)res->buffer;
}
}
// no matching found
if( size ) *size = 0;
return NULL;
}
// main DLL entry point
BOOL WINAPI DllMain( HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved )
{
return TRUE;
}
baserc_exp_t DLLEXPORT *CreateAPI( stdlib_api_t *input, void *unused )
{
static baserc_exp_t Com;
com = *input;
// generic functions
Com.api_size = sizeof( baserc_exp_t );
Com.com_size = sizeof( stdlib_api_t );
Com.LoadFile = RC_FindFile;
return &Com;
}