\r
ret=TexScreenInit(); if (ret) return 1;\r
\r
- FontInit();\r
+ //FontInit();\r
\r
Device->SetRenderState(D3DRS_LIGHTING,0); // Turn off lighting\r
\r
\r
void DirectExit()\r
{\r
- FontExit();\r
- TexScreenExit();\r
+ //FontExit();\r
+ //TexScreenExit();\r
\r
RELEASE(VertexBuffer)\r
RELEASE(DirectBack)\r
\r
#include "app.h"\r
\r
-extern "C" {\r
-struct Pico\r
-{\r
- unsigned char ram[0x10000]; // 0x00000 scratch ram\r
- unsigned short vram[0x8000]; // 0x10000\r
- unsigned char zram[0x2000]; // 0x20000 Z80 ram\r
- unsigned char ioports[0x10];\r
- unsigned int pad[0x3c]; // unused\r
- unsigned short cram[0x40]; // 0x22100\r
- unsigned short vsram[0x40]; // 0x22180\r
-\r
- unsigned char *rom; // 0x22200\r
- unsigned int romsize; // 0x22204\r
-\r
-// struct PicoMisc m;\r
-// struct PicoVideo video;\r
-};\r
- extern struct Pico Pico;\r
-}\r
-\r
unsigned short *EmuScreen=NULL;\r
extern "C" unsigned short *framebuff=NULL;\r
int EmuWidth=0,EmuHeight=0;\r
static int frame=0;\r
static int EmuScan(unsigned int num, void *sdata);\r
+unsigned char *PicoDraw2FB = NULL;\r
\r
int EmuInit()\r
{\r
int len=0;\r
\r
-// PicoOpt=-1;\r
-// PsndRate=44100; PsndLen=DSoundSeg;\r
-\r
PicoInit();\r
\r
// Allocate screen:\r
framebuff=(unsigned short *)malloc((8+320)*(8+224+8)*2);\r
memset(EmuScreen,0,len);\r
\r
+ PicoDraw2FB = (unsigned char *)framebuff;\r
+ PicoDrawSetColorFormat(1);\r
PicoScan=EmuScan;\r
\r
return 0;\r
pd=EmuScreen+(num<<8)+(num<<6); end=pd+320;\r
ps=(unsigned short *)sdata;\r
\r
- do { *pd++=(unsigned short)PicoCram(*ps++); } while (pd<end);\r
+ do { *pd++=*ps++; } while (pd<end);\r
\r
return 0;\r
}\r
frame++;\r
PsndOut=(short *)DSoundNext; PicoFrame(); PsndOut=NULL;\r
\r
- // rendermode2\r
- if(PicoOpt&0x10) {\r
- unsigned short *pd=EmuScreen;\r
- unsigned char *ps=(unsigned char*)framebuff+328*8;\r
+ return 0;\r
+}\r
\r
- unsigned short palHigh[0x40];\r
- for(int i = 0; i < 0x40; i++)\r
- palHigh[i]=(unsigned short)PicoCram(Pico.cram[i]);\r
\r
- for(int y=0; y < 224; y++) {\r
- ps+=8;\r
- for(int x=0; x < 320; x++)\r
- *pd++=palHigh[*ps++];\r
- }\r
- }\r
\r
+int mp3_get_offset(void) // 0-1023\r
+{\r
return 0;\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
}\r
else if(!sblobked && GetAsyncKeyState(VK_ESCAPE)) {\r
DSoundMute();\r
- FILE *rom = 0;\r
+ pm_file *rom = 0;\r
OPENFILENAME of; ZeroMemory(&of, sizeof(OPENFILENAME));\r
of.lStructSize = sizeof(OPENFILENAME);\r
of.lpstrFilter = "ROMs\0*.smd;*.bin;*.gen\0";\r
of.nMaxFile = MAX_PATH;\r
of.Flags = OFN_FILEMUSTEXIST|OFN_HIDEREADONLY;\r
GetOpenFileName(&of);\r
- rom = fopen(romname, "rb");\r
+ rom = pm_open(romname);\r
DSoundUnMute();\r
if(!rom) return 1;\r
PicoCartLoad(rom, &rom_data, &rom_size);\r
PicoCartInsert(rom_data, rom_size);\r
- fclose(rom);\r
- sblobked = 1;\r
- }\r
- else if(!sblobked && GetAsyncKeyState(VK_BACK)) {\r
- if(frameStep) frameStep=0;\r
- else fastForward^=1;\r
- sblobked = 1;\r
- }\r
- else if(!sblobked && GetAsyncKeyState(VK_OEM_5)) {\r
- frameStep=3;\r
+ pm_close(rom);\r
sblobked = 1;\r
}\r
else\r
sblobked = GetAsyncKeyState(VK_F6) | GetAsyncKeyState(VK_F9) |\r
- GetAsyncKeyState(VK_TAB) | GetAsyncKeyState(VK_ESCAPE) |\r
- GetAsyncKeyState(VK_BACK) | GetAsyncKeyState(VK_OEM_5);\r
+ GetAsyncKeyState(VK_TAB) | GetAsyncKeyState(VK_ESCAPE);\r
\r
return 0;\r
}\r
#include "app.h"\r
-#include "FileMenu.h"\r
+//#include "FileMenu.h"\r
\r
-// sram\r
-struct PicoSRAM\r
-{\r
- unsigned char *data; // actual data\r
- unsigned int start; // start address in 68k address space\r
- unsigned int end;\r
- unsigned char resize; // 1=SRAM size changed and needs to be reallocated on PicoReset\r
- unsigned char reg_back; // copy of Pico.m.sram_reg to set after reset\r
- unsigned char changed;\r
- unsigned char pad;\r
-};\r
-\r
-extern "C" PicoSRAM SRam;\r
extern char *romname;\r
int fastForward=0;\r
int frameStep=0;\r
char LoopQuit=0;\r
static FILE *DebugFile=NULL;\r
int LoopMode=0;\r
-static void UpdateSound();\r
+static void UpdateSound(int len);\r
\r
int LoopInit()\r
{\r
//PsndLen=PsndRate/60; // calculated later by pico itself\r
\r
// Init Direct3D:\r
- ret=DirectInit(); if (ret) return 1;\r
+ ret=DirectInit(); if (ret) { error("Direct3D init failed"); return 1; }\r
InputInit();\r
\r
// Init DirectSound:\r
//DSoundInit();\r
\r
ret=EmuInit(); if (ret) return 1;\r
- FileMenu.init();\r
+ //FileMenu.init();\r
\r
LoopMode=8;\r
PicoWriteSound = UpdateSound;\r
return 0;\r
}\r
\r
-void preLoopInit()\r
-{\r
- romname[strlen(romname)-3] = 0;\r
- strcat(romname, "srm");\r
- int sram_size = SRam.end-SRam.start+1;\r
- if(SRam.reg_back & 4) sram_size=0x2000;\r
- FILE *f = fopen(romname, "rb");\r
- if(f && SRam.data)\r
- fread(SRam.data, 1, sram_size, f);\r
- if(f) fclose(f);\r
-}\r
-\r
extern "C" char *debugString();\r
\r
void LoopExit()\r
{\r
dprintf(debugString());\r
\r
- romname[strlen(romname)-3] = 0;\r
- strcat(romname, "srm");\r
- int sram_size = SRam.end-SRam.start+1;\r
- if(SRam.reg_back & 4) sram_size=0x2000;\r
- for(; sram_size > 0; sram_size--)\r
- if(SRam.data[sram_size-1]) break;\r
- if(sram_size) {\r
- FILE *f = fopen(romname, "wb");\r
- if(f) {\r
- fwrite(SRam.data, 1, sram_size, f);\r
- fclose(f);\r
- }\r
- }\r
-\r
- FileMenu.exit();\r
+ //FileMenu.exit();\r
EmuExit();\r
DSoundExit(); PsndLen=0;\r
InputExit();\r
}\r
// ----------------------------------------------------------------\r
\r
+/*\r
static int MenuUpdate()\r
{\r
int delta=0;\r
\r
return 0;\r
}\r
+*/\r
\r
// ----------------------------------------------------------------\r
\r
\r
if (DSoundNext) memset(DSoundNext,0,PsndLen<<2);\r
\r
- if (LoopMode==2) { FileMenu.scan(); LoopMode++; return 0; }\r
- if (LoopMode==3) { MenuUpdate(); return 0; }\r
- if (LoopMode==4) { LightCalUpdate(); return 0; }\r
+// if (LoopMode==2) { FileMenu.scan(); LoopMode++; return 0; }\r
+// if (LoopMode==3) { MenuUpdate(); return 0; }\r
+// if (LoopMode==4) { LightCalUpdate(); return 0; }\r
\r
LoopMode=2; // Unknown mode, go to rom menu\r
return 0;\r
static int ModeRender()\r
{\r
DirectScreen();\r
- if (LoopMode==3) MenuRender();\r
- if (LoopMode==4) LightCalRender();\r
+// if (LoopMode==3) MenuRender();\r
+// if (LoopMode==4) LightCalRender();\r
\r
return 0;\r
}\r
\r
-static void UpdateSound()\r
+static void UpdateSound(int len)\r
{\r
if(fastForward) return;\r
while (DSoundUpdate()) { Sleep(1); }\r
\r
// -------------------------------------------------------------------------------------\r
\r
+#if 0\r
extern "C" int dprintf(char *format, ...)\r
{\r
char *name=NULL;\r
va_end(val);\r
return 0;\r
}\r
+#endif\r
\r
extern "C" int dprintf2(char *format, ...)\r
{\r
\r
return 0;\r
}\r
+\r
DWORD tid=0;\r
HANDLE thread=NULL;\r
\r
+ FrameInit();\r
+ ret=LoopInit(); if (ret) { LoopExit(); return 1; }\r
+\r
// notaz: load rom\r
static char rompath[MAX_PATH]; rompath[0] = 0;\r
strcpy(rompath, cmdline + (cmdline[0] == '\"' ? 1 : 0));\r
if(rompath[strlen(rompath)-1] == '\"') rompath[strlen(rompath)-1] = 0;\r
\r
- FILE *rom = 0;\r
- if(strlen(rompath) > 4) rom = fopen(rompath, "rb");\r
+ pm_file *rom = 0;\r
+ if(strlen(rompath) > 4) rom = pm_open(rompath);\r
if(!rom) {\r
OPENFILENAME of; ZeroMemory(&of, sizeof(OPENFILENAME));\r
of.lStructSize = sizeof(OPENFILENAME);\r
of.nMaxFile = MAX_PATH;\r
of.Flags = OFN_FILEMUSTEXIST|OFN_HIDEREADONLY;\r
if(!GetOpenFileName(&of)) return 1;\r
- rom = fopen(rompath, "rb");\r
+ rom = pm_open(rompath);\r
if(!rom) return 1;\r
}\r
romname = rompath;\r
//RDebug::Print(_L("PicoCartLoad() failed."));\r
//goto cleanup;\r
}\r
-\r
- FrameInit();\r
- ret=LoopInit(); if (ret) { LoopExit(); return 1; }\r
+ pm_close(rom);\r
\r
PicoCartInsert(rom_data, rom_size);\r
\r
// only now we got the mode (pal/ntsc), so init sound now\r
DSoundInit();\r
\r
- preLoopInit();\r
-\r
// Make another thread to run LoopCode():\r
LoopQuit=0;\r
thread=CreateThread(NULL,0,ThreadCode,NULL,0,&tid);\r
_CrtDumpMemoryLeaks();\r
return 0;\r
}\r
+\r
+extern void error(char *text)\r
+{\r
+ MessageBox(FrameWnd, text, "Error", 0);\r
+}\r
#endif\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)\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
+# emu\r
+OBJ = Emu.obj Input.obj Main.obj Direct.obj DSound.obj Loop.obj TexScreen.obj\r
+\r
+# not used: Rom.obj Font.obj FileMenu.obj LightCal.obj\r
+\r
+# common\r
+#OBJS += platform\common\emu.obj platform\common\menu.obj platform\common\fonts.obj \r
+# platform\common\readpng.obj platform\common\mp3_helix.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
+# 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\svp\svp.obj $(R)Pico\carthw\svp\Memory.obj $(R)Pico\carthw\svp\ssp16.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) gdi32.lib user32.lib advapi32.lib d3d8.lib d3dx8.lib dsound.lib comdlg32.lib\r
+\r
+clean:\r
+ -del $(OBJ) PicoDrive.exe\r
\r
#include <d3dx8.h>\r
\r
-#include "Pico.h"\r
+#include <Pico/Pico.h>\r
\r
#define PI 3.14159265f\r
\r
int LightCalRender();\r
\r
// Loop.cpp\r
-void preLoopInit();\r
extern char LoopQuit;\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 dprintf2(char *format, ...);\r
\r
// Main.cpp\r
extern HWND FrameWnd;\r
extern int MainWidth,MainHeight;\r
extern char AppName[];\r
-extern "C" int dprintf(char *format, ...);\r
+extern void error(char *text);\r
\r
// Rom.cpp\r
extern unsigned char *RomData;\r
#define START_ROW 0 // which row of tiles to start rendering at?\r
#define END_ROW 28 // ..end\r
\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
-#ifdef __cplusplus\r
-extern "C" {\r
-#endif\r
-\r
-// common debug\r
-int dprintf (char *format, ...);\r
-int dprintf2(char *format, ...);\r
-\r
-#ifdef __cplusplus\r
-} // End of extern "C"\r
-#endif\r
+#define dprintf\r
+#define strcasecmp stricmp\r
\r
#endif //PORT_CONFIG_H\r