Since there is a need to know, i will post my the Renegades modload source here. Do with it as you please (don't forget to mention my name in your credits list - if you have one that is
).
//----------------------------------------------------------------------------------------
// Outpost - Renegades
//----------------------------------------------------------------------------------------
// Module loader
#define EXPORT extern "C" __declspec(dllexport)
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include "outpost2app.h"
#include "public.h"
#define arraysize(x) (sizeof(x)/sizeof(*(x)))
#define autosize(x) (x),arraysize(x)
#define Msg(x) OP2MessageBox(NULL,(x),"DEBUG",MB_OK)
char s[80];
typedef int (__fastcall *EMB)(int,char*,char*,unsigned int);
EMB OP2MessageBox = (EMB)0x0041E0E0;
//----------------------------------------------------------------------------------------
char ren[]="REN";
char renegades[]="Renegades";
char version[]="1.0.0.0";
//char modulename[80];
//char moddir[80];
// PatchInfo contains information about the patch
struct PatchInfo
{
int memlocation;
char *patch;
int bytes;
};
PatchInfo patches[]=
{
{ 0x4E96A0,autosize(ren)-1 },
{ 0x4E96C0,autosize(ren)-1 },
// change file extention "OP2" into "REN"
{ 0x4E061C,autosize(ren)-1 },
{ 0x4E0630,autosize(ren)-1 },
{ 0x4E5AB7,autosize(ren)-1 },
{ 0x4E5ABE,autosize(ren)-1 },
// "Failed to load OP2Shell" > "RENShell"
{ 0x4E5AD3,autosize(ren)-1 },
// "INI" > "REN"
{ 0x4DF36C,autosize(ren)-1 },
// mission dll names
{ 0x4E971C,"Q",1 },
// { 0x4E9728,"F",1 },
// "Outpost 2" > "Renegades"
{ 0x4E484A,autosize(renegades)-1 },
{ 0x4E4870,autosize(renegades)-1 },
{ 0x4E555C,autosize(renegades)-1 },
{ 0x4E561A,autosize(renegades)-1 },
{ 0x4E57FE,autosize(renegades)-1 },
{ 0x4E580C,autosize(renegades)-1 },
{ 0x4E5AA4,autosize(renegades)-1 },
{ 0x4E5BE0,autosize(renegades)-1 },
{ 0x4E5C6C,autosize(renegades)-1 },
{ 0x4E5DEC,autosize(renegades)-1 },
{ 0x4E6124,autosize(renegades)-1 },
{ 0x4E7CC6,autosize(renegades)-1 },
{ 0x4E7CEE,autosize(renegades)-1 },
// Version info
{ 0x4E973C,autosize(version)-1 }, // unused at the moment
};
void patch(PatchInfo pi)
{
_asm {
MOV ECX,pi.bytes
MOV EDI,pi.memlocation
MOV ESI,pi.patch
REP MOVSB
}
}
void PatchOutpost()
{
for (int i=0; i<arraysize(patches); ++i)
patch(patches[i]);
}
/*
void ExtractDir()
{
int x,l=strlen(modulename);
bool foundend=false;
x=l;
while (--x>=0)
{
if (modulename[x]=='\\') foundend=true;
if (foundend) moddir[x]=modulename[x];
}
}
// concat's mod-folder and volname
void AddVol(char *volname)
{
char filename[128];
strcpy(filename,moddir);
strcat(filename,volname);
AddVolToList(filename);
}
*/
//----------------------------------------------------------------------------------------
// Exported functions -> required by op2ext.dll
//----------------------------------------------------------------------------------------
EXPORT void mod_init()
{
PatchOutpost();
AddVolToList("ren.vol"); // renegades story + briefings
AddVolToList("extra.vol"); // extra waves
AddVolToList("ren1.vol"); // first 4 missions + tek files
}
EXPORT void mod_run()
{
}
EXPORT void mod_destroy()
{
}
// Main DLL entry Routine
BOOL APIENTRY DllMain(HANDLE hModule,DWORD ul_reason_for_call,LPVOID lpReserved)
{
// GetModuleFileName((HMODULE)hModule,modulename,sizeof(modulename)-1);
// ExtractDir();
return TRUE;
}
and OP2 will open the subfolder <modname> and load & execute the file modload.dll
You will always need to export the functions mod_init, mod_run, mod_destroy and ofcourse DllMain.