#include "app.h" unsigned short *EmuScreen=NULL; int EmuWidth=0,EmuHeight=0; static int EmuScan(unsigned int num, void *sdata); unsigned char *PicoDraw2FB = NULL; int EmuInit() { int len=0; PicoInit(); // Allocate screen: EmuWidth=320; EmuHeight=224; len=EmuWidth*EmuHeight; len<<=1; EmuScreen=(unsigned short *)malloc(len); if (EmuScreen==NULL) return 1; PicoDraw2FB=(unsigned char *)malloc((8+320)*(8+224+8)*2); memset(EmuScreen,0,len); PicoDrawSetColorFormat(1); PicoScan=EmuScan; return 0; } void EmuExit() { //RomFree(); free(EmuScreen); EmuScreen=NULL; // Deallocate screen free(PicoDraw2FB); EmuWidth=EmuHeight=0; PicoExit(); } // Megadrive scanline callback: static int EmuScan(unsigned int num, void *sdata) { unsigned short *pd=NULL,*end=NULL; unsigned short *ps=NULL; if (num>=(unsigned int)EmuHeight) return 0; // Copy scanline to screen buffer: pd=EmuScreen+(num<<8)+(num<<6); end=pd+320; ps=(unsigned short *)sdata; do { *pd++=*ps++; } while (pd=0) if (Inp.button[m]>30) input|=1<