minor game_def.cfg update
[picodrive.git] / platform / win32 / GenaDrive / Emu.cpp
CommitLineData
cc68a136 1\r
2#include "app.h"\r
3\r
cc68a136 4unsigned short *EmuScreen=NULL;\r
03a265e5 5int EmuWidth=320,EmuHeight=224;\r
1b0ac8ad 6RECT EmuScreenRect = { 0, 0, 320, 224 };\r
2cb51c3c 7int PicoPadAdd = 0;\r
1b0ac8ad 8\r
67c81ee2 9static int EmuScan(unsigned int num);\r
4b2b67eb 10unsigned char *PicoDraw2FB = NULL;\r
cc68a136 11\r
12int EmuInit()\r
13{\r
14 int len=0;\r
15\r
cc68a136 16 PicoInit();\r
17\r
18 // Allocate screen:\r
19 EmuWidth=320; EmuHeight=224;\r
20 len=EmuWidth*EmuHeight; len<<=1;\r
21 EmuScreen=(unsigned short *)malloc(len); if (EmuScreen==NULL) return 1;\r
8831ef19 22 PicoDraw2FB=(unsigned char *)malloc((8+320)*(8+224+8)*2);\r
cc68a136 23 memset(EmuScreen,0,len);\r
24\r
4b2b67eb 25 PicoDrawSetColorFormat(1);\r
67c81ee2 26 PicoScanBegin=EmuScan;\r
cc68a136 27\r
28 return 0;\r
29}\r
30\r
31void EmuExit()\r
32{\r
33 //RomFree();\r
34 free(EmuScreen); EmuScreen=NULL; // Deallocate screen\r
8831ef19 35 free(PicoDraw2FB);\r
cc68a136 36 EmuWidth=EmuHeight=0;\r
37\r
38 PicoExit();\r
39}\r
40\r
41// Megadrive scanline callback:\r
67c81ee2 42static int EmuScan(unsigned int num)\r
cc68a136 43{\r
67c81ee2 44 DrawLineDest=EmuScreen+(num<<8)+(num<<6);\r
cc68a136 45 \r
46 return 0;\r
47}\r
48\r
49int EmuFrame()\r
50{\r
51 char map[12]={0,1,2,3,8,9,10,4,11,12,13,14}; // Joypads, format is UDLR BCAS ZYXM\r
52 int a=0,input=0;\r
53 \r
54 // Set Megadrive buttons:\r
55 for (a=0;a<12;a++)\r
56 {\r
57 int m=map[a];\r
58 if (m>=0) if (Inp.button[m]>30) input|=1<<a;\r
59 }\r
60\r
61 PicoPad[0]=input;\r
2cb51c3c 62 PicoPad[0]|=PicoPadAdd;\r
cc68a136 63\r
03a265e5 64 PsndOut=(short *)DSoundNext;\r
65 PicoFrame();\r
1b0ac8ad 66 PsndOut=NULL;\r
cc68a136 67\r
4b2b67eb 68 return 0;\r
69}\r
cc68a136 70\r
cc68a136 71\r
4b2b67eb 72void mp3_update(int *buffer, int length, int stereo)\r
73{\r
74}\r
75\r
76void mp3_start_play(FILE *f, int pos)\r
77{\r
78}\r
79\r
80int mp3_get_bitrate(FILE *f, int size)\r
81{\r
82 return -1;\r
83}\r
84\r