Aperture Image Format

From Portal Puzzle Wiki

Jump to: navigation, search
Under construction.png This article or section is under major construction.
Please avoid editing this article or section until this message box is removed.

Aperture Menu/Picture Format is a runlength encoded interactive graphics format created by Aperture Laboratories in 1985 and maintained by Doug Rattmann.

The format consists of two filetypes:

AMF = "Aperture Menu Format", contains position and text data for menus to display over an image

APF = "Aperture Picture Format", contains image data

All AMF and APF files must be stored in a directory named "DATA"

The data is parsed and displayed by the following code:

Contents

GW-Basic AMF/APF Viewer Source

10 REM ****************************************************

20 REM **  COPYRIGHT (c) APERTURE LABORATORIES 1985-1987 **

30 REM **    (MAINTAINER: DOUG RATTMANN, EXT. 3270)      **

40 REM ****************************************************

50 F$="APERTURE":DIM MX%(9):DIM MY%(9):DIM MT$(9):DIM MF$(10)

60 KEY OFF:SCREEN 1,0:CLS:X%=0:Y%=199:P%=0:L%=0:I%=0:R%=0:SK%=0:SN%=0

70 FOR N%=1 TO 9:MX%(N%)=0:MY%(N%)=0:MT$(N%)="":MF$(N%)="":NEXT N%

80 OPEN "DATA\"+F$+".AMF" FOR INPUT AS #1:REM OBTAIN MENU DISKS FROM OTHER ACCOUNT

90 LINE INPUT #1,T$:IF T$<>"APERTURE MENU FORMAT (c) 1985" THEN PRINT "ERR: Not a valid menu file!":END

100 INPUT #1,CB%,CP%,CG%:COLOR CB%,CP%:N%=1

110 IF EOF(1) OR N%>9 THEN CLOSE(1):GOTO 120 ELSE INPUT #1,MX%(N%),MY%(N%),MT$(N%),MF$(N%):N%=N%+1:GOTO 110

120 OPEN "DATA\"+F$+".APF" FOR INPUT AS #2:LINE INPUT #2,T$:IF T$<>"APERTURE IMAGE FORMAT (c) 1985" THEN PRINT "ERR: Not a valid image file!":END ELSE INPUT #2,SK%

130 IF EOF(2) THEN CLOSE(2):GOTO 210 ELSE LINE INPUT #2,D$:L%=LEN(D$)

140 FOR P%=1 TO L%:R%=ASC(MID$(D$,P%,1))-32:IF I%=1 THEN I%=0 ELSE I%=1

    150 WHILE R%>0:IF I%=0 GOTO 180

        160 IF X%+R%>320 THEN LINE(X%,Y%)-(320,Y%),CG%:R%=(R%+X%)MOD 320:X%=0:Y%=Y%-SK% ELSE LINE(X%,Y%)-(X%+R%-1,Y%),CG%:X%=X%+R%:R%=0

        170 GOTO 190

        180 IF X%+R%>320 THEN R%=(R%+X%)MOD 320:X%=0:Y%=Y%-SK% ELSE X%=X%+R%:R%=0

        190 IF Y%<0 THEN SN%=SN%+1:Y%=199-SN%

200 WEND:NEXT P%:GOTO 130

210 FOR N%=1 TO 9:IF LEN(MT$(N%))>0 THEN LOCATE MY%(N%),MX%(N%):PRINT STR$(N%)+": "+MT$(N%);

220 NEXT N%

230 K$=INKEY$:IF LEN(K$)=0 THEN GOTO 230 ELSE I%=ASC(K$)-48

240 IF I%>=1 AND I%<=9 THEN IF LEN(MT$(I%))>0 THEN F$=MF$(I%):IF F$="EXIT" THEN SYSTEM ELSE GOTO 60

250 GOTO 230

Windows Binaries

The first two of the following methods contain the AMF/APF files obtained from the BBS, and will view them on launch.

Method 1 (Precompiled)

Standalone program (precompiled with QB64)

Method 2 (Configured to autorun)

Dosbox-Portal

Method 3 (Built off of C# and .NET, no QBasic required)

AIF.rar

NOTE: Requires the .NET framework, probably already installed on your computer. For *NIX and Mac, please recompile using Mono.

Decoded Images

APF Images

APF Format Information

The Aperture Picture Format is an ASCII file that can be identified by its plaintext header:

APERTURE IMAGE FORMAT (c) 1985

The convention for the end of a line is given by hex code 0x0D0D0A, or <CR CR LF>. The APF file format has the following basic structure:

Header<CR CR LF>
<line skip><CR CR LF>
data
EOF

The data section is read in as a single chunk of ASCII characters, each of which corresponds to a line length to be either written to the screen or skipped. Each ASCII character is converted to an integer, and 32 is subtracted from it. The first number is written as a line to the screen, the second number is skipped without writing, and so on. When the program reaches the end of a line, the remaining characters will be written to NOT the next line, but <line skip> lines up on the screen. In this sense, the data is interleaved by <line skip>. The image begins at line #199, and proceeds backwards, skipping over <line skip> lines. When the program goes past line #0, it begins again at the largest unwritten line#. The colors for a given image are defined in the loaded Aperture Menu Format file.

AMF Format information

The Aperture Menu Format is an ASCII file that can be identified by its plaintext header:

APERTURE MENU FORMAT (c) 1985

The convention for the end of a line is the same as the APF - 0x0D0D0A or <CR CR LF>. The AMF file format has the following basic structure:

Header<CR CR LF>
<BG color>,<FG Color>,<Line color><CR CR LF>
data
EOF

The data section contains an array of menu entries. The array may be as small as 0 or as large as 9 entries, maximum. The structure for each entry in the array is as follows:

<X>,<Y>,"<Title>","<File>"<CR CR LF>

<X> and <Y> are the X and Y coordinates of the menu. <Title> contains the text of the menu, and <File> contains the image to load when the menu is selected. If the File field contains "EXIT", then the program will exit when that menu item is chosen. These fields should be filled as 0,0,"","" if the menu number is not in use (it will not be drawn or activated). <File> should point to the filename of both an AMF and an APF file. If <File> points to valid files, then upon selecting that menu entry, the program will reload itself reading the indicated files.

Fake APFs

The Aperture Menu/Picture Format can be trivially emulated by individuals attempting to fake leads. The below is one example:

One such example is available at

When decoded, the image looks like:

Fake.bmp

Personal tools