-
Notifications
You must be signed in to change notification settings - Fork 7
/
tads3.c
100 lines (86 loc) · 2.68 KB
/
tads3.c
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
87
88
89
90
91
92
93
94
95
96
97
98
99
/*
* tads3.c - Treaty of Babel module for Tads 3 files
*
* This file depends on treaty_builder.h
*
* This file is public domain, but note that any changes to this file may
* render it noncompliant with the Treaty of Babel
*
* Modified
*. 04/15/2006 LRRaszewski - Separated tads2.c and tads3.c
*. 04/08/2006 LRRaszewski - changed babel API calls to threadsafe versions
*. 04/08/2006 MJRoberts - initial implementation
*/
#define FORMAT tads3
#define HOME_PAGE "http://www.tads.org"
#define FORMAT_EXT ".t3"
#include "treaty_builder.h"
#include "tads.h"
#define T3_SIGNATURE "T3-image\015\012\032"
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE 1
#endif
/*
* get a story file's IFID
*/
static int32 get_story_file_IFID(void *story_file, int32 extent,
char *output, int32 output_extent)
{
/* use the common tads IFID extractor/generator */
return tads_get_story_file_IFID(story_file, extent,
output, output_extent);
}
/*
* determine if a given story file is one of ours
*/
static int32 claim_story_file(void *story_file, int32 extent)
{
/* check our signature */
if (tads_match_sig(story_file, extent, T3_SIGNATURE))
return VALID_STORY_FILE_RV;
/* not one of ours */
return INVALID_STORY_FILE_RV;
}
/*
* Get the size of the iFiction metadata for the game
*/
static int32 get_story_file_metadata_extent(void *story_file, int32 extent)
{
/* use the common tads iFiction synthesizer */
return tads_get_story_file_metadata_extent(story_file, extent);
}
/*
* Get the iFiction metadata for the game
*/
static int32 get_story_file_metadata(void *story_file, int32 extent,
char *buf, int32 bufsize)
{
/* use the common tads iFiction synthesizer */
return tads_get_story_file_metadata(story_file, extent, buf, bufsize);
}
static int32 get_story_file_cover_extent(void *story_file, int32 story_len)
{
/* use the common tads cover file extractor */
return tads_get_story_file_cover_extent(story_file, story_len);
}
/*
* Get the format of the cover art
*/
static int32 get_story_file_cover_format(void *story_file, int32 story_len)
{
/* use the common tads cover file extractor */
return tads_get_story_file_cover_format(story_file, story_len);
}
/*
* Get the cover art data
*/
static int32 get_story_file_cover(void *story_file, int32 story_len,
void *outbuf, int32 output_extent)
{
/* use the common tads cover file extractor */
return tads_get_story_file_cover(story_file, story_len,
outbuf, output_extent);
}