win32 stuff, SIMPLE_WRITE_SOUND

git-svn-id: file:///home/notaz/opt/svn/PicoDrive@341 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
notaz 2008-01-29 23:04:26 +00:00
parent 7c9e6899a2
commit 03a265e5eb
14 changed files with 161 additions and 57 deletions

View file

@ -255,6 +255,11 @@ static int CheckIdle(void)
// to be called on 224 or line_sample scanlines only // to be called on 224 or line_sample scanlines only
static __inline void getSamples(int y) static __inline void getSamples(int y)
{ {
#if SIMPLE_WRITE_SOUND
PsndRender(0, PsndLen);
if (PicoWriteSound) PicoWriteSound(PsndLen);
PsndClear();
#else
static int curr_pos = 0; static int curr_pos = 0;
if(y == 224) { if(y == 224) {
@ -271,6 +276,7 @@ static __inline void getSamples(int y)
emustatus&=~1; emustatus&=~1;
curr_pos = PsndRender(0, PsndLen/2); curr_pos = PsndRender(0, PsndLen/2);
} }
#endif
} }

View file

@ -232,6 +232,7 @@ PICO_INTERNAL int PsndRender(int offset, int length)
int do_pcm = (PicoMCD&1) && (PicoOpt&0x400) && (Pico_mcd->pcm.control & 0x80) && Pico_mcd->pcm.enabled; int do_pcm = (PicoMCD&1) && (PicoOpt&0x400) && (Pico_mcd->pcm.control & 0x80) && Pico_mcd->pcm.enabled;
offset <<= stereo; offset <<= stereo;
#if !SIMPLE_WRITE_SOUND
if (offset == 0) { // should happen once per frame if (offset == 0) { // should happen once per frame
// compensate for float part of PsndLen // compensate for float part of PsndLen
PsndLen_exc_cnt += PsndLen_exc_add; PsndLen_exc_cnt += PsndLen_exc_add;
@ -240,6 +241,7 @@ PICO_INTERNAL int PsndRender(int offset, int length)
length++; length++;
} }
} }
#endif
// PSG // PSG
if (PicoOpt & 2) if (PicoOpt & 2)

View file

@ -6,6 +6,7 @@
#define CASE_SENSITIVE_FS 0 #define CASE_SENSITIVE_FS 0
#define DONT_OPEN_MANY_FILES 0 #define DONT_OPEN_MANY_FILES 0
#define REDUCE_IO_CALLS 0 #define REDUCE_IO_CALLS 0
#define SIMPLE_WRITE_SOUND 0
// draw.c // draw.c
#define OVERRIDE_HIGHCOL 1 #define OVERRIDE_HIGHCOL 1

View file

@ -6,6 +6,7 @@
#define CASE_SENSITIVE_FS 1 // CS filesystem #define CASE_SENSITIVE_FS 1 // CS filesystem
#define DONT_OPEN_MANY_FILES 0 #define DONT_OPEN_MANY_FILES 0
#define REDUCE_IO_CALLS 0 #define REDUCE_IO_CALLS 0
#define SIMPLE_WRITE_SOUND 0
// draw.c // draw.c
#define OVERRIDE_HIGHCOL 0 #define OVERRIDE_HIGHCOL 0

View file

@ -12,9 +12,10 @@
// pico.c // pico.c
#define CAN_HANDLE_240_LINES 1 #define CAN_HANDLE_240_LINES 1
#define SIMPLE_WRITE_SOUND 0
#define mix_32_to_16l_stereo_lvl mix_32_to_16l_stereo #define mix_32_to_16l_stereo_lvl mix_32_to_16l_stereo
#define EL_LOGMASK (EL_ANOMALY|EL_STATUS|EL_SRAMIO|EL_EEPROM|EL_UIO|EL_SVP) #define EL_LOGMASK (EL_ANOMALY|EL_STATUS|EL_SRAMIO|EL_EEPROM|EL_UIO)//|EL_VDPDMA|EL_HVCNT|EL_ASVDP)//|EL_SVP)
// EL_VDPDMA|EL_ASVDP|EL_SR) // |EL_BUSREQ|EL_Z80BNK) // EL_VDPDMA|EL_ASVDP|EL_SR) // |EL_BUSREQ|EL_Z80BNK)
//#define dprintf(f,...) printf("%05i:%03i: " f "\n",Pico.m.frame_count,Pico.m.scanline,##__VA_ARGS__) //#define dprintf(f,...) printf("%05i:%03i: " f "\n",Pico.m.frame_count,Pico.m.scanline,##__VA_ARGS__)

View file

@ -6,6 +6,7 @@
#define CASE_SENSITIVE_FS 0 #define CASE_SENSITIVE_FS 0
#define DONT_OPEN_MANY_FILES 1 // work around the stupid PSP ~10 open file limit #define DONT_OPEN_MANY_FILES 1 // work around the stupid PSP ~10 open file limit
#define REDUCE_IO_CALLS 1 // another workaround #define REDUCE_IO_CALLS 1 // another workaround
#define SIMPLE_WRITE_SOUND 0
// draw.c // draw.c
#define USE_BGR555 1 #define USE_BGR555 1

View file

@ -45,7 +45,7 @@ int DSoundInit()
wfx.nAvgBytesPerSec=wfx.nBlockAlign*wfx.nSamplesPerSec; wfx.nAvgBytesPerSec=wfx.nBlockAlign*wfx.nSamplesPerSec;
// Make buffer for the next seg to put into the loop: // Make buffer for the next seg to put into the loop:
DSoundNext=(short *)malloc(PsndLen<<2); if (DSoundNext==NULL) return 1; DSoundNext=(short *)malloc((PsndLen<<2)+64); if (DSoundNext==NULL) return 1;
memset(DSoundNext,0,PsndLen<<2); memset(DSoundNext,0,PsndLen<<2);
// Create the DirectSound interface: // Create the DirectSound interface:
@ -89,7 +89,10 @@ static int WriteSeg()
// Lock the segment at 'LoopWrite' and copy the next segment in // Lock the segment at 'LoopWrite' and copy the next segment in
LoopBuffer->Lock(LoopWrite<<((PicoOpt&8) ? 2 : 1),PsndLen<<((PicoOpt&8) ? 2 : 1), &mema,&sizea, &memb,&sizeb, 0); LoopBuffer->Lock(LoopWrite<<((PicoOpt&8) ? 2 : 1),PsndLen<<((PicoOpt&8) ? 2 : 1), &mema,&sizea, &memb,&sizeb, 0);
//dprintf2("lock %p, cpy %x\n", mema, sizea);
if (mema) memcpy(mema,DSoundNext,sizea); if (mema) memcpy(mema,DSoundNext,sizea);
// if (memb) memcpy(memb,DSoundNext+sizea,sizeb);
LoopBuffer->Unlock(mema,sizea, memb,0); LoopBuffer->Unlock(mema,sizea, memb,0);
@ -106,6 +109,8 @@ int DSoundUpdate()
LoopBuffer->GetCurrentPosition(&play,NULL); LoopBuffer->GetCurrentPosition(&play,NULL);
pos=play>>((PicoOpt&8) ? 2 : 1); pos=play>>((PicoOpt&8) ? 2 : 1);
//dprintf2("loop %i pos %i\n", LoopWrite, pos);
// 'LoopWrite' is the next seg in the loop that we want to write // 'LoopWrite' is the next seg in the loop that we want to write
// First check that the sound 'play' pointer has moved out of it: // First check that the sound 'play' pointer has moved out of it:
if (pos>=LoopWrite && pos<LoopWrite+PsndLen) return 1; // No, it hasn't if (pos>=LoopWrite && pos<LoopWrite+PsndLen) return 1; // No, it hasn't

View file

@ -1,4 +1,3 @@
#include "app.h" #include "app.h"
// d3d // d3d
@ -21,87 +20,137 @@ static CustomVertex VertexList[4];
// ddraw // ddraw
#include <ddraw.h> #include <ddraw.h>
LPDIRECTDRAW7 m_pDD; LPDIRECTDRAW7 m_pDD = NULL;
LPDIRECTDRAWSURFACE7 m_pddsFrontBuffer; LPDIRECTDRAWSURFACE7 m_pddsFrontBuffer = NULL;
LPDIRECTDRAWSURFACE7 m_pddsBackBuffer; LPDIRECTDRAWSURFACE7 m_pddsBackBuffer = NULL;
// quick and dirty stuff.. // quick and dirty stuff..
static void DirectExitDDraw()
{
RELEASE(m_pddsBackBuffer);
RELEASE(m_pddsFrontBuffer);
RELEASE(m_pDD);
}
static int DirectDrawInit() static int DirectDrawInit()
{ {
HRESULT ret; HRESULT ret;
LPDIRECTDRAWCLIPPER pcClipper = NULL;
DDSURFACEDESC2 ddsd;
ret = DirectDrawCreateEx(NULL, (VOID**)&m_pDD, IID_IDirectDraw7, NULL); ret = DirectDrawCreateEx(NULL, (VOID**)&m_pDD, IID_IDirectDraw7, NULL);
if (ret) { LOGFAIL(); return 1; } if (ret) { LOGFAIL(); return 1; }
// Set cooperative level // Set cooperative level
ret = m_pDD->SetCooperativeLevel( FrameWnd, DDSCL_NORMAL ); ret = m_pDD->SetCooperativeLevel( FrameWnd, DDSCL_NORMAL );
if (ret) { LOGFAIL(); return 1; } if (ret) { LOGFAIL(); goto fail; }
// Create the primary surface // Create the primary surface
DDSURFACEDESC2 ddsd;
ZeroMemory( &ddsd, sizeof( ddsd ) ); ZeroMemory( &ddsd, sizeof( ddsd ) );
ddsd.dwSize = sizeof( ddsd ); ddsd.dwSize = sizeof( ddsd );
ddsd.dwFlags = DDSD_CAPS; ddsd.dwFlags = DDSD_CAPS;
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
ret = m_pDD->CreateSurface( &ddsd, &m_pddsFrontBuffer, NULL ); ret = m_pDD->CreateSurface( &ddsd, &m_pddsFrontBuffer, NULL );
if (ret) { LOGFAIL(); return 1; } if (ret) { LOGFAIL(); goto fail; }
// Create the backbuffer surface // Create the backbuffer surface
ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE; ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE;
ddsd.dwWidth = 320; ddsd.dwWidth = EmuWidth;
ddsd.dwHeight = 240; ddsd.dwHeight = EmuHeight;
ret = m_pDD->CreateSurface( &ddsd, &m_pddsBackBuffer, NULL ); ret = m_pDD->CreateSurface( &ddsd, &m_pddsBackBuffer, NULL );
if (ret) { LOGFAIL(); return 1; } if (ret) { LOGFAIL(); goto fail; }
// clipper // clipper
LPDIRECTDRAWCLIPPER pcClipper = NULL;
ret = m_pDD->CreateClipper( 0, &pcClipper, NULL ); ret = m_pDD->CreateClipper( 0, &pcClipper, NULL );
if (ret) { LOGFAIL(); return 1; } if (ret) { LOGFAIL(); goto fail; }
ret = pcClipper->SetHWnd( 0, FrameWnd ); ret = pcClipper->SetHWnd( 0, FrameWnd );
if (ret) { LOGFAIL(); return 1; } if (ret) { LOGFAIL(); goto fail; }
ret = m_pddsFrontBuffer->SetClipper( pcClipper ); ret = m_pddsFrontBuffer->SetClipper( pcClipper );
if (ret) { LOGFAIL(); return 1; } if (ret) { LOGFAIL(); goto fail; }
RELEASE(pcClipper); RELEASE(pcClipper);
return 0;
#if 0 fail:
RELEASE(pcClipper);
DirectExitDDraw();
return 1;
}
static int DirectScreenDDraw()
{
DDSURFACEDESC2 sd; DDSURFACEDESC2 sd;
unsigned short *ps=EmuScreen;
int ret, x, y;
memset(&sd, 0, sizeof(sd)); memset(&sd, 0, sizeof(sd));
sd.dwSize = sizeof(sd); sd.dwSize = sizeof(sd);
ret = m_pddsBackBuffer->Lock(NULL, &sd, DDLOCK_SURFACEMEMORYPTR|DDLOCK_WAIT|DDLOCK_WRITEONLY, NULL); ret = m_pddsBackBuffer->Lock(NULL, &sd, DDLOCK_SURFACEMEMORYPTR|DDLOCK_WAIT|DDLOCK_WRITEONLY, NULL);
if (ret) { LOGFAIL(); return 1; } if (ret) { LOGFAIL(); return 1; }
memset(sd.lpSurface, 0xcc, 200*200); //dprintf2("w: %i h: %i pi: %i pf: %i\n", sd.dwWidth, sd.dwHeight, sd.lPitch, sd.ddpfPixelFormat.dwRGBBitCount);
if (sd.ddpfPixelFormat.dwRGBBitCount == 32)
{
int *dst = (int *)sd.lpSurface;
for (y = 0; y < EmuHeight; y++)
{
for (x = 0; x < EmuWidth; x++)
{
int s = *ps++;
dst[x] = ((s&0xf800)<<8) | ((s&0x07e0)<<5) | ((s&0x001f)<<3);
}
dst = (int *)((char *)dst + sd.lPitch);
}
}
else if (sd.ddpfPixelFormat.dwRGBBitCount == 16)
{
unsigned short *dst = (unsigned short *)sd.lpSurface;
for (y = 0; y < EmuHeight; y++)
{
memcpy(dst, ps, EmuWidth*2);
ps += EmuWidth;
dst = (unsigned short *)((char *)dst + sd.lPitch);
}
}
else
{
LOGFAIL();
}
ret = m_pddsBackBuffer->Unlock(NULL); ret = m_pddsBackBuffer->Unlock(NULL);
if (ret) { LOGFAIL(); return 1; } if (ret) { LOGFAIL(); return 1; }
#else
DDBLTFX ddbltfx;
ZeroMemory( &ddbltfx, sizeof(ddbltfx) );
ddbltfx.dwSize = sizeof(ddbltfx);
ddbltfx.dwFillColor = 0xff00;
ret = m_pddsBackBuffer->Blt( NULL, NULL, NULL, DDBLT_COLORFILL, &ddbltfx );
#endif
ret = m_pddsFrontBuffer->Blt(NULL, m_pddsBackBuffer, NULL, DDBLT_WAIT, NULL);
if (ret) { LOGFAIL(); return 1; }
Sleep(2000);
/* Sleep(500);
ret = m_pddsFrontBuffer->Blt(NULL, m_pddsBackBuffer, NULL, DDBLT_WAIT, NULL);
if (ret) { LOGFAIL(); return 1; }
Sleep(500);
ret = m_pddsFrontBuffer->Blt(NULL, m_pddsBackBuffer, NULL, DDBLT_WAIT, NULL);
if (ret) { LOGFAIL(); return 1; }
*/
return 0; return 0;
} }
static int DirectClearDDraw(unsigned int colour)
{
int ret;
DDBLTFX ddbltfx;
ZeroMemory( &ddbltfx, sizeof(ddbltfx) );
ddbltfx.dwSize = sizeof(ddbltfx);
ddbltfx.dwFillColor = colour;
if (m_pddsBackBuffer != NULL)
ret = m_pddsBackBuffer->Blt( NULL, NULL, NULL, DDBLT_COLORFILL, &ddbltfx );
if (ret) { LOGFAIL(); return 1; }
return 0;
}
static int DirectPresentDDraw()
{
int ret = m_pddsFrontBuffer->Blt(&FrameRectMy, m_pddsBackBuffer, NULL, DDBLT_WAIT, NULL);
if (ret) { LOGFAIL(); return 1; }
return 0;
}
/* D3D */
int DirectInit() int DirectInit()
{ {
@ -119,6 +168,7 @@ int DirectInit()
d3dpp.BackBufferHeight=MainHeight; d3dpp.BackBufferHeight=MainHeight;
d3dpp.BackBufferCount =1; d3dpp.BackBufferCount =1;
d3dpp.SwapEffect=D3DSWAPEFFECT_DISCARD; d3dpp.SwapEffect=D3DSWAPEFFECT_DISCARD;
d3dpp.MultiSampleType =D3DMULTISAMPLE_NONE;
#ifdef _XBOX #ifdef _XBOX
d3dpp.BackBufferFormat=D3DFMT_X8R8G8B8; d3dpp.BackBufferFormat=D3DFMT_X8R8G8B8;
@ -127,6 +177,7 @@ int DirectInit()
Direct3D->GetAdapterDisplayMode(D3DADAPTER_DEFAULT,&mode); Direct3D->GetAdapterDisplayMode(D3DADAPTER_DEFAULT,&mode);
d3dpp.BackBufferFormat=mode.Format; d3dpp.BackBufferFormat=mode.Format;
d3dpp.Windowed=1; d3dpp.Windowed=1;
d3dpp.hDeviceWindow=FrameWnd;
#endif #endif
// Try to create a device with hardware vertex processing: // Try to create a device with hardware vertex processing:
@ -201,10 +252,13 @@ void DirectExit()
//FontExit(); //FontExit();
TexScreenExit(); TexScreenExit();
// d3d
RELEASE(VertexBuffer) RELEASE(VertexBuffer)
RELEASE(DirectBack) RELEASE(DirectBack)
RELEASE(Device) RELEASE(Device)
RELEASE(Direct3D) RELEASE(Direct3D)
DirectExitDDraw();
} }
@ -251,12 +305,18 @@ static int MakeVertexList()
int DirectClear(unsigned int colour) int DirectClear(unsigned int colour)
{ {
if (Device == NULL)
return DirectClearDDraw(colour);
Device->Clear(0,NULL,D3DCLEAR_TARGET,colour,1.0f,0); Device->Clear(0,NULL,D3DCLEAR_TARGET,colour,1.0f,0);
return 0; return 0;
} }
int DirectPresent() int DirectPresent()
{ {
if (Device == NULL)
return DirectPresentDDraw();
Device->Present(NULL,NULL,NULL,NULL); Device->Present(NULL,NULL,NULL,NULL);
return 0; return 0;
} }
@ -297,6 +357,9 @@ int DirectScreen()
unsigned char *lock=NULL; unsigned char *lock=NULL;
int ret; int ret;
if (Device == NULL)
return DirectScreenDDraw();
// Copy the screen to the screen texture: // Copy the screen to the screen texture:
#ifdef _XBOX #ifdef _XBOX
TexScreenSwizzle(); TexScreenSwizzle();
@ -315,18 +378,12 @@ int DirectScreen()
memcpy(lock,VertexList,sizeof(VertexList)); memcpy(lock,VertexList,sizeof(VertexList));
VertexBuffer->Unlock(); VertexBuffer->Unlock();
ret=Device->BeginScene(); Device->BeginScene();
if (ret) dprintf2("BeginScene failed\n"); Device->SetTexture(0,TexScreen);
ret=Device->SetTexture(0,TexScreen); Device->SetStreamSource(0,VertexBuffer,sizeof(CustomVertex));
if (ret) dprintf2("SetTexture failed\n"); Device->SetVertexShader(D3DFVF_CUSTOMVERTEX);
ret=Device->SetStreamSource(0,VertexBuffer,sizeof(CustomVertex)); Device->DrawPrimitive(D3DPT_TRIANGLESTRIP,0,2);
if (ret) dprintf2("SetStreamSource failed\n"); Device->EndScene();
ret=Device->SetVertexShader(D3DFVF_CUSTOMVERTEX);
if (ret) dprintf2("SetVertexShader failed\n");
ret=Device->DrawPrimitive(D3DPT_TRIANGLESTRIP,0,2);
if (ret) dprintf2("DrawPrimitive failed\n");
ret=Device->EndScene();
if (ret) dprintf2("EndScene failed\n");
return 0; return 0;
} }

View file

@ -2,7 +2,7 @@
#include "app.h" #include "app.h"
unsigned short *EmuScreen=NULL; unsigned short *EmuScreen=NULL;
int EmuWidth=0,EmuHeight=0; int EmuWidth=320,EmuHeight=224;
static int EmuScan(unsigned int num, void *sdata); static int EmuScan(unsigned int num, void *sdata);
unsigned char *PicoDraw2FB = NULL; unsigned char *PicoDraw2FB = NULL;
@ -66,7 +66,9 @@ int EmuFrame()
PicoPad[0]=input; PicoPad[0]=input;
PsndOut=(short *)DSoundNext; PicoFrame(); PsndOut=NULL; PsndOut=(short *)DSoundNext;
PicoFrame();
//PsndOut=NULL;
return 0; return 0;
} }

View file

@ -13,11 +13,11 @@ int LoopInit()
// bits LSb->MSb: // bits LSb->MSb:
// enable_ym2612&dac, enable_sn76496, enable_z80, stereo_sound; // enable_ym2612&dac, enable_sn76496, enable_z80, stereo_sound;
// alt_renderer, 6button_gamepad, accurate_timing, accurate_sprites // alt_renderer, 6button_gamepad, accurate_timing, accurate_sprites
PicoOpt=0xbccf; PicoOpt=0xbcc7;
PsndRate=44100; PsndRate=44100;
// Init Direct3D: // Init Direct3D:
ret=DirectInit(); if (ret) { error("Direct3D init failed"); return 1; } ret=DirectInit(); if (ret) { error("DirectX video init failed"); return 1; }
InputInit(); InputInit();
// Init DirectSound: // Init DirectSound:
@ -108,7 +108,7 @@ static int ModeUpdate()
if (LoopMode==8) { DoGame(); return 0; } if (LoopMode==8) { DoGame(); return 0; }
if (DSoundNext) memset(DSoundNext,0,PsndLen<<2); // if (DSoundNext) memset(DSoundNext,0,PsndLen<<2);
// if (LoopMode==2) { FileMenu.scan(); LoopMode++; return 0; } // if (LoopMode==2) { FileMenu.scan(); LoopMode++; return 0; }
// if (LoopMode==3) { MenuUpdate(); return 0; } // if (LoopMode==3) { MenuUpdate(); return 0; }

View file

@ -5,14 +5,21 @@
char *romname; char *romname;
HWND FrameWnd=NULL; HWND FrameWnd=NULL;
RECT FrameRectMy;
int MainWidth=720,MainHeight=480; int MainWidth=720,MainHeight=480;
// Window proc for the frame window: // Window proc for the frame window:
static LRESULT CALLBACK WndProc(HWND hwnd,UINT msg,WPARAM wparam,LPARAM lparam) static LRESULT CALLBACK WndProc(HWND hwnd,UINT msg,WPARAM wparam,LPARAM lparam)
{ {
if (msg==WM_CLOSE) { PostQuitMessage(0); return 0; } switch (msg)
if (msg==WM_DESTROY) FrameWnd=NULL; // Blank handle {
case WM_CLOSE: PostQuitMessage(0); return 0;
case WM_DESTROY: FrameWnd=NULL; break; // Blank handle
case WM_SIZE:
case WM_MOVE:
case WM_SIZING: GetWindowRect(hwnd, &FrameRectMy); break;
}
return DefWindowProc(hwnd,msg,wparam,lparam); return DefWindowProc(hwnd,msg,wparam,lparam);
} }
@ -55,6 +62,10 @@ static int FrameInit()
FrameWnd=CreateWindow(wc.lpszClassName,"PicoDrive " VERSION,style|WS_VISIBLE, FrameWnd=CreateWindow(wc.lpszClassName,"PicoDrive " VERSION,style|WS_VISIBLE,
left,top,width,height,NULL,NULL,NULL,NULL); left,top,width,height,NULL,NULL,NULL,NULL);
ShowWindow(FrameWnd, SW_NORMAL);
UpdateWindow(FrameWnd);
GetWindowRect(FrameWnd, &FrameRectMy);
return 0; return 0;
} }
@ -75,15 +86,16 @@ int WINAPI WinMain(HINSTANCE,HINSTANCE,LPSTR cmdline,int)
unsigned char *rom_data = 0; unsigned char *rom_data = 0;
unsigned int rom_size = 0; unsigned int rom_size = 0;
static char rompath[MAX_PATH] = { 0, };
pm_file *rom = NULL;
FrameInit(); FrameInit();
ret=LoopInit(); if (ret) goto end0; ret=LoopInit(); if (ret) goto end0;
// notaz: load rom // notaz: load rom
static char rompath[MAX_PATH]; rompath[0] = 0;
strcpy(rompath, cmdline + (cmdline[0] == '\"' ? 1 : 0)); strcpy(rompath, cmdline + (cmdline[0] == '\"' ? 1 : 0));
if(rompath[strlen(rompath)-1] == '\"') rompath[strlen(rompath)-1] = 0; if(rompath[strlen(rompath)-1] == '\"') rompath[strlen(rompath)-1] = 0;
pm_file *rom = 0;
if(strlen(rompath) > 4) rom = pm_open(rompath); if(strlen(rompath) > 4) rom = pm_open(rompath);
if(!rom) { if(!rom) {
OPENFILENAME of; ZeroMemory(&of, sizeof(OPENFILENAME)); OPENFILENAME of; ZeroMemory(&of, sizeof(OPENFILENAME));

View file

@ -55,3 +55,13 @@ PicoDrive.exe : $(OBJ)
clean: clean:
-del $(OBJ) PicoDrive.exe -del $(OBJ) PicoDrive.exe
test.exe : test.cpp
cl $(CFLAGS) test.cpp user32.lib d3dx8.lib d3d8.lib
dxtut1.exe : dxtut1.cpp
cl $(CFLAGS) dxtut1.cpp user32.lib d3d8.lib
# d3dx8.lib

View file

@ -13,6 +13,10 @@
#define RELEASE(x) if (x) x->Release(); x=NULL; #define RELEASE(x) if (x) x->Release(); x=NULL;
#ifndef __FUNCTION__
#define __FUNCTION__ ""
#endif
#define LOGFAIL() dprintf2("fail: %s %s:%i\n", __FUNCTION__, __FILE__, __LINE__) #define LOGFAIL() dprintf2("fail: %s %s:%i\n", __FUNCTION__, __FILE__, __LINE__)
@ -56,6 +60,7 @@ extern "C" int dprintf2(char *format, ...);
// Main.cpp // Main.cpp
extern char *romname; extern char *romname;
extern HWND FrameWnd; extern HWND FrameWnd;
extern RECT FrameRectMy;
extern int MainWidth,MainHeight; extern int MainWidth,MainHeight;
extern void error(char *text); extern void error(char *text);

View file

@ -7,6 +7,7 @@
#define START_ROW 0 // which row of tiles to start rendering at? #define START_ROW 0 // which row of tiles to start rendering at?
#define END_ROW 28 // ..end #define END_ROW 28 // ..end
#define SIMPLE_WRITE_SOUND 1
#define mix_32_to_16l_stereo_lvl mix_32_to_16l_stereo #define mix_32_to_16l_stereo_lvl mix_32_to_16l_stereo
// pico.c // pico.c