mirror of
https://github.com/iCatButler/pcsxr.git
synced 2024-06-02 19:27:44 -04:00
Added:
- per game memory card support (improved version) - save state pictures (F2) - Wipeout MemHack (improved version) Fixed LTCG build and set as default.
This commit is contained in:
parent
3c0cd06add
commit
f671d256e7
|
@ -470,6 +470,161 @@ static int parsetoc(const char *isofile) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int(*cdimg_read_func_archive)(FILE *f, unsigned int base, void *dest, int sector) = NULL;
|
||||
#ifdef HAVE_LIBARCHIVE
|
||||
#include <archive.h>
|
||||
#include <archive_entry.h>
|
||||
|
||||
struct archive *a = NULL;
|
||||
u32 len_uncompressed_buffer = 0;
|
||||
void *cdimage_buffer_mem = NULL;
|
||||
FILE* cdimage_buffer = NULL; //cdHandle to store file
|
||||
|
||||
int aropen(FILE* fparchive, const char* _fn) {
|
||||
s32 r;
|
||||
u64 length = 0, length_peek;
|
||||
boolean use_temp_file = FALSE; // TODO make a config param
|
||||
static struct archive_entry *ae = NULL;
|
||||
struct archive_entry *ae_peek;
|
||||
|
||||
if (a == NULL && cdimage_buffer == NULL) {
|
||||
// We open file twice. First to peek sizes. This nastyness due used interface.
|
||||
a = archive_read_new();
|
||||
r = archive_read_support_compression_all(a);
|
||||
r = archive_read_support_format_all(a);
|
||||
//r = archive_read_support_filter_all(a);
|
||||
//r = archive_read_support_format_raw(a);
|
||||
//r = archive_read_open_FILE(a, archive);
|
||||
archive_read_open_filename(a, _fn, 75 * CD_FRAMESIZE_RAW);
|
||||
if (r != ARCHIVE_OK) {
|
||||
SysPrintf("Archive open failed (%i).\n", r);
|
||||
archive_read_free(a);
|
||||
a = NULL;
|
||||
return -1;
|
||||
}
|
||||
// Get the biggest file in archive
|
||||
while ((r = archive_read_next_header(a, &ae_peek)) == ARCHIVE_OK) {
|
||||
length_peek = archive_entry_size(ae_peek);
|
||||
//printf("Entry canditate %s %i\n", archive_entry_pathname(ae_peek), length_peek);
|
||||
length = MAX(length_peek, length);
|
||||
ae = (ae == NULL ? ae_peek : ae);
|
||||
}
|
||||
archive_read_free(a);
|
||||
if (ae == NULL) {
|
||||
SysPrintf("Archive entry read failed (%i).\n", r);
|
||||
a = NULL;
|
||||
return -1;
|
||||
}
|
||||
//Now really open the file
|
||||
a = archive_read_new();
|
||||
r = archive_read_support_compression_all(a);
|
||||
r = archive_read_support_format_all(a);
|
||||
archive_read_open_filename(a, _fn, 75 * CD_FRAMESIZE_RAW);
|
||||
while ((r = archive_read_next_header(a, &ae)) == ARCHIVE_OK) {
|
||||
length_peek = archive_entry_size(ae);
|
||||
if (length_peek == length) {
|
||||
//ae = ae_peek;
|
||||
SysPrintf(" -- Selected entry %s %i", archive_entry_pathname(ae), length);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
len_uncompressed_buffer = length ? length : 700 * 1024 * 1024;
|
||||
}
|
||||
|
||||
if (use_temp_file && (cdimage_buffer == NULL || cdHandle != cdimage_buffer)) {
|
||||
cdimage_buffer = fopen("/tmp/pcsxr.tmp.bin", "w+b");
|
||||
}
|
||||
else if (!use_temp_file && (cdimage_buffer == NULL || cdHandle != cdimage_buffer)) {
|
||||
if (cdimage_buffer_mem == NULL && ((cdimage_buffer_mem = malloc(len_uncompressed_buffer)) == NULL)) {
|
||||
SysMessage("Could not reserve enough memory for full image buffer.\n");
|
||||
exit(3);
|
||||
}
|
||||
//printf("Memory ok2 %u %p\n", len_uncompressed_buffer, cdimage_buffer_mem);
|
||||
cdimage_buffer = fmemopen(cdimage_buffer_mem, len_uncompressed_buffer, "w+b");
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
|
||||
if (cdHandle != cdimage_buffer) {
|
||||
fclose(cdHandle); // opened thru archive so this not needed anymore
|
||||
cdHandle = cdimage_buffer;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cdread_archive(FILE *f, unsigned int base, void *dest, int sector)
|
||||
{
|
||||
s32 r;
|
||||
size_t size;
|
||||
size_t readsize;
|
||||
static off_t offset = 0; // w/o read always or static/ftell
|
||||
const void *buff;
|
||||
|
||||
// If not pointing to archive file but CDDA file or some other track
|
||||
if (f != cdHandle) {
|
||||
return cdimg_read_func_archive(f, base, dest, sector);
|
||||
}
|
||||
|
||||
// Jump if already completely read
|
||||
if (a != NULL /*&& (ecm_file_detected || sector*CD_FRAMESIZE_RAW <= len_uncompressed_buffer)*/) {
|
||||
readsize = (sector + 1) * CD_FRAMESIZE_RAW;
|
||||
for (fseek(cdimage_buffer, offset, SEEK_SET); offset < readsize;) {
|
||||
r = archive_read_data_block(a, &buff, &size, &offset);
|
||||
offset += size;
|
||||
SysPrintf("ReadArchive seek:%u(%u) cur:%u(%u)\r", sector, readsize / 1024, offset / CD_FRAMESIZE_RAW, offset / 1024);
|
||||
fwrite(buff, size, 1, cdimage_buffer);
|
||||
if (r != ARCHIVE_OK) {
|
||||
//SysPrintf("End of archive.\n");
|
||||
archive_read_free(a);
|
||||
a = NULL;
|
||||
readsize = offset;
|
||||
fflush(cdimage_buffer);
|
||||
fseek(cdimage_buffer, 0, SEEK_SET);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
//SysPrintf("ReadSectorArchSector: %u(%u)\n", sector, sector*CD_FRAMESIZE_RAW);
|
||||
}
|
||||
|
||||
// TODO what causes req sector to be greater than CD size?
|
||||
r = cdimg_read_func_archive(cdimage_buffer, base, dest, sector);
|
||||
return r;
|
||||
}
|
||||
int handlearchive(const char *isoname, s32* accurate_length) {
|
||||
u32 read_size = accurate_length ? MSF2SECT(70, 70, 16) : MSF2SECT(0, 0, 16);
|
||||
int ret = -1;
|
||||
if ((ret = aropen(cdHandle, isoname)) == 0) {
|
||||
cdimg_read_func = cdread_archive;
|
||||
SysPrintf("[+archive]");
|
||||
if (!ecm_file_detected) {
|
||||
#ifndef ENABLE_ECM_FULL
|
||||
//Detect ECM inside archive
|
||||
cdimg_read_func_archive = cdread_normal;
|
||||
cdread_archive(cdHandle, 0, cdbuffer, read_size);
|
||||
if (handleecm("test.ecm", cdimage_buffer, accurate_length) != -1) {
|
||||
cdimg_read_func_archive = cdread_ecm_decode;
|
||||
cdimg_read_func = cdread_archive;
|
||||
SysPrintf("[+ecm]");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
SysPrintf("[+ecm]");
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
int aropen(FILE* fparchive, const char* _fn) { return -1; }
|
||||
static int cdread_archive(FILE *f, unsigned int base, void *dest, int sector) { return -1; }
|
||||
int handlearchive(const char *isoname, s32* accurate_length) { return -1; }
|
||||
#endif
|
||||
|
||||
// this function tries to get the .cue file of the given .bin
|
||||
// the necessary data is put into the ti (trackinformation)-array
|
||||
static int parsecue(const char *isofile) {
|
||||
|
@ -1489,157 +1644,6 @@ int handleecm(const char *isoname, FILE* cdh, s32* accurate_length) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
int (*cdimg_read_func_archive)(FILE *f, unsigned int base, void *dest, int sector) = NULL;
|
||||
#ifdef HAVE_LIBARCHIVE
|
||||
#include <archive.h>
|
||||
#include <archive_entry.h>
|
||||
|
||||
struct archive *a = NULL;
|
||||
u32 len_uncompressed_buffer = 0;
|
||||
void *cdimage_buffer_mem = NULL;
|
||||
FILE* cdimage_buffer = NULL; //cdHandle to store file
|
||||
|
||||
int aropen(FILE* fparchive, const char* _fn) {
|
||||
s32 r;
|
||||
u64 length = 0, length_peek;
|
||||
boolean use_temp_file = FALSE; // TODO make a config param
|
||||
static struct archive_entry *ae=NULL;
|
||||
struct archive_entry *ae_peek;
|
||||
|
||||
if (a == NULL && cdimage_buffer == NULL) {
|
||||
// We open file twice. First to peek sizes. This nastyness due used interface.
|
||||
a = archive_read_new();
|
||||
r = archive_read_support_compression_all(a);
|
||||
r = archive_read_support_format_all(a);
|
||||
//r = archive_read_support_filter_all(a);
|
||||
//r = archive_read_support_format_raw(a);
|
||||
//r = archive_read_open_FILE(a, archive);
|
||||
archive_read_open_filename(a, _fn, 75*CD_FRAMESIZE_RAW);
|
||||
if (r != ARCHIVE_OK) {
|
||||
SysPrintf("Archive open failed (%i).\n", r);
|
||||
archive_read_free(a);
|
||||
a = NULL;
|
||||
return -1;
|
||||
}
|
||||
// Get the biggest file in archive
|
||||
while ((r=archive_read_next_header(a, &ae_peek)) == ARCHIVE_OK) {
|
||||
length_peek = archive_entry_size(ae_peek);
|
||||
//printf("Entry canditate %s %i\n", archive_entry_pathname(ae_peek), length_peek);
|
||||
length = MAX(length_peek, length);
|
||||
ae = (ae == NULL ? ae_peek : ae);
|
||||
}
|
||||
archive_read_free(a);
|
||||
if (ae == NULL) {
|
||||
SysPrintf("Archive entry read failed (%i).\n", r);
|
||||
a = NULL;
|
||||
return -1;
|
||||
}
|
||||
//Now really open the file
|
||||
a = archive_read_new();
|
||||
r = archive_read_support_compression_all(a);
|
||||
r = archive_read_support_format_all(a);
|
||||
archive_read_open_filename(a, _fn, 75*CD_FRAMESIZE_RAW);
|
||||
while ((r=archive_read_next_header(a, &ae)) == ARCHIVE_OK) {
|
||||
length_peek = archive_entry_size(ae);
|
||||
if (length_peek == length) {
|
||||
//ae = ae_peek;
|
||||
SysPrintf(" -- Selected entry %s %i", archive_entry_pathname(ae), length);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
len_uncompressed_buffer = length?length:700*1024*1024;
|
||||
}
|
||||
|
||||
if (use_temp_file && (cdimage_buffer == NULL || cdHandle != cdimage_buffer)) {
|
||||
cdimage_buffer = fopen("/tmp/pcsxr.tmp.bin", "w+b");
|
||||
}
|
||||
else if (!use_temp_file && (cdimage_buffer == NULL || cdHandle != cdimage_buffer)) {
|
||||
if (cdimage_buffer_mem == NULL && ((cdimage_buffer_mem = malloc(len_uncompressed_buffer)) == NULL)) {
|
||||
SysMessage("Could not reserve enough memory for full image buffer.\n");
|
||||
exit(3);
|
||||
}
|
||||
//printf("Memory ok2 %u %p\n", len_uncompressed_buffer, cdimage_buffer_mem);
|
||||
cdimage_buffer = fmemopen(cdimage_buffer_mem, len_uncompressed_buffer, "w+b");
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
if (cdHandle != cdimage_buffer) {
|
||||
fclose(cdHandle); // opened thru archive so this not needed anymore
|
||||
cdHandle = cdimage_buffer;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cdread_archive(FILE *f, unsigned int base, void *dest, int sector)
|
||||
{
|
||||
s32 r;
|
||||
size_t size;
|
||||
size_t readsize;
|
||||
static off_t offset = 0; // w/o read always or static/ftell
|
||||
const void *buff;
|
||||
|
||||
// If not pointing to archive file but CDDA file or some other track
|
||||
if(f != cdHandle) {
|
||||
return cdimg_read_func_archive(f, base, dest, sector);
|
||||
}
|
||||
|
||||
// Jump if already completely read
|
||||
if (a != NULL /*&& (ecm_file_detected || sector*CD_FRAMESIZE_RAW <= len_uncompressed_buffer)*/) {
|
||||
readsize = (sector+1) * CD_FRAMESIZE_RAW;
|
||||
for (fseek(cdimage_buffer, offset, SEEK_SET); offset < readsize;) {
|
||||
r = archive_read_data_block(a, &buff, &size, &offset);
|
||||
offset += size;
|
||||
SysPrintf("ReadArchive seek:%u(%u) cur:%u(%u)\r", sector, readsize/1024, offset/CD_FRAMESIZE_RAW, offset/1024);
|
||||
fwrite(buff, size, 1, cdimage_buffer);
|
||||
if (r != ARCHIVE_OK) {
|
||||
//SysPrintf("End of archive.\n");
|
||||
archive_read_free(a);
|
||||
a = NULL;
|
||||
readsize = offset;
|
||||
fflush(cdimage_buffer);
|
||||
fseek(cdimage_buffer, 0, SEEK_SET);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//SysPrintf("ReadSectorArchSector: %u(%u)\n", sector, sector*CD_FRAMESIZE_RAW);
|
||||
}
|
||||
|
||||
// TODO what causes req sector to be greater than CD size?
|
||||
r = cdimg_read_func_archive(cdimage_buffer, base, dest, sector);
|
||||
return r;
|
||||
}
|
||||
int handlearchive(const char *isoname, s32* accurate_length) {
|
||||
u32 read_size = accurate_length?MSF2SECT(70,70,16) : MSF2SECT(0,0,16);
|
||||
int ret = -1;
|
||||
if ((ret=aropen(cdHandle, isoname)) == 0) {
|
||||
cdimg_read_func = cdread_archive;
|
||||
SysPrintf("[+archive]");
|
||||
if (!ecm_file_detected) {
|
||||
#ifndef ENABLE_ECM_FULL
|
||||
//Detect ECM inside archive
|
||||
cdimg_read_func_archive = cdread_normal;
|
||||
cdread_archive(cdHandle, 0, cdbuffer, read_size);
|
||||
if (handleecm("test.ecm", cdimage_buffer, accurate_length) != -1) {
|
||||
cdimg_read_func_archive = cdread_ecm_decode;
|
||||
cdimg_read_func = cdread_archive;
|
||||
SysPrintf("[+ecm]");
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
SysPrintf("[+ecm]");
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
int aropen(FILE* fparchive, const char* _fn) {return -1;}
|
||||
static int cdread_archive(FILE *f, unsigned int base, void *dest, int sector) {return -1;}
|
||||
int handlearchive(const char *isoname, s32* accurate_length) {return -1;}
|
||||
#endif
|
||||
|
||||
static unsigned char * CALLBACK ISOgetBuffer_compr(void) {
|
||||
return compr_img->buff_raw[compr_img->sector_in_blk] + 12;
|
||||
}
|
||||
|
|
|
@ -363,6 +363,12 @@ int CheckCdrom() {
|
|||
SysPrintf(_("CD-ROM ID: %.9s\n"), CdromId);
|
||||
SysPrintf(_("CD-ROM EXE Name: %.255s\n"), exename);
|
||||
|
||||
memset(Config.PsxExeName, 0, sizeof(Config.PsxExeName));
|
||||
strncpy(Config.PsxExeName, exename, 11);
|
||||
|
||||
if(Config.PerGameMcd)
|
||||
LoadMcds(Config.Mcd1, Config.Mcd2);
|
||||
|
||||
BuildPPFCache();
|
||||
LoadSBI(NULL);
|
||||
|
||||
|
|
|
@ -1744,7 +1744,7 @@ static void buopen(int mcd, u8 *ptr, u8 *cfg)
|
|||
SysPrintf("openC %s %d\n", ptr, nblk);
|
||||
v0 = 1 + mcd;
|
||||
/* just go ahead and resave them all */
|
||||
SaveMcd(cfg, ptr, 128, 128 * 15);
|
||||
SaveMcd(mcd, cfg, ptr, 128, 128 * 15);
|
||||
break;
|
||||
}
|
||||
/* shouldn't this return ENOSPC if i == 16? */
|
||||
|
@ -1839,7 +1839,7 @@ void psxBios_read() { // 0x34
|
|||
ptr = Mcd##mcd##Data + offset; \
|
||||
memcpy(ptr, Ra1, a2); \
|
||||
FDesc[1 + mcd].offset += a2; \
|
||||
SaveMcd(Config.Mcd##mcd, Mcd##mcd##Data, offset, a2); \
|
||||
SaveMcd(mcd, Config.Mcd##mcd, Mcd##mcd##Data, offset, a2); \
|
||||
if (FDesc[1 + mcd].mode & 0x8000) v0 = 0; \
|
||||
else v0 = a2; \
|
||||
DeliverEvent(0x11, 0x2); /* 0xf0000011, 0x0004 */ \
|
||||
|
@ -2023,7 +2023,7 @@ void psxBios_nextfile() { // 43
|
|||
memset(ptr+0xa+namelen, 0, 0x75-namelen); \
|
||||
for (j=0; j<127; j++) xor^= ptr[j]; \
|
||||
ptr[127] = xor; \
|
||||
SaveMcd(Config.Mcd##mcd, Mcd##mcd##Data, 128 * i + 0xa, 0x76); \
|
||||
SaveMcd(mcd, Config.Mcd##mcd, Mcd##mcd##Data, 128 * i + 0xa, 0x76); \
|
||||
v0 = 1; \
|
||||
break; \
|
||||
} \
|
||||
|
@ -2061,7 +2061,7 @@ void psxBios_rename() { // 44
|
|||
if ((*ptr & 0xF0) != 0x50) continue; \
|
||||
if (strcmp(Ra0+5, ptr+0xa)) continue; \
|
||||
*ptr = (*ptr & 0xf) | 0xA0; \
|
||||
SaveMcd(Config.Mcd##mcd, Mcd##mcd##Data, 128 * i, 1); \
|
||||
SaveMcd(mcd, Config.Mcd##mcd, Mcd##mcd##Data, 128 * i, 1); \
|
||||
SysPrintf("delete %s\n", ptr+0xa); \
|
||||
v0 = 1; \
|
||||
break; \
|
||||
|
@ -2135,10 +2135,10 @@ void psxBios__card_write() { // 0x4e
|
|||
|
||||
if (port == 0) {
|
||||
memcpy(Mcd1Data + (sect * MCD_SECT_SIZE), Ra2, MCD_SECT_SIZE);
|
||||
SaveMcd(Config.Mcd1, Mcd1Data, sect * MCD_SECT_SIZE, MCD_SECT_SIZE);
|
||||
SaveMcd(1, Config.Mcd1, Mcd1Data, sect * MCD_SECT_SIZE, MCD_SECT_SIZE);
|
||||
} else {
|
||||
memcpy(Mcd2Data + (sect * MCD_SECT_SIZE), Ra2, MCD_SECT_SIZE);
|
||||
SaveMcd(Config.Mcd2, Mcd2Data, sect * MCD_SECT_SIZE, MCD_SECT_SIZE);
|
||||
SaveMcd(2, Config.Mcd2, Mcd2Data, sect * MCD_SECT_SIZE, MCD_SECT_SIZE);
|
||||
}
|
||||
|
||||
DeliverEvent(0x11, 0x2); // 0xf0000011, 0x0004
|
||||
|
|
|
@ -137,6 +137,7 @@ typedef struct {
|
|||
char PluginsDir[MAXPATHLEN];
|
||||
char PatchesDir[MAXPATHLEN];
|
||||
char IsoImgDir[MAXPATHLEN];
|
||||
char PsxExeName[12];
|
||||
boolean Xa;
|
||||
boolean SioIrq;
|
||||
boolean Mdec;
|
||||
|
@ -151,6 +152,7 @@ typedef struct {
|
|||
boolean UseNet;
|
||||
boolean VSyncWA;
|
||||
boolean NoMemcard;
|
||||
boolean PerGameMcd;
|
||||
boolean Widescreen;
|
||||
boolean HideCursor;
|
||||
boolean SaveWindowPos;
|
||||
|
@ -162,6 +164,7 @@ typedef struct {
|
|||
u32 AltSpeed1; // Percent relative to natural speed.
|
||||
u32 AltSpeed2;
|
||||
u8 HackFix;
|
||||
u8 MemHack;
|
||||
#ifdef _WIN32
|
||||
char Lang[256];
|
||||
#endif
|
||||
|
|
|
@ -143,9 +143,10 @@ u8 psxMemRead8(u32 mem) {
|
|||
char *p;
|
||||
u32 t;
|
||||
|
||||
|
||||
psxRegs.cycle += 0;
|
||||
|
||||
if (!Config.MemHack)
|
||||
{
|
||||
psxRegs.cycle += 0;
|
||||
}
|
||||
|
||||
t = mem >> 16;
|
||||
if (t == 0x1f80 || t == 0x9f80 || t == 0xbf80) {
|
||||
|
@ -172,9 +173,10 @@ u16 psxMemRead16(u32 mem) {
|
|||
char *p;
|
||||
u32 t;
|
||||
|
||||
|
||||
psxRegs.cycle += 1;
|
||||
|
||||
if (!Config.MemHack)
|
||||
{
|
||||
psxRegs.cycle += 1;
|
||||
}
|
||||
|
||||
t = mem >> 16;
|
||||
if (t == 0x1f80 || t == 0x9f80 || t == 0xbf80) {
|
||||
|
@ -201,10 +203,11 @@ u32 psxMemRead32(u32 mem) {
|
|||
char *p;
|
||||
u32 t;
|
||||
|
||||
if (!Config.MemHack)
|
||||
{
|
||||
psxRegs.cycle += 1;
|
||||
}
|
||||
|
||||
psxRegs.cycle += 1;
|
||||
|
||||
|
||||
t = mem >> 16;
|
||||
if (t == 0x1f80 || t == 0x9f80 || t == 0xbf80) {
|
||||
if ((mem & 0xffff) < 0x400)
|
||||
|
@ -230,9 +233,10 @@ void psxMemWrite8(u32 mem, u8 value) {
|
|||
char *p;
|
||||
u32 t;
|
||||
|
||||
|
||||
psxRegs.cycle += 1;
|
||||
|
||||
if (!Config.MemHack)
|
||||
{
|
||||
psxRegs.cycle += 1;
|
||||
}
|
||||
|
||||
t = mem >> 16;
|
||||
if (t == 0x1f80 || t == 0x9f80 || t == 0xbf80) {
|
||||
|
@ -261,9 +265,10 @@ void psxMemWrite16(u32 mem, u16 value) {
|
|||
char *p;
|
||||
u32 t;
|
||||
|
||||
|
||||
psxRegs.cycle += 1;
|
||||
|
||||
if (!Config.MemHack)
|
||||
{
|
||||
psxRegs.cycle += 1;
|
||||
}
|
||||
|
||||
t = mem >> 16;
|
||||
if (t == 0x1f80 || t == 0x9f80 || t == 0xbf80) {
|
||||
|
@ -292,9 +297,10 @@ void psxMemWrite32(u32 mem, u32 value) {
|
|||
char *p;
|
||||
u32 t;
|
||||
|
||||
|
||||
psxRegs.cycle += 1;
|
||||
|
||||
if (!Config.MemHack)
|
||||
{
|
||||
psxRegs.cycle += 1;
|
||||
}
|
||||
|
||||
// if ((mem&0x1fffff) == 0x71E18 || value == 0x48088800) SysPrintf("t2fix!!\n");
|
||||
t = mem >> 16;
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "mdec.h"
|
||||
#include "gpu.h"
|
||||
#include "gte.h"
|
||||
#include "pgxp_gte.h"
|
||||
|
||||
R3000Acpu *psxCpu = NULL;
|
||||
psxRegisters psxRegs;
|
||||
|
|
|
@ -801,11 +801,11 @@ unsigned char sioRead8() {
|
|||
switch (CtrlReg & 0x2002) {
|
||||
case 0x0002:
|
||||
memcpy(Mcd1Data + (adrL | (adrH << 8)) * 128, &buf[1], 128);
|
||||
SaveMcd(Config.Mcd1, Mcd1Data, (adrL | (adrH << 8)) * 128, 128);
|
||||
SaveMcd(1, Config.Mcd1, Mcd1Data, (adrL | (adrH << 8)) * 128, 128);
|
||||
break;
|
||||
case 0x2002:
|
||||
memcpy(Mcd2Data + (adrL | (adrH << 8)) * 128, &buf[1], 128);
|
||||
SaveMcd(Config.Mcd2, Mcd2Data, (adrL | (adrH << 8)) * 128, 128);
|
||||
SaveMcd(2, Config.Mcd2, Mcd2Data, (adrL | (adrH << 8)) * 128, 128);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -884,23 +884,29 @@ void sioInterrupt() {
|
|||
void LoadMcd(int mcd, char *str) {
|
||||
FILE *f;
|
||||
char *data = NULL;
|
||||
char Mcd[MAXPATHLEN];
|
||||
|
||||
if (mcd == 1) data = Mcd1Data;
|
||||
if (mcd == 2) data = Mcd2Data;
|
||||
|
||||
if (*str == 0) {
|
||||
if (Config.PerGameMcd && mcd && strlen(Config.PsxExeName))
|
||||
sprintf(Mcd, "memcards\\games\\%s-%02d.mcr", Config.PsxExeName, mcd-1);
|
||||
else
|
||||
strcpy(Mcd, str);
|
||||
|
||||
if (*Mcd == 0) {
|
||||
SysPrintf(_("No memory card value was specified - card %i is not plugged.\n"), mcd);
|
||||
return;
|
||||
}
|
||||
f = fopen(str, "rb");
|
||||
f = fopen(Mcd, "rb");
|
||||
if (f == NULL) {
|
||||
SysPrintf(_("The memory card %s doesn't exist - creating it\n"), str);
|
||||
CreateMcd(str);
|
||||
f = fopen(str, "rb");
|
||||
SysPrintf(_("The memory card %s doesn't exist - creating it\n"), Mcd);
|
||||
CreateMcd(Mcd);
|
||||
f = fopen(Mcd, "rb");
|
||||
if (f != NULL) {
|
||||
struct stat buf;
|
||||
|
||||
if (stat(str, &buf) != -1) {
|
||||
if (stat(Mcd, &buf) != -1) {
|
||||
if (buf.st_size == MCD_SIZE + 64)
|
||||
fseek(f, 64, SEEK_SET);
|
||||
else if(buf.st_size == MCD_SIZE + 3904)
|
||||
|
@ -910,12 +916,12 @@ void LoadMcd(int mcd, char *str) {
|
|||
fclose(f);
|
||||
}
|
||||
else
|
||||
SysMessage(_("Memory card %s failed to load!\n"), str);
|
||||
SysMessage(_("Memory card %s failed to load!\n"), Mcd);
|
||||
}
|
||||
else {
|
||||
struct stat buf;
|
||||
SysPrintf(_("Loading memory card %s\n"), str);
|
||||
if (stat(str, &buf) != -1) {
|
||||
SysPrintf(_("Loading memory card %s\n"), Mcd);
|
||||
if (stat(Mcd, &buf) != -1) {
|
||||
if (buf.st_size == MCD_SIZE + 64)
|
||||
fseek(f, 64, SEEK_SET);
|
||||
else if(buf.st_size == MCD_SIZE + 3904)
|
||||
|
@ -934,14 +940,20 @@ void LoadMcds(char *mcd1, char *mcd2) {
|
|||
LoadMcd(2, mcd2);
|
||||
}
|
||||
|
||||
void SaveMcd(char *mcd, char *data, uint32_t adr, int size) {
|
||||
void SaveMcd(int mcd, char *str, char *data, uint32_t adr, int size) {
|
||||
FILE *f;
|
||||
char Mcd[MAXPATHLEN];
|
||||
|
||||
f = fopen(mcd, "r+b");
|
||||
if (Config.PerGameMcd && mcd && strlen(Config.PsxExeName))
|
||||
sprintf(Mcd, "memcards\\games\\%s-%02d.mcr", Config.PsxExeName, mcd-1);
|
||||
else
|
||||
strcpy(Mcd, str);
|
||||
|
||||
f = fopen(Mcd, "r+b");
|
||||
if (f != NULL) {
|
||||
struct stat buf;
|
||||
|
||||
if (stat(mcd, &buf) != -1) {
|
||||
if (stat(Mcd, &buf) != -1) {
|
||||
if (buf.st_size == MCD_SIZE + 64)
|
||||
fseek(f, adr + 64, SEEK_SET);
|
||||
else if (buf.st_size == MCD_SIZE + 3904)
|
||||
|
@ -953,6 +965,9 @@ void SaveMcd(char *mcd, char *data, uint32_t adr, int size) {
|
|||
|
||||
fwrite(data + adr, 1, size, f);
|
||||
fclose(f);
|
||||
|
||||
SysPrintf(_("Saving memory card %s\n"), Mcd);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -965,7 +980,7 @@ void SaveMcd(char *mcd, char *data, uint32_t adr, int size) {
|
|||
}
|
||||
#endif
|
||||
|
||||
ConvertMcd(mcd, data);
|
||||
ConvertMcd(str, data);
|
||||
}
|
||||
|
||||
void CreateMcd(char *mcd) {
|
||||
|
|
|
@ -55,7 +55,7 @@ int sioFreeze(gzFile f, int Mode);
|
|||
|
||||
void LoadMcd(int mcd, char *str);
|
||||
void LoadMcds(char *mcd1, char *mcd2);
|
||||
void SaveMcd(char *mcd, char *data, uint32_t adr, int size);
|
||||
void SaveMcd(int mcd, char *str, char *data, uint32_t adr, int size);
|
||||
void CreateMcd(char *mcd);
|
||||
void ConvertMcd(char *mcd, char *data);
|
||||
|
||||
|
|
|
@ -84,9 +84,11 @@ int LoadConfig() {
|
|||
QueryKeyV("Widescreen", Conf->Widescreen);
|
||||
QueryKeyV("HideCursor", Conf->HideCursor);
|
||||
QueryKeyV("SaveWindowPos", Conf->SaveWindowPos);
|
||||
QueryKeyV("PerGameMcd", Conf->PerGameMcd);
|
||||
QueryKeyV("WindowPosX", Conf->WindowPos[0]);
|
||||
QueryKeyV("WindowPosY", Conf->WindowPos[1]);
|
||||
QueryKeyV("HackFix", Conf->HackFix);
|
||||
QueryKeyV("MemHack", Conf->MemHack);
|
||||
|
||||
QueryKeyV("Cpu", Conf->Cpu);
|
||||
QueryKeyV("PsxType", Conf->PsxType);
|
||||
|
@ -142,9 +144,11 @@ void SaveConfig() {
|
|||
SetKeyV("Widescreen", Conf->Widescreen);
|
||||
SetKeyV("HideCursor", Conf->HideCursor);
|
||||
SetKeyV("SaveWindowPos", Conf->SaveWindowPos);
|
||||
SetKeyV("PerGameMcd", Conf->PerGameMcd);
|
||||
SetKeyV("WindowPosX", Conf->WindowPos[0]);
|
||||
SetKeyV("WindowPosY", Conf->WindowPos[1]);
|
||||
SetKeyV("HackFix", Conf->HackFix);
|
||||
SetKeyV("MemHack", Conf->MemHack);
|
||||
|
||||
SetKeyV("Cpu", Conf->Cpu);
|
||||
SetKeyV("PsxType", Conf->PsxType);
|
||||
|
|
|
@ -1177,18 +1177,18 @@ BOOL CALLBACK ConfigureMcdsDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lPa
|
|||
|
||||
// save dir data + save data
|
||||
memcpy(Mcd1Data + (i+1) * 128, Mcd2Data + (copy+1) * 128, 128);
|
||||
SaveMcd(str, Mcd1Data, (i+1) * 128, 128);
|
||||
SaveMcd(0, 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);
|
||||
SaveMcd(0, 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);
|
||||
SaveMcd(0, 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);
|
||||
SaveMcd(0, str, Mcd2Data, (i+1) * 1024 * 8, 1024 * 8);
|
||||
}
|
||||
|
||||
UpdateMcdDlg();
|
||||
|
@ -1223,7 +1223,7 @@ BOOL CALLBACK ConfigureMcdsDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lPa
|
|||
for (j=0; j<127; j++) xor^=*ptr++;
|
||||
*ptr = xor;
|
||||
|
||||
SaveMcd(str, data, i * 128, 128);
|
||||
SaveMcd(0, str, data, i * 128, 128);
|
||||
UpdateMcdDlg();
|
||||
}
|
||||
|
||||
|
@ -1257,7 +1257,7 @@ BOOL CALLBACK ConfigureMcdsDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lPa
|
|||
for (j=0; j<127; j++) xor^=*ptr++;
|
||||
*ptr = xor;
|
||||
|
||||
SaveMcd(str, data, i * 128, 128);
|
||||
SaveMcd(0, str, data, i * 128, 128);
|
||||
UpdateMcdDlg();
|
||||
}
|
||||
|
||||
|
@ -1355,6 +1355,7 @@ BOOL CALLBACK ConfigureCpuDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lPar
|
|||
Button_SetText(GetDlgItem(hW,IDC_HIDECURSOR), _("Hide cursor"));
|
||||
Button_SetText(GetDlgItem(hW,IDC_SAVEWINDOWPOS), _("Save window position"));
|
||||
Button_SetText(GetDlgItem(hW,IDC_HACKFIX), _("Compatibility hacks (Raystorm/VH-D/MML/Cart World/...)"));
|
||||
Button_SetText(GetDlgItem(hW,IDC_MEMHACK), _("Wipeout MemHack"));
|
||||
|
||||
Static_SetText(GetDlgItem(hW,IDC_MISCOPT), _("Options"));
|
||||
Static_SetText(GetDlgItem(hW,IDC_SELPSX), _("Psx System Type"));
|
||||
|
@ -1375,6 +1376,7 @@ BOOL CALLBACK ConfigureCpuDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lPar
|
|||
Button_SetCheck(GetDlgItem(hW,IDC_HIDECURSOR), Config.HideCursor);
|
||||
Button_SetCheck(GetDlgItem(hW,IDC_SAVEWINDOWPOS), Config.SaveWindowPos);
|
||||
Button_SetCheck(GetDlgItem(hW,IDC_HACKFIX), Config.HackFix);
|
||||
Button_SetCheck(GetDlgItem(hW,IDC_MEMHACK), Config.MemHack);
|
||||
|
||||
ComboBox_AddString(GetDlgItem(hW,IDC_PSXTYPES), "NTSC");
|
||||
ComboBox_AddString(GetDlgItem(hW,IDC_PSXTYPES), "PAL");
|
||||
|
@ -1423,6 +1425,7 @@ BOOL CALLBACK ConfigureCpuDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lPar
|
|||
Config.HideCursor = Button_GetCheck(GetDlgItem(hW,IDC_HIDECURSOR));
|
||||
Config.SaveWindowPos = Button_GetCheck(GetDlgItem(hW,IDC_SAVEWINDOWPOS));
|
||||
Config.HackFix = Button_GetCheck(GetDlgItem(hW, IDC_HACKFIX));
|
||||
Config.MemHack = Button_GetCheck(GetDlgItem(hW, IDC_MEMHACK));
|
||||
|
||||
if(Config.SaveWindowPos) {
|
||||
GetWindowRect(gApp.hWnd, &rect);
|
||||
|
|
|
@ -31,39 +31,68 @@
|
|||
#include "misc.h"
|
||||
#include "sio.h"
|
||||
|
||||
int ShowPic = 0;
|
||||
|
||||
extern void LidInterrupt();
|
||||
|
||||
HANDLE hThread = 0;
|
||||
BOOL start = FALSE;
|
||||
BOOL restart = FALSE;
|
||||
|
||||
void gpuHidePic()
|
||||
{
|
||||
GPU_showScreenPic(NULL);
|
||||
}
|
||||
|
||||
DWORD WINAPI HidePicAfter(LPVOID lpThreadParameter)
|
||||
{
|
||||
while (1)
|
||||
{
|
||||
while (!start) Sleep(10);
|
||||
|
||||
while (1) {
|
||||
Sleep(3000);
|
||||
if (!restart)
|
||||
break;
|
||||
restart = FALSE;
|
||||
};
|
||||
|
||||
gpuHidePic();
|
||||
start = FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void gpuShowPic() {
|
||||
char Text[255];
|
||||
gzFile f;
|
||||
|
||||
if (!ShowPic) {
|
||||
unsigned char *pMem;
|
||||
unsigned char *pMem;
|
||||
|
||||
pMem = (unsigned char *) malloc(128*96*3);
|
||||
if (pMem == NULL) return;
|
||||
GetStateFilename(Text, StatesC);
|
||||
pMem = (unsigned char *)malloc(128 * 96 * 3);
|
||||
if (pMem == NULL) return;
|
||||
GetStateFilename(Text, StatesC);
|
||||
|
||||
GPU_freeze(2, (GPUFreeze_t *)&StatesC);
|
||||
GPU_freeze(2, (GPUFreeze_t *)&StatesC);
|
||||
|
||||
f = gzopen(Text, "rb");
|
||||
if (f != NULL) {
|
||||
gzseek(f, 32, SEEK_SET); // skip header
|
||||
gzseek(f, sizeof(u32), SEEK_CUR);
|
||||
gzseek(f, sizeof(boolean), SEEK_CUR);
|
||||
gzread(f, pMem, 128*96*3);
|
||||
gzclose(f);
|
||||
} else {
|
||||
memcpy(pMem, NoPic_Image.pixel_data, 128*96*3);
|
||||
DrawNumBorPic(pMem, StatesC+1);
|
||||
}
|
||||
GPU_showScreenPic(pMem);
|
||||
f = gzopen(Text, "rb");
|
||||
if (f != NULL) {
|
||||
gzseek(f, 32, SEEK_SET); // skip header
|
||||
gzseek(f, sizeof(u32), SEEK_CUR);
|
||||
gzseek(f, sizeof(boolean), SEEK_CUR);
|
||||
gzread(f, pMem, 128 * 96 * 3);
|
||||
gzclose(f);
|
||||
}else {
|
||||
memcpy(pMem, NoPic_Image.pixel_data, 128 * 96 * 3);
|
||||
DrawNumBorPic(pMem, StatesC + 1);
|
||||
}
|
||||
GPU_showScreenPic(pMem);
|
||||
free(pMem);
|
||||
|
||||
free(pMem);
|
||||
ShowPic = 1;
|
||||
} else { GPU_showScreenPic(NULL); ShowPic = 0; }
|
||||
DWORD ThreadId = 0;
|
||||
if (!hThread) hThread = CreateThread(NULL, 0, HidePicAfter, NULL, 0, NULL);
|
||||
|
||||
if (start) restart = TRUE;
|
||||
start = TRUE;
|
||||
}
|
||||
|
||||
void GetStateFilename(char *out, int i) {
|
||||
|
@ -72,7 +101,7 @@ void GetStateFilename(char *out, int i) {
|
|||
|
||||
strncpy(trimlabel, CdromLabel, 32);
|
||||
trimlabel[32] = 0;
|
||||
for (j=31; j>=0; j--)
|
||||
for (j = 31; j >= 0; j--)
|
||||
if (trimlabel[j] == ' ')
|
||||
trimlabel[j] = '\0';
|
||||
|
||||
|
@ -85,89 +114,90 @@ void PADhandleKey(int key) {
|
|||
|
||||
if (Running == 0) return;
|
||||
switch (key) {
|
||||
case 0: break;
|
||||
case VK_F1:
|
||||
GetStateFilename(Text, StatesC);
|
||||
GPU_freeze(2, (GPUFreeze_t *)&StatesC);
|
||||
ret = SaveState(Text);
|
||||
if (ret == 0)
|
||||
sprintf(Text, _("*PCSXR*: Saved State %d"), StatesC+1);
|
||||
else sprintf(Text, _("*PCSXR*: Error Saving State %d"), StatesC+1);
|
||||
GPU_displayText(Text);
|
||||
if (ShowPic) { ShowPic = 0; gpuShowPic(); }
|
||||
break;
|
||||
case 0: break;
|
||||
case VK_F1:
|
||||
GetStateFilename(Text, StatesC);
|
||||
GPU_freeze(2, (GPUFreeze_t *)&StatesC);
|
||||
ret = SaveState(Text);
|
||||
if (ret == 0)
|
||||
sprintf(Text, _("*PCSXR*: Saved State %d"), StatesC + 1);
|
||||
else sprintf(Text, _("*PCSXR*: Error Saving State %d"), StatesC + 1);
|
||||
GPU_displayText(Text);
|
||||
gpuShowPic();
|
||||
break;
|
||||
|
||||
case VK_F2:
|
||||
if (StatesC < 8) StatesC++;
|
||||
else StatesC = 0;
|
||||
GPU_freeze(2, (GPUFreeze_t *)&StatesC);
|
||||
if (ShowPic) { ShowPic = 0; gpuShowPic(); }
|
||||
break;
|
||||
case VK_F2:
|
||||
if (StatesC < 8) StatesC++;
|
||||
else StatesC = 0;
|
||||
GPU_freeze(2, (GPUFreeze_t *)&StatesC);
|
||||
gpuShowPic();
|
||||
break;
|
||||
|
||||
case VK_F3:
|
||||
GetStateFilename(Text, StatesC);
|
||||
ret = LoadState(Text);
|
||||
if (ret == 0)
|
||||
sprintf(Text, _("*PCSXR*: Loaded State %d"), StatesC+1);
|
||||
else sprintf(Text, _("*PCSXR*: Error Loading State %d"), StatesC+1);
|
||||
GPU_displayText(Text);
|
||||
break;
|
||||
case VK_F3:
|
||||
GetStateFilename(Text, StatesC);
|
||||
ret = LoadState(Text);
|
||||
if (ret == 0)
|
||||
sprintf(Text, _("*PCSXR*: Loaded State %d"), StatesC + 1);
|
||||
else sprintf(Text, _("*PCSXR*: Error Loading State %d"), StatesC + 1);
|
||||
GPU_displayText(Text);
|
||||
gpuShowPic();
|
||||
break;
|
||||
|
||||
case VK_F4:
|
||||
gpuShowPic();
|
||||
break;
|
||||
case VK_F4:
|
||||
gpuShowPic();
|
||||
break;
|
||||
|
||||
case VK_F5:
|
||||
Config.SioIrq ^= 0x1;
|
||||
if (Config.SioIrq)
|
||||
sprintf(Text, _("*PCSXR*: Sio Irq Always Enabled"));
|
||||
else sprintf(Text, _("*PCSXR*: Sio Irq Not Always Enabled"));
|
||||
GPU_displayText(Text);
|
||||
break;
|
||||
case VK_F5:
|
||||
Config.SioIrq ^= 0x1;
|
||||
if (Config.SioIrq)
|
||||
sprintf(Text, _("*PCSXR*: Sio Irq Always Enabled"));
|
||||
else sprintf(Text, _("*PCSXR*: Sio Irq Not Always Enabled"));
|
||||
GPU_displayText(Text);
|
||||
break;
|
||||
|
||||
case VK_F6:
|
||||
Config.Mdec ^= 0x1;
|
||||
if (Config.Mdec)
|
||||
sprintf(Text, _("*PCSXR*: Black&White Mdecs Only Enabled"));
|
||||
else sprintf(Text, _("*PCSXR*: Black&White Mdecs Only Disabled"));
|
||||
GPU_displayText(Text);
|
||||
break;
|
||||
case VK_F6:
|
||||
Config.Mdec ^= 0x1;
|
||||
if (Config.Mdec)
|
||||
sprintf(Text, _("*PCSXR*: Black&White Mdecs Only Enabled"));
|
||||
else sprintf(Text, _("*PCSXR*: Black&White Mdecs Only Disabled"));
|
||||
GPU_displayText(Text);
|
||||
break;
|
||||
|
||||
case VK_F7:
|
||||
Config.Xa ^= 0x1;
|
||||
if (Config.Xa == 0)
|
||||
sprintf (Text, _("*PCSXR*: Xa Enabled"));
|
||||
else sprintf (Text, _("*PCSXR*: Xa Disabled"));
|
||||
GPU_displayText(Text);
|
||||
break;
|
||||
case VK_F7:
|
||||
Config.Xa ^= 0x1;
|
||||
if (Config.Xa == 0)
|
||||
sprintf(Text, _("*PCSXR*: Xa Enabled"));
|
||||
else sprintf(Text, _("*PCSXR*: Xa Disabled"));
|
||||
GPU_displayText(Text);
|
||||
break;
|
||||
|
||||
case VK_F8:
|
||||
GPU_makeSnapshot();
|
||||
return;
|
||||
case VK_F8:
|
||||
GPU_makeSnapshot();
|
||||
return;
|
||||
|
||||
case VK_F9:
|
||||
GPU_displayText(_("*PCSXR*: CdRom Case Opened"));
|
||||
SetCdOpenCaseTime(-1);
|
||||
LidInterrupt();
|
||||
break;
|
||||
case VK_F9:
|
||||
GPU_displayText(_("*PCSXR*: CdRom Case Opened"));
|
||||
SetCdOpenCaseTime(-1);
|
||||
LidInterrupt();
|
||||
break;
|
||||
|
||||
case VK_F10:
|
||||
GPU_displayText(_("*PCSXR*: CdRom Case Closed"));
|
||||
SetCdOpenCaseTime(0);
|
||||
LidInterrupt();
|
||||
break;
|
||||
case VK_F10:
|
||||
GPU_displayText(_("*PCSXR*: CdRom Case Closed"));
|
||||
SetCdOpenCaseTime(0);
|
||||
LidInterrupt();
|
||||
break;
|
||||
|
||||
case VK_F12:
|
||||
SysPrintf("*PCSXR*: CpuReset\n");
|
||||
psxReset();
|
||||
break;
|
||||
case VK_F12:
|
||||
SysPrintf("*PCSXR*: CpuReset\n");
|
||||
psxReset();
|
||||
break;
|
||||
|
||||
case VK_ESCAPE:
|
||||
ShowCursor(TRUE); // we want GUI to have cursor always
|
||||
Running = 0;
|
||||
ClosePlugins();
|
||||
SysRunGui();
|
||||
break;
|
||||
case VK_ESCAPE:
|
||||
ShowCursor(TRUE); // we want GUI to have cursor always
|
||||
Running = 0;
|
||||
ClosePlugins();
|
||||
SysRunGui();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -177,27 +207,27 @@ BOOL CALLBACK ConnectDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) {
|
|||
char str[256];
|
||||
static int waitState;
|
||||
|
||||
switch(uMsg) {
|
||||
case WM_INITDIALOG:
|
||||
SetWindowText(hW, _("Connecting..."));
|
||||
switch (uMsg) {
|
||||
case WM_INITDIALOG:
|
||||
SetWindowText(hW, _("Connecting..."));
|
||||
|
||||
sprintf(str, _("Please wait while connecting... %c\n"), charsTable[waitState]);
|
||||
Static_SetText(GetDlgItem(hW, IDC_CONNECTSTR), str);
|
||||
SetTimer(hW, 0, 100, NULL);
|
||||
return TRUE;
|
||||
sprintf(str, _("Please wait while connecting... %c\n"), charsTable[waitState]);
|
||||
Static_SetText(GetDlgItem(hW, IDC_CONNECTSTR), str);
|
||||
SetTimer(hW, 0, 100, NULL);
|
||||
return TRUE;
|
||||
|
||||
case WM_TIMER:
|
||||
if (++waitState == 4) waitState = 0;
|
||||
sprintf(str, _("Please wait while connecting... %c\n"), charsTable[waitState]);
|
||||
Static_SetText(GetDlgItem(hW, IDC_CONNECTSTR), str);
|
||||
return TRUE;
|
||||
case WM_TIMER:
|
||||
if (++waitState == 4) waitState = 0;
|
||||
sprintf(str, _("Please wait while connecting... %c\n"), charsTable[waitState]);
|
||||
Static_SetText(GetDlgItem(hW, IDC_CONNECTSTR), str);
|
||||
return TRUE;
|
||||
|
||||
/* case WM_COMMAND:
|
||||
switch (LOWORD(wParam)) {
|
||||
case IDCANCEL:
|
||||
/* case WM_COMMAND:
|
||||
switch (LOWORD(wParam)) {
|
||||
case IDCANCEL:
|
||||
WaitCancel = 1;
|
||||
return TRUE;
|
||||
}*/
|
||||
}*/
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
@ -205,9 +235,9 @@ BOOL CALLBACK ConnectDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) {
|
|||
|
||||
#define PARSEPATH(dst, src) \
|
||||
ptr = src + strlen(src); \
|
||||
while (*ptr != '\\' && ptr != src) ptr--; \
|
||||
while (*ptr != '\\' && ptr != src) ptr--; \
|
||||
if (ptr != src) { \
|
||||
strcpy(dst, ptr+1); \
|
||||
strcpy(dst, ptr+1); \
|
||||
}
|
||||
|
||||
int _OpenPlugins(HWND hWnd) {
|
||||
|
@ -251,55 +281,55 @@ int _OpenPlugins(HWND hWnd) {
|
|||
char *ptr;
|
||||
|
||||
PARSEPATH(Config.Bios, info.BIOSpath);
|
||||
PARSEPATH(Config.Gpu, info.GPUpath);
|
||||
PARSEPATH(Config.Spu, info.SPUpath);
|
||||
PARSEPATH(Config.Cdr, info.CDRpath);
|
||||
PARSEPATH(Config.Gpu, info.GPUpath);
|
||||
PARSEPATH(Config.Spu, info.SPUpath);
|
||||
PARSEPATH(Config.Cdr, info.CDRpath);
|
||||
|
||||
strcpy(Config.Mcd1, info.MCD1path);
|
||||
strcpy(Config.Mcd2, info.MCD2path);
|
||||
return -2;
|
||||
} else {
|
||||
}else {
|
||||
Config.UseNet = FALSE;
|
||||
}
|
||||
} else {
|
||||
}else {
|
||||
HWND hW = CreateDialog(gApp.hInstance, MAKEINTRESOURCE(IDD_CONNECT), gApp.hWnd, ConnectDlgProc);
|
||||
ShowWindow(hW, SW_SHOW);
|
||||
|
||||
if (NET_queryPlayer() == 1) {
|
||||
if (SendPcsxInfo() == -1) Config.UseNet = FALSE;
|
||||
} else {
|
||||
}else {
|
||||
if (RecvPcsxInfo() == -1) Config.UseNet = FALSE;
|
||||
}
|
||||
|
||||
DestroyWindow(hW);
|
||||
}
|
||||
NetOpened = TRUE;
|
||||
} else if (Config.UseNet) {
|
||||
}else if (Config.UseNet) {
|
||||
NET_resume();
|
||||
}
|
||||
|
||||
ret = GPU_open(hWnd);
|
||||
if (ret < 0) { SysMessage (_("Error Opening GPU Plugin (%d)"), ret); return -1; }
|
||||
if (ret < 0) { SysMessage(_("Error Opening GPU Plugin (%d)"), ret); return -1; }
|
||||
ret = SPU_open(hWnd);
|
||||
if (ret < 0) { SysMessage (_("Error Opening SPU Plugin (%d)"), ret); return -1; }
|
||||
if (ret < 0) { SysMessage(_("Error Opening SPU Plugin (%d)"), ret); return -1; }
|
||||
SPU_registerCallback(SPUirq);
|
||||
ret = PAD1_open(hWnd);
|
||||
if (ret < 0) { SysMessage (_("Error Opening PAD1 Plugin (%d)"), ret); return -1; }
|
||||
if (ret < 0) { SysMessage(_("Error Opening PAD1 Plugin (%d)"), ret); return -1; }
|
||||
PAD1_registerVibration(GPU_visualVibration);
|
||||
PAD1_registerCursor(GPU_cursor);
|
||||
ret = PAD2_open(hWnd);
|
||||
if (ret < 0) { SysMessage (_("Error Opening PAD2 Plugin (%d)"), ret); return -1; }
|
||||
if (ret < 0) { SysMessage(_("Error Opening PAD2 Plugin (%d)"), ret); return -1; }
|
||||
PAD2_registerVibration(GPU_visualVibration);
|
||||
PAD2_registerCursor(GPU_cursor);
|
||||
#ifdef ENABLE_SIO1API
|
||||
ret = SIO1_open(hWnd);
|
||||
if (ret < 0) { SysMessage (_("Error Opening SIO1 plugin (%d)"), ret); return -1; }
|
||||
if (ret < 0) { SysMessage(_("Error Opening SIO1 plugin (%d)"), ret); return -1; }
|
||||
SIO1_registerCallback(SIO1irq);
|
||||
#endif
|
||||
|
||||
|
||||
SetCurrentDirectory(PcsxrDir);
|
||||
|
||||
if(Config.HideCursor)
|
||||
|
||||
if (Config.HideCursor)
|
||||
ShowCursor(FALSE);
|
||||
return 0;
|
||||
}
|
||||
|
@ -325,14 +355,14 @@ void ClosePlugins() {
|
|||
PAD2_close();
|
||||
|
||||
ret = CDR_close();
|
||||
if (ret < 0) { SysMessage (_("Error Closing CDR Plugin")); return; }
|
||||
if (ret < 0) { SysMessage(_("Error Closing CDR Plugin")); return; }
|
||||
ret = GPU_close();
|
||||
if (ret < 0) { SysMessage (_("Error Closing GPU Plugin")); return; }
|
||||
if (ret < 0) { SysMessage(_("Error Closing GPU Plugin")); return; }
|
||||
ret = SPU_close();
|
||||
if (ret < 0) { SysMessage (_("Error Closing SPU Plugin")); return; }
|
||||
if (ret < 0) { SysMessage(_("Error Closing SPU Plugin")); return; }
|
||||
#ifdef ENABLE_SIO1API
|
||||
ret = SIO1_close();
|
||||
if (ret < 0) { SysMessage (_("Error Closing SIO1 plugin")); return; }
|
||||
if (ret < 0) { SysMessage(_("Error Closing SIO1 plugin")); return; }
|
||||
#endif
|
||||
|
||||
if (Config.UseNet) {
|
||||
|
@ -354,23 +384,23 @@ void ResetPlugins() {
|
|||
if (Config.UseNet) NET_shutdown();
|
||||
|
||||
ret = CDR_init();
|
||||
if (ret != 0) { SysMessage (_("CDRinit error: %d"), ret); return; }
|
||||
if (ret != 0) { SysMessage(_("CDRinit error: %d"), ret); return; }
|
||||
ret = GPU_init();
|
||||
if (ret != 0) { SysMessage (_("GPUinit error: %d"), ret); return; }
|
||||
if (ret != 0) { SysMessage(_("GPUinit error: %d"), ret); return; }
|
||||
ret = SPU_init();
|
||||
if (ret != 0) { SysMessage (_("SPUinit error: %d"), ret); return; }
|
||||
if (ret != 0) { SysMessage(_("SPUinit error: %d"), ret); return; }
|
||||
ret = PAD1_init(1);
|
||||
if (ret != 0) { SysMessage (_("PAD1init error: %d"), ret); return; }
|
||||
if (ret != 0) { SysMessage(_("PAD1init error: %d"), ret); return; }
|
||||
ret = PAD2_init(2);
|
||||
if (ret != 0) { SysMessage (_("PAD2init error: %d"), ret); return; }
|
||||
if (ret != 0) { SysMessage(_("PAD2init error: %d"), ret); return; }
|
||||
#ifdef ENABLE_SIO1API
|
||||
ret = SIO1_init();
|
||||
if (ret != 0) { SysMessage (_("SIO1init error: %d"), ret); return; }
|
||||
if (ret != 0) { SysMessage(_("SIO1init error: %d"), ret); return; }
|
||||
#endif
|
||||
|
||||
if (Config.UseNet) {
|
||||
ret = NET_init();
|
||||
if (ret < 0) { SysMessage (_("NETinit error: %d"), ret); return; }
|
||||
if (ret < 0) { SysMessage(_("NETinit error: %d"), ret); return; }
|
||||
}
|
||||
|
||||
NetOpened = FALSE;
|
||||
|
|
|
@ -103,7 +103,7 @@ BEGIN
|
|||
GROUPBOX "",IDC_STATIC,43,100,234,79
|
||||
END
|
||||
|
||||
IDD_CPUCONF DIALOGEX 0, 0, 232, 311
|
||||
IDD_CPUCONF DIALOGEX 0, 0, 240, 320
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Cpu Config"
|
||||
FONT 8, "MS Sans Serif", 0, 0, 0x0
|
||||
|
@ -124,13 +124,13 @@ BEGIN
|
|||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,150,205,10
|
||||
CONTROL "InuYasha Sengoku Battle Fix",IDC_VSYNCWA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,165,205,10
|
||||
CONTROL "Widescreen (GTE Hack)",IDC_WIDESCREEN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,180,205,10
|
||||
GROUPBOX "Select Psx System Type",IDC_SELPSX,5,246,220,35
|
||||
CONTROL "Autodetect",IDC_PSXAUTO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,260,80,10
|
||||
COMBOBOX IDC_PSXTYPES,105,260,53,50,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
|
||||
GROUPBOX "Select Psx System Type",IDC_SELPSX,5,255,220,35
|
||||
CONTROL "Autodetect",IDC_PSXAUTO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,265,80,10
|
||||
COMBOBOX IDC_PSXTYPES,105,265,53,50,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
|
||||
CONTROL "Hide cursor",IDC_HIDECURSOR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,195,205,10
|
||||
CONTROL "Save window position",IDC_SAVEWINDOWPOS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,210,205,10
|
||||
CONTROL "Compatibility hacks (Raystorm/VH-D/MML/Cart World/...)",IDC_HACKFIX,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,225,205,10
|
||||
CONTROL "Compatibility hacks (Raystorm/VH-D/MML/Cart World/...)",IDC_HACKFIX, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,225,205,10
|
||||
CONTROL "Wipeout MemHack", IDC_MEMHACK, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 10, 240, 205, 10
|
||||
END
|
||||
|
||||
IDD_NETPLAY DIALOG 0, 0, 165, 95
|
||||
|
|
|
@ -13,13 +13,15 @@
|
|||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{9EEA62F5-46DC-4C07-AFE1-F72F9D6B9E3E}</ProjectGuid>
|
||||
<RootNamespace>pcsxr</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<PlatformToolset>v140_xp</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
|
@ -46,7 +48,7 @@
|
|||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</LinkIncremental>
|
||||
<EmbedManifest Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</EmbedManifest>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\Release\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\Release\</IntDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\Release\obj\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
|
@ -57,6 +59,7 @@
|
|||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<EmbedManifest>false</EmbedManifest>
|
||||
<TargetName>$(ProjectName)-pgxp</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Midl>
|
||||
|
@ -113,20 +116,13 @@
|
|||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<AdditionalOptions>/Zm200 %(AdditionalOptions)</AdditionalOptions>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||
<AdditionalIncludeDirectories>../;./zlib;../libpcsxcore;./glue;./;./gui;./intl;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;__WIN32__;_MSC_VER_;PCSXR_VERSION="1.5";__i386__;ENABLE_NLS;PACKAGE="pcsxr";inline=__forceinline;ENABLE_SIO1API=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<StructMemberAlignment>16Bytes</StructMemberAlignment>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<PrecompiledHeaderOutputFile>.\Release/pcsxr.pch</PrecompiledHeaderOutputFile>
|
||||
<AssemblerListingLocation>.\Release/</AssemblerListingLocation>
|
||||
<ObjectFileName>.\Release/</ObjectFileName>
|
||||
<ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName>
|
||||
<BrowseInformation>true</BrowseInformation>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
</ClCompile>
|
||||
|
@ -136,7 +132,6 @@
|
|||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>odbc32.lib;odbccp32.lib;comctl32.lib;wsock32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>.\Release/pcsxr.exe</OutputFile>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
|
|
|
@ -306,6 +306,7 @@
|
|||
#define IDC_HIDECURSOR 1265
|
||||
#define IDC_SAVEWINDOWPOS 1266
|
||||
#define IDC_HACKFIX 1267
|
||||
#define IDC_MEMHACK 1268
|
||||
#define ID_FILE_EXIT 40001
|
||||
#define ID_HELP_ABOUT 40002
|
||||
#define ID_FILE_RUN_CD 40003
|
||||
|
|
Loading…
Reference in a new issue