Fixed a bug in the COP0 TLB / Branch instructions that was causing some games to freeze up or crash (bug was introduced in r572).

Cleaned up the GUI code a bit.  The gui is no longer recursively called from the EErecs branchtest.  This is good for process stack security, good for savestate stability, and good for improving the GUI's ability to handle and recover from errors (although the last part will need more work before it's fully implemented).

Did some more cleanups of the IPU code.  Fixed some tabbing and formatting, and did a couple more __fastcalls.

Note to our compilers: We redid the naming scheme of the build targets (again!).  Builds are now names Debug, Devel, and Release.  The builds behave the same as they did prior, except that now the names are much shorter.  Also, we decided to disable PCH on Release builds for safety sake.  Devel builds still have PCH enabled on everything except IPU.cpp.

**VM build is still broken!**  (I'm going to take a look at it in earnest tomorrow)

git-svn-id: http://pcsx2-playground.googlecode.com/svn/trunk@587 a6443dda-0b58-4228-96e9-037be469359c
This commit is contained in:
Jake.Stine 2009-01-14 03:37:21 +00:00 committed by Gregory Hainaut
parent 28e4ac4079
commit f1bdbd59a8
22 changed files with 591 additions and 645 deletions

View File

@ -75,7 +75,6 @@ extern TESTRUNARGS g_TestRun;
// Moving this before one of the other includes causes compilation issues.
#include "Misc.h"
#include "Counters.h"
#include "IPU/IPU.h"
#include "Patch.h"
#include "COP0.h"
#include "VifDma.h"

View File

@ -18,8 +18,9 @@
#include "PrecompiledHeader.h"
#include "R5900.h"
#include "Common.h"
#include "IPU.h"
#include "mpeg2lib/Mpeg.h"
#include "yuv2rgb.h"
#include "coroutine.h"
@ -102,10 +103,10 @@ static u8 niq[64], //non-intraquant matrix
u16 vqclut[16]; //clut conversion table
static u8 s_thresh[2]; //thresholds for color conversions
int coded_block_pattern=0;
PCSX2_ALIGNED16(struct macroblock_8 mb8);
PCSX2_ALIGNED16(struct macroblock_16 mb16);
PCSX2_ALIGNED16(struct macroblock_rgb32 rgb32);
PCSX2_ALIGNED16(struct macroblock_rgb16 rgb16);
PCSX2_ALIGNED16(macroblock_8 mb8);
PCSX2_ALIGNED16(macroblock_16 mb16);
PCSX2_ALIGNED16(macroblock_rgb32 rgb32);
PCSX2_ALIGNED16(macroblock_rgb16 rgb16);
u8 indx4[16*16/2];
u32 mpeg2_inited; //mpeg2_idct_init() must be called only once
@ -1240,7 +1241,7 @@ int getBits(u8 *address, u32 size, u32 advance)
void Skl_YUV_To_RGB32_MMX(u8 *RGB, const int Dst_BpS, const u8 *Y, const u8 *U, const u8 *V,
const int Src_BpS, const int Width, const int Height);
void ipu_csc(struct macroblock_8 *mb8, struct macroblock_rgb32 *rgb32, int sgn){
void __fastcall ipu_csc(macroblock_8 *mb8, macroblock_rgb32 *rgb32, int sgn){
int i;
u8* p = (u8*)rgb32;
@ -1267,7 +1268,7 @@ void ipu_csc(struct macroblock_8 *mb8, struct macroblock_rgb32 *rgb32, int sgn){
}
}
void ipu_dither2(struct macroblock_rgb32* rgb32, struct macroblock_rgb16 *rgb16, int dte)
void __fastcall ipu_dither2(const macroblock_rgb32* rgb32, macroblock_rgb16 *rgb16, int dte)
{
int i, j;
for(i = 0; i < 16; ++i) {
@ -1280,18 +1281,18 @@ void ipu_dither2(struct macroblock_rgb32* rgb32, struct macroblock_rgb16 *rgb16,
}
}
void ipu_dither(struct macroblock_8 *mb8, struct macroblock_rgb16 *rgb16, int dte)
void __fastcall ipu_dither(macroblock_8 *mb8, macroblock_rgb16 *rgb16, int dte)
{
//SysPrintf("IPU: Dither not implemented");
}
void ipu_vq(struct macroblock_rgb16 *rgb16, u8* indx4){
void __fastcall ipu_vq(macroblock_rgb16 *rgb16, u8* indx4){
Console::Error("IPU: VQ not implemented");
}
void ipu_copy(struct macroblock_8 *mb8, struct macroblock_16 *mb16) {
unsigned char *s=(unsigned char*)mb8;
signed short *d=(signed short*)mb16;
void __fastcall ipu_copy(const macroblock_8 *mb8, macroblock_16 *mb16) {
const u8 *s=(const u8*)mb8;
s16 *d=(s16*)mb16;
int i;
for (i=0; i< 256; i++) *d++ = *s++; //Y bias - 16
for (i=0; i< 64; i++) *d++ = *s++; //Cr bias - 128

View File

@ -42,7 +42,7 @@
//
// Bitfield Structure
//
typedef union {
union tIPU_CMD {
struct {
u32 OPTION : 28; // VDEC decoded value
u32 CMD : 4; // last command
@ -52,7 +52,7 @@ typedef union {
u32 DATA;
u32 BUSY;
};
} tIPU_CMD;
};
#define IPU_CTRL_IFC_M (0x0f<< 0)
#define IPU_CTRL_OFC_M (0x0f<< 4)
@ -188,7 +188,6 @@ struct IPUregisters {
extern tIPU_BP g_BP;
extern int coded_block_pattern;
extern u16 FillInternalBuffer(u32 * pointer, u32 advance, u32 size);
extern int g_nIPU0Data; // or 0x80000000 whenever transferring
extern u8* g_pIPU0Pointer;
@ -202,9 +201,6 @@ void ipuShutdown();
int ipuFreeze(gzFile f, int Mode);
bool ipuCanFreeze();
void IPUCMD_WRITE(u32 val);
void ipuSoftReset();
u32 ipuRead32(u32 mem);
u64 ipuRead64(u32 mem);
@ -219,6 +215,9 @@ namespace Dynarec
void ipuConstWrite64(u32 mem, int mmreg);
}
extern void IPUCMD_WRITE(u32 val);
extern void ipuSoftReset();
extern u16 FillInternalBuffer(u32 * pointer, u32 advance, u32 size);
extern void IPUProcessInterrupt();
extern void ipu0Interrupt();
extern void ipu1Interrupt();

View File

@ -25,6 +25,7 @@
#include "PrecompiledHeader.h"
#include "Common.h"
#include "IPU.h"
#define W1 2841 /* 2048*sqrt (2)*cos (1*pi/16) */
#define W2 2676 /* 2048*sqrt (2)*cos (2*pi/16) */
@ -34,10 +35,11 @@
#define W7 565 /* 2048*sqrt (2)*cos (7*pi/16) */
#define clp(val,res) res = (val < 0) ? 0 : ((val > 255) ? 255 : val);
#define clp2(val,res) res = (val < -255) ? -255 : ((val > 255) ? 255 : val);
/* idct main entry point */
void (* mpeg2_idct_copy) (s16 * block, u8 * dest, int stride);
void (__fastcall *mpeg2_idct_copy) (s16 * block, u8 * dest, int stride);
/* JayteeMaster: changed dest to 16 bit signed */
void (* mpeg2_idct_add) (int last, s16 * block,
void (__fastcall *mpeg2_idct_add) (int last, s16 * block,
/*u8*/s16 * dest, int stride);
/*
@ -64,7 +66,7 @@ do { \
} while (0)
#endif
static void idct_row (s16 * const block)
static __forceinline void idct_row (s16 * const block)
{
int d0, d1, d2, d3;
int a0, a1, a2, a3, b0, b1, b2, b3;
@ -117,7 +119,7 @@ static void idct_row (s16 * const block)
block[7] = (a0 - b0) >> 8;
}
static void idct_col (s16 * const block)
static __forceinline void idct_col (s16 * const block)
{
int d0, d1, d2, d3;
int a0, a1, a2, a3, b0, b1, b2, b3;
@ -158,7 +160,7 @@ static void idct_col (s16 * const block)
block[8*7] = (a0 - b0) >> 17;
}
static void mpeg2_idct_copy_c (s16 * block, u8 * dest,
static void __fastcall mpeg2_idct_copy_c (s16 * block, u8 * dest,
const int stride)
{
int i;
@ -186,7 +188,7 @@ static void mpeg2_idct_copy_c (s16 * block, u8 * dest,
}
/* JayteeMaster: changed dest to 16 bit signed */
static void mpeg2_idct_add_c (const int last, s16 * block,
static void __fastcall mpeg2_idct_add_c (const int last, s16 * block,
/*u8*/s16 * dest, const int stride)
{
int i;

View File

@ -28,24 +28,20 @@
#include "PrecompiledHeader.h"
#include "Common.h"
#include "IPU.h"
#include "Mpeg.h"
#include "Vlc.h"
#include "coroutine.h"
extern void (* __fastcall mpeg2_idct_copy) (s16 * block, u8* dest, int stride);
/* JayteeMaster: changed dest to 16 bit signed */
extern void (* __fastcall mpeg2_idct_add) (int last, s16 * block,
/*u8*/s16* dest, int stride);
/* JayteeMaster: remove static attribute */
/*static */int non_linear_quantizer_scale [] = {
int non_linear_quantizer_scale [] = {
0, 1, 2, 3, 4, 5, 6, 7,
8, 10, 12, 14, 16, 18, 20, 22,
24, 28, 32, 36, 40, 44, 48, 52,
56, 64, 72, 80, 88, 96, 104, 112
};
/* Bitstream and buffer needs to be realocated inorder for sucessful
/* Bitstream and buffer needs to be reallocated in order for successful
reading of the old data. Here the old data stored in the 2nd slot
of the internal buffer is copied to 1st slot, and the new data read
into 1st slot is copied to the 2nd slot. Which will later be copied

View File

@ -25,8 +25,6 @@
#ifndef __MPEG_H__
#define __MPEG_H__
#include "Common.h"
/* macroblock modes */
#define MACROBLOCK_INTRA 1
#define MACROBLOCK_PATTERN 2
@ -160,8 +158,13 @@ struct decoder_t {
int mpeg1;
};
extern void (__fastcall *mpeg2_idct_copy) (s16 * block, u8* dest, int stride);
extern void (__fastcall *mpeg2_idct_add) (int last, s16 * block,
/*u8*/s16* dest, int stride);
#define IDEC 0
#define BDEC 1
void mpeg2sliceIDEC(void* pdone);
void mpeg2_slice(void* pdone);
int get_macroblock_address_increment(decoder_t * const decoder);
@ -170,14 +173,14 @@ int get_macroblock_modes (decoder_t * const decoder);
extern int get_motion_delta (decoder_t * const decoder, const int f_code);
extern int get_dmv (decoder_t * const decoder);
extern int non_linear_quantizer_scale[]; // JayteeMaster: it is needed in Ipu.c
extern int non_linear_quantizer_scale[];
extern decoder_t g_decoder;
void ipu_csc(struct macroblock_8 *mb8, struct macroblock_rgb32 *rgb32, int sgn);
void ipu_dither(struct macroblock_8 *mb8, struct macroblock_rgb16 *rgb16, int dte);
void ipu_dither2(struct macroblock_rgb32* rgb32, struct macroblock_rgb16 *rgb16, int dte);
void ipu_vq(struct macroblock_rgb16 *rgb16, u8* indx4);
void ipu_copy(struct macroblock_8 *mb8, struct macroblock_16 *mb16);
void __fastcall ipu_csc(macroblock_8 *mb8, macroblock_rgb32 *rgb32, int sgn);
void __fastcall ipu_dither(macroblock_8 *mb8, macroblock_rgb16 *rgb16, int dte);
void __fastcall ipu_dither2(const macroblock_rgb32* rgb32, macroblock_rgb16 *rgb16, int dte);
void __fastcall ipu_vq(macroblock_rgb16 *rgb16, u8* indx4);
void __fastcall ipu_copy(const macroblock_8 *mb8, macroblock_16 *mb16);
int slice (decoder_t * const decoder, u8 * buffer);
/* idct.c */

View File

@ -25,7 +25,6 @@
#ifndef __VLC_H__
#define __VLC_H__
#include "IPU.h"
#include "coroutine.h"
static u8 data[2];

View File

@ -24,6 +24,7 @@
#include "PrecompiledHeader.h"
#include "System.h"
#include "mpeg2lib/Mpeg.h"
#include "yuv2rgb.h"
@ -104,28 +105,28 @@ static void __fastcall yuv2rgb_c_32 (u8 * py_1, u8 * py_2,
dst_2 = (u32 *) _dst_2;
do {
_RGB (u32, 0);
DST (py_1, dst_1, 0);
DST (py_2, dst_2, 0);
_RGB (u32, 0);
DST (py_1, dst_1, 0);
DST (py_2, dst_2, 0);
_RGB (u32, 1);
DST (py_2, dst_2, 1);
DST (py_1, dst_1, 1);
_RGB (u32, 1);
DST (py_2, dst_2, 1);
DST (py_1, dst_1, 1);
_RGB (u32, 2);
DST (py_1, dst_1, 2);
DST (py_2, dst_2, 2);
_RGB (u32, 2);
DST (py_1, dst_1, 2);
DST (py_2, dst_2, 2);
_RGB (u32, 3);
DST (py_2, dst_2, 3);
DST (py_1, dst_1, 3);
_RGB (u32, 3);
DST (py_2, dst_2, 3);
DST (py_1, dst_1, 3);
pu += 4;
pv += 4;
py_1 += 8;
py_2 += 8;
dst_1 += 8;
dst_2 += 8;
pu += 4;
pv += 4;
py_1 += 8;
py_2 += 8;
dst_1 += 8;
dst_2 += 8;
} while (--width);
}
@ -143,28 +144,28 @@ static void __fastcall yuv2rgb_c_24_rgb (u8 * py_1, u8 * py_2,
dst_2 = (u8 *) _dst_2;
do {
_RGB (u8, 0);
DSTRGB (py_1, dst_1, 0);
DSTRGB (py_2, dst_2, 0);
_RGB (u8, 0);
DSTRGB (py_1, dst_1, 0);
DSTRGB (py_2, dst_2, 0);
_RGB (u8, 1);
DSTRGB (py_2, dst_2, 1);
DSTRGB (py_1, dst_1, 1);
_RGB (u8, 1);
DSTRGB (py_2, dst_2, 1);
DSTRGB (py_1, dst_1, 1);
_RGB (u8, 2);
DSTRGB (py_1, dst_1, 2);
DSTRGB (py_2, dst_2, 2);
_RGB (u8, 2);
DSTRGB (py_1, dst_1, 2);
DSTRGB (py_2, dst_2, 2);
_RGB (u8, 3);
DSTRGB (py_2, dst_2, 3);
DSTRGB (py_1, dst_1, 3);
_RGB (u8, 3);
DSTRGB (py_2, dst_2, 3);
DSTRGB (py_1, dst_1, 3);
pu += 4;
pv += 4;
py_1 += 8;
py_2 += 8;
dst_1 += 24;
dst_2 += 24;
pu += 4;
pv += 4;
py_1 += 8;
py_2 += 8;
dst_1 += 24;
dst_2 += 24;
} while (--width);
}
@ -182,28 +183,28 @@ static void __fastcall yuv2rgb_c_24_bgr (u8 * py_1, u8 * py_2,
dst_2 = (u8 *) _dst_2;
do {
_RGB (u8, 0);
DSTBGR (py_1, dst_1, 0);
DSTBGR (py_2, dst_2, 0);
_RGB (u8, 0);
DSTBGR (py_1, dst_1, 0);
DSTBGR (py_2, dst_2, 0);
_RGB (u8, 1);
DSTBGR (py_2, dst_2, 1);
DSTBGR (py_1, dst_1, 1);
_RGB (u8, 1);
DSTBGR (py_2, dst_2, 1);
DSTBGR (py_1, dst_1, 1);
_RGB (u8, 2);
DSTBGR (py_1, dst_1, 2);
DSTBGR (py_2, dst_2, 2);
_RGB (u8, 2);
DSTBGR (py_1, dst_1, 2);
DSTBGR (py_2, dst_2, 2);
_RGB (u8, 3);
DSTBGR (py_2, dst_2, 3);
DSTBGR (py_1, dst_1, 3);
_RGB (u8, 3);
DSTBGR (py_2, dst_2, 3);
DSTBGR (py_1, dst_1, 3);
pu += 4;
pv += 4;
py_1 += 8;
py_2 += 8;
dst_1 += 24;
dst_2 += 24;
pu += 4;
pv += 4;
py_1 += 8;
py_2 += 8;
dst_1 += 24;
dst_2 += 24;
} while (--width);
}
@ -222,37 +223,37 @@ static void __fastcall yuv2rgb_c_16 (u8 * py_1, u8 * py_2,
dst_2 = (u16 *) _dst_2;
do {
_RGB (u16, 0);
DST (py_1, dst_1, 0);
DST (py_2, dst_2, 0);
_RGB (u16, 0);
DST (py_1, dst_1, 0);
DST (py_2, dst_2, 0);
_RGB (u16, 1);
DST (py_2, dst_2, 1);
DST (py_1, dst_1, 1);
_RGB (u16, 1);
DST (py_2, dst_2, 1);
DST (py_1, dst_1, 1);
_RGB (u16, 2);
DST (py_1, dst_1, 2);
DST (py_2, dst_2, 2);
_RGB (u16, 2);
DST (py_1, dst_1, 2);
DST (py_2, dst_2, 2);
_RGB (u16, 3);
DST (py_2, dst_2, 3);
DST (py_1, dst_1, 3);
_RGB (u16, 3);
DST (py_2, dst_2, 3);
DST (py_1, dst_1, 3);
pu += 4;
pv += 4;
py_1 += 8;
py_2 += 8;
dst_1 += 8;
dst_2 += 8;
pu += 4;
pv += 4;
py_1 += 8;
py_2 += 8;
dst_1 += 8;
dst_2 += 8;
} while (--width);
}
static int div_round (int dividend, int divisor)
{
if (dividend > 0)
return (dividend + (divisor>>1)) / divisor;
return (dividend + (divisor>>1)) / divisor;
else
return -((-dividend + (divisor>>1)) / divisor);
return -((-dividend + (divisor>>1)) / divisor);
}
static yuv2rgb_c_internal __fastcall * yuv2rgb_c_init (int order, int bpp)
@ -273,96 +274,101 @@ static yuv2rgb_c_internal __fastcall * yuv2rgb_c_init (int order, int bpp)
int cgu = -Inverse_Table_6_9[matrix_coefficients][2];
int cgv = -Inverse_Table_6_9[matrix_coefficients][3];
for (i = 0; i < 1024; i++) {
int j;
for (i = 0; i < 1024; i++)
{
int j;
j = (76309 * (i - 384 - 16) + 32768) >> 16;
j = (j < 0) ? 0 : ((j > 255) ? 255 : j);
table_Y[i] = j;
j = (76309 * (i - 384 - 16) + 32768) >> 16;
j = (j < 0) ? 0 : ((j > 255) ? 255 : j);
table_Y[i] = j;
}
switch (bpp) {
switch (bpp)
{
case 32:
yuv2rgb = yuv2rgb_c_32;
yuv2rgb = yuv2rgb_c_32;
table_32 = (u32 *) malloc ((197 + 2*682 + 256 + 132) *
sizeof (u32));
table_32 = (u32 *) malloc ((197 + 2*682 + 256 + 132) *
sizeof (u32));
entry_size = sizeof (u32);
table_r = table_32 + 197;
table_b = table_32 + 197 + 685;
table_g = table_32 + 197 + 2*682;
entry_size = sizeof (u32);
table_r = table_32 + 197;
table_b = table_32 + 197 + 685;
table_g = table_32 + 197 + 2*682;
for (i = -197; i < 256+197; i++)
((u32 *) table_r)[i] =
table_Y[i+384] << ((order == CONVERT_RGB) ? 16 : 0);
for (i = -132; i < 256+132; i++)
((u32 *) table_g)[i] = table_Y[i+384] << 8;
for (i = -232; i < 256+232; i++)
((u32 *) table_b)[i] =
table_Y[i+384] << ((order == CONVERT_RGB) ? 0 : 16);
for (i = -197; i < 256+197; i++)
((u32 *) table_r)[i] =
table_Y[i+384] << ((order == CONVERT_RGB) ? 16 : 0);
for (i = -132; i < 256+132; i++)
((u32 *) table_g)[i] = table_Y[i+384] << 8;
for (i = -232; i < 256+232; i++)
((u32 *) table_b)[i] =
table_Y[i+384] << ((order == CONVERT_RGB) ? 0 : 16);
break;
case 24:
yuv2rgb = (order == CONVERT_RGB) ? yuv2rgb_c_24_rgb : yuv2rgb_c_24_bgr;
yuv2rgb = (order == CONVERT_RGB) ? yuv2rgb_c_24_rgb : yuv2rgb_c_24_bgr;
table_8 = (u8 *) malloc ((256 + 2*232) * sizeof (u8));
table_8 = (u8 *) malloc ((256 + 2*232) * sizeof (u8));
entry_size = sizeof (u8);
table_r = table_g = table_b = table_8 + 232;
entry_size = sizeof (u8);
table_r = table_g = table_b = table_8 + 232;
for (i = -232; i < 256+232; i++)
((u8 * )table_b)[i] = table_Y[i+384];
for (i = -232; i < 256+232; i++)
((u8 * )table_b)[i] = table_Y[i+384];
break;
case 15:
case 16:
yuv2rgb = yuv2rgb_c_16;
yuv2rgb = yuv2rgb_c_16;
table_16 = (u16 *) malloc ((197 + 2*682 + 256 + 132) *
sizeof (u16));
table_16 = (u16 *) malloc ((197 + 2*682 + 256 + 132) *
sizeof (u16));
entry_size = sizeof (u16);
table_r = table_16 + 197;
table_b = table_16 + 197 + 685;
table_g = table_16 + 197 + 2*682;
entry_size = sizeof (u16);
table_r = table_16 + 197;
table_b = table_16 + 197 + 685;
table_g = table_16 + 197 + 2*682;
for (i = -197; i < 256+197; i++) {
int j = table_Y[i+384] >> 3;
for (i = -197; i < 256+197; i++) {
int j = table_Y[i+384] >> 3;
if (order == CONVERT_RGB)
j <<= ((bpp==16) ? 11 : 10);
if (order == CONVERT_RGB)
j <<= ((bpp==16) ? 11 : 10);
((u16 *)table_r)[i] = j;
}
for (i = -132; i < 256+132; i++) {
int j = table_Y[i+384] >> ((bpp==16) ? 2 : 3);
((u16 *)table_r)[i] = j;
}
for (i = -132; i < 256+132; i++) {
int j = table_Y[i+384] >> ((bpp==16) ? 2 : 3);
((u16 *)table_g)[i] = j << 5;
}
for (i = -232; i < 256+232; i++) {
int j = table_Y[i+384] >> 3;
((u16 *)table_g)[i] = j << 5;
}
for (i = -232; i < 256+232; i++) {
int j = table_Y[i+384] >> 3;
if (order == CONVERT_RGB)
j <<= ((bpp==16) ? 11 : 10);
if (order == CONVERT_RGB)
j <<= ((bpp==16) ? 11 : 10);
((u16 *)table_b)[i] = j;
}
((u16 *)table_b)[i] = j;
}
break;
#ifdef PCSX2_DEVBUILD
default:
fprintf (stderr, "%ibpp not supported by yuv2rgb\n", bpp);
exit (1);
}
DevCon::Error( "IPU Panic! %ibpp not supported by yuv2rgb", params bpp );
#else
jNO_DEFAULT
#endif
}
for (i = 0; i < 256; i++) {
table_rV[i] = (((u8 *)table_r) +
entry_size * div_round (crv * (i-128), 76309));
table_gU[i] = (((u8 *)table_g) +
entry_size * div_round (cgu * (i-128), 76309));
table_gV[i] = entry_size * div_round (cgv * (i-128), 76309);
table_bU[i] = (((u8 *)table_b) +
entry_size * div_round (cbu * (i-128), 76309));
table_rV[i] = (((u8 *)table_r) +
entry_size * div_round (crv * (i-128), 76309));
table_gU[i] = (((u8 *)table_g) +
entry_size * div_round (cgu * (i-128), 76309));
table_gV[i] = entry_size * div_round (cgv * (i-128), 76309);
table_bU[i] = (((u8 *)table_b) +
entry_size * div_round (cbu * (i-128), 76309));
}
return yuv2rgb;
@ -383,12 +389,12 @@ static void __fastcall convert_yuv2rgb_c (void * _id, u8 * Y, u8 * Cr, u8 * Cb,
loop = 8;
do {
id->yuv2rgb (py, py + (id->uv_stride << 1), pu, pv,
id->yuv2rgb (py, py + (id->uv_stride << 1), pu, pv,
dst, dst + id->rgb_stride, id->width);
py += id->uv_stride << 2;
pu += id->uv_stride;
pv += id->uv_stride;
dst += 2 * id->rgb_stride;
py += id->uv_stride << 2;
pu += id->uv_stride;
pv += id->uv_stride;
dst += 2 * id->rgb_stride;
} while (--loop);
}
@ -398,53 +404,52 @@ static void __fastcall convert_start (void * _id, u8 * dest, int flags)
id->rgb_ptr = dest;
switch (flags) {
case CONVERT_BOTTOM_FIELD:
id->rgb_ptr += id->rgb_stride_frame;
/* break thru */
id->rgb_ptr += id->rgb_stride_frame;
/* break thru */
case CONVERT_TOP_FIELD:
id->uv_stride = id->uv_stride_frame << 1;
id->rgb_stride = id->rgb_stride_frame << 1;
id->uv_stride = id->uv_stride_frame << 1;
id->rgb_stride = id->rgb_stride_frame << 1;
break;
default:
id->uv_stride = id->uv_stride_frame;
id->rgb_stride = id->rgb_stride_frame;
id->uv_stride = id->uv_stride_frame;
id->rgb_stride = id->rgb_stride_frame;
}
}
static void __fastcall convert_internal (int order, int bpp, int width, int height,
u32 accel, void * arg,
convert_init_t * result)
u32 accel, void * arg, convert_init_t * result)
{
convert_rgb_t * id = (convert_rgb_t *) result->id;
if (!id) {
result->id_size = sizeof (convert_rgb_t);
result->id_size = sizeof (convert_rgb_t);
} else {
id->width = width;
id->uv_stride_frame = width >> 1;
id->rgb_stride_frame = ((bpp + 7) >> 3) * width;
id->width = width;
id->uv_stride_frame = width >> 1;
id->rgb_stride_frame = ((bpp + 7) >> 3) * width;
result->buf_size[0] = id->rgb_stride_frame * height;
result->buf_size[1] = result->buf_size[2] = 0;
result->start = convert_start;
result->buf_size[0] = id->rgb_stride_frame * height;
result->buf_size[1] = result->buf_size[2] = 0;
result->start = convert_start;
result->copy = NULL;
#ifdef ARCH_X86
if ((result->copy == NULL) && (accel & MPEG2_ACCEL_X86_MMXEXT)) {
result->copy = yuv2rgb_init_mmxext (order, bpp);
}
if ((result->copy == NULL) && (accel & MPEG2_ACCEL_X86_MMX)) {
result->copy = yuv2rgb_init_mmx (order, bpp);
}
#endif
#ifdef LIBVO_MLIB
if ((result->copy == NULL) && (accel & MPEG2_ACCEL_MLIB)) {
result->copy = yuv2rgb_init_mlib (order, bpp);
}
#endif
if (result->copy == NULL) {
result->copy = convert_yuv2rgb_c;
id->yuv2rgb = yuv2rgb_c_init (order, bpp);
}
result->copy = NULL;
#ifdef ARCH_X86
if ((result->copy == NULL) && (accel & MPEG2_ACCEL_X86_MMXEXT)) {
result->copy = yuv2rgb_init_mmxext (order, bpp);
}
if ((result->copy == NULL) && (accel & MPEG2_ACCEL_X86_MMX)) {
result->copy = yuv2rgb_init_mmx (order, bpp);
}
#endif
#ifdef LIBVO_MLIB
if ((result->copy == NULL) && (accel & MPEG2_ACCEL_MLIB)) {
result->copy = yuv2rgb_init_mlib (order, bpp);
}
#endif
if (result->copy == NULL) {
result->copy = convert_yuv2rgb_c;
id->yuv2rgb = yuv2rgb_c_init (order, bpp);
}
}
}

View File

@ -54,6 +54,7 @@ BIOS
#include "VUmicro.h"
#include "GS.h"
#include "vtlb.h"
#include "ipu/IPU.h"
using namespace Dynarec;
using namespace Dynarec::R5900;

View File

@ -615,7 +615,7 @@ void ShutdownPlugins()
ClosePlugins();
// GS is a special case: It needs closed first usually.
// (the GS isn't closed during emulation pauses)
// (the GS isn't always closed during emulation pauses)
if( OpenStatus.GS )
{
gsClose();

View File

@ -25,6 +25,7 @@
#include "R3000A.h"
#include "VUmicro.h"
#include "GS.h"
#include "IPU/IPU.h"
#include "iVUzerorec.h" // for SuperVUReset
@ -385,7 +386,7 @@ static __forceinline void _cpuTestInterrupts()
if( cpuRegs.interrupt & ( 1 | (3 << 3) | (3<<8) | (3<<10)) )
{
TESTINT(0, vif0Interrupt);
#ifndef USE_IPU_SPEEDHACK
#ifndef IPU_INLINE_IRQS
TESTINT(3, ipu0Interrupt);
TESTINT(4, ipu1Interrupt);
#endif
@ -403,7 +404,7 @@ static __forceinline void _cpuTestTIMR()
s_iLastCOP0Cycle = cpuRegs.cycle;
// fixme: this looks like a hack to make up for the fact that the TIMR
// doesn't yet have a proper mecahnism for setting itself up on a nextBranchCycle.
// doesn't yet have a proper mechanism for setting itself up on a nextBranchCycle.
// A proper fix would schedule the TIMR to trigger at a specific cycle anytime
// the Count or Compare registers are modified.

View File

@ -40,7 +40,7 @@ static const struct mc_command_0x26_tag mc_command_0x26= {'+', 512, 16, 0x4000,
__forceinline void SIO_INT()
{
if( !(psxRegs.interrupt & (1<<IopEvt_SIO)) )
PSX_INT(IopEvt_SIO, PSXCLK/250000);
PSX_INT(IopEvt_SIO, 64 ); // PSXCLK/250000);
}
#define SIO_FORCEINLINE __forceinline
#endif

View File

@ -24,10 +24,9 @@
#include "Paths.h"
void SysDetect(); // Detects cpu type and fills cpuInfo structs.
bool SysInit(); // Init logfiles, directories, plugins, and other OS-specific junk
bool SysInit(); // Init logfiles, directories, critical memory resources, and other OS-specific one-time
void SysReset(); // Resets the various PS2 cpus, sub-systems, and recompilers.
void SysUpdate(); // Called on VBlank (to update i.e. pads)
void SysRunGui(); // Returns to the Gui
void SysClose(); // Close mem and plugins
bool SysAllocateMem(); // allocates memory for all PS2 systems; returns FALSe on critical error.
@ -45,7 +44,7 @@ void SysCloseLibrary(void *lib); // Closes Library
// Returns NULL on allocation failure.
void *SysMmap(uptr base, u32 size);
// Unamps a block allocated by SysMmap
// Unmaps a block allocated by SysMmap
void SysMunmap(uptr base, u32 size);
// Writes text to the console.

View File

@ -298,6 +298,7 @@ void OnOK(HWND hW) {
SaveConfig();
SysRestorableReset();
ResetPlugins();
}

View File

@ -19,7 +19,7 @@
</ToolFiles>
<Configurations>
<Configuration
Name="Release vm (dev)|Win32"
Name="Devel vm|Win32"
OutputDirectory="$(SolutionDir)\bin\"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
@ -269,7 +269,7 @@
/>
</Configuration>
<Configuration
Name="Release vtlb (dev)|Win32"
Name="Devel vtlb|Win32"
OutputDirectory="$(SolutionDir)\bin\"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
@ -364,7 +364,7 @@
/>
</Configuration>
<Configuration
Name="Release vm (nondev)|Win32"
Name="Release vm|Win32"
OutputDirectory="$(SolutionDir)\bin\"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
@ -406,7 +406,7 @@
SmallerTypeCheck="false"
BufferSecurityCheck="false"
EnableEnhancedInstructionSet="0"
UsePrecompiledHeader="2"
UsePrecompiledHeader="0"
PrecompiledHeaderThrough="PrecompiledHeader.h"
PrecompiledHeaderFile="$(IntDir)\$(TargetName).pch"
CompileAs="2"
@ -449,7 +449,7 @@
/>
</Configuration>
<Configuration
Name="Release vtlb (nondev)|Win32"
Name="Release vtlb|Win32"
OutputDirectory="$(SolutionDir)\bin\"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
@ -491,7 +491,7 @@
SmallerTypeCheck="false"
BufferSecurityCheck="false"
EnableEnhancedInstructionSet="0"
UsePrecompiledHeader="2"
UsePrecompiledHeader="0"
PrecompiledHeaderThrough="PrecompiledHeader.h"
PrecompiledHeaderFile="$(IntDir)\$(TargetName).pch"
CompileAs="2"
@ -600,7 +600,7 @@
RelativePath="..\WinMain.cpp"
>
<FileConfiguration
Name="Release vm (dev)|Win32"
Name="Devel vm|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -608,7 +608,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vtlb (dev)|Win32"
Name="Devel vtlb|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -616,7 +616,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vm (nondev)|Win32"
Name="Release vm|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -624,7 +624,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vtlb (nondev)|Win32"
Name="Release vtlb|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -636,7 +636,7 @@
RelativePath="..\WinSysExec.cpp"
>
<FileConfiguration
Name="Release vm (dev)|Win32"
Name="Devel vm|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -644,7 +644,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vtlb (dev)|Win32"
Name="Devel vtlb|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -652,7 +652,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vm (nondev)|Win32"
Name="Release vm|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -660,7 +660,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vtlb (nondev)|Win32"
Name="Release vtlb|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -728,7 +728,7 @@
RelativePath="..\..\x86\fast_routines.cpp"
>
<FileConfiguration
Name="Release vm (dev)|Win32"
Name="Devel vm|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -763,7 +763,7 @@
RelativePath="..\..\PrecompiledHeader.cpp"
>
<FileConfiguration
Name="Release vm (dev)|Win32"
Name="Devel vm|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -788,7 +788,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vtlb (dev)|Win32"
Name="Devel vtlb|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -796,7 +796,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vm (nondev)|Win32"
Name="Release vm|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -804,7 +804,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vtlb (nondev)|Win32"
Name="Release vtlb|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -843,7 +843,7 @@
RelativePath="..\..\tinyxml\tinystr.cpp"
>
<FileConfiguration
Name="Release vm (dev)|Win32"
Name="Devel vm|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -867,7 +867,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vtlb (dev)|Win32"
Name="Devel vtlb|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -875,7 +875,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vm (nondev)|Win32"
Name="Release vm|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -883,7 +883,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vtlb (nondev)|Win32"
Name="Release vtlb|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -899,7 +899,7 @@
RelativePath="..\..\tinyxml\tinyxml.cpp"
>
<FileConfiguration
Name="Release vm (dev)|Win32"
Name="Devel vm|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -923,7 +923,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vtlb (dev)|Win32"
Name="Devel vtlb|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -931,7 +931,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vm (nondev)|Win32"
Name="Release vm|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -939,7 +939,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vtlb (nondev)|Win32"
Name="Release vtlb|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -955,7 +955,7 @@
RelativePath="..\..\tinyxml\tinyxmlerror.cpp"
>
<FileConfiguration
Name="Release vm (dev)|Win32"
Name="Devel vm|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -979,7 +979,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vtlb (dev)|Win32"
Name="Devel vtlb|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -987,7 +987,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vm (nondev)|Win32"
Name="Release vm|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -995,7 +995,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vtlb (nondev)|Win32"
Name="Release vtlb|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1007,7 +1007,7 @@
RelativePath="..\..\tinyxml\tinyxmlparser.cpp"
>
<FileConfiguration
Name="Release vm (dev)|Win32"
Name="Devel vm|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1031,7 +1031,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vtlb (dev)|Win32"
Name="Devel vtlb|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1039,7 +1039,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vm (nondev)|Win32"
Name="Release vm|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1047,7 +1047,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vtlb (nondev)|Win32"
Name="Release vtlb|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1059,7 +1059,7 @@
RelativePath="..\..\xmlpatchloader.cpp"
>
<FileConfiguration
Name="Release vm (dev)|Win32"
Name="Devel vm|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1083,7 +1083,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vtlb (dev)|Win32"
Name="Devel vtlb|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1091,7 +1091,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vm (nondev)|Win32"
Name="Release vm|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1099,7 +1099,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vtlb (nondev)|Win32"
Name="Release vtlb|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1131,7 +1131,7 @@
RelativePath="..\..\x86\ix86\ix86.cpp"
>
<FileConfiguration
Name="Release vm (dev)|Win32"
Name="Devel vm|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1155,7 +1155,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vtlb (dev)|Win32"
Name="Devel vtlb|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1163,7 +1163,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vm (nondev)|Win32"
Name="Release vm|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1179,7 +1179,7 @@
RelativePath="..\..\x86\ix86\ix86_3dnow.cpp"
>
<FileConfiguration
Name="Release vm (dev)|Win32"
Name="Devel vm|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1203,7 +1203,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vtlb (dev)|Win32"
Name="Devel vtlb|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1211,7 +1211,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vm (nondev)|Win32"
Name="Release vm|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1223,7 +1223,7 @@
RelativePath="..\..\x86\ix86\ix86_cpudetect.cpp"
>
<FileConfiguration
Name="Release vm (dev)|Win32"
Name="Devel vm|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1247,7 +1247,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vtlb (dev)|Win32"
Name="Devel vtlb|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1259,7 +1259,7 @@
RelativePath="..\..\x86\ix86\ix86_fpu.cpp"
>
<FileConfiguration
Name="Release vm (dev)|Win32"
Name="Devel vm|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1283,7 +1283,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vtlb (dev)|Win32"
Name="Devel vtlb|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1291,7 +1291,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vm (nondev)|Win32"
Name="Release vm|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1303,7 +1303,7 @@
RelativePath="..\..\x86\ix86\ix86_mmx.cpp"
>
<FileConfiguration
Name="Release vm (dev)|Win32"
Name="Devel vm|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1327,7 +1327,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vtlb (dev)|Win32"
Name="Devel vtlb|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1335,7 +1335,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vm (nondev)|Win32"
Name="Release vm|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1347,7 +1347,7 @@
RelativePath="..\..\x86\ix86\ix86_sse.cpp"
>
<FileConfiguration
Name="Release vm (dev)|Win32"
Name="Devel vm|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1371,7 +1371,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vtlb (dev)|Win32"
Name="Devel vtlb|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1379,7 +1379,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vm (nondev)|Win32"
Name="Release vm|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1399,7 +1399,7 @@
RelativePath="..\..\zlib\adler32.c"
>
<FileConfiguration
Name="Release vm (dev)|Win32"
Name="Devel vm|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1426,7 +1426,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vtlb (dev)|Win32"
Name="Devel vtlb|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1435,7 +1435,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vm (nondev)|Win32"
Name="Release vm|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1444,7 +1444,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vtlb (nondev)|Win32"
Name="Release vtlb|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1457,7 +1457,7 @@
RelativePath="..\..\zlib\compress.c"
>
<FileConfiguration
Name="Release vm (dev)|Win32"
Name="Devel vm|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1484,7 +1484,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vtlb (dev)|Win32"
Name="Devel vtlb|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1493,7 +1493,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vm (nondev)|Win32"
Name="Release vm|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1502,7 +1502,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vtlb (nondev)|Win32"
Name="Release vtlb|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1515,7 +1515,7 @@
RelativePath="..\..\zlib\crc32.c"
>
<FileConfiguration
Name="Release vm (dev)|Win32"
Name="Devel vm|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1542,7 +1542,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vtlb (dev)|Win32"
Name="Devel vtlb|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1551,7 +1551,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vm (nondev)|Win32"
Name="Release vm|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1560,7 +1560,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vtlb (nondev)|Win32"
Name="Release vtlb|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1573,7 +1573,7 @@
RelativePath="..\..\zlib\deflate.c"
>
<FileConfiguration
Name="Release vm (dev)|Win32"
Name="Devel vm|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1600,7 +1600,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vtlb (dev)|Win32"
Name="Devel vtlb|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1609,7 +1609,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vm (nondev)|Win32"
Name="Release vm|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1618,7 +1618,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vtlb (nondev)|Win32"
Name="Release vtlb|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1631,7 +1631,7 @@
RelativePath="..\..\zlib\gzio.c"
>
<FileConfiguration
Name="Release vm (dev)|Win32"
Name="Devel vm|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1658,7 +1658,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vtlb (dev)|Win32"
Name="Devel vtlb|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1667,7 +1667,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vm (nondev)|Win32"
Name="Release vm|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1676,7 +1676,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vtlb (nondev)|Win32"
Name="Release vtlb|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1689,7 +1689,7 @@
RelativePath="..\..\zlib\infback.c"
>
<FileConfiguration
Name="Release vm (dev)|Win32"
Name="Devel vm|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1716,7 +1716,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vtlb (dev)|Win32"
Name="Devel vtlb|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1725,7 +1725,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vm (nondev)|Win32"
Name="Release vm|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1734,7 +1734,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vtlb (nondev)|Win32"
Name="Release vtlb|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1747,7 +1747,7 @@
RelativePath="..\..\zlib\inffast.c"
>
<FileConfiguration
Name="Release vm (dev)|Win32"
Name="Devel vm|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1774,7 +1774,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vtlb (dev)|Win32"
Name="Devel vtlb|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1783,7 +1783,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vm (nondev)|Win32"
Name="Release vm|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1792,7 +1792,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vtlb (nondev)|Win32"
Name="Release vtlb|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1805,7 +1805,7 @@
RelativePath="..\..\zlib\inflate.c"
>
<FileConfiguration
Name="Release vm (dev)|Win32"
Name="Devel vm|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1832,7 +1832,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vtlb (dev)|Win32"
Name="Devel vtlb|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1841,7 +1841,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vm (nondev)|Win32"
Name="Release vm|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1850,7 +1850,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vtlb (nondev)|Win32"
Name="Release vtlb|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1863,7 +1863,7 @@
RelativePath="..\..\zlib\inftrees.c"
>
<FileConfiguration
Name="Release vm (dev)|Win32"
Name="Devel vm|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1890,7 +1890,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vtlb (dev)|Win32"
Name="Devel vtlb|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1899,7 +1899,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vm (nondev)|Win32"
Name="Release vm|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1908,7 +1908,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vtlb (nondev)|Win32"
Name="Release vtlb|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1921,7 +1921,7 @@
RelativePath="..\..\zlib\trees.c"
>
<FileConfiguration
Name="Release vm (dev)|Win32"
Name="Devel vm|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1948,7 +1948,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vtlb (dev)|Win32"
Name="Devel vtlb|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1957,7 +1957,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vm (nondev)|Win32"
Name="Release vm|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1966,7 +1966,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vtlb (nondev)|Win32"
Name="Release vtlb|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1979,7 +1979,7 @@
RelativePath="..\..\zlib\uncompr.c"
>
<FileConfiguration
Name="Release vm (dev)|Win32"
Name="Devel vm|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -2006,7 +2006,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vtlb (dev)|Win32"
Name="Devel vtlb|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -2015,7 +2015,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vm (nondev)|Win32"
Name="Release vm|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -2024,7 +2024,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vtlb (nondev)|Win32"
Name="Release vtlb|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -2037,7 +2037,7 @@
RelativePath="..\..\zlib\zutil.c"
>
<FileConfiguration
Name="Release vm (dev)|Win32"
Name="Devel vm|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -2064,7 +2064,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vtlb (dev)|Win32"
Name="Devel vtlb|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -2073,7 +2073,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vm (nondev)|Win32"
Name="Release vm|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -2082,7 +2082,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vtlb (nondev)|Win32"
Name="Release vtlb|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -2251,7 +2251,7 @@
RelativePath="..\..\Counters.cpp"
>
<FileConfiguration
Name="Release vm (dev)|Win32"
Name="Devel vm|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -2259,7 +2259,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vm (nondev)|Win32"
Name="Release vm|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -2267,7 +2267,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vtlb (nondev)|Win32"
Name="Release vtlb|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -2296,7 +2296,7 @@
RelativePath="..\..\InterTables.cpp"
>
<FileConfiguration
Name="Release vm (dev)|Win32"
Name="Devel vm|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -2366,7 +2366,7 @@
RelativePath="..\..\x86\iFPU.cpp"
>
<FileConfiguration
Name="Release vm (dev)|Win32"
Name="Devel vm|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -2390,7 +2390,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vtlb (dev)|Win32"
Name="Devel vtlb|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -2398,7 +2398,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vm (nondev)|Win32"
Name="Release vm|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -2406,7 +2406,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vtlb (nondev)|Win32"
Name="Release vtlb|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -2635,7 +2635,7 @@
RelativePath="..\..\IPU\coroutine.cpp"
>
<FileConfiguration
Name="Release vm (dev)|Win32"
Name="Devel vm|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -2654,7 +2654,7 @@
RelativePath="..\..\Ipu\IPU.cpp"
>
<FileConfiguration
Name="Release vm (dev)|Win32"
Name="Devel vm|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -2678,7 +2678,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vtlb (dev)|Win32"
Name="Devel vtlb|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -2686,7 +2686,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vm (nondev)|Win32"
Name="Release vm|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -2694,7 +2694,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release vtlb (nondev)|Win32"
Name="Release vtlb|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -2710,7 +2710,7 @@
RelativePath="..\..\Ipu\yuv2rgb.cpp"
>
<FileConfiguration
Name="Release vm (dev)|Win32"
Name="Devel vm|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -2728,7 +2728,7 @@
RelativePath="..\..\Ipu\mpeg2lib\Idct.cpp"
>
<FileConfiguration
Name="Release vm (dev)|Win32"
Name="Devel vm|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -2739,7 +2739,7 @@
RelativePath="..\..\Ipu\mpeg2lib\Mpeg.cpp"
>
<FileConfiguration
Name="Release vm (dev)|Win32"
Name="Devel vm|Win32"
>
<Tool
Name="VCCLCompilerTool"

View File

@ -74,22 +74,22 @@ void OnStates_LoadOther();
void OnStates_SaveOther();
int ParseCommandLine( int tokenCount, TCHAR *const *const tokens );
void RunExecute( const char* elf_file, bool use_bios=false );
void ExecuteCpu();
void strcatz(char *dst, char *src);
BOOL CALLBACK PatchBDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam);
BOOL CALLBACK CpuDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam);
BOOL CALLBACK AdvancedOptionsProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam);
BOOL APIENTRY HacksProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
BOOL CALLBACK HacksProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
extern AppData gApp;
extern HWND hStatusWnd;
extern PcsxConfig winConfig; // local storage of the configuration options.
extern bool g_GameInProgress;
extern bool m_ReturnToGame; // set to exit the RunGui message pump
extern bool g_ReturnToGui; // set to exit the execution of the emulator and return control to the GUI
extern bool g_EmulationInProgress; // Set TRUE if a game is actively running (set to false on reset)
extern int UseGui;
extern int nDisableSC; // screensaver
extern bool AccBreak;
extern unsigned int langsMax;
extern MemoryAlloc<u8>* g_RecoveryState;

View File

@ -16,13 +16,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
// WARNING! Do not put code in this module that uses try/catch. MSVC appears to have
// a compiler bug that generates some seriously bad stackframe management if both
// types of exception handling are used in the same module. Compiler bugs are rare,
// and it's usually user error, but in this case I'm pretty sure I found one.
// So put your c++ exception code in WinSysExec.cpp. It's better that way. :D (air)
#include "PrecompiledHeader.h"
#include "win32.h"
@ -46,7 +39,6 @@
#include "implement.h" // pthreads-win32 defines for startup/shutdown
bool AccBreak = false;
unsigned int langsMax;
@ -182,7 +174,6 @@ void WinClose()
// Don't check Config.Profiler here -- the Profiler will know if it's running or not.
ProfilerTerm();
timeEndPeriod( 1 );
ReleasePlugins();
Console::Close();
@ -195,27 +186,107 @@ void WinClose()
#ifdef PCSX2_VIRTUAL_MEM
VirtualFree(PS2MEM_BASE, 0, MEM_RELEASE);
#endif
exit(0);
}
/*class SehException
{
public:
uint m_code;
const _EXCEPTION_POINTERS& m_info;
public:
SehException(uint code, const _EXCEPTION_POINTERS& eptr ) : m_code(code), m_info(eptr) { }
};
void SehTranslatorFunction( uint code, _EXCEPTION_POINTERS* eptr )
{
throw SehException( code, *eptr );
}*/
BOOL SysLoggedSetLockPagesPrivilege ( HANDLE hProcess, BOOL bEnable);
void WinRun( int nCmdShow )
{
try
{
SysInit();
// Load the command line overrides for plugins.
// Back up the user's preferences in winConfig.
memcpy( &winConfig, &Config, sizeof( PcsxConfig ) );
if( g_TestRun.pgsdll )
{
_tcscpy_s( Config.GS, g_MaxPath, g_TestRun.pgsdll );
Console::Notice( "* GS plugin override: \n\t%s\n", params Config.GS );
}
if( g_TestRun.pcdvddll )
{
_tcscpy_s( Config.CDVD, g_MaxPath, g_TestRun.pcdvddll );
Console::Notice( "* CDVD plugin override: \n\t%s\n", params Config.CDVD );
}
if( g_TestRun.pspudll )
{
_tcscpy_s( Config.SPU2, g_MaxPath, g_TestRun.pspudll );
Console::Notice( "* SPU2 plugin override: \n\t%s\n", params Config.SPU2 );
}
// [TODO] : Add the other plugin overrides here...
#ifndef _DEBUG
if( Config.Profiler )
ProfilerInit();
#endif
InitCPUTicks();
while (LoadPlugins() == -1)
{
if (Pcsx2Configure(NULL) == FALSE) return;
}
if( IsDevBuild && (g_TestRun.enabled || g_TestRun.ptitle != NULL) )
{
// run without ui
UseGui = 0;
RunExecute( g_TestRun.efile ? g_TestRun.ptitle : NULL );
return;
}
#ifdef PCSX2_DEVBUILD
if( g_pRunGSState ) {
LoadGSState(g_pRunGSState);
return;
}
#endif
CreateMainWindow( nCmdShow );
if( Config.PsxOut )
{
// output the help commands
Console::SetColor( Console::Color_White );
Console::WriteLn( "Hotkeys:" );
Console::WriteLn(
"\tF1 - save state\n"
"\t(Shift +) F2 - cycle states\n"
"\tF3 - load state"
);
DevCon::WriteLn(
//"\tF10 - dump performance counters\n"
"\tF11 - save GS state\n"
//"\tF12 - dump hardware registers"
);
Console::ClearColor();
}
LoadPatch("default");
RunGui();
}
catch( Exception::BaseException& ex )
{
Msgbox::Alert(
"An unhandled or unrecoverable exception occurred, with the message:\n\n" + ex.Message() +
"\n\nPcsx2 will now close. More details may be available via the emuLog.txt file." );
}
catch( std::exception& ex )
{
Msgbox::Alert(
string( "An unhandled or unrecoverable exception occurred, with the message:\n\n" ) + ex.what() +
"\n\nPcsx2 will now close. More details may be available via the emuLog.txt file." );
}
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
char *lang;
@ -311,103 +382,8 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
// Console::WriteLn("-help to see arguments");
}
if( !SysInit() )
WinClose();
// Load the command line overrides for plugins.
// Back up the user's preferences in winConfig.
memcpy( &winConfig, &Config, sizeof( PcsxConfig ) );
if( g_TestRun.pgsdll )
{
_tcscpy_s( Config.GS, g_MaxPath, g_TestRun.pgsdll );
Console::Notice( "* GS plugin override: \n\t%s\n", params Config.GS );
}
if( g_TestRun.pcdvddll )
{
_tcscpy_s( Config.CDVD, g_MaxPath, g_TestRun.pcdvddll );
Console::Notice( "* CDVD plugin override: \n\t%s\n", params Config.CDVD );
}
if( g_TestRun.pspudll )
{
_tcscpy_s( Config.SPU2, g_MaxPath, g_TestRun.pspudll );
Console::Notice( "* SPU2 plugin override: \n\t%s\n", params Config.SPU2 );
}
// [TODO] : Add the other plugin overrides here...
#ifndef _DEBUG
if( Config.Profiler )
ProfilerInit();
#endif
while (LoadPlugins() == -1) {
if (Pcsx2Configure(NULL) == FALSE) {
WinClose(); // user cancelled.
}
}
// This makes sure the Windows Kernel is using high resolution
// timeslices for Sleep calls.
// (may not make much difference on most desktops but can improve performance
// a lot on laptops).
timeBeginPeriod( 1 );
InitCPUTicks();
if( IsDevBuild && (g_TestRun.enabled || g_TestRun.ptitle != NULL) ) {
// run without ui
UseGui = 0;
SysReset();
RunExecute( g_TestRun.efile ? g_TestRun.ptitle : NULL );
WinClose();
return 0; // success!
}
#ifdef PCSX2_DEVBUILD
if( g_pRunGSState ) {
LoadGSState(g_pRunGSState);
WinClose();
return 0;
}
#endif
CreateMainWindow( nCmdShow );
if( Config.PsxOut )
{
// output the help commands
Console::SetColor( Console::Color_White );
Console::WriteLn( "Hotkeys:" );
Console::WriteLn(
"\tF1 - save state\n"
"\t(Shift +) F2 - cycle states\n"
"\tF3 - load state"
);
DevCon::WriteLn(
//"\tF10 - dump performance counters\n"
"\tF11 - save GS state\n"
//"\tF12 - dump hardware registers"
);
Console::ClearColor();
}
LoadPatch("default");
RunGui();
/*}
catch( SehException& ex )
{
SysPageFaultExceptionFilter( ex.m_info );
}*/
// Note : Because of how the GUI and recompiler function, this area of
// the code is effectively unreachable. Program termination is handled
// by a call to WinClose instead. (above)
WinRun( nCmdShow );
WinClose();
return 0;
}
@ -416,8 +392,12 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
void RunGui() {
MSG msg;
for (;;) {
if(PeekMessage(&msg, NULL, 0U, 0U, PM_REMOVE)) {
while( true )
{
if( PeekMessage(&msg, NULL, 0U, 0U, PM_REMOVE) != 0 )
{
if( msg.message == WM_QUIT ) return;
TranslateMessage(&msg);
DispatchMessage(&msg);
}
@ -641,15 +621,14 @@ LRESULT WINAPI MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
return FALSE;
case ID_RUN_EXECUTE:
if( g_GameInProgress )
{
m_ReturnToGame = true;
}
if( g_EmulationInProgress )
ExecuteCpu();
else
RunExecute( NULL, true ); // boots bios if no savestate is to be recovered
return FALSE;
case ID_FILE_RUNCD:
g_EmulationInProgress = false;
safe_delete( g_RecoveryState );
safe_delete( g_gsRecoveryState );
ResetPlugins();
@ -752,8 +731,8 @@ LRESULT WINAPI MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
R5900::cpuExecuteBios();
DialogBox(gApp.hInstance, MAKEINTRESOURCE(IDD_RDEBUG), NULL, (DLGPROC)RemoteDebuggerProc);
CreateMainWindow(SW_SHOWNORMAL);
RunGui();
//CreateMainWindow(SW_SHOWNORMAL);
//RunGui();
}
}
return FALSE;
@ -854,7 +833,6 @@ LRESULT WINAPI MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
default:
if (LOWORD(wParam) >= ID_LANGS && LOWORD(wParam) <= (ID_LANGS + langsMax)) {
AccBreak = true;
DestroyWindow(gApp.hWnd);
ChangeLanguage(langs[LOWORD(wParam) - ID_LANGS].lang);
CreateMainWindow(SW_SHOWNORMAL);
@ -864,26 +842,23 @@ LRESULT WINAPI MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
return TRUE;
case WM_DESTROY:
if (!AccBreak)
{
// [TODO] : Check if a game is active in the emulator and ask the user
// before closing!
DeleteObject(hbitmap_background);
WinClose();
} else AccBreak = false;
DeleteObject(hbitmap_background);
PostQuitMessage(0);
gApp.hWnd = NULL;
return FALSE;
// Explicit handling of WM_CLOSE.
// This is Windows default behavior, but we handle it here sot hat we might add a
// user confirmation prompt prior to exit (someday!)
case WM_CLOSE:
DestroyWindow( hWnd );
return TRUE;
case WM_SYSCOMMAND:
if( nDisableSC && (wParam== SC_SCREENSAVE || wParam == SC_MONITORPOWER) ) {
return FALSE;
}
break;
case WM_QUIT:
if (Config.PsxOut)
Console::Close();
return TRUE;
}
return DefWindowProc(hWnd, msg, wParam, lParam);
@ -1060,6 +1035,8 @@ void CreateMainWindow(int nCmdShow) {
RECT rect;
int w, h;
g_ReturnToGui = true;
#ifdef _MSC_VER
sprintf(COMPILER, "(VC%d)", (_MSC_VER+100)/200);//hacky:) works for VC6 & VC.NET
#elif __BORLANDC__
@ -1132,10 +1109,6 @@ void CreateMainWindow(int nCmdShow) {
ShowWindow(hWnd, nCmdShow);
SetWindowPos(hWnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
// If we're coming off the GS plugin then we need to force ourselves to the top:
if( g_GameInProgress )
SetForegroundWindow( hWnd );
}

View File

@ -41,9 +41,8 @@ MemoryAlloc<u8>* g_RecoveryState = NULL;
MemoryAlloc<u8>* g_gsRecoveryState = NULL;
bool m_ReturnToGame = false; // set to exit the RunGui message pump
bool g_GameInProgress = false; // Set TRUE if a game is actively running (set to false on reset)
bool m_EmuStateActive = false; // Set TRUE when the GUI is running from the context of an emulation EventTest
bool g_ReturnToGui = false; // set to exit the execution of the emulator and return control to the GUI
bool g_EmulationInProgress = false; // Set TRUE if a game is actively running (set to false on reset)
// This instance is not modified by command line overrides so
// that command line plugins and stuff won't be saved into the
@ -191,51 +190,76 @@ __forceinline void SysUpdate() {
KeyEvent( (ev1 != NULL) ? ev1 : ev2);
}
static void TryRecoverFromGsState()
{
if( g_gsRecoveryState != NULL )
{
s32 dummylen;
memLoadingState eddie( *g_gsRecoveryState );
eddie.FreezePlugin( "GS", gsSafeFreeze );
eddie.Freeze( dummylen ); // reads the length value recorded earlier.
eddie.gsFreeze();
}
}
void ExecuteCpu()
{
// Make sure any left-over recovery states are cleaned up.
safe_delete( g_RecoveryState );
// Just in case they weren't initialized earlier (no harm in calling this multiple times)
if (OpenPlugins(NULL) == -1) return;
// this needs to be called for every new game!
// (note: sometimes launching games through bios will give a crc of 0)
if( GSsetGameCRC != NULL )
GSsetGameCRC(ElfCRC, g_ZeroGSOptions);
TryRecoverFromGsState();
safe_delete( g_gsRecoveryState );
// This tells the WM_DELETE handler of our GUI that we don't want the
// system and plugins shut down, thanks...
if( UseGui )
AccBreak = true;
// ... and destroy the window. Ugly thing.
DestroyWindow( gApp.hWnd );
gApp.hWnd = NULL;
g_GameInProgress = true;
if( !m_EmuStateActive )
//DestroyWindow( gApp.hWnd );
//gApp.hWnd = NULL;
ShowWindow( gApp.hWnd, SW_HIDE );
g_EmulationInProgress = true;
g_ReturnToGui = false;
// Optimization: We hardcode two versions of the EE here -- one for recs and one for ints.
// This is because recs are performance critical, and being able to inline them into the
// function here helps considerably.
timeBeginPeriod( 1 );
PCSX2_MEM_PROTECT_BEGIN();
if( Cpu == &R5900::recCpu )
{
// Optimization: We hardcode two versions of the EE here -- one for recs and one for ints.
// This is because recs are performance critical, and being able to inline them into the
// function here helps considerably.
PCSX2_MEM_PROTECT_BEGIN();
if( Cpu == &R5900::recCpu )
while( !g_ReturnToGui )
{
while( true )
{
Dynarec::R5900::recExecute();
SysUpdate();
}
g_GameInProgress = false;
Dynarec::R5900::recExecute();
SysUpdate();
}
else if( Cpu == &R5900::intCpu )
{
while( true )
{
R5900::Interpreter::intExecute();
SysUpdate();
}
g_GameInProgress = false;
}
PCSX2_MEM_PROTECT_END();
}
else
m_ReturnToGame = true;
else if( Cpu == &R5900::intCpu )
{
while( !g_ReturnToGui )
{
R5900::Interpreter::intExecute();
SysUpdate();
}
}
PCSX2_MEM_PROTECT_END();
timeEndPeriod( 1 );
ShowWindow( gApp.hWnd, SW_SHOW );
SetForegroundWindow( gApp.hWnd );
}
// Runs and ELF image directly (ISO or ELF program or BIN)
@ -246,8 +270,9 @@ void RunExecute( const char* elf_file, bool use_bios )
SetPriorityClass(GetCurrentProcess(), Config.ThPriority == THREAD_PRIORITY_HIGHEST ? ABOVE_NORMAL_PRIORITY_CLASS : NORMAL_PRIORITY_CLASS);
nDisableSC = 1;
g_GameInProgress = false;
// Issue a cpu reset if the emulation state is invalid or if a recovery state
// is waiting to be loaded.
try
{
cpuReset();
@ -280,16 +305,15 @@ void RunExecute( const char* elf_file, bool use_bios )
ClosePlugins();
return;
}
safe_delete( g_RecoveryState );
}
else
else if( g_gsRecoveryState == NULL )
{
// Not recovering a state, so need to execute the bios and load the ELF information.
// (note: gsRecoveries are done from ExecuteCpu)
// Note: if the elf_file is null we use the CDVD elf file.
// if the elf_file is null we use the CDVD elf file.
// But if the elf_file is an empty string then we boot the bios instead.
m_EmuStateActive = false; // make sure to start a new emu state when running cpuExecuteBios();
cpuExecuteBios();
char ename[g_MaxPath];
ename[0] = 0;
@ -303,64 +327,13 @@ void RunExecute( const char* elf_file, bool use_bios )
// Custom ELF specified (not using CDVD).
// Run the BIOS and load the ELF.
m_EmuStateActive = false; // make sure to start a new emu state when running cpuExecuteBios();
cpuExecuteBios();
loadElfFile( elf_file );
}
// this needs to be called for every new game!
// (note: sometimes launching games through bios will give a crc of 0)
if( GSsetGameCRC != NULL )
GSsetGameCRC(ElfCRC, g_ZeroGSOptions);
ExecuteCpu();
}
void RunGuiAndReturn() {
MSG msg;
m_ReturnToGame = false;
m_EmuStateActive = true;
while( !m_ReturnToGame )
{
if(PeekMessage(&msg, NULL, 0U, 0U, PM_REMOVE)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
Sleep(10);
}
// re-init plugins before returning execution:
OpenPlugins( NULL );
if( g_gsRecoveryState != NULL )
{
s32 dummylen;
memLoadingState eddie( *g_gsRecoveryState );
eddie.FreezePlugin( "GS", gsSafeFreeze );
eddie.Freeze( dummylen ); // reads the length value recorded earlier.
eddie.gsFreeze();
safe_delete( g_gsRecoveryState );
if( GSsetGameCRC != NULL )
GSsetGameCRC(ElfCRC, g_ZeroGSOptions);
}
if( gApp.hWnd != NULL )
{
AccBreak = true;
DestroyWindow(gApp.hWnd);
gApp.hWnd = NULL;
}
}
class RecoveryMemSavingState : public memSavingState, Sealed
{
public:
@ -494,7 +467,7 @@ void States_Load( const string& file, int num )
ssprintf( message,
"Encountered an error while loading savestate from file: %s.\n", params file );
if( g_GameInProgress )
if( g_EmulationInProgress )
message += "Since the savestate load was incomplete, the emulator has been reset.\n";
message += "\nError: " + ex.Message();
@ -563,7 +536,7 @@ void States_Save(int num)
return;
}
if( !g_GameInProgress )
if( !g_EmulationInProgress )
{
Msgbox::Alert( "You need to start a game first before you can save it's state." );
return;
@ -692,10 +665,8 @@ static void __fastcall KeyEvent(keyEvent* ev)
// Woops! Something was unrecoverable. Bummer.
// Let's give the user a RunGui!
g_GameInProgress = false;
m_EmuStateActive = false;
CreateMainWindow( SW_SHOWNORMAL );
RunGui(); // ah the beauty of perpetual stack recursion! (air)
g_EmulationInProgress = false;
g_ReturnToGui = true;
}
break;
@ -708,9 +679,11 @@ static void __fastcall KeyEvent(keyEvent* ev)
}
#endif
if (CHECK_ESCAPE_HACK) {
PostMessage(GetForegroundWindow(), WM_CLOSE, 0, 0);
WinClose();
g_ReturnToGui = true;
if( CHECK_ESCAPE_HACK )
{
//PostMessage(GetForegroundWindow(), WM_CLOSE, 0, 0);
DestroyWindow( gApp.hWnd );
}
else
{
@ -730,11 +703,8 @@ static void __fastcall KeyEvent(keyEvent* ev)
PluginsResetGS();
}
//ClosePlugins();
CreateMainWindow(SW_SHOWNORMAL);
ClosePlugins();
nDisableSC = 0;
RunGuiAndReturn();
}
break;
@ -750,7 +720,7 @@ static bool sinit=false;
void SysRestorableReset()
{
// already reset? and saved?
if( !g_GameInProgress ) return;
if( !g_EmulationInProgress ) return;
if( g_RecoveryState != NULL ) return;
try
@ -758,7 +728,7 @@ void SysRestorableReset()
g_RecoveryState = new MemoryAlloc<u8>( "Memory Savestate Recovery" );
RecoveryMemSavingState().FreezeAll();
safe_delete( g_gsRecoveryState );
g_GameInProgress = false;
g_EmulationInProgress = false;
}
catch( std::runtime_error& ex )
{
@ -767,31 +737,33 @@ void SysRestorableReset()
"Error: %s", params ex.what() );
safe_delete( g_RecoveryState );
}
SetCursor( LoadCursor( gApp.hInstance, IDC_ARROW ) );
}
void SysReset()
{
if (!sinit) return;
// fixme - this code sets the sttusbar but never returns control to the window message pump
// so the status bar won't recieve the WM_PAINT messages needed to update itself anyway.
// fixme - this code sets the statusbar but never returns control to the window message pump
// so the status bar won't receive the WM_PAINT messages needed to update itself anyway.
// Oops! (air)
StatusBar_Notice(_("Resetting..."));
g_GameInProgress = false;
g_EmulationInProgress = false;
safe_delete( g_RecoveryState );
safe_delete( g_gsRecoveryState );
ResetPlugins();
// Note : No need to call cpuReset() here. It gets called automatically before the
// emulator resumes execution.
StatusBar_Notice(_("Ready"));
}
bool SysInit()
{
if( sinit )
SysClose();
if( sinit ) return true;
sinit = true;
CreateDirectory(MEMCARDS_DIR, NULL);
CreateDirectory(SSTATES_DIR, NULL);
@ -808,7 +780,6 @@ bool SysInit()
SysAllocateDynarecs();
sinit = true;
return true;
}
@ -822,10 +793,6 @@ void SysClose() {
}
void SysRunGui() {
RunGui();
}
static const char *err = N_("Error Loading Symbol");
static int errval;
@ -861,7 +828,6 @@ void *SysMmap(uptr base, u32 size) {
void *mem;
mem = VirtualAlloc((void*)base, size, MEM_RESERVE | MEM_COMMIT, PAGE_EXECUTE_READWRITE);
//mem = VirtualAlloc((void*)mem, size, MEM_COMMIT , PAGE_EXECUTE_READWRITE);
return mem;
}

View File

@ -42,14 +42,15 @@ namespace COP0 {
* *
*********************************************************/
void recBC0F() { recCall( Interp::BC0F, 0 ); }
void recBC0T() { recCall( Interp::BC0T, 0 ); }
void recBC0FL() { recCall( Interp::BC0FL, 0 ); }
void recBC0TL() { recCall( Interp::BC0TL, 0 ); }
void recTLBR() { recCall( Interp::TLBR, 0 ); }
void recTLBWI() { recCall( Interp::TLBWI, 0 ); }
void recTLBWR() { recCall( Interp::TLBWR, 0 ); }
void recTLBP() { recCall( Interp::TLBP, 0 ); }
void recBC0F() { recBranchCall( Interp::BC0F ); }
void recBC0T() { recBranchCall( Interp::BC0T ); }
void recBC0FL() { recBranchCall( Interp::BC0FL ); }
void recBC0TL() { recBranchCall( Interp::BC0TL ); }
void recTLBR() { recBranchCall( Interp::TLBR ); }
void recTLBWI() { recBranchCall( Interp::TLBWI ); }
void recTLBWR() { recBranchCall( Interp::TLBWR ); }
void recTLBP() { recBranchCall( Interp::TLBP ); }
#ifndef CP0_RECOMPILE

View File

@ -47,7 +47,6 @@ namespace R5900
// In order to make sure a branch test is performed, the nextBranchCycle is set
// to the current cpu cycle.
branch = 2;
MOV32ItoM( (uptr)&cpuRegs.code, cpuRegs.code );
MOV32MtoR( ECX, (uptr)&cpuRegs.cycle );
MOV32ItoM( (uptr)&cpuRegs.pc, pc );
@ -57,6 +56,7 @@ namespace R5900
// recompiler inserts the branchtest anyway.
iFlushCall(FLUSH_EVERYTHING);
CALLFunc( (uptr)func );
branch = 2;
}
void recCall( void (*func)(), int delreg )

View File

@ -675,8 +675,8 @@ __forceinline void recExecute()
//PCSX2_MEM_PROTECT_BEGIN()
while( true )
{
if( recEventTest() ) break;
execute();
if( recEventTest() ) break;
}
//PCSX2_MEM_PROTECT_END()
}

View File

@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pcsx2", "pcsx2\windows\VCprojects\pcsx2_2008.vcproj", "{1CEFD830-2B76-4596-A4EE-BCD7280A60BD}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pcsx2pg", "pcsx2\windows\VCprojects\pcsx2_2008.vcproj", "{1CEFD830-2B76-4596-A4EE-BCD7280A60BD}"
ProjectSection(ProjectDependencies) = postProject
{26511268-2902-4997-8421-ECD7055F9E28} = {26511268-2902-4997-8421-ECD7055F9E28}
EndProjectSection
@ -12,36 +12,36 @@ Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug vm|Win32 = Debug vm|Win32
Debug vtlb|Win32 = Debug vtlb|Win32
Release vm (dev)|Win32 = Release vm (dev)|Win32
Release vm (nondev) [public]|Win32 = Release vm (nondev) [public]|Win32
Release vtlb (dev)|Win32 = Release vtlb (dev)|Win32
Release vtlb (nondev) [public]|Win32 = Release vtlb (nondev) [public]|Win32
Devel vm|Win32 = Devel vm|Win32
Devel vtlb|Win32 = Devel vtlb|Win32
Release vm|Win32 = Release vm|Win32
Release vtlb|Win32 = Release vtlb|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{1CEFD830-2B76-4596-A4EE-BCD7280A60BD}.Debug vm|Win32.ActiveCfg = Debug vm|Win32
{1CEFD830-2B76-4596-A4EE-BCD7280A60BD}.Debug vm|Win32.Build.0 = Debug vm|Win32
{1CEFD830-2B76-4596-A4EE-BCD7280A60BD}.Debug vtlb|Win32.ActiveCfg = Debug vtlb|Win32
{1CEFD830-2B76-4596-A4EE-BCD7280A60BD}.Debug vtlb|Win32.Build.0 = Debug vtlb|Win32
{1CEFD830-2B76-4596-A4EE-BCD7280A60BD}.Release vm (dev)|Win32.ActiveCfg = Release vm (dev)|Win32
{1CEFD830-2B76-4596-A4EE-BCD7280A60BD}.Release vm (dev)|Win32.Build.0 = Release vm (dev)|Win32
{1CEFD830-2B76-4596-A4EE-BCD7280A60BD}.Release vm (nondev) [public]|Win32.ActiveCfg = Release vm (nondev)|Win32
{1CEFD830-2B76-4596-A4EE-BCD7280A60BD}.Release vm (nondev) [public]|Win32.Build.0 = Release vm (nondev)|Win32
{1CEFD830-2B76-4596-A4EE-BCD7280A60BD}.Release vtlb (dev)|Win32.ActiveCfg = Release vtlb (dev)|Win32
{1CEFD830-2B76-4596-A4EE-BCD7280A60BD}.Release vtlb (dev)|Win32.Build.0 = Release vtlb (dev)|Win32
{1CEFD830-2B76-4596-A4EE-BCD7280A60BD}.Release vtlb (nondev) [public]|Win32.ActiveCfg = Release vtlb (nondev)|Win32
{1CEFD830-2B76-4596-A4EE-BCD7280A60BD}.Release vtlb (nondev) [public]|Win32.Build.0 = Release vtlb (nondev)|Win32
{1CEFD830-2B76-4596-A4EE-BCD7280A60BD}.Devel vm|Win32.ActiveCfg = Devel vm|Win32
{1CEFD830-2B76-4596-A4EE-BCD7280A60BD}.Devel vm|Win32.Build.0 = Devel vm|Win32
{1CEFD830-2B76-4596-A4EE-BCD7280A60BD}.Devel vtlb|Win32.ActiveCfg = Devel vtlb|Win32
{1CEFD830-2B76-4596-A4EE-BCD7280A60BD}.Devel vtlb|Win32.Build.0 = Devel vtlb|Win32
{1CEFD830-2B76-4596-A4EE-BCD7280A60BD}.Release vm|Win32.ActiveCfg = Release vm|Win32
{1CEFD830-2B76-4596-A4EE-BCD7280A60BD}.Release vm|Win32.Build.0 = Release vm|Win32
{1CEFD830-2B76-4596-A4EE-BCD7280A60BD}.Release vtlb|Win32.ActiveCfg = Release vtlb|Win32
{1CEFD830-2B76-4596-A4EE-BCD7280A60BD}.Release vtlb|Win32.Build.0 = Release vtlb|Win32
{26511268-2902-4997-8421-ECD7055F9E28}.Debug vm|Win32.ActiveCfg = Debug|Win32
{26511268-2902-4997-8421-ECD7055F9E28}.Debug vm|Win32.Build.0 = Debug|Win32
{26511268-2902-4997-8421-ECD7055F9E28}.Debug vtlb|Win32.ActiveCfg = Debug|Win32
{26511268-2902-4997-8421-ECD7055F9E28}.Debug vtlb|Win32.Build.0 = Debug|Win32
{26511268-2902-4997-8421-ECD7055F9E28}.Release vm (dev)|Win32.ActiveCfg = Release|Win32
{26511268-2902-4997-8421-ECD7055F9E28}.Release vm (dev)|Win32.Build.0 = Release|Win32
{26511268-2902-4997-8421-ECD7055F9E28}.Release vm (nondev) [public]|Win32.ActiveCfg = Release|Win32
{26511268-2902-4997-8421-ECD7055F9E28}.Release vm (nondev) [public]|Win32.Build.0 = Release|Win32
{26511268-2902-4997-8421-ECD7055F9E28}.Release vtlb (dev)|Win32.ActiveCfg = Release|Win32
{26511268-2902-4997-8421-ECD7055F9E28}.Release vtlb (dev)|Win32.Build.0 = Release|Win32
{26511268-2902-4997-8421-ECD7055F9E28}.Release vtlb (nondev) [public]|Win32.ActiveCfg = Release|Win32
{26511268-2902-4997-8421-ECD7055F9E28}.Release vtlb (nondev) [public]|Win32.Build.0 = Release|Win32
{26511268-2902-4997-8421-ECD7055F9E28}.Devel vm|Win32.ActiveCfg = Release|Win32
{26511268-2902-4997-8421-ECD7055F9E28}.Devel vm|Win32.Build.0 = Release|Win32
{26511268-2902-4997-8421-ECD7055F9E28}.Devel vtlb|Win32.ActiveCfg = Release|Win32
{26511268-2902-4997-8421-ECD7055F9E28}.Devel vtlb|Win32.Build.0 = Release|Win32
{26511268-2902-4997-8421-ECD7055F9E28}.Release vm|Win32.ActiveCfg = Release|Win32
{26511268-2902-4997-8421-ECD7055F9E28}.Release vm|Win32.Build.0 = Release|Win32
{26511268-2902-4997-8421-ECD7055F9E28}.Release vtlb|Win32.ActiveCfg = Release|Win32
{26511268-2902-4997-8421-ECD7055F9E28}.Release vtlb|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE