summaryrefslogtreecommitdiff
path: root/PcsxSrc/Win32
diff options
context:
space:
mode:
Diffstat (limited to 'PcsxSrc/Win32')
-rw-r--r--PcsxSrc/Win32/AboutDlg.c44
-rw-r--r--PcsxSrc/Win32/AboutDlg.h24
-rw-r--r--PcsxSrc/Win32/Cdrom02.icobin0 -> 1078 bytes
-rw-r--r--PcsxSrc/Win32/ConfigurePlugins.c471
-rw-r--r--PcsxSrc/Win32/Win32.h48
-rw-r--r--PcsxSrc/Win32/WndMain.c1044
-rw-r--r--PcsxSrc/Win32/pcsx.dsp350
-rw-r--r--PcsxSrc/Win32/pcsx.dsw29
-rw-r--r--PcsxSrc/Win32/pcsx.rc402
-rw-r--r--PcsxSrc/Win32/plugin.c191
-rw-r--r--PcsxSrc/Win32/plugin.h29
-rw-r--r--PcsxSrc/Win32/resource.h266
12 files changed, 2898 insertions, 0 deletions
diff --git a/PcsxSrc/Win32/AboutDlg.c b/PcsxSrc/Win32/AboutDlg.c
new file mode 100644
index 0000000..0a93fae
--- /dev/null
+++ b/PcsxSrc/Win32/AboutDlg.c
@@ -0,0 +1,44 @@
+/* Pcsx - Pc Psx Emulator
+ * Copyright (C) 1999-2002 Pcsx 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <windows.h>
+#include <windowsx.h>
+#include "resource.h"
+#include "AboutDlg.h"
+
+LRESULT WINAPI AboutDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+ switch(uMsg)
+ {
+ case WM_INITDIALOG:
+ {
+ Static_SetText(GetDlgItem(hDlg, IDC_PCSX_ABOUT_TEXT), "P©SX EMU\nVersion " PCSX_VERSION);
+ return TRUE;
+ }
+
+ case WM_COMMAND:
+ switch(wParam)
+ {
+ case IDOK:
+ EndDialog(hDlg, TRUE );
+ return TRUE;
+ }
+ break;
+ }
+ return FALSE;
+}
diff --git a/PcsxSrc/Win32/AboutDlg.h b/PcsxSrc/Win32/AboutDlg.h
new file mode 100644
index 0000000..4c71245
--- /dev/null
+++ b/PcsxSrc/Win32/AboutDlg.h
@@ -0,0 +1,24 @@
+/* Pcsx - Pc Psx Emulator
+ * Copyright (C) 1999-2002 Pcsx 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef _PCSX_ABOUTDLG_H_
+#define _PCSX_ABOUTDLG_H_
+
+LRESULT WINAPI AboutDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
+
+#endif \ No newline at end of file
diff --git a/PcsxSrc/Win32/Cdrom02.ico b/PcsxSrc/Win32/Cdrom02.ico
new file mode 100644
index 0000000..7a7038b
--- /dev/null
+++ b/PcsxSrc/Win32/Cdrom02.ico
Binary files differ
diff --git a/PcsxSrc/Win32/ConfigurePlugins.c b/PcsxSrc/Win32/ConfigurePlugins.c
new file mode 100644
index 0000000..5399dc1
--- /dev/null
+++ b/PcsxSrc/Win32/ConfigurePlugins.c
@@ -0,0 +1,471 @@
+/* Pcsx - Pc Psx Emulator
+ * Copyright (C) 1999-2002 Pcsx 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <windows.h>
+#include <windowsx.h>
+#include <stdio.h>
+#include "PsxCommon.h"
+#include "plugin.h"
+#include "resource.h"
+#include "Win32.h"
+
+#define QueryKeyV(s, name, var) \
+ size = s; \
+ if (RegQueryValueEx(myKey, name, 0, &type, (LPBYTE) var, &size) != 0) { if (err) { RegCloseKey(myKey); return -1; } }
+
+#define SetKeyV(name, var, s, t) \
+ RegSetValueEx(myKey, name, 0, t, (LPBYTE) var, s);
+
+int LoadConfig() {
+ HKEY myKey;
+ DWORD type,size;
+ PcsxConfig *Conf = &Config;
+ int err;
+
+ if (RegOpenKeyEx(HKEY_CURRENT_USER,"Software\\Pcsx",0,KEY_ALL_ACCESS,&myKey)!=ERROR_SUCCESS) return -1;
+
+ err = 1;
+ QueryKeyV(256, "Bios", Conf->Bios);
+ QueryKeyV(256, "Gpu", Conf->Gpu);
+ QueryKeyV(256, "Spu", Conf->Spu);
+ QueryKeyV(256, "Cdr", Conf->Cdr);
+ QueryKeyV(256, "Pad1", Conf->Pad1);
+ QueryKeyV(256, "Pad2", Conf->Pad2);
+ QueryKeyV(256, "Mcd1", Conf->Mcd1);
+ QueryKeyV(256, "Mcd2", Conf->Mcd2);
+ QueryKeyV(256, "PluginsDir", Conf->PluginsDir);
+ QueryKeyV(256, "BiosDir", Conf->BiosDir);
+ err = 0;
+ QueryKeyV(sizeof(Conf->Xa), "Xa", &Conf->Xa);
+ QueryKeyV(sizeof(Conf->Sio), "Sio", &Conf->Sio);
+ QueryKeyV(sizeof(Conf->Mdec), "Mdec", &Conf->Mdec);
+ QueryKeyV(sizeof(Conf->PsxAuto), "PsxAuto", &Conf->PsxAuto);
+ QueryKeyV(sizeof(Conf->PsxType), "PsxType", &Conf->PsxType);
+ QueryKeyV(sizeof(Conf->QKeys), "QKeys", &Conf->QKeys);
+ QueryKeyV(sizeof(Conf->Cdda), "Cdda", &Conf->Cdda);
+ QueryKeyV(sizeof(Conf->Cpu), "Cpu", &Conf->Cpu);
+ QueryKeyV(sizeof(Conf->PsxOut), "PsxOut", &Conf->PsxOut);
+ QueryKeyV(sizeof(Conf->SpuIrq), "SpuIrq", &Conf->SpuIrq);
+ QueryKeyV(sizeof(Conf->CdTiming),"CdTiming",&Conf->CdTiming);
+
+ RegCloseKey(myKey);
+
+ return 0;
+}
+
+/////////////////////////////////////////////////////////
+
+void SaveConfig() {
+ HKEY myKey;
+ DWORD myDisp;
+ PcsxConfig *Conf = &Config;
+
+ RegCreateKeyEx(HKEY_CURRENT_USER,"Software\\Pcsx",0,NULL,REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS,NULL,&myKey,&myDisp);
+
+ SetKeyV("Bios", Conf->Bios, strlen(Conf->Bios), REG_SZ);
+ SetKeyV("Gpu", Conf->Gpu, strlen(Conf->Gpu), REG_SZ);
+ SetKeyV("Spu", Conf->Spu, strlen(Conf->Spu), REG_SZ);
+ SetKeyV("Cdr", Conf->Cdr, strlen(Conf->Cdr), REG_SZ);
+ SetKeyV("Pad1", Conf->Pad1, strlen(Conf->Pad1), REG_SZ);
+ SetKeyV("Pad2", Conf->Pad2, strlen(Conf->Pad2), REG_SZ);
+ SetKeyV("Mcd1", Conf->Mcd1, strlen(Conf->Mcd1), REG_SZ);
+ SetKeyV("Mcd2", Conf->Mcd2, strlen(Conf->Mcd2), REG_SZ);
+ SetKeyV("PluginsDir", Conf->PluginsDir, strlen(Conf->PluginsDir), REG_SZ);
+ SetKeyV("BiosDir", Conf->BiosDir, strlen(Conf->BiosDir), REG_SZ);
+ SetKeyV("Xa", &Conf->Xa, sizeof(Conf->Xa), REG_DWORD);
+ SetKeyV("Sio", &Conf->Sio, sizeof(Conf->Sio), REG_DWORD);
+ SetKeyV("Mdec", &Conf->Mdec, sizeof(Conf->Mdec), REG_DWORD);
+ SetKeyV("PsxAuto", &Conf->PsxAuto, sizeof(Conf->PsxAuto), REG_DWORD);
+ SetKeyV("PsxType", &Conf->PsxType, sizeof(Conf->PsxType), REG_DWORD);
+ SetKeyV("QKeys", &Conf->QKeys, sizeof(Conf->QKeys), REG_DWORD);
+ SetKeyV("Cdda", &Conf->Cdda, sizeof(Conf->Cdda), REG_DWORD);
+ SetKeyV("Cpu", &Conf->Cpu, sizeof(Conf->Cpu), REG_DWORD);
+ SetKeyV("PsxOut", &Conf->PsxOut, sizeof(Conf->PsxOut), REG_DWORD);
+ SetKeyV("SpuIrq", &Conf->SpuIrq, sizeof(Conf->SpuIrq), REG_DWORD);
+ SetKeyV("CdTiming",&Conf->CdTiming,sizeof(Conf->SpuIrq), REG_DWORD);
+
+ RegCloseKey(myKey);
+}
+
+/////////////////////////////////////////////////////////
+
+#define ComboAddPlugin(hw, str) { \
+ lp = (char *)malloc(strlen(FindData.cFileName)+8); \
+ sprintf(lp, "%s", FindData.cFileName); \
+ i = ComboBox_AddString(hw, tmpStr); \
+ ComboBox_SetItemData(hw, i, lp); \
+ if (stricmp(str, lp)==0) \
+ ComboBox_SetCurSel(hw, i); \
+}
+
+BOOL OnConfigurePluginsDialog(HWND hW) {
+ WIN32_FIND_DATA FindData;
+ HANDLE Find;
+ HANDLE Lib;
+ PSEgetLibType PSE_GetLibType;
+ PSEgetLibName PSE_GetLibName;
+ PSEgetLibVersion PSE_GetLibVersion;
+ HWND hWC_GPU=GetDlgItem(hW,IDC_LISTGPU);
+ HWND hWC_SPU=GetDlgItem(hW,IDC_LISTSPU);
+ HWND hWC_CDR=GetDlgItem(hW,IDC_LISTCDR);
+ HWND hWC_PAD1=GetDlgItem(hW,IDC_LISTPAD1);
+ HWND hWC_PAD2=GetDlgItem(hW,IDC_LISTPAD2);
+ HWND hWC_BIOS=GetDlgItem(hW,IDC_LISTBIOS);
+ char tmpStr[256];
+ char *lp;
+ int i;
+
+ strcpy(tmpStr, Config.PluginsDir);
+ strcat(tmpStr, "*.dll");
+ Find = FindFirstFile(tmpStr, &FindData);
+
+ do {
+ if (Find==INVALID_HANDLE_VALUE) break;
+ sprintf(tmpStr,"%s%s", Config.PluginsDir, FindData.cFileName);
+ Lib = LoadLibrary(tmpStr);
+ if (Lib!=NULL) {
+ PSE_GetLibType = (PSEgetLibType) GetProcAddress((HMODULE)Lib,"PSEgetLibType");
+ PSE_GetLibName = (PSEgetLibName) GetProcAddress((HMODULE)Lib,"PSEgetLibName");
+ PSE_GetLibVersion = (PSEgetLibVersion) GetProcAddress((HMODULE)Lib,"PSEgetLibVersion");
+
+ if (PSE_GetLibType != NULL && PSE_GetLibName != NULL && PSE_GetLibVersion != NULL) {
+ unsigned long version = PSE_GetLibVersion();
+ long type;
+
+ sprintf(tmpStr, "%s %d.%d", PSE_GetLibName(), (version>>8)&0xff, version&0xff);
+ type = PSE_GetLibType();
+ if (type & PSE_LT_CDR) {
+ ComboAddPlugin(hWC_CDR, Config.Cdr);
+ }
+
+ if (type & PSE_LT_SPU) {
+ ComboAddPlugin(hWC_SPU, Config.Spu);
+ }
+
+ if (type & PSE_LT_GPU) {
+ ComboAddPlugin(hWC_GPU, Config.Gpu);
+ }
+
+ if (type & PSE_LT_PAD) {
+ PADquery query;
+
+ query = (PADquery)GetProcAddress((HMODULE)Lib, "PADquery");
+ if (query() & 0x1)
+ ComboAddPlugin(hWC_PAD1, Config.Pad1);
+ if (query() & 0x2)
+ ComboAddPlugin(hWC_PAD2, Config.Pad2);
+ }
+ }
+ }
+ } while (FindNextFile(Find,&FindData));
+
+ if (Find!=INVALID_HANDLE_VALUE) FindClose(Find);
+
+// BIOS
+
+ lp=(char *)malloc(strlen("HLE") + 1);
+ sprintf(lp, "HLE");
+ i=ComboBox_AddString(hWC_BIOS, "Internal HLE Bios");
+ ComboBox_SetItemData(hWC_BIOS, i, lp);
+ if (stricmp(Config.Bios, lp)==0)
+ ComboBox_SetCurSel(hWC_BIOS, i);
+
+ strcpy(tmpStr, Config.BiosDir);
+ strcat(tmpStr, "*");
+ Find=FindFirstFile(tmpStr, &FindData);
+
+ do {
+ if (Find==INVALID_HANDLE_VALUE) break;
+ if (!strcmp(FindData.cFileName, ".")) continue;
+ if (!strcmp(FindData.cFileName, "..")) continue;
+ if (FindData.nFileSizeLow != 1024 * 512) continue;
+ lp = (char *)malloc(strlen(FindData.cFileName)+8);
+ sprintf(lp, "%s", (char *)FindData.cFileName);
+ i = ComboBox_AddString(hWC_BIOS, FindData.cFileName);
+ ComboBox_SetItemData(hWC_BIOS, i, lp);
+ if (stricmp(Config.Bios, FindData.cFileName)==0)
+ ComboBox_SetCurSel(hWC_BIOS, i);
+ } while (FindNextFile(Find,&FindData));
+
+ if (Find!=INVALID_HANDLE_VALUE) FindClose(Find);
+
+ if (ComboBox_GetCurSel(hWC_CDR ) == -1)
+ ComboBox_SetCurSel(hWC_CDR, 0);
+ if (ComboBox_GetCurSel(hWC_GPU ) == -1)
+ ComboBox_SetCurSel(hWC_GPU, 0);
+ if (ComboBox_GetCurSel(hWC_SPU ) == -1)
+ ComboBox_SetCurSel(hWC_SPU, 0);
+ if (ComboBox_GetCurSel(hWC_PAD1) == -1)
+ ComboBox_SetCurSel(hWC_PAD1, 0);
+ if (ComboBox_GetCurSel(hWC_PAD2) == -1)
+ ComboBox_SetCurSel(hWC_PAD2, 0);
+ if (ComboBox_GetCurSel(hWC_BIOS) == -1)
+ ComboBox_SetCurSel(hWC_BIOS, 0);
+
+ return TRUE;
+}
+
+#define CleanCombo(item) \
+ hWC = GetDlgItem(hW, item); \
+ iCnt = ComboBox_GetCount(hWC); \
+ for (i=0; i<iCnt; i++) { \
+ lp = (char *)ComboBox_GetItemData(hWC, i); \
+ if (lp) free(lp); \
+ } \
+ ComboBox_ResetContent(hWC);
+
+void CleanUpCombos(HWND hW) {
+ int i,iCnt;HWND hWC;char * lp;
+
+ CleanCombo(IDC_LISTGPU);
+ CleanCombo(IDC_LISTSPU);
+ CleanCombo(IDC_LISTCDR);
+ CleanCombo(IDC_LISTPAD1);
+ CleanCombo(IDC_LISTPAD2);
+ CleanCombo(IDC_LISTBIOS);
+}
+
+
+void OnCancel(HWND hW) {
+ CleanUpCombos(hW);
+ EndDialog(hW,FALSE);
+}
+
+
+char *GetSelDLL(HWND hW,int id) {
+ HWND hWC = GetDlgItem(hW,id);
+ int iSel;
+ iSel = ComboBox_GetCurSel(hWC);
+ if (iSel<0) return NULL;
+ return (char *)ComboBox_GetItemData(hWC, iSel);
+}
+
+
+void OnOK(HWND hW) {
+ char * gpuDLL=GetSelDLL(hW,IDC_LISTGPU);
+ char * spuDLL=GetSelDLL(hW,IDC_LISTSPU);
+ char * cdrDLL=GetSelDLL(hW,IDC_LISTCDR);
+ char * pad1DLL=GetSelDLL(hW,IDC_LISTPAD1);
+ char * pad2DLL=GetSelDLL(hW,IDC_LISTPAD2);
+ char * biosFILE=GetSelDLL(hW,IDC_LISTBIOS);
+
+ if ((gpuDLL==NULL) || (spuDLL ==NULL) ||
+ (cdrDLL ==NULL) || (pad1DLL==NULL) ||
+ (pad2DLL==NULL) ||(biosFILE==NULL)) {
+ MessageBox(hW,"Configuration not OK!","Error",MB_OK|MB_ICONERROR);
+ return;
+ }
+
+ strcpy(Config.Bios, biosFILE);
+ strcpy(Config.Gpu, gpuDLL);
+ strcpy(Config.Spu, spuDLL);
+ strcpy(Config.Cdr, cdrDLL);
+ strcpy(Config.Pad1, pad1DLL);
+ strcpy(Config.Pad2, pad2DLL);
+
+ SaveConfig();
+
+ CleanUpCombos(hW);
+
+ if (!ConfPlug) {
+ NeedReset = 1;
+ ReleasePlugins();
+ LoadPlugins();
+ }
+ EndDialog(hW,TRUE);
+}
+
+
+#define ConfPlugin(src, confs, name) \
+ void *drv; \
+ src conf; \
+ char * pDLL = GetSelDLL(hW, confs); \
+ char file[256]; \
+ if(pDLL==NULL) return; \
+ strcpy(file, Config.PluginsDir); \
+ strcat(file, pDLL); \
+ drv = SysLoadLibrary(file); \
+ if (drv == NULL) return; \
+ conf = (src) SysLoadSym(drv, name); \
+ if (SysLibError() == NULL) conf(); \
+ SysCloseLibrary(drv);
+
+void ConfigureGPU(HWND hW) {
+ ConfPlugin(GPUconfigure, IDC_LISTGPU, "GPUconfigure");
+}
+
+void ConfigureSPU(HWND hW) {
+ ConfPlugin(SPUconfigure, IDC_LISTSPU, "SPUconfigure");
+}
+
+void ConfigureCDR(HWND hW) {
+ ConfPlugin(CDRconfigure, IDC_LISTCDR, "CDRconfigure");
+}
+
+void ConfigurePAD1(HWND hW) {
+ ConfPlugin(PADconfigure, IDC_LISTPAD1, "PADconfigure");
+}
+
+void ConfigurePAD2(HWND hW) {
+ ConfPlugin(PADconfigure, IDC_LISTPAD2, "PADconfigure");
+}
+
+
+void AboutGPU(HWND hW) {
+ ConfPlugin(GPUabout, IDC_LISTGPU, "GPUabout");
+}
+
+void AboutSPU(HWND hW) {
+ ConfPlugin(SPUabout, IDC_LISTSPU, "SPUabout");
+}
+
+void AboutCDR(HWND hW) {
+ ConfPlugin(CDRabout, IDC_LISTCDR, "CDRabout");
+}
+
+void AboutPAD1(HWND hW) {
+ ConfPlugin(PADabout, IDC_LISTPAD1, "PADabout");
+}
+
+void AboutPAD2(HWND hW) {
+ ConfPlugin(PADabout, IDC_LISTPAD2, "PADabout");
+}
+
+
+#define TestPlugin(src, confs, name) \
+ void *drv; \
+ src conf; \
+ int ret = 0; \
+ char * pDLL = GetSelDLL(hW, confs); \
+ char file[256]; \
+ if (pDLL== NULL) return; \
+ strcpy(file, Config.PluginsDir); \
+ strcat(file, pDLL); \
+ drv = SysLoadLibrary(file); \
+ if (drv == NULL) return; \
+ conf = (src) SysLoadSym(drv, name); \
+ if (SysLibError() == NULL) ret = conf(); \
+ SysCloseLibrary(drv); \
+ SysMessage("This plugin reports that should %swork correctly",ret == 0 ? "" : "not ");
+
+void TestGPU(HWND hW) {
+ TestPlugin(GPUtest, IDC_LISTGPU, "GPUtest");
+}
+
+void TestSPU(HWND hW) {
+ TestPlugin(SPUtest, IDC_LISTSPU, "SPUtest");
+}
+
+void TestCDR(HWND hW) {
+ TestPlugin(CDRtest, IDC_LISTCDR, "CDRtest");
+}
+
+void TestPAD1(HWND hW) {
+ TestPlugin(PADtest, IDC_LISTPAD1, "PADtest");
+}
+
+void TestPAD2(HWND hW) {
+ TestPlugin(PADtest, IDC_LISTPAD2, "PADtest");
+}
+
+#include <shlobj.h>
+
+int SelectPath(HWND hW, char *Title, char *Path) {
+ LPITEMIDLIST pidl;
+ BROWSEINFO bi;
+ char Buffer[256];
+
+ bi.hwndOwner = hW;
+ bi.pidlRoot = NULL;
+ bi.pszDisplayName = Buffer;
+ bi.lpszTitle = Title;
+ bi.ulFlags = BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS;
+ bi.lpfn = NULL;
+ bi.lParam = 0;
+ if ((pidl = SHBrowseForFolder(&bi)) != NULL) {
+ if (SHGetPathFromIDList(pidl, Path)) {
+ int len = strlen(Path);
+
+ if (Path[len - 1] != '\\') { strcat(Path,"\\"); }
+ return 0;
+ }
+ }
+ return -1;
+}
+
+void SetPluginsDir(HWND hW) {
+ char Path[256];
+
+ if (SelectPath(hW, "Select Plugins Directory", Path) == -1) return;
+ strcpy(Config.PluginsDir, Path);
+ CleanUpCombos(hW);
+ OnConfigurePluginsDialog(hW);
+}
+
+void SetBiosDir(HWND hW) {
+ char Path[256];
+
+ if (SelectPath(hW, "Select Bios Directory", Path) == -1) return;
+ strcpy(Config.BiosDir, Path);
+ CleanUpCombos(hW);
+ OnConfigurePluginsDialog(hW);
+}
+
+BOOL CALLBACK ConfigurePluginsDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) {
+ switch(uMsg) {
+ case WM_INITDIALOG:
+ return OnConfigurePluginsDialog(hW);
+
+ case WM_COMMAND:
+ switch(LOWORD(wParam)) {
+ case IDC_CONFIGGPU: ConfigureGPU(hW); return TRUE;
+ case IDC_CONFIGSPU: ConfigureSPU(hW); return TRUE;
+ case IDC_CONFIGCDR: ConfigureCDR(hW); return TRUE;
+ case IDC_CONFIGPAD1: ConfigurePAD1(hW); return TRUE;
+ case IDC_CONFIGPAD2: ConfigurePAD2(hW); return TRUE;
+
+ case IDC_TESTGPU: TestGPU(hW); return TRUE;
+ case IDC_TESTSPU: TestSPU(hW); return TRUE;
+ case IDC_TESTCDR: TestCDR(hW); return TRUE;
+ case IDC_TESTPAD1: TestPAD1(hW); return TRUE;
+ case IDC_TESTPAD2: TestPAD2(hW); return TRUE;
+
+ case IDC_ABOUTGPU: AboutGPU(hW); return TRUE;
+ case IDC_ABOUTSPU: AboutSPU(hW); return TRUE;
+ case IDC_ABOUTCDR: AboutCDR(hW); return TRUE;
+ case IDC_ABOUTPAD1: AboutPAD1(hW); return TRUE;
+ case IDC_ABOUTPAD2: AboutPAD2(hW); return TRUE;
+
+ case IDC_PLUGINSDIR: SetPluginsDir(hW); return TRUE;
+ case IDC_BIOSDIR: SetBiosDir(hW); return TRUE;
+
+ case IDCANCEL: OnCancel(hW); return TRUE;
+ case IDOK: OnOK(hW); return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+
+void ConfigurePlugins(HWND hWnd) {
+ DialogBox(gApp.hInstance,
+ MAKEINTRESOURCE(IDD_CONFIG),
+ hWnd,
+ (DLGPROC)ConfigurePluginsDlgProc);
+}
+
diff --git a/PcsxSrc/Win32/Win32.h b/PcsxSrc/Win32/Win32.h
new file mode 100644
index 0000000..77954ad
--- /dev/null
+++ b/PcsxSrc/Win32/Win32.h
@@ -0,0 +1,48 @@
+/* Pcsx - Pc Psx Emulator
+ * Copyright (C) 1999-2002 Pcsx 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef __WIN32_H__
+#define __WIN32_H__
+
+AppData gApp;
+HANDLE hConsole;
+
+long LoadCdBios;
+extern int StatesC;
+extern int AccBreak;
+extern int NeedReset;
+extern int ConfPlug;
+int Running;
+char PcsxDir[256];
+
+LRESULT WINAPI MainWndProc(HWND, UINT, WPARAM, LPARAM);
+BOOL CALLBACK ConfigureMcdsDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam);
+BOOL CALLBACK ConfigureCpuDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam);
+
+void ConfigurePlugins(HWND hWnd);
+
+int Open_File_Proc(char *file);
+void Open_Mcd_Proc(HWND hW, int MCDID);
+void CreateMainWindow(int nCmdShow);
+void RunGui();
+void PADhandleKey(int key);
+
+int LoadConfig();
+void SaveConfig();
+
+#endif /* __WIN32_H__ */ \ No newline at end of file
diff --git a/PcsxSrc/Win32/WndMain.c b/PcsxSrc/Win32/WndMain.c
new file mode 100644
index 0000000..eaeab13
--- /dev/null
+++ b/PcsxSrc/Win32/WndMain.c
@@ -0,0 +1,1044 @@
+/* Pcsx - Pc Psx Emulator
+ * Copyright (C) 1999-2002 Pcsx 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <windows.h>
+#include <windowsx.h>
+#include <commctrl.h>
+#include <time.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdarg.h>
+
+#include "resource.h"
+#include "AboutDlg.h"
+
+#include "PsxCommon.h"
+#include "plugin.h"
+#include "Debug.h"
+#include "Win32.h"
+
+int AccBreak=0;
+int ConfPlug=0;
+int StatesC=0;
+int NeedReset=1;
+int cdOpenCase=0;
+
+int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
+ gApp.hInstance = hInstance;
+
+ Running=0;
+
+ GetCurrentDirectory(256, PcsxDir);
+
+ memset(&Config, 0, sizeof(PcsxConfig));
+ if (LoadConfig() == -1) {
+ Config.PsxAuto = 1;
+ strcpy(Config.PluginsDir, "Plugin\\");
+ strcpy(Config.BiosDir, "Bios\\");
+ SysMessage("Pcsx needs to be configured");
+ ConfPlug=1;
+ ConfigurePlugins(gApp.hWnd);
+ DialogBox(gApp.hInstance, MAKEINTRESOURCE(IDD_MCDCONF), gApp.hWnd, (DLGPROC)ConfigureMcdsDlgProc);
+ SysMessage("Pcsx now will quit, restart it");
+ return 0;
+ }
+
+ if (SysInit() == -1) return 1;
+
+ CreateMainWindow(nCmdShow);
+
+ RunGui();
+
+ return 0;
+}
+
+void RunGui() {
+ MSG msg;
+
+ PeekMessage(&msg, NULL, 0U, 0U, PM_NOREMOVE);
+
+ for (;;) {
+ if(PeekMessage(&msg, NULL, 0U, 0U, PM_REMOVE)) {
+ TranslateMessage(&msg);
+ DispatchMessage(&msg);
+ }
+ }
+}
+
+void OpenConsole() {
+ if (hConsole) return;
+ AllocConsole();
+ SetConsoleTitle("Psx Output");
+ hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
+}
+
+void CloseConsole() {
+ FreeConsole(); hConsole = NULL;
+}
+
+LRESULT WINAPI MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) {
+ char File[256];
+
+ switch (msg) {
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case ID_FILE_EXIT:
+ SysClose();
+ PostQuitMessage(0);
+ exit(0);
+ return TRUE;
+
+ case ID_FILE_RUN_CD:
+ LoadCdBios = 0;
+ SetMenu(hWnd, NULL);
+ OpenPlugins(hWnd);
+ SysReset();
+ NeedReset = 0;
+ CheckCdrom();
+ if (LoadCdrom() == -1) {
+ ClosePlugins();
+ AccBreak = 1;
+ DestroyWindow(gApp.hWnd);
+ CreateMainWindow(SW_SHOWNORMAL);
+ SetMenu(gApp.hWnd, gApp.hMenu);
+ SetCursor(LoadCursor(gApp.hInstance, IDC_ARROW));
+ ShowCursor(TRUE);
+ SysMessage("Could not load Cdrom\n");
+ return TRUE;
+ }
+ ShowCursor(FALSE);
+ Running = 1;
+ psxCpu->Execute();
+ return TRUE;
+
+ case ID_FILE_RUNCDBIOS:
+ LoadCdBios = 1;
+ SetMenu(hWnd, NULL);
+ OpenPlugins(hWnd);
+ ShowCursor(FALSE);
+ CheckCdrom();
+ SysReset();
+ NeedReset = 0;
+ Running = 1;
+ psxCpu->Execute();
+ return TRUE;
+
+ case ID_FILE_RUN_EXE:
+ if (!Open_File_Proc(File)) return TRUE;
+ SetMenu(hWnd, NULL);
+ OpenPlugins(hWnd);
+ SysReset();
+ NeedReset = 0;
+ Load(File);
+ Running = 1;
+ psxCpu->Execute();
+ return TRUE;
+
+ case ID_EMULATOR_RUN:
+ SetMenu(hWnd, NULL);
+ OpenPlugins(hWnd);
+ ShowCursor(FALSE);
+ if (NeedReset) { SysReset(); NeedReset = 0; }
+ Running = 1;
+ psxCpu->Execute();
+ return TRUE;
+
+ case ID_EMULATOR_RESET:
+ NeedReset = 1;
+ return TRUE;
+
+ case ID_CONFIGURATION_GRAPHICS:
+ GPU_configure();
+ return TRUE;
+
+ case ID_CONFIGURATION_SOUND:
+ SPU_configure();
+ return TRUE;
+
+ case ID_CONFIGURATION_CONTROLLERS:
+ PAD1_configure();
+ if (strcmp(Config.Pad1, Config.Pad2)) PAD2_configure();
+ return TRUE;
+
+ case ID_CONFIGURATION_CDROM:
+ CDR_configure();
+ return TRUE;
+
+ case ID_CONFIGURATION_MEMORYCARDMANAGER:
+ DialogBox(gApp.hInstance, MAKEINTRESOURCE(IDD_MCDCONF), hWnd, (DLGPROC)ConfigureMcdsDlgProc);
+ return TRUE;
+
+ case ID_CONFIGURATION_CPU:
+ DialogBox(gApp.hInstance, MAKEINTRESOURCE(IDD_CPUCONF), hWnd, (DLGPROC)ConfigureCpuDlgProc);
+ return TRUE;
+
+ case ID_CONFIGURATION:
+ ConfigurePlugins(hWnd);
+ return TRUE;
+
+ case ID_HELP_HELP:
+ ShellExecute(NULL, "open", "Readme.txt", NULL, NULL, SW_SHOWNORMAL);
+ return TRUE;
+
+ case ID_HELP_ABOUT:
+ DialogBox(gApp.hInstance, MAKEINTRESOURCE(ABOUT_DIALOG), hWnd, (DLGPROC)AboutDlgProc);
+ return TRUE;
+ }
+ break;
+
+ case WM_SYSKEYDOWN:
+ if (wParam != VK_F10)
+ return DefWindowProc(hWnd, msg, wParam, lParam);
+ case WM_KEYDOWN:
+ PADhandleKey(wParam);
+ return TRUE;
+
+ case WM_DESTROY:
+ if (!AccBreak) {
+ if (Running) ClosePlugins();
+ SysClose();
+ PostQuitMessage(0);
+ exit(0);
+ }
+ else AccBreak = 0;
+
+ return TRUE;
+
+ case WM_CREATE:
+ gApp.hMenu = LoadMenu(gApp.hInstance, MAKEINTRESOURCE(IDR_MENU1));
+ SetMenu(hWnd, gApp.hMenu);
+ break;
+
+ case WM_QUIT:
+ exit(0);
+ break;
+
+ default:
+ return DefWindowProc(hWnd, msg, wParam, lParam);
+ }
+
+ return FALSE;
+}
+
+HWND mcdDlg;
+McdBlock Blocks[2][15];
+int IconC[2][15];
+HIMAGELIST Iiml[2];
+HICON eICON;
+
+void CreateListView(int idc) {
+ HWND List;
+ LV_COLUMN col;
+
+ List = GetDlgItem(mcdDlg, idc);
+
+ col.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
+ col.fmt = LVCFMT_LEFT;
+
+ col.pszText = "Title";
+ col.cx = 170;
+ col.iSubItem = 0;
+
+ ListView_InsertColumn(List, 0, &col);
+
+ col.pszText = "Status";
+ col.cx = 50;
+ col.iSubItem = 1;
+
+ ListView_InsertColumn(List, 1, &col);
+
+ col.pszText = "Game ID";
+ col.cx = 90;
+ col.iSubItem = 2;
+
+ ListView_InsertColumn(List, 2, &col);
+
+ col.pszText = "Game";
+ col.cx = 80;
+ col.iSubItem = 3;
+
+ ListView_InsertColumn(List, 3, &col);
+}
+
+int GetRGB() {
+ HDC scrDC, memDC;
+ HBITMAP oldBmp = NULL;
+ HBITMAP curBmp = NULL;
+ COLORREF oldColor;
+ COLORREF curColor = RGB(255,255,255);
+ int i, R, G, B;
+
+ R = G = B = 1;
+
+ scrDC = CreateDC("DISPLAY", NULL, NULL, NULL);
+ memDC = CreateCompatibleDC(NULL);
+ curBmp = CreateCompatibleBitmap(scrDC, 1, 1);
+ oldBmp = (HBITMAP)SelectObject(memDC, curBmp);
+
+ for (i = 255; i >= 0; --i) {
+ oldColor = curColor;
+ curColor = SetPixel(memDC, 0, 0, RGB(i, i, i));
+
+ if (GetRValue(curColor) < GetRValue(oldColor)) ++R;
+ if (GetGValue(curColor) < GetGValue(oldColor)) ++G;
+ if (GetBValue(curColor) < GetBValue(oldColor)) ++B;
+ }
+
+ DeleteObject(oldBmp);
+ DeleteObject(curBmp);
+ DeleteDC(scrDC);
+ DeleteDC(memDC);
+
+ return (R * G * B);
+}
+
+HICON GetIcon(short *icon) {
+ ICONINFO iInfo;
+ HDC hDC;
+ char mask[16*16];
+ int x, y, c, Depth;
+
+ hDC = CreateIC("DISPLAY",NULL,NULL,NULL);
+ Depth=GetDeviceCaps(hDC, BITSPIXEL);
+ DeleteDC(hDC);
+
+ if (Depth == 16) {
+ if (GetRGB() == (32 * 32 * 32))
+ Depth = 15;
+ }
+
+ for (y=0; y<16; y++) {
+ for (x=0; x<16; x++) {
+ c = icon[y*16+x];
+ if (Depth == 15)
+ c = ((c&0x001f) << 10) | ((c&0x7c00) >> 10) | (c&0x03e0);
+ else
+ c = (c&0x001f) | ((c&0x7c00) << 1) | ((c&0x03e0) << 1);
+
+ icon[y*16+x] = c;
+ }
+ }
+
+ iInfo.fIcon = TRUE;
+ memset(mask, 0, 16*16);
+ iInfo.hbmMask = CreateBitmap(16, 16, 1, 1, mask);
+ iInfo.hbmColor = CreateBitmap(16, 16, 1, 16, icon);
+
+ return CreateIconIndirect(&iInfo);
+}
+
+HICON hICON[2][3][15];
+int aIover[2];
+int ani[2];
+
+void LoadMcdItems(int mcd, int idc) {
+ HWND List = GetDlgItem(mcdDlg, idc);
+ LV_ITEM item;
+ HIMAGELIST iml = Iiml[mcd-1];
+ int i, j;
+ HICON hIcon;
+ McdBlock *Info;
+
+ aIover[mcd-1]=0;
+ ani[mcd-1]=0;
+
+ ListView_DeleteAllItems(List);
+
+ for (i=0; i<15; i++) {
+
+ item.mask = LVIF_TEXT | LVIF_IMAGE;
+ item.iItem = i;
+ item.iImage = i;
+ item.pszText = LPSTR_TEXTCALLBACK;
+ item.iSubItem = 0;
+
+ IconC[mcd-1][i] = 0;
+ Info = &Blocks[mcd-1][i];
+
+ if ((Info->Flags & 0xF) == 1 && Info->IconCount != 0) {
+ hIcon = GetIcon(Info->Icon);
+
+ if (Info->IconCount > 1) {
+ for(j = 0; j < 3; j++)
+ hICON[mcd-1][j][i]=hIcon;
+ }
+ } else {
+ hIcon = eICON;
+ }
+
+ ImageList_ReplaceIcon(iml, -1, hIcon);
+ ListView_InsertItem(List, &item);
+ }
+}
+
+void UpdateMcdItems(int mcd, int idc) {
+ HWND List = GetDlgItem(mcdDlg, idc);
+ LV_ITEM item;
+ HIMAGELIST iml = Iiml[mcd-1];
+ int i, j;
+ McdBlock *Info;
+ HICON hIcon;
+
+ aIover[mcd-1]=0;
+ ani[mcd-1]=0;
+
+ for (i=0; i<15; i++) {
+
+ item.mask = LVIF_TEXT | LVIF_IMAGE;
+ item.iItem = i;
+ item.iImage = i;
+ item.pszText = LPSTR_TEXTCALLBACK;
+ item.iSubItem = 0;
+
+ IconC[mcd-1][i] = 0;
+ Info = &Blocks[mcd-1][i];
+
+ if ((Info->Flags & 0xF) == 1 && Info->IconCount != 0) {
+ hIcon = GetIcon(Info->Icon);
+
+ if (Info->IconCount > 1) {
+ for(j = 0; j < 3; j++)
+ hICON[mcd-1][j][i]=hIcon;
+ }
+ } else {
+ hIcon = eICON;
+ }
+
+ ImageList_ReplaceIcon(iml, i, hIcon);
+ ListView_SetItem(List, &item);
+ }
+ ListView_Update(List, -1);
+}
+
+void McdListGetDispInfo(int mcd, int idc, LPNMHDR pnmh) {
+ LV_DISPINFO *lpdi = (LV_DISPINFO *)pnmh;
+ McdBlock *Info;
+
+ Info = &Blocks[mcd-1][lpdi->item.iItem];
+
+ switch (lpdi->item.iSubItem) {
+ case 0:
+ switch (Info->Flags & 0xF) {
+ case 1:
+ lpdi->item.pszText = Info->Title;
+ break;
+ case 2:
+ lpdi->item.pszText = "mid link block";
+ break;
+ case 3:
+ lpdi->item.pszText = "terminiting link block";
+ break;
+ }
+ break;
+ case 1:
+ if ((Info->Flags & 0xF0) == 0xA0) {
+ if ((Info->Flags & 0xF) >= 1 &&
+ (Info->Flags & 0xF) <= 3) {
+ lpdi->item.pszText = "Deleted";
+ } else lpdi->item.pszText = "Free";
+ } else if ((Info->Flags & 0xF0) == 0x50)
+ lpdi->item.pszText = "Used";
+ else { lpdi->item.pszText = "Free"; }
+ break;
+ case 2:
+ if((Info->Flags & 0xF)==1)
+ lpdi->item.pszText = Info->ID;
+ break;
+ case 3:
+ if((Info->Flags & 0xF)==1)
+ lpdi->item.pszText = Info->Name;
+ break;
+ }
+}
+
+void McdListNotify(int mcd, int idc, LPNMHDR pnmh) {
+ switch (pnmh->code) {
+ case LVN_GETDISPINFO: McdListGetDispInfo(mcd, idc, pnmh); break;
+ }
+}
+
+void UpdateMcdDlg() {
+ int i;
+
+ for (i=1; i<16; i++) GetMcdBlockInfo(1, i, &Blocks[0][i-1]);
+ for (i=1; i<16; i++) GetMcdBlockInfo(2, i, &Blocks[1][i-1]);
+ UpdateMcdItems(1, IDC_LIST1);
+ UpdateMcdItems(2, IDC_LIST2);
+}
+
+void LoadMcdDlg() {
+ int i;
+
+ for (i=1; i<16; i++) GetMcdBlockInfo(1, i, &Blocks[0][i-1]);
+ for (i=1; i<16; i++) GetMcdBlockInfo(2, i, &Blocks[1][i-1]);
+ LoadMcdItems(1, IDC_LIST1);
+ LoadMcdItems(2, IDC_LIST2);
+}
+
+void UpdateMcdIcon(int mcd, int idc) {
+ HWND List = GetDlgItem(mcdDlg, idc);
+ HIMAGELIST iml = Iiml[mcd-1];
+ int i;
+ McdBlock *Info;
+ int *count;
+
+ if(!aIover[mcd-1]) {
+ ani[mcd-1]++;
+
+ for (i=0; i<15; i++) {
+ Info = &Blocks[mcd-1][i];
+ count = &IconC[mcd-1][i];
+
+ if ((Info->Flags & 0xF) != 1) continue;
+ if (Info->IconCount <= 1) continue;
+
+ if (*count < Info->IconCount) {
+ (*count)++;
+ aIover[mcd-1]=0;
+
+ if(ani[mcd-1] <= (Info->IconCount-1)) // last frame and below...
+ hICON[mcd-1][ani[mcd-1]][i] = GetIcon(&Info->Icon[(*count)*16*16]);
+ } else {
+ aIover[mcd-1]=1;
+ }
+ }
+
+ } else {
+
+ if (ani[mcd-1] > 1) ani[mcd-1] = 0; // 1st frame
+ else ani[mcd-1]++; // 2nd, 3rd frame
+
+ for(i=0;i<15;i++) {
+// RECT rect, hrect;
+
+ Info = &Blocks[mcd-1][i];
+
+ if (((Info->Flags & 0xF) == 1) && (Info->IconCount > 1))
+ ImageList_ReplaceIcon(iml, i, hICON[mcd-1][ani[mcd-1]][i]);
+
+/* GetWindowRect(List, &hrect);
+ ListView_GetItemRect(List, i, &rect, LVIR_ICON);
+ rect.left+= hrect.left; rect.right+= hrect.left;
+ rect.top+= hrect.top; rect.bottom+= hrect.top;
+
+// rect.left-= 12; rect.right-= 12; // quick fix
+
+ InvalidateRect(mcdDlg, &rect, FALSE);*/
+ }
+ ListView_Update(List, 0);
+ }
+}
+
+static int copy = 0, copymcd = 0;
+static int listsel = 0;
+
+BOOL CALLBACK ConfigureMcdsDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) {
+ char str[256];
+ LPBYTE lpAND, lpXOR;
+ LPBYTE lpA, lpX;
+ int i, j;
+
+ switch(uMsg) {
+ case WM_INITDIALOG:
+ mcdDlg = hW;
+
+ lpA=lpAND=(LPBYTE)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,(16*16));
+ lpX=lpXOR=(LPBYTE)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,(16*16));
+
+ for(i=0;i<16;i++)
+ {
+ for(j=0;j<16;j++)
+ {
+ *lpA++=0xff;
+ *lpX++=0;
+ }
+ }
+ eICON=CreateIcon(gApp.hInstance,16,16,1,1,lpAND,lpXOR);
+
+ HeapFree(GetProcessHeap(),0,lpAND);
+ HeapFree(GetProcessHeap(),0,lpXOR);
+
+ if (!strlen(Config.Mcd1)) strcpy(Config.Mcd1, "memcards\\Mcd001.mcr");
+ if (!strlen(Config.Mcd2)) strcpy(Config.Mcd2, "memcards\\Mcd002.mcr");
+ Edit_SetText(GetDlgItem(hW,IDC_MCD1), Config.Mcd1);
+ Edit_SetText(GetDlgItem(hW,IDC_MCD2), Config.Mcd2);
+
+ CreateListView(IDC_LIST1);
+ CreateListView(IDC_LIST2);
+
+ Iiml[0] = ImageList_Create(16, 16, ILC_COLOR16, 0, 0);
+ Iiml[1] = ImageList_Create(16, 16, ILC_COLOR16, 0, 0);
+
+ ListView_SetImageList(GetDlgItem(mcdDlg, IDC_LIST1), Iiml[0], LVSIL_SMALL);
+ ListView_SetImageList(GetDlgItem(mcdDlg, IDC_LIST2), Iiml[1], LVSIL_SMALL);
+
+ Button_Enable(GetDlgItem(hW, IDC_PASTE), FALSE);
+
+ LoadMcdDlg();
+
+ SetTimer(hW, 1, 250, NULL);
+
+ return TRUE;
+
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDC_COPYTO1:
+ copy = ListView_GetSelectionMark(GetDlgItem(mcdDlg, IDC_LIST2));
+ copymcd = 1;
+
+ Button_Enable(GetDlgItem(hW, IDC_PASTE), TRUE);
+ return TRUE;
+ case IDC_COPYTO2:
+ copy = ListView_GetSelectionMark(GetDlgItem(mcdDlg, IDC_LIST1));
+ copymcd = 2;
+
+ Button_Enable(GetDlgItem(hW, IDC_PASTE), TRUE);
+ return TRUE;
+ case IDC_PASTE:
+ if (MessageBox(hW, "Are you sure you want to paste this selection?", "Confirmation", MB_YESNO) == IDNO) return TRUE;
+
+ if (copymcd == 1) {
+ Edit_GetText(GetDlgItem(hW,IDC_MCD1), str, 256);
+ i = ListView_GetSelectionMark(GetDlgItem(mcdDlg, IDC_LIST1));
+
+ // save dir data + save data
+ memcpy(Mcd1Data + (i+1) * 128, Mcd2Data + (copy+1) * 128, 128);
+ SaveMcd(str, Mcd1Data, (i+1) * 128, 128);
+ memcpy(Mcd1Data + (i+1) * 1024 * 8, Mcd2Data + (copy+1) * 1024 * 8, 1024 * 8);
+ SaveMcd(str, Mcd1Data, (i+1) * 1024 * 8, 1024 * 8);
+ } else { // 2
+ Edit_GetText(GetDlgItem(hW,IDC_MCD2), str, 256);
+ i = ListView_GetSelectionMark(GetDlgItem(mcdDlg, IDC_LIST2));
+
+ // save dir data + save data
+ memcpy(Mcd2Data + (i+1) * 128, Mcd1Data + (copy+1) * 128, 128);
+ SaveMcd(str, Mcd2Data, (i+1) * 128, 128);
+ memcpy(Mcd2Data + (i+1) * 1024 * 8, Mcd1Data + (copy+1) * 1024 * 8, 1024 * 8);
+ SaveMcd(str, Mcd2Data, (i+1) * 1024 * 8, 1024 * 8);
+ }
+
+ UpdateMcdDlg();
+
+ return TRUE;
+ case IDC_DELETE1:
+ {
+ McdBlock *Info;
+ int mcd = 1;
+ int i, xor = 0, j;
+ unsigned char *data, *ptr;
+
+ Edit_GetText(GetDlgItem(hW,IDC_MCD1), str, 256);
+ i = ListView_GetSelectionMark(GetDlgItem(mcdDlg, IDC_LIST1));
+ data = Mcd1Data;
+
+ i++;
+
+ ptr = data + i * 128;
+
+ Info = &Blocks[mcd-1][i-1];
+
+ if ((Info->Flags & 0xF0) == 0xA0) {
+ if ((Info->Flags & 0xF) >= 1 &&
+ (Info->Flags & 0xF) <= 3) { // deleted
+ *ptr = 0x50 | (Info->Flags & 0xF);
+ } else return TRUE;
+ } else if ((Info->Flags & 0xF0) == 0x50) { // used
+ *ptr = 0xA0 | (Info->Flags & 0xF);
+ } else { return TRUE; }
+
+ for (j=0; j<127; j++) xor^=*ptr++;
+ *ptr = xor;
+
+ SaveMcd(str, data, i * 128, 128);
+ UpdateMcdDlg();
+ }
+
+ return TRUE;
+ case IDC_DELETE2:
+ {
+ McdBlock *Info;
+ int mcd = 2;
+ int i, xor = 0, j;
+ unsigned char *data, *ptr;
+
+ Edit_GetText(GetDlgItem(hW,IDC_MCD2), str, 256);
+ i = ListView_GetSelectionMark(GetDlgItem(mcdDlg, IDC_LIST2));
+ data = Mcd2Data;
+
+ i++;
+
+ ptr = data + i * 128;
+
+ Info = &Blocks[mcd-1][i-1];
+
+ if ((Info->Flags & 0xF0) == 0xA0) {
+ if ((Info->Flags & 0xF) >= 1 &&
+ (Info->Flags & 0xF) <= 3) { // deleted
+ *ptr = 0x50 | (Info->Flags & 0xF);
+ } else return TRUE;
+ } else if ((Info->Flags & 0xF0) == 0x50) { // used
+ *ptr = 0xA0 | (Info->Flags & 0xF);
+ } else { return TRUE; }
+
+ for (j=0; j<127; j++) xor^=*ptr++;
+ *ptr = xor;
+
+ SaveMcd(str, data, i * 128, 128);
+ UpdateMcdDlg();
+ }
+
+ return TRUE;
+
+ case IDC_MCDSEL1:
+ Open_Mcd_Proc(hW, 1);
+ return TRUE;
+ case IDC_MCDSEL2:
+ Open_Mcd_Proc(hW, 2);
+ return TRUE;
+ case IDC_RELOAD1:
+ Edit_GetText(GetDlgItem(hW,IDC_MCD1), str, 256);
+ LoadMcd(1, str);
+ UpdateMcdDlg();
+ return TRUE;
+ case IDC_RELOAD2:
+ Edit_GetText(GetDlgItem(hW,IDC_MCD2), str, 256);
+ LoadMcd(2, str);
+ UpdateMcdDlg();
+ return TRUE;
+ case IDC_FORMAT1:
+ if (MessageBox(hW, "Are you sure you want to format this Memory Card?", "Confirmation", MB_YESNO) == IDNO) return TRUE;
+ Edit_GetText(GetDlgItem(hW,IDC_MCD1), str, 256);
+ CreateMcd(str);
+ LoadMcd(1, str);
+ UpdateMcdDlg();
+ return TRUE;
+ case IDC_FORMAT2:
+ if (MessageBox(hW, "Are you sure you want to format this Memory Card?", "Confirmation", MB_YESNO) == IDNO) return TRUE;
+ Edit_GetText(GetDlgItem(hW,IDC_MCD2), str, 256);
+ CreateMcd(str);
+ LoadMcd(2, str);
+ UpdateMcdDlg();
+ return TRUE;
+ case IDCANCEL:
+ LoadMcds(Config.Mcd1, Config.Mcd2);
+
+ EndDialog(hW,FALSE);
+
+ return TRUE;
+ case IDOK:
+ Edit_GetText(GetDlgItem(hW,IDC_MCD1), Config.Mcd1, 256);
+ Edit_GetText(GetDlgItem(hW,IDC_MCD2), Config.Mcd2, 256);
+
+ LoadMcds(Config.Mcd1, Config.Mcd2);
+ SaveConfig();
+
+ EndDialog(hW,TRUE);
+
+ return TRUE;
+ }
+ case WM_NOTIFY:
+ switch (wParam) {
+ case IDC_LIST1: McdListNotify(1, IDC_LIST1, (LPNMHDR)lParam); break;
+ case IDC_LIST2: McdListNotify(2, IDC_LIST2, (LPNMHDR)lParam); break;
+ }
+ return TRUE;
+ case WM_TIMER:
+ UpdateMcdIcon(1, IDC_LIST1);
+ UpdateMcdIcon(2, IDC_LIST2);
+ return TRUE;
+ case WM_DESTROY:
+ DestroyIcon(eICON);
+ //KillTimer(hW, 1);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+BOOL CALLBACK ConfigureCpuDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) {
+ long tmp;
+
+ switch(uMsg) {
+ case WM_INITDIALOG:
+ Button_SetCheck(GetDlgItem(hW,IDC_XA), Config.Xa);
+ Button_SetCheck(GetDlgItem(hW,IDC_SIO), Config.Sio);
+ Button_SetCheck(GetDlgItem(hW,IDC_MDEC), Config.Mdec);
+ Button_SetCheck(GetDlgItem(hW,IDC_QKEYS), Config.QKeys);
+ Button_SetCheck(GetDlgItem(hW,IDC_CDDA), Config.Cdda);
+ Button_SetCheck(GetDlgItem(hW,IDC_PSXAUTO), Config.PsxAuto);
+ Button_SetCheck(GetDlgItem(hW,IDC_CPU), Config.Cpu);
+ Button_SetCheck(GetDlgItem(hW,IDC_PSXOUT), Config.PsxOut);
+ Button_SetCheck(GetDlgItem(hW,IDC_SPUIRQ), Config.SpuIrq);
+ Button_SetCheck(GetDlgItem(hW,IDC_CDTIMING),Config.CdTiming);
+ ComboBox_AddString(GetDlgItem(hW,IDC_PSXTYPES),"NTSC");
+ ComboBox_AddString(GetDlgItem(hW,IDC_PSXTYPES),"PAL");
+ ComboBox_SetCurSel(GetDlgItem(hW,IDC_PSXTYPES),Config.PsxType);
+
+ case WM_COMMAND: {
+ switch (LOWORD(wParam)) {
+ case IDCANCEL: EndDialog(hW,FALSE); return TRUE;
+ case IDOK:
+ tmp = ComboBox_GetCurSel(GetDlgItem(hW,IDC_PSXTYPES));
+ if (tmp == 0) Config.PsxType = 0;
+ else Config.PsxType = 1;
+
+ Config.Xa = Button_GetCheck(GetDlgItem(hW,IDC_XA));
+ Config.Sio = Button_GetCheck(GetDlgItem(hW,IDC_SIO));
+ Config.Mdec = Button_GetCheck(GetDlgItem(hW,IDC_MDEC));
+ Config.QKeys = Button_GetCheck(GetDlgItem(hW,IDC_QKEYS));
+ Config.Cdda = Button_GetCheck(GetDlgItem(hW,IDC_CDDA));
+ Config.PsxAuto = Button_GetCheck(GetDlgItem(hW,IDC_PSXAUTO));
+ tmp = Config.Cpu;
+ Config.Cpu = Button_GetCheck(GetDlgItem(hW,IDC_CPU));
+ if (tmp != Config.Cpu) {
+ psxCpu->Shutdown();
+ if (Config.Cpu)
+ psxCpu = &psxInt;
+ else psxCpu = &psxRec;
+ if (psxCpu->Init() == -1) {
+ SysClose();
+ exit(1);
+ }
+ psxCpu->Reset();
+ }
+ Config.PsxOut = Button_GetCheck(GetDlgItem(hW,IDC_PSXOUT));
+ Config.SpuIrq = Button_GetCheck(GetDlgItem(hW,IDC_SPUIRQ));
+ Config.CdTiming= Button_GetCheck(GetDlgItem(hW,IDC_CDTIMING));
+
+ SaveConfig();
+
+ EndDialog(hW,TRUE);
+
+ if (Config.PsxOut) OpenConsole();
+ else CloseConsole();
+
+ return TRUE;
+ }
+ }
+ }
+ return FALSE;
+}
+
+#define MAXFILENAME 256
+
+void Open_Mcd_Proc(HWND hW, int mcd) {
+ OPENFILENAME ofn;
+ char szFileName[MAXFILENAME];
+ char szFileTitle[MAXFILENAME];
+
+ memset(&szFileName, 0, sizeof(szFileName));
+ memset(&szFileTitle, 0, sizeof(szFileTitle));
+
+ ofn.lStructSize = sizeof(OPENFILENAME);
+ ofn.hwndOwner = hW;
+ ofn.lpstrFilter = "Psx Mcd Format (*.mcr;*.mc;*.mem;*.vgs;*.mcd;*.gme;*.ddf)\0*.mcr;*.mcd;*.mem;*.gme;*.mc;*.ddf\0Psx Memory Card (*.mcr;*.mc)\0*.mcr;0*.mc\0CVGS Memory Card (*.mem;*.vgs)\0*.mem;*.vgs\0Bleem Memory Card (*.mcd)\0*.mcd\0DexDrive Memory Card (*.gme)\0*.gme\0DataDeck Memory Card (*.ddf)\0*.ddf\0";;
+ ofn.lpstrCustomFilter = NULL;
+ ofn.nMaxCustFilter = 0;
+ ofn.nFilterIndex = 1;
+ ofn.lpstrFile = szFileName;
+ ofn.nMaxFile = MAXFILENAME;
+ ofn.lpstrInitialDir = "memcards";
+ ofn.lpstrFileTitle = szFileTitle;
+ ofn.nMaxFileTitle = MAXFILENAME;
+ ofn.lpstrTitle = NULL;
+ ofn.lpstrDefExt = "MCR";
+ ofn.Flags = OFN_HIDEREADONLY | OFN_NOCHANGEDIR;
+
+ if (GetOpenFileName ((LPOPENFILENAME)&ofn)) {
+ Edit_SetText(GetDlgItem(hW,mcd == 1 ? IDC_MCD1 : IDC_MCD2), szFileName);
+ LoadMcd(mcd, szFileName);
+ UpdateMcdDlg();
+ }
+}
+
+int Open_File_Proc(char *file) {
+ OPENFILENAME ofn;
+ char szFileName[MAXFILENAME];
+ char szFileTitle[MAXFILENAME];
+
+ memset(&szFileName, 0, sizeof(szFileName));
+ memset(&szFileTitle, 0, sizeof(szFileTitle));
+
+ ofn.lStructSize = sizeof(OPENFILENAME);
+ ofn.hwndOwner = gApp.hWnd;
+ ofn.lpstrFilter = "Psx Exe Format\0*.*;*.*\0";
+ ofn.lpstrCustomFilter = NULL;
+ ofn.nMaxCustFilter = 0;
+ ofn.nFilterIndex = 1;
+ ofn.lpstrFile = szFileName;
+ ofn.nMaxFile = MAXFILENAME;
+ ofn.lpstrInitialDir = NULL;
+ ofn.lpstrFileTitle = szFileTitle;
+ ofn.nMaxFileTitle = MAXFILENAME;
+ ofn.lpstrTitle = NULL;
+ ofn.lpstrDefExt = "EXE";
+ ofn.Flags = OFN_HIDEREADONLY | OFN_NOCHANGEDIR;
+
+ if (GetOpenFileName ((LPOPENFILENAME)&ofn)) {
+ strcpy(file, szFileName);
+ return 1;
+ } else
+ return 0;
+}
+
+void CreateMainWindow(int nCmdShow) {
+ char strTitle[20];
+ WNDCLASS wc;
+ HWND hWnd;
+ HDC hdc;
+ HPEN hpen;
+
+ LoadString(gApp.hInstance, IDS_TITLE, strTitle, 20);
+
+ wc.lpszClassName = "P©SX Main";
+ wc.lpfnWndProc = MainWndProc;
+ wc.style = 0;
+ wc.hInstance = gApp.hInstance;
+ wc.hIcon = LoadIcon(gApp.hInstance, MAKEINTRESOURCE(IDI_APP_ICON));
+ wc.hCursor = NULL;
+ wc.hbrBackground = (HBRUSH)(COLOR_MENUTEXT);
+ wc.lpszMenuName = 0;
+ wc.cbClsExtra = 0;
+ wc.cbWndExtra = 0;
+
+ RegisterClass(&wc);
+
+ hWnd = CreateWindow("P©SX Main",
+ strTitle,
+ WS_OVERLAPPED | WS_SYSMENU,
+ 20,
+ 20,
+ 320,
+ 240,
+ NULL,
+ NULL,
+ gApp.hInstance,
+ NULL);
+
+ gApp.hWnd = hWnd;
+
+ hdc = GetDC(hWnd);
+ hpen = CreatePen(PS_SOLID, 0, 0xffffff);
+
+ SelectObject(hdc, hpen);
+
+ ShowWindow(hWnd, nCmdShow);
+}
+
+int SysInit() {
+ if (Config.PsxOut) OpenConsole();
+
+ if (psxInit() == -1) return -1;
+
+ #ifdef GTE_DUMP
+ gteLog = fopen("gteLog.txt","w");
+ #endif
+
+#ifdef EMU_LOG
+ emuLog = fopen("emuLog.txt","w");
+ setvbuf(emuLog, NULL, _IONBF, 0);
+#endif
+
+ LoadPlugins();
+ LoadMcds(Config.Mcd1, Config.Mcd2);
+
+ return 0;
+}
+
+void SysReset() {
+ psxReset();
+}
+
+
+void SysClose() {
+ psxShutdown();
+ ReleasePlugins();
+
+ if (Config.PsxOut) CloseConsole();
+
+ if (emuLog != NULL) fclose(emuLog);
+ #ifdef GTE_DUMP
+ if (gteLog != NULL) fclose(gteLog);
+ #endif
+}
+
+void SysPrintf(char *fmt, ...) {
+ va_list list;
+ char msg[512];
+ DWORD tmp;
+
+ if (!hConsole) return;
+
+ va_start(list,fmt);
+ vsprintf(msg,fmt,list);
+ va_end(list);
+
+ WriteConsole(hConsole, msg, (DWORD)strlen(msg), &tmp, 0);
+#ifdef EMU_LOG
+#ifndef LOG_STDOUT
+ fprintf(emuLog, "%s", msg);
+#endif
+#endif
+}
+
+void SysMessage(char *fmt, ...) {
+ va_list list;
+ char tmp[512];
+
+ va_start(list,fmt);
+ vsprintf(tmp,fmt,list);
+ va_end(list);
+ MessageBox(0, tmp, "Pcsx Msg", 0);
+}
+
+static char *err = "Error Loading Symbol";
+static int errval;
+
+void *SysLoadLibrary(char *lib) {
+ return LoadLibrary(lib);
+}
+
+void *SysLoadSym(void *lib, char *sym) {
+ void *tmp = GetProcAddress((HINSTANCE)lib, sym);
+ if (tmp == NULL) errval = 1;
+ else errval = 0;
+ return tmp;
+}
+
+char *SysLibError() {
+ if (errval) { errval = 0; return err; }
+ return NULL;
+}
+
+void SysCloseLibrary(void *lib) {
+ FreeLibrary((HINSTANCE)lib);
+}
+
+void SysUpdate() {
+ MSG msg;
+
+ PeekMessage(&msg, NULL, 0U, 0U, PM_NOREMOVE);
+
+ while (PeekMessage(&msg, NULL, 0U, 0U, PM_REMOVE)) {
+ TranslateMessage(&msg);
+ DispatchMessage(&msg);
+ }
+}
+
+void SysRunGui() {
+ RunGui();
+} \ No newline at end of file
diff --git a/PcsxSrc/Win32/pcsx.dsp b/PcsxSrc/Win32/pcsx.dsp
new file mode 100644
index 0000000..0cd948b
--- /dev/null
+++ b/PcsxSrc/Win32/pcsx.dsp
@@ -0,0 +1,350 @@
+# Microsoft Developer Studio Project File - Name="pcsx" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Application" 0x0101
+
+CFG=PCSX - WIN32 RELEASE
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "pcsx.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "pcsx.mak" CFG="PCSX - WIN32 RELEASE"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "pcsx - Win32 Release" (based on "Win32 (x86) Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /O2 /I "../" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "__WIN32__" /D PCSX_VERSION=\"1.3\" /D "__i386__" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x408 /d "NDEBUG"
+# ADD RSC /l 0x408 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib zlib.lib winmm.lib /nologo /subsystem:windows /machine:I386
+# Begin Target
+
+# Name "pcsx - Win32 Release"
+# Begin Group "GUI"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\AboutDlg.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\AboutDlg.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\resource.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\Win32.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\WndMain.c
+# End Source File
+# End Group
+# Begin Group "Bios"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\PsxBios.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\PsxBios.h
+# End Source File
+# End Group
+# Begin Group "CdRom"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\CdRom.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\CdRom.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\Decode_XA.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\Decode_XA.h
+# End Source File
+# End Group
+# Begin Group "GPU-SPU-SIO"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\Sio.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\Sio.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\Spu.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\Spu.h
+# End Source File
+# End Group
+# Begin Group "Debugger"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\Debug.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\DisR3000A.c
+# End Source File
+# End Group
+# Begin Group "GTE"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\Gte.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\Gte.h
+# End Source File
+# End Group
+# Begin Group "Memory"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\PsxMem.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\PsxMem.h
+# End Source File
+# End Group
+# Begin Group "Plugins system"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\ConfigurePlugins.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\plugin.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\plugin.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\plugins.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\plugins.h
+# End Source File
+# End Group
+# Begin Group "CPU"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\PsxInterpreter.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\R3000A.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\R3000A.h
+# End Source File
+# End Group
+# Begin Group "Hardware registers"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\PsxHw.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\PsxHw.h
+# End Source File
+# End Group
+# Begin Group "DMA"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\PsxDma.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\PsxDma.h
+# End Source File
+# End Group
+# Begin Group "Mdec"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\Mdec.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\Mdec.h
+# End Source File
+# End Group
+# Begin Group "Misc"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\Coff.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\Misc.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\Misc.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\System.h
+# End Source File
+# End Group
+# Begin Group "Counters"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\PsxCounters.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\PsxCounters.h
+# End Source File
+# End Group
+# Begin Group "ix86"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\ix86\iR3000A.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ix86\ix86.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ix86\ix86.h
+# End Source File
+# End Group
+# Begin Group "HLE"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\PsxHLE.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\PsxHLE.h
+# End Source File
+# End Group
+# Begin Group "Docs"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\Docs\ChangeLog.txt
+# End Source File
+# Begin Source File
+
+SOURCE=..\Docs\CodingStyle.txt
+# End Source File
+# Begin Source File
+
+SOURCE=..\Docs\License.txt
+# End Source File
+# Begin Source File
+
+SOURCE=..\Docs\Readme.txt
+# End Source File
+# Begin Source File
+
+SOURCE=..\Docs\ToDo.txt
+# End Source File
+# End Group
+# Begin Source File
+
+SOURCE=.\Cdrom02.ico
+# End Source File
+# Begin Source File
+
+SOURCE=.\pcsx.rc
+# End Source File
+# Begin Source File
+
+SOURCE=..\pcsxAbout.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=..\PSEmu_Plugin_Defs.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\PsxCommon.h
+# End Source File
+# End Target
+# End Project
diff --git a/PcsxSrc/Win32/pcsx.dsw b/PcsxSrc/Win32/pcsx.dsw
new file mode 100644
index 0000000..038983b
--- /dev/null
+++ b/PcsxSrc/Win32/pcsx.dsw
@@ -0,0 +1,29 @@
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "pcsx"=.\pcsx.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/PcsxSrc/Win32/pcsx.rc b/PcsxSrc/Win32/pcsx.rc
new file mode 100644
index 0000000..40723e0
--- /dev/null
+++ b/PcsxSrc/Win32/pcsx.rc
@@ -0,0 +1,402 @@
+//Microsoft Developer Studio generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_MCDCONF DIALOG DISCARDABLE 0, 0, 407, 197
+STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "P©SX Memcard Manager"
+FONT 8, "MS Sans Serif"
+BEGIN
+ DEFPUSHBUTTON "OK",IDOK,285,175,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,345,175,50,14
+ EDITTEXT IDC_MCD1,10,155,160,14,ES_AUTOHSCROLL
+ EDITTEXT IDC_MCD2,235,155,160,14,ES_AUTOHSCROLL
+ PUSHBUTTON "Select Mcd",IDC_MCDSEL1,10,135,50,14
+ PUSHBUTTON "Select Mcd",IDC_MCDSEL2,235,135,50,14
+ GROUPBOX "Memory Card 2",IDC_STATIC,230,5,170,125
+ PUSHBUTTON "Format Mcd",IDC_FORMAT1,65,135,50,14
+ GROUPBOX "Memory Card 1",IDC_STATIC,5,5,170,125
+ PUSHBUTTON "Format Mcd",IDC_FORMAT2,290,135,50,14
+ CONTROL "List3",IDC_LIST1,"SysListView32",LVS_REPORT |
+ LVS_ALIGNLEFT | WS_BORDER | WS_TABSTOP,10,15,160,110
+ CONTROL "List3",IDC_LIST2,"SysListView32",LVS_REPORT |
+ LVS_ALIGNLEFT | WS_BORDER | WS_TABSTOP,235,15,160,110
+ PUSHBUTTON "Reload Mcd",IDC_RELOAD1,120,135,50,14
+ PUSHBUTTON "Reload Mcd",IDC_RELOAD2,345,135,50,14
+ PUSHBUTTON "-> Copy ->",IDC_COPYTO2,180,30,45,14
+ PUSHBUTTON "<- Copy <-",IDC_COPYTO1,180,50,45,14
+ PUSHBUTTON "Paste",IDC_PASTE,180,70,45,14
+ PUSHBUTTON "<- Un/Delete",IDC_DELETE1,180,90,45,14
+ PUSHBUTTON "Un/Delete ->",IDC_DELETE2,180,110,45,14
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO DISCARDABLE
+BEGIN
+ IDD_MCDCONF, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 400
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 190
+ END
+END
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// String Table
+//
+
+STRINGTABLE DISCARDABLE
+BEGIN
+ IDS_TITLE "P©SX"
+END
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.K.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+ABOUT_DIALOG DIALOGEX 0, 0, 332, 166
+STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "About"
+FONT 8, "MS Sans Serif", 0, 0, 0x1
+BEGIN
+ DEFPUSHBUTTON "OK",IDOK,135,145,50,14
+ CTEXT "PCSX EMU\nVersion x.x",IDC_PCSX_ABOUT_TEXT,55,10,40,15,
+ 0,WS_EX_TRANSPARENT
+ CTEXT "PCSX a psx emulator\n\nwritten by:\nmain coder: linuzappz\nco-coders: shadow\nex-coders: Nocomp, Pete Bernett, nik3d\nWebmaster: AkumaX",
+ IDC_STATIC,10,35,135,55,0,WS_EX_TRANSPARENT
+ CTEXT "Greets to: Duddie, Tratax, Kazzuya, JNS, Bobbi\nSpecial thanks to : Twin (we Love you twin0r), Roor (love for you too), calb (Thanks for help :) ), now3d (for great help to my psxdev stuff :) )",
+ IDC_STATIC,45,110,232,25
+ CONTROL 113,IDC_STATIC,"Static",SS_BITMAP | WS_BORDER,155,10,171,
+ 86
+ GROUPBOX "",IDC_STATIC,5,25,145,70
+ GROUPBOX "",IDC_STATIC,43,100,235,40
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO DISCARDABLE
+BEGIN
+ ABOUT_DIALOG, DIALOG
+ BEGIN
+ RIGHTMARGIN, 310
+ BOTTOMMARGIN, 158
+ END
+END
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Menu
+//
+
+IDR_MENU1 MENU DISCARDABLE
+BEGIN
+ POPUP "&File"
+ BEGIN
+ MENUITEM "Run &CD", ID_FILE_RUN_CD
+ MENUITEM "Run CD Though &Bios", ID_FILE_RUNCDBIOS
+ MENUITEM "Run &EXE", ID_FILE_RUN_EXE
+ MENUITEM SEPARATOR
+ MENUITEM "E&xit", ID_FILE_EXIT
+ END
+ POPUP "&Emulator"
+ BEGIN
+ MENUITEM "&Run", ID_EMULATOR_RUN
+ MENUITEM "Re&set", ID_EMULATOR_RESET
+ END
+ POPUP "&Configuration"
+ BEGIN
+ MENUITEM "&Plugins && Bios", ID_CONFIGURATION
+ MENUITEM SEPARATOR
+ MENUITEM "&Graphics", ID_CONFIGURATION_GRAPHICS
+ MENUITEM "&Sound", ID_CONFIGURATION_SOUND
+ MENUITEM "CD-&ROM", ID_CONFIGURATION_CDROM
+ MENUITEM "&Controllers", ID_CONFIGURATION_CONTROLLERS
+ MENUITEM SEPARATOR
+ MENUITEM "C&PU", ID_CONFIGURATION_CPU
+ MENUITEM "&Memory cards", ID_CONFIGURATION_MEMORYCARDMANAGER
+
+ END
+ POPUP "Help"
+ BEGIN
+ MENUITEM "&Help", ID_HELP_HELP
+ MENUITEM SEPARATOR
+ MENUITEM "&About P©SX", ID_HELP_ABOUT
+ END
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDI_APP_ICON ICON DISCARDABLE ".\\Cdrom02.ico"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Bitmap
+//
+
+SPLASH_LOGO BITMAP DISCARDABLE "..\\pcsxAbout.bmp"
+#endif // English (U.K.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Spanish (Castilian) (unknown sub-lang: 0xB) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ESS)
+#ifdef _WIN32
+LANGUAGE LANG_SPANISH, 0xB
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_CPUCONF DIALOG DISCARDABLE 0, 0, 227, 161
+STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Cpu Config"
+FONT 8, "MS Sans Serif"
+BEGIN
+ DEFPUSHBUTTON "OK",IDOK,50,140,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,120,140,50,14
+ CONTROL "Disable Xa Decoding",IDC_XA,"Button",BS_AUTOCHECKBOX |
+ WS_TABSTOP,10,15,83,10
+ CONTROL "Sio Irq Always Enabled",IDC_SIO,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,10,30,88,10
+ CONTROL "Black && White Movies",IDC_MDEC,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,10,60,85,10
+ CONTROL "Autodetect",IDC_PSXAUTO,"Button",BS_AUTOCHECKBOX |
+ WS_TABSTOP,10,110,51,10
+ GROUPBOX "Misc Options",IDC_STATIC,5,5,220,85
+ COMBOBOX IDC_PSXTYPES,105,111,53,50,CBS_DROPDOWNLIST | CBS_SORT |
+ WS_VSCROLL | WS_TABSTOP
+ GROUPBOX "Select Psx System Type",IDC_STATIC,5,95,220,35
+ CONTROL "Disable Misc Quick Keys (F5-F8)",IDC_QKEYS,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,105,60,118,10
+ CONTROL "Disable Cd Audio",IDC_CDDA,"Button",BS_AUTOCHECKBOX |
+ WS_TABSTOP,105,15,70,10
+ CONTROL "Enable Console Output",IDC_PSXOUT,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,105,30,89,10
+ CONTROL "Enable Interpreter Cpu",IDC_CPU,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,105,45,87,10
+ CONTROL "Spu Irq Always Enabled",IDC_SPUIRQ,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,10,45,91,10
+ CONTROL "Old Cdrom Timing (Gran Turismo...)",IDC_CDTIMING,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,10,75,125,10
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO DISCARDABLE
+BEGIN
+ IDD_CPUCONF, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 220
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 154
+ END
+END
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog Info
+//
+
+IDD_CPUCONF DLGINIT
+BEGIN
+ IDC_PSXTYPES, 0x403, 5, 0
+0x544e, 0x4353, "\000"
+ IDC_PSXTYPES, 0x403, 4, 0
+0x4150, 0x004c,
+ 0
+END
+
+#endif // Spanish (Castilian) (unknown sub-lang: 0xB) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Greek resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ELL)
+#ifdef _WIN32
+LANGUAGE LANG_GREEK, SUBLANG_DEFAULT
+#pragma code_page(1253)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_CONFIG DIALOG DISCARDABLE 0, 0, 322, 161
+STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Configuration"
+FONT 8, "MS Sans Serif"
+BEGIN
+ COMBOBOX IDC_LISTGPU,10,10,145,74,CBS_DROPDOWNLIST | WS_VSCROLL |
+ WS_TABSTOP
+ PUSHBUTTON "Configure...",IDC_CONFIGGPU,10,30,45,12
+ PUSHBUTTON "Test...",IDC_TESTGPU,60,30,45,12
+ PUSHBUTTON "About...",IDC_ABOUTGPU,110,30,45,12
+ COMBOBOX IDC_LISTSPU,165,10,145,74,CBS_DROPDOWNLIST | WS_VSCROLL |
+ WS_TABSTOP
+ PUSHBUTTON "Configure...",IDC_CONFIGSPU,165,30,45,12
+ PUSHBUTTON "Test...",IDC_TESTSPU,215,30,45,12
+ PUSHBUTTON "About...",IDC_ABOUTSPU,265,30,43,12
+ COMBOBOX IDC_LISTCDR,10,100,145,74,CBS_DROPDOWNLIST | WS_VSCROLL |
+ WS_TABSTOP
+ PUSHBUTTON "Configure...",IDC_CONFIGCDR,10,120,43,12
+ PUSHBUTTON "Test...",IDC_TESTCDR,60,120,45,12
+ PUSHBUTTON "About...",IDC_ABOUTCDR,110,120,45,12
+ COMBOBOX IDC_LISTBIOS,165,100,145,74,CBS_DROPDOWNLIST |
+ WS_VSCROLL | WS_TABSTOP
+ DEFPUSHBUTTON "OK",IDOK,205,140,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,260,140,50,14
+ RTEXT "Graphics",IDC_STATIC,50,0,41,10,SS_CENTERIMAGE
+ RTEXT "Sound",IDC_STATIC,200,0,43,10,SS_CENTERIMAGE
+ RTEXT "Cdrom",IDC_STATIC,70,90,20,10,SS_CENTERIMAGE
+ RTEXT "Bios",IDC_STATIC,225,90,15,10,SS_CENTERIMAGE
+ COMBOBOX IDC_LISTPAD1,10,55,145,74,CBS_DROPDOWNLIST | WS_VSCROLL |
+ WS_TABSTOP
+ PUSHBUTTON "Configure...",IDC_CONFIGPAD1,10,75,45,12
+ PUSHBUTTON "Test...",IDC_TESTPAD1,60,75,45,12
+ PUSHBUTTON "About...",IDC_ABOUTPAD1,110,75,45,12
+ RTEXT "Second Controller",IDC_STATIC,205,45,58,10,
+ SS_CENTERIMAGE
+ COMBOBOX IDC_LISTPAD2,165,55,145,74,CBS_DROPDOWNLIST | WS_VSCROLL |
+ WS_TABSTOP
+ PUSHBUTTON "Configure...",IDC_CONFIGPAD2,165,75,45,12
+ PUSHBUTTON "Test...",IDC_TESTPAD2,215,75,45,12
+ PUSHBUTTON "About...",IDC_ABOUTPAD2,265,75,45,12
+ CTEXT "First Controller",IDC_STATIC,55,45,48,10,SS_CENTERIMAGE
+ PUSHBUTTON "Set Bios Directory",IDC_BIOSDIR,90,140,65,14
+ PUSHBUTTON "Set Plugins Directory",IDC_PLUGINSDIR,10,140,75,14
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO DISCARDABLE
+BEGIN
+ IDD_CONFIG, DIALOG
+ BEGIN
+ BOTTOMMARGIN, 147
+ END
+END
+#endif // APSTUDIO_INVOKED
+
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+#endif // Greek resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/PcsxSrc/Win32/plugin.c b/PcsxSrc/Win32/plugin.c
new file mode 100644
index 0000000..a705fb2
--- /dev/null
+++ b/PcsxSrc/Win32/plugin.c
@@ -0,0 +1,191 @@
+/* Pcsx - Pc Psx Emulator
+ * Copyright (C) 1999-2002 Pcsx 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <windows.h>
+#include <stdio.h>
+#include "plugins.h"
+#include "resource.h"
+#include <time.h>
+#include <stdio.h>
+#include "R3000A.h"
+#include "Win32.h"
+
+void PADhandleKey(int key) {
+ char Text[255];
+ int ret;
+
+ if (Running == 0) return;
+ switch (key) {
+ case 0: break;
+ case VK_F1:
+ sprintf (Text, "sstates/%s.%3.3d", CdromId, StatesC);
+ GPU_freeze(2, (GPUFreeze_t *)&StatesC);
+ ret = SaveState(Text);
+ sprintf (Text, "*PCSX*: %s State %d", !ret ? "Saved" : "Error Saving", StatesC+1);
+ GPU_displayText(Text);
+ return;
+
+ case VK_F2:
+ if (StatesC < 4) StatesC++;
+ else StatesC = 0;
+ GPU_freeze(2, (GPUFreeze_t *)&StatesC);
+ return;
+
+ case VK_F3:
+ sprintf (Text, "sstates/%s.%3.3d", CdromId, StatesC);
+ ret = LoadState(Text);
+ sprintf (Text, "*PCSX*: %s State %d", !ret ? "Loaded" : "Error Loading", StatesC+1);
+ GPU_displayText(Text);
+ return;
+
+ case VK_F4:
+ {
+ gzFile f;
+ static int ShowPic;
+ static unsigned char *pMem;
+
+ if (!ShowPic) {
+ sprintf (Text, "sstates/%s.%3.3d", CdromId, StatesC);
+ f = gzopen(Text, "rb");
+ if (f == NULL) return;
+
+ gzseek(f, 32, SEEK_SET); // skip header
+
+ pMem = (unsigned char *) malloc(128*96*3);
+ gzread(f, pMem, 128*96*3);
+ gzclose(f);
+ GPU_freeze(2, (GPUFreeze_t *)&StatesC);
+ GPU_showScreenPic(pMem);
+ free(pMem);
+ ShowPic = 1;
+ }
+ else {
+ GPU_showScreenPic(NULL);
+ ShowPic = 0;
+ }
+
+ }
+ return;
+
+ case VK_F5:
+ if (Config.QKeys) break;
+ Config.Sio ^= 0x1;
+ sprintf (Text, "*PCSX*: Sio Irq %sAlways Enabled", Config.Sio ? "" : "Not ");
+ GPU_displayText(Text);
+ return;
+
+ case VK_F6:
+ if (Config.QKeys) break;
+ Config.Mdec ^= 0x1;
+ sprintf (Text, "*PCSX*: Black&White Only Mdecs %sabled", Config.Mdec ? "En" : "Dis");
+ GPU_displayText(Text);
+ return;
+
+ case VK_F7:
+ if (Config.QKeys) break;
+ Config.Xa ^= 0x1;
+ sprintf (Text, "*PCSX*: Xa %sabled", !Config.Xa ? "En" : "Dis");
+ GPU_displayText(Text);
+ return;
+
+ case VK_F8:
+ if (Config.QKeys) break;
+ GPU_makeSnapshot();
+ return;
+
+ case VK_F9:
+ GPU_displayText("*PCSX*: CdRom Case Opened");
+ cdOpenCase = 1;
+ return;
+
+ case VK_F10:
+ GPU_displayText("*PCSX*: CdRom Case Closed");
+ cdOpenCase = 0;
+ return;
+
+ case VK_ESCAPE:
+ Running = 0;
+ ClosePlugins();
+ AccBreak = 1;
+ DestroyWindow(gApp.hWnd);
+ CreateMainWindow(SW_SHOWNORMAL);
+ SetMenu(gApp.hWnd, gApp.hMenu);
+ SetCursor(LoadCursor(gApp.hInstance, IDC_ARROW));
+ ShowCursor(TRUE);
+ RunGui();
+ return;
+ }
+}
+
+void CALLBACK SPUirq(void);
+
+void OpenPlugins(HWND hWnd) {
+ int ret;
+
+ ret = CDR_open();
+ if (ret != 0) { SysMessage ("Error Opening CDR Plugin\n"); exit(1); }
+ ShowCursor(FALSE);
+ ret = GPU_open(hWnd);
+ if (ret != 0) { SysMessage ("Error Opening GPU Plugin\n"); exit(1); }
+ ret = SPU_open(hWnd);
+ if (ret != 0) { SysMessage ("Error Opening SPU Plugin\n"); exit(1); }
+ SPU_registerCallback(SPUirq);
+ ret = PAD1_open(hWnd);
+ if (ret != 0) { SysMessage ("Error Opening PAD1 Plugin\n"); exit(1); }
+ ret = PAD2_open(hWnd);
+ if (ret != 0) { SysMessage ("Error Opening PAD2 Plugin\n"); exit(1); }
+ SetCurrentDirectory(PcsxDir);
+}
+
+void ClosePlugins() {
+ int ret;
+
+ ret = CDR_close();
+ if (ret != 0) { SysMessage ("Error Closing CDR Plugin\n"); exit(1); }
+ ret = GPU_close();
+ if (ret != 0) { SysMessage ("Error Closing GPU Plugin\n"); exit(1); }
+ ret = SPU_close();
+ if (ret != 0) { SysMessage ("Error Closing SPU Plugin\n"); exit(1); }
+ ret = PAD1_close();
+ if (ret != 0) { SysMessage ("Error Closing PAD1 Plugin\n"); exit(1); }
+ ret = PAD2_close();
+ if (ret != 0) { SysMessage ("Error Closing PAD2 Plugin\n"); exit(1); }
+ ShowCursor(TRUE);
+}
+
+void ResetPlugins() {
+ int ret;
+
+ CDR_shutdown();
+ GPU_shutdown();
+ SPU_shutdown();
+ PAD1_shutdown();
+ PAD2_shutdown();
+ ret = CDR_init();
+ if (ret != 0) { SysMessage ("CDRinit error : %d\n",ret); exit(1); }
+ ret = GPU_init();
+ if (ret != 0) { SysMessage ("GPUinit error : %d\n",ret); exit(1); }
+ ret = SPU_init();
+ if (ret != 0) { SysMessage ("SPUinit error : %d\n",ret); exit(1); }
+ ret = PAD1_init(1);
+ if (ret != 0) { SysMessage ("PAD1init error : %d\n",ret); exit(1); }
+ ret = PAD2_init(2);
+ if (ret != 0) { SysMessage ("PAD2init error : %d\n",ret); exit(1); }
+}
+
+
diff --git a/PcsxSrc/Win32/plugin.h b/PcsxSrc/Win32/plugin.h
new file mode 100644
index 0000000..bec7f7f
--- /dev/null
+++ b/PcsxSrc/Win32/plugin.h
@@ -0,0 +1,29 @@
+/* Pcsx - Pc Psx Emulator
+ * Copyright (C) 1999-2002 Pcsx 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+// Windows Specifyc Plugin Functions
+#ifndef __PLUGIN_H__
+#define __PLUGIN_H__
+
+typedef long (CALLBACK* GPUopen)(HWND);
+
+typedef long (CALLBACK* SPUopen)(HWND);
+
+typedef long (CALLBACK* PADopen)(HWND);
+
+#endif /* __PLUGIN_H__ */ \ No newline at end of file
diff --git a/PcsxSrc/Win32/resource.h b/PcsxSrc/Win32/resource.h
new file mode 100644
index 0000000..464846e
--- /dev/null
+++ b/PcsxSrc/Win32/resource.h
@@ -0,0 +1,266 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Developer Studio generated include file.
+// Used by pcsx.rc
+//
+#define IDS_TITLE 1
+#define IDR_MENU1 101
+#define IDI_APP_ICON 102
+#define IDD_MCDCONF 102
+#define DEBUG_DIALOG 103
+#define ABOUT_DIALOG 104
+#define IDD_CPUCONF 105
+#define SPLASH_LOGO 113
+#define IDD_GPREGS 114
+#define IDD_CP0REGS 115
+#define IDD_COP2D 116
+#define IDD_COP2C 117
+#define IDD_CONFIG 120
+#define IDD_MEMVIEW 136
+#define IDC_EDIT2 1001
+#define IDC_MCD2 1004
+#define IDC_ASMCHECK1 1005
+#define IDC_MCD1 1005
+#define IDC_MCDSEL1 1006
+#define IDC_STEP 1007
+#define IDC_MCDSEL2 1007
+#define IDC_XA 1007
+#define IDC_SIO 1008
+#define IDC_SKIP 1009
+#define IDC_MDEC 1009
+#define IDC_RESET 1010
+#define IDC_PSXAUTO 1010
+#define IDC_GO 1011
+#define IDC_PSXTYPES 1011
+#define IDC_BREAK 1012
+#define IDC_DISCPUQKEYS 1012
+#define IDC_QKEYS 1012
+#define IDC_EDIT1 1013
+#define IDC_CDDA 1013
+#define IDC_CLOSE 1014
+#define IDC_PCSX_ABOUT_TEXT 1014
+#define IDC_PSXOUT 1014
+#define IDC_ASM_SCROLL 1015
+#define IDC_CPU 1015
+#define IDC_ASMCHECK2 1016
+#define IDC_SPUIRQ 1016
+#define IDC_ASMCHECK3 1017
+#define IDC_MDEC2 1017
+#define IDC_CDTIMING 1017
+#define IDC_ASMCHECK4 1018
+#define IDC_ASMCHECK5 1019
+#define IDC_RELOAD1 1019
+#define IDC_CP07 1020
+#define IDC_ASMCHECK6 1020
+#define IDC_RELOAD2 1020
+#define IDC_ASMCHECK7 1021
+#define IDC_COPYTO2 1021
+#define IDC_ASMCHECK8 1022
+#define IDC_COPYTO1 1022
+#define IDC_ASMCHECK9 1023
+#define IDC_PASTE 1023
+#define IDC_ASMCHECK10 1024
+#define IDC_DELETE1 1024
+#define IDC_ASMCHECK11 1025
+#define IDC_DELETE2 1025
+#define IDC_ASMCHECK12 1026
+#define IDC_LIST1 1027
+#define IDC_ASMCHECK13 1027
+#define IDC_ASMCHECK14 1028
+#define IDC_LIST2 1028
+#define IDC_ASMCHECK15 1029
+#define IDC_ASMCHECK16 1030
+#define IDC_ASMCHECK17 1031
+#define IDC_ASMCHECK18 1032
+#define IDC_ASMCHECK19 1033
+#define IDC_CP021 1034
+#define IDC_ASMCHECK20 1034
+#define IDC_CP022 1035
+#define IDC_ASMCHECK21 1035
+#define IDC_CP023 1036
+#define IDC_ASMCHECK22 1036
+#define IDC_CP024 1037
+#define IDC_ASMCHECK23 1037
+#define IDC_CP025 1038
+#define IDC_ASMCHECK24 1038
+#define IDC_CP031 1044
+#define IDC_GPR0 1047
+#define IDC_GPR1 1048
+#define IDC_GPR2 1049
+#define IDC_GPR3 1050
+#define IDC_GPR4 1051
+#define IDC_GPR5 1052
+#define IDC_LISTGPU 1052
+#define IDC_GPR6 1053
+#define IDC_LISTSPU 1053
+#define IDC_GPR7 1054
+#define IDC_LISTCDR 1054
+#define IDC_GPR8 1055
+#define IDC_LISTBIOS 1055
+#define IDC_GPR9 1056
+#define IDC_CONFIGGPU 1056
+#define IDC_GPR10 1057
+#define IDC_TESTGPU 1057
+#define IDC_ABOUTGPU 1058
+#define IDC_CONFIGSPU 1059
+#define IDC_TESTSPU 1060
+#define IDC_ABOUTSPU 1061
+#define IDC_CONFIGCDR 1062
+#define IDC_GPR11 1063
+#define IDC_TESTCDR 1063
+#define IDC_ABOUTCDR 1064
+#define IDC_COMBODRIVE 1065
+#define IDC_LISTPAD1 1066
+#define IDC_CONFIGPAD1 1067
+#define IDC_GPR12 1068
+#define IDC_TESTPAD1 1068
+#define IDC_GPR13 1069
+#define IDC_ABOUTPAD1 1069
+#define IDC_GPR14 1070
+#define IDC_LISTPAD2 1070
+#define IDC_GPR15 1071
+#define IDC_CONFIGPAD2 1071
+#define IDC_GPR16 1072
+#define IDC_TESTPAD2 1072
+#define IDC_GPR17 1073
+#define IDC_ABOUTPAD2 1073
+#define IDC_GPR18 1074
+#define IDC_GPR19 1075
+#define IDC_GPR20 1076
+#define IDC_GPR21 1077
+#define IDC_GPR22 1078
+#define IDC_GPR23 1079
+#define IDC_GPR24 1080
+#define IDC_GPR25 1081
+#define IDC_GPR26 1082
+#define IDC_GPR27 1083
+#define IDC_GPR28 1084
+#define IDC_GPR29 1085
+#define IDC_GPR30 1086
+#define IDC_GPR31 1087
+#define IDC_GPR_PC 1089
+#define IDC_GPR_HI 1091
+#define IDC_GPR_LO 1092
+#define IDC_CP00 1093
+#define IDC_CP01 1094
+#define IDC_CP02 1095
+#define IDC_CP03 1096
+#define IDC_CP04 1097
+#define IDC_CP05 1098
+#define IDC_CP06 1099
+#define IDC_CP08 1100
+#define IDC_CP09 1101
+#define IDC_CP010 1102
+#define IDC_CP011 1103
+#define IDC_CP012 1104
+#define IDC_CP013 1105
+#define IDC_CP014 1106
+#define IDC_CP015 1107
+#define IDC_CP016 1108
+#define IDC_CP017 1109
+#define IDC_CP018 1110
+#define IDC_CP019 1111
+#define IDC_CP020 1112
+#define IDC_CP026 1113
+#define IDC_CP027 1114
+#define IDC_CP028 1115
+#define IDC_CP029 1116
+#define IDC_CP030 1117
+#define IDC_COP2D0 1118
+#define IDC_COP2D1 1119
+#define IDC_COP2D2 1120
+#define IDC_COP2D3 1121
+#define IDC_COP2D4 1122
+#define IDC_COP2D5 1123
+#define IDC_COP2D6 1124
+#define IDC_COP2D7 1125
+#define IDC_COP2D8 1126
+#define IDC_COP2D9 1127
+#define IDC_COP2D10 1128
+#define IDC_COP2D11 1129
+#define IDC_COP2D12 1130
+#define IDC_COP2D13 1131
+#define IDC_COP2D14 1132
+#define IDC_COP2D15 1133
+#define IDC_COP2D16 1134
+#define IDC_COP2D17 1135
+#define IDC_COP2D18 1136
+#define IDC_COP2D19 1137
+#define IDC_COP2D20 1138
+#define IDC_COP2D21 1139
+#define IDC_COP2D22 1140
+#define IDC_COP2D23 1141
+#define IDC_COP2D24 1142
+#define IDC_COP2D25 1143
+#define IDC_COP2D26 1144
+#define IDC_COP2D27 1145
+#define IDC_COP2D28 1146
+#define IDC_COP2D29 1147
+#define IDC_COP2D30 1148
+#define IDC_COP2D31 1149
+#define IDC_COP2C0 1152
+#define IDC_COP2C1 1153
+#define IDC_COP2C2 1154
+#define IDC_COP2C3 1155
+#define IDC_COP2C4 1156
+#define IDC_COP2C5 1157
+#define IDC_COP2C6 1158
+#define IDC_COP2C7 1159
+#define IDC_COP2C8 1160
+#define IDC_COP2C9 1161
+#define IDC_COP2C10 1162
+#define IDC_COP2C11 1163
+#define IDC_COP2C12 1164
+#define IDC_COP2C13 1165
+#define IDC_COP2C14 1166
+#define IDC_COP2C15 1167
+#define IDC_COP2C16 1168
+#define IDC_COP2C17 1169
+#define IDC_COP2C18 1170
+#define IDC_COP2C19 1171
+#define IDC_COP2C20 1172
+#define IDC_COP2C21 1173
+#define IDC_COP2C22 1174
+#define IDC_COP2C23 1175
+#define IDC_COP2C24 1176
+#define IDC_COP2C25 1177
+#define IDC_COP2C26 1178
+#define IDC_COP2C27 1179
+#define IDC_COP2C28 1180
+#define IDC_COP2C29 1181
+#define IDC_COP2C30 1182
+#define IDC_COP2C31 1183
+#define IDC_BUTTON1 1254
+#define IDC_BIOSDIR 1254
+#define IDC_FORMAT1 1254
+#define IDC_PLUGINSDIR 1255
+#define IDC_FORMAT2 1255
+#define ID_FILE_EXIT 40001
+#define ID_HELP_ABOUT 40002
+#define ID_FILE_RUN_CD 40003
+#define ID_FILE_RUN_EXE 40004
+#define ID_EMULATOR_PAUSE 40005
+#define ID_EMULATOR_RESET 40006
+#define ID_HELP_HELP 40007
+#define ID_DEBUG_ENABLE_DEBUGGER 40008
+#define ID_CONFIGURATION_GRAPHICS 40009
+#define ID_CONFIGURATION_SOUND 40010
+#define ID_CONFIGURATION_CDROM 40011
+#define ID_CONFIGURATION_MEMORYCARDMANAGER 40012
+#define ID_CONFIGURATION_CPU 40013
+#define ID_EMULATOR_RUN 40014
+#define ID_DEBUGREG 40015
+#define ID_DEBUG_MESSAGES 40015
+#define ID_CONFIGURATION_CONTROLLERS 40017
+#define ID_CONFIGURATION 40018
+#define ID_FILE_RUNCDBIOS 40026
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 108
+#define _APS_NEXT_COMMAND_VALUE 40028
+#define _APS_NEXT_CONTROL_VALUE 1022
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif