2008-07-24 22:00:00 +02:00
|
|
|
|
//=======================================================================
|
2008-07-30 22:00:00 +02:00
|
|
|
|
// Copyright XashXT Group 2008 <20>
|
2008-07-24 22:00:00 +02:00
|
|
|
|
// rc_main.c - resource library
|
|
|
|
|
//=======================================================================
|
|
|
|
|
|
|
|
|
|
#include <windows.h>
|
2008-10-27 22:00:00 +01:00
|
|
|
|
#include "launch_api.h"
|
|
|
|
|
#include "baserc_api.h"
|
2008-07-24 22:00:00 +02:00
|
|
|
|
|
|
|
|
|
// 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
|
|
|
|
|
{"error.tga", error_tga, sizeof(error_tga)},
|
|
|
|
|
{"blank.bmp", blank_bmp, sizeof(blank_bmp)},
|
2008-11-06 22:00:00 +01:00
|
|
|
|
{"checkerboard.dds", q1mip_dds, sizeof(q1mip_dds)},
|
2008-07-24 22:00:00 +02:00
|
|
|
|
{"default.dds", deffont_dds, sizeof(deffont_dds)},
|
2009-01-18 22:00:00 +01:00
|
|
|
|
{"net.png", net_png, sizeof(net_png)},
|
2008-07-24 22:00:00 +02:00
|
|
|
|
{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 ))
|
|
|
|
|
{
|
2008-08-27 22:00:00 +02:00
|
|
|
|
MsgDev( D_LOAD, "RC_FindFile: %s\n", res->intname );
|
2008-07-24 22:00:00 +02:00
|
|
|
|
if( size ) *size = res->filesize;
|
|
|
|
|
return ( byte *)res->buffer;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// no matching found
|
|
|
|
|
if( size ) *size = 0;
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2009-01-21 22:00:00 +01:00
|
|
|
|
// main DLL entry point
|
|
|
|
|
BOOL WINAPI DllMain( HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved )
|
|
|
|
|
{
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
2008-07-24 22:00:00 +02:00
|
|
|
|
baserc_exp_t DLLEXPORT *CreateAPI( stdlib_api_t *input, void *unused )
|
|
|
|
|
{
|
|
|
|
|
static baserc_exp_t Com;
|
|
|
|
|
|
|
|
|
|
com = *input;
|
|
|
|
|
|
|
|
|
|
// generic functions
|
2009-09-10 22:00:00 +02:00
|
|
|
|
Com.api_size = sizeof( baserc_exp_t );
|
|
|
|
|
Com.com_size = sizeof( stdlib_api_t );
|
2008-07-24 22:00:00 +02:00
|
|
|
|
Com.LoadFile = RC_FindFile;
|
|
|
|
|
|
|
|
|
|
return &Com;
|
|
|
|
|
}
|