CDVDiso: Now compiles under Win32 properly (can be compiled as either C or C++ code so linux should hopefully still work too). Fixed the issue where leaving the ISOfile blank (auto-prompts for ISO on RunCD) won't auto-prompt everytime you resume execution.

git-svn-id: http://pcsx2-playground.googlecode.com/svn/trunk@493 a6443dda-0b58-4228-96e9-037be469359c
This commit is contained in:
Jake.Stine 2008-12-25 15:59:45 +00:00 committed by Gregory Hainaut
parent 092110eb06
commit aa99d7781d
14 changed files with 503 additions and 805 deletions

View File

@ -17,20 +17,31 @@
*/
#ifdef __MSCW32__
#ifdef _MSC_VER
#pragma warning(disable:4018)
#endif
//#define CDVDdefs
#include "PS2Edefs.h"
#include "libiso.h"
#ifndef __LINUX__
#ifdef __cplusplus
#ifdef _MSC_VER
#define EXPORT_C(type) extern "C" __declspec(dllexport) type CALLBACK
#else
#define EXPORT_C(type) extern "C" type
#endif
#else
#ifdef _MSC_VER
#define EXPORT_C(type) __declspec(dllexport) type __stdcall
#else
#define EXPORT_C(type) type
#endif
#endif
EXPORT_C(u32) PS2EgetLibType();
EXPORT_C(u32) PS2EgetLibVersion2(u32 type);
EXPORT_C(char*) PS2EgetLibName();
@ -68,25 +79,20 @@ void __Log(char *fmt, ...);
#define VERBOSE 1
char IsoFile[256];
#define DEV_DEF ""
char CdDev[256];
#define CDDEV_DEF "/dev/cdrom"
int BlockDump;
isoFile *fdump;
isoFile *iso;
typedef struct {
int slsn;
int elsn;
#ifdef __WIN32__
#ifdef _WINDOWS_
HANDLE handle;
#else
FILE *handle;
#endif
} _cdIso;
_cdIso cdIso[8];
extern _cdIso cdIso[8];
#define CD_FRAMESIZE_RAW 2352
#define DATA_SIZE (CD_FRAMESIZE_RAW-12)
@ -96,17 +102,24 @@ _cdIso cdIso[8];
#define MSF2SECT(m,s,f) (((m)*60+(s)-2)*75+(f))
extern unsigned char cdbuffer[];
unsigned char *pbuffer;
int cdblocksize;
int cdblockofs;
int cdoffset;
int cdtype;
int cdblocks;
extern char IsoFile[256];
extern char CdDev[256];
int Zmode; // 1 Z - 2 bz2
int fmode; // 0 - file / 1 - Zfile
char *Ztable;
extern int BlockDump;
extern isoFile *fdump;
extern isoFile *iso;
extern u8 cdbuffer[];
extern u8 *pbuffer;
extern int cdblocksize;
extern int cdblockofs;
extern int cdoffset;
extern int cdtype;
extern int cdblocks;
extern int Zmode; // 1 Z - 2 bz2
extern int fmode; // 0 - file / 1 - Zfile
extern char *Ztable;
extern char *methods[];

View File

@ -13,6 +13,24 @@
#define MAX_PATH 255
#endif
char IsoFile[256];
char CdDev[256];
_cdIso cdIso[8];
u8 *pbuffer;
int cdblocksize;
int cdblockofs;
int cdoffset;
int cdtype;
int cdblocks;
int Zmode; // 1 Z - 2 bz2
int fmode; // 0 - file / 1 - Zfile
char *Ztable;
int BlockDump;
isoFile *fdump;
isoFile *iso;
FILE *cdvdLog = NULL;
@ -251,7 +269,7 @@ EXPORT_C(s32) CDVDgetTOC(void* toc) {
if( layer1start != -2 && iso->blocks >= 0x300000 ) {
int off = iso->blockofs;
char* tempbuffer;
u8* tempbuffer;
// dual sided
tocBuff[ 0] = 0x24;
@ -271,7 +289,7 @@ EXPORT_C(s32) CDVDgetTOC(void* toc) {
// search for it
if( layer1start == -1 ) {
printf("CDVD: searching for layer1...");
tempbuffer = (char*)malloc(CD_FRAMESIZE_RAW * 10);
tempbuffer = (u8*)malloc(CD_FRAMESIZE_RAW * 10);
for(layer1start = (iso->blocks/2-0x10)&~0xf; layer1start < 0x200010; layer1start += 16) {
isoReadBlock(iso, tempbuffer, layer1start);
// CD001

View File

@ -1,3 +1,20 @@
/* Pcsx2 - Pc Ps2 Emulator
* Copyright (C) 2002-2008 Pcsx2 Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __PS2EDEFS_H__
#define __PS2EDEFS_H__
@ -33,12 +50,6 @@
#include "PS2Etypes.h"
#ifdef __LINUX__
#define CALLBACK
#else
#include <windows.h>
#endif
/* common defines */
#ifndef C_ASSERT
@ -88,9 +99,9 @@ char* CALLBACK PS2EgetLibName(void);
#define KEYPRESS 1
#define KEYRELEASE 2
typedef struct {
typedef struct _keyEvent {
u32 key;
u32 event;
u32 evt;
} keyEvent;
// for 64bit compilers
@ -104,7 +115,7 @@ typedef char __keyEvent_Size__[(sizeof(keyEvent) == 8)?1:-1];
typedef int (CALLBACK * SIOchangeSlotCB)(int slot);
typedef struct {
typedef struct _cdvdSubQ {
u8 ctrl:4; // control and mode bits
u8 mode:4; // control and mode bits
u8 trackNum; // current track number (1 to 99)
@ -118,12 +129,12 @@ typedef struct {
u8 discF; // current frame offset from first track (BCD encoded)
} cdvdSubQ;
typedef struct { // NOT bcd coded
typedef struct _cdvdTD { // NOT bcd coded
u32 lsn;
u8 type;
} cdvdTD;
typedef struct {
typedef struct _cdvdTN {
u8 strack; //number of the first track (usually 1)
u8 etrack; //number of the last track
} cdvdTN;
@ -175,19 +186,23 @@ typedef int (*USBhandler)(void);
#define FREEZE_SAVE 1
#define FREEZE_SIZE 2
typedef struct {
typedef struct _GSdriverInfo {
char name[8];
void *common;
} GSdriverInfo;
#ifdef _WIN32
typedef struct { // unsupported values must be set to zero
#ifdef _WINDOWS_
typedef struct _winInfo { // unsupported values must be set to zero
HWND hWnd;
HMENU hMenu;
HWND hStatusWnd;
} winInfo;
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* GS plugin API */
// if this file is included with this define
@ -204,6 +219,7 @@ void CALLBACK GSvsync(int field);
void CALLBACK GSgifTransfer1(u32 *pMem, u32 addr);
void CALLBACK GSgifTransfer2(u32 *pMem, u32 size);
void CALLBACK GSgifTransfer3(u32 *pMem, u32 size);
void CALLBACK GSgetLastTag(u64* ptag); // returns the last tag processed (64 bits)
void CALLBACK GSgifSoftReset(u32 mask);
void CALLBACK GSreadFIFO(u64 *mem);
void CALLBACK GSreadFIFO2(u64 *mem, int qwc);
@ -218,11 +234,16 @@ void CALLBACK GSmakeSnapshot2(char *pathname, int* snapdone, int savejpg);
void CALLBACK GSirqCallback(void (*callback)());
void CALLBACK GSprintf(int timeout, char *fmt, ...);
void CALLBACK GSsetBaseMem(void*);
void CALLBACK GSsetGameCRC(int);
void CALLBACK GSsetGameCRC(int crc, int gameoptions);
// controls frame skipping in the GS, if this routine isn't present, frame skipping won't be done
void CALLBACK GSsetFrameSkip(int frameskip);
// if start is 1, starts recording spu2 data, else stops
// returns a non zero value if successful
// for now, pData is not used
int CALLBACK GSsetupRecording(int start, void* pData);
void CALLBACK GSreset();
void CALLBACK GSwriteCSR(u32 value);
void CALLBACK GSgetDriverInfo(GSdriverInfo *info);
@ -257,6 +278,15 @@ u8 CALLBACK PADpoll(u8 value);
// 3 if both are supported
u32 CALLBACK PADquery();
// call to give a hint to the PAD plugin to query for the keyboard state. A
// good plugin will query the OS for keyboard state ONLY in this function.
// This function is necessary when multithreading because otherwise
// the PAD plugin can get into deadlocks with the thread that really owns
// the window (and input). Note that PADupdate can be called from a different
// thread than the other functions, so mutex or other multithreading primitives
// have to be added to maintain data integrity.
void CALLBACK PADupdate(int pad);
// extended funcs
void CALLBACK PADgsDriverInfo(GSdriverInfo *info);
@ -310,11 +340,24 @@ void CALLBACK SPU2writeDMA4Mem(u16 *pMem, int size);
void CALLBACK SPU2interruptDMA4();
void CALLBACK SPU2readDMA7Mem(u16* pMem, int size);
void CALLBACK SPU2writeDMA7Mem(u16 *pMem, int size);
// all addresses passed by dma will be pointers to the array starting at baseaddr
// This function is necessary to successfully save and reload the spu2 state
void CALLBACK SPU2setDMABaseAddr(uptr baseaddr);
void CALLBACK SPU2interruptDMA7();
u32 CALLBACK SPU2ReadMemAddr(int core);
void CALLBACK SPU2WriteMemAddr(int core,u32 value);
void CALLBACK SPU2irqCallback(void (*SPU2callback)(),void (*DMA4callback)(),void (*DMA7callback)());
// extended funcs
// if start is 1, starts recording spu2 data, else stops
// returns a non zero value if successful
// for now, pData is not used
int CALLBACK SPU2setupRecording(int start, void* pData);
void CALLBACK SPU2setClockPtr(u32* ptr);
void CALLBACK SPU2setTimeStretcher(short int enable);
void CALLBACK SPU2async(u32 cycles);
s32 CALLBACK SPU2freeze(int mode, freezeData *data);
@ -413,6 +456,8 @@ u32 CALLBACK USBread32(u32 addr);
void CALLBACK USBwrite8(u32 addr, u8 value);
void CALLBACK USBwrite16(u32 addr, u16 value);
void CALLBACK USBwrite32(u32 addr, u32 value);
void CALLBACK USBasync(u32 cycles);
// cycles = IOP cycles before calling callback,
// if callback returns 1 the irq is triggered, else not
void CALLBACK USBirqCallback(USBcallback callback);
@ -471,6 +516,7 @@ typedef void (CALLBACK* _GSvsync)(int field);
typedef void (CALLBACK* _GSgifTransfer1)(u32 *pMem, u32 addr);
typedef void (CALLBACK* _GSgifTransfer2)(u32 *pMem, u32 size);
typedef void (CALLBACK* _GSgifTransfer3)(u32 *pMem, u32 size);
typedef void (CALLBACK* _GSgetLastTag)(u64* ptag); // returns the last tag processed (64 bits)
typedef void (CALLBACK* _GSgifSoftReset)(u32 mask);
typedef void (CALLBACK* _GSreadFIFO)(u64 *pMem);
typedef void (CALLBACK* _GSreadFIFO2)(u64 *pMem, int qwc);
@ -480,16 +526,17 @@ typedef void (CALLBACK* _GSchangeSaveState)(int, const char* filename);
typedef void (CALLBACK* _GSirqCallback)(void (*callback)());
typedef void (CALLBACK* _GSprintf)(int timeout, char *fmt, ...);
typedef void (CALLBACK* _GSsetBaseMem)(void*);
typedef void (CALLBACK* _GSsetGameCRC)(int);
typedef void (CALLBACK* _GSsetGameCRC)(int, int);
typedef void (CALLBACK* _GSsetFrameSkip)(int frameskip);
typedef int (CALLBACK* _GSsetupRecording)(int, void*);
typedef void (CALLBACK* _GSreset)();
typedef void (CALLBACK* _GSwriteCSR)(u32 value);
typedef void (CALLBACK* _GSgetDriverInfo)(GSdriverInfo *info);
#ifdef _WIN32
#ifdef _WINDOWS_
typedef s32 (CALLBACK* _GSsetWindowInfo)(winInfo *info);
#endif
typedef void (CALLBACK* _GSmakeSnapshot)(char *path);
typedef void (CALLBACK* _GSmakeSnapshot2)(char *path, int*, int);
typedef void (CALLBACK* _GSmakeSnapshot)(const char *path);
typedef void (CALLBACK* _GSmakeSnapshot2)(const char *path, int*, int);
typedef s32 (CALLBACK* _GSfreeze)(int mode, freezeData *data);
typedef void (CALLBACK* _GSconfigure)();
typedef s32 (CALLBACK* _GStest)();
@ -504,6 +551,7 @@ typedef keyEvent* (CALLBACK* _PADkeyEvent)();
typedef u8 (CALLBACK* _PADstartPoll)(int pad);
typedef u8 (CALLBACK* _PADpoll)(u8 value);
typedef u32 (CALLBACK* _PADquery)();
typedef void (CALLBACK* _PADupdate)(int pad);
typedef void (CALLBACK* _PADgsDriverInfo)(GSdriverInfo *info);
typedef void (CALLBACK* _PADconfigure)();
@ -537,8 +585,14 @@ typedef void (CALLBACK* _SPU2writeDMA4Mem)(u16 *pMem, int size);
typedef void (CALLBACK* _SPU2interruptDMA4)();
typedef void (CALLBACK* _SPU2readDMA7Mem)(u16 *pMem, int size);
typedef void (CALLBACK* _SPU2writeDMA7Mem)(u16 *pMem, int size);
typedef void (CALLBACK* _SPU2setDMABaseAddr)(uptr baseaddr);
typedef void (CALLBACK* _SPU2interruptDMA7)();
typedef void (CALLBACK* _SPU2irqCallback)(void (*SPU2callback)(),void (*DMA4callback)(),void (*DMA7callback)());
typedef int (CALLBACK* _SPU2setupRecording)(int, void*);
typedef void (CALLBACK* _SPU2setClockPtr)(u32*ptr);
typedef void (CALLBACK* _SPU2setTimeStretcher)(short int enable);
typedef u32 (CALLBACK* _SPU2ReadMemAddr)(int core);
typedef void (CALLBACK* _SPU2WriteMemAddr)(int core,u32 value);
typedef void (CALLBACK* _SPU2async)(u32 cycles);
@ -547,6 +601,7 @@ typedef void (CALLBACK* _SPU2configure)();
typedef s32 (CALLBACK* _SPU2test)();
typedef void (CALLBACK* _SPU2about)();
// CDVD
// NOTE: The read/write functions CANNOT use XMM/MMX regs
// If you want to use them, need to save and restore current ones
@ -606,6 +661,9 @@ typedef u32 (CALLBACK* _USBread32)(u32 mem);
typedef void (CALLBACK* _USBwrite8)(u32 mem, u8 value);
typedef void (CALLBACK* _USBwrite16)(u32 mem, u16 value);
typedef void (CALLBACK* _USBwrite32)(u32 mem, u32 value);
typedef void (CALLBACK* _USBasync)(u32 cycles);
typedef void (CALLBACK* _USBirqCallback)(USBcallback callback);
typedef USBhandler (CALLBACK* _USBirqHandler)(void);
typedef void (CALLBACK* _USBsetRAM)(void *mem);
@ -634,179 +692,194 @@ typedef void (CALLBACK* _FWabout)();
#ifdef PLUGINfuncs
// GS
_GSinit GSinit;
_GSopen GSopen;
_GSclose GSclose;
_GSshutdown GSshutdown;
_GSvsync GSvsync;
_GSgifTransfer1 GSgifTransfer1;
_GSgifTransfer2 GSgifTransfer2;
_GSgifTransfer3 GSgifTransfer3;
_GSgifSoftReset GSgifSoftReset;
_GSreadFIFO GSreadFIFO;
_GSreadFIFO2 GSreadFIFO2;
extern _GSinit GSinit;
extern _GSopen GSopen;
extern _GSclose GSclose;
extern _GSshutdown GSshutdown;
extern _GSvsync GSvsync;
extern _GSgifTransfer1 GSgifTransfer1;
extern _GSgifTransfer2 GSgifTransfer2;
extern _GSgifTransfer3 GSgifTransfer3;
extern _GSgetLastTag GSgetLastTag;
extern _GSgifSoftReset GSgifSoftReset;
extern _GSreadFIFO GSreadFIFO;
extern _GSreadFIFO2 GSreadFIFO2;
_GSkeyEvent GSkeyEvent;
_GSchangeSaveState GSchangeSaveState;
_GSmakeSnapshot GSmakeSnapshot;
_GSmakeSnapshot2 GSmakeSnapshot2;
_GSirqCallback GSirqCallback;
_GSprintf GSprintf;
_GSsetBaseMem GSsetBaseMem;
_GSsetGameCRC GSsetGameCRC;
_GSsetFrameSkip GSsetFrameSkip;
_GSreset GSreset;
_GSwriteCSR GSwriteCSR;
_GSgetDriverInfo GSgetDriverInfo;
#ifdef _WIN32
_GSsetWindowInfo GSsetWindowInfo;
extern _GSkeyEvent GSkeyEvent;
extern _GSchangeSaveState GSchangeSaveState;
extern _GSmakeSnapshot GSmakeSnapshot;
extern _GSmakeSnapshot2 GSmakeSnapshot2;
extern _GSirqCallback GSirqCallback;
extern _GSprintf GSprintf;
extern _GSsetBaseMem GSsetBaseMem;
extern _GSsetGameCRC GSsetGameCRC;
extern _GSsetFrameSkip GSsetFrameSkip;
extern _GSsetupRecording GSsetupRecording;
extern _GSreset GSreset;
extern _GSwriteCSR GSwriteCSR;
extern _GSgetDriverInfo GSgetDriverInfo;
#ifdef _WINDOWS_
extern _GSsetWindowInfo GSsetWindowInfo;
#endif
_GSfreeze GSfreeze;
_GSconfigure GSconfigure;
_GStest GStest;
_GSabout GSabout;
extern _GSfreeze GSfreeze;
extern _GSconfigure GSconfigure;
extern _GStest GStest;
extern _GSabout GSabout;
// PAD1
_PADinit PAD1init;
_PADopen PAD1open;
_PADclose PAD1close;
_PADshutdown PAD1shutdown;
_PADkeyEvent PAD1keyEvent;
_PADstartPoll PAD1startPoll;
_PADpoll PAD1poll;
_PADquery PAD1query;
extern _PADinit PAD1init;
extern _PADopen PAD1open;
extern _PADclose PAD1close;
extern _PADshutdown PAD1shutdown;
extern _PADkeyEvent PAD1keyEvent;
extern _PADstartPoll PAD1startPoll;
extern _PADpoll PAD1poll;
extern _PADquery PAD1query;
extern _PADupdate PAD1update;
_PADgsDriverInfo PAD1gsDriverInfo;
_PADconfigure PAD1configure;
_PADtest PAD1test;
_PADabout PAD1about;
extern _PADgsDriverInfo PAD1gsDriverInfo;
extern _PADconfigure PAD1configure;
extern _PADtest PAD1test;
extern _PADabout PAD1about;
// PAD2
_PADinit PAD2init;
_PADopen PAD2open;
_PADclose PAD2close;
_PADshutdown PAD2shutdown;
_PADkeyEvent PAD2keyEvent;
_PADstartPoll PAD2startPoll;
_PADpoll PAD2poll;
_PADquery PAD2query;
extern _PADinit PAD2init;
extern _PADopen PAD2open;
extern _PADclose PAD2close;
extern _PADshutdown PAD2shutdown;
extern _PADkeyEvent PAD2keyEvent;
extern _PADstartPoll PAD2startPoll;
extern _PADpoll PAD2poll;
extern _PADquery PAD2query;
extern _PADupdate PAD2update;
_PADgsDriverInfo PAD2gsDriverInfo;
_PADconfigure PAD2configure;
_PADtest PAD2test;
_PADabout PAD2about;
extern _PADgsDriverInfo PAD2gsDriverInfo;
extern _PADconfigure PAD2configure;
extern _PADtest PAD2test;
extern _PADabout PAD2about;
// SIO[2]
_SIOinit SIOinit[2][9];
_SIOopen SIOopen[2][9];
_SIOclose SIOclose[2][9];
_SIOshutdown SIOshutdown[2][9];
_SIOstartPoll SIOstartPoll[2][9];
_SIOpoll SIOpoll[2][9];
_SIOquery SIOquery[2][9];
extern _SIOinit SIOinit[2][9];
extern _SIOopen SIOopen[2][9];
extern _SIOclose SIOclose[2][9];
extern _SIOshutdown SIOshutdown[2][9];
extern _SIOstartPoll SIOstartPoll[2][9];
extern _SIOpoll SIOpoll[2][9];
extern _SIOquery SIOquery[2][9];
_SIOconfigure SIOconfigure[2][9];
_SIOtest SIOtest[2][9];
_SIOabout SIOabout[2][9];
extern _SIOconfigure SIOconfigure[2][9];
extern _SIOtest SIOtest[2][9];
extern _SIOabout SIOabout[2][9];
// SPU2
_SPU2init SPU2init;
_SPU2open SPU2open;
_SPU2close SPU2close;
_SPU2shutdown SPU2shutdown;
_SPU2write SPU2write;
_SPU2read SPU2read;
_SPU2readDMA4Mem SPU2readDMA4Mem;
_SPU2writeDMA4Mem SPU2writeDMA4Mem;
_SPU2interruptDMA4 SPU2interruptDMA4;
_SPU2readDMA7Mem SPU2readDMA7Mem;
_SPU2writeDMA7Mem SPU2writeDMA7Mem;
_SPU2interruptDMA7 SPU2interruptDMA7;
_SPU2ReadMemAddr SPU2ReadMemAddr;
_SPU2WriteMemAddr SPU2WriteMemAddr;
_SPU2irqCallback SPU2irqCallback;
extern _SPU2init SPU2init;
extern _SPU2open SPU2open;
extern _SPU2close SPU2close;
extern _SPU2shutdown SPU2shutdown;
extern _SPU2write SPU2write;
extern _SPU2read SPU2read;
extern _SPU2readDMA4Mem SPU2readDMA4Mem;
extern _SPU2writeDMA4Mem SPU2writeDMA4Mem;
extern _SPU2interruptDMA4 SPU2interruptDMA4;
extern _SPU2readDMA7Mem SPU2readDMA7Mem;
extern _SPU2writeDMA7Mem SPU2writeDMA7Mem;
extern _SPU2setDMABaseAddr SPU2setDMABaseAddr;
extern _SPU2interruptDMA7 SPU2interruptDMA7;
extern _SPU2ReadMemAddr SPU2ReadMemAddr;
extern _SPU2setupRecording SPU2setupRecording;
extern _SPU2WriteMemAddr SPU2WriteMemAddr;
extern _SPU2irqCallback SPU2irqCallback;
_SPU2async SPU2async;
_SPU2freeze SPU2freeze;
_SPU2configure SPU2configure;
_SPU2test SPU2test;
_SPU2about SPU2about;
extern _SPU2setClockPtr SPU2setClockPtr;
extern _SPU2setTimeStretcher SPU2setTimeStretcher;
extern _SPU2async SPU2async;
extern _SPU2freeze SPU2freeze;
extern _SPU2configure SPU2configure;
extern _SPU2test SPU2test;
extern _SPU2about SPU2about;
// CDVD
_CDVDinit CDVDinit;
_CDVDopen CDVDopen;
_CDVDclose CDVDclose;
_CDVDshutdown CDVDshutdown;
_CDVDreadTrack CDVDreadTrack;
_CDVDgetBuffer CDVDgetBuffer;
_CDVDreadSubQ CDVDreadSubQ;
_CDVDgetTN CDVDgetTN;
_CDVDgetTD CDVDgetTD;
_CDVDgetTOC CDVDgetTOC;
_CDVDgetDiskType CDVDgetDiskType;
_CDVDgetTrayStatus CDVDgetTrayStatus;
_CDVDctrlTrayOpen CDVDctrlTrayOpen;
_CDVDctrlTrayClose CDVDctrlTrayClose;
extern _CDVDinit CDVDinit;
extern _CDVDopen CDVDopen;
extern _CDVDclose CDVDclose;
extern _CDVDshutdown CDVDshutdown;
extern _CDVDreadTrack CDVDreadTrack;
extern _CDVDgetBuffer CDVDgetBuffer;
extern _CDVDreadSubQ CDVDreadSubQ;
extern _CDVDgetTN CDVDgetTN;
extern _CDVDgetTD CDVDgetTD;
extern _CDVDgetTOC CDVDgetTOC;
extern _CDVDgetDiskType CDVDgetDiskType;
extern _CDVDgetTrayStatus CDVDgetTrayStatus;
extern _CDVDctrlTrayOpen CDVDctrlTrayOpen;
extern _CDVDctrlTrayClose CDVDctrlTrayClose;
_CDVDconfigure CDVDconfigure;
_CDVDtest CDVDtest;
_CDVDabout CDVDabout;
_CDVDnewDiskCB CDVDnewDiskCB;
extern _CDVDconfigure CDVDconfigure;
extern _CDVDtest CDVDtest;
extern _CDVDabout CDVDabout;
extern _CDVDnewDiskCB CDVDnewDiskCB;
// DEV9
_DEV9init DEV9init;
_DEV9open DEV9open;
_DEV9close DEV9close;
_DEV9shutdown DEV9shutdown;
_DEV9read8 DEV9read8;
_DEV9read16 DEV9read16;
_DEV9read32 DEV9read32;
_DEV9write8 DEV9write8;
_DEV9write16 DEV9write16;
_DEV9write32 DEV9write32;
_DEV9readDMA8Mem DEV9readDMA8Mem;
_DEV9writeDMA8Mem DEV9writeDMA8Mem;
_DEV9irqCallback DEV9irqCallback;
_DEV9irqHandler DEV9irqHandler;
extern _DEV9init DEV9init;
extern _DEV9open DEV9open;
extern _DEV9close DEV9close;
extern _DEV9shutdown DEV9shutdown;
extern _DEV9read8 DEV9read8;
extern _DEV9read16 DEV9read16;
extern _DEV9read32 DEV9read32;
extern _DEV9write8 DEV9write8;
extern _DEV9write16 DEV9write16;
extern _DEV9write32 DEV9write32;
extern _DEV9readDMA8Mem DEV9readDMA8Mem;
extern _DEV9writeDMA8Mem DEV9writeDMA8Mem;
extern _DEV9irqCallback DEV9irqCallback;
extern _DEV9irqHandler DEV9irqHandler;
_DEV9configure DEV9configure;
_DEV9freeze DEV9freeze;
_DEV9test DEV9test;
_DEV9about DEV9about;
extern _DEV9configure DEV9configure;
extern _DEV9freeze DEV9freeze;
extern _DEV9test DEV9test;
extern _DEV9about DEV9about;
// USB
_USBinit USBinit;
_USBopen USBopen;
_USBclose USBclose;
_USBshutdown USBshutdown;
_USBread8 USBread8;
_USBread16 USBread16;
_USBread32 USBread32;
_USBwrite8 USBwrite8;
_USBwrite16 USBwrite16;
_USBwrite32 USBwrite32;
_USBirqCallback USBirqCallback;
_USBirqHandler USBirqHandler;
_USBsetRAM USBsetRAM;
extern _USBinit USBinit;
extern _USBopen USBopen;
extern _USBclose USBclose;
extern _USBshutdown USBshutdown;
extern _USBread8 USBread8;
extern _USBread16 USBread16;
extern _USBread32 USBread32;
extern _USBwrite8 USBwrite8;
extern _USBwrite16 USBwrite16;
extern _USBwrite32 USBwrite32;
extern _USBasync USBasync;
_USBconfigure USBconfigure;
_USBfreeze USBfreeze;
_USBtest USBtest;
_USBabout USBabout;
extern _USBirqCallback USBirqCallback;
extern _USBirqHandler USBirqHandler;
extern _USBsetRAM USBsetRAM;
extern _USBconfigure USBconfigure;
extern _USBfreeze USBfreeze;
extern _USBtest USBtest;
extern _USBabout USBabout;
// FW
_FWinit FWinit;
_FWopen FWopen;
_FWclose FWclose;
_FWshutdown FWshutdown;
_FWread32 FWread32;
_FWwrite32 FWwrite32;
_FWirqCallback FWirqCallback;
extern _FWinit FWinit;
extern _FWopen FWopen;
extern _FWclose FWclose;
extern _FWshutdown FWshutdown;
extern _FWread32 FWread32;
extern _FWwrite32 FWwrite32;
extern _FWirqCallback FWirqCallback;
_FWconfigure FWconfigure;
_FWfreeze FWfreeze;
_FWtest FWtest;
_FWabout FWabout;
extern _FWconfigure FWconfigure;
extern _FWfreeze FWfreeze;
extern _FWtest FWtest;
extern _FWabout FWabout;
#endif
#ifdef __cplusplus
} // End extern "C"
#endif
#endif /* __PS2EDEFS_H__ */

View File

@ -1,8 +1,75 @@
/* Pcsx2 - Pc Ps2 Emulator
* Copyright (C) 2002-2008 Pcsx2 Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __PS2ETYPES_H__
#define __PS2ETYPES_H__
#if defined (__linux__) && !defined(__LINUX__) // some distributions are lower case
#define __LINUX__
#endif
#ifdef __CYGWIN__
#define __LINUX__
#endif
#ifndef ARRAYSIZE
#define ARRAYSIZE(x) (sizeof(x)/sizeof((x)[0]))
#endif
#ifdef __LINUX__
#define CALLBACK
#else
#define CALLBACK __stdcall
#endif
// jASSUME - give hints to the optimizer
// This is primarily useful for the default case switch optimizer, which enables VC to
// generate more compact switches.
#ifdef NDEBUG
# define jBREAKPOINT() ((void) 0)
# ifdef _MSC_VER
# define jASSUME(exp) (__assume(exp))
# else
# define jASSUME(exp) ((void) sizeof(exp))
# endif
#else
# if defined(_MSC_VER)
# define jBREAKPOINT() do { __asm int 3 } while(0)
# else
# define jBREAKPOINT() ((void) *(volatile char *) 0)
# endif
# define jASSUME(exp) if(exp) ; else jBREAKPOINT()
#endif
// disable the default case in a switch
#define jNO_DEFAULT \
{ \
break; \
\
default: \
jASSUME(0); \
break; \
}
// Basic types
#if defined(__MSCW32__)
#if defined(_MSC_VER)
typedef __int8 s8;
typedef __int16 s16;
@ -14,13 +81,33 @@ typedef unsigned __int16 u16;
typedef unsigned __int32 u32;
typedef unsigned __int64 u64;
#if defined(__x86_64__)
typedef u64 uptr;
#else
typedef u32 uptr;
#endif
typedef unsigned int uint;
#elif defined(__LINUX__) || defined(__MINGW32__)
#define PCSX2_ALIGNED(alig,x) __declspec(align(alig)) x
#define PCSX2_ALIGNED16(x) __declspec(align(16)) x
#define PCSX2_ALIGNED16_DECL(x) __declspec(align(16)) x
#else
#ifdef __LINUX__
#ifdef HAVE_STDINT_H
#include "stdint.h"
typedef int8_t s8;
typedef int16_t s16;
typedef int32_t s32;
typedef int64_t s64;
typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;
typedef uintptr_t uptr;
typedef intptr_t sptr;
#else
typedef char s8;
typedef short s16;
@ -32,12 +119,53 @@ typedef unsigned short u16;
typedef unsigned int u32;
typedef unsigned long long u64;
#if defined(__x86_64__)
typedef u64 uptr;
#else
typedef u32 uptr;
#endif
typedef unsigned int uint;
#define LONG long
typedef union _LARGE_INTEGER
{
long long QuadPart;
} LARGE_INTEGER;
#define __fastcall __attribute__((fastcall))
#define __unused __attribute__((unused))
#define _inline __inline__ __attribute__((unused))
#define __forceinline __attribute__((always_inline,unused))
#endif
#if defined(__MINGW32__)
#define PCSX2_ALIGNED(alig,x) __declspec(align(alig)) x
#define PCSX2_ALIGNED16(x) __declspec(align(16)) x
#else
#define PCSX2_ALIGNED(alig,x) x __attribute((aligned(alig)))
#define PCSX2_ALIGNED16(x) x __attribute((aligned(16)))
#endif
#define PCSX2_ALIGNED16_DECL(x) x
#endif // _MSC_VER
#if !defined(__LINUX__) || !defined(HAVE_STDINT_H)
#if defined(__x86_64__)
typedef u64 uptr;
typedef s64 sptr;
#else
typedef u32 uptr;
typedef s32 sptr;
#endif
#endif
typedef struct {
int size;
s8 *data;
} freezeData;
/* common defines */
#ifndef C_ASSERT
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
#endif
#endif /* __PS2ETYPES_H__ */

View File

@ -0,0 +1,26 @@
; CDVDiso.def : Declares the module parameters for the DLL.
EXPORTS
; Explicit exports can go here
PS2EgetLibType @2
PS2EgetLibName @3
PS2EgetLibVersion2 @4
CDVDinit @5
CDVDshutdown @6
CDVDopen @7
CDVDclose @8
CDVDreadTrack @9
CDVDgetBuffer @10
CDVDreadSubQ @11
CDVDgetTN @12
CDVDgetTD @13
CDVDgetTOC @14
CDVDgetDiskType @15
CDVDgetTrayStatus @16
CDVDctrlTrayOpen @17
CDVDctrlTrayClose @18
CDVDconfigure @19
CDVDtest @20
CDVDabout @21

View File

@ -1,560 +0,0 @@
<?xml version="1.0" encoding="windows-1253"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="CDVDiso"
ProjectGUID="{BB27CC2C-28D1-4438-A0DF-3E120D01EDEC}"
RootNamespace="CDVDiso"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="Win64 (AMD64)"
/>
</Platforms>
<ToolFiles>
<DefaultToolFile
FileName="masm.rules"
/>
</ToolFiles>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)\bin\plugins"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
WholeProgramOptimization="1"
EnableManagedIncrementalBuild="0"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
CommandLine=""
/>
<Tool
Name="MASM"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="true"
SuppressStartupBanner="true"
TargetEnvironment="1"
TypeLibraryName=".\Release/CDVDiso.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="2"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
WholeProgramOptimization="true"
AdditionalIncludeDirectories="..;..\ZLIB;..\bzip2;."
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;__MSCW32__;_CRT_SECURE_NO_DEPRECATE;__WIN32__;_LARGEFILE_SOURCE;_FILE_OFFSET_BITS=64"
StringPooling="true"
RuntimeLibrary="0"
StructMemberAlignment="5"
EnableFunctionLevelLinking="true"
PrecompiledHeaderFile=".\Release/CDVDiso.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
BrowseInformation="1"
WarningLevel="3"
SuppressStartupBanner="true"
CompileAs="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1032"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="odbc32.lib odbccp32.lib comctl32.lib"
OutputFile="$(OutDir)\CDVDiso.dll"
LinkIncremental="1"
SuppressStartupBanner="true"
GenerateManifest="false"
IgnoreDefaultLibraryNames="msvcrt.lib"
GenerateDebugInformation="true"
ProgramDatabaseFile=".\Release/CDVDiso.pdb"
OptimizeReferences="2"
EnableCOMDATFolding="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
ImportLibrary=".\Release/CDVDiso.lib"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine=""
/>
</Configuration>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)\bin\plugins"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
CommandLine=""
/>
<Tool
Name="MASM"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="true"
SuppressStartupBanner="true"
TargetEnvironment="1"
TypeLibraryName=".\Release/CDVDiso.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..;..\ZLIB;..\bzip2;."
PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS;_USRDLL;__MSCW32__;CDVDiso_EXPORTS;_CRT_SECURE_NO_DEPRECATE;__WIN32__;_LARGEFILE_SOURCE;_FILE_OFFSET_BITS=64"
StringPooling="true"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
StructMemberAlignment="5"
EnableFunctionLevelLinking="true"
PrecompiledHeaderFile=".\Debug\CDVDiso.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
BrowseInformation="1"
WarningLevel="3"
SuppressStartupBanner="true"
DebugInformationFormat="3"
CompileAs="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1032"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="odbc32.lib odbccp32.lib comctl32.lib"
OutputFile="$(OutDir)\CDVDiso-debug.dll"
LinkIncremental="1"
SuppressStartupBanner="true"
GenerateManifest="false"
IgnoreDefaultLibraryNames="msvcrt.lib"
GenerateDebugInformation="true"
ProgramDatabaseFile=".\Release/CDVDiso.pdb"
OptimizeReferences="1"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
ImportLibrary=".\Debug/CDVDisod.lib"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine=""
/>
</Configuration>
<Configuration
Name="Release|Win64 (AMD64)"
OutputDirectory="amd64\$(ConfigurationName)"
IntermediateDirectory="amd64\$(ConfigurationName)"
ConfigurationType="2"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="3"
TypeLibraryName=".\Release/CDVDiso.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="../;../ZLIB;./"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;__MSCW32__;CDVDiso_EXPORTS;__WIN32__;__x86_64__;_LARGEFILE_SOURCE;_FILE_OFFSET_BITS=64;ASMV;ASMINF"
StringPooling="TRUE"
RuntimeLibrary="0"
EnableFunctionLevelLinking="TRUE"
PrecompiledHeaderFile=".\Release/CDVDiso.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
CompileAs="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1032"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="odbc32.lib odbccp32.lib comctl32.lib"
OutputFile=".\Release/CDVDiso.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
GenerateManifest="FALSE"
IgnoreDefaultLibraryNames="msvcrt.lib"
ModuleDefinitionFile=".\CDVDiso.def"
ProgramDatabaseFile=".\Release/CDVDiso.pdb"
ImportLibrary=".\Release/CDVDiso.lib"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
>
<File
RelativePath="..\CDVDisop.c"
>
</File>
<File
RelativePath=".\Config.c"
>
</File>
<File
RelativePath="..\libiso.c"
>
</File>
<File
RelativePath=".\Win32.c"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl"
>
<File
RelativePath="..\CDVDiso.h"
>
</File>
<File
RelativePath=".\Config.h"
>
</File>
<File
RelativePath="..\libiso.h"
>
</File>
<File
RelativePath="..\PS2Edefs.h"
>
</File>
<File
RelativePath="..\PS2Etypes.h"
>
</File>
<File
RelativePath=".\resource.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
>
<File
RelativePath="CDVDiso.rc"
>
</File>
</Filter>
<Filter
Name="zlib"
>
<File
RelativePath="..\zlib\adler32.c"
>
</File>
<File
RelativePath="..\zlib\compress.c"
>
</File>
<File
RelativePath="..\zlib\crc32.c"
>
</File>
<File
RelativePath="..\zlib\crc32.h"
>
</File>
<File
RelativePath="..\zlib\deflate.c"
>
</File>
<File
RelativePath="..\zlib\deflate.h"
>
</File>
<File
RelativePath="..\zlib\gvmat32c.c"
>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\zlib\gzio.c"
>
</File>
<File
RelativePath="..\zlib\infback.c"
>
</File>
<File
RelativePath="..\zlib\inffast.c"
>
</File>
<File
RelativePath="..\zlib\inffast.h"
>
</File>
<File
RelativePath="..\zlib\inffixed.h"
>
</File>
<File
RelativePath="..\zlib\inflate.c"
>
</File>
<File
RelativePath="..\zlib\inflate.h"
>
</File>
<File
RelativePath="..\zlib\inftrees.c"
>
</File>
<File
RelativePath="..\zlib\inftrees.h"
>
</File>
<File
RelativePath="..\zlib\trees.c"
>
</File>
<File
RelativePath="..\zlib\trees.h"
>
</File>
<File
RelativePath="..\zlib\uncompr.c"
>
</File>
<File
RelativePath="..\zlib\zconf.h"
>
</File>
<File
RelativePath="..\zlib\zlib.h"
>
</File>
<File
RelativePath="..\zlib\zutil.c"
>
</File>
<File
RelativePath="..\zlib\zutil.h"
>
</File>
</Filter>
<Filter
Name="bzip2"
>
<File
RelativePath="..\bzip2\blocksort.c"
>
</File>
<File
RelativePath="..\bzip2\bzlib.c"
>
</File>
<File
RelativePath="..\bzip2\bzlib.h"
>
</File>
<File
RelativePath="..\bzip2\bzlib_private.h"
>
</File>
<File
RelativePath="..\bzip2\compress.c"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\bzip2\crctable.c"
>
</File>
<File
RelativePath="..\bzip2\decompress.c"
>
</File>
<File
RelativePath="..\bzip2\huffman.c"
>
</File>
<File
RelativePath="..\bzip2\randtable.c"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -1,7 +1,7 @@
#include <stdio.h>
#include <windows.h>
#include "CDVDiso.h"
#include "../CDVDiso.h"
#define GetKeyV(name, var, s, t) \
size = s; type = t; \

View File

@ -5,7 +5,7 @@
#include <stdarg.h>
#include <sys/stat.h>
#include <string.h>
#include <zlib.h>
#include "zlib/zlib.h"
#include "Config.h"

View File

@ -1374,7 +1374,7 @@ const char * BZ_API(BZ2_bzlibVersion)(void)
#if defined(_WIN32) || defined(OS2) || defined(MSDOS)
# include <fcntl.h>
# include <io.h>
# define SET_BINARY_MODE(file) setmode(fileno(file),O_BINARY)
# define SET_BINARY_MODE(file) _setmode(_fileno(file),O_BINARY)
#else
# define SET_BINARY_MODE(file)
#endif
@ -1427,7 +1427,7 @@ BZFILE * bzopen_or_bzdopen
#ifdef BZ_STRICT_ANSI
fp = NULL;
#else
fp = fdopen(fd,mode2);
fp = _fdopen(fd,mode2);
#endif
}
if (fp == NULL) return NULL;

View File

@ -2,18 +2,18 @@
#define __USE_FILE_OFFSET64
#define _FILE_OFFSET_BITS 64
#ifdef _WIN32
#include <windows.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <zlib.h>
#include <bzlib.h>
#ifdef __WIN32__
#include <windows.h>
#endif
#include "zlib/zlib.h"
#include "bzip2/bzlib.h"
#include "PS2Etypes.h"
#include "CDVDiso.h"
@ -21,7 +21,7 @@
/* some structs from libcdvd by Hiryu & Sjeep (C) 2002 */
#if defined(__WIN32__)
#if defined(_WIN32)
#pragma pack(1)
#endif
@ -36,7 +36,7 @@ struct rootDirTocHeader
u8 reserved[6]; //+1A
u8 reserved2; //+20
u8 reserved3; //+21
#if defined(__WIN32__)
#if defined(_WIN32)
}; //+22
#else
} __attribute__((packed));
@ -52,7 +52,7 @@ struct asciiDate
char seconds[2];
char hundreths[2];
char terminator[1];
#if defined(__WIN32__)
#if defined(_WIN32)
};
#else
} __attribute__((packed));
@ -94,14 +94,14 @@ struct cdVolDesc
struct asciiDate expirationDate;
u8 reserved10;
u8 reserved11[1166];
#if defined(__WIN32__)
#if defined(_WIN32)
};
#else
} __attribute__((packed));
#endif
#ifdef __WIN32__
#ifdef _WIN32
void *_openfile(const char *filename, int flags) {
HANDLE handle;
@ -119,7 +119,7 @@ void *_openfile(const char *filename, int flags) {
u64 _tellfile(void *handle) {
u64 ofs;
DWORD *_ofs = (DWORD*)&ofs;
PLONG _ofs = (LONG*)&ofs;
_ofs[1] = 0;
_ofs[0] = SetFilePointer(handle, 0, &_ofs[1], FILE_CURRENT);
return ofs;
@ -127,7 +127,7 @@ u64 _tellfile(void *handle) {
int _seekfile(void *handle, u64 offset, int whence) {
u64 ofs = (u64)offset;
DWORD *_ofs = (DWORD*)&ofs;
PLONG _ofs = (LONG*)&ofs;
// printf("_seekfile %p, %d_%d\n", handle, _ofs[1], _ofs[0]);
if (whence == SEEK_SET) {
SetFilePointer(handle, _ofs[0], &_ofs[1], FILE_BEGIN);
@ -165,7 +165,7 @@ void _closefile(void *handle) {
void *_openfile(const char *filename, int flags) {
printf("_openfile %s %x\n", filename, flags);
#ifdef __WIN32__
#ifdef _WIN32
if (flags & O_WRONLY)
return fopen64(filename, "wb");
else return fopen64(filename, "rb");
@ -213,12 +213,12 @@ void _closefile(void *handle) {
#endif
int detect(isoFile *iso) {
char buf[2448];
u8 buf[2448];
struct cdVolDesc *volDesc;
if (isoReadBlock(iso, buf, 16) == -1) return -1;
volDesc = (struct cdVolDesc *)(buf + 24);
if (strncmp(volDesc->volID, "CD001", 5)) return 0;
if (strncmp((char*)volDesc->volID, "CD001", 5)) return 0;
if (volDesc->rootToc.tocSize == 2048) {
iso->type = ISOTYPE_CD;
@ -405,7 +405,7 @@ int isoDetect(isoFile *iso) { // based on florin's CDVDbin detection code :)
_readfile(iso->handle, &iso->blocks, 4);
_readfile(iso->handle, &iso->blockofs, 4);
iso->buflsn = -1;
iso->buffer = malloc(iso->blocksize*16);
iso->buffer = (u8*)malloc(iso->blocksize*16);
if (iso->buffer == NULL) return -1;
_isoReadBZ2table(iso);
return detect(iso) == 1 ? 0 : -1;
@ -574,7 +574,7 @@ int isoSetFormat(isoFile *iso, int blockofs, int blocksize, int blocks) {
if (_writefile(iso->handle, &blocks, 4) < 4) return -1;
if (_writefile(iso->handle, &blockofs, 4) < 4) return -1;
iso->buflsn = -1;
iso->buffer = malloc(iso->blocksize*16);
iso->buffer = (u8*)malloc(iso->blocksize*16);
if (iso->buffer == NULL) return -1;
}
if (iso->flags & ISOFLAGS_BLOCKDUMP) {
@ -607,7 +607,7 @@ void LSNtoMSF(u8 *Time, s32 lsn) {
Time[0] = itob(m); Time[1] = itob(s); Time[2] = itob(f);
}
int _isoReadBlock(isoFile *iso, char *dst, int lsn) {
int _isoReadBlock(isoFile *iso, u8 *dst, int lsn) {
u64 ofs = (u64)lsn * iso->blocksize + iso->offset;
int ret;
@ -623,7 +623,7 @@ int _isoReadBlock(isoFile *iso, char *dst, int lsn) {
return 0;
}
int _isoReadBlockZ(isoFile *iso, char *dst, int lsn) {
int _isoReadBlockZ(isoFile *iso, u8 *dst, int lsn) {
u32 pos, p;
uLongf size;
u8 Zbuf[CD_FRAMESIZE_RAW*2];
@ -646,7 +646,7 @@ int _isoReadBlockZ(isoFile *iso, char *dst, int lsn) {
return 0;
}
int _isoReadBlockZ2(isoFile *iso, char *dst, int lsn) {
int _isoReadBlockZ2(isoFile *iso, u8 *dst, int lsn) {
u32 pos, p;
uLongf size;
u8 Zbuf[16*1024];
@ -669,7 +669,7 @@ int _isoReadBlockZ2(isoFile *iso, char *dst, int lsn) {
return 0;
}
int _isoReadBlockBZ2(isoFile *iso, char *dst, int lsn) {
int _isoReadBlockBZ2(isoFile *iso, u8 *dst, int lsn) {
u32 pos, p;
u32 size;
u8 Zbuf[64*1024];
@ -694,7 +694,7 @@ int _isoReadBlockBZ2(isoFile *iso, char *dst, int lsn) {
}
size = iso->blocksize*64;
ret = BZ2_bzBuffToBuffDecompress(iso->buffer, &size, Zbuf, p, 0, 0);
ret = BZ2_bzBuffToBuffDecompress((s8*)iso->buffer, &size, (s8*)Zbuf, p, 0, 0);
if (ret != BZ_OK) {
printf("_isoReadBlockBZ2 %d, %d\n", lsn, iso->blocksize);
printf("%d, %d\n", pos, p);
@ -707,7 +707,7 @@ int _isoReadBlockBZ2(isoFile *iso, char *dst, int lsn) {
return 0;
}
int _isoReadBlockD(isoFile *iso, char *dst, int lsn) {
int _isoReadBlockD(isoFile *iso, u8 *dst, int lsn) {
int ret;
int i;
@ -727,7 +727,7 @@ int _isoReadBlockD(isoFile *iso, char *dst, int lsn) {
return -1;
}
int _isoReadBlockM(isoFile *iso, char *dst, int lsn) {
int _isoReadBlockM(isoFile *iso, u8 *dst, int lsn) {
u64 ofs;
int ret;
int i;
@ -753,7 +753,7 @@ int _isoReadBlockM(isoFile *iso, char *dst, int lsn) {
return 0;
}
int isoReadBlock(isoFile *iso, char *dst, int lsn) {
int isoReadBlock(isoFile *iso, u8 *dst, int lsn) {
int ret;
if (lsn > iso->blocks) {
@ -812,9 +812,9 @@ int _isoWriteBlockZ(isoFile *iso, u8 *src, int lsn) {
// printf("_isoWriteBlockZ %d\n", size);
pos = (u32)_tellfile(iso->handle);
ret = _writefile(iso->htable, (u8*)&pos, 4);
ret = _writefile(iso->htable, &pos, 4);
if (ret < 4) return -1;
ret = _writefile(iso->htable, (u8*)&size, 2);
ret = _writefile(iso->htable, &size, 2);
if (ret < 2) return -1;
ret = _writefile(iso->handle, Zbuf, size);
@ -879,7 +879,7 @@ int _isoWriteBlockBZ2(isoFile *iso, u8 *src, int lsn) {
// printf("_isoWriteBlockBZ2 %d\n", iso->blocksize);
size = 64*1024;
ret = BZ2_bzBuffToBuffCompress(Zbuf, (u32*)&size, iso->buffer, iso->blocksize*blocks, 9, 0, 30);
ret = BZ2_bzBuffToBuffCompress((s8*)Zbuf, (u32*)&size, (s8*)iso->buffer, iso->blocksize*blocks, 9, 0, 30);
if (ret != BZ_OK) {
printf("error on BZ2: %d\n", ret);
}
@ -897,7 +897,7 @@ int _isoWriteBlockBZ2(isoFile *iso, u8 *src, int lsn) {
return 0;
}
int isoWriteBlock(isoFile *iso, char *src, int lsn) {
int isoWriteBlock(isoFile *iso, u8 *src, int lsn) {
int ret;
if (iso->flags & ISOFLAGS_Z) {

View File

@ -1,7 +1,7 @@
#ifndef __LIBISO_H__
#define __LIBISO_H__
#ifdef __MSCW32__
#ifdef _MSC_VER
#pragma warning(disable:4018)
#endif
@ -43,7 +43,7 @@ typedef struct {
int dtablesize;
_multih multih[8];
int buflsn;
char *buffer;
u8 *buffer;
} isoFile;
@ -51,8 +51,8 @@ isoFile *isoOpen(const char *filename);
isoFile *isoCreate(const char *filename, int mode);
int isoSetFormat(isoFile *iso, int blockofs, int blocksize, int blocks);
int isoDetect(isoFile *iso);
int isoReadBlock(isoFile *iso, char *dst, int lsn);
int isoWriteBlock(isoFile *iso, char *src, int lsn);
int isoReadBlock(isoFile *iso, u8 *dst, int lsn);
int isoWriteBlock(isoFile *iso, u8 *src, int lsn);
void isoClose(isoFile *iso);
void *_openfile(const char *filename, int flags);

View File

@ -96,7 +96,7 @@ local gzFile gz_open (path, mode, fd)
int fd;
{
int err;
int level = Z_DEFAULT_COMPRESSION; /* compression level */
int level = Z_BEST_COMPRESSION; /* compression level */
int strategy = Z_DEFAULT_STRATEGY; /* compression strategy */
char *p = (char*)mode;
gz_stream *s;

View File

@ -67,7 +67,7 @@ extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
/* default windowBits for decompression. MAX_WBITS is for compression only */
#if MAX_MEM_LEVEL >= 8
# define DEF_MEM_LEVEL 8
# define DEF_MEM_LEVEL 9
#else
# define DEF_MEM_LEVEL MAX_MEM_LEVEL
#endif

View File

@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CDVDiso", "CDVDiso_2008.vcproj", "{BB27CC2C-28D1-4438-A0DF-3E120D01EDEC}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CDVDiso_vs2008", "CDVDiso\src\Win32\CDVDiso_vs2008.vcproj", "{5F78E90B-BD22-47B1-9CA5-7A80F4DF5EF3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -9,10 +9,10 @@ Global
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{BB27CC2C-28D1-4438-A0DF-3E120D01EDEC}.Debug|Win32.ActiveCfg = Debug|Win32
{BB27CC2C-28D1-4438-A0DF-3E120D01EDEC}.Debug|Win32.Build.0 = Debug|Win32
{BB27CC2C-28D1-4438-A0DF-3E120D01EDEC}.Release|Win32.ActiveCfg = Release|Win32
{BB27CC2C-28D1-4438-A0DF-3E120D01EDEC}.Release|Win32.Build.0 = Release|Win32
{5F78E90B-BD22-47B1-9CA5-7A80F4DF5EF3}.Debug|Win32.ActiveCfg = Debug|Win32
{5F78E90B-BD22-47B1-9CA5-7A80F4DF5EF3}.Debug|Win32.Build.0 = Debug|Win32
{5F78E90B-BD22-47B1-9CA5-7A80F4DF5EF3}.Release|Win32.ActiveCfg = Release|Win32
{5F78E90B-BD22-47B1-9CA5-7A80F4DF5EF3}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE