File: jzexe.h

package info (click to toggle)
jzip 210r20001005d-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 1,088 kB
  • ctags: 1,867
  • sloc: ansic: 11,700; makefile: 28; sh: 27
file content (86 lines) | stat: -rw-r--r-- 2,535 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86

/* $Id: jzexe.h,v 1.1.1.1 2000/05/10 14:21:34 jholder Exp $
 * --------------------------------------------------------------------
 * see doc/License.txt for License Information
 * --------------------------------------------------------------------
 *
 * File name: $Id: jzexe.h,v 1.1.1.1 2000/05/10 14:21:34 jholder Exp $
 *
 * Description:
 *
 * Modification history:
 * $Log: jzexe.h,v $
 * Revision 1.1.1.1  2000/05/10 14:21:34  jholder
 *
 * imported
 *
 *
 * --------------------------------------------------------------------
 */

/*
 * jzexe.h
 * 
 * Definitions of the "magic" string and flags used by JZip and JZexe to 
 * create standalone games.
 *
 * Written by Magnus Olsson (mol@df.lth.se), 19 November, 1995,
 * as part of the JZip distribution. 
 * You may use this code in any way you like as long as it is
 * attributed to its author.
 *
 */

/* *JWK* Altered by John W. Kennedy */

/* *JWK* signed/unsigned char problems cleaned up */

/* 2000-02-29 */

#ifndef JZEXE_H
#define JZEXE_H

/* 
 * The following string is used to identify the patch area in the JZip
 * interpreter. The patch area itself is the four '~' characters at 
 * the end; these are part of the string to assure that the memory
 * locations are contiguous under all compilers.
 *
 * The algorithms used require that
 * a) The first character of the string must be unique.
 * b) The string must appear only once within the MSDOS JZip executable.
 * c) The string ends with a patch area of four non-zero bytes.
 * As long as these requirements are fulfilled, the string is arbitrary.
 */
#define MAGIC_STRING "JZip/magic (mol)~~~~"


/* 
 * MAGIC_END is the length of the magic string proper, i.e. 
 * strlen(MAGIC_STRING) - 4.
 */
#define MAGIC_END 16

/* 
 * The first byte of the patch area is used as a flag to tell if the
 * interpreter is part of a standalone game. When creating a standalone
 * game, JZexe patches this byte to a zero. 
 * Hence, the macro STANDALONE_FLAG will be TRUE for a standalone game,
 * and FALSE for the ordinary JZip interpreter.
 */
#define STANDALONE_FLAG (!magic[MAGIC_END])

/*
 * The magic string and patch area are stored in a global, initialized
 * string variable. All C compilers I know of will store this string
 * somewhere in the executable, so JZexe can patch it. If you have
 * an advanced C compiler that doesn't, please contact me (mol@df.lth.se).
 */
extern char *magic;             

/*
 * For ANSI C, a prototype for a function defined in fileio.c.
 */
int analyze_exefile( void );

#endif