+++ /dev/null
-\r
-#include "app.h"\r
-\r
-#ifndef _XBOX\r
-#pragma warning (disable:4201)\r
-#include <mmsystem.h>\r
-#include <dsound.h>\r
-#endif\r
-\r
-static IDirectSound *DSound=NULL;\r
-static IDirectSoundBuffer *LoopBuffer=NULL;\r
-static int LoopLen=0,LoopWrite=0; // Next position in loop to write\r
-\r
-short *DSoundNext=NULL; // Buffer for next sound data to put in loop\r
-\r
-static int LoopBlank()\r
-{\r
- void *mema=NULL,*memb=NULL;\r
- DWORD sizea=0,sizeb=0;\r
-\r
- LoopBuffer->Lock(0,LoopLen<<((PicoOpt&8) ? 2 : 1), &mema,&sizea, &memb,&sizeb, 0);\r
- \r
- if (mema) memset(mema,0,sizea);\r
-\r
- LoopBuffer->Unlock(mema,sizea, memb,sizeb);\r
-\r
- return 0;\r
-}\r
-\r
-int DSoundInit()\r
-{\r
- DSBUFFERDESC dsbd;\r
- WAVEFORMATEX wfx;\r
-\r
- memset(&dsbd,0,sizeof(dsbd));\r
- memset(&wfx,0,sizeof(wfx));\r
-\r
- // Make wave format:\r
- wfx.wFormatTag=WAVE_FORMAT_PCM;\r
- wfx.nChannels=(unsigned short)((PicoOpt&8) ? 2 : 1); // Stereo/mono\r
- wfx.nSamplesPerSec=PsndRate;\r
- wfx.wBitsPerSample=16;\r
-\r
- wfx.nBlockAlign=(WORD)((wfx.nChannels*wfx.wBitsPerSample)>>3);\r
- wfx.nAvgBytesPerSec=wfx.nBlockAlign*wfx.nSamplesPerSec;\r
-\r
- // Make buffer for the next seg to put into the loop:\r
- DSoundNext=(short *)malloc((PsndLen<<2)+64); if (DSoundNext==NULL) return 1;\r
- memset(DSoundNext,0,PsndLen<<2);\r
-// lprintf("p %p\n", DSoundNext);\r
-\r
- // Create the DirectSound interface:\r
- DirectSoundCreate(NULL,&DSound,NULL);\r
- if (DSound==NULL) return 1;\r
-\r
- LoopLen=PsndLen<<1; // 2 segs\r
-\r
-#ifndef _XBOX\r
- LoopLen<<=1; // 4 segs\r
- DSound->SetCooperativeLevel(FrameWnd,DSSCL_PRIORITY);\r
- dsbd.dwFlags=DSBCAPS_GLOBALFOCUS; // Play in background\r
-#endif\r
-\r
- // Create the looping buffer:\r
- dsbd.dwSize=sizeof(dsbd);\r
- dsbd.dwBufferBytes=LoopLen<<wfx.nChannels; // 16bit stereo?\r
- dsbd.lpwfxFormat=&wfx;\r
-\r
- DSound->CreateSoundBuffer(&dsbd,&LoopBuffer,NULL);\r
- if (LoopBuffer==NULL) return 1;\r
-\r
- LoopBlank();\r
- LoopBuffer->Play(0,0,DSBPLAY_LOOPING);\r
- return 0;\r
-}\r
-\r
-void DSoundExit()\r
-{\r
- if (LoopBuffer) LoopBuffer->Stop();\r
- RELEASE(LoopBuffer)\r
- RELEASE(DSound)\r
- DSound=0;\r
- if (DSoundNext) free(DSoundNext); DSoundNext=NULL;\r
-}\r
-\r
-static int WriteSeg()\r
-{\r
- void *mema=NULL,*memb=NULL;\r
- DWORD sizea=0,sizeb=0;\r
- int ret;\r
-\r
- // Lock the segment at 'LoopWrite' and copy the next segment in\r
- ret = LoopBuffer->Lock(LoopWrite<<((PicoOpt&8) ? 2 : 1),PsndLen<<((PicoOpt&8) ? 2 : 1), &mema,&sizea, &memb,&sizeb, 0);\r
- if (ret) lprintf("LoopBuffer->Lock() failed: %i\n", ret);\r
-\r
- if (mema) memcpy(mema,DSoundNext,sizea);\r
-// if (memb) memcpy(memb,DSoundNext+sizea,sizeb);\r
- if (sizeb != 0) lprintf("sizeb is not 0! (%i)\n", sizeb);\r
-\r
- ret = LoopBuffer->Unlock(mema,sizea, memb,0);\r
- if (ret) lprintf("LoopBuffer->Unlock() failed: %i\n", ret);\r
-\r
- return 0;\r
-}\r
-\r
-static int DSoundFake()\r
-{\r
- static int ticks_old = 0;\r
- int ticks = GetTickCount() * 1000;\r
- int diff;\r
-\r
- diff = ticks - ticks_old;\r
- if (diff >= 0 && diff < 1000000/60*4)\r
- {\r
- while (diff >= 0 && diff < 1000000/60)\r
- {\r
- Sleep(1);\r
- diff = GetTickCount()*1000 - ticks_old;\r
- }\r
- ticks_old += 1000000/60;\r
- }\r
- else\r
- ticks_old = ticks;\r
- return 0;\r
-}\r
-\r
-int DSoundUpdate()\r
-{\r
- DWORD play=0;\r
- int pos=0;\r
-\r
- if (LoopBuffer==NULL) return DSoundFake();\r
-\r
- LoopBuffer->GetCurrentPosition(&play,NULL);\r
- pos=play>>((PicoOpt&8) ? 2 : 1);\r
-\r
- // 'LoopWrite' is the next seg in the loop that we want to write\r
- // First check that the sound 'play' pointer has moved out of it:\r
- if (pos>=LoopWrite && pos<LoopWrite+PsndLen) return 1; // No, it hasn't\r
-\r
- WriteSeg();\r
-\r
- // Advance LoopWrite to next seg:\r
- LoopWrite+=PsndLen; if (LoopWrite+PsndLen>LoopLen) LoopWrite=0;\r
-\r
- return 0;\r
-}\r
-\r
+++ /dev/null
-#include "app.h"\r
-\r
-#ifdef USE_D3D\r
-// d3d\r
-static IDirect3D8 *Direct3D=NULL;\r
-IDirect3DDevice8 *Device=NULL;\r
-IDirect3DSurface8 *DirectBack=NULL; // Back Buffer\r
-\r
-static IDirect3DVertexBuffer8 *VertexBuffer=NULL;\r
-\r
-struct CustomVertex\r
-{\r
- float x,y,z; // Vertex cordinates\r
- unsigned int colour;\r
- float u,v; // Texture coordinates\r
-};\r
-#define D3DFVF_CUSTOMVERTEX (D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX1)\r
-\r
-static CustomVertex VertexList[4];\r
-#endif\r
-\r
-// ddraw\r
-#include <ddraw.h>\r
-\r
-LPDIRECTDRAW7 m_pDD = NULL;\r
-LPDIRECTDRAWSURFACE7 m_pddsFrontBuffer = NULL;\r
-LPDIRECTDRAWSURFACE7 m_pddsBackBuffer = NULL;\r
-\r
-// quick and dirty stuff..\r
-static void DirectExitDDraw()\r
-{\r
- RELEASE(m_pddsBackBuffer);\r
- RELEASE(m_pddsFrontBuffer);\r
- RELEASE(m_pDD);\r
-}\r
-\r
-static int DirectDrawInit()\r
-{\r
- HRESULT ret;\r
- LPDIRECTDRAWCLIPPER pcClipper = NULL;\r
- DDSURFACEDESC2 ddsd;\r
-\r
- ret = DirectDrawCreateEx(NULL, (VOID**)&m_pDD, IID_IDirectDraw7, NULL);\r
- if (ret) { LOGFAIL(); return 1; }\r
-\r
- // Set cooperative level\r
- ret = m_pDD->SetCooperativeLevel( FrameWnd, DDSCL_NORMAL );\r
- if (ret) { LOGFAIL(); goto fail; }\r
-\r
- // Create the primary surface\r
- ZeroMemory( &ddsd, sizeof( ddsd ) );\r
- ddsd.dwSize = sizeof( ddsd );\r
- ddsd.dwFlags = DDSD_CAPS;\r
- ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;\r
-\r
- ret = m_pDD->CreateSurface( &ddsd, &m_pddsFrontBuffer, NULL );\r
- if (ret) { LOGFAIL(); goto fail; }\r
-\r
- // Create the backbuffer surface\r
- ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;\r
- ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY;\r
- ddsd.dwWidth = EmuWidth;\r
- ddsd.dwHeight = EmuHeight;\r
-\r
- ret = m_pDD->CreateSurface( &ddsd, &m_pddsBackBuffer, NULL );\r
- if (ret) { LOGFAIL(); goto fail; }\r
-\r
- // clipper\r
- ret = m_pDD->CreateClipper( 0, &pcClipper, NULL );\r
- if (ret) { LOGFAIL(); goto fail; }\r
-\r
- ret = pcClipper->SetHWnd( 0, FrameWnd );\r
- if (ret) { LOGFAIL(); goto fail; }\r
-\r
- ret = m_pddsFrontBuffer->SetClipper( pcClipper );\r
- if (ret) { LOGFAIL(); goto fail; }\r
-\r
- RELEASE(pcClipper);\r
- return 0;\r
-\r
-fail:\r
- RELEASE(pcClipper);\r
- DirectExitDDraw();\r
- return 1;\r
-}\r
-\r
-static int DirectScreenDDraw()\r
-{\r
- DDSURFACEDESC2 sd;\r
- unsigned short *ps=EmuScreen;\r
- int ret, x, y;\r
-\r
- memset(&sd, 0, sizeof(sd));\r
- sd.dwSize = sizeof(sd);\r
- ret = m_pddsBackBuffer->Lock(NULL, &sd, DDLOCK_SURFACEMEMORYPTR|DDLOCK_WAIT|DDLOCK_WRITEONLY, NULL);\r
- if (ret) { LOGFAIL(); return 1; }\r
-\r
- //lprintf("w: %i h: %i pi: %i pf: %i\n", sd.dwWidth, sd.dwHeight, sd.lPitch, sd.ddpfPixelFormat.dwRGBBitCount);\r
-\r
- if (sd.ddpfPixelFormat.dwRGBBitCount == 32)\r
- {\r
- int *dst = (int *)sd.lpSurface;\r
- for (y = 0; y < EmuHeight; y++)\r
- {\r
- for (x = 0; x < EmuWidth; x++)\r
- {\r
- int s = *ps++;\r
- dst[x] = ((s&0xf800)<<8) | ((s&0x07e0)<<5) | ((s&0x001f)<<3);\r
- }\r
- dst = (int *)((char *)dst + sd.lPitch);\r
- }\r
- }\r
- else if (sd.ddpfPixelFormat.dwRGBBitCount == 24) /* wine uses this for me */\r
- {\r
- void *dst = sd.lpSurface;\r
- for (y = 0; y < EmuHeight; y++)\r
- {\r
- unsigned char *dst1 = (unsigned char *) dst;\r
- for (x = 0; x < EmuWidth; x++, dst1 += 3)\r
- {\r
- int s = *ps++;\r
- dst1[2] = (s&0xf800)>>8; dst1[1] = (s&0x07e0)>>3; dst1[0] = s<<3; // BGR\r
- }\r
- dst = (void *)((char *)dst + sd.lPitch);\r
- }\r
- }\r
- else if (sd.ddpfPixelFormat.dwRGBBitCount == 16)\r
- {\r
- unsigned short *dst = (unsigned short *)sd.lpSurface;\r
- for (y = 0; y < EmuHeight; y++)\r
- {\r
- memcpy(dst, ps, EmuWidth*2);\r
- ps += EmuWidth;\r
- dst = (unsigned short *)((char *)dst + sd.lPitch);\r
- }\r
- }\r
- else\r
- {\r
- LOGFAIL();\r
- }\r
-\r
- ret = m_pddsBackBuffer->Unlock(NULL);\r
- if (ret) { LOGFAIL(); return 1; }\r
- return 0;\r
-}\r
-\r
-static int DirectClearDDraw(unsigned int colour)\r
-{\r
- int ret;\r
- DDBLTFX ddbltfx;\r
- ZeroMemory( &ddbltfx, sizeof(ddbltfx) );\r
- ddbltfx.dwSize = sizeof(ddbltfx);\r
- ddbltfx.dwFillColor = colour;\r
-\r
- if (m_pddsBackBuffer != NULL)\r
- ret = m_pddsBackBuffer->Blt( NULL, NULL, NULL, DDBLT_COLORFILL, &ddbltfx );\r
- if (ret) { LOGFAIL(); return 1; }\r
- return 0;\r
-}\r
-\r
-static int DirectPresentDDraw()\r
-{\r
- int ret = 0;\r
- if (FrameRectMy.right - FrameRectMy.left > 0 && FrameRectMy.bottom - FrameRectMy.top > 0)\r
- ret = m_pddsFrontBuffer->Blt(&FrameRectMy, m_pddsBackBuffer, &EmuScreenRect, DDBLT_WAIT, NULL);\r
- if (ret) { LOGFAIL(); return 1; }\r
- return 0;\r
-}\r
-\r
-\r
-/* D3D */\r
-\r
-int DirectInit()\r
-{\r
-#if USE_D3D\r
- D3DPRESENT_PARAMETERS d3dpp;\r
- D3DDISPLAYMODE mode;\r
- int i,u,ret=0;\r
-\r
- memset(&d3dpp,0,sizeof(d3dpp));\r
- memset(&mode,0,sizeof(mode));\r
-\r
- Direct3D=Direct3DCreate8(D3D_SDK_VERSION); if (Direct3D==NULL) return 1;\r
-\r
- // Set up the structure used to create the D3D device:\r
- d3dpp.BackBufferWidth =MainWidth;\r
- d3dpp.BackBufferHeight=MainHeight;\r
- d3dpp.BackBufferCount =1;\r
- d3dpp.SwapEffect=D3DSWAPEFFECT_DISCARD;\r
- d3dpp.MultiSampleType =D3DMULTISAMPLE_NONE;\r
-\r
-#ifdef _XBOX\r
- d3dpp.BackBufferFormat=D3DFMT_X8R8G8B8;\r
- d3dpp.FullScreen_RefreshRateInHz=60;\r
-#else\r
- Direct3D->GetAdapterDisplayMode(D3DADAPTER_DEFAULT,&mode);\r
- d3dpp.BackBufferFormat=mode.Format;\r
- d3dpp.Windowed=1;\r
- d3dpp.hDeviceWindow=FrameWnd;\r
-#endif\r
-\r
- // Try to create a device with hardware vertex processing:\r
- for (i=0;i<3;i++)\r
- {\r
- int behave=D3DCREATE_HARDWARE_VERTEXPROCESSING;\r
-\r
- // Try software vertex processing:\r
- if (i==1) behave=D3DCREATE_MIXED_VERTEXPROCESSING;\r
- if (i==2) behave=D3DCREATE_SOFTWARE_VERTEXPROCESSING;\r
-\r
- Direct3D->CreateDevice(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL,FrameWnd,\r
- behave|D3DCREATE_MULTITHREADED,&d3dpp,&Device);\r
- if (Device) break;\r
- }\r
-\r
- if (Device==NULL)\r
- {\r
-#if 0\r
- // try ref\r
- Direct3D->CreateDevice(D3DADAPTER_DEFAULT,D3DDEVTYPE_REF,FrameWnd,\r
- D3DCREATE_SOFTWARE_VERTEXPROCESSING|D3DCREATE_MULTITHREADED,&d3dpp,&Device);\r
- if (Device==NULL) goto fail0;\r
- HMODULE test = LoadLibrary("d3d8d.dll");\r
- if (test != NULL) FreeLibrary(test);\r
- else {\r
- error("Sorry, but this program requires Direct3D with hardware acceleration.\n\n"\r
- "You can try using Direct3D software emulation, but you have to install "\r
- "DirectX SDK for it to work\n(it seems to be missing now).");\r
- goto fail1;\r
- }\r
-#else\r
- goto fail1;\r
-#endif\r
- }\r
-\r
- Device->GetBackBuffer(0,D3DBACKBUFFER_TYPE_MONO,&DirectBack);\r
- if (DirectBack==NULL) goto fail1;\r
-\r
- Device->CreateVertexBuffer(sizeof(VertexList),0,D3DFVF_CUSTOMVERTEX,D3DPOOL_DEFAULT,&VertexBuffer);\r
- if (VertexBuffer==NULL) goto fail2;\r
-\r
- ret=TexScreenInit(); if (ret) goto fail3;\r
-\r
- //FontInit();\r
-\r
- Device->SetRenderState(D3DRS_LIGHTING,0); // Turn off lighting\r
-\r
- // Set up texture modes:\r
- Device->SetTextureStageState(0,D3DTSS_ADDRESSU,D3DTADDRESS_CLAMP);\r
- Device->SetTextureStageState(0,D3DTSS_ADDRESSV,D3DTADDRESS_CLAMP);\r
-\r
- return 0;\r
-\r
-fail3:\r
- RELEASE(VertexBuffer)\r
-fail2:\r
- RELEASE(DirectBack)\r
-fail1:\r
- RELEASE(Device)\r
-fail0:\r
- RELEASE(Direct3D)\r
-\r
- // error("Failed to use Direct3D, trying DirectDraw..");\r
-#endif\r
- // try DirectDraw\r
- return DirectDrawInit();\r
-}\r
-\r
-void DirectExit()\r
-{\r
-#ifdef USE_D3D\r
- TexScreenExit();\r
-\r
- // d3d\r
- RELEASE(VertexBuffer)\r
- RELEASE(DirectBack)\r
- RELEASE(Device)\r
- RELEASE(Direct3D)\r
-#endif\r
- DirectExitDDraw();\r
-}\r
-\r
-int DirectClear(unsigned int colour)\r
-{\r
-#ifdef USE_D3D\r
- if (Device != NULL) {\r
- Device->Clear(0,NULL,D3DCLEAR_TARGET,colour,1.0f,0);\r
- return 0;\r
- }\r
-#endif\r
-\r
- return DirectClearDDraw(colour);\r
-}\r
-\r
-int DirectPresent()\r
-{\r
-#ifdef USE_D3D\r
- if (Device != NULL) {\r
- Device->Present(NULL,NULL,NULL,NULL);\r
- return 0;\r
- }\r
-#endif\r
-\r
- return DirectPresentDDraw();\r
-}\r
-\r
-#ifdef USE_D3D\r
-#define PI 3.14159265f\r
-\r
-static int MakeVertexList()\r
-{\r
- struct CustomVertex *vert=NULL,*pv=NULL;\r
- float dist=0.0f;\r
- float scalex=0.0f,scaley=0.0f;\r
- unsigned int colour=0xffffff;\r
- float right=0.0f,bottom=0.0f;\r
-\r
- if (LoopMode!=8) colour=0x102040;\r
-\r
- dist=10.0f; scalex=dist*1.3333f; scaley=dist;\r
-\r
- scalex*=640.0f/(float)MainWidth;\r
- scaley*=448.0f/(float)MainHeight;\r
-\r
- vert=VertexList;\r
-\r
- // Put the vertices for the corners of the screen:\r
- pv=vert;\r
- pv->z=dist;\r
- pv->x=-scalex; pv->y=scaley;\r
- pv->colour=colour; pv++;\r
-\r
- *pv=vert[0]; pv->x= scalex; pv->y= scaley; pv++;\r
- *pv=vert[0]; pv->x=-scalex; pv->y=-scaley; pv++;\r
- *pv=vert[0]; pv->x= scalex; pv->y=-scaley; pv++;\r
-\r
- // Find where the screen images ends on the texture\r
- right =(float)EmuWidth /(float)TexWidth;\r
- bottom=(float)EmuHeight/(float)TexHeight;\r
-\r
- // Write texture coordinates:\r
- pv=vert;\r
- pv->u=0.0f; pv->v=0.00f; pv++;\r
- pv->u=right; pv->v=0.00f; pv++;\r
- pv->u=0.0f; pv->v=bottom; pv++;\r
- pv->u=right; pv->v=bottom; pv++;\r
-\r
- return 0;\r
-}\r
-\r
-static int SetupMatrices()\r
-{\r
- D3DXVECTOR3 eye ( 0.0f, 0.0f, 0.0f );\r
- D3DXVECTOR3 look( 0.0f, 0.0f, 0.0f );\r
- D3DXVECTOR3 up ( 0.0f, 1.0f, 0.0f );\r
- D3DXMATRIX mat;\r
- float nudgex=0.0f,nudgey=0.0f;\r
-\r
- memset(&mat,0,sizeof(mat));\r
-\r
- mat.m[0][0]=mat.m[1][1]=mat.m[2][2]=mat.m[3][3]=1.0f;\r
- Device->SetTransform(D3DTS_WORLD,&mat);\r
-\r
- look.x=(float)Inp.axis[2]/2457.6f;\r
- look.y=(float)Inp.axis[3]/2457.6f;\r
- look.z=10.0f;\r
-\r
- // Nudge pixels to the centre of each screen pixel:\r
- nudgex=13.3333f/(float)(MainWidth <<1);\r
- nudgey=10.0000f/(float)(MainHeight<<1);\r
- eye.x +=nudgex; eye.y +=nudgey;\r
- look.x+=nudgex; look.y+=nudgey;\r
-\r
- D3DXMatrixLookAtLH(&mat,&eye,&look,&up);\r
- Device->SetTransform(D3DTS_VIEW,&mat);\r
-\r
- D3DXMatrixPerspectiveFovLH(&mat, 0.5f*PI, 1.3333f, 0.2f, 1000.0f);\r
- Device->SetTransform(D3DTS_PROJECTION,&mat);\r
- return 0;\r
-}\r
-\r
-int DirectScreen()\r
-{\r
- unsigned char *lock=NULL;\r
- int ret;\r
-\r
- if (Device == NULL)\r
- return DirectScreenDDraw();\r
-\r
- // Copy the screen to the screen texture:\r
-#ifdef _XBOX\r
- TexScreenSwizzle();\r
-#else\r
- ret=TexScreenLinear();\r
- if (ret) lprintf("TexScreenLinear failed\n");\r
-#endif\r
-\r
- SetupMatrices();\r
-\r
- MakeVertexList();\r
-\r
- // Copy vertices in:\r
- VertexBuffer->Lock(0,sizeof(VertexList),&lock,0);\r
- if (lock==NULL) { lprintf("VertexBuffer->Lock failed\n"); return 1; }\r
- memcpy(lock,VertexList,sizeof(VertexList));\r
- VertexBuffer->Unlock();\r
-\r
- Device->BeginScene();\r
- Device->SetTexture(0,TexScreen);\r
- Device->SetStreamSource(0,VertexBuffer,sizeof(CustomVertex));\r
- Device->SetVertexShader(D3DFVF_CUSTOMVERTEX);\r
- Device->DrawPrimitive(D3DPT_TRIANGLESTRIP,0,2);\r
- Device->EndScene();\r
-\r
- return 0;\r
-}\r
-#else\r
-int DirectScreen()\r
-{\r
- return DirectScreenDDraw();\r
-}\r
-#endif\r
-\r
+++ /dev/null
-\r
-#include "app.h"\r
-\r
-unsigned short *EmuScreen=NULL;\r
-int EmuWidth=320,EmuHeight=224;\r
-RECT EmuScreenRect = { 0, 0, 320, 224 };\r
-int PicoPadAdd = 0;\r
-\r
-static int EmuScan(unsigned int num);\r
-unsigned char *PicoDraw2FB = NULL;\r
-\r
-int EmuInit()\r
-{\r
- int len=0;\r
-\r
- PicoInit();\r
-\r
- // Allocate screen:\r
- EmuWidth=320; EmuHeight=224;\r
- len=EmuWidth*EmuHeight; len<<=1;\r
- EmuScreen=(unsigned short *)malloc(len); if (EmuScreen==NULL) return 1;\r
- PicoDraw2FB=(unsigned char *)malloc((8+320)*(8+224+8)*2);\r
- memset(EmuScreen,0,len);\r
-\r
- PicoDrawSetColorFormat(1);\r
- PicoScanBegin=EmuScan;\r
-\r
- return 0;\r
-}\r
-\r
-void EmuExit()\r
-{\r
- //RomFree();\r
- free(EmuScreen); EmuScreen=NULL; // Deallocate screen\r
- free(PicoDraw2FB);\r
- EmuWidth=EmuHeight=0;\r
-\r
- PicoExit();\r
-}\r
-\r
-// Megadrive scanline callback:\r
-static int EmuScan(unsigned int num)\r
-{\r
- DrawLineDest=EmuScreen+(num<<8)+(num<<6);\r
- \r
- return 0;\r
-}\r
-\r
-int EmuFrame()\r
-{\r
- char map[12]={0,1,2,3,8,9,10,4,11,12,13,14}; // Joypads, format is UDLR BCAS ZYXM\r
- int a=0,input=0;\r
- \r
- // Set Megadrive buttons:\r
- for (a=0;a<12;a++)\r
- {\r
- int m=map[a];\r
- if (m>=0) if (Inp.button[m]>30) input|=1<<a;\r
- }\r
-\r
- PicoPad[0]=input;\r
- PicoPad[0]|=PicoPadAdd;\r
-\r
- PsndOut=(short *)DSoundNext;\r
- PicoFrame();\r
- PsndOut=NULL;\r
-\r
- return 0;\r
-}\r
-\r
-\r
-void mp3_update(int *buffer, int length, int stereo)\r
-{\r
-}\r
-\r
-void mp3_start_play(FILE *f, int pos)\r
-{\r
-}\r
-\r
-int mp3_get_bitrate(FILE *f, int size)\r
-{\r
- return -1;\r
-}\r
-\r
+++ /dev/null
-\r
-#include "app.h"\r
-#include <commdlg.h>\r
-\r
-struct Input Inp;\r
-\r
-// --------------------- XBox Input -----------------------------\r
-#ifdef _XBOX\r
-static HANDLE GamePad=NULL;\r
-static XINPUT_STATE Pad;\r
-\r
-static int DeadZone(short *paxis)\r
-{\r
- int zone=0x2000;\r
- int a=*paxis;\r
-\r
- if (a<-zone) a+=zone;\r
- else if (a> zone) a-=zone; else a=0;\r
-\r
- *paxis=(short)a;\r
- return 0;\r
-}\r
-\r
-static int DeviceRead()\r
-{\r
- int but=0,a=0;\r
-\r
- memset(Inp.axis, 0,sizeof(Inp.axis));\r
- memset(Inp.button,0,sizeof(Inp.button));\r
-\r
- if (GamePad==NULL) GamePad=XInputOpen(XDEVICE_TYPE_GAMEPAD,0,XDEVICE_NO_SLOT,NULL);\r
- if (GamePad==NULL) return 1;\r
-\r
- // Read XBox joypad:\r
- XInputGetState(GamePad,&Pad);\r
-\r
- // Get analog axes:\r
- Inp.axis[0]=Pad.Gamepad.sThumbLX;\r
- Inp.axis[1]=Pad.Gamepad.sThumbLY;\r
- Inp.axis[2]=Pad.Gamepad.sThumbRX;\r
- Inp.axis[3]=Pad.Gamepad.sThumbRY;\r
-\r
- for (a=0;a<4;a++) DeadZone(Inp.axis+a);\r
-\r
- // Get digital buttons:\r
- but=Pad.Gamepad.wButtons;\r
- for (a=0;a<8;a++)\r
- {\r
- if (but&(1<<a)) Inp.button[a]=0xff;\r
- }\r
-\r
- // Get analog buttons:\r
- memcpy(Inp.button+8, Pad.Gamepad.bAnalogButtons, 8);\r
-\r
- return 0;\r
-}\r
-\r
-#endif\r
-\r
-// --------------------- Windows Input -----------------------------\r
-\r
-#ifndef _XBOX\r
-\r
-static int DeviceRead()\r
-{\r
- int push=0x6000;\r
- int axis[]={0,0,0,0};\r
- int i=0;\r
-\r
- memset(Inp.axis, 0,sizeof(Inp.axis));\r
- memset(Inp.button,0,sizeof(Inp.button));\r
-\r
- if (GetForegroundWindow()!=FrameWnd) return 1;\r
-\r
- if (GetAsyncKeyState(VK_LEFT )) axis[0]-=push;\r
- if (GetAsyncKeyState(VK_RIGHT)) axis[0]+=push;\r
- if (GetAsyncKeyState(VK_DOWN )) axis[1]-=push;\r
- if (GetAsyncKeyState(VK_UP )) axis[1]+=push;\r
- for (i=0;i<4;i++) Inp.axis[i]=(short)axis[i];\r
-\r
- if (GetAsyncKeyState(VK_RETURN)) Inp.button[4]=0xff; // Start\r
- //if (GetAsyncKeyState(VK_ESCAPE)) Inp.button[7]=0xff; // Right thumb\r
-\r
- if (GetAsyncKeyState('Z')) Inp.button[10]=0xff;\r
- if (GetAsyncKeyState('X')) Inp.button[ 8]=0xff;\r
- if (GetAsyncKeyState('C')) Inp.button[ 9]=0xff;\r
-\r
- if (GetAsyncKeyState('A')) Inp.button[13]=0xff;\r
- if (GetAsyncKeyState('S')) Inp.button[12]=0xff;\r
- if (GetAsyncKeyState('D')) Inp.button[11]=0xff;\r
- if (GetAsyncKeyState('F')) Inp.button[14]=0xff;\r
-\r
- static int sblobked = 0;\r
- if (!sblobked && GetAsyncKeyState(VK_TAB)) {\r
- PicoReset();\r
- sblobked = 1;\r
- }\r
- else if (!sblobked && GetAsyncKeyState(VK_ESCAPE))\r
- {\r
- PostMessage(FrameWnd, WM_COMMAND, 0x20000 | 1000, 0);\r
- sblobked = 1;\r
- }\r
- else\r
- sblobked = GetAsyncKeyState(VK_TAB) | GetAsyncKeyState(VK_ESCAPE);\r
- \r
- return 0;\r
-}\r
-\r
-#endif\r
-\r
-int InputInit()\r
-{\r
- memset(&Inp,0,sizeof(Inp));\r
-#ifdef _XBOX\r
- memset(&Pad,0,sizeof(Pad));\r
- XInitDevices(0,NULL);\r
-#endif\r
- return 0;\r
-}\r
-\r
-void InputExit()\r
-{\r
-#ifdef _XBOX\r
- if (GamePad) XInputClose(GamePad);\r
- GamePad=NULL;\r
-#endif\r
-}\r
-\r
-int InputUpdate()\r
-{\r
- int i=0;\r
- int push=0x2000;\r
-\r
- DeviceRead(); // Read XBox or PC device \r
-\r
- // Use left analog for left digital too:\r
- if (Inp.axis[1]>= push) Inp.button[0]|=0xff; // Up\r
- if (Inp.axis[1]<=-push) Inp.button[1]|=0xff; // Down\r
- if (Inp.axis[0]<=-push) Inp.button[2]|=0xff; // Left\r
- if (Inp.axis[0]>= push) Inp.button[3]|=0xff; // Right\r
-\r
- // Update debounce/time held information:\r
- for (i=0;i<sizeof(Inp.held);i++)\r
- {\r
- if (Inp.held[i]==0)\r
- {\r
- if (Inp.button[i]>30) Inp.held[i]=1; // Just pressed\r
- }\r
- else\r
- {\r
- // Is the button still being held down?\r
- Inp.held[i]++;\r
- if (Inp.held[i]>=0x80) Inp.held[i]&=0xbf; // (Keep looping around)\r
-\r
- if (Inp.button[i]<25) Inp.held[i]=0; // No\r
- }\r
- }\r
-\r
- // Work out some key repeat values:\r
- for (i=0;i<sizeof(Inp.repeat);i++)\r
- {\r
- char rep=0;\r
- int held=Inp.held[i];\r
-\r
- if (held==1) rep=1;\r
- if (held>=0x20 && (held&1)) rep=1;\r
-\r
- Inp.repeat[i]=rep;\r
- }\r
-\r
- return 0;\r
-}\r
-\r
-// Set Lightgun calibration values:\r
-int InputLightCal(int cx,int cy,int ux,int uy)\r
-{\r
-#ifdef _XBOX\r
- XINPUT_LIGHTGUN_CALIBRATION_OFFSETS cal;\r
-\r
- memset(&cal,0,sizeof(cal));\r
-\r
- cal.wCenterX =(WORD)cx;\r
- cal.wCenterY =(WORD)cy;\r
- cal.wUpperLeftX=(WORD)ux;\r
- cal.wUpperLeftY=(WORD)uy;\r
- XInputSetLightgunCalibration(GamePad,&cal);\r
-\r
-#endif\r
-\r
- (void)(cx+cy+ux+uy);\r
-\r
- return 0;\r
-}\r
+++ /dev/null
-#include "app.h"\r
-//#include "FileMenu.h"\r
-\r
-char LoopQuit=0,LoopWait=0,LoopWaiting=0;\r
-static FILE *DebugFile=NULL;\r
-int LoopMode=0;\r
-static void UpdateSound(int len);\r
-\r
-int LoopInit()\r
-{\r
- int ret=0;\r
-\r
- // bits LSb->MSb:\r
- // enable_ym2612&dac, enable_sn76496, enable_z80, stereo_sound;\r
- // alt_renderer, 6button_gamepad, accurate_timing, accurate_sprites\r
- PicoOpt=0xbccf;\r
- PsndRate=44100;\r
-\r
- // Init Direct3D:\r
- ret=DirectInit(); if (ret) { error("DirectX video init failed"); return 1; }\r
- InputInit();\r
-\r
- // Init DirectSound:\r
- //DSoundInit();\r
-\r
- ret=EmuInit(); if (ret) return 1;\r
-\r
- LoopMode=8;\r
- PicoWriteSound = UpdateSound;\r
- PicoAutoRgnOrder = 0x184;\r
-\r
- return 0;\r
-}\r
-\r
-extern "C" char *debugString();\r
-\r
-void LoopExit()\r
-{\r
- dprintf(debugString());\r
-\r
- EmuExit();\r
- InputExit();\r
- DirectExit();\r
-\r
- if (DebugFile) fclose(DebugFile);\r
- DebugFile=NULL;\r
-}\r
-\r
-// ----------------------------------------------------------------\r
-\r
-static void UpdateSound(int len)\r
-{\r
- while (DSoundUpdate() > 0) { Sleep(1); }\r
- //while (DSoundUpdate()== 0) { }\r
-}\r
-\r
-static void PostProcess()\r
-{\r
- static int lock_to_1_1_prev = 0, is_40_prev = -1;\r
- int is_40;\r
- PicoGetInternal(PI_IS40_CELL, (pint_ret_t *)&is_40);\r
- if (lock_to_1_1)\r
- {\r
- if (is_40 != is_40_prev || !lock_to_1_1_prev)\r
- PostMessage(FrameWnd, WM_COMMAND, 0x20000 | (is_40 ? 1100 : 1101), 0);\r
- }\r
- if (is_40 != is_40_prev)\r
- {\r
- EmuScreenRect.left = is_40 ? 0 : 32;\r
- EmuScreenRect.right = is_40 ? 320 : 256+32;\r
- }\r
- lock_to_1_1_prev = lock_to_1_1;\r
- is_40_prev = is_40;\r
-}\r
-\r
-int LoopCode()\r
-{\r
-\r
- // Main loop:\r
- while (!LoopQuit)\r
- {\r
- if (LoopWait)\r
- {\r
- DSoundExit();\r
- while (!LoopQuit && LoopWait) { LoopWaiting=1; Sleep(100); }\r
- if (LoopQuit) break;\r
- DSoundInit();\r
- }\r
- InputUpdate();\r
-\r
- DirectClear(0);\r
- EmuFrame();\r
- PostProcess();\r
- DirectScreen();\r
- DirectPresent();\r
-// UpdateSound();\r
- }\r
- DSoundExit();\r
-\r
- return 0;\r
-}\r
-\r
-// -------------------------------------------------------------------------------------\r
-\r
-#if 0\r
-extern "C" int dprintf(char *format, ...)\r
-{\r
- char *name=NULL;\r
- va_list val=NULL;\r
-\r
-#ifdef _XBOX\r
- name="d:\\zout.txt";\r
-#else\r
- name="zout.txt";\r
-#endif\r
-\r
- if (DebugFile==NULL) DebugFile=fopen(name,"wt");\r
- if (DebugFile==NULL) return 1;\r
-\r
- fprintf(DebugFile, "%05i: ", emu_frame);\r
- va_start(val,format);\r
- vfprintf(DebugFile,format,val);\r
- fprintf(DebugFile, "\n");\r
- fflush(DebugFile);\r
-\r
- va_end(val);\r
- return 0;\r
-}\r
-#endif\r
-\r
-extern "C" int lprintf(char *format, ...)\r
-{\r
- char str[512];\r
- va_list val=NULL;\r
-\r
- va_start(val,format);\r
- vsprintf(str,format,val);\r
- va_end(val);\r
- OutputDebugString(str);\r
-\r
- return 0;\r
-}\r
-\r
+++ /dev/null
-#include "app.h"\r
-#include "version.h"\r
-#include <crtdbg.h>\r
-#include <commdlg.h>\r
-#include "../../common/readpng.h"\r
-#include "../../common/config.h"\r
-\r
-char *romname=NULL;\r
-HWND FrameWnd=NULL;\r
-RECT FrameRectMy;\r
-int lock_to_1_1 = 1;\r
-static HWND PicoSwWnd=NULL, PicoPadWnd=NULL;\r
-\r
-int MainWidth=720,MainHeight=480;\r
-\r
-static HMENU mmain = 0, mdisplay = 0, mpicohw = 0;\r
-static int rom_loaded = 0;\r
-static HBITMAP ppad_bmp = 0;\r
-static HBITMAP ppage_bmps[7] = { 0, };\r
-static char rom_name[0x20*3+1];\r
-static int main_wnd_as_pad = 0;\r
-\r
-static void UpdateRect()\r
-{\r
- WINDOWINFO wi;\r
- memset(&wi, 0, sizeof(wi));\r
- wi.cbSize = sizeof(wi);\r
- GetWindowInfo(FrameWnd, &wi);\r
- FrameRectMy = wi.rcClient;\r
-}\r
-\r
-static int extract_rom_name(char *dest, const unsigned char *src, int len)\r
-{\r
- char *p = dest, s_old = 0x20;\r
- int i;\r
-\r
- for (i = len - 1; i >= 0; i--)\r
- {\r
- if (src[i^1] != ' ') break;\r
- }\r
- len = i + 1;\r
-\r
- for (i = 0; i < len; i++)\r
- {\r
- unsigned char s = src[i^1];\r
- if (s == 0x20 && s_old == 0x20) continue;\r
- else if (s >= 0x20 && s < 0x7f && s != '%')\r
- {\r
- *p++ = s;\r
- }\r
- else\r
- {\r
- sprintf(p, "%%%02x", s);\r
- p += 3;\r
- }\r
- s_old = s;\r
- }\r
- *p = 0;\r
-\r
- return p - dest;\r
-}\r
-\r
-static void check_name_alias(const char *afname)\r
-{\r
- char buff[256], *var, *val;\r
- FILE *f;\r
- int ret;\r
-\r
- f = fopen(afname, "r");\r
- if (f == NULL) return;\r
-\r
- while (1)\r
- {\r
- ret = config_get_var_val(f, buff, sizeof(buff), &var, &val);\r
- if (ret == 0) break;\r
- if (ret == -1) continue;\r
-\r
- if (strcmp(rom_name, var) == 0) {\r
- lprintf("rom aliased: \"%s\" -> \"%s\"\n", rom_name, val);\r
- strncpy(rom_name, val, sizeof(rom_name));\r
- break;\r
- }\r
- }\r
- fclose(f);\r
-}\r
-\r
-static HBITMAP png2hb(const char *fname, int is_480)\r
-{\r
- BITMAPINFOHEADER bih;\r
- HBITMAP bmp;\r
- void *bmem;\r
- int ret;\r
-\r
- bmem = calloc(1, is_480 ? 480*240*3 : 320*240*3);\r
- if (bmem == NULL) return NULL;\r
- ret = readpng(bmem, fname, is_480 ? READPNG_480_24 : READPNG_320_24);\r
- if (ret != 0) {\r
- free(bmem);\r
- return NULL;\r
- }\r
-\r
- memset(&bih, 0, sizeof(bih));\r
- bih.biSize = sizeof(bih);\r
- bih.biWidth = is_480 ? 480 : 320;\r
- bih.biHeight = -240;\r
- bih.biPlanes = 1;\r
- bih.biBitCount = 24;\r
- bih.biCompression = BI_RGB;\r
- bmp = CreateDIBitmap(GetDC(FrameWnd), &bih, CBM_INIT, bmem, (BITMAPINFO *)&bih, 0);\r
- if (bmp == NULL)\r
- lprintf("CreateDIBitmap failed with %i", GetLastError());\r
-\r
- free(bmem);\r
- return bmp;\r
-}\r
-\r
-static void PrepareForROM(void)\r
-{\r
- unsigned char *rom_data = NULL;\r
- int i, ret, show = PicoAHW & PAHW_PICO;\r
- \r
- PicoGetInternal(PI_ROM, (pint_ret_t *) &rom_data);\r
- EnableMenuItem(mmain, 2, MF_BYPOSITION|(show ? MF_ENABLED : MF_GRAYED));\r
- ShowWindow(PicoPadWnd, show ? SW_SHOWNA : SW_HIDE);\r
- ShowWindow(PicoSwWnd, show ? SW_SHOWNA : SW_HIDE);\r
- CheckMenuItem(mpicohw, 1210, show ? MF_CHECKED : MF_UNCHECKED);\r
- CheckMenuItem(mpicohw, 1211, show ? MF_CHECKED : MF_UNCHECKED);\r
- PostMessage(FrameWnd, WM_COMMAND, 1220 + PicoPicohw.page, 0);\r
- DrawMenuBar(FrameWnd);\r
- InvalidateRect(PicoSwWnd, NULL, 1);\r
-\r
- PicoPicohw.pen_pos[0] =\r
- PicoPicohw.pen_pos[1] = 0x8000;\r
- PicoPadAdd = 0;\r
-\r
- ret = extract_rom_name(rom_name, rom_data + 0x150, 0x20);\r
- if (ret == 0)\r
- extract_rom_name(rom_name, rom_data + 0x130, 0x20);\r
-\r
- if (show)\r
- {\r
- char path[MAX_PATH], *p;\r
- GetModuleFileName(NULL, path, sizeof(path) - 32);\r
- p = strrchr(path, '\\');\r
- if (p == NULL) p = path;\r
- else p++;\r
- if (ppad_bmp == NULL) {\r
- strcpy(p, "pico\\pad.png");\r
- ppad_bmp = png2hb(path, 0);\r
- }\r
-\r
- strcpy(p, "pico\\alias.txt");\r
- check_name_alias(path);\r
-\r
- for (i = 0; i < 7; i++) {\r
- if (ppage_bmps[i] != NULL) DeleteObject(ppage_bmps[i]);\r
- sprintf(p, "pico\\%s_%i.png", rom_name, i);\r
- ppage_bmps[i] = png2hb(path, 1);\r
- }\r
- // games usually don't have page 6, so just duplicate page 5.\r
- if (ppage_bmps[6] == NULL && ppage_bmps[5] != NULL) {\r
- sprintf(p, "pico\\%s_5.png", rom_name);\r
- ppage_bmps[6] = png2hb(path, 1);\r
- }\r
- }\r
-}\r
-\r
-static void LoadROM(const char *cmdpath)\r
-{\r
- static char rompath[MAX_PATH] = { 0, };\r
- unsigned char *rom_data_new = NULL;\r
- unsigned int rom_size = 0;\r
- pm_file *rom = NULL;\r
- int oldwait=LoopWait;\r
- int i, ret;\r
-\r
- if (cmdpath) {\r
- strcpy(rompath, cmdpath + (cmdpath[0] == '\"' ? 1 : 0));\r
- if (rompath[strlen(rompath)-1] == '\"') rompath[strlen(rompath)-1] = 0;\r
- if (strlen(rompath) > 4) rom = pm_open(rompath);\r
- }\r
-\r
- if (!rom) {\r
- OPENFILENAME of; ZeroMemory(&of, sizeof(OPENFILENAME));\r
- of.lStructSize = sizeof(OPENFILENAME);\r
- of.lpstrFilter = "ROMs\0*.smd;*.bin;*.gen;*.zip\0";\r
- of.lpstrFile = rompath; rompath[0] = 0;\r
- of.nMaxFile = MAX_PATH;\r
- of.Flags = OFN_FILEMUSTEXIST|OFN_HIDEREADONLY;\r
- of.hwndOwner = FrameWnd;\r
- if (!GetOpenFileName(&of)) return;\r
- rom = pm_open(rompath);\r
- if (!rom) { error("failed to open ROM"); return; }\r
- }\r
-\r
- ret=PicoCartLoad(rom, &rom_data_new, &rom_size);\r
- pm_close(rom);\r
- if (ret) {\r
- error("failed to load ROM");\r
- return;\r
- }\r
-\r
- // halt the work thread..\r
- // just a hack, should've used proper sync. primitives here, but who will use this emu anyway..\r
- LoopWaiting=0;\r
- LoopWait=1;\r
- for (i = 0; LoopWaiting == 0 && i < 10; i++) Sleep(100);\r
-\r
- PicoCartUnload();\r
- PicoCartInsert(rom_data_new, rom_size);\r
-\r
- PrepareForROM();\r
-\r
- rom_loaded = 1;\r
- romname = rompath;\r
- LoopWait=0;\r
-}\r
-\r
-static int rect_widths[4] = { 320, 256, 640, 512 };\r
-static int rect_heights[4] = { 224, 224, 448, 448 };\r
-\r
-// Window proc for the frame window:\r
-static LRESULT CALLBACK WndProc(HWND hwnd,UINT msg,WPARAM wparam,LPARAM lparam)\r
-{\r
- POINT pt;\r
- RECT rc;\r
- int i;\r
- switch (msg)\r
- {\r
- case WM_CLOSE: PostQuitMessage(0); return 0;\r
- case WM_DESTROY: FrameWnd=NULL; break; // Blank handle\r
- case WM_SIZE:\r
- case WM_MOVE:\r
- case WM_SIZING: UpdateRect(); break;\r
- case WM_COMMAND:\r
- switch (LOWORD(wparam))\r
- {\r
- case 1000: LoadROM(NULL); break;\r
- case 1001: PicoReset(); return 0;\r
- case 1002: PostQuitMessage(0); return 0;\r
- case 1100:\r
- case 1101:\r
- case 1102:\r
- case 1103:\r
- LoopWait=1; // another sync hack\r
- for (i = 0; !LoopWaiting && i < 10; i++) Sleep(10);\r
- FrameRectMy.right = FrameRectMy.left + rect_widths[wparam&3];\r
- FrameRectMy.bottom = FrameRectMy.top + rect_heights[wparam&3];\r
- AdjustWindowRect(&FrameRectMy, WS_OVERLAPPEDWINDOW, 1);\r
- MoveWindow(hwnd, FrameRectMy.left, FrameRectMy.top,\r
- FrameRectMy.right-FrameRectMy.left, FrameRectMy.bottom-FrameRectMy.top, 1);\r
- UpdateRect();\r
- if (HIWORD(wparam) == 0) { // locally sent\r
- lock_to_1_1=0;\r
- CheckMenuItem(mdisplay, 1104, MF_UNCHECKED);\r
- }\r
- if (rom_loaded) LoopWait=0;\r
- return 0;\r
- case 1104:\r
- lock_to_1_1=!lock_to_1_1;\r
- CheckMenuItem(mdisplay, 1104, lock_to_1_1 ? MF_CHECKED : MF_UNCHECKED);\r
- return 0;\r
- case 1210:\r
- case 1211:\r
- i = IsWindowVisible((LOWORD(wparam)&1) ? PicoPadWnd : PicoSwWnd);\r
- i = !i;\r
- ShowWindow((LOWORD(wparam)&1) ? PicoPadWnd : PicoSwWnd, i ? SW_SHOWNA : SW_HIDE);\r
- CheckMenuItem(mpicohw, LOWORD(wparam), i ? MF_CHECKED : MF_UNCHECKED);\r
- return 0;\r
- case 1212:\r
- main_wnd_as_pad = !main_wnd_as_pad;\r
- CheckMenuItem(mpicohw, 1212, main_wnd_as_pad ? MF_CHECKED : MF_UNCHECKED);\r
- return 0;\r
- case 1220:\r
- case 1221:\r
- case 1222:\r
- case 1223:\r
- case 1224:\r
- case 1225:\r
- case 1226:\r
- PicoPicohw.page = LOWORD(wparam) % 10;\r
- for (i = 0; i < 7; i++)\r
- CheckMenuItem(mpicohw, 1220 + i, MF_UNCHECKED);\r
- CheckMenuItem(mpicohw, 1220 + PicoPicohw.page, MF_CHECKED);\r
- InvalidateRect(PicoSwWnd, NULL, 1);\r
- return 0;\r
- case 1300:\r
- MessageBox(FrameWnd, "PicoDrive v" VERSION " (c) notaz, 2006-2008\n"\r
- "SVP and Pico demo edition\n\n"\r
- "Credits:\n"\r
- "fDave: base code of PicoDrive, GenaDrive (the frontend)\n"\r
- "Chui: Fame/C\n"\r
- "NJ: CZ80\n"\r
- "MAME devs: YM2612 and SN76496 cores\n"\r
- "Stéphane Dallongeville: Gens code, base of Fame/C (C68K), CZ80\n"\r
- "Tasco Deluxe: SVP RE work\n"\r
- "Pierpaolo Prazzoli: info about SSP16 chips\n",\r
- "About", 0);\r
- return 0;\r
- }\r
- break;\r
- case WM_TIMER:\r
- GetCursorPos(&pt);\r
- GetWindowRect(PicoSwWnd, &rc);\r
- if (PtInRect(&rc, pt)) break;\r
- GetWindowRect(PicoPadWnd, &rc);\r
- if (PtInRect(&rc, pt)) break;\r
- PicoPicohw.pen_pos[0] |= 0x8000;\r
- PicoPicohw.pen_pos[1] |= 0x8000;\r
- PicoPadAdd = 0;\r
- break;\r
- case WM_LBUTTONDOWN: PicoPadAdd |= 0x20; return 0;\r
- case WM_LBUTTONUP: PicoPadAdd &= ~0x20; return 0;\r
- case WM_MOUSEMOVE:\r
- if (!main_wnd_as_pad) break;\r
- PicoPicohw.pen_pos[0] = 0x03c + (320 * LOWORD(lparam) / (FrameRectMy.right - FrameRectMy.left));\r
- PicoPicohw.pen_pos[1] = 0x1fc + (232 * HIWORD(lparam) / (FrameRectMy.bottom - FrameRectMy.top));\r
- SetTimer(FrameWnd, 100, 1000, NULL);\r
- break;\r
- }\r
-\r
- return DefWindowProc(hwnd,msg,wparam,lparam);\r
-}\r
-\r
-static void key_down(WPARAM key)\r
-{\r
- switch (key) {\r
- case VK_LEFT: PicoPadAdd |= 4; break;\r
- case VK_RIGHT: PicoPadAdd |= 8; break;\r
- case VK_UP: PicoPadAdd |= 1; break;\r
- case VK_DOWN: PicoPadAdd |= 2; break;\r
- case 'X': PicoPadAdd |= 0x10; break;\r
- }\r
-}\r
-\r
-static void key_up(WPARAM key)\r
-{\r
- switch (key) {\r
- case VK_LEFT: PicoPadAdd &= ~0x04; break;\r
- case VK_RIGHT: PicoPadAdd &= ~0x08; break;\r
- case VK_UP: PicoPadAdd &= ~0x01; break;\r
- case VK_DOWN: PicoPadAdd &= ~0x02; break;\r
- case 'X': PicoPadAdd &= ~0x10; break;\r
- }\r
-}\r
-\r
-static LRESULT CALLBACK PicoSwWndProc(HWND hwnd,UINT msg,WPARAM wparam,LPARAM lparam)\r
-{\r
- PAINTSTRUCT ps;\r
- HDC hdc, hdc2;\r
-\r
- switch (msg)\r
- {\r
- case WM_DESTROY: PicoSwWnd=NULL; break;\r
- case WM_LBUTTONDOWN: PicoPadAdd |= 0x20; return 0;\r
- case WM_LBUTTONUP: PicoPadAdd &= ~0x20; return 0;\r
- case WM_MOUSEMOVE:\r
- if (HIWORD(lparam) < 0x20) break;\r
- PicoPicohw.pen_pos[0] = 0x03c + LOWORD(lparam) * 2/3;\r
- PicoPicohw.pen_pos[1] = 0x2f8 + HIWORD(lparam) - 0x20;\r
- SetTimer(FrameWnd, 100, 1000, NULL);\r
- break;\r
- case WM_KEYDOWN: key_down(wparam); break;\r
- case WM_KEYUP: key_up(wparam); break;\r
- case WM_PAINT:\r
- hdc = BeginPaint(hwnd, &ps);\r
- if (ppage_bmps[PicoPicohw.page] == NULL)\r
- {\r
- SelectObject(hdc, GetStockObject(DEFAULT_GUI_FONT));\r
- SetTextColor(hdc, RGB(255, 255, 255));\r
- SetBkColor(hdc, RGB(0, 0, 0));\r
- TextOut(hdc, 2, 2, "missing PNGs for", 16);\r
- TextOut(hdc, 2, 18, rom_name, strlen(rom_name));\r
- }\r
- else\r
- {\r
- hdc2 = CreateCompatibleDC(GetDC(FrameWnd));\r
- SelectObject(hdc2, ppage_bmps[PicoPicohw.page]);\r
- BitBlt(hdc, 0, 0, 480, 240, hdc2, 0, 0, SRCCOPY);\r
- DeleteDC(hdc2);\r
- }\r
- EndPaint(hwnd, &ps);\r
- return 0;\r
- }\r
-\r
- return DefWindowProc(hwnd,msg,wparam,lparam);\r
-}\r
-\r
-static LRESULT CALLBACK PicoPadWndProc(HWND hwnd,UINT msg,WPARAM wparam,LPARAM lparam)\r
-{\r
- PAINTSTRUCT ps;\r
- HDC hdc, hdc2;\r
-\r
- switch (msg)\r
- {\r
- case WM_DESTROY: PicoPadWnd=NULL; break;\r
- case WM_LBUTTONDOWN: PicoPadAdd |= 0x20; return 0;\r
- case WM_LBUTTONUP: PicoPadAdd &= ~0x20; return 0;\r
- case WM_MOUSEMOVE:\r
- PicoPicohw.pen_pos[0] = 0x03c + LOWORD(lparam);\r
- PicoPicohw.pen_pos[1] = 0x1fc + HIWORD(lparam);\r
- SetTimer(FrameWnd, 100, 1000, NULL);\r
- break;\r
- case WM_KEYDOWN: key_down(wparam); break;\r
- case WM_KEYUP: key_up(wparam); break;\r
- case WM_PAINT:\r
- if (ppad_bmp == NULL) break;\r
- hdc = BeginPaint(hwnd, &ps);\r
- hdc2 = CreateCompatibleDC(GetDC(FrameWnd));\r
- SelectObject(hdc2, ppad_bmp);\r
- BitBlt(hdc, 0, 0, 320, 240, hdc2, 0, 0, SRCCOPY);\r
- EndPaint(hwnd, &ps);\r
- DeleteDC(hdc2);\r
- return 0;\r
- }\r
-\r
- return DefWindowProc(hwnd,msg,wparam,lparam);\r
-}\r
-\r
-\r
-static int FrameInit()\r
-{\r
- WNDCLASS wc;\r
- RECT rect={0,0,0,0};\r
- HMENU mfile;\r
- int style=0;\r
- int left=0,top=0,width=0,height=0;\r
-\r
- memset(&wc,0,sizeof(wc));\r
-\r
- // Register the window class:\r
- wc.lpfnWndProc=WndProc;\r
- wc.hInstance=GetModuleHandle(NULL);\r
- wc.hCursor=LoadCursor(NULL,IDC_ARROW);\r
- wc.hbrBackground=CreateSolidBrush(0);\r
- wc.lpszClassName="PicoMainFrame";\r
- RegisterClass(&wc);\r
-\r
- wc.lpszClassName="PicoSwWnd";\r
- wc.lpfnWndProc=PicoSwWndProc;\r
- RegisterClass(&wc);\r
-\r
- wc.lpszClassName="PicoPadWnd";\r
- wc.lpfnWndProc=PicoPadWndProc;\r
- RegisterClass(&wc);\r
-\r
- rect.right =320;//MainWidth;\r
- rect.bottom=224;//MainHeight;\r
-\r
- // Adjust size of windows based on borders:\r
- style=WS_OVERLAPPEDWINDOW;\r
- AdjustWindowRect(&rect,style,1);\r
- width =rect.right-rect.left;\r
- height=rect.bottom-rect.top;\r
-\r
- // Place window in the centre of the screen:\r
- SystemParametersInfo(SPI_GETWORKAREA,0,&rect,0);\r
- left=rect.left+rect.right;\r
- top=rect.top+rect.bottom;\r
-\r
- left-=width; left>>=1;\r
- top-=height; top>>=1;\r
-\r
- // Create menu:\r
- mfile = CreateMenu();\r
- InsertMenu(mfile, -1, MF_BYPOSITION|MF_STRING, 1000, "&Load ROM");\r
- InsertMenu(mfile, -1, MF_BYPOSITION|MF_STRING, 1001, "&Reset");\r
- InsertMenu(mfile, -1, MF_BYPOSITION|MF_STRING, 1002, "E&xit");\r
- mdisplay = CreateMenu();\r
- InsertMenu(mdisplay, -1, MF_BYPOSITION|MF_STRING, 1100, "320x224");\r
- InsertMenu(mdisplay, -1, MF_BYPOSITION|MF_STRING, 1101, "256x224");\r
- InsertMenu(mdisplay, -1, MF_BYPOSITION|MF_STRING, 1102, "640x448");\r
- InsertMenu(mdisplay, -1, MF_BYPOSITION|MF_STRING, 1103, "512x448");\r
- InsertMenu(mdisplay, -1, MF_BYPOSITION|MF_STRING, 1104, "Lock to 1:1");\r
- mpicohw = CreateMenu();\r
- InsertMenu(mpicohw, -1, MF_BYPOSITION|MF_STRING, 1210, "Show &Storyware");\r
- InsertMenu(mpicohw, -1, MF_BYPOSITION|MF_STRING, 1211, "Show &Drawing pad");\r
- InsertMenu(mpicohw, -1, MF_BYPOSITION|MF_STRING, 1212, "&Main window as pad");\r
- InsertMenu(mpicohw, -1, MF_BYPOSITION|MF_SEPARATOR, 0, NULL);\r
- InsertMenu(mpicohw, -1, MF_BYPOSITION|MF_STRING, 1220, "Title page (&0)");\r
- InsertMenu(mpicohw, -1, MF_BYPOSITION|MF_STRING, 1221, "Page &1");\r
- InsertMenu(mpicohw, -1, MF_BYPOSITION|MF_STRING, 1222, "Page &2");\r
- InsertMenu(mpicohw, -1, MF_BYPOSITION|MF_STRING, 1223, "Page &3");\r
- InsertMenu(mpicohw, -1, MF_BYPOSITION|MF_STRING, 1224, "Page &4");\r
- InsertMenu(mpicohw, -1, MF_BYPOSITION|MF_STRING, 1225, "Page &5");\r
- InsertMenu(mpicohw, -1, MF_BYPOSITION|MF_STRING, 1226, "Page &6");\r
- mmain = CreateMenu();\r
- InsertMenu(mmain, -1, MF_BYPOSITION|MF_STRING|MF_POPUP, (UINT_PTR) mfile, "&File");\r
- InsertMenu(mmain, -1, MF_BYPOSITION|MF_STRING|MF_POPUP, (UINT_PTR) mdisplay, "&Display");\r
- InsertMenu(mmain, -1, MF_BYPOSITION|MF_STRING|MF_POPUP, (UINT_PTR) mpicohw, "&Pico");\r
- EnableMenuItem(mmain, 2, MF_BYPOSITION|MF_GRAYED);\r
-// InsertMenu(mmain, -1, MF_BYPOSITION|MF_STRING|MF_POPUP, 1200, "&Config");\r
- InsertMenu(mmain, -1, MF_BYPOSITION|MF_STRING, 1300, "&About");\r
-\r
- // Create the window:\r
- FrameWnd=CreateWindow("PicoMainFrame","PicoDrive " VERSION,style|WS_VISIBLE,\r
- left,top,width,height,NULL,mmain,NULL,NULL);\r
-\r
- CheckMenuItem(mdisplay, 1104, lock_to_1_1 ? MF_CHECKED : MF_UNCHECKED);\r
- ShowWindow(FrameWnd, SW_NORMAL);\r
- UpdateWindow(FrameWnd);\r
- UpdateRect();\r
-\r
- // create Pico windows\r
- style = WS_OVERLAPPED|WS_CAPTION|WS_BORDER;\r
- rect.left=rect.top=0;\r
- rect.right =320;\r
- rect.bottom=224;\r
-\r
- AdjustWindowRect(&rect,style,1);\r
- width =rect.right-rect.left;\r
- height=rect.bottom-rect.top;\r
-\r
- left += 326;\r
- PicoSwWnd=CreateWindow("PicoSwWnd","Storyware",style,\r
- left,top,width+160,height,FrameWnd,NULL,NULL,NULL);\r
-\r
- top += 266;\r
- PicoPadWnd=CreateWindow("PicoPadWnd","Drawing Pad",style,\r
- left,top,width,height,FrameWnd,NULL,NULL,NULL);\r
-\r
- return 0;\r
-}\r
-\r
-// --------------------\r
-\r
-static DWORD WINAPI ThreadCode(void *)\r
-{\r
- LoopCode();\r
- return 0;\r
-}\r
-\r
-int WINAPI WinMain(HINSTANCE,HINSTANCE,LPSTR cmdline,int)\r
-{\r
- MSG msg;\r
- int ret=0;\r
- DWORD tid=0;\r
- HANDLE thread=NULL;\r
-\r
- FrameInit();\r
- ret=LoopInit(); if (ret) goto end0;\r
-\r
- // Make another thread to run LoopCode():\r
- LoopQuit=0;\r
- LoopWait=1; // wait for ROM to be loaded\r
- thread=CreateThread(NULL,0,ThreadCode,NULL,0,&tid);\r
-\r
- LoadROM(cmdline);\r
-\r
- // Main window loop:\r
- for (;;)\r
- {\r
- GetMessage(&msg,NULL,0,0);\r
- if (msg.message==WM_QUIT) break;\r
-\r
- TranslateMessage(&msg);\r
- DispatchMessage(&msg);\r
- }\r
-\r
- // Signal thread to quit and wait for it to exit:\r
- LoopQuit=1; WaitForSingleObject(thread,5000);\r
- CloseHandle(thread); thread=NULL;\r
-\r
-end0:\r
- LoopExit();\r
- DestroyWindow(FrameWnd);\r
-\r
- _CrtDumpMemoryLeaks();\r
- return 0;\r
-}\r
-\r
-extern void error(char *text)\r
-{\r
- MessageBox(FrameWnd, text, "Error", 0);\r
-}\r
-\r
+++ /dev/null
-# Makefile for MS Visual C\r
-\r
-R=..\..\..\ \r
-\r
-CFLAGS=/nologo /W2 /O2 /D "_CRT_SECURE_NO_WARNINGS" -I. -I$(R) -I$(R)zlib\\r
-\r
-LDFLAGS=/nologo /machine:I386 /opt:nowin98 /out:PicoDrive.exe\r
-\r
-CFLAGS=$(CFLAGS) /DEMU_F68K\r
-\r
-CFLAGS=$(CFLAGS) /D_USE_CZ80\r
-\r
-# debug\r
-#CFLAGS=$(CFLAGS) /Gi\r
-\r
-#LDFLAGS=$(LDFLAGS) /DEBUG\r
-\r
-# emu\r
-OBJ = Emu.obj Input.obj Main.obj Direct.obj DSound.obj Loop.obj\r
-\r
-# TexScreen.obj\r
-\r
-# common\r
-#OBJS += platform\common\emu.obj platform\common\menu.obj platform\common\fonts.obj \r
-# platform\common\mp3_helix.obj\r
-OBJ = $(OBJ) $(R)platform\common\readpng.obj $(R)platform\common\config.obj\r
-\r
-# Pico\r
-OBJ = $(OBJ) $(R)Pico\Area.obj $(R)Pico\Cart.obj $(R)Pico\Memory.obj $(R)Pico\Misc.obj $(R)Pico\Pico.obj $(R)Pico\Sek.obj \\r
- $(R)Pico\VideoPort.obj $(R)Pico\Draw2.obj $(R)Pico\Draw.obj $(R)Pico\Patch.obj\r
-# Pico - CD\r
-OBJ = $(OBJ) $(R)Pico\cd\Pico.obj $(R)Pico\cd\Memory.obj $(R)Pico\cd\Sek.obj $(R)Pico\cd\LC89510.obj \\r
- $(R)Pico\cd\cd_sys.obj $(R)Pico\cd\cd_file.obj $(R)Pico\cd\gfx_cd.obj \\r
- $(R)Pico\cd\Area.obj $(R)Pico\cd\Misc.obj $(R)Pico\cd\pcm.obj $(R)Pico\cd\buffering.obj \\r
- $(R)Pico\cd\cue.obj\r
-# Pico - Pico\r
-OBJ = $(OBJ) $(R)Pico\Pico\Pico.obj $(R)Pico\Pico\Memory.obj $(R)Pico\Pico\xpcm.obj\r
-# Pico - sound\r
-OBJ = $(OBJ) $(R)Pico\sound\sound.obj $(R)Pico\sound\sn76496.obj $(R)Pico\sound\ym2612.obj $(R)Pico\sound\mix.obj\r
-# Pico - carthw\r
-OBJ = $(OBJ) $(R)Pico\carthw\carthw.obj $(R)Pico\carthw\svp\svp.obj $(R)Pico\carthw\svp\Memory.obj \\r
- $(R)Pico\carthw\svp\ssp16.obj $(R)Pico\carthw\svp\compiler.obj\r
-# zlib\r
-OBJ = $(OBJ) $(R)zlib\gzio.obj $(R)zlib\inffast.obj $(R)zlib\inflate.obj $(R)zlib\inftrees.obj $(R)zlib\trees.obj \\r
- $(R)zlib\deflate.obj $(R)zlib\crc32.obj $(R)zlib\adler32.obj $(R)zlib\zutil.obj $(R)zlib\compress.obj $(R)zlib\uncompr.obj\r
-# unzip\r
-OBJ = $(OBJ) $(R)unzip\unzip.obj $(R)unzip\unzip_stream.obj\r
-# CPU cores\r
-OBJ = $(OBJ) $(R)cpu\fame\famec.obj\r
-# z80\r
-OBJ = $(OBJ) $(R)cpu\cz80\cz80.obj\r
-\r
-\r
-.c.obj:\r
- cl $(CFLAGS) /c $< /Fo$@\r
-\r
-.cpp.obj:\r
- cl $(CFLAGS) /c $< /Fo$@\r
-\r
-\r
-ALL : PicoDrive.exe\r
-\r
-PicoDrive.exe : $(OBJ)\r
- link.exe $(LDFLAGS) $(OBJ) libpng.lib gdi32.lib user32.lib advapi32.lib dsound.lib comdlg32.lib ddraw.lib dxguid.lib\r
-\r
-# d3d8.lib d3dx8.lib \r
-\r
-clean:\r
- -del $(OBJ) PicoDrive.exe\r
-\r
-\r
-test.exe : test.cpp\r
- cl $(CFLAGS) test.cpp user32.lib d3dx8.lib d3d8.lib\r
-\r
-dxtut1.exe : dxtut1.cpp\r
- cl $(CFLAGS) dxtut1.cpp user32.lib d3d8.lib\r
-\r
-# d3dx8.lib\r
-\r
+++ /dev/null
-\r
-#include "app.h"\r
-\r
-IDirect3DTexture8 *TexScreen=NULL;\r
-int TexWidth=0,TexHeight=0;\r
-\r
-// Blank the texture:\r
-static int TexBlank()\r
-{\r
- D3DLOCKED_RECT lock={0,NULL};\r
- unsigned char *dest=NULL;\r
- int y=0,line=0;\r
-\r
- TexScreen->LockRect(0,&lock,NULL,0); if (lock.pBits==NULL) return 1;\r
-\r
- dest=(unsigned char *)lock.pBits;\r
- for (y=0; y<TexHeight; y++,line+=lock.Pitch)\r
- {\r
- memset(dest+line,0,TexWidth<<1);\r
- }\r
-\r
- TexScreen->UnlockRect(0);\r
- return 0;\r
-}\r
-\r
-int TexScreenInit()\r
-{\r
- TexWidth =512;\r
- TexHeight=512;\r
-\r
- Device->CreateTexture(TexWidth,TexHeight,1,0,D3DFMT_R5G6B5,D3DPOOL_MANAGED,&TexScreen);\r
- if (TexScreen==NULL) return 1;\r
-\r
- TexBlank();\r
- return 0;\r
-}\r
-\r
-void TexScreenExit()\r
-{\r
- RELEASE(TexScreen)\r
- TexWidth=TexHeight=0;\r
-}\r
-\r
-// Copy screen to a swizzled texture\r
-int TexScreenSwizzle()\r
-{\r
- D3DLOCKED_RECT lock={0,NULL};\r
- unsigned char *dest=NULL;\r
- int y=0,sy=0,mask=0;\r
- unsigned short *ps=NULL;\r
-\r
- mask=TexWidth*TexHeight-1;\r
-\r
- TexScreen->LockRect(0,&lock,NULL,0); if (lock.pBits==NULL) return 1;\r
-\r
- dest=(unsigned char *)lock.pBits;\r
- ps=EmuScreen;\r
-\r
- // Write to swizzled locations:\r
- for (y=0,sy=0; y<EmuHeight; y++,sy++)\r
- {\r
- int x=0,sx=0;\r
- sy|=0x55555555;\r
-\r
- for (x=0,sx=0; x<EmuWidth; x++,sx++)\r
- {\r
- int addr=0;\r
-\r
- sx|=0xaaaaaaaa;\r
- addr=sx&sy&mask; // Calculate swizzled address\r
-\r
- ((unsigned short *)dest)[addr]=*ps++;\r
- }\r
- }\r
-\r
- TexScreen->UnlockRect(0);\r
-\r
- return 0;\r
-}\r
-\r
-// Copy screen to a linear texture:\r
-int TexScreenLinear()\r
-{\r
- D3DLOCKED_RECT lock={0,NULL};\r
- unsigned char *dest=NULL;\r
- int y=0,line=0;\r
- unsigned short *ps=NULL;\r
-\r
- TexScreen->LockRect(0,&lock,NULL,0);\r
- if (lock.pBits==NULL) return 1;\r
-\r
- dest=(unsigned char *)lock.pBits;\r
- ps=EmuScreen;\r
-\r
- for (y=0; y<EmuHeight; y++,line+=lock.Pitch)\r
- {\r
- int x=0;\r
- int addr=line;\r
-\r
- for (x=0; x<EmuWidth; x++,addr+=2)\r
- {\r
- *(unsigned int *)(dest+addr)=*ps++;\r
- }\r
- }\r
-\r
- TexScreen->UnlockRect(0);\r
- return 0;\r
-}\r
+++ /dev/null
-\r
-#include <stdio.h>\r
-\r
-#define WIN32_LEAN_AND_MEAN\r
-#include <windows.h>\r
-#include <d3d8.h>\r
-\r
-#include <d3dx8.h>\r
-\r
-#include <pico/pico.h>\r
-\r
-#define RELEASE(x) if (x) x->Release(); x=NULL;\r
-\r
-#ifndef __FUNCTION__\r
-#define __FUNCTION__ ""\r
-#endif\r
-\r
-#define LOGFAIL() lprintf("fail: %s %s:%i\n", __FUNCTION__, __FILE__, __LINE__)\r
-\r
-\r
-// Emu.cpp\r
-extern unsigned short *EmuScreen;\r
-extern int EmuWidth,EmuHeight;\r
-extern RECT EmuScreenRect;\r
-extern int PicoPadAdd;\r
-int EmuInit();\r
-void EmuExit();\r
-int EmuRomLoad(char *name);\r
-int EmuFrame();\r
-\r
-// Input.cpp\r
-struct Input\r
-{\r
- short axis[4];\r
- unsigned char button[16];\r
- unsigned char held[16]; // How long has the button been held\r
- char repeat[16]; // Auto-repeat\r
-};\r
-extern struct Input Inp;\r
-int InputInit();\r
-void InputExit();\r
-int InputUpdate();\r
-int InputLightCal(int cx,int cy,int ux,int uy);\r
-\r
-// Loop.cpp\r
-extern char LoopQuit,LoopWait,LoopWaiting;\r
-extern int LoopMode;\r
-\r
-int LoopInit();\r
-void LoopExit();\r
-int LoopCode();\r
-//extern "C" int dprintf(char *format, ...);\r
-extern "C" int lprintf(char *format, ...);\r
-\r
-// Main.cpp\r
-extern char *romname;\r
-extern HWND FrameWnd;\r
-extern RECT FrameRectMy;\r
-extern int MainWidth,MainHeight;\r
-extern int lock_to_1_1;\r
-extern void error(char *text);\r
-\r
-// --------------------------------------------\r
-// Direct.cpp\r
-extern IDirect3DDevice8 *Device;\r
-extern IDirect3DSurface8 *DirectBack; // Back Buffer\r
-int DirectInit();\r
-int DirectClear(unsigned int colour);\r
-int DirectScreen();\r
-int DirectPresent();\r
-void DirectExit();\r
-\r
-// DSound.cpp:\r
-int DSoundInit();\r
-void DSoundExit();\r
-int DSoundUpdate();\r
-extern short *DSoundNext; // Buffer for next sound data to put in loop\r
-\r
-// TexScreen.cpp\r
-extern IDirect3DTexture8 *TexScreen;\r
-extern int TexWidth,TexHeight;\r
-int TexScreenInit();\r
-void TexScreenExit();\r
-int TexScreenSwizzle();\r
-int TexScreenLinear();\r
+++ /dev/null
-// port specific settings\r
-\r
-#ifndef PORT_CONFIG_H\r
-#define PORT_CONFIG_H\r
-\r
-// draw2.c\r
-#define START_ROW 0 // which row of tiles to start rendering at?\r
-#define END_ROW 28 // ..end\r
-\r
-#define SIMPLE_WRITE_SOUND 1\r
-#define mix_32_to_16l_stereo_lvl mix_32_to_16l_stereo\r
-\r
-// pico.c\r
-#define CAN_HANDLE_240_LINES 0\r
-\r
-#define dprintf\r
-#define strcasecmp stricmp\r
-\r
-#endif //PORT_CONFIG_H\r
+++ /dev/null
-\r
-About\r
------\r
-\r
-This is a quick windows port of PicoDrive, a Megadrive / Genesis emulator for\r
-handheld devices. It was originally coded having ARM CPU based devices in mind\r
-(most work was done on GP2X version), but there is also a PSP port.\r
-\r
-The sole purpose of this port is to demonstrate my SVP and Sega Pico emulation\r
-code. This makes it one of the most minimal emulators out there. If you need\r
-more features, you will have to wait until support is integrated in Kega,\r
-Gens and the likes, as this emu was not meant to compete with them.\r
-\r
-For more info, visit http://notaz.gp2x.de/svp.php\r
-\r
-\r
-Releases\r
---------\r
-\r
-1.40 - first release.\r
-1.40a - Tasco Deluxe's dithering fix.\r
-1.40b - Perspective fix thanks to Pierpaolo Prazzoli's info.\r
-1.45 - Added preliminary Sega Pico emulation.\r
-1.45a - Few bugfixes and additions.\r
-\r
-\r
-Controls\r
---------\r
-\r
-These are currently hardcoded, keyboard only:\r
-\r
-PC Gen/MD Sega Pico\r
--------+-----------+---------\r
-Enter: Start\r
-Z: A\r
-X: B red button\r
-C: C pen push\r
-TAB: (reset)\r
-Esc: (load ROM)\r
-Arrows: D-pad\r
-\r
-\r
-Credits\r
--------\r
-\r
-A lot of work on making SVP emulation happen was done by Tasco Deluxe, my\r
-stuff is a continuation of his. Pierpaolo Prazzoli's information and his\r
-SSP1610 disassembler in MAME code helped a lot too.\r
-\r
-The original PicoDrive was written by fDave from finalburn.com\r
-\r
-This PicoDrive version uses bits and pieces of from other projects:\r
-\r
-68k: FAME/C core, by Chui and Stéphane Dallongeville (as C68K).\r
-z80: CZ80 by Stéphane Dallongeville and modified by NJ.\r
-YM2612 and SN76496 cores: MAME devs.\r
-\r
-Special thanks to Rokas and Lordus for various ideas.\r
-\r
-Greets to all the sceners and emu authors out there!\r
-\r
+++ /dev/null
-#define VERSION "1.45a"\r
-\r