diff --git a/plugins/cdvdGigaherz/src/CDVD.cpp b/plugins/cdvdGigaherz/src/CDVD.cpp
index ab9f349f81..88112df7f2 100644
--- a/plugins/cdvdGigaherz/src/CDVD.cpp
+++ b/plugins/cdvdGigaherz/src/CDVD.cpp
@@ -241,22 +241,12 @@ s32 CALLBACK CDVDopen(const char* pTitleFilename)
return 0;
}
- if(source_drive=='$')
- {
- printf(" * CDVD: Opening image '%s'...\n",source_file);
+ sprintf(csrc, "\\\\.\\%c:", source_drive);
- //open device file
- src= TryLoaders(source_file);
- }
- else
- {
- sprintf(csrc,"\\\\.\\%c:",source_drive);
+ printf(" * CDVD: Opening drive '%s'...\n", csrc);
- printf(" * CDVD: Opening drive '%s'...\n",csrc);
-
- //open device file
- src=new IOCtlSrc(csrc);
- }
+ // open device file
+ src = new IOCtlSrc(csrc);
if(!src->IsOK())
{
diff --git a/plugins/cdvdGigaherz/src/CDVD.h b/plugins/cdvdGigaherz/src/CDVD.h
index 71f96af193..7d4d724805 100644
--- a/plugins/cdvdGigaherz/src/CDVD.h
+++ b/plugins/cdvdGigaherz/src/CDVD.h
@@ -139,14 +139,11 @@ public:
extern Source *src;
-Source* TryLoaders(const char* fileName);
-
int FindDiskType();
void configure();
extern char source_drive;
-extern char source_file[];
extern HINSTANCE hinst;
diff --git a/plugins/cdvdGigaherz/src/FileStream.cpp b/plugins/cdvdGigaherz/src/FileStream.cpp
deleted file mode 100644
index 72474c3d40..0000000000
--- a/plugins/cdvdGigaherz/src/FileStream.cpp
+++ /dev/null
@@ -1,142 +0,0 @@
-/* PCSX2 - PS2 Emulator for PCs
- * Copyright (C) 2002-2014 David Quintana [gigaherz]
- *
- * PCSX2 is free software: you can redistribute it and/or modify it under the terms
- * of the GNU Lesser General Public License as published by the Free Software Found-
- * ation, either version 3 of the License, or (at your option) any later version.
- *
- * PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with PCSX2.
- * If not, see .
- */
-
-#include
-#include "CDVD.h"
-#include "FileStream.h"
-
-using namespace std;
-
-FileStream::FileStream(const char* fileName)
-{
- struct __stat64 stat_info;
- _stat64(fileName, &stat_info);
- fileSize = stat_info.st_size;
-
- handle = fopen(fileName, "rb");
-}
-
-void FileStream::seek(s64 offset)
-{
- seek(offset,SEEK_SET);
-}
-
-void FileStream::seek(s64 offset, int ref_position)
-{
- int ret = _fseeki64(handle, offset, ref_position);
-#ifdef __linux__
- if (ret) throw "Seek offset out of bounds.";
-#else
- if (ret)
- throw new exception("Seek offset out of bounds.");
-#endif
-}
-
-void FileStream::reset()
-{
- seek(0);
-}
-
-s64 FileStream::skip(s64 n)
-{
- s64 before = getFilePointer();
- seek(n,SEEK_CUR);
-
- return getFilePointer() - before;
-}
-
-s64 FileStream::getFilePointer()
-{
- return _ftelli64(handle);
-}
-
-bool FileStream::eof()
-{
- return feof(handle)!=0;
-}
-
-int FileStream::read()
-{
- return fgetc(handle);
-}
-
-int FileStream::read(byte* b, int len)
-{
- if (b == NULL)
- {
-#ifdef __linux__
- throw "NULL buffer passed.";
-#else
- throw new exception("NULL buffer passed.");
-#endif
- }
-
- if (len < 0)
- {
-#ifdef __linux__
- throw "off<0 or len<0.";
-#else
- throw new exception("off<0 or len<0.");
-#endif
- }
-
- return fread(b,1,len,handle);
-}
-
-string FileStream::readLine()
-{
- string s;
-
- s.clear();
- while (!eof())
- {
- char c = read();
-
- if ((c == '\n') || (c == '\r') || (c == '\0'))
- break;
-
- s.append(1, c);
- }
-
- return s;
-}
-
-wstring FileStream::readLineW()
-{
- wstring s;
-
- s.clear();
- while (!eof())
- {
- wchar_t c = read();
-
- if ((c == L'\n') || (c == L'\r') || (c == L'\0'))
- break;
-
- s.append(1, c);
- }
-
- return s;
-}
-
-s64 FileStream::getLength()
-{
- return fileSize;
-}
-
-FileStream::~FileStream(void)
-{
- fclose(handle);
-}
diff --git a/plugins/cdvdGigaherz/src/FileStream.h b/plugins/cdvdGigaherz/src/FileStream.h
deleted file mode 100644
index 99fb7ac1bd..0000000000
--- a/plugins/cdvdGigaherz/src/FileStream.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/* PCSX2 - PS2 Emulator for PCs
- * Copyright (C) 2002-2014 David Quintana [gigaherz]
- *
- * PCSX2 is free software: you can redistribute it and/or modify it under the terms
- * of the GNU Lesser General Public License as published by the Free Software Found-
- * ation, either version 3 of the License, or (at your option) any later version.
- *
- * PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with PCSX2.
- * If not, see .
- */
-
-#pragma once
-
-#include
-#include
-
-typedef unsigned char byte;
-
-class FileStream
-{
- int internalRead(byte* b, int off, int len);
-
- FILE* handle;
- s64 fileSize;
-
- FileStream(FileStream&);
-public:
-
- FileStream(const char* fileName);
-
- virtual void seek(s64 offset);
- virtual void seek(s64 offset, int ref_position);
- virtual void reset();
-
- virtual s64 skip(s64 n);
- virtual s64 getFilePointer();
-
- virtual bool eof();
- virtual int read();
- virtual int read(byte* b, int len);
-
- // Tool to read a specific value type, including structs.
- template
- T read()
- {
- if(sizeof(T)==1)
- return (T)read();
- else
- {
- T t;
- read((byte*)&t,sizeof(t));
- return t;
- }
- }
-
- virtual std::string readLine(); // Assume null-termination
- virtual std::wstring readLineW(); // (this one too)
-
- virtual s64 getLength();
-
- virtual ~FileStream(void);
-};
diff --git a/plugins/cdvdGigaherz/src/PlainIso.cpp b/plugins/cdvdGigaherz/src/PlainIso.cpp
deleted file mode 100644
index f4f4b8e4a5..0000000000
--- a/plugins/cdvdGigaherz/src/PlainIso.cpp
+++ /dev/null
@@ -1,216 +0,0 @@
-/* PCSX2 - PS2 Emulator for PCs
- * Copyright (C) 2002-2014 David Quintana [gigaherz]
- *
- * PCSX2 is free software: you can redistribute it and/or modify it under the terms
- * of the GNU Lesser General Public License as published by the Free Software Found-
- * ation, either version 3 of the License, or (at your option) any later version.
- *
- * PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with PCSX2.
- * If not, see .
- */
-
-#include "CDVD.h"
-
-#include
-#include
-
-#include "ReaderModules.h"
-#include "SectorConverters.h"
-
-#include
-
-#define RETURN(v) {OpenOK=v; return;}
-
-s32 PlainIso::Reopen()
-{
- if(fileSource)
- {
- delete fileSource;
- fileSource = NULL;
- }
-
- OpenOK = false;
-
- fileSource = new FileStream(fName);
-
- tocCached = false;
- mediaTypeCached = false;
- discSizeCached = false;
- layerBreakCached = false;
-
- OpenOK=true;
- return 0;
-}
-
-PlainIso::PlainIso(const char* fileName)
-{
- fileSource=NULL;
-
- strcpy_s(fName,256,fileName);
-
- Reopen();
-}
-
-PlainIso::~PlainIso()
-{
- if(fileSource && OpenOK)
- {
- delete fileSource;
- }
-}
-
-s32 PlainIso::GetSectorCount()
-{
- if(discSizeCached)
- return discSize;
-
- s64 length = fileSource->getLength();
-
- discSizeCached = true;
- discSize = (s32)(length / 2048);
- return discSize;
-}
-
-s32 PlainIso::GetLayerBreakAddress()
-{
- return 0;
-}
-
-s32 PlainIso::GetMediaType()
-{
- if(mediaTypeCached)
- return mediaType;
-
- // assume single layer DVD, for now
- mediaTypeCached = true;
- mediaType = 0;
- return mediaType;
-}
-
-#define MKDESCRIPTOR(n,ses,ctr,adr,pt,me,se,fe,tm,ts,tf) \
- ftd->Descriptors[n].SessionNumber = ses; \
- ftd->Descriptors[n].Control = ctr; \
- ftd->Descriptors[n].Adr = adr; \
- ftd->Descriptors[n].Reserved1 = 0; \
- ftd->Descriptors[n].Point = pt; \
- ftd->Descriptors[n].MsfExtra[0] = me; \
- ftd->Descriptors[n].MsfExtra[1] = se; \
- ftd->Descriptors[n].MsfExtra[2] = fe; \
- ftd->Descriptors[n].Zero = 0; \
- ftd->Descriptors[n].Msf[0] = tm; \
- ftd->Descriptors[n].Msf[1] = ts; \
- ftd->Descriptors[n].Msf[2] = tf;
-
-#define MSF_TO_LBA(m,s,f) ((m*60+s)*75+f-150)
-#define LBA_TO_MSF(m,s,f,l) \
- m = (l)/(75*60); \
- s = (((l)/75)%60); \
- f = ((l)%75);
-
-
-s32 PlainIso::ReadTOC(char *toc,int msize)
-{
- if(GetMediaType()>=0)
- return -1;
-
- if(!tocCached)
- {
- CDROM_TOC_FULL_TOC_DATA *ftd=(CDROM_TOC_FULL_TOC_DATA*)tocCacheData;
-
- // Build basic TOC
- int length = 6 * sizeof(ftd->Descriptors[0]) + 2;
- ftd->Length[0] = length>>8;
- ftd->Length[1] = length;
- ftd->FirstCompleteSession=1;
- ftd->LastCompleteSession=2;
-
- int dm,ds,df;
-
- LBA_TO_MSF(dm,ds,df,sector_count);
-
- MKDESCRIPTOR(0,1,0x00,1,0xA0,0,0,0,1,0,0);
- MKDESCRIPTOR(1,1,0x00,1,0xA1,0,0,0,1,0,0);
- MKDESCRIPTOR(2,1,0x00,1,0xA2,0,0,0,dm,ds,df);
- MKDESCRIPTOR(3,1,0x00,5,0xB0,0,0,0,0,0,0);
- MKDESCRIPTOR(4,1,0x00,5,0xC0,0,0,0,0,0,0);
- MKDESCRIPTOR(5,1,0x04,1,0x01,0,0,0,0,2,0);
-
- tocCached = true;
- }
-
- memcpy(toc,tocCacheData,min(2048,msize));
-
- return 0;
-}
-
-s32 PlainIso::ReadSectors2048(u32 sector, u32 count, char *buffer)
-{
- if(!OpenOK) return -1;
-
- fileSource->seek(sector*(u64)2048);
-
- s32 bytes = count * 2048;
- s32 size = fileSource->read((byte*)buffer,bytes);
-
- if(size!=bytes)
- {
- return -1;
- }
-
- return 0;
-}
-
-
-s32 PlainIso::ReadSectors2352(u32 sector, u32 count, char *buffer)
-{
- if(!OpenOK) return -1;
-
- fileSource->seek(sector*(u64)2352);
-
- for(uint i=0;iread((byte*)sectorbuffer,2352);
-
- if(size!=2352)
- {
- return -1;
- }
-
- Convert<2048,2352>(buffer+2048*i,sectorbuffer,sector+i);
- }
-
- return 0;
-}
-
-s32 PlainIso::DiscChanged()
-{
- if(!OpenOK) return -1;
-
- return 0;
-}
-
-s32 PlainIso::IsOK()
-{
- return OpenOK;
-}
-
-Reader* PlainIso::TryLoad(const char* fName)
-{
- std::string fileName = fName;
- std::string::size_type pos = fileName.find_last_of('.');
-
- if(pos == std::string::npos) // no "." found, error.
- return NULL;
-
- std::string extension = fileName.substr(pos);
-
- if((extension.compare(".iso")!=0)&&
- (extension.compare(".ISO")!=0)) // assume valid
- return NULL;
-
- return new PlainIso(fName);
-}
\ No newline at end of file
diff --git a/plugins/cdvdGigaherz/src/ReaderModules.cpp b/plugins/cdvdGigaherz/src/ReaderModules.cpp
deleted file mode 100644
index c015b14853..0000000000
--- a/plugins/cdvdGigaherz/src/ReaderModules.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-/* PCSX2 - PS2 Emulator for PCs
- * Copyright (C) 2002-2014 David Quintana [gigaherz]
- *
- * PCSX2 is free software: you can redistribute it and/or modify it under the terms
- * of the GNU Lesser General Public License as published by the Free Software Found-
- * ation, either version 3 of the License, or (at your option) any later version.
- *
- * PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with PCSX2.
- * If not, see .
- */
-
-#include "CDVD.h"
-#include "ReaderModules.h"
-
-Source* TryLoaders(const char* fileName)
-{
- Source *src=NULL;
- if((src=PlainIso::TryLoad(fileName))!=NULL) return src;
- //if((src=CueSheet::TryLoad(fileName))!=NULL) return src;
- //if((src=CloneCD::TryLoad(fileName))!=NULL) return src;
- //error
- return NULL;
-}
\ No newline at end of file
diff --git a/plugins/cdvdGigaherz/src/ReaderModules.h b/plugins/cdvdGigaherz/src/ReaderModules.h
deleted file mode 100644
index 8b3955756c..0000000000
--- a/plugins/cdvdGigaherz/src/ReaderModules.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/* PCSX2 - PS2 Emulator for PCs
- * Copyright (C) 2002-2014 David Quintana [gigaherz]
- *
- * PCSX2 is free software: you can redistribute it and/or modify it under the terms
- * of the GNU Lesser General Public License as published by the Free Software Found-
- * ation, either version 3 of the License, or (at your option) any later version.
- *
- * PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with PCSX2.
- * If not, see .
- */
-
-#pragma once
-
-#include "FileStream.h"
-
-class Reader: public Source //abstract class as base for Reader modules
-{
- Reader(Reader&);
-public:
- Reader(){};
-
- //virtual destructor
- virtual ~Reader() {}
-
- //virtual members
- virtual s32 GetSectorCount()=0;
- virtual s32 ReadTOC(char *toc,int size)=0;
- virtual s32 ReadSectors2048(u32 sector, u32 count, char *buffer)=0;
- virtual s32 ReadSectors2352(u32 sector, u32 count, char *buffer)=0;
- virtual s32 GetLayerBreakAddress()=0;
-
- virtual s32 GetMediaType()=0;
-
- virtual s32 IsOK()=0;
- virtual s32 Reopen()=0;
-
- virtual s32 DiscChanged()=0;
-
- //added members
- static Reader* TryLoad(const char* fileName);
-};
-
-class PlainIso: public Reader
-{
- FileStream* fileSource;
-
- bool OpenOK;
-
- s32 sector_count;
-
- char sectorbuffer[32*2048];
-
- char fName[256];
-
- DWORD sessID;
-
- bool tocCached;
- char tocCacheData[2048];
-
- bool mediaTypeCached;
- int mediaType;
-
- bool discSizeCached;
- s32 discSize;
-
- bool layerBreakCached;
- s32 layerBreak;
-
- PlainIso(PlainIso&);
-public:
-
- PlainIso(const char* fileName);
- virtual ~PlainIso();
-
- //virtual members
- virtual s32 GetSectorCount();
- virtual s32 ReadTOC(char *toc,int size);
- virtual s32 ReadSectors2048(u32 sector, u32 count, char *buffer);
- virtual s32 ReadSectors2352(u32 sector, u32 count, char *buffer);
- virtual s32 GetLayerBreakAddress();
-
- virtual s32 GetMediaType();
-
- virtual s32 IsOK();
- virtual s32 Reopen();
-
- virtual s32 DiscChanged();
-
- static Reader* TryLoad(const char* fileName);
-};
\ No newline at end of file
diff --git a/plugins/cdvdGigaherz/src/SectorConverters.h b/plugins/cdvdGigaherz/src/SectorConverters.h
deleted file mode 100644
index eb9a998bb1..0000000000
--- a/plugins/cdvdGigaherz/src/SectorConverters.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* PCSX2 - PS2 Emulator for PCs
- * Copyright (C) 2002-2014 David Quintana [gigaherz]
- *
- * PCSX2 is free software: you can redistribute it and/or modify it under the terms
- * of the GNU Lesser General Public License as published by the Free Software Found-
- * ation, either version 3 of the License, or (at your option) any later version.
- *
- * PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with PCSX2.
- * If not, see .
- */
-
-#pragma once
-
-template
-int Convert(char *dest, const char* psrc, int lsn);
-
-template<>
-int Convert<2048,2048>(char *dest, const char* psrc, int lsn)
-{
- memcpy(dest,psrc,2048);
- return 0;
-}
-
-template<>
-int Convert<2352,2352>(char *dest, const char* psrc, int lsn)
-{
- memcpy(dest,psrc,2352);
- return 0;
-}
-
-template<>
-int Convert<2352,2048>(char *dest, const char* psrc, int lsn)
-{
- memcpy(dest,psrc+16,2048);
- return 0;
-}
-
-template<>
-int Convert<2048,2352>(char *dest, const char* psrc, int lsn)
-{
- u8 m = lsn / (75*60);
- u8 s = (lsn/75) % 60;
- u8 f = lsn%75;
- u8 header[16] = {
- 0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,m,s,f,0x02
- };
-
- memcpy(dest,header,16);
- memcpy(dest+16,psrc,2048);
- return 0;
-}
diff --git a/plugins/cdvdGigaherz/src/Windows/cdvdGigaherz.vcxproj b/plugins/cdvdGigaherz/src/Windows/cdvdGigaherz.vcxproj
index 3548e3121d..de5d2f9fb0 100644
--- a/plugins/cdvdGigaherz/src/Windows/cdvdGigaherz.vcxproj
+++ b/plugins/cdvdGigaherz/src/Windows/cdvdGigaherz.vcxproj
@@ -54,19 +54,13 @@
-
-
-
-
-
-
diff --git a/plugins/cdvdGigaherz/src/Windows/cdvdGigaherz.vcxproj.filters b/plugins/cdvdGigaherz/src/Windows/cdvdGigaherz.vcxproj.filters
index bd3c064ad8..cc9463670e 100644
--- a/plugins/cdvdGigaherz/src/Windows/cdvdGigaherz.vcxproj.filters
+++ b/plugins/cdvdGigaherz/src/Windows/cdvdGigaherz.vcxproj.filters
@@ -5,9 +5,6 @@
{c03fe088-95f7-4235-a796-5fe044914fb5}
cpp;c;cxx;rc;def;r;odl;idl;hpj;bat
-
- {1dc55077-7d7a-4951-8841-26d21ff1513b}
-
{6c12b075-7b05-42ce-8628-c668f325f4ce}
h;hpp;hxx;hm;inl
@@ -24,41 +21,23 @@
Source Files
-
- Source Files
-
Source Files
-
- Source Files
-
Source Files
Source Files
-
- Source Files\Reader Modules
-
Header Files
-
- Header Files
-
-
- Header Files
-
Header Files
-
- Header Files
-
diff --git a/plugins/cdvdGigaherz/src/Windows/config.cpp b/plugins/cdvdGigaherz/src/Windows/config.cpp
index 420149321f..4d1a919fa2 100644
--- a/plugins/cdvdGigaherz/src/Windows/config.cpp
+++ b/plugins/cdvdGigaherz/src/Windows/config.cpp
@@ -26,7 +26,6 @@
// DEBUG
char source_drive;
-char source_file[MAX_PATH];
char CfgFile[MAX_PATH+10] = "inis/cdvdGigaherz.ini";
@@ -123,24 +122,17 @@ void ReadSettings()
CfgReadStr("Config","Source",temp,511,"-");
source_drive=temp[0];
-
- if(source_drive=='$')
- strcpy_s(source_file,sizeof(source_file),temp+1);
- else
- source_file[0]=0;
}
/*****************************************************************************/
void WriteSettings()
{
- char temp[511];
+ char temp[2];
temp[0]=source_drive;
temp[1]=0;
- strcat(temp,source_file);
-
CfgWriteStr("Config","Source",temp);
}