/* Sound improver for StrongHold(tm) by Royce Liao Source code for PUTAIL.EXE This program will install the Gravis MIDI driver into the stronghold data file, and thus improve it. Whether or not you hear BETTER music is a different issue... :) Of course, this program could alter games beside StrongHold(tm) -- I assume no responsibility for damages, headaches, stress, etc. etc.etc, caused by the use of this program. I.E., if this doesn't work, don't blame me! */ #define BUFFER_SIZE 1024 #define ROLAND_OFFSET 0x3289C5L #define STRING_LENGTH 40 #include #include void main() { unsigned long offset, counter, total; unsigned char buffer[BUFFER_SIZE]; unsigned char out_name[STRING_LENGTH], adv_name[STRING_LENGTH]; int lcv; FILE *file_out, *file_adv; /* file_out is the file to be altered (patched) file_adv is the file to be inserted (into file_out) */ counter=0; printf("\nEnter name of file to alter: "); scanf("%s", out_name ) ; file_out= fopen ( out_name, "rb+"); if ( file_out==NULL ) { fprintf( stderr," Could not open %s", out_name ); exit(1); } printf("\nEnter name of file to install. (.ADV file) "); printf("\n"); scanf("%s", adv_name ) ; file_adv= fopen ( adv_name, "rb"); if ( file_adv==NULL ) { fprintf( stderr, "Could not open %s", adv_name ); fclose ( file_out ) ; exit(1); } printf("\n(For the game StrongHold(tm), I think the offset for", "the Roland driver is %ld decimal.", ROLAND_OFFSET ); printf("\nInsert %s at what offset (decimal from beginning) ? ", adv_name ); scanf("%lu", &offset); total=0; fseek(file_out, offset, SEEK_SET); fseek(file_adv, 0, SEEK_SET); do { counter= fread(buffer, sizeof(char), BUFFER_SIZE, file_adv); fwrite(buffer, sizeof(char), counter, file_out); total+=counter; } while ( counter==BUFFER_SIZE ) ; printf("\nTotal bytes (re)written into %s = %lu", out_name, total); fclose( file_out ); fclose( file_adv ); } /* Compiled with Borland Turbo C++ 3.0 (DOS)...Tiny memory model, 8088 code.*/