mirror of
https://github.com/ondra-novak/gates_of_skeldal.git
synced 2025-07-22 07:04:47 -04:00
github publish
This commit is contained in:
commit
506e23bf32
542 changed files with 120675 additions and 0 deletions
1462
insteng/SETUP.C
Normal file
1462
insteng/SETUP.C
Normal file
File diff suppressed because it is too large
Load diff
18
insteng/SETUP.H
Normal file
18
insteng/SETUP.H
Normal file
|
@ -0,0 +1,18 @@
|
|||
extern word ikones;
|
||||
extern word boldcz;
|
||||
extern word sipka;
|
||||
extern word font6x9;
|
||||
extern void *bbutt;
|
||||
extern word *vga_font;
|
||||
extern word *icones;
|
||||
extern word icone_color[];
|
||||
extern word ramecek;
|
||||
extern word *ramecky[];
|
||||
|
||||
//#define WINCOLOR 0x6318
|
||||
#define WINCOLOR (31*1024+31*32+26)
|
||||
#define LABELCOLOR (11*1024+11*32+06)
|
||||
#define BUTTONCOLOR (28*1024+24*32+3)
|
||||
|
||||
#define PRG_HEADER "The Gates of Skeldal Setup v1."VERSION
|
||||
extern FILE *ini;
|
165
insteng/SETUPCPY.C
Normal file
165
insteng/SETUPCPY.C
Normal file
|
@ -0,0 +1,165 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <memman.h>
|
||||
#include <string.h>
|
||||
#include "setupcpy.h"
|
||||
|
||||
#define DATASIZE 32768
|
||||
#define INFOBLOCK 1
|
||||
#define DATABLOCK 2
|
||||
#define ERRORBLOCK 3
|
||||
|
||||
typedef struct tdatablock
|
||||
{
|
||||
void *next;
|
||||
char block_type;
|
||||
unsigned short load_size;
|
||||
char data[DATASIZE];
|
||||
}TDATABLOCK;
|
||||
|
||||
typedef struct tinfoblock
|
||||
{
|
||||
void *next;
|
||||
char block_type;
|
||||
char pathname[2];
|
||||
}TINFOBLOCK;
|
||||
|
||||
static void *start=NULL;
|
||||
static void *end=NULL;
|
||||
static FILE *cpyout=NULL;
|
||||
static long progress=0;
|
||||
|
||||
void (*cpy_error)(int,char *);
|
||||
void (*mem_error_next)(long);
|
||||
|
||||
void (*cpy_progress)(long);
|
||||
|
||||
|
||||
static void *alloc_file(char *target_name)
|
||||
{
|
||||
TINFOBLOCK *p;
|
||||
|
||||
p=(TINFOBLOCK *)getmem(sizeof(TINFOBLOCK)+strlen(target_name));
|
||||
strcpy(p->pathname,target_name);
|
||||
p->next=NULL;
|
||||
p->block_type=INFOBLOCK;
|
||||
return p;
|
||||
}
|
||||
|
||||
static void *alloc_data()
|
||||
{
|
||||
TDATABLOCK *p;
|
||||
|
||||
p=New(TDATABLOCK);
|
||||
p->next=NULL;
|
||||
p->load_size=0;
|
||||
p->block_type=DATABLOCK;
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
static void *load_data(FILE *f)
|
||||
{
|
||||
TDATABLOCK *p;
|
||||
int rc;
|
||||
int retry=0;
|
||||
void *end_line;
|
||||
|
||||
p=end_line=alloc_data();
|
||||
again:
|
||||
errno=0;
|
||||
rc=fread(p->data,1,sizeof(p->data),f);
|
||||
p->load_size=rc;
|
||||
if (ferror(f) || rc!=sizeof(p->data) && errno!=0)
|
||||
{
|
||||
if (retry) retry--;
|
||||
else cpy_error(CPERR_READ,NULL);
|
||||
fseek(f,-rc,SEEK_CUR);
|
||||
errno=0;
|
||||
goto again;
|
||||
}
|
||||
progress+=p->load_size;
|
||||
cpy_progress(progress);
|
||||
return end_line;
|
||||
}
|
||||
|
||||
static error_mem(long size)
|
||||
{
|
||||
TDATABLOCK *p;
|
||||
TINFOBLOCK *q;
|
||||
int rc;
|
||||
|
||||
size;
|
||||
if (start==NULL) mem_error_next(size);
|
||||
while (start!=NULL)
|
||||
{
|
||||
p=start;
|
||||
q=start;
|
||||
if (q->block_type==INFOBLOCK)
|
||||
{
|
||||
if (cpyout!=NULL) fclose(cpyout);
|
||||
again:
|
||||
cpyout=fopen(q->pathname,"wb");
|
||||
if (cpyout==NULL)
|
||||
{
|
||||
cpy_error(CPERR_OPEN,q->pathname);
|
||||
goto again;
|
||||
}
|
||||
start=q->next;
|
||||
free(q);
|
||||
}
|
||||
else if (p->block_type==DATABLOCK)
|
||||
{
|
||||
again2:
|
||||
rc=fwrite(p->data,1,p->load_size,cpyout);
|
||||
if (rc!=p->load_size)
|
||||
{
|
||||
cpy_error(CPERR_WRITE,q->pathname);
|
||||
fseek(cpyout,-rc,SEEK_CUR);
|
||||
goto again2;
|
||||
}
|
||||
progress+=p->load_size;
|
||||
cpy_progress(progress);
|
||||
start=p->next;
|
||||
free(p);
|
||||
}
|
||||
}
|
||||
end=NULL;
|
||||
}
|
||||
|
||||
void cpy_file(char *source,char *target)
|
||||
{
|
||||
FILE *f;
|
||||
TDATABLOCK *p;
|
||||
TINFOBLOCK *q;
|
||||
|
||||
again:
|
||||
errno=0;
|
||||
f=fopen(source,"rb");
|
||||
if (f==NULL)
|
||||
{
|
||||
cpy_error(CPERR_OPEN,source);
|
||||
goto again;
|
||||
}
|
||||
q=alloc_file(target);
|
||||
if (start==NULL) start=end=q;else end=(((TDATABLOCK *)end)->next=q);
|
||||
while (!feof(f))
|
||||
{
|
||||
p=load_data(f);
|
||||
if (start==NULL) start=end=p;else end=(((TDATABLOCK *)end)->next=p);
|
||||
}
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
void cpy_flush()
|
||||
{
|
||||
if (start!=NULL)error_mem(0);
|
||||
if (cpyout!=NULL)fclose(cpyout);
|
||||
cpyout=NULL;
|
||||
}
|
||||
|
||||
void install_cpy()
|
||||
{
|
||||
mem_error_next=mem_error;
|
||||
mem_error=error_mem;
|
||||
}
|
9
insteng/SETUPCPY.H
Normal file
9
insteng/SETUPCPY.H
Normal file
|
@ -0,0 +1,9 @@
|
|||
#define CPERR_OPEN 1
|
||||
#define CPERR_WRITE 2
|
||||
#define CPERR_READ 3
|
||||
|
||||
extern void (*cpy_error)(int,char *);
|
||||
extern void (*cpy_progress)(long);
|
||||
void cpy_file(char *source,char *target);
|
||||
void cpy_flush();
|
||||
void install_cpy();
|
505
insteng/SETUPLIB.C
Normal file
505
insteng/SETUPLIB.C
Normal file
|
@ -0,0 +1,505 @@
|
|||
#include <types.h>
|
||||
#include <ctype.h>
|
||||
#include <io.h>
|
||||
#include <dos.h>
|
||||
#include <malloc.h>
|
||||
#include <direct.h>
|
||||
#include <memman.h>
|
||||
#include <string.h>
|
||||
#include <event.h>
|
||||
#include <strlite.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <bgraph.h>
|
||||
#include <vesa.h>
|
||||
#include <bmouse.h>
|
||||
#include <gui.h>
|
||||
#include <basicobj.h>
|
||||
#include "setuplib.h"
|
||||
#include "setupcpy.h"
|
||||
#include "setup.h"
|
||||
|
||||
#define COPY "COPY"
|
||||
#define MKDIR "MKDIR"
|
||||
#define INI "INI"
|
||||
|
||||
#define DIR_NAMES 6
|
||||
char *dirnames[]=
|
||||
{
|
||||
"GAMES.*",
|
||||
"GAME*.*",
|
||||
"HRY.*",
|
||||
"ZABAVA.*",
|
||||
"SKELDAL",
|
||||
"NAPOLEON",
|
||||
};
|
||||
|
||||
TSTR_LIST file_list=NULL;
|
||||
|
||||
static void done_bar_init(OBJREC *o,long *params)
|
||||
{
|
||||
o->userptr=New(long);
|
||||
*(long *)o->userptr=*params;
|
||||
}
|
||||
|
||||
static void done_bar_draw(int x1,int y1,int x2,int y2,OBJREC *o)
|
||||
{
|
||||
long value,max,x3;
|
||||
|
||||
value=*(long *)o->data;
|
||||
max=*(long *)o->userptr;
|
||||
x3=x1+(x2-x1)*value/max;
|
||||
if (x3<=x1) x3=x1;
|
||||
if (x3>=x2) x3=x2;
|
||||
bar(x3,y1,x2,y2);
|
||||
curcolor=o->f_color[1];
|
||||
bar(x1,y1,x3,y2);
|
||||
}
|
||||
|
||||
void done_bar(OBJREC *o) //define(...done_bar,max);
|
||||
{
|
||||
o->runs[0]=done_bar_init;
|
||||
o->runs[1]=done_bar_draw;
|
||||
o->datasize=4;
|
||||
}
|
||||
|
||||
|
||||
|
||||
char select_disk()
|
||||
{
|
||||
char last=3;
|
||||
struct diskfree_t ds;
|
||||
int max=0,i;
|
||||
long now;
|
||||
|
||||
for(i=('C'-'@');i<('Z'-'@');i++)
|
||||
{
|
||||
if (_dos_getdiskfree(i,&ds)==0)
|
||||
{
|
||||
now=ds.avail_clusters*ds.sectors_per_cluster*ds.bytes_per_sector;
|
||||
if (now>max)
|
||||
{
|
||||
max=now;
|
||||
last=i;
|
||||
}
|
||||
}
|
||||
}
|
||||
return last;
|
||||
}
|
||||
|
||||
char dir_finder()
|
||||
{
|
||||
struct find_t ft;
|
||||
int i;
|
||||
int rc;
|
||||
|
||||
for(i=0;i<DIR_NAMES;i++)
|
||||
{
|
||||
rc=_dos_findfirst(dirnames[i],_A_SUBDIR,&ft);
|
||||
if (rc==0 && ft.attrib & _A_SUBDIR) break;
|
||||
do_events();
|
||||
}
|
||||
if (i==DIR_NAMES) return 0;
|
||||
if (strcmp(dirnames[i],"SKELDAL"))
|
||||
{
|
||||
chdir(ft.name);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
long get_disk_free(char disk)
|
||||
{
|
||||
struct diskfree_t ds;
|
||||
if (_dos_getdiskfree(disk,&ds)==0)
|
||||
return ds.avail_clusters*ds.sectors_per_cluster*ds.bytes_per_sector;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
char all_finder()
|
||||
{
|
||||
unsigned total;
|
||||
int i,j,max,lmax,p;
|
||||
long sz[30];
|
||||
int end='Z'-'@';
|
||||
|
||||
exit_wait=0;
|
||||
lmax=0x7fffffff;
|
||||
for(i=3;i<end;i++) sz[i]=get_disk_free(i);
|
||||
for(i=3;i<end;i++)
|
||||
{
|
||||
p=3;max=0;
|
||||
for(j=3;j<end;j++) if (sz[j]>max && sz[j]<lmax) p=j,max=sz[j];
|
||||
lmax=max;
|
||||
_dos_setdrive(p,&total);
|
||||
chdir("\\");
|
||||
if (dir_finder()) return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
TSTR_LIST script=NULL;
|
||||
char work_buff[8000];
|
||||
|
||||
static char compile_script(char *in,char *out,char *source,char *target)
|
||||
{
|
||||
char *c,*d;
|
||||
|
||||
c=in;d=out;
|
||||
while (*c)
|
||||
{
|
||||
if (*c=='%')
|
||||
switch(toupper(*(++c)))
|
||||
{
|
||||
case 'T':strcpy(d,target);d=strchr(d,0);break;
|
||||
case 'S':strcpy(d,source);d=strchr(d,0);break;
|
||||
default: return 1;
|
||||
}
|
||||
else
|
||||
*d++=*c;
|
||||
c++;
|
||||
}
|
||||
*d=0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
char read_script(char *filename,char *source_path,char *target_path)
|
||||
{
|
||||
FILE *f;
|
||||
char buff[161];
|
||||
int i=0;
|
||||
|
||||
if (script!=NULL) release_list(script);
|
||||
script=create_list(16);
|
||||
f=fopen(filename,"r");
|
||||
if (f==NULL) return 1;
|
||||
while (!feof(f))
|
||||
{
|
||||
if (fgets(buff,160,f)==NULL) break;
|
||||
if (buff[strlen(buff)-1]=='\n') buff[strlen(buff)-1]=0;
|
||||
if (buff[0]==0) continue;
|
||||
if (compile_script(buff,work_buff,source_path,target_path))
|
||||
{
|
||||
fclose(f);
|
||||
return 2;
|
||||
}
|
||||
str_replace(&script,i,work_buff);
|
||||
i++;
|
||||
}
|
||||
fclose(f);
|
||||
return 0;
|
||||
}
|
||||
|
||||
long check_size(int gr)
|
||||
{
|
||||
int group,pocet,i;
|
||||
char prikaz[20];
|
||||
long suma=0;
|
||||
|
||||
pocet=str_count(script);
|
||||
for(i=0;i<pocet;i++) if (script[i]!=NULL)
|
||||
{
|
||||
if (sscanf(script[i],"%d %s %s",&group,prikaz,work_buff)<1) group=gr+1;
|
||||
strupr(prikaz);
|
||||
if (!strcmp(prikaz,COPY) && group==gr)
|
||||
{
|
||||
struct find_t ft;
|
||||
int rc;
|
||||
|
||||
rc=_dos_findfirst(work_buff,_A_NORMAL,&ft);
|
||||
while (rc==0)
|
||||
{
|
||||
suma+=ft.size;
|
||||
rc=_dos_findnext(&ft);
|
||||
}
|
||||
}
|
||||
}
|
||||
return suma;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void view_line_init(OBJREC *o,int *len)
|
||||
{
|
||||
o->datasize=(*len)+1;
|
||||
}
|
||||
|
||||
static void view_line_draw(int x1,int y1, int x2, int y2, OBJREC *o)
|
||||
{
|
||||
char *c;
|
||||
|
||||
bar(x1,y1,x2,y2);
|
||||
c=(char *)o->data;
|
||||
if (!*c) return;
|
||||
set_aligned_position(x2,y1,2,0,c);
|
||||
outtext(c);
|
||||
}
|
||||
|
||||
|
||||
void view_line(OBJREC *o)
|
||||
{
|
||||
o->runs[0]=view_line_init;
|
||||
o->runs[1]=view_line_draw;
|
||||
}
|
||||
|
||||
|
||||
char get_max_res()
|
||||
{
|
||||
if (vesasupport(0x110)) return 2;
|
||||
if (vesasupport(0x100)) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void add_to_list(char *name)
|
||||
{
|
||||
if (file_list==NULL) file_list=create_list(256);
|
||||
str_add(&file_list,name);
|
||||
}
|
||||
|
||||
static void copy_1_file(char *init_mask,char *filename,char *target)
|
||||
{
|
||||
char *c,*d;
|
||||
|
||||
c=alloca(strlen(init_mask)+strlen(filename)+1);
|
||||
strcpy(c,init_mask);
|
||||
d=strrchr(c,'\\');
|
||||
d++;
|
||||
strcpy(d,filename);
|
||||
d=alloca(strlen(target)+strlen(filename)+10);
|
||||
strcpy(d,target);
|
||||
if (d[0]==0 || d[strlen(d)-1]!='\\') strcat(d,"\\");
|
||||
strcat(d,filename);
|
||||
set_value(0,20,filename);
|
||||
add_to_list(d);
|
||||
cpy_file(c,d);
|
||||
}
|
||||
|
||||
static void copy_files(char *param)
|
||||
{
|
||||
struct find_t ft;
|
||||
char *source_mask;
|
||||
char *target;
|
||||
int rc;
|
||||
|
||||
target=strchr(param,' ');
|
||||
if (target==NULL) return;
|
||||
source_mask=alloca(target-param);
|
||||
source_mask[target-param]=0;
|
||||
strncpy(source_mask,param,target-param);
|
||||
target++;
|
||||
rc=_dos_findfirst(source_mask,_A_NORMAL,&ft);
|
||||
while (rc==0)
|
||||
{
|
||||
copy_1_file(source_mask,ft.name,target);
|
||||
rc=_dos_findnext(&ft);
|
||||
}
|
||||
_dos_findclose(&ft);
|
||||
}
|
||||
|
||||
char cascade_mkdir(char *path)
|
||||
{
|
||||
char *c;
|
||||
char d;
|
||||
|
||||
if (path[0]==0||path[1]==':' && path[2]==0) return 0;
|
||||
if (!access(path,F_OK)) return 0;
|
||||
c=strrchr(path,'\\');
|
||||
if (c==NULL) return 0;
|
||||
*c=0;
|
||||
d=cascade_mkdir(path);
|
||||
*c='\\';
|
||||
if (d==1) return 1;
|
||||
if (mkdir(path)!=0) return 1;
|
||||
add_to_list(path);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static char add_to_ini(char *params)
|
||||
{
|
||||
return fprintf(ini,"%s\n",params)<0;
|
||||
}
|
||||
|
||||
static char *commands[]=
|
||||
{
|
||||
COPY,
|
||||
MKDIR,
|
||||
INI,
|
||||
};
|
||||
|
||||
static char (*calls[])(char *params)=
|
||||
{
|
||||
copy_files,
|
||||
cascade_mkdir,
|
||||
add_to_ini,
|
||||
};
|
||||
|
||||
|
||||
|
||||
static char command_match(char *cmd,char *test,char **params)
|
||||
{
|
||||
while (*test) if (toupper(*cmd++)!=toupper(*test++)) return 0;
|
||||
if (*cmd!=' ') return 0;
|
||||
*params=cmd+1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
char do_script(int section)
|
||||
{
|
||||
int pos;
|
||||
int num;
|
||||
int str_siz=str_count(script);
|
||||
char *command;
|
||||
|
||||
for(pos=0;pos<str_siz;pos++) if (script[pos]!=NULL)
|
||||
{
|
||||
num=-1;
|
||||
sscanf(script[pos],"%d",&num);
|
||||
if (num==section && (command=strchr(script[pos],' '))!=NULL)
|
||||
{
|
||||
int i;
|
||||
command++;
|
||||
|
||||
for(i=0;i<sizeof(commands)/4;i++)
|
||||
{
|
||||
char *p;
|
||||
if (command_match(command,commands[i],&p))
|
||||
if (calls[i](p))
|
||||
{
|
||||
char s[200];
|
||||
|
||||
sprintf(s,"Instal tor nedok z l zpracovat © dek '%s' - P©¡kaz '%s' vr til chybu",command,commands[i]);
|
||||
if (msg_box("Chyba v INF",'\x1',s,"Ignoruj","P©eru¨it",NULL)==2) return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
char test_mscdex();
|
||||
#pragma aux test_mscdex =\
|
||||
"mov eax,1500h"\
|
||||
"mov ebx,0h"\
|
||||
"int 2fh"\
|
||||
"cmp al,0ffh"\
|
||||
"mov al,0"\
|
||||
"jnz nook"\
|
||||
"mov al,cl"\
|
||||
"add al,65"\
|
||||
"nook:"\
|
||||
value[al] modify [eax ebx ecx]
|
||||
|
||||
int mscdex_ver();
|
||||
#pragma aux mscdex_ver =\
|
||||
"mov eax,150ch"\
|
||||
"int 2fh"\
|
||||
value [ebx] modify [eax]
|
||||
|
||||
char *get_cdrom()
|
||||
{
|
||||
static char s[80];
|
||||
char c;
|
||||
int v;
|
||||
|
||||
c=test_mscdex();
|
||||
if (c)
|
||||
{
|
||||
v=mscdex_ver();
|
||||
sprintf(s," MSCDEX %d.%02d drive %c:",v/256,v%256,c);
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(s,"<nen¡>");
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
char validate_path(char *path)
|
||||
{
|
||||
unsigned disk;
|
||||
unsigned cdisk,lastdrv;
|
||||
char *c,ll=0,tt=0,d;
|
||||
|
||||
static char valid[]="$%'_@{}~`#()&-";
|
||||
|
||||
if (path==NULL || path[0]==0 || path[1]!=':' || path[2]!='\\') return 0;
|
||||
disk=toupper(path[0]);
|
||||
if (disk<'A' || disk>'Z') return 0;
|
||||
_dos_getdrive(&cdisk);
|
||||
disk-='@';_dos_setdrive(disk,&lastdrv);
|
||||
_dos_getdrive(&lastdrv);
|
||||
disk=(disk==lastdrv);
|
||||
_dos_setdrive(cdisk,&lastdrv);
|
||||
if (!disk) return 0;
|
||||
c=path+2;ll=0;
|
||||
while (*c)
|
||||
{
|
||||
d=toupper(*c);
|
||||
if (d=='\\')
|
||||
if (ll) return 0;else ll=1,tt=0;
|
||||
else
|
||||
if (d>='A' && d<='Z' || d>='0' && d<='9' || strchr(valid,d)!=NULL || d>127) ll=0;
|
||||
else if (d=='.') if (tt) return 0;else tt=1;
|
||||
else return 0;
|
||||
c++;
|
||||
}
|
||||
if (ll) return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void clean_up()
|
||||
{
|
||||
int i,cnt;
|
||||
if (file_list==NULL) return;
|
||||
cnt=str_count(file_list);
|
||||
for(i=cnt-1;i>=0;i--) if (file_list[i]!=NULL)
|
||||
{
|
||||
if (remove(file_list[i])) rmdir(file_list[i]);
|
||||
}
|
||||
release_list(file_list);
|
||||
file_list=NULL;
|
||||
}
|
||||
|
||||
void purge_file_list()
|
||||
{
|
||||
if (file_list==NULL) return;
|
||||
release_list(file_list);
|
||||
file_list=NULL;
|
||||
}
|
||||
|
||||
char cascade_delete(char ignore_sav)
|
||||
{
|
||||
struct find_t f;
|
||||
int rc;
|
||||
|
||||
rc=_dos_findfirst("*.*",_A_SUBDIR,&f);
|
||||
while (rc==0)
|
||||
{
|
||||
if (f.attrib & _A_SUBDIR)
|
||||
{
|
||||
if (f.name[0]!='.')
|
||||
{
|
||||
chdir(f.name);
|
||||
cascade_delete(ignore_sav);
|
||||
chdir("..");
|
||||
rmdir(f.name);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
char *c=strchr(f.name,'.');
|
||||
|
||||
if (c!=NULL)
|
||||
{
|
||||
strupr(c);
|
||||
if (!ignore_sav || strncmp(c,".SAV",4)) remove(f.name);
|
||||
}
|
||||
else remove(f.name);
|
||||
}
|
||||
rc=_dos_findnext(&f);
|
||||
}
|
||||
return 0;
|
||||
}
|
22
insteng/SETUPLIB.H
Normal file
22
insteng/SETUPLIB.H
Normal file
|
@ -0,0 +1,22 @@
|
|||
char all_finder();
|
||||
char select_disk();
|
||||
char read_script(char *filename,char *source_path,char *target_path);
|
||||
long check_size(int gr);
|
||||
long get_disk_free(char disk);
|
||||
void view_line(OBJREC *o);
|
||||
char *get_cdrom();
|
||||
char get_max_res();
|
||||
char do_script(int);
|
||||
void done_bar(); //define(...done_bar,max);
|
||||
char cascade_mkdir(char *path);
|
||||
char validate_path(char *path);
|
||||
char cascade_delete(char ignore_sav); //maze soubory a podadresare. Pripadne ignoruje soubory SAV
|
||||
|
||||
void clean_up(); //maze zkopirovane soubory a adresare
|
||||
void purge_file_list();
|
||||
void add_to_list(char *name);
|
||||
|
||||
|
||||
#define INST_MIN 0
|
||||
#define INST_MED 1
|
||||
#define INST_MAX 2
|
210
insteng/SETVIDEO.C
Normal file
210
insteng/SETVIDEO.C
Normal file
|
@ -0,0 +1,210 @@
|
|||
#include <types.h>
|
||||
#include <vesa.h>
|
||||
#include <stdlib.h>
|
||||
#include <mem.h>
|
||||
#include <stdio.h>
|
||||
#include <bgraph.h>
|
||||
#include <bmouse.h>
|
||||
#include <devices.h>
|
||||
#include <gui.h>
|
||||
#include <basicobj.h>
|
||||
#include <strlite.h>
|
||||
#include <strlists.h>
|
||||
#include "setup.h"
|
||||
|
||||
static void *xlat256=NULL;
|
||||
static void *xlat16=NULL;
|
||||
static void *xlat64=NULL;
|
||||
|
||||
static void create_xlats()
|
||||
{
|
||||
if (xlat256==NULL) xlat256=create_special_palette();
|
||||
if (xlat16==NULL) xlat16=create_blw_palette16();
|
||||
if (xlat64==NULL) xlat64=create_hixlat();
|
||||
}
|
||||
|
||||
|
||||
static void initgr_common()
|
||||
{
|
||||
register_ms_cursor(&sipka);
|
||||
if (init_mysky()!=0)
|
||||
{
|
||||
closemode();
|
||||
puts("Neni mys!\nMouse not found!");
|
||||
exit(0);
|
||||
}
|
||||
// hranice_mysky(0,0,639,479);
|
||||
update_mysky();
|
||||
schovej_mysku();
|
||||
bar(0,0,639,479);
|
||||
showview(0,0,0,0);
|
||||
}
|
||||
|
||||
int initgr_auto()
|
||||
{
|
||||
int vmode;
|
||||
create_xlats();
|
||||
vmode=2;
|
||||
if (initmode32())
|
||||
{
|
||||
vmode=5;
|
||||
if (initmode64(xlat64))
|
||||
{
|
||||
vmode=1;
|
||||
if (initmode256(xlat256))
|
||||
{
|
||||
vmode=0;
|
||||
initmode16(xlat16);
|
||||
}
|
||||
}
|
||||
}
|
||||
initgr_common();
|
||||
return vmode;
|
||||
}
|
||||
|
||||
int initgr_spec(int vmode)
|
||||
{
|
||||
int i=-1;
|
||||
create_xlats();
|
||||
switch (vmode)
|
||||
{
|
||||
case 0:i=initmode_lo(xlat256);break;
|
||||
case 1:i=initmode256(xlat256);break;
|
||||
case 2:i=initmode32();break;
|
||||
case 5:i=initmode64(xlat64);break;
|
||||
}
|
||||
if (!i) initgr_common();
|
||||
return i;
|
||||
}
|
||||
|
||||
void initgr_low()
|
||||
{
|
||||
create_xlats();
|
||||
initmode16(xlat16);
|
||||
initgr_common();
|
||||
}
|
||||
|
||||
void donegr()
|
||||
{
|
||||
closemode();
|
||||
done_mysky();
|
||||
}
|
||||
|
||||
void kresli_okno(WINDOW *w)
|
||||
{
|
||||
int x,y;
|
||||
int xs,ys,xsr,ysr;
|
||||
int x1,y1,xs1,ys1;
|
||||
int i,j;
|
||||
|
||||
xsr=ramecky[0][0];
|
||||
ysr=ramecky[0][1];
|
||||
x1=w->x-12;
|
||||
y1=w->y-12;
|
||||
xs1=w->xs+24;
|
||||
ys1=w->ys+24;
|
||||
xs=xs1/xsr;
|
||||
ys=ys1/ysr;
|
||||
curcolor=w->color;
|
||||
bar(w->x,w->y,w->x+w->xs,w->y+w->ys);
|
||||
for(j=0,y=y1;j<ys;j++,y+=ysr)
|
||||
if (j==0)
|
||||
for(i=0,x=x1;i<xs;i++,x+=xsr)
|
||||
if (i==0) put_picture(x,y,ramecky[0]);
|
||||
else if (i+1==xs) put_picture(x,y,ramecky[2]);
|
||||
else put_picture(x,y,ramecky[1]);
|
||||
else if (j+1==ys)
|
||||
for(i=0,x=x1;i<xs;i++,x+=xsr)
|
||||
if (i==0) put_picture(x,y,ramecky[5]);
|
||||
else if (i+1==xs) put_picture(x,y,ramecky[5]);
|
||||
else put_picture(x,y,ramecky[6]);
|
||||
else
|
||||
{
|
||||
x=x1;
|
||||
put_picture(x+xsr*xs-xsr,y,ramecky[4]);
|
||||
put_picture(x,y,ramecky[3]);
|
||||
}
|
||||
}
|
||||
|
||||
long def_window(word xs,word ys,char *name)
|
||||
{
|
||||
word x=0,y=0;
|
||||
WINDOW *p;
|
||||
CTL3D ctl;
|
||||
FC_TABLE fc;
|
||||
long q;
|
||||
|
||||
if (waktual!=NULL)
|
||||
{
|
||||
x=waktual->x;
|
||||
y=waktual->y;
|
||||
}
|
||||
name;
|
||||
highlight(&ctl,WINCOLOR);
|
||||
ctl.bsize=2;ctl.ctldef=0;
|
||||
x+=20;y+=20;
|
||||
memcpy(fc,flat_color(0x7fe0),sizeof(FC_TABLE));
|
||||
fc[0]=0x0000;
|
||||
if (x+xs>MAX_X-2) x=MAX_X-2-xs;
|
||||
if (y+ys>MAX_Y-2) y=MAX_Y-2-ys;
|
||||
p=create_window(x,y,xs,ys,WINCOLOR,&ctl);
|
||||
q=desktop_add_window(p);
|
||||
define(0,2,2,xs-5-20*(xs>=70),14,0,win_label,name);
|
||||
ctl.bsize=1;ctl.ctldef=1;
|
||||
o_end->autoresizex=1;
|
||||
property(&ctl,vga_font,&fc,LABELCOLOR);
|
||||
if (xs>=70)
|
||||
{
|
||||
define(1,1,1,19,16,1,button,"\x0f");
|
||||
property(NULL,icones,&icone_color,WINCOLOR);on_change(close_current);
|
||||
}
|
||||
return q;
|
||||
}
|
||||
|
||||
int def_dialoge(word x,word y,word xs, word ys, char *name,char modal)
|
||||
{
|
||||
CTL3D ctl;
|
||||
FC_TABLE fc;
|
||||
WINDOW *p;
|
||||
int i;
|
||||
|
||||
memcpy(fc,flat_color(0x7fe0),sizeof(FC_TABLE));
|
||||
if (modal & 0x2)
|
||||
{
|
||||
ctl.bsize=12;
|
||||
xs=((xs+6)/12)*12;
|
||||
ys=((ys+6)/12)*12;
|
||||
}
|
||||
else
|
||||
memcpy(&ctl,def_border(2,WINCOLOR),sizeof(CTL3D));
|
||||
p=create_window(x,y,xs,ys,WINCOLOR,&ctl);
|
||||
i=desktop_add_window(p);
|
||||
if (modal & 1) set_window_modal();
|
||||
memcpy(&ctl,def_border(5,WINCOLOR),sizeof(CTL3D));
|
||||
if (name!=NULL)
|
||||
{
|
||||
define(0,2,2,xs-4,14,0,win_label,name);
|
||||
o_end->autoresizex=1;
|
||||
property(&ctl,vga_font,&fc,LABELCOLOR);
|
||||
}
|
||||
if (modal & 0x2) p->draw_event=kresli_okno;
|
||||
return i;
|
||||
}
|
||||
|
||||
void def_listbox(int id,word x,word y,word xs,word ys,TSTR_LIST ls,int ofs,int color)
|
||||
{
|
||||
CTL3D b1,b2;
|
||||
word black[]={0,0,0,0,0,0};
|
||||
|
||||
memcpy(&b1,def_border(1,0),sizeof(CTL3D));
|
||||
memcpy(&b2,def_border(5,WINCOLOR),sizeof(CTL3D));
|
||||
define(id+1,x+xs+4,y+18,15,ys-35,0,scroll_bar_v,0,10,1,0x0200);
|
||||
property(&b2,NULL,NULL,WINCOLOR);
|
||||
define(id+2,x+xs+4,y,14,14,0,scroll_button,-1,0,"\x4");
|
||||
property(&b1,icones,black,WINCOLOR);on_change(scroll_support);
|
||||
define(id+3,x+xs+4,y+ys-14,14,14,0,scroll_button,1,10,"\6");
|
||||
property(&b1,icones,black,WINCOLOR);on_change(scroll_support);
|
||||
define(id,x,y,xs,ys,0,listbox,ls,color,ofs);
|
||||
property(&b2,NULL,NULL,WINCOLOR);
|
||||
}
|
||||
|
6
insteng/SETVIDEO.H
Normal file
6
insteng/SETVIDEO.H
Normal file
|
@ -0,0 +1,6 @@
|
|||
int initgr_auto();
|
||||
void initgr_low();
|
||||
int initgr_spec(int vmode);
|
||||
void donegr();
|
||||
int def_dialoge(word x,word y,word xs, word ys, char *name,char modal);
|
||||
void def_listbox(int id,word x,word y,word xs,word ys,TSTR_LIST ls,int ofs,int color);
|
53
insteng/STUB.C
Normal file
53
insteng/STUB.C
Normal file
|
@ -0,0 +1,53 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <process.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#define QUIET x
|
||||
|
||||
/* Add environment strings to be searched here */
|
||||
char *paths_to_check[] = {
|
||||
"DOS4GPATH",
|
||||
"PATH"};
|
||||
|
||||
char *dos4g_path()
|
||||
{
|
||||
static char fullpath[80];
|
||||
int i;
|
||||
|
||||
for( i = 0;
|
||||
i < sizeof( paths_to_check ) / sizeof( paths_to_check[0] ); i++ ) {
|
||||
_searchenv( "dos4gw.exe", paths_to_check[i], fullpath );
|
||||
if( fullpath[0] ) return( &fullpath );
|
||||
}
|
||||
for( i = 0;
|
||||
i < sizeof( paths_to_check ) / sizeof( paths_to_check[0] ); i++ ) {
|
||||
_searchenv( "dos4g.exe", paths_to_check[i], fullpath );
|
||||
if( fullpath[0] ) return( &fullpath );
|
||||
}
|
||||
return( "dos4gw.exe" );
|
||||
}
|
||||
|
||||
main( int argc, char *argv[] )
|
||||
{
|
||||
char *av[4];
|
||||
auto char cmdline[128];
|
||||
int i;
|
||||
av[0] = dos4g_path(); /* Locate the DOS/4G loader */
|
||||
av[1] = argv[0]; /* name of executable to run */
|
||||
av[2] = getcmd( cmdline ); /* command line */
|
||||
av[3] = NULL; /* end of list */
|
||||
#ifdef QUIET
|
||||
putenv( "DOS4G=QUIET" ); /* disables DOS/4G Copyright banner */
|
||||
#endif
|
||||
printf("Instalator Br ny Skeldalu (C)1997 Napoleon gameS Nahr v m... \n");
|
||||
i=spawnvp(P_WAIT, av[0], av );
|
||||
if (i==254)
|
||||
execl(av[0],av[0],"SKELDAL.EXE",NULL);else exit(0);
|
||||
puts( "Chyba pri nacitani extenderu:" );
|
||||
puts( av[0] );
|
||||
puts( "\nZkontrolujte zda-li je k dosazeni na aktualnim adresari\n"
|
||||
"popripade specifikujte jeho v cestu v systemove promenne:\n"
|
||||
"SET DOS4GPATH=disk:\\cesta\n");
|
||||
exit( 1 ); /* indicate error */
|
||||
}
|
101
insteng/TEXTLIB.ASM
Normal file
101
insteng/TEXTLIB.ASM
Normal file
|
@ -0,0 +1,101 @@
|
|||
.model small
|
||||
.386
|
||||
|
||||
SEGB800 equ 0b8000h
|
||||
|
||||
_TEXT segment byte public 'CODE' use32
|
||||
assume CS:_TEXT
|
||||
assume DS:DGROUP
|
||||
|
||||
public load_font_
|
||||
load_font_: ;esi font
|
||||
mov esi,offset fonttable
|
||||
mov edx,3c4h
|
||||
mov eax,0402h
|
||||
out dx,ax
|
||||
mov eax,0704h
|
||||
out dx,ax
|
||||
Mov edx,3ceh
|
||||
mov eax,0204h
|
||||
out dx,ax
|
||||
mov eax,0005h
|
||||
out dx,ax
|
||||
mov eax,0406h
|
||||
out dx,ax
|
||||
mov edi,0xA0000h
|
||||
mov edx,256
|
||||
lfOpk: mov ecx,16
|
||||
rep movsb
|
||||
add edi,16
|
||||
dec edx
|
||||
jne lfopk
|
||||
mov edx,3c4h
|
||||
mov eax,0302h
|
||||
out dx,ax
|
||||
mov eax,0304h
|
||||
out dx,ax
|
||||
Mov edx,3ceh
|
||||
mov eax,0004h
|
||||
out dx,ax
|
||||
mov eax,1005h
|
||||
out dx,ax
|
||||
mov eax,0E06h
|
||||
out dx,ax
|
||||
ret
|
||||
|
||||
public set_font_8x8_
|
||||
set_font_8x8_:
|
||||
cli
|
||||
mov edx,3d4h
|
||||
mov eax,0100h
|
||||
out dx,ax
|
||||
mov edx,3c4h
|
||||
mov al,1
|
||||
out dx,al
|
||||
inc edx
|
||||
in al,dx
|
||||
or al,1
|
||||
out dx,al
|
||||
mov edx,03dah
|
||||
in al,dx
|
||||
mov edx,03c0h
|
||||
mov al,13h
|
||||
out dx,al
|
||||
mov al,0
|
||||
out dx,ax
|
||||
mov al,32
|
||||
out dx,al
|
||||
mov edx,3d4h
|
||||
mov eax,0300h
|
||||
out dx,ax
|
||||
sti
|
||||
ret
|
||||
|
||||
public turn_flashing_ ;ebx - ON/OFF
|
||||
turn_flashing_:
|
||||
mov eax,1003h
|
||||
int 10h
|
||||
ret
|
||||
|
||||
|
||||
public get_window_size_ ;eax,edx-velikost
|
||||
get_window_size_:
|
||||
imul eax,edx
|
||||
shl eax,1
|
||||
add eax,4
|
||||
ret
|
||||
|
||||
public save_window_ ;eax,edx-pozice
|
||||
;ecx,ebx-velikost
|
||||
;edi - buffer
|
||||
save_window_
|
||||
stosb
|
||||
imul eax,160
|
||||
lea eax,[eax+edx*2]
|
||||
lea esi,[eax+SEGB800]
|
||||
mov al,dl
|
||||
stosb
|
||||
mov al,bl
|
||||
mov ah,cl
|
||||
stosw
|
||||
mov edx,ebx
|
4
insteng/TEXTLIB.C
Normal file
4
insteng/TEXTLIB.C
Normal file
|
@ -0,0 +1,4 @@
|
|||
|
||||
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue