1 /* advsys.c Treaty of Babel module for AdvSys files
\r
2 * 2006 By L. Ross Raszewski
\r
4 * This file depends on treaty_builder.h
\r
6 * This file is public domain, but note that any changes to this file
\r
7 * may render it noncompliant with the Treaty of Babel
\r
10 #define FORMAT advsys
\r
11 #define HOME_PAGE "http://www.ifarchive.org/if-archive/programming/advsys/"
\r
12 #define FORMAT_EXT ".dat"
\r
16 #include "treaty_builder.h"
\r
20 /* IFIDs for AdvSys are formed by prepending ADVSYS- to the default
\r
23 static int32 get_story_file_IFID(void *story_file, int32 extent, char *output, int32 output_extent)
\r
25 /* This line suppresses a warning from the borland compiler */
\r
26 if (story_file || extent) { }
\r
27 ASSERT_OUTPUT_SIZE(8);
\r
28 strcpy(output,"ADVSYS-");
\r
29 return INCOMPLETE_REPLY_RV;
\r
33 /* The Advsys claim algorithm: bytes 2-8 of the file contain the
\r
34 text "ADVSYS", unobfuscated in the following way:
\r
35 30 is added to each byte, then the bits are reversed
\r
37 static int32 claim_story_file(void *story_file, int32 extent)
\r
44 buf[i]=~(((char *)story_file)[i+2]+30);
\r
46 if (strcmp(buf,"ADVSYS")==0) return VALID_STORY_FILE_RV;
\r
48 return INVALID_STORY_FILE_RV;
\r