mirror of https://github.com/PCSX2/pcsx2.git
Misc changes to Patches.cpp. Unconst xSHUF for the moment, so Linux compiles.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2136 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
fcdb429bb9
commit
6a7c617a65
|
@ -431,14 +431,14 @@ namespace x86Emitter
|
|||
extern const xImplSimd_DestRegEither xPOR;
|
||||
extern const xImplSimd_DestRegEither xPXOR;
|
||||
|
||||
extern const xImplSimd_Shuffle xSHUF;
|
||||
extern /*const*/ xImplSimd_Shuffle xSHUF;
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
extern const xImplSimd_DestRegSSE xPTEST;
|
||||
|
||||
extern const xImplSimd_MinMax xMIN;
|
||||
extern const xImplSimd_MinMax xMAX;
|
||||
extern const xImplSimd_MinMax xMAX;
|
||||
|
||||
extern const xImplSimd_Compare xCMPEQ, xCMPLT,
|
||||
xCMPLE, xCMPUNORD,
|
||||
|
@ -453,7 +453,7 @@ namespace x86Emitter
|
|||
extern const xImplSimd_PMinMax xPMAX;
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
extern void xCVTDQ2PD( const xRegisterSSE& to, const xRegisterSSE& from );
|
||||
extern void xCVTDQ2PD( const xRegisterSSE& to, const ModSib64& from );
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* PCSX2 - PS2 Emulator for PCs
|
||||
* Copyright (C) 2002-2009 PCSX2 Dev Team
|
||||
*
|
||||
*
|
||||
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU Lesser General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
|
@ -29,7 +29,7 @@ SSE_RoundMode SSE_MXCSR::GetRoundMode() const
|
|||
|
||||
SSE_MXCSR& SSE_MXCSR::SetRoundMode( SSE_RoundMode mode )
|
||||
{
|
||||
pxAssert( (uint)mode < 4 );
|
||||
pxAssert( (uint)mode < 4 );
|
||||
RoundingControl = (u32)mode;
|
||||
return *this;
|
||||
}
|
||||
|
@ -306,7 +306,7 @@ const xImplSimd_AndNot xANDN =
|
|||
{ 0x66, 0x55 } // PD
|
||||
};
|
||||
|
||||
const xImplSimd_PAbsolute xPABS =
|
||||
const xImplSimd_PAbsolute xPABS =
|
||||
{
|
||||
{ 0x66, 0x1c38 }, // B
|
||||
{ 0x66, 0x1d38 }, // W
|
||||
|
@ -362,7 +362,7 @@ void xImplSimd_Compare::SS( const xRegisterSSE& to, const ModSibBase& from ) con
|
|||
void xImplSimd_Compare::SD( const xRegisterSSE& to, const xRegisterSSE& from ) const { xOpWrite0F( 0xf2, 0xc2, to, from, (u8)CType ); }
|
||||
void xImplSimd_Compare::SD( const xRegisterSSE& to, const ModSibBase& from ) const { xOpWrite0F( 0xf2, 0xc2, to, from, (u8)CType ); }
|
||||
|
||||
const xImplSimd_MinMax xMIN =
|
||||
const xImplSimd_MinMax xMIN =
|
||||
{
|
||||
{ 0x00, 0x5d }, // PS
|
||||
{ 0x66, 0x5d }, // PD
|
||||
|
@ -370,7 +370,7 @@ const xImplSimd_MinMax xMIN =
|
|||
{ 0xf2, 0x5d }, // SD
|
||||
};
|
||||
|
||||
const xImplSimd_MinMax xMAX =
|
||||
const xImplSimd_MinMax xMAX =
|
||||
{
|
||||
{ 0x00, 0x5f }, // PS
|
||||
{ 0x66, 0x5f }, // PD
|
||||
|
@ -412,7 +412,7 @@ const xImplSimd_PCompare xPCMP =
|
|||
{ 0x66, 0x66 }, // GTD
|
||||
};
|
||||
|
||||
const xImplSimd_PMinMax xPMIN =
|
||||
const xImplSimd_PMinMax xPMIN =
|
||||
{
|
||||
{ 0x66, 0xda }, // UB
|
||||
{ 0x66, 0xea }, // SW
|
||||
|
@ -423,7 +423,7 @@ const xImplSimd_PMinMax xPMIN =
|
|||
{ 0x66, 0x3b38 }, // UD
|
||||
};
|
||||
|
||||
const xImplSimd_PMinMax xPMAX =
|
||||
const xImplSimd_PMinMax xPMAX =
|
||||
{
|
||||
{ 0x66, 0xde }, // UB
|
||||
{ 0x66, 0xee }, // SW
|
||||
|
@ -486,7 +486,7 @@ void SimdImpl_PExtract::W( const xRegister32& to, const xRegisterSSE& from, u8 i
|
|||
void SimdImpl_PExtract::W( const xRegister32& to, const xRegisterMMX& from, u8 imm8 ) const { xOpWrite0F( 0xc5, to, from, imm8 ); }
|
||||
void SimdImpl_PExtract::W( const ModSibBase& dest, const xRegisterSSE& from, u8 imm8 ) const { xOpWrite0F( 0x66, 0x153a, from, dest, imm8 ); }
|
||||
|
||||
const xImplSimd_Shuffle xSHUF;
|
||||
/*const*/ xImplSimd_Shuffle xSHUF;
|
||||
|
||||
const xImplSimd_PShuffle xPSHUF =
|
||||
{
|
||||
|
@ -494,7 +494,7 @@ const xImplSimd_PShuffle xPSHUF =
|
|||
{ 0x66, 0x70 }, // D
|
||||
{ 0xf2, 0x70 }, // LW
|
||||
{ 0xf3, 0x70 }, // HW
|
||||
|
||||
|
||||
{ 0x66, 0x0038 }, // B
|
||||
};
|
||||
|
||||
|
@ -757,7 +757,7 @@ __forceinline void xMASKMOV( const xRegisterSSE& to, const xRegisterSSE& from )
|
|||
__forceinline void xMASKMOV( const xRegisterMMX& to, const xRegisterMMX& from ) { xOpWrite0F( 0xf7, to, from ); }
|
||||
|
||||
// xPMOVMSKB:
|
||||
// Creates a mask made up of the most significant bit of each byte of the source
|
||||
// Creates a mask made up of the most significant bit of each byte of the source
|
||||
// operand and stores the result in the low byte or word of the destination operand.
|
||||
// Upper bits of the destination are cleared to zero.
|
||||
//
|
||||
|
@ -852,4 +852,4 @@ __emitinline void xFXRSTOR( const ModSibBase& src )
|
|||
EmitSibMagic( 1, src );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
|
||||
#include "R5900.h"
|
||||
#include "Elfheader.h"
|
||||
#include "Patch.h"
|
||||
|
||||
static const ConsoleColors ConColor_IOP = Color_Yellow;
|
||||
static const ConsoleColors ConColor_EE = Color_Cyan;
|
||||
|
@ -42,7 +41,6 @@ static const ConsoleColors ConColor_EE = Color_Cyan;
|
|||
extern wxString ShiftJIS_ConvertString( const char* src );
|
||||
extern wxString ShiftJIS_ConvertString( const char* src, int maxlen );
|
||||
|
||||
|
||||
// Some homeless externs. This is as good a spot as any for now...
|
||||
|
||||
extern void SetCPUState(SSE_MXCSR sseMXCSR, SSE_MXCSR sseVUMXCSR);
|
||||
|
|
|
@ -31,6 +31,10 @@ using namespace Threading;
|
|||
|
||||
extern u8 psxhblankgate;
|
||||
|
||||
// The two functions needed for patches.
|
||||
extern void ApplyPatch( int place );
|
||||
extern void inifile_read( const char* name );
|
||||
|
||||
static const uint EECNT_FUTURE_TARGET = 0x10000000;
|
||||
|
||||
u64 profile_starttick = 0;
|
||||
|
@ -357,7 +361,7 @@ static __forceinline void VSyncStart(u32 sCycle)
|
|||
psxVBlankStart();
|
||||
|
||||
if (gates) rcntStartGate(true, sCycle); // Counters Start Gate code
|
||||
if (EmuConfig.EnablePatches) applypatch(1); // fixme - Apply patches
|
||||
if (EmuConfig.EnablePatches) ApplyPatch(1); // fixme - Apply patches
|
||||
|
||||
// INTC - VB Blank Start Hack --
|
||||
// Hack fix! This corrects a freezeup in Granda 2 where it decides to spin
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* PCSX2 - PS2 Emulator for PCs
|
||||
* Copyright (C) 2002-2009 PCSX2 Dev Team
|
||||
*
|
||||
*
|
||||
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU Lesser General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
|
@ -22,6 +22,10 @@
|
|||
|
||||
using namespace std;
|
||||
|
||||
// The two functions needed for patches.
|
||||
extern void ApplyPatch( int place );
|
||||
extern void inifile_read( const char* name );
|
||||
|
||||
u32 ElfCRC;
|
||||
|
||||
struct ELF_HEADER {
|
||||
|
@ -164,13 +168,13 @@ static uint parseCommandLine( const wxString& filename )
|
|||
args_ptr -= 256;
|
||||
|
||||
args[ 255 ] = 0;
|
||||
|
||||
// Copy the parameters into the section of memory at args_ptr,
|
||||
|
||||
// Copy the parameters into the section of memory at args_ptr,
|
||||
// then zero out anything past the end of args till 256 chars is reached.
|
||||
memcpy( &PS2MEM_BASE[ args_ptr ], args, 256 );
|
||||
memset( &PS2MEM_BASE[ args_ptr + strlen( args ) ], 0, 256 - strlen( args ) );
|
||||
args_end = args_ptr + strlen( args );
|
||||
|
||||
|
||||
// Set p to just the filename, no path.
|
||||
#ifdef _WIN32
|
||||
p = strrchr( filename, '\\' );
|
||||
|
@ -183,12 +187,12 @@ static uint parseCommandLine( const wxString& filename )
|
|||
else
|
||||
p = filename;
|
||||
|
||||
|
||||
|
||||
args_ptr -= strlen( p ) + 1;
|
||||
|
||||
//fill param 0; i.e. name of the program
|
||||
strcpy( (char*)&PS2MEM_BASE[ args_ptr ], p );
|
||||
|
||||
|
||||
// Start from the end of where we wrote to, not including all the zero'd out area.
|
||||
for ( i = args_end - args_ptr + 1, argc = 0; i > 0; i-- )
|
||||
{
|
||||
|
@ -199,14 +203,14 @@ static uint parseCommandLine( const wxString& filename )
|
|||
|
||||
while (i && !isEmpty(args_ptr + i )) { i--; }
|
||||
|
||||
// Now that we've gone back a word, increase the number of arguments,
|
||||
// and mark the location of the argument.
|
||||
// Now that we've gone back a word, increase the number of arguments,
|
||||
// and mark the location of the argument.
|
||||
if (!isEmpty(args_ptr + i )) // i <= 0
|
||||
{
|
||||
// If the spot we are on is not a space or null , use it.
|
||||
argc++;
|
||||
ret = args_ptr - 4 - 4 - argc * 4;
|
||||
|
||||
|
||||
if (ret < 0 ) return 0;
|
||||
((u32*)PS2MEM_BASE)[ args_ptr / 4 - argc ] = args_ptr + i;
|
||||
}
|
||||
|
@ -217,17 +221,17 @@ static uint parseCommandLine( const wxString& filename )
|
|||
// Otherwise, use the next character .
|
||||
argc++;
|
||||
ret = args_ptr - 4 - 4 - argc * 4;
|
||||
|
||||
|
||||
if (ret < 0 ) return 0;
|
||||
((u32*)PS2MEM_BASE)[ args_ptr / 4 - argc ] = args_ptr + i + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Pass the number of arguments, and if we have arguments.
|
||||
((u32*)PS2MEM_BASE)[ args_ptr /4 - argc - 1 ] = argc; //how many args
|
||||
((u32*)PS2MEM_BASE)[ args_ptr /4 - argc - 2 ] = ( argc > 0); //have args? //not used, cannot be filled at all
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -326,7 +330,7 @@ struct ElfObject
|
|||
(strnicmp( work, "cdrom1:", strlen("cdromN:")) == 0))
|
||||
{
|
||||
int fi = IsoFS_open(work + strlen("cdromN:"), 1);//RDONLY
|
||||
|
||||
|
||||
if (fi < 0) throw Exception::FileNotFound( filename );
|
||||
|
||||
IsoFS_lseek( fi, 0, SEEK_SET );
|
||||
|
@ -495,17 +499,9 @@ void ElfApplyPatches()
|
|||
Console.SetTitle( wxsFormat( _("Game running [CRC=%s]"), filename.c_str() ) );
|
||||
|
||||
if( !EmuConfig.EnablePatches ) return;
|
||||
|
||||
/*if(LoadPatch( filename ) != 0)
|
||||
{
|
||||
Console.WriteLn( "XML Loader returned an error. Trying to load a pnach..." );
|
||||
inifile_read( filename.ToUTF8() );
|
||||
}
|
||||
else
|
||||
Console.WriteLn( "XML Loading success. Will not load from pnach..." );*/
|
||||
|
||||
inifile_read( filename.ToUTF8() );
|
||||
applypatch( 0 );
|
||||
ApplyPatch( 0 );
|
||||
}
|
||||
|
||||
// Fetches the CRC of the game bound to the CDVD plugin.
|
||||
|
@ -514,9 +510,9 @@ u32 loadElfCRC( const char* filename )
|
|||
TocEntry toc;
|
||||
|
||||
IsoFS_init( );
|
||||
|
||||
|
||||
Console.WriteLn("loadElfCRC: %s", filename);
|
||||
|
||||
|
||||
int mylen = strlen( "cdromN:" );
|
||||
if ( IsoFS_findFile( filename + mylen, &toc ) == -1 ) return 0;
|
||||
|
||||
|
@ -540,14 +536,14 @@ u32 loadElfCRC( const char* filename )
|
|||
void loadElfFile(const wxString& filename)
|
||||
{
|
||||
if( filename.IsEmpty() ) return;
|
||||
|
||||
|
||||
s64 elfsize;
|
||||
Console.WriteLn( L"loadElfFile: " + filename );
|
||||
|
||||
const wxCharBuffer buffer( filename.ToUTF8() );
|
||||
const char* fnptr = buffer.data();
|
||||
bool useCdvdSource=false;
|
||||
|
||||
|
||||
if( !filename.StartsWith( L"cdrom0:" ) && !filename.StartsWith( L"cdrom1:" ) )
|
||||
{
|
||||
DevCon.WriteLn("Loading from a file (or non-cd image)");
|
||||
|
@ -607,7 +603,7 @@ void loadElfFile(const wxString& filename)
|
|||
Console.WriteLn( L"loadElfFile: %s; CRC = %8.8X", filename.c_str(), ElfCRC );
|
||||
ElfApplyPatches();
|
||||
mtgsThread.SendGameCRC( ElfCRC );
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
848
pcsx2/Patch.cpp
848
pcsx2/Patch.cpp
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,6 @@
|
|||
/* PCSX2 - PS2 Emulator for PCs
|
||||
* Copyright (C) 2002-2009 PCSX2 Dev Team
|
||||
*
|
||||
*
|
||||
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU Lesser General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
|
@ -17,22 +17,7 @@
|
|||
|
||||
#include "Pcsx2Defs.h"
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
#define MAX_PATCH 1024
|
||||
|
||||
#define IFIS(x,str) if(!strnicmp(x,str,sizeof(str)-1))
|
||||
|
||||
#define GETNEXT_PARAM() \
|
||||
while ( *param && ( *param != ',' ) ) param++; \
|
||||
if ( *param ) param++; \
|
||||
while ( *param && ( *param == ' ' ) ) param++; \
|
||||
if ( *param == 0 ) { Console.Error( _( "Not enough params for inicommand" ) ); return; }
|
||||
|
||||
//
|
||||
// Enums
|
||||
//
|
||||
#define MAX_PATCH 1024
|
||||
|
||||
enum patch_cpu_type {
|
||||
NO_CPU,
|
||||
|
@ -49,9 +34,6 @@ enum patch_data_type {
|
|||
EXTENDED_T
|
||||
};
|
||||
|
||||
//
|
||||
// Typedefs
|
||||
//
|
||||
typedef void (*PATCHTABLEFUNC)( char * text1, char * text2 );
|
||||
|
||||
struct IniPatch
|
||||
|
@ -65,41 +47,27 @@ struct IniPatch
|
|||
u64 data;
|
||||
};
|
||||
|
||||
//
|
||||
// Function prototypes
|
||||
//
|
||||
void patchFunc_comment( char * text1, char * text2 );
|
||||
void patchFunc_gametitle( char * text1, char * text2 );
|
||||
void patchFunc_patch( char * text1, char * text2 );
|
||||
void patchFunc_fastmemory( char * text1, char * text2 );
|
||||
void patchFunc_roundmode( char * text1, char * text2 );
|
||||
void patchFunc_zerogs( char * text1, char * text2 );
|
||||
void patchFunc_vunanmode( char * text1, char * text2 );
|
||||
void patchFunc_ffxhack( char * text1, char * text2 );
|
||||
void patchFunc_xkickdelay( char * text1, char * text2 );
|
||||
|
||||
void inifile_trim( char * buffer );
|
||||
namespace PatchFunc
|
||||
{
|
||||
void comment( char* text1, char* text2 );
|
||||
void gametitle( char* text1, char* text2 );
|
||||
void patch( char* text1, char* text2 );
|
||||
void roundmode( char* text1, char* text2 );
|
||||
void zerogs( char* text1, char* text2 );
|
||||
}
|
||||
|
||||
//
|
||||
// Variables
|
||||
//
|
||||
extern IniPatch patch[ MAX_PATCH ];
|
||||
extern int patchnumber;
|
||||
|
||||
void applypatch( int place );
|
||||
void inifile_read( const char * name );
|
||||
void inifile_command( char * cmd );
|
||||
void resetpatch( void );
|
||||
void inifile_read( const char* name );
|
||||
void inifile_command( char* cmd );
|
||||
void inifile_trim( char* buffer );
|
||||
|
||||
int AddPatch(int Mode, int Place, int Address, int Size, u64 data);
|
||||
void ApplyPatch( int place );
|
||||
void ResetPatch( void );
|
||||
|
||||
extern void SetFastMemory(int); // iR5900LoadStore.c
|
||||
|
||||
//extern int g_VUGameFixes;
|
||||
extern int g_ZeroGSOptions;
|
||||
|
||||
extern void SetRoundMode(SSE_RoundMode ee, SSE_RoundMode vu);
|
||||
extern int LoadPatch(const wxString& patchfile);
|
||||
void SetRoundMode(SSE_RoundMode ee, SSE_RoundMode vu);
|
||||
|
||||
#endif /* __PATCH_H__ */
|
||||
|
||||
|
|
Loading…
Reference in New Issue