Skip to content

Commit c7bee7e

Browse files
committed
Add Pandora specific code (PANDORA preprocessor definition) and README.md
1 parent 9cd3800 commit c7bee7e

File tree

8 files changed

+228
-6
lines changed

8 files changed

+228
-6
lines changed

Makefile-pandora

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
HOST=generic
2+
#HOST=mingw
3+
#HOST=haiku
4+
5+
CC=arm-none-linux-gnueabi-g++
6+
RM=rm
7+
CFLAGS= -Os -DPANDORA -pipe -march=armv7-a -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=vfpv3 -mfloat-abi=softfp -I${PNDSDK}/usr/include -L${PNDSDK}/usr/lib
8+
COPTS= $(CFLAGS) -funsigned-char -ffast-math
9+
LIBS= -lm -lSDL -lts -lSDL_mixer -lmad -s
10+
SRCS= alien.c asylum.c bullet.c file.c keyboard.c maze.c menus.c player.c projectile.c sound.c vdu.c
11+
12+
RESOURCES=data/Resources data/Ego data/Psyche data/Id data/Voices
13+
14+
INSTALLGROUP=games
15+
CHGRP=chgrp
16+
CHMOD=chmod
17+
18+
# For a non-root install, try something like this:
19+
#
20+
#INSTALLBIN=/home/blotwell/bin/asylum
21+
#INSTALLRESOURCEPATH=/home/blotwell/lib/asylum
22+
#INSTALLHISCORES=/home/blotwell/.asylum-hiscores
23+
#
24+
#INSTALLGROUP=foo
25+
#CHGRP=echo
26+
#CHMOD=echo
27+
ifeq ($(HOST),haiku)
28+
CC=i586-pc-haiku-gcc
29+
COPTS+=$(CPPFLAGS) -D_NO_SOUND
30+
INSTALLBIN=/boot/common/games/asylum/asylum
31+
INSTALLRESOURCEPATH=/boot/common/games/asylum/data
32+
INSTALLHISCORES=/boot/common/games/asylum/hiscores
33+
OS_SOURCE=asylum_haiku.c
34+
LIBS=-lSDL_mixer -lSDL -lbe -lroot -ldevice -lgame -lGL -ltextencoding -lmedia
35+
endif
36+
ifeq ($(HOST),mingw)
37+
INSTALLBIN="c:/program files/asylum/asylum.exe"
38+
INSTALLRESOURCEPATH="c:/program files/asylum/data"
39+
INSTALLHISCORES="c:/program files/asylum/hiscores"
40+
OS_SOURCE=asylum_win.c
41+
RM=del
42+
EXE=.exe
43+
LIBS=-lm -lmingw32 -lSDL_mixer -lSDLmain -lSDL -mwindows
44+
endif
45+
ifeq ($(HOST),generic)
46+
INSTALLBIN=/usr/games/asylum
47+
INSTALLRESOURCEPATH=/usr/share/games/asylum
48+
INSTALLHISCORES=/var/games/asylum
49+
endif
50+
51+
default: build
52+
53+
ifneq ($(HOST),mingw)
54+
$(INSTALLBIN): asylum$(EXE) Makefile
55+
cp asylum$(EXE) $(INSTALLBIN)
56+
$(CHGRP) $(INSTALLGROUP) $(INSTALLBIN)
57+
$(CHMOD) g+s $(INSTALLBIN)
58+
$(CHMOD) a+x $(INSTALLBIN)
59+
60+
install-resources: $(RESOURCES) Makefile
61+
mkdir -p $(INSTALLRESOURCEPATH)
62+
cp -r $(RESOURCES) $(INSTALLRESOURCEPATH)/
63+
$(CHGRP) -R $(INSTALLGROUP) $(INSTALLRESOURCEPATH)/
64+
$(CHMOD) -R a+rX $(INSTALLRESOURCEPATH)/
65+
66+
install-hiscores: Makefile
67+
mkdir -p $(INSTALLHISCORES)
68+
touch $(INSTALLHISCORES)/EgoHighScores
69+
touch $(INSTALLHISCORES)/PsycheHighScores
70+
touch $(INSTALLHISCORES)/IdHighScores
71+
touch $(INSTALLHISCORES)/ExtendedHighScores
72+
$(CHGRP) -R $(INSTALLGROUP) $(INSTALLHISCORES)/*
73+
$(CHMOD) -R 660 $(INSTALLHISCORES)/*
74+
75+
install-binary: $(INSTALLBIN)
76+
77+
install: install-resources install-hiscores install-binary
78+
79+
uninstall:
80+
rm -rf $(INSTALLBINARY) $(INSTALLRESOURCEPATH) $(INSTALLHISCORES)
81+
endif
82+
83+
oggs:
84+
bash -c 'pushd data; for i in */Music?; do pushd ..; ./asylum --dumpmusic $$i `if (echo \$$i|grep Resources.Music2>/dev/null); then echo -n --slower; fi`; \
85+
popd;\
86+
tail -c +33 $$i.au| \
87+
oggenc - --raw --raw-endianness=1 --raw-rate=22050 --artist="Andy Southgate" \
88+
--album="Background music for Asylum computer game" \
89+
>$$i.ogg;\
90+
rm $$i.au;\
91+
done; popd'
92+
93+
build: asylum$(EXE)
94+
95+
asylum$(EXE): $(SRCS) $(OS_SOURCE) asylum.h Makefile
96+
$(CC) $(COPTS) $(LDFLAGS) -o asylum$(EXE) $(SRCS) $(OS_SOURCE) $(LIBS)
97+
98+
clean:
99+
$(RM) asylum$(EXE)
100+

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# SDL Asylum
2+
3+
<i>Young Sigmund has a few problems. To help him resolve his mental instability you must enter the surreal world of his inner mind and shut down the malfunctioning brain cells which are causing him these problems.</i> — Instructions file from original game
4+
5+
SDL Asylum is a C port of the computer game Asylum, which was written by Andy Southgate in 1994 for the Acorn Archimedes and is now public domain. It should be possible to run it on any platform which support SDL and OpenGL graphics. It's developed primarily on Linux but has also been built successfully on Cygwin, FreeBSD, Windows and Haiku.
6+
7+
This fork contains bug fixes and Pandora specific functionality.
8+
9+
10+
##Instructions
11+
12+
<i>Well, you don't really need any instructions to play the game. Just remember, the object is to find things that look like brain cells and shut them down! Good luck!</i> — Instructions file from original game
13+
14+
The game revolves around shooting anything which moves, collecting anything which doesn't move, and, most importantly, finding your way to each of the eight pulsating neurons scattered through the immense map. Use ‘Z’, ‘X’, ‘;’ and ‘.’ to move and ‘Enter’ to fire, or remap the keys to something you like better.
15+
16+
The one game feature which does merit explicit instruction is teleporting. In the first level (“Ego”) the teleporters look like candelabra. To use a teleporter, stand in its centre and press “down” (that's ‘.’ with the default key settings).
17+
18+
19+
##Credits
20+
21+
SDL Asylum wouldn't have happened at all without Andy Southgate, who wrote the original game and later generously made it public domain. Nor without Jeffrey Lee and John Hoare, who got hold of Andy's original assembly source and hosted it on their marvellous Asylum tribute site at acornarcade.com.
22+
23+
SDL Asylum wouldn't be as good without the ports, packages and patches provided by: Dmitry Marakasov, Ian Chapman, James Woodcock, Peter De Wachter.
24+
25+
26+
##Licensing
27+
28+
SDL Asylum is distributed under GPL version 3. The original game music and graphics are © Andy Southgate 1993, and have been placed in the public domain by Andy Southgate.
29+
30+
31+
##Original Web site
32+
33+
http://sdl-asylum.sourceforge.net/

asylum.c

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717

1818
#include <SDL/SDL.h>
1919
#include <SDL/SDL_mixer.h>
20+
#if defined(PANDORA)
21+
#include <unistd.h>
22+
#endif
2023

2124
#include "asylum_os.h"
2225
#include "asylum.h"
@@ -245,7 +248,11 @@ void bonus1()
245248
}
246249

247250
const int keydefs[] =
251+
#if defined(PANDORA)
252+
{ -SDLK_LEFT, -SDLK_RIGHT, -SDLK_UP, -SDLK_DOWN, -SDLK_HOME };
253+
#else
248254
{ -SDLK_z, -SDLK_x, -SDLK_SEMICOLON, -SDLK_PERIOD, -SDLK_RETURN };
255+
#endif
249256

250257
void setdefaults()
251258
{
@@ -261,7 +268,11 @@ void setdefaults()
261268
options.firekey = keydefs[4];
262269
options.gearchange = (arm3 == 0) ? 0 : 1;
263270
options.explospeed = (arm3 == 0) ? 2 : 1;
271+
#if defined(PANDORA)
272+
options.fullscreen = 1;
273+
#else
264274
options.fullscreen = 0;
275+
#endif
265276
#ifndef DISABLE_OPENGL
266277
options.opengl = 1;
267278
options.size = 1; // 640 x 512
@@ -707,7 +718,9 @@ void loadconfig()
707718
case 4: options.firekey = -temp; break;
708719
case 5: options.soundtype = temp; break;
709720
//case 6: options.soundquality=temp; break;
721+
#if !defined(PANDORA)
710722
case 7: options.fullscreen = temp; break;
723+
#endif
711724
#ifndef DISABLE_OPENGL
712725
case 8: options.opengl = temp; break;
713726
case 9: options.size = temp; break;
@@ -740,7 +753,12 @@ void saveconfig()
740753
config_keywords[4], -options.firekey,
741754
config_keywords[5], options.soundtype,
742755
//config_keywords[6], options.soundquality,
743-
config_keywords[7], options.fullscreen,
756+
config_keywords[7],
757+
#if defined(PANDORA)
758+
1,
759+
#else
760+
options.fullscreen,
761+
#endif
744762
config_keywords[8],
745763
#ifndef DISABLE_OPENGL
746764
options.opengl,
@@ -767,6 +785,9 @@ void saveconfig()
767785
options.initials[2],
768786
((options.idpermit == 1) ? idpermitstring : ""));
769787
fclose(r0);
788+
#if defined(PANDORA)
789+
sync();
790+
#endif
770791
}
771792

772793
void loadgame()
@@ -822,6 +843,9 @@ void savegame()
822843
fwrite(neuronadr->contents, neuronadr->width, neuronadr->height, r0);
823844
}
824845
fclose(r0);
846+
#if defined(PANDORA)
847+
sync();
848+
#endif
825849
}
826850

827851
void permitid()
@@ -833,6 +857,9 @@ void permitid()
833857
{
834858
fprintf(r0, "%s", idpermitstring);
835859
fclose(r0);
860+
#if defined(PANDORA)
861+
sync();
862+
#endif
836863
}
837864
options.idpermit = 1;
838865
}

file.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,15 @@ FILE* find_game(int op)
4646
{
4747
char fullname[240] = "";
4848

49+
#if defined(PANDORA)
50+
strcpy(fullname, "..");
51+
#else
4952
char* home = getenv("HOME");
5053
if (home)
5154
strcat(fullname, home);
5255
else
5356
return NULL;
57+
#endif
5458
strcat(fullname, savegamename);
5559
switch (op)
5660
{
@@ -65,11 +69,15 @@ FILE* find_config(int op)
6569
{
6670
char fullname[240] = "";
6771

72+
#if defined(PANDORA)
73+
strcpy(fullname, "..");
74+
#else
6875
char* home = getenv("HOME");
6976
if (home)
7077
strcat(fullname, home);
7178
else
7279
strcat(fullname, resource_path);
80+
#endif
7381
strcat(fullname, configname);
7482
switch (op)
7583
{
@@ -326,6 +334,9 @@ int swi_osfile(int op, const char* name, char* start, char* end)
326334
f = fopen(name, "wb");
327335
for (char* i = start; i < end; i++) fputc(*i, f);
328336
fclose(f);
337+
#if defined(PANDORA)
338+
sync();
339+
#endif
329340
return 0;
330341
case 5: // test file existence
331342
f = fopen(name, "rb");

keyboard.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,13 @@ void update_keyboard()
109109
if (ke->keysym.unicode)
110110
unibuf = ke->keysym.unicode;
111111
else
112+
{
113+
#if defined(PANDORA)
114+
if (keybuf > 32 && keybuf <= 127) unibuf = keybuf;
115+
else
116+
#endif
112117
unibuf = -1;
118+
}
113119
break;
114120
case SDL_KEYUP:
115121
ke = (SDL_KeyboardEvent*)&e;
@@ -197,7 +203,7 @@ void keyread(key_state* ks)
197203
*/
198204
}
199205
nojoystick:
200-
if ((osbyte_81(options.leftkey) == 0xff) || !(r4&1))
206+
if ((osbyte_81(options.leftkey) == 0xff) || !(r4&1))
201207
{ if (++ks->leftpress == 0) ks->leftpress = 0xff;}
202208
else ks->leftpress = 0;
203209
if ((osbyte_81(options.rightkey) == 0xff) || !(r4&2))

menus.c

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,20 @@ void choosecontrol()
177177
wipetexttab();
178178
showchatscreen();
179179
message(96, 48, 0, 0, "Controls");
180+
#if defined(PANDORA)
181+
message(64, 96, 0, 0, "1. Set Keys");
182+
#else
180183
message(64, 96, 0, 0, "1. Keyboard");
181184
message(64, 128, 0, 0, "2. Joystick");
185+
#endif
182186
showtext();
183-
switch (readopt(2))
187+
switch (readopt(
188+
#if defined(PANDORA)
189+
1
190+
#else
191+
2
192+
#endif
193+
))
184194
{
185195
case-1: return;
186196
case 1: choosekeys(); return;
@@ -271,9 +281,15 @@ void tunegame()
271281
}
272282
}
273283

284+
#if defined(PANDORA)
285+
char sound1[] = "-1. No Sound";
286+
char sound2[] = "-2. Sound";
287+
char sound3[] = "-3. Sound";
288+
#else
274289
char sound1[] = "-1. No Sound";
275290
char sound2[] = "-2. 4 Channels";
276291
char sound3[] = "-3. 4 Channels";
292+
#endif
277293
char sound4[] = "-4. 8 Channels";
278294
char sound5[] = "-5. Normal Quality";
279295
char sound6[] = "-6. High Quality";
@@ -292,16 +308,24 @@ void tunesound()
292308
message(32, 80, 0, 0, sound2);
293309
message(32, 100, 0, 0, sound3);
294310
message(80, 120, 0, 0, "and music");
311+
#if !defined(PANDORA)
295312
message(32, 140, 0, 0, sound4);
296313
message(32, 160, 0, 0, sound5);
297314
message(32, 180, 0, 0, sound6);
298315
message(32, 200, 0, 0, sound7);
316+
#endif
299317
message(96, 220, 0, 0, "ESC - Exit");
300318
swi_blitz_wait(0);
301319
swi_fastspr_clearwindow();
302320
showtext();
303321

304-
switch (readopt(7))
322+
switch (readopt(
323+
#if defined(PANDORA)
324+
3
325+
#else
326+
7
327+
#endif
328+
))
305329
{
306330
case 1: options.soundtype = 0; break;
307331
case 2: options.soundtype = 1; break;
@@ -339,7 +363,9 @@ void tunevolume()
339363
message(48, 116, 0, 0, "2. Quieter effects");
340364
message(48, 136, 0, 0, "3. Louder music");
341365
message(48, 156, 0, 0, "4. Quieter music");
366+
#if !defined(PANDORA)
342367
message(48-14, 176, 0, 0, tunevol1);
368+
#endif
343369
message(96, 220, 0, 0, "ESC - Exit");
344370
do
345371
{
@@ -350,7 +376,13 @@ void tunevolume()
350376
swi_blitz_wait(0);
351377
swi_fastspr_clearwindow();
352378
showtext();
353-
int r0 = readopt(5);
379+
int r0 = readopt(
380+
#if defined(PANDORA)
381+
4
382+
#else
383+
5
384+
#endif
385+
);
354386
if (r0 == -1) return;
355387

356388
if (r0 == 1)

platform.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
#if defined(PANDORA)
2+
#define DISABLE_OPENGL
3+
#undef RESOURCEPATH
4+
#undef SCOREPATH
5+
#undef HAVE_GET_EXE_PATH
6+
#endif
7+
18
#define DISPLAY_HWDOUBLEBUF 0
29

310
#ifndef DISABLE_OPENGL

0 commit comments

Comments
 (0)