lots of win32 port work
[picodrive.git] / platform / win32 / GenaDrive / Rom.cpp
diff --git a/platform/win32/GenaDrive/Rom.cpp b/platform/win32/GenaDrive/Rom.cpp
deleted file mode 100644 (file)
index 9192dcf..0000000
+++ /dev/null
@@ -1,143 +0,0 @@
-\r
-#include "app.h"\r
-#include "Unzip.h"\r
-\r
-unsigned char *RomData=NULL;\r
-int RomLen=0;\r
-char RomName[260]="";\r
-\r
-\r
-static int Byteswap(unsigned char *data,int len)\r
-{\r
-  int i=0;\r
-\r
-  if (len<2) return 1; // Too short\r
-\r
-  do\r
-  {\r
-    unsigned short *pd=(unsigned short *)(data+i);\r
-    int word=*pd; // Get word\r
-\r
-    word=(word<<8)|(word>>8); // Byteswap it\r
-    *pd=(unsigned short)word; // Put word\r
-    i+=2;\r
-  }  \r
-  while (i+2<=len);\r
-\r
-  return 0;\r
-}\r
-\r
-// Interleve a 16k block and byteswap\r
-static int InterleveBlock(unsigned char *dest,unsigned char *src)\r
-{\r
-  int i=0;\r
-  for (i=0;i<0x2000;i++) dest[(i<<1)  ]=src[       i]; // Odd\r
-  for (i=0;i<0x2000;i++) dest[(i<<1)+1]=src[0x2000+i]; // Even\r
-  return 0;\r
-}\r
-\r
-// Decode a SMD file\r
-static int DecodeSmd(unsigned char *data,int len)\r
-{\r
-  unsigned char *temp=NULL;\r
-  int i=0;\r
-\r
-  temp=(unsigned char *)malloc(0x4000);\r
-  if (temp==NULL) return 1;\r
-  memset(temp,0,0x4000);\r
-\r
-  // Interleve each 16k block and shift down by 0x200:\r
-  for (i=0; i+0x4200<=len; i+=0x4000)\r
-  {\r
-    InterleveBlock(temp,data+0x200+i); // Interleve 16k to temporary buffer\r
-    memcpy(data+i,temp,0x4000); // Copy back in\r
-  }\r
-\r
-  free(temp);\r
-  return 0;\r
-}\r
-\r
-int RomLoad()\r
-{\r
-  FILE *file=NULL;\r
-  char *name=NULL;\r
-  int nameLen=0;\r
-  int fileLen=0,space=0;\r
-  Unzip unzip;\r
-\r
-  name=RomName;\r
-\r
-  file=fopen(name,"rb"); if (file==NULL) return 1;\r
-\r
-  nameLen=strlen(name);\r
-  if (stricmp(name+nameLen-4,".zip")==0) unzip.file=file; // Open as zip file\r
-\r
-  if (unzip.file)\r
-  {\r
-    int ret=0;\r
-\r
-    ret=unzip.fileOpen(); // Get first entry\r
-    if (ret==0)\r
-    {\r
-      fileLen=unzip.dataLen;  // Length of file\r
-      // Switch to using the name in the zip file:\r
-      name=unzip.name; nameLen=strlen(name);\r
-    }\r
-    else\r
-    {\r
-      unzip.file=NULL;\r
-    }\r
-\r
-  }\r
-  else\r
-  {\r
-    // Find out the length of the file:\r
-    fseek(file,0,SEEK_END); fileLen=ftell(file);\r
-    fseek(file,0,SEEK_SET);\r
-  }\r
-\r
-  // Allocate space for it:\r
-  space=(fileLen+0x3fff)&~0x3fff;\r
-\r
-  RomData=(unsigned char *)malloc(space);\r
-  if (RomData==NULL) { fclose(file); return 1; }\r
-  memset(RomData,0,space);\r
-\r
-  // Read in file:\r
-  if (unzip.file) unzip.fileDecode(RomData);\r
-  else fread(RomData,1,fileLen,file);\r
-\r
-  unzip.fileClose();\r
-\r
-  fclose(file);\r
-  unzip.file=file=NULL;\r
-\r
-  RomLen=fileLen;\r
-\r
-  // Check for SMD:\r
-  if ((fileLen&0x3fff)==0x200)\r
-  {\r
-    // Decode and byteswap:\r
-    DecodeSmd(RomData,RomLen);\r
-    RomLen-=0x200;\r
-  }\r
-  else\r
-  {\r
-    // Just byteswap:\r
-    Byteswap(RomData,RomLen);\r
-  }\r
-\r
-  PicoCartInsert(RomData,RomLen);\r
-\r
-  return 0;\r
-}\r
-\r
-void RomFree()\r
-{\r
-//  PicoCartInsert(NULL,0); // Unplug rom\r
-\r
-  if (RomData) free(RomData);\r
-  RomData=NULL; RomLen=0;\r
-  memset(RomName,0,sizeof(RomName));\r
-}\r
-\r