Can Anyone Port This Small Bloody 2d Shooter?


Parkydr said:
It's statically linked so there should be on library dependencies
I don't think you should totally rule out the idea of it being Allegro. I've had similar reports of Stairway to Heaven not working on some GP2Xs (like nickspoon's) and that is written in Allegro. Those of you who get a black screen with this thing, try loading Stairway to Heaven and see if that gives a similar result: http://archive.gp2x.de/cgi-bin/cfiles.cgi?0,0,0,0,27,1972
 
Last edited by a moderator:
spoyser, who had the same problem with o2em_gp2x has PM'd me.

You need to do a dummy blit before initialising allegro.

New version with fix coming soon... :)
 
Last edited by a moderator:
What exactly is a dummy blit? People are having similiar issues with Snake on Some Planes, and if the dummy blit fixes things I'd like to try that out.
 
It just means you do a hardware blit operation to get it initialised.

I got the code from o2em_gp2x

Code:
         unsigned long                  gp2x_dev;
        static volatile unsigned long *gp2x_memregl;
        volatile unsigned short       *gp2x_memregs;

        int                         mmsp2_blit_base;
        static struct MAPPED_MEMORY mmsp2_blit;

	gp2x_dev     = open("/dev/mem",   O_RDWR); 
	gp2x_memregl = (unsigned long  *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, gp2x_dev, 0xc0000000);
	gp2x_memregs = (unsigned short *)gp2x_memregl;

	{
		//the following is to work around bug in allegro library which causes it to lock up
		//if HW blitter hasn't done anything since GP2X was switched on.

		gp2x_memregs[0x90a >> 1] = 0xffff; // Enable all video and sound devices
  		gp2x_memregs[0x904 >> 1] |= 1<<10; // Enable FASTIO for the hardware blitter

		#define MESGDSTCTRL      0x0000
		#define MESG_BSTBPP      0x60
		#define MESG_DSTBPP_16  (1<<5)
		#define MESG_DSTENB     (1<<6)
		#define MESGDSTADDR      0x0004
		#define MESGSRCCTRL      0x000c
		#define MESG_INVIDEO    (1<<8)
		#define MESGPATCTRL      0x0020
		#define MESGSIZE         0x002c
		#define MESG_HEIGHT      16
		#define MESGCTRL         0x0030
		#define MESG_XDIR_POS    (1<<8)
		#define MESG_YDIR_POS    (1<<9)
		#define MESG_FFCLR       (1<<10)
		#define MESGSTATUS       0x0034
		#define MESG_BUSY        (1<<0)

		#define mmsp2_blit_putl(addr,value) (*(unsigned long volatile *)(mmsp2_blit_base+(addr)) = (value))
		#define mmsp2_blit_getl(addr)       (*(unsigned long volatile *)(mmsp2_blit_base+(addr)))

		mmsp2_blit.base  = 0xe0020000;
		mmsp2_blit.size  = 0x100;
		mmsp2_blit.perms = PROT_READ|PROT_WRITE;
		mmsp2_blit.data  = mmap(0, 0x100, PROT_READ|PROT_WRITE, MAP_SHARED, gp2x_dev, 0xe0020000);
		
		if (mmsp2_blit.data == MAP_FAILED)
			exit(EXIT_FAILURE);

		mmsp2_blit_base = (int)mmsp2_blit.data;

		mmsp2_blit_putl (MESGDSTCTRL, MESG_DSTBPP_16 | MESG_DSTENB);
		mmsp2_blit_putl (MESGDSTADDR, 0x3101000);
		mmsp2_blit_putl (MESGSRCCTRL, MESG_INVIDEO);
		mmsp2_blit_putl (MESGPATCTRL, 0);
		mmsp2_blit_putl (MESGSIZE, (1 << MESG_HEIGHT) | 8);
		mmsp2_blit_putl (MESGCTRL, (MESG_XDIR_POS) | (MESG_YDIR_POS) | 0xaa | MESG_FFCLR);
		mmsp2_blit_putl (MESGSTATUS, 1);
		
		while (mmsp2_blit_getl(MESGSTATUS) & MESG_BUSY);

		munmap((void *)&mmsp2_blit_base, 0x100);
	}
 
Back
Top