wxgui: synced with trunk, and started work on an improved plugin initialization procedure. (branch currently does NOT compile, sorry)

git-svn-id: http://pcsx2.googlecode.com/svn/branches/wxgui@1582 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
Jake.Stine 2009-07-29 14:00:00 +00:00
commit 71490981bf
102 changed files with 4127 additions and 1907 deletions

View File

@ -278,11 +278,11 @@
> >
</File> </File>
<File <File
RelativePath="..\..\include\x86emitter\types.h" RelativePath="..\..\include\x86emitter\x86emitter.h"
> >
</File> </File>
<File <File
RelativePath="..\..\include\x86emitter\x86emitter.h" RelativePath="..\..\include\x86emitter\x86types.h"
> >
</File> </File>
<Filter <Filter

View File

@ -704,10 +704,7 @@ typedef void (CALLBACK* _FWabout)();
#ifdef PLUGINfuncs #ifdef PLUGINfuncs
// GS // GS
extern _GSinit GSinit;
extern _GSopen GSopen; extern _GSopen GSopen;
extern _GSclose GSclose;
extern _GSshutdown GSshutdown;
extern _GSvsync GSvsync; extern _GSvsync GSvsync;
extern _GSgifTransfer1 GSgifTransfer1; extern _GSgifTransfer1 GSgifTransfer1;
extern _GSgifTransfer2 GSgifTransfer2; extern _GSgifTransfer2 GSgifTransfer2;
@ -717,7 +714,6 @@ extern _GSgifSoftReset GSgifSoftReset;
extern _GSreadFIFO GSreadFIFO; extern _GSreadFIFO GSreadFIFO;
extern _GSreadFIFO2 GSreadFIFO2; extern _GSreadFIFO2 GSreadFIFO2;
extern _GSkeyEvent GSkeyEvent;
extern _GSchangeSaveState GSchangeSaveState; extern _GSchangeSaveState GSchangeSaveState;
extern _GSmakeSnapshot GSmakeSnapshot; extern _GSmakeSnapshot GSmakeSnapshot;
extern _GSmakeSnapshot2 GSmakeSnapshot2; extern _GSmakeSnapshot2 GSmakeSnapshot2;
@ -734,41 +730,18 @@ extern _GSgetDriverInfo GSgetDriverInfo;
#ifdef _WINDOWS_ #ifdef _WINDOWS_
extern _GSsetWindowInfo GSsetWindowInfo; extern _GSsetWindowInfo GSsetWindowInfo;
#endif #endif
extern _GSfreeze GSfreeze;
extern _GSconfigure GSconfigure;
extern _GStest GStest;
extern _GSabout GSabout;
// PAD1 // PAD1
extern _PADinit PAD1init;
extern _PADopen PAD1open; extern _PADopen PAD1open;
extern _PADclose PAD1close;
extern _PADshutdown PAD1shutdown;
extern _PADkeyEvent PAD1keyEvent;
extern _PADstartPoll PAD1startPoll; extern _PADstartPoll PAD1startPoll;
extern _PADpoll PAD1poll; extern _PADpoll PAD1poll;
extern _PADquery PAD1query; extern _PADquery PAD1query;
extern _PADupdate PAD1update; extern _PADupdate PAD1update;
extern _PADgsDriverInfo PAD1gsDriverInfo; extern _PADgsDriverInfo PAD1gsDriverInfo;
extern _PADconfigure PAD1configure;
extern _PADtest PAD1test;
extern _PADabout PAD1about;
extern _PADfreeze PAD1freeze;
extern _PADsetSlot PAD1setSlot; extern _PADsetSlot PAD1setSlot;
extern _PADqueryMtap PAD1queryMtap; extern _PADqueryMtap PAD1queryMtap;
// PAD2
extern _PADinit PAD2init;
extern _PADopen PAD2open;
extern _PADclose PAD2close;
extern _PADshutdown PAD2shutdown;
extern _PADkeyEvent PAD2keyEvent;
extern _PADstartPoll PAD2startPoll;
extern _PADpoll PAD2poll;
extern _PADquery PAD2query;
extern _PADupdate PAD2update;
extern _PADgsDriverInfo PAD2gsDriverInfo; extern _PADgsDriverInfo PAD2gsDriverInfo;
extern _PADconfigure PAD2configure; extern _PADconfigure PAD2configure;
extern _PADtest PAD2test; extern _PADtest PAD2test;
@ -778,23 +751,13 @@ extern _PADsetSlot PAD2setSlot;
extern _PADqueryMtap PAD2queryMtap; extern _PADqueryMtap PAD2queryMtap;
// SIO[2] // SIO[2]
extern _SIOinit SIOinit[2][9];
extern _SIOopen SIOopen[2][9]; extern _SIOopen SIOopen[2][9];
extern _SIOclose SIOclose[2][9];
extern _SIOshutdown SIOshutdown[2][9];
extern _SIOstartPoll SIOstartPoll[2][9]; extern _SIOstartPoll SIOstartPoll[2][9];
extern _SIOpoll SIOpoll[2][9]; extern _SIOpoll SIOpoll[2][9];
extern _SIOquery SIOquery[2][9]; extern _SIOquery SIOquery[2][9];
extern _SIOconfigure SIOconfigure[2][9];
extern _SIOtest SIOtest[2][9];
extern _SIOabout SIOabout[2][9];
// SPU2 // SPU2
extern _SPU2init SPU2init;
extern _SPU2open SPU2open; extern _SPU2open SPU2open;
extern _SPU2close SPU2close;
extern _SPU2shutdown SPU2shutdown;
extern _SPU2write SPU2write; extern _SPU2write SPU2write;
extern _SPU2read SPU2read; extern _SPU2read SPU2read;
extern _SPU2readDMA4Mem SPU2readDMA4Mem; extern _SPU2readDMA4Mem SPU2readDMA4Mem;
@ -813,10 +776,6 @@ extern _SPU2setClockPtr SPU2setClockPtr;
extern _SPU2setTimeStretcher SPU2setTimeStretcher; extern _SPU2setTimeStretcher SPU2setTimeStretcher;
extern _SPU2async SPU2async; extern _SPU2async SPU2async;
extern _SPU2freeze SPU2freeze;
extern _SPU2configure SPU2configure;
extern _SPU2test SPU2test;
extern _SPU2about SPU2about;
// CDVD // CDVD
struct CDVDplugin { struct CDVDplugin {
@ -850,10 +809,7 @@ struct CDVDplugin {
extern CDVDplugin CDVD_plugin; // _plugin because of extern CDVDplugin CDVD_plugin; // _plugin because of
// DEV9 // DEV9
extern _DEV9init DEV9init;
extern _DEV9open DEV9open; extern _DEV9open DEV9open;
extern _DEV9close DEV9close;
extern _DEV9shutdown DEV9shutdown;
extern _DEV9read8 DEV9read8; extern _DEV9read8 DEV9read8;
extern _DEV9read16 DEV9read16; extern _DEV9read16 DEV9read16;
extern _DEV9read32 DEV9read32; extern _DEV9read32 DEV9read32;
@ -865,16 +821,8 @@ extern _DEV9writeDMA8Mem DEV9writeDMA8Mem;
extern _DEV9irqCallback DEV9irqCallback; extern _DEV9irqCallback DEV9irqCallback;
extern _DEV9irqHandler DEV9irqHandler; extern _DEV9irqHandler DEV9irqHandler;
extern _DEV9configure DEV9configure;
extern _DEV9freeze DEV9freeze;
extern _DEV9test DEV9test;
extern _DEV9about DEV9about;
// USB // USB
extern _USBinit USBinit;
extern _USBopen USBopen; extern _USBopen USBopen;
extern _USBclose USBclose;
extern _USBshutdown USBshutdown;
extern _USBread8 USBread8; extern _USBread8 USBread8;
extern _USBread16 USBread16; extern _USBread16 USBread16;
extern _USBread32 USBread32; extern _USBread32 USBread32;
@ -887,24 +835,12 @@ extern _USBirqCallback USBirqCallback;
extern _USBirqHandler USBirqHandler; extern _USBirqHandler USBirqHandler;
extern _USBsetRAM USBsetRAM; extern _USBsetRAM USBsetRAM;
extern _USBconfigure USBconfigure;
extern _USBfreeze USBfreeze;
extern _USBtest USBtest;
extern _USBabout USBabout;
// FW // FW
extern _FWinit FWinit;
extern _FWopen FWopen; extern _FWopen FWopen;
extern _FWclose FWclose;
extern _FWshutdown FWshutdown;
extern _FWread32 FWread32; extern _FWread32 FWread32;
extern _FWwrite32 FWwrite32; extern _FWwrite32 FWwrite32;
extern _FWirqCallback FWirqCallback; extern _FWirqCallback FWirqCallback;
extern _FWconfigure FWconfigure;
extern _FWfreeze FWfreeze;
extern _FWtest FWtest;
extern _FWabout FWabout;
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -132,10 +132,8 @@ struct McdConfig
bool Enabled; bool Enabled;
}; };
struct PcsxConfig struct PluginNames
{ {
public:
char Bios[g_MaxPath];
char GS[g_MaxPath]; char GS[g_MaxPath];
char PAD1[g_MaxPath]; char PAD1[g_MaxPath];
char PAD2[g_MaxPath]; char PAD2[g_MaxPath];
@ -144,9 +142,47 @@ public:
char DEV9[g_MaxPath]; char DEV9[g_MaxPath];
char USB[g_MaxPath]; char USB[g_MaxPath];
char FW[g_MaxPath]; char FW[g_MaxPath];
char PluginsDir[g_MaxPath]; };
char BiosDir[g_MaxPath];
char InisDir[g_MaxPath]; // This is intended for the program to populate, and the plugins to read. Obviously can't be saved in the config file. :) // This is intended to be where all the main paths for Pcsx2 are.
// This may end up being moved to Paths.h. It may also be converted to strings.
struct FilePaths
{
string Working;
char Plugins[g_MaxPath];
char Bios[g_MaxPath];
// These are mainly placeholders for later.
string Isos;
string Dumps;
// This is intended for the program to populate, and the plugins to read.
// Obviously can't be saved in the config file. :)
string Inis;
};
struct Hacks_t
{
int EECycleRate;
bool IOPCycleDouble;
//bool WaitCycleExt;
bool INTCSTATSlow;
bool IdleLoopFF;
int VUCycleSteal;
bool vuFlagHack;
bool vuMinMax;
bool ESCExits; // this is a hack!?
};
struct PcsxConfig
{
public:
// The Bios name isn't really a plugin name, so doesn't go with the Plugins.
char Bios[g_MaxPath];
PluginNames Plugins;
FilePaths Paths;
char Lang[g_MaxPath]; char Lang[g_MaxPath];
McdConfig Mcd[2]; McdConfig Mcd[2];
@ -164,17 +200,9 @@ public:
int PsxType; int PsxType;
int Patch; int Patch;
int CustomFps; int CustomFps;
struct Hacks_t {
int EECycleRate; Hacks_t Hacks;
bool IOPCycleDouble;
//bool WaitCycleExt;
bool INTCSTATSlow;
bool IdleLoopFF;
int VUCycleSteal;
bool vuFlagHack;
bool vuMinMax;
bool ESCExits; // this is a hack!?
} Hacks;
int GameFixes; int GameFixes;
int CustomFrameSkip; int CustomFrameSkip;
int CustomConsecutiveFrames; int CustomConsecutiveFrames;

View File

@ -20,52 +20,588 @@
#ifndef __PLUGINCALLBACKS_H__ #ifndef __PLUGINCALLBACKS_H__
#define __PLUGINCALLBACKS_H__ #define __PLUGINCALLBACKS_H__
extern "C" #include "x86caps.h" // fixme: x86caps.h needs to be implemented from the pcsx2 emitter cpucaps structs
{
// General
typedef u32 (CALLBACK* _PS2EgetLibType)(void);
typedef u32 (CALLBACK* _PS2EgetLibVersion2)(u32 type);
typedef char*(CALLBACK* _PS2EgetLibName)(void);
typedef void (CALLBACK* _PS2EpassConfig)(PcsxConfig *Config);
typedef void (CALLBACK* _PS2EpassIniPath)(const char *path);
// GS //////////////////////////////////////////////////////////////////////////////////////////
// NOTE: GSreadFIFOX/GSwriteCSR functions CANNOT use XMM/MMX regs // HWND is our only operating system dependent type. For it to be defined as accurately
// If you want to use them, need to save and restore current ones // as possible, this header file needs to be included after whatever window/GUI platform
typedef s32 (CALLBACK* _GSinit)(char *configpath); // headers you need (wxWidgets, Windows.h, GTK, etc).
typedef s32 (CALLBACK* _GSopen)(void *pDisplay, char *Title, bool multithread); //
typedef void (CALLBACK* _GSclose)(); // We could be lazy with this typedef, because window handles are always a (void*) on all
typedef void (CALLBACK* _GSshutdown)(); // platforms that matter to us (windows, gtk, OSX). But Windows has some type strictness
typedef void (CALLBACK* _GSvsync)(int field); // on its HWND define that could be useful, and well it's probably good practice to use
typedef void (CALLBACK* _GSgifTransfer1)(u32 *pMem, u32 addr); // platform available defines when they exist.
typedef void (CALLBACK* _GSgifTransfer2)(u32 *pMem, u32 size); //
typedef void (CALLBACK* _GSgifTransfer3)(u32 *pMem, u32 size); #if defined( _WX_DEFS_H_ )
typedef void (CALLBACK* _GSgetLastTag)(u64* ptag); // returns the last tag processed (64 bits)
typedef void (CALLBACK* _GSgifSoftReset)(u32 mask);
typedef void (CALLBACK* _GSreadFIFO)(u64 *pMem);
typedef void (CALLBACK* _GSreadFIFO2)(u64 *pMem, int qwc);
typedef void (CALLBACK* _GSkeyEvent)(keyEvent* ev); typedef WXWidget PS2E_HWND;
typedef void (CALLBACK* _GSchangeSaveState)(s32 state, const char* filename);
typedef void (CALLBACK* _GSirqCallback)(void (*callback)());
typedef void (CALLBACK* _GSprintf)(s32 timeout, char *fmt, ...);
typedef void (CALLBACK* _GSsetBaseMem)(void*);
typedef void (CALLBACK* _GSsetGameCRC)(s32 crc, s32 gameoptions);
typedef void (CALLBACK* _GSsetFrameSkip)(int frameskip); #elif defined( _WINDEF_ )
typedef bool (CALLBACK* _GSsetupRecording)(bool start);
typedef void (CALLBACK* _GSreset)(); // For Windows let's use HWND, since it has some type strictness applied to it.
typedef void (CALLBACK* _GSwriteCSR)(u32 value); typedef HWND PS2E_HWND;
typedef void (CALLBACK* _GSgetDriverInfo)(GSdriverInfo *info);
#ifdef _WINDOWS_ #else
typedef s32 (CALLBACK* _GSsetWindowInfo)(winInfo *info); // Unsupported platform... use void* as a best guess. Should work fine for almost
// any GUI platform, and certainly works for any currently supported one.
typedef void* PS2E_HWND;
#endif #endif
typedef void (CALLBACK* _GSmakeSnapshot)(const char *path);
typedef void (CALLBACK* _GSmakeSnapshot2)(const char *path, int*, int);
typedef s32 (CALLBACK* _GSfreeze)(u8 mode, freezeData *data); //////////////////////////////////////////////////////////////////////////////////////////
typedef void (CALLBACK* _GSconfigure)(); // PS2E_THISPTR - (ps2 component scope 'this' object pointer type)
typedef s32 (CALLBACK* _GStest)(); //
typedef void (CALLBACK* _GSabout)(); // This macro provides C++ plugin authors with a reasonably friendly way to automatically
// typecast the session objects for your plugin to your internal type. Just #define
// PS2E_THISPTR to your internal structure type prior to loading this header file, and all
// APIs will assume your struct type in their signature. Since all pointer types are inter-
// changeable, plugin APIs will retain full compatibility as long as PS2E_THISPTR is a
// pointer type.
//
#ifndef PS2E_THISPTR
# define PS2E_THISPTR struct _PS2E_ComponentAPI*
#else
// Ensure the user's defined PS2E_THISPTR retains the correct signature for our
// plugin API.
C_ASSERT( sizeof(PS2E_THISPTR) == sizeof(void*) );
#endif
// PS2E_LIB_THISPTR - (library scope version of PS2E_THISPTR)
#ifndef PS2E_LIB_THISPTR
# define PS2E_LIB_THISPTR void*
#else
// Ensure the user's defined PS2E_THISPTR retains the correct signature for our
// plugin API.
C_ASSERT( sizeof(PS2E_LIB_THISPTR) == sizeof(void*) );
#endif
// Use fastcall by default, since under most circumstances the object-model approach of the
// API will benefit considerably from it.
#define PS2E_CALLBACK __fastcall
#ifndef __cplusplus
extern "C" {
#endif
//////////////////////////////////////////////////////////////////////////////////////////
// Plugin Type / Version Enumerations
//
enum PS2E_ComponentTypes
{
PS2E_TYPE_GS=0,
PS2E_TYPE_PAD,
PS2E_TYPE_SPU2,
PS2E_TYPE_CDVD,
PS2E_TYPE_DEV9,
PS2E_TYPE_USB,
PS2E_TYPE_FW,
PS2E_TYPE_SIO,
};
enum PluginLibVersion
{
PS2E_VER_GS = 0x1000,
PS2E_VER_PAD = 0x1000,
PS2E_VER_SPU2 = 0x1000,
PS2E_VER_CDVD = 0x1000,
PS2E_VER_DEV9 = 0x1000,
PS2E_VER_USB = 0x1000,
PS2E_VER_FW = 0x1000,
PS2E_VER_SIO = 0x1000
};
enum OSDIconTypes
{
OSD_Icon_None = 0,
OSD_Icon_Error,
OSD_Icon_Notice, // An exclamation point maybe?
// [TODO] -- dunno. What else?
// Emulators implementing their own custom non-standard icon extensions should do so
// somewhere after OSD_Icon_ReserveEnd. All values below this are
OSD_Icon_ReserveEnd = 0x1000
};
/////////////////////////////////////////////////////////////////////////////////////////
// PS2E_VersionInfo
//
// This structure is populated by the plugin via the PS2E_PluginLibAPI::GetVersion()
// callback. Specify -1 for any Version or Revision to disable/ignore it. The emulator
// will not factor that info into the display name of the plugin.
//
typedef struct PS2E_VersionInfo
{
// Low/Mid/High versions combine to form a number in the format of: 2.3.1
// ... where 2 is the high version, 3 mid, and 1 low.
s16 VersionLow;
s16 VersionMid;
s16 VersionHigh;
// Revision typically refers a revision control system (such as SVN). When displayed
// by the emulator it will have an 'r' prefixed before it.
s32 Revision;
} PS2E_VersionInfo;
//////////////////////////////////////////////////////////////////////////////////////////
// PS2E_MachineInfo
//
// This struct is populated by the emulator when the application is started, and is passed
// to plugins via PS2E_PluginLibAPI::Init(). Plugins may optionally use this information
// to determine compatibility or to select which special CPU-oriented builds and/or functions
// to bind to callbacks.
//
// Fields marked as Optional can either be NULL or -1, denoting the field is unused/ignored.
//
typedef struct _PS2E_MachineInfo
{
const x86CPU_INFO* x86caps;
// brief name of the emulator (ex: "PCSX2") [required]
// Depending on the design of the emulator, this string may optionally include version
// information, however that is not recommended since it can inhibit backward support.
const char* EmuName;
s16 EmuVersionLow; // [optional]
s16 EmuVersionMid; // [optional]
s16 EmuVersionHigh; // [optional]
s32 EmuRevision; // emulator's revision number. [optional]
} PS2E_MachineInfo;
//////////////////////////////////////////////////////////////////////////////////////////
// PS2E_SessionInfo
//
// This struct is populated by the emulator prior to starting emulation, and is passed to
// each plugin via a call to PS2E_PluginLibAPI::EmuStart().
//
typedef struct _PS2E_SessionInfo
{
PS2E_HWND window;
u32* CycleEE; // current EE cycle count
u32* CycleIOP; // current IOP cycle count
u32 ElfCRC; // CRC of the ELF header for this app/game
// Sony's assigned serial number, valid only for CD/CDVD games (ASCII-Z string).
// Ex: SLUS-2932 (if the running app is not a sony-registered game, the serial
// will be a zero length string).
const char Serial[16];
} PS2E_SessionInfo;
/////////////////////////////////////////////////////////////////////////////////////////
// PS2E_EmulatorAPI
//
// These functions are provided to the PS2 plugins by the emulator. Plugins may call these
// functions to perform operations or retrieve data.
//
typedef struct _PS2E_EmulatorAPI
{
// TODO : Create the ConsoleLogger class.
// Provides a set of basic console functions for writing text to the emulator's
// console. Some emulators may not support a console, in which case these functions
// will be NOPs. For plain and simple to-disk logging, plugins should create and use
// their own logging facilities.
ConsoleLogger* Console;
// OSD_WriteLn
// This function allows the plugin to post messages to the emulator's On-Screen Display.
// The OSD message will be displayed with the specified icon (optional) for the duration
// of a few seconds, or until other messages have scrolled it out of view.
// Implementation of the OSD is emulator specific, and there is no guarantee that the
// OSD will be honored at all. If the emulator does not support OSD then this function
// call is treated as a NOP.
//
// Typically a plugin author should only use the OSD for infrequent notices that are
// potentially useful to users playing games (particularly at fullscreen). Trouble-
// shooting and debug information is best dumped to console or to disk log.
//
// Parameters:
// icon - an icon identifier, typically from the PS2E_OSDIconTypes enumeration. Specific
// versions of emulators may provide their own icon extensions. The emulator will
// silently ignore unrecognized icon identifiers, thus retaining cross-compat.
//
// msg - string message displayed to the user.
void (PS2E_CALLBACK* OSD_WriteLn)( int icon, const char* msg );
} PS2E_EmulatorAPI;
//////////////////////////////////////////////////////////////////////////////////////////
// PS2E_FreezeData
//
// Structure used to pass savestate info between emulator and plugin.
//
typedef struct _PS2E_FreezeData
{
u32 Size; // size of the data being frozen or thawed. This value is allowed to be changed by Freeze().
void* Data; // pointer to the data target (freeze) or source (thaw)
} PS2E_FreezeData;
//////////////////////////////////////////////////////////////////////////////////////////
// PS2E_ComponentAPI
//
// The PluginTypeAPI is provided for every PS2 component plugin (see PS2E_ComponentTypes
// enumeration). For typical dlls which only provide one plugin type of functionality,
// the plugin only needs one instance of this struct. For multi-type plugins, for example
// a plugin that supports both DEV9 and FW together, an interface must be provided for
// each component supported.
//
// These are functions provided to the PS2 emulator from the plugin. The emulator will
// call these functions and expect the plugin to perform defined tasks.
//
typedef struct _PS2E_ComponentAPI
{
// EmuStart
// This function is called by the emulator when an emulation session is started. The
// plugin should take this opportunity to bind itself to the given window handle, open
// necessary audio/video/input devices, etc.
//
// Parameters:
// session - provides relevant emulation session information. Provided pointer is
// valid until after the subsequent call to EmuClose()
//
// Threading: EmuStart is called from the GUI thread. All other emulation threads are
// guaranteed to be suspended or closed at the time of this call (no locks required).
//
void (PS2E_CALLBACK* EmuStart)( PS2E_THISPTR thisptr, const PS2E_SessionInfo *session );
// EmuClose
// This function is called by the emulator prior to stopping emulation. The window
// handle specified in EmuStart is guaranteed to be valid at the time EmuClose is called,
// and the plugin should unload/unbind all window dependencies at this time.
//
// Threading: EmuClose is called from the GUI thread. All other emulation threads are
// guaranteed to be suspended or closed at the time of this call (no locks required).
//
void (PS2E_CALLBACK* EmuClose)( PS2E_THISPTR thisptr );
// CalcFreezeSize
// This function should calculate and return the amount of memory needed for the plugin
// to freeze its complete emulation state. The value can be larger than the required
// amount of space, but cannot be smaller.
//
// The emulation state when this function is called is guaranteed to be the same as
// the following call to Freeze.
//
// Thread Safety:
// May be called from any thread (GUI, Emu, GS, Unknown, etc).
// All Emulation threads are halted at a PS2 logical vsync-end event.
// No locking is necessary.
u32 (PS2E_CALLBACK* CalcFreezeSize)( PS2E_THISPTR thisptr );
// Freeze
// This function should make a complete copy of the plugin's emulation state into the
// provided dest->Data pointer. The plugin is allowed to reduce the dest->Size value
// but is not allowed to make it larger. The plugin will only receive calls to Freeze
// and Thaw while a plugin is in an EmuStart() state.
//
// Parameters:
// dest - a pointer to the Data/Size destination buffer (never NULL).
//
// Thread Safety:
// May be called from any thread (GUI, Emu, GS, Unknown, etc).
// All Emulation threads are halted at a PS2 logical vsync-end event.
// No locking is necessary.
void (PS2E_CALLBACK* Freeze)( PS2E_THISPTR thisptr, PS2E_FreezeData* dest );
// Thaw
// Plugin should restore a complete emulation state from the given FreezeData. The
// plugin will only receive calls to Freeze and Thaw while a plugin is in an EmuStart()
// state.
//
// Thread Safety:
// May be called from any thread (GUI, Emu, GS, Unknown, etc).
// All Emulation threads are halted at a PS2 logical vsync-end event.
// No locking is necessary.
void (PS2E_CALLBACK* Thaw)( PS2E_THISPTR thisptr, const PS2E_FreezeData* src );
// Configure
// The plugin should open a modal dialog box with plugin-specific settings and prop-
// erties. This function can be NULL, in which case the user's Configure option for
// this plugin is grayed out.
//
// All emulation is suspended and the plugin's state is saved to memory prior to this
// function being called. Configure is only called outside the context of EmuStart()
// (after a call to EmuClose()).
//
// Plugin authors should ensure to re-read and re-apply all settings on EmuStart(),
// which will ensure that any user changes will be applied immediately. For changes
// that can be applied without emulation suspension, see/use the GUI extensions for
// menu and toolbar shortcuts.
//
// Thread Safety:
// Always called from the GUI thread, with emulation in a halted state (no locks
// needed).
void (PS2E_CALLBACK* Configure)( PS2E_THISPTR thisptr );
// Reserved area at the end of the structure, for future API expansion.
void* reserved[16];
} PS2E_ComponentAPI;
/////////////////////////////////////////////////////////////////////////////////////////
// PS2E_LibraryAPI
//
// The LibraryAPI is an overall library-scope set of functions that perform basic Init,
// Shutdown, and global configuration operations.
//
// These are functions provided to the PS2 emulator from the plugin. The emulator will
// call these functions and expect the plugin to perform defined tasks.
//
// Threading:
// - get* callbacks in this struct are not bound to any particular thread. Implementations
// should not assume any specific thread affinity.
//
// - set* callbacks in this struct are bound to the GUI thread of the emulator, and will
// always be invoked from that thread.
//
typedef struct _PS2E_LibraryAPI
{
// GetName
// Returns an ASCII-Z (zero-terminated) string name of the plugin. The name should
// *not* include version or build information. That info is returned separately
// via GetVersion. The return value cannot be NULL (if it is NULL, the emulator
// will assume the DLL is invalid and ignore it).
//
// The pointer should reference a static/global scope char array, or an allocated
// heap pointer (not recommended).
//
// This function may be called multiple times by the emulator, so it should accommodate
// for such if it performs heap allocations or other initialization procedures.
const char* (PS2E_CALLBACK* GetName)();
// GetVersion
// This function returns name and version information for the requested PS2 component.
// If the plugin does not support the requested component, it should return NULL.
// The returned pointer, if non-NULL, must be either a static value [recommended] or a
// heap-allocated value, and valid for the lifetime of the plugin.
//
// This function may be called multiple times by the emulator, so it should accommodate
// for such if it performs heap allocations or other initialization procedures.
//
// Typically a plugin will return the same version for all supported components. The
// component parameter is mostly provided to allow this function to serve a dual purpose
// of both component versioning and as a component enumerator.
//
// See PS2E_VersionInfo for more details.
//
// Parameters:
// component - indicates the ps2 component plugin to be versioned. If the plugin
// does not support the requested component, the function should return NULL.
//
const PS2E_VersionInfo* (PS2E_CALLBACK* GetVersion)( u32 component );
// Test
// Called by the plugin enumerator to check the hardware availability of the specified
// component. The function should return 1 if the plugin appears to be supported, or
// 0 if the test failed.
//
// While a plugin is welcome to use its own CPU capabilities information, it is recommended
// that you use the emulator provided CPU capabilities structure instead. The emulator may
// have provisions in its interface to allow for the forced disabling of extended CPU cap-
// abilities, for testing purposes.
//
// Exceptions:
// C++ Plugins may alternately use exception handling to return more detailed
// information on why the plugin failed it's availability test. [TODO]
//
s32 (PS2E_CALLBACK* Test)( u32 component, const PS2E_MachineInfo* xinfo );
// NewComponentInstance
// The emulator calls this function to fetch the API for the requested component.
// The plugin is expected to perform an "availability test" (the same test as performed
// by Test()) and return NULL if the plugin does not support the host machine's hardware
// or software installations.
//
// This function is only called for components which the plugin returned a non-NULL
// version information struct for in GetVersion().
//
// Plugin Allocation Strategy:
// The Component API has been designed with function invocation efficiency in mind.
// To allocate your plugin's component instance you should create a structure that
// contains PS2E_ComponentAPI_* as the first member (where * refers to the PS2
// component type), and plugin-specific instance data is stored as any number of
// subsequent members in the struct.
//
// Parameters:
// component - indicates the ps2 component API to return.
// dest - structure to fill with plugin function implementations. Dest should
// be manually typecast by the plugin to match the requested component.
//
// Exceptions:
// C++ Plugins may alternately use exception handling to return more detailed
// information on why the plugin failed it's availability test. [TODO]
//
PS2E_THISPTR (PS2E_CALLBACK* NewComponentInstance)( u32 component );
// DeleteComponentInstance
// Called by the emulator when the plugin component is to be shutdown. The component API
// instance pointer can be safely deleted here.
void (PS2E_CALLBACK* DeleteComponentInstance)( PS2E_THISPTR instance );
// SetSettingsFolder
// Callback is passed an ASCII-Z string representing the folder where the emulator's
// settings files are stored (may either be under the user's documents folder, or a
// location relative to the CWD of the emu application).
//
// Typically this callback is only issued once per plugin session, aand prior to the
// opening of any PS2 components. It is the responsibility of the emu to save the
// emulation state, shutdown plugins, and restart everything anew from the new settings
// in such an event as a dynamic change of the settings folder.
//
void (PS2E_CALLBACK* SetSettingsFolder)( const char* folder );
// SetLogFolder
// This callback may be issued at any time. It is the responsibility of the plugin
// to do the necessary actions to close existing disk logging facilities and re-open
// new facilities.
//
// Thread Safety:
// This function is always called from the GUI thread. All emulation threads are
// suspended during the call, so no locking is required.
//
void (PS2E_CALLBACK* SetLogFolder)( const char* folder );
// Reserved area at the end of the structure, for future API expansion. This area
// should always be zeroed out, so that future versions of emulators that may have
// defined functions here will recognize the functions as not supported.
void* reserved[12];
} PS2E_LibraryAPI;
//////////////////////////////////////////////////////////////////////////////////////////
// PS2E_Image
//
// Simple RGBA image data container, for passing surface textures to the GS plugin, and
// for receiving snapshots from the GS plugin.
//
// fixme - this might be more ideal as BGRA or ABGR format on Windows platforms?
//
typedef struct _PS2E_Image
{
u32 width
u32 height;
u8* data; // RGBA data. top to bottom.
} PS2E_Image;
//////////////////////////////////////////////////////////////////////////////////////////
// PS2E_ComponentAPI_GS
//
// Thread Safety:
// All GS callbacks are issued from the GS thread only, and are always called synchronously
// with all other component API functions. No locks are needed, and DirectX-based GS
// plugins can safely disable DX multithreading support for speedup (unless the plugin
// utilizes multiple threads of its own internally).
//
typedef struct _PS2E_ComponentAPI_GS
{
// Base Component API (inherited structure)
struct _PS2E_ComponentAPI Base;
// SetSnapshotsFolder
// Callback is passed an ASCII-Z string representing the folder where the emulator's
// snapshots are to be saved (typically located under user documents, but may be CWD
// or any user-specified location).
//
// Thread Safety:
// This function is only called from the GUI thread, however other threads are not
// suspended.
//
void (PS2E_CALLBACK* SetSnapshotsFolder)( PS2E_THISPTR thisptr, const char* folder );
// TakeSnapshot
// The GS plugin is to save the current frame into the given target image. This
// function is always called immediately after a GSvsync(), ensuring that the current
// framebuffer is safely intact for capture.
void (PS2E_CALLBACK* TakeSnapshot)( PS2E_THISPTR thisptr, PS2E_Image* dest );
// OSD_SetTexture
// Uploads a new OSD texture to the GS. Display of the OSD should be performed at
// the next soonest possible vsync.
void (PS2E_CALLBACK* OSD_SetTexture)( PS2E_THISPTR thisptr, PS2E_Image* src );
// OSD_SetAlpha
//
// Parameters:
// alphOverall - Specifies the 'full' opacity of the OSD. The alphaFade setting
// effectively slides from alphaOverall to 0.0.
//
// alphaFade - Specifies the fadeout status of the OSD. This value can be loosely
// interpreted by the GS plugin. The only requirement is that the GS plugin
// honor the fade value of 0.0 (OSD is not displayed).
void (PS2E_CALLBACK* OSD_SetAlpha)( PS2E_THISPTR thisptr, float alphaOverall, float alphaFade );
void (PS2E_CALLBACK* OSD_SetPosition)( PS2E_THISPTR thisptr, int xpos, int ypos );
void (PS2E_CALLBACK* GSvsync)(int field);
//
//
void (PS2E_CALLBACK* GSreadFIFO)(u128 *pMem, int qwc);
// GStransferTag
// Sends a set of GIFtags. Note that SIGNAL, FINISH, and LABEL tags are handled
// internally by the emulator in a thread-safe manner -- the GS plugin can safely
// ignore the tags (and there is no guarantee the emulator will even bother to
// pass the tags onto the GS).
void (PS2E_CALLBACK* GStransferTags)(u128 *pMem, int tagcnt);
// GStransferPackedTag
// Sends a set of packed GIFtags. Note that SIGNAL, FINISH, and LABEL tags are handled
// internally by the emulator in a thread-safe manner -- the GS plugin can safely
// ignore the tags (and there is no guarantee the emulator will even bother to
// pass the tags onto the GS).
void (PS2E_CALLBACK* GStransferPackedTags)(u128 *pMem, int tagcnt);
// GStransferImage
// Uploads GIFtag image data.
void (PS2E_CALLBACK* GStransferImage)(u128 *pMem, u32 len_qwc);
void* reserved[8];
} PS2E_ComponentAPI_GS;
// PS2E_InitAPI
// Called by the emulator when the plugin is loaded into memory. The emulator uses the
// presence of this function to detect PS2E-v2 plugin API, and will direct all subsequent
// calls through the returned LibraryAPI. The function is allowed to return NULL if the
// emulator's version information or machine capabilities are insufficient for the
// plugin's needs.
//
// This function is called *once* for the duration of a loaded plugin.
//
// Parameters:
// xinfo - Machine info and capabilities, usable for cpu detection. This pointer is
// valid for the duration of the plugin's tenure in memory.
//
// Returns:
// A pointer to a static structure that contains the API for this plugin, or NULL if
// the plugin explicitly does not support the emulator version.
//
// Exceptions:
// C++ Plugins can use exceptions instead of NULL to return additional information on
// why the plugin failed to init the API. [TODO]
//
typedef const PS2E_LibraryAPI* (PS2E_CALLBACK* _PS2E_InitAPI)( const PS2E_MachineInfo* xinfo );
//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
// Begin old legacy API here (present for reference purposes only, until all plugin API
// specifics have been accounted for)
//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
// PAD // PAD
typedef s32 (CALLBACK* _PADinit)(char *configpath, u32 flags); typedef s32 (CALLBACK* _PADinit)(char *configpath, u32 flags);
@ -428,6 +964,9 @@ extern _FWconfigure FWconfigure;
extern _FWfreeze FWfreeze; extern _FWfreeze FWfreeze;
extern _FWtest FWtest; extern _FWtest FWtest;
extern _FWabout FWabout; extern _FWabout FWabout;
#ifndef __cplusplus
} }
#endif
#endif // __PLUGINCALLBACKS_H__ #endif // __PLUGINCALLBACKS_H__

View File

@ -22,79 +22,81 @@
extern void cpudetectInit(); extern void cpudetectInit();
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
// cpu capabilities structure
// //
struct CAPABILITIES struct x86CPU_INFO
{ {
u32 hasFloatingPointUnit; u32 FamilyID; // Processor Family
u32 hasVirtual8086ModeEnhancements; u32 Model; // Processor Model
u32 hasDebuggingExtensions; u32 TypeID; // Processor Type
u32 hasPageSizeExtensions; u32 StepID; // Stepping ID
u32 hasTimeStampCounter; u32 Flags; // Feature Flags
u32 hasModelSpecificRegisters; u32 Flags2; // More Feature Flags
u32 hasPhysicalAddressExtension; u32 EFlags; // Extended Feature Flags
u32 hasCOMPXCHG8BInstruction; u32 EFlags2; // Extended Feature Flags pg2
u32 hasAdvancedProgrammableInterruptController;
u32 hasSEPFastSystemCall; u32 PhysicalCores;
u32 hasMemoryTypeRangeRegisters; u32 LogicalCores;
u32 hasPTEGlobalFlag;
u32 hasMachineCheckArchitecture; char VendorName[16]; // Vendor/Creator ID
u32 hasConditionalMoveAndCompareInstructions; char TypeName[20]; // cpu type
u32 hasFGPageAttributeTable; char FamilyName[50]; // the original cpu name
u32 has36bitPageSizeExtension;
u32 hasProcessorSerialNumber; // Speed - speed of cpu in mhz
u32 hasCFLUSHInstruction; // This is a rough "real" measure of the cpu speed, taken at application startup.
u32 hasDebugStore; // Not to be considered totally accurate: Power saving CPUs and SpeedStep can skew
u32 hasACPIThermalMonitorAndClockControl; // results considerably.
u32 hasMultimediaExtensions; u32 Speed;
u32 hasFastStreamingSIMDExtensionsSaveRestore;
u32 hasStreamingSIMDExtensions; // ----------------------------------------------------------------------------
u32 hasStreamingSIMD2Extensions; // x86 CPU Capabilities Section (all boolean flags!)
u32 hasSelfSnoop; // ----------------------------------------------------------------------------
u32 hasMultiThreading; // is TRUE for both mutli-core and Hyperthreaded CPUs.
u32 hasThermalMonitor; u32 hasFloatingPointUnit:1;
u32 hasIntel64BitArchitecture; u32 hasVirtual8086ModeEnhancements:1;
u32 hasStreamingSIMD3Extensions; u32 hasDebuggingExtensions:1;
u32 hasSupplementalStreamingSIMD3Extensions; u32 hasPageSizeExtensions:1;
u32 hasStreamingSIMD4Extensions; u32 hasTimeStampCounter:1;
u32 hasStreamingSIMD4Extensions2; u32 hasModelSpecificRegisters:1;
u32 hasPhysicalAddressExtension:1;
u32 hasCOMPXCHG8BInstruction:1;
u32 hasAdvancedProgrammableInterruptController:1;
u32 hasSEPFastSystemCall:1;
u32 hasMemoryTypeRangeRegisters:1;
u32 hasPTEGlobalFlag:1;
u32 hasMachineCheckArchitecture:1;
u32 hasConditionalMoveAndCompareInstructions:1;
u32 hasFGPageAttributeTable:1;
u32 has36bitPageSizeExtension:1;
u32 hasProcessorSerialNumber:1;
u32 hasCFLUSHInstruction:1;
u32 hasDebugStore:1;
u32 hasACPIThermalMonitorAndClockControl:1;
u32 hasMultimediaExtensions:1;
u32 hasFastStreamingSIMDExtensionsSaveRestore:1;
u32 hasStreamingSIMDExtensions:1;
u32 hasStreamingSIMD2Extensions:1;
u32 hasSelfSnoop:1;
u32 hasMultiThreading:1; // is TRUE for both multi-core and Hyperthreaded CPUs.
u32 hasThermalMonitor:1;
u32 hasIntel64BitArchitecture:1;
u32 hasStreamingSIMD3Extensions:1;
u32 hasSupplementalStreamingSIMD3Extensions:1;
u32 hasStreamingSIMD4Extensions:1;
u32 hasStreamingSIMD4Extensions2:1;
// AMD-specific CPU Features // AMD-specific CPU Features
u32 hasMultimediaExtensionsExt; u32 hasMultimediaExtensionsExt:1;
u32 hasAMD64BitArchitecture; u32 hasAMD64BitArchitecture:1;
u32 has3DNOWInstructionExtensionsExt; u32 has3DNOWInstructionExtensionsExt:1;
u32 has3DNOWInstructionExtensions; u32 has3DNOWInstructionExtensions:1;
u32 hasStreamingSIMD4ExtensionsA; u32 hasStreamingSIMD4ExtensionsA:1;
};
//////////////////////////////////////////////////////////////////////////////////////////
//
struct CPUINFO
{
u32 x86Family; // Processor Family
u32 x86Model; // Processor Model
u32 x86PType; // Processor Type
u32 x86StepID; // Stepping ID
u32 x86Flags; // Feature Flags
u32 x86Flags2; // More Feature Flags
u32 x86EFlags; // Extended Feature Flags
u32 x86EFlags2; // Extended Feature Flags pg2
u32 PhysicalCores;
u32 LogicalCores;
char x86ID[16]; // Vendor ID //the vendor creator (in %s)
char x86Type[20]; //cpu type in char format //the cpu type (in %s)
char x86Fam[50]; // family in char format //the original cpu name string (in %s)
u32 cpuspeed; // speed of cpu //this will give cpu speed (in %d)
}; };
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
extern CAPABILITIES cpucaps; PCSX2_ALIGNED16_EXTERN( x86CPU_INFO x86caps );
extern CPUINFO cpuinfo;
extern u8 g_globalMMXSaved, g_globalXMMSaved; extern u8 g_globalMMXSaved, g_globalXMMSaved;
extern bool g_EEFreezeRegs; extern bool g_EEFreezeRegs;

View File

@ -36,14 +36,14 @@ namespace Threading
if( numCPU > 0 ) if( numCPU > 0 )
{ {
isMultiCore = numCPU > 1; isMultiCore = numCPU > 1;
cpuinfo.LogicalCores = numCPU; x86caps.LogicalCores = numCPU;
cpuinfo.PhysicalCores = ( numCPU / LogicalCoresPerPhysicalCPU ) * PhysicalCoresPerPhysicalCPU; x86caps.PhysicalCores = ( numCPU / LogicalCoresPerPhysicalCPU ) * PhysicalCoresPerPhysicalCPU;
} }
else else
{ {
// Indeterminate? // Indeterminate?
cpuinfo.LogicalCores = 1; x86caps.LogicalCores = 1;
cpuinfo.PhysicalCores = 1; x86caps.PhysicalCores = 1;
} }
} }

View File

@ -34,7 +34,7 @@ namespace Threading
DWORD vProcessCPUs; DWORD vProcessCPUs;
DWORD vSystemCPUs; DWORD vSystemCPUs;
cpuinfo.LogicalCores = 1; x86caps.LogicalCores = 1;
if( !GetProcessAffinityMask (GetCurrentProcess (), if( !GetProcessAffinityMask (GetCurrentProcess (),
&vProcessCPUs, &vSystemCPUs) ) return; &vProcessCPUs, &vSystemCPUs) ) return;
@ -48,12 +48,12 @@ namespace Threading
CPUs++; CPUs++;
} }
cpuinfo.LogicalCores = CPUs; x86caps.LogicalCores = CPUs;
if( LogicalCoresPerPhysicalCPU > CPUs) // for 1-socket HTT-disabled machines if( LogicalCoresPerPhysicalCPU > CPUs) // for 1-socket HTT-disabled machines
LogicalCoresPerPhysicalCPU = CPUs; LogicalCoresPerPhysicalCPU = CPUs;
cpuinfo.PhysicalCores = ( CPUs / LogicalCoresPerPhysicalCPU ) * PhysicalCoresPerPhysicalCPU; x86caps.PhysicalCores = ( CPUs / LogicalCoresPerPhysicalCPU ) * PhysicalCoresPerPhysicalCPU;
//ptw32_smp_system = ( cpuinfo.LogicalCores > 1 ) ? TRUE : FALSE; //ptw32_smp_system = ( x86caps.LogicalCores > 1 ) ? TRUE : FALSE;
} }
__forceinline void Timeslice() __forceinline void Timeslice()

View File

@ -24,8 +24,7 @@
using namespace x86Emitter; using namespace x86Emitter;
CAPABILITIES cpucaps; PCSX2_ALIGNED16( x86CPU_INFO x86caps );
CPUINFO cpuinfo;
static s32 iCpuId( u32 cmd, u32 *regs ) static s32 iCpuId( u32 cmd, u32 *regs )
{ {
@ -119,7 +118,7 @@ static s64 CPUSpeedHz( u64 time )
u64 timeStart, timeStop; u64 timeStart, timeStop;
s64 startTick, endTick; s64 startTick, endTick;
if( ! cpucaps.hasTimeStampCounter ) if( ! x86caps.hasTimeStampCounter )
return 0; //check if function is supported return 0; //check if function is supported
SetSingleAffinity(); SetSingleAffinity();
@ -169,20 +168,20 @@ void cpudetectInit()
int num; int num;
char str[50]; char str[50];
memzero_obj( cpuinfo.x86ID ); memzero_obj( x86caps.VendorName );
cpuinfo.x86Family = 0; x86caps.FamilyID = 0;
cpuinfo.x86Model = 0; x86caps.Model = 0;
cpuinfo.x86PType = 0; x86caps.TypeID = 0;
cpuinfo.x86StepID = 0; x86caps.StepID = 0;
cpuinfo.x86Flags = 0; x86caps.Flags = 0;
cpuinfo.x86EFlags = 0; x86caps.EFlags = 0;
if ( iCpuId( 0, regs ) == -1 ) return; if ( iCpuId( 0, regs ) == -1 ) return;
cmds = regs[ 0 ]; cmds = regs[ 0 ];
((u32*)cpuinfo.x86ID)[ 0 ] = regs[ 1 ]; ((u32*)x86caps.VendorName)[ 0 ] = regs[ 1 ];
((u32*)cpuinfo.x86ID)[ 1 ] = regs[ 3 ]; ((u32*)x86caps.VendorName)[ 1 ] = regs[ 3 ];
((u32*)cpuinfo.x86ID)[ 2 ] = regs[ 2 ]; ((u32*)x86caps.VendorName)[ 2 ] = regs[ 2 ];
// Hack - prevents reg[2] & reg[3] from being optimized out of existance! // Hack - prevents reg[2] & reg[3] from being optimized out of existance!
num = sprintf(str, "\tx86Flags = %8.8x %8.8x\n", regs[3], regs[2]); num = sprintf(str, "\tx86Flags = %8.8x %8.8x\n", regs[3], regs[2]);
@ -194,18 +193,18 @@ void cpudetectInit()
{ {
if ( iCpuId( 0x00000001, regs ) != -1 ) if ( iCpuId( 0x00000001, regs ) != -1 )
{ {
cpuinfo.x86StepID = regs[ 0 ] & 0xf; x86caps.StepID = regs[ 0 ] & 0xf;
cpuinfo.x86Model = (regs[ 0 ] >> 4) & 0xf; x86caps.Model = (regs[ 0 ] >> 4) & 0xf;
cpuinfo.x86Family = (regs[ 0 ] >> 8) & 0xf; x86caps.FamilyID = (regs[ 0 ] >> 8) & 0xf;
cpuinfo.x86PType = (regs[ 0 ] >> 12) & 0x3; x86caps.TypeID = (regs[ 0 ] >> 12) & 0x3;
LogicalCoresPerPhysicalCPU = ( regs[1] >> 16 ) & 0xff; LogicalCoresPerPhysicalCPU = ( regs[1] >> 16 ) & 0xff;
x86_64_8BITBRANDID = regs[ 1 ] & 0xff; x86_64_8BITBRANDID = regs[ 1 ] & 0xff;
cpuinfo.x86Flags = regs[ 3 ]; x86caps.Flags = regs[ 3 ];
cpuinfo.x86Flags2 = regs[ 2 ]; x86caps.Flags2 = regs[ 2 ];
} }
} }
/* detect multicore for intel cpu */ /* detect multicore for intel cpu */
if ((cmds >= 0x00000004) && !strcmp("GenuineIntel",cpuinfo.x86ID)) if ((cmds >= 0x00000004) && !strcmp("GenuineIntel",x86caps.VendorName))
{ {
if ( iCpuId( 0x00000004, regs ) != -1 ) if ( iCpuId( 0x00000004, regs ) != -1 )
{ {
@ -221,13 +220,13 @@ void cpudetectInit()
if ( iCpuId( 0x80000001, regs ) != -1 ) if ( iCpuId( 0x80000001, regs ) != -1 )
{ {
x86_64_12BITBRANDID = regs[1] & 0xfff; x86_64_12BITBRANDID = regs[1] & 0xfff;
cpuinfo.x86EFlags2 = regs[ 2 ]; x86caps.EFlags2 = regs[ 2 ];
cpuinfo.x86EFlags = regs[ 3 ]; x86caps.EFlags = regs[ 3 ];
} }
} }
/* detect multicore for amd cpu */ /* detect multicore for amd cpu */
if ((cmds >= 0x80000008) && !strcmp("AuthenticAMD",cpuinfo.x86ID)) if ((cmds >= 0x80000008) && !strcmp("AuthenticAMD",x86caps.VendorName))
{ {
if ( iCpuId( 0x80000008, regs ) != -1 ) if ( iCpuId( 0x80000008, regs ) != -1 )
{ {
@ -236,84 +235,84 @@ void cpudetectInit()
} }
} }
switch(cpuinfo.x86PType) switch(x86caps.TypeID)
{ {
case 0: case 0:
strcpy( cpuinfo.x86Type, "Standard OEM"); strcpy( x86caps.TypeName, "Standard OEM");
break; break;
case 1: case 1:
strcpy( cpuinfo.x86Type, "Overdrive"); strcpy( x86caps.TypeName, "Overdrive");
break; break;
case 2: case 2:
strcpy( cpuinfo.x86Type, "Dual"); strcpy( x86caps.TypeName, "Dual");
break; break;
case 3: case 3:
strcpy( cpuinfo.x86Type, "Reserved"); strcpy( x86caps.TypeName, "Reserved");
break; break;
default: default:
strcpy( cpuinfo.x86Type, "Unknown"); strcpy( x86caps.TypeName, "Unknown");
break; break;
} }
if ( cpuinfo.x86ID[ 0 ] == 'G' ){ cputype=0;}//trick lines but if you know a way better ;p if ( x86caps.VendorName[ 0 ] == 'G' ){ cputype=0;}//trick lines but if you know a way better ;p
if ( cpuinfo.x86ID[ 0 ] == 'A' ){ cputype=1;} if ( x86caps.VendorName[ 0 ] == 'A' ){ cputype=1;}
memzero_obj( cpuinfo.x86Fam ); memzero_obj( x86caps.FamilyName );
iCpuId( 0x80000002, (u32*)cpuinfo.x86Fam); iCpuId( 0x80000002, (u32*)x86caps.FamilyName);
iCpuId( 0x80000003, (u32*)(cpuinfo.x86Fam+16)); iCpuId( 0x80000003, (u32*)(x86caps.FamilyName+16));
iCpuId( 0x80000004, (u32*)(cpuinfo.x86Fam+32)); iCpuId( 0x80000004, (u32*)(x86caps.FamilyName+32));
//capabilities //capabilities
cpucaps.hasFloatingPointUnit = ( cpuinfo.x86Flags >> 0 ) & 1; x86caps.hasFloatingPointUnit = ( x86caps.Flags >> 0 ) & 1;
cpucaps.hasVirtual8086ModeEnhancements = ( cpuinfo.x86Flags >> 1 ) & 1; x86caps.hasVirtual8086ModeEnhancements = ( x86caps.Flags >> 1 ) & 1;
cpucaps.hasDebuggingExtensions = ( cpuinfo.x86Flags >> 2 ) & 1; x86caps.hasDebuggingExtensions = ( x86caps.Flags >> 2 ) & 1;
cpucaps.hasPageSizeExtensions = ( cpuinfo.x86Flags >> 3 ) & 1; x86caps.hasPageSizeExtensions = ( x86caps.Flags >> 3 ) & 1;
cpucaps.hasTimeStampCounter = ( cpuinfo.x86Flags >> 4 ) & 1; x86caps.hasTimeStampCounter = ( x86caps.Flags >> 4 ) & 1;
cpucaps.hasModelSpecificRegisters = ( cpuinfo.x86Flags >> 5 ) & 1; x86caps.hasModelSpecificRegisters = ( x86caps.Flags >> 5 ) & 1;
cpucaps.hasPhysicalAddressExtension = ( cpuinfo.x86Flags >> 6 ) & 1; x86caps.hasPhysicalAddressExtension = ( x86caps.Flags >> 6 ) & 1;
cpucaps.hasMachineCheckArchitecture = ( cpuinfo.x86Flags >> 7 ) & 1; x86caps.hasMachineCheckArchitecture = ( x86caps.Flags >> 7 ) & 1;
cpucaps.hasCOMPXCHG8BInstruction = ( cpuinfo.x86Flags >> 8 ) & 1; x86caps.hasCOMPXCHG8BInstruction = ( x86caps.Flags >> 8 ) & 1;
cpucaps.hasAdvancedProgrammableInterruptController = ( cpuinfo.x86Flags >> 9 ) & 1; x86caps.hasAdvancedProgrammableInterruptController = ( x86caps.Flags >> 9 ) & 1;
cpucaps.hasSEPFastSystemCall = ( cpuinfo.x86Flags >> 11 ) & 1; x86caps.hasSEPFastSystemCall = ( x86caps.Flags >> 11 ) & 1;
cpucaps.hasMemoryTypeRangeRegisters = ( cpuinfo.x86Flags >> 12 ) & 1; x86caps.hasMemoryTypeRangeRegisters = ( x86caps.Flags >> 12 ) & 1;
cpucaps.hasPTEGlobalFlag = ( cpuinfo.x86Flags >> 13 ) & 1; x86caps.hasPTEGlobalFlag = ( x86caps.Flags >> 13 ) & 1;
cpucaps.hasMachineCheckArchitecture = ( cpuinfo.x86Flags >> 14 ) & 1; x86caps.hasMachineCheckArchitecture = ( x86caps.Flags >> 14 ) & 1;
cpucaps.hasConditionalMoveAndCompareInstructions = ( cpuinfo.x86Flags >> 15 ) & 1; x86caps.hasConditionalMoveAndCompareInstructions = ( x86caps.Flags >> 15 ) & 1;
cpucaps.hasFGPageAttributeTable = ( cpuinfo.x86Flags >> 16 ) & 1; x86caps.hasFGPageAttributeTable = ( x86caps.Flags >> 16 ) & 1;
cpucaps.has36bitPageSizeExtension = ( cpuinfo.x86Flags >> 17 ) & 1; x86caps.has36bitPageSizeExtension = ( x86caps.Flags >> 17 ) & 1;
cpucaps.hasProcessorSerialNumber = ( cpuinfo.x86Flags >> 18 ) & 1; x86caps.hasProcessorSerialNumber = ( x86caps.Flags >> 18 ) & 1;
cpucaps.hasCFLUSHInstruction = ( cpuinfo.x86Flags >> 19 ) & 1; x86caps.hasCFLUSHInstruction = ( x86caps.Flags >> 19 ) & 1;
cpucaps.hasDebugStore = ( cpuinfo.x86Flags >> 21 ) & 1; x86caps.hasDebugStore = ( x86caps.Flags >> 21 ) & 1;
cpucaps.hasACPIThermalMonitorAndClockControl = ( cpuinfo.x86Flags >> 22 ) & 1; x86caps.hasACPIThermalMonitorAndClockControl = ( x86caps.Flags >> 22 ) & 1;
cpucaps.hasMultimediaExtensions = ( cpuinfo.x86Flags >> 23 ) & 1; //mmx x86caps.hasMultimediaExtensions = ( x86caps.Flags >> 23 ) & 1; //mmx
cpucaps.hasFastStreamingSIMDExtensionsSaveRestore = ( cpuinfo.x86Flags >> 24 ) & 1; x86caps.hasFastStreamingSIMDExtensionsSaveRestore = ( x86caps.Flags >> 24 ) & 1;
cpucaps.hasStreamingSIMDExtensions = ( cpuinfo.x86Flags >> 25 ) & 1; //sse x86caps.hasStreamingSIMDExtensions = ( x86caps.Flags >> 25 ) & 1; //sse
cpucaps.hasStreamingSIMD2Extensions = ( cpuinfo.x86Flags >> 26 ) & 1; //sse2 x86caps.hasStreamingSIMD2Extensions = ( x86caps.Flags >> 26 ) & 1; //sse2
cpucaps.hasSelfSnoop = ( cpuinfo.x86Flags >> 27 ) & 1; x86caps.hasSelfSnoop = ( x86caps.Flags >> 27 ) & 1;
cpucaps.hasMultiThreading = ( cpuinfo.x86Flags >> 28 ) & 1; x86caps.hasMultiThreading = ( x86caps.Flags >> 28 ) & 1;
cpucaps.hasThermalMonitor = ( cpuinfo.x86Flags >> 29 ) & 1; x86caps.hasThermalMonitor = ( x86caps.Flags >> 29 ) & 1;
cpucaps.hasIntel64BitArchitecture = ( cpuinfo.x86Flags >> 30 ) & 1; x86caps.hasIntel64BitArchitecture = ( x86caps.Flags >> 30 ) & 1;
//that is only for AMDs //that is only for AMDs
cpucaps.hasMultimediaExtensionsExt = ( cpuinfo.x86EFlags >> 22 ) & 1; //mmx2 x86caps.hasMultimediaExtensionsExt = ( x86caps.EFlags >> 22 ) & 1; //mmx2
cpucaps.hasAMD64BitArchitecture = ( cpuinfo.x86EFlags >> 29 ) & 1; //64bit cpu x86caps.hasAMD64BitArchitecture = ( x86caps.EFlags >> 29 ) & 1; //64bit cpu
cpucaps.has3DNOWInstructionExtensionsExt = ( cpuinfo.x86EFlags >> 30 ) & 1; //3dnow+ x86caps.has3DNOWInstructionExtensionsExt = ( x86caps.EFlags >> 30 ) & 1; //3dnow+
cpucaps.has3DNOWInstructionExtensions = ( cpuinfo.x86EFlags >> 31 ) & 1; //3dnow x86caps.has3DNOWInstructionExtensions = ( x86caps.EFlags >> 31 ) & 1; //3dnow
cpucaps.hasStreamingSIMD4ExtensionsA = ( cpuinfo.x86EFlags2 >> 6 ) & 1; //INSERTQ / EXTRQ / MOVNT x86caps.hasStreamingSIMD4ExtensionsA = ( x86caps.EFlags2 >> 6 ) & 1; //INSERTQ / EXTRQ / MOVNT
InitCPUTicks(); InitCPUTicks();
u64 span = GetTickFrequency(); u64 span = GetTickFrequency();
if( (span % 1000) < 400 ) // helps minimize rounding errors if( (span % 1000) < 400 ) // helps minimize rounding errors
cpuinfo.cpuspeed = (u32)( CPUSpeedHz( span / 1000 ) / 1000 ); x86caps.Speed = (u32)( CPUSpeedHz( span / 1000 ) / 1000 );
else else
cpuinfo.cpuspeed = (u32)( CPUSpeedHz( span / 500 ) / 2000 ); x86caps.Speed = (u32)( CPUSpeedHz( span / 500 ) / 2000 );
// --> SSE3 / SSSE3 / SSE4.1 / SSE 4.2 detection <-- // --> SSE3 / SSSE3 / SSE4.1 / SSE 4.2 detection <--
cpucaps.hasStreamingSIMD3Extensions = ( cpuinfo.x86Flags2 >> 0 ) & 1; //sse3 x86caps.hasStreamingSIMD3Extensions = ( x86caps.Flags2 >> 0 ) & 1; //sse3
cpucaps.hasSupplementalStreamingSIMD3Extensions = ( cpuinfo.x86Flags2 >> 9 ) & 1; //ssse3 x86caps.hasSupplementalStreamingSIMD3Extensions = ( x86caps.Flags2 >> 9 ) & 1; //ssse3
cpucaps.hasStreamingSIMD4Extensions = ( cpuinfo.x86Flags2 >> 19 ) & 1; //sse4.1 x86caps.hasStreamingSIMD4Extensions = ( x86caps.Flags2 >> 19 ) & 1; //sse4.1
cpucaps.hasStreamingSIMD4Extensions2 = ( cpuinfo.x86Flags2 >> 20 ) & 1; //sse4.2 x86caps.hasStreamingSIMD4Extensions2 = ( x86caps.Flags2 >> 20 ) & 1; //sse4.2
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
// SIMD Instruction Support Detection // SIMD Instruction Support Detection
@ -355,28 +354,28 @@ void cpudetectInit()
// more reliable gauge of the cpu's actual ability. But since a difference in bit // more reliable gauge of the cpu's actual ability. But since a difference in bit
// and actual ability may represent a cmos/bios problem, we report it to the user. // and actual ability may represent a cmos/bios problem, we report it to the user.
if( sse3_result != !!cpucaps.hasStreamingSIMD3Extensions ) if( sse3_result != !!x86caps.hasStreamingSIMD3Extensions )
{ {
Console::Notice( "SSE3 Detection Inconsistency: cpuid=%s, test_result=%s", Console::Notice( "SSE3 Detection Inconsistency: cpuid=%s, test_result=%s",
params bool_to_char( !!cpucaps.hasStreamingSIMD3Extensions ), bool_to_char( sse3_result ) ); params bool_to_char( !!x86caps.hasStreamingSIMD3Extensions ), bool_to_char( sse3_result ) );
cpucaps.hasStreamingSIMD3Extensions = sse3_result; x86caps.hasStreamingSIMD3Extensions = sse3_result;
} }
if( ssse3_result != !!cpucaps.hasSupplementalStreamingSIMD3Extensions ) if( ssse3_result != !!x86caps.hasSupplementalStreamingSIMD3Extensions )
{ {
Console::Notice( "SSSE3 Detection Inconsistency: cpuid=%s, test_result=%s", Console::Notice( "SSSE3 Detection Inconsistency: cpuid=%s, test_result=%s",
params bool_to_char( !!cpucaps.hasSupplementalStreamingSIMD3Extensions ), bool_to_char( ssse3_result ) ); params bool_to_char( !!x86caps.hasSupplementalStreamingSIMD3Extensions ), bool_to_char( ssse3_result ) );
cpucaps.hasSupplementalStreamingSIMD3Extensions = ssse3_result; x86caps.hasSupplementalStreamingSIMD3Extensions = ssse3_result;
} }
if( sse41_result != !!cpucaps.hasStreamingSIMD4Extensions ) if( sse41_result != !!x86caps.hasStreamingSIMD4Extensions )
{ {
Console::Notice( "SSE4 Detection Inconsistency: cpuid=%s, test_result=%s", Console::Notice( "SSE4 Detection Inconsistency: cpuid=%s, test_result=%s",
params bool_to_char( !!cpucaps.hasStreamingSIMD4Extensions ), bool_to_char( sse41_result ) ); params bool_to_char( !!x86caps.hasStreamingSIMD4Extensions ), bool_to_char( sse41_result ) );
cpucaps.hasStreamingSIMD4Extensions = sse41_result; x86caps.hasStreamingSIMD4Extensions = sse41_result;
} }
} }
@ -392,10 +391,10 @@ void cpudetectInit()
//////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////
// Core Counting! // Core Counting!
if( !cpucaps.hasMultiThreading || LogicalCoresPerPhysicalCPU == 0 ) if( !x86caps.hasMultiThreading || LogicalCoresPerPhysicalCPU == 0 )
LogicalCoresPerPhysicalCPU = 1; LogicalCoresPerPhysicalCPU = 1;
// This will assign values into cpuinfo.LogicalCores and PhysicalCores // This will assign values into x86caps.LogicalCores and PhysicalCores
Threading::CountLogicalCores( LogicalCoresPerPhysicalCPU, PhysicalCoresPerPhysicalCPU ); Threading::CountLogicalCores( LogicalCoresPerPhysicalCPU, PhysicalCoresPerPhysicalCPU );
} }

View File

@ -298,11 +298,8 @@ s32 cdvdReadConfig(u8* config)
} }
s32 cdvdWriteConfig(const u8* config) s32 cdvdWriteConfig(const u8* config)
{ {
// make sure its in write mode // make sure its in write mode && the block index is in bounds
if(cdvd.CReadWrite != 1) if ((cdvd.CReadWrite != 1) || (cdvd.CBlockIndex >= cdvd.CNumBlocks))
return 1;
// check if block index is in bounds
else if(cdvd.CBlockIndex >= cdvd.CNumBlocks)
return 1; return 1;
else if( else if(
((cdvd.COffset == 0) && (cdvd.CBlockIndex >= 4))|| ((cdvd.COffset == 0) && (cdvd.CBlockIndex >= 4))||
@ -549,14 +546,12 @@ void cdvdNewDiskCB()
void mechaDecryptBytes( u32 madr, int size ) void mechaDecryptBytes( u32 madr, int size )
{ {
int i;
int shiftAmount = (cdvd.decSet>>4) & 7; int shiftAmount = (cdvd.decSet>>4) & 7;
int doXor = (cdvd.decSet) & 1; int doXor = (cdvd.decSet) & 1;
int doShift = (cdvd.decSet) & 2; int doShift = (cdvd.decSet) & 2;
u8* curval = iopPhysMem( madr ); u8* curval = iopPhysMem( madr );
for( i=0; i<size; ++i, ++curval ) for( int i=0; i<size; ++i, ++curval )
{ {
if( doXor ) *curval ^= cdvd.Key[4]; if( doXor ) *curval ^= cdvd.Key[4];
if( doShift ) *curval = (*curval >> shiftAmount) | (*curval << (8-shiftAmount) ); if( doShift ) *curval = (*curval >> shiftAmount) | (*curval << (8-shiftAmount) );
@ -596,7 +591,7 @@ int cdvdReadSector() {
{ {
// dual layer ptp disc // dual layer ptp disc
layerNum = 1; layerNum = 1;
lsn = lsn-layer1Start + 0x30000; lsn = lsn - layer1Start + 0x30000;
} }
else if((dualType == 2) && (lsn >= layer1Start)) else if((dualType == 2) && (lsn >= layer1Start))
{ {
@ -605,9 +600,9 @@ int cdvdReadSector() {
lsn = ~(layer1Start+0x30000 - 1); lsn = ~(layer1Start+0x30000 - 1);
} }
else else
{ // Assumed the other dualType is 0. {
// single layer disc // Assuming the other dualType is 0,
// or on first layer of dual layer disc // single layer disc, or on first layer of dual layer disc.
layerNum = 0; layerNum = 0;
lsn += 0x30000; lsn += 0x30000;
} }
@ -630,7 +625,24 @@ int cdvdReadSector() {
mdest[11] = 0; mdest[11] = 0;
// normal 2048 bytes of sector data // normal 2048 bytes of sector data
memcpy_fast( &mdest[12], cdr.pTransfer, 2048); if (cdr.pTransfer == NULL)
{
// Unlike CDVDiso, the internal IsoReadTrack function will pass an error if lsn is more
// then the number of blocks in the iso. If this happens, cdr.pTransfer will be NULL.
//
// Passing null to memcpy is a bad thing, and will result in, for example, the start of
// Final Fantasy X-2 crashing. So we won't.
DevCon::WriteLn("Bad Transfer!");
for (int i = 12; i <= 2060; i++)
{
mdest[i] = 0;
}
}
else
{
memcpy_fast( &mdest[12], cdr.pTransfer, 2048);
}
// 4 bytes of edc (not calculated at present) // 4 bytes of edc (not calculated at present)
mdest[2060] = 0; mdest[2060] = 0;
@ -731,7 +743,10 @@ __forceinline void cdvdReadInterrupt()
cdr.pTransfer = cdr.Transfer; cdr.pTransfer = cdr.Transfer;
} }
else else
{
DevCon::WriteLn("Error reading track.");
cdr.pTransfer = NULL; cdr.pTransfer = NULL;
}
if (cdr.RErr == -1) if (cdr.RErr == -1)
{ {
@ -774,7 +789,6 @@ __forceinline void cdvdReadInterrupt()
cdvd.Ready = CDVD_READY2; cdvd.Ready = CDVD_READY2;
// All done! :D // All done! :D
return; return;
} }

View File

@ -27,6 +27,43 @@ extern char isoFileName[];
#define btoi(b) ((b)/16*10 + (b)%16) /* BCD to u_char */ #define btoi(b) ((b)/16*10 + (b)%16) /* BCD to u_char */
#define itob(i) ((i)/10*16 + (i)%10) /* u_char to BCD */ #define itob(i) ((i)/10*16 + (i)%10) /* u_char to BCD */
static __forceinline s32 msf_to_lsn(u8 *Time)
{
u32 lsn;
lsn = Time[2];
lsn +=(Time[1] - 2) * 75;
lsn += Time[0] * 75 * 60;
return lsn;
}
static __forceinline s32 msf_to_lba(u8 m, u8 s, u8 f)
{
u32 lsn;
lsn = f;
lsn += (s - 2) * 75;
lsn += m * 75 * 60;
return lsn;
}
static __forceinline void lsn_to_msf(u8 *Time, s32 lsn)
{
lsn += 150;
Time[2] = lsn / 4500; // minuten
lsn = lsn - Time[2] * 4500; // minuten rest
Time[1] = lsn / 75; // sekunden
Time[0] = lsn - Time[1] * 75; // sekunden rest
}
static __forceinline void lba_to_msf(s32 lba, u8* m, u8* s, u8* f)
{
lba += 150;
*m = lba / (60 * 75);
*s = (lba / 75) % 60;
*f = lba % 75;
}
struct cdvdRTC { struct cdvdRTC {
u8 status; u8 status;
u8 second; u8 second;

View File

@ -18,7 +18,6 @@
#include "PrecompiledHeader.h" #include "PrecompiledHeader.h"
// TODO: fix this for linux! (hardcoded as _WIN32 only)
#define ENABLE_TIMESTAMPS #define ENABLE_TIMESTAMPS
#ifdef _WIN32 #ifdef _WIN32
@ -26,7 +25,7 @@
#endif #endif
#include <ctype.h> #include <ctype.h>
#include <time.h> #include <wx/datetime.h>
#include "IopCommon.h" #include "IopCommon.h"
#include "IsoFStools.h" #include "IsoFStools.h"
@ -54,8 +53,10 @@ int CheckDiskTypeFS(int baseType)
IsoFS_init(); IsoFS_init();
f = IsoFS_open("SYSTEM.CNF;1", 1);
// check if the file exists // check if the file exists
if ((f=IsoFS_open("SYSTEM.CNF;1", 1)) >= 0) if (f >= 0)
{ {
int size = IsoFS_read(f, buffer, 256); int size = IsoFS_read(f, buffer, 256);
IsoFS_close(f); IsoFS_close(f);
@ -91,9 +92,7 @@ int FindDiskType(int mType)
{ {
int dataTracks = 0; int dataTracks = 0;
int audioTracks = 0; int audioTracks = 0;
int iCDType = mType; int iCDType = mType;
cdvdTN tn; cdvdTN tn;
CDVD.getTN(&tn); CDVD.getTN(&tn);
@ -105,6 +104,7 @@ int FindDiskType(int mType)
else if (mType < 0) else if (mType < 0)
{ {
cdvdTD td; cdvdTD td;
CDVD.getTD(0,&td); CDVD.getTD(0,&td);
if (td.lsn > 452849) if (td.lsn > 452849)
{ {
@ -153,6 +153,7 @@ int FindDiskType(int mType)
for(int i = tn.strack; i <= tn.etrack; i++) for(int i = tn.strack; i <= tn.etrack; i++)
{ {
cdvdTD td,td2; cdvdTD td,td2;
CDVD.getTD(i,&td); CDVD.getTD(i,&td);
if (tn.etrack > i) if (tn.etrack > i)
@ -260,58 +261,28 @@ s32 DoCDVDopen(const char* pTitleFilename)
int ret = CDVD.open(pTitleFilename); int ret = CDVD.open(pTitleFilename);
int cdtype = DoCDVDdetectDiskType(); int cdtype = DoCDVDdetectDiskType();
if((Config.Blockdump)&&(cdtype != CDVD_TYPE_NODISC)) if ((Config.Blockdump) && (cdtype != CDVD_TYPE_NODISC))
{ {
char fname_only[g_MaxPath]; // write blockdumps to the CWD for now.
if(CDVD.init == ISO.init) wxString temp( Path::Combine( wxGetCwd(), (CDVD.init == ISO.init) ?
{ Path::GetFilenameWithoutExt(wxString::FromAscii(isoFileName)) : L"Untitled"
#ifdef _WIN32 ) );
char fname[MAX_PATH], ext[g_MaxPath];
_splitpath(isoFileName, NULL, NULL, fname, ext);
_makepath(fname_only, NULL, NULL, fname, NULL);
#else
getcwd(fname_only, ArraySize(fname_only)); // Base it out of the current directory for now.
strcat(fname_only, Path::GetFilenameWithoutExt(isoFileName).c_str());
#endif
}
else
{
strcpy(fname_only, "Untitled");
}
#ifdef ENABLE_TIMESTAMPS #ifdef ENABLE_TIMESTAMPS
#ifdef _WIN32 wxDateTime curtime( wxDateTime::GetTimeNow() );
SYSTEMTIME time;
GetLocalTime(&time);
sprintf( temp += wxsFormat( L" (%04d-%02d-%02d %02d-%02d-%02d)",
fname_only+strlen(fname_only), curtime.GetYear(), curtime.GetMonth(), curtime.GetDay(),
" (%04d-%02d-%02d %02d-%02d-%02d).dump", curtime.GetHour(), curtime.GetMinute(), curtime.GetSecond()
time.wYear, time.wMonth, time.wDay, );
time.wHour, time.wMinute, time.wSecond);
#else
time_t rawtime;
struct tm * timeinfo;
time(&rawtime);
timeinfo = localtime(&rawtime);
sprintf(
fname_only+strlen(fname_only),
" (%04d-%02d-%02d %02d-%02d-%02d).dump",
timeinfo->tm_year + 1900, timeinfo->tm_mon, timeinfo->tm_mday,
timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec);
#endif
#else
strcat(fname_only, ".dump");
#endif #endif
temp += L".dump";
cdvdTD td; cdvdTD td;
CDVD.getTD(0, &td); CDVD.getTD(0, &td);
int blockofs = 0; int blockofs = 0, blocksize = 0, blocks = td.lsn;
int blocksize = 0;
int blocks = td.lsn;
switch(cdtype) switch(cdtype)
{ {
@ -329,7 +300,7 @@ s32 DoCDVDopen(const char* pTitleFilename)
break; break;
} }
blockDumpFile = isoCreate(fname_only, ISOFLAGS_BLOCKDUMP); blockDumpFile = isoCreate(temp.ToAscii().data(), ISOFLAGS_BLOCKDUMP);
if (blockDumpFile) isoSetFormat(blockDumpFile, blockofs, blocksize, blocks); if (blockDumpFile) isoSetFormat(blockDumpFile, blockofs, blocksize, blocks);
} }
else else

View File

@ -30,79 +30,21 @@
#include "CDVDisoReader.h" #include "CDVDisoReader.h"
char isoFileName[g_MaxPath]; char isoFileName[g_MaxPath];
u8 *pbuffer; u8 *pbuffer;
int cdtype; static int psize, cdtype;
static int psize;
isoFile *iso;
FILE *cdvdLog = NULL;
u8 cdbuffer[2352] = {0}; u8 cdbuffer[2352] = {0};
isoFile *iso;
s32 msf_to_lba(u8 m, u8 s, u8 f)
{
u32 lsn;
lsn = f;
lsn += (s - 2) * 75;
lsn += m * 75 * 60;
return lsn;
}
void lba_to_msf(s32 lba, u8* m, u8* s, u8* f)
{
lba += 150;
*m = lba / (60 * 75);
*s = (lba / 75) % 60;
*f = lba % 75;
}
//#define btoi(b) ((b)/16*10 + (b)%16) /* BCD to u_char */
//#define itob(i) ((i)/10*16 + (i)%10) /* u_char to BCD */
/*#ifdef PCSX2_DEBUG
void __Log(char *fmt, ...)
{
va_list list;
if (cdvdLog == NULL) return;
va_start(list, fmt);
vfprintf(cdvdLog, fmt, list);
va_end(list);
}
#else
#define __Log 0&&
#endif*/
s32 CALLBACK ISOinit() s32 CALLBACK ISOinit()
{ {
/*#ifdef PCSX2_DEBUG CDVD_LOG("ISOinit\n");
cdvdLog = fopen("logs/cdvdLog.txt", "w");
if (cdvdLog == NULL)
{
cdvdLog = fopen("cdvdLog.txt", "w");
if (cdvdLog == NULL)
{
Console::Error("Can't create cdvdLog.txt");
return -1;
}
}
setvbuf(cdvdLog, NULL, _IONBF, 0);*/
CDVD_LOG("CDVDinit\n");
/*#endif*/
return 0; return 0;
} }
void CALLBACK ISOshutdown() void CALLBACK ISOshutdown()
{ {
/*#ifdef CDVD_LOG CDVD_LOG("ISOshutdown\n");
if (cdvdLog != NULL) fclose(cdvdLog);
#endif*/
} }
s32 CALLBACK ISOopen(const char* pTitle) s32 CALLBACK ISOopen(const char* pTitle)
@ -246,7 +188,7 @@ s32 CALLBACK ISOgetTOC(void* toc)
u8 type = ISOgetDiskType(); u8 type = ISOgetDiskType();
u8* tocBuff = (u8*)toc; u8* tocBuff = (u8*)toc;
//__Log("CDVDgetTOC\n"); //CDVD_LOG("CDVDgetTOC\n");
if (type == CDVD_TYPE_DVDV || type == CDVD_TYPE_PS2DVD) if (type == CDVD_TYPE_DVDV || type == CDVD_TYPE_PS2DVD)
{ {

View File

@ -29,19 +29,6 @@
#include "IsoFStools.h" #include "IsoFStools.h"
#include "IsoFileFormats.h" #include "IsoFileFormats.h"
//#define CDVD_LOG __Log
//#ifndef MAX_PATH
//#define MAX_PATH 255
//#endif
//extern FILE *cdvdLog;
//void __Log(char *fmt, ...);
//#define itob(i) ((i)/10*16 + (i)%10) /* u_char to BCD */
//#define btoi(b) ((b)/16*10 + (b)%16) /* BCD to u_char */
extern char isoFileName[g_MaxPath]; extern char isoFileName[g_MaxPath];
extern isoFile *iso; extern isoFile *iso;

View File

@ -118,30 +118,13 @@ static __forceinline void SetResultSize(u8 size) {
cdr.ResultReady = 1; cdr.ResultReady = 1;
} }
static __forceinline s32 MSFtoLSN(u8 *Time) {
u32 lsn;
lsn = Time[2];
lsn+=(Time[1] - 2) * 75;
lsn+= Time[0] * 75 * 60;
return lsn;
}
static __forceinline void LSNtoMSF(u8 *Time, s32 lsn) {
lsn += 150;
Time[2] = lsn / 4500; // minuten
lsn = lsn - Time[2] * 4500; // minuten rest
Time[1] = lsn / 75; // sekunden
Time[0] = lsn - Time[1] * 75; // sekunden rest
}
static void ReadTrack() { static void ReadTrack() {
cdr.Prev[0] = itob(cdr.SetSector[0]); cdr.Prev[0] = itob(cdr.SetSector[0]);
cdr.Prev[1] = itob(cdr.SetSector[1]); cdr.Prev[1] = itob(cdr.SetSector[1]);
cdr.Prev[2] = itob(cdr.SetSector[2]); cdr.Prev[2] = itob(cdr.SetSector[2]);
CDR_LOG("KEY *** %x:%x:%x", cdr.Prev[0], cdr.Prev[1], cdr.Prev[2]); CDR_LOG("KEY *** %x:%x:%x", cdr.Prev[0], cdr.Prev[1], cdr.Prev[2]);
cdr.RErr = DoCDVDreadTrack(MSFtoLSN(cdr.SetSector), CDVD_MODE_2340); cdr.RErr = DoCDVDreadTrack(msf_to_lsn(cdr.SetSector), CDVD_MODE_2340);
} }
// cdr.Stat: // cdr.Stat:
@ -351,7 +334,7 @@ void cdrInterrupt() {
cdr.Stat = DiskError; cdr.Stat = DiskError;
cdr.Result[0]|= 0x01; cdr.Result[0]|= 0x01;
} else { } else {
LSNtoMSF(cdr.ResultTD, trackInfo.lsn); lsn_to_msf(cdr.ResultTD, trackInfo.lsn);
cdr.Stat = Acknowledge; cdr.Stat = Acknowledge;
cdr.Result[0] = cdr.StatP; cdr.Result[0] = cdr.StatP;
cdr.Result[1] = itob(cdr.ResultTD[0]); cdr.Result[1] = itob(cdr.ResultTD[0]);
@ -397,11 +380,14 @@ void cdrInterrupt() {
SetResultSize(4); SetResultSize(4);
*(int*)cdr.Result = *(int*)Test20; *(int*)cdr.Result = *(int*)Test20;
break; break;
case 0x22: case 0x22:
SetResultSize(8); SetResultSize(8);
*(int*)cdr.Result = *(int*)Test22; *(int*)cdr.Result = *(int*)Test22;
break; break;
case 0x23: case 0x24:
case 0x23:
case 0x24:
SetResultSize(8); SetResultSize(8);
*(int*)cdr.Result = *(int*)Test23; *(int*)cdr.Result = *(int*)Test23;
break; break;
@ -456,8 +442,7 @@ void cdrInterrupt() {
break; break;
case READ_ACK: case READ_ACK:
if (!cdr.Reading) if (!cdr.Reading) return;
return;
SetResultSize(1); SetResultSize(1);
cdr.StatP|= 0x2; cdr.StatP|= 0x2;

View File

@ -27,7 +27,7 @@
#include "IsoFSdrv.h" #include "IsoFSdrv.h"
struct fdtable{ struct fdtable{
//int fd; // int fd;
int fileSize; int fileSize;
int LBA; int LBA;
int filePos; int filePos;
@ -68,8 +68,7 @@ int IsoFS_open(const char *name, int mode){
static struct TocEntry tocEntry; static struct TocEntry tocEntry;
// check if the file exists // check if the file exists
if (IsoFS_findFile(name, &tocEntry) != TRUE) if (IsoFS_findFile(name, &tocEntry) != TRUE) return -1;
return -1;
if(mode != 1) return -2; //SCE_RDONLY if(mode != 1) return -2; //SCE_RDONLY
@ -117,11 +116,12 @@ int IsoFS_lseek(int fd, int offset, int whence){
return -1; return -1;
} }
if (fd_table[fd].filePos < 0) if (fd_table[fd].filePos < 0) fd_table[fd].filePos = 0;
fd_table[fd].filePos = 0;
if (fd_table[fd].filePos > fd_table[fd].fileSize) if (fd_table[fd].filePos > fd_table[fd].fileSize)
{
fd_table[fd].filePos = fd_table[fd].fileSize; fd_table[fd].filePos = fd_table[fd].fileSize;
}
return fd_table[fd].filePos; return fd_table[fd].filePos;
} }
@ -152,7 +152,9 @@ int IsoFS_read( int fd, char *buffer, int size )
} }
if ((fd_table[fd].filePos + size) > fd_table[fd].fileSize) if ((fd_table[fd].filePos + size) > fd_table[fd].fileSize)
{
size = fd_table[fd].fileSize - fd_table[fd].filePos; size = fd_table[fd].fileSize - fd_table[fd].filePos;
}
// Now work out where we want to start reading from // Now work out where we want to start reading from
asector = ssector = fd_table[fd].LBA + (fd_table[fd].filePos >> 11); asector = ssector = fd_table[fd].LBA + (fd_table[fd].filePos >> 11);
@ -179,7 +181,7 @@ int IsoFS_read( int fd, char *buffer, int size )
} }
memcpy_fast(buffer, lb + off_sector, ssize); memcpy_fast(buffer, lb + off_sector, ssize);
} }
if (asize) if (IsoFS_readSectors(asector, asize >> 11, buffer+ssize) != TRUE) if (asize && (IsoFS_readSectors(asector, asize >> 11, buffer+ssize) != TRUE))
{ {
ISOFS_LOG("[IsoFSdrv:read] Couldn't Read from file for some reason"); ISOFS_LOG("[IsoFSdrv:read] Couldn't Read from file for some reason");
return 0; return 0;
@ -228,6 +230,7 @@ int IsoFS_close( int fd)
ISOFS_LOG("[IsoFSdrv:close] ERROR: File does not appear to be open!"); ISOFS_LOG("[IsoFSdrv:close] ERROR: File does not appear to be open!");
return -1; return -1;
} }
ISOFS_LOG("[IsoFSdrv:close] internal fd %d", fd); ISOFS_LOG("[IsoFSdrv:close] internal fd %d", fd);
fd_used[fd] = 0; fd_used[fd] = 0;
files_open--; files_open--;

View File

@ -113,10 +113,10 @@ void TocEntryCopy(TocEntry* tocEntry, const dirTocEntry* internalTocEntry){
filenamelen = internalTocEntry->filenameLength/2; filenamelen = internalTocEntry->filenameLength/2;
if (!(tocEntry->fileProperties & 0x02)){ // if (!(tocEntry->fileProperties & 0x02)){
// strip the ;1 from the filename // strip the ;1 from the filename
// filenamelen -= 2;//(Florin) nah, do not strip ;1 // filenamelen -= 2;//(Florin) nah, do not strip ;1
} // }
for (i=0; i < filenamelen; i++) for (i=0; i < filenamelen; i++)
tocEntry->filename[i] = internalTocEntry->filename[(i<<1)+1]; tocEntry->filename[i] = internalTocEntry->filename[(i<<1)+1];
@ -126,10 +126,10 @@ void TocEntryCopy(TocEntry* tocEntry, const dirTocEntry* internalTocEntry){
else{ else{
filenamelen = internalTocEntry->filenameLength; filenamelen = internalTocEntry->filenameLength;
if (!(tocEntry->fileProperties & 0x02)){ // if (!(tocEntry->fileProperties & 0x02)){
// strip the ;1 from the filename // strip the ;1 from the filename
// filenamelen -= 2;//(Florin) nah, do not strip ;1 // filenamelen -= 2;//(Florin) nah, do not strip ;1
} // }
// use normal string copy // use normal string copy
strncpy(tocEntry->filename,internalTocEntry->filename,128); strncpy(tocEntry->filename,internalTocEntry->filename,128);
@ -140,9 +140,7 @@ void TocEntryCopy(TocEntry* tocEntry, const dirTocEntry* internalTocEntry){
// Check if a TOC Entry matches our extension list // Check if a TOC Entry matches our extension list
int TocEntryCompare(char* filename, char* extensions){ int TocEntryCompare(char* filename, char* extensions){
static char ext_list[129]; static char ext_list[129];
char* token; char* token;
char* ext_point; char* ext_point;
strncpy(ext_list,extensions,128); strncpy(ext_list,extensions,128);
@ -167,15 +165,9 @@ int TocEntryCompare(char* filename, char* extensions){
} }
#define CD_SECS 60 /* seconds per minute */
#define CD_FRAMES 75 /* frames per second */
#define CD_MSF_OFFSET 150 /* MSF numbering offset of first frame */
int IsoFS_readSectors(u32 lsn, u32 sectors, void *buf) int IsoFS_readSectors(u32 lsn, u32 sectors, void *buf)
{ {
u32 i; for (u32 i=0; i<sectors; i++)
for (i=0; i<sectors; i++)
{ {
if (DoCDVDreadSector((u8*)((uptr)buf+2048*i), lsn+i, CDVD_MODE_2048) == -1) return 0; if (DoCDVDreadSector((u8*)((uptr)buf+2048*i), lsn+i, CDVD_MODE_2048) == -1) return 0;
} }
@ -191,8 +183,7 @@ int IsoFS_readSectors(u32 lsn, u32 sectors, void *buf)
int IsoFS_getVolumeDescriptor(void) int IsoFS_getVolumeDescriptor(void)
{ {
// Read until we find the last valid Volume Descriptor // Read until we find the last valid Volume Descriptor
int volDescSector; s32 volDescSector;
cdVolDesc localVolDesc; cdVolDesc localVolDesc;
DbgCon::WriteLn("IsoFS_GetVolumeDescriptor called"); DbgCon::WriteLn("IsoFS_GetVolumeDescriptor called");
@ -219,7 +210,8 @@ int IsoFS_getVolumeDescriptor(void)
DbgCon::WriteLn( Color_Green, "CD FileSystem is ISO9660" ); DbgCon::WriteLn( Color_Green, "CD FileSystem is ISO9660" );
else if (CDVolDesc.filesystemType == 2) else if (CDVolDesc.filesystemType == 2)
DbgCon::WriteLn( Color_Green, "CD FileSystem is Joliet"); DbgCon::WriteLn( Color_Green, "CD FileSystem is Joliet");
else DbgCon::Notice("Could not detect CD FileSystem type"); else
DbgCon::Notice("Could not detect CD FileSystem type");
// CdStop(); // CdStop();
@ -227,21 +219,11 @@ int IsoFS_getVolumeDescriptor(void)
} }
int IsoFS_findFile(const char* fname, TocEntry* tocEntry){ int IsoFS_findFile(const char* fname, TocEntry* tocEntry){
char filename[g_MaxPath+1]; char filename[g_MaxPath+1], pathname[JolietMaxPath+1], toc[2048];
char pathname[JolietMaxPath+1];
char toc[2048];
char* dirname; char* dirname;
s32 found_dir, num_dir_sectors, current_sector, dir_lba;
TocEntry localTocEntry; // used for internal checking only
int found_dir;
int num_dir_sectors;
int current_sector;
int dir_lba;
dirTocEntry* tocEntryPointer; dirTocEntry* tocEntryPointer;
TocEntry localTocEntry; // used for internal checking only
DbgCon::WriteLn("IsoFS_findfile(\"%s\") called", params fname); DbgCon::WriteLn("IsoFS_findfile(\"%s\") called", params fname);
@ -439,15 +421,12 @@ int IsoFS_findFile(const char* fname, TocEntry* tocEntry){
// This is the RPC-ready function which takes the request to start the tocEntry retrieval // This is the RPC-ready function which takes the request to start the tocEntry retrieval
int IsoFS_initDirectoryList(char* pathname, char* extensions, unsigned int inc_dirs){ int IsoFS_initDirectoryList(char* pathname, char* extensions, unsigned int inc_dirs){
// int dir_depth = 1;
char toc[2048]; char toc[2048];
char* dirname; char* dirname;
int found_dir; s32 found_dir, num_dir_sectors, current_sector;
int num_dir_sectors; u32 toc_entry_num;
unsigned int toc_entry_num;
dirTocEntry* tocEntryPointer; dirTocEntry* tocEntryPointer;
TocEntry localTocEntry; TocEntry localTocEntry;
int current_sector;
// store the extension list statically for the retrieve function // store the extension list statically for the retrieve function
strncpy(getDirTocData.extension_list, extensions, 128); strncpy(getDirTocData.extension_list, extensions, 128);
@ -540,8 +519,7 @@ int IsoFS_initDirectoryList(char* pathname, char* extensions, unsigned int inc_d
} }
// If we havent found the directory name we wanted then fail // If we havent found the directory name we wanted then fail
if (found_dir != TRUE) if (found_dir != TRUE) return -1;
return -1;
// Get next directory name // Get next directory name
dirname = strtok( NULL, "\\/" ); dirname = strtok( NULL, "\\/" );
@ -660,8 +638,7 @@ int IsoFS_initDirectoryList(char* pathname, char* extensions, unsigned int inc_d
// buffer (tocEntry) must be 18KB in size, and this will be filled with a maximum of 128 entries in one go // buffer (tocEntry) must be 18KB in size, and this will be filled with a maximum of 128 entries in one go
int IsoFS_getDirectories(TocEntry tocEntry[], int req_entries){ int IsoFS_getDirectories(TocEntry tocEntry[], int req_entries){
char toc[2048]; char toc[2048];
int toc_entry_num; s32 toc_entry_num;
dirTocEntry* tocEntryPointer; dirTocEntry* tocEntryPointer;
if (IsoFS_readSectors(getDirTocData.current_sector,1,toc) != TRUE){ if (IsoFS_readSectors(getDirTocData.current_sector,1,toc) != TRUE){
@ -682,8 +659,7 @@ int IsoFS_getDirectories(TocEntry tocEntry[], int req_entries){
tocEntryPointer = (dirTocEntry*)(toc + getDirTocData.current_sector_offset); tocEntryPointer = (dirTocEntry*)(toc + getDirTocData.current_sector_offset);
} }
if (req_entries > 128) if (req_entries > 128) req_entries = 128;
req_entries = 128;
for (toc_entry_num=0; toc_entry_num < req_entries;) for (toc_entry_num=0; toc_entry_num < req_entries;)
{ {

View File

@ -28,6 +28,10 @@
int IsoFS_initDirectoryList(char* pathname, char* extensions, unsigned int inc_dirs); int IsoFS_initDirectoryList(char* pathname, char* extensions, unsigned int inc_dirs);
int IsoFS_getDirectories(TocEntry tocEntry[], int req_entries); int IsoFS_getDirectories(TocEntry tocEntry[], int req_entries);
#define CD_SECS 60 /* seconds per minute */
#define CD_FRAMES 75 /* frames per second */
#define CD_MSF_OFFSET 150 /* MSF numbering offset of first frame */
#if defined(_MSC_VER) #if defined(_MSC_VER)
#pragma pack(1) #pragma pack(1)
#pragma warning(disable:4996) //ignore the stricmp deprecated warning #pragma warning(disable:4996) //ignore the stricmp deprecated warning

View File

@ -26,135 +26,6 @@
#include <fcntl.h> #include <fcntl.h>
#include <errno.h> #include <errno.h>
#ifdef _WIN32
#include <windows.h>
void *_openfile(const char *filename, int flags)
{
HANDLE handle;
wxString fn( wxString::FromAscii( filename ) );
// Console::WriteLn("_openfile %s, %d", params filename, flags & O_RDONLY);
if (flags & O_WRONLY)
{
int _flags = CREATE_NEW;
if (flags & O_CREAT) _flags = CREATE_ALWAYS;
handle = CreateFile(fn.c_str(), GENERIC_WRITE, 0, NULL, _flags, 0, NULL);
}
else
{
handle = CreateFile(fn.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);
}
return handle == INVALID_HANDLE_VALUE ? NULL : handle;
}
u64 _tellfile(void *handle)
{
u64 ofs;
PLONG _ofs = (LONG*) & ofs;
_ofs[1] = 0;
_ofs[0] = SetFilePointer(handle, 0, &_ofs[1], FILE_CURRENT);
return ofs;
}
int _seekfile(void *handle, u64 offset, int whence)
{
u64 ofs = (u64)offset;
PLONG _ofs = (LONG*) & ofs;
// Console::WriteLn("_seekfile %p, %d_%d", params handle, _ofs[1], _ofs[0]);
if (whence == SEEK_SET)
{
SetFilePointer(handle, _ofs[0], &_ofs[1], FILE_BEGIN);
}
else
{
SetFilePointer(handle, _ofs[0], &_ofs[1], FILE_END);
}
return 0;
}
int _readfile(void *handle, void *dst, int size)
{
DWORD ret;
// Console::WriteLn("_readfile %p %d", params handle, size);
ReadFile(handle, dst, size, &ret, NULL);
// Console::WriteLn("_readfile ret %d; %d", params ret, GetLastError());
return ret;
}
int _writefile(void *handle, void *src, int size)
{
DWORD ret;
// Console::WriteLn("_writefile %p, %d", params handle, size);
// _seekfile(handle, _tellfile(handle));
WriteFile(handle, src, size, &ret, NULL);
// Console::WriteLn("_writefile ret %d", params ret);
return ret;
}
void _closefile(void *handle)
{
CloseHandle(handle);
}
#else
void *_openfile(const char *filename, int flags)
{
// Console::WriteLn("_openfile %s %x", params filename, flags);
if (flags & O_WRONLY)
return fopen64(filename, "wb");
else
return fopen64(filename, "rb");
}
u64 _tellfile(void *handle)
{
s64 cursize = ftell(handle);
if (cursize == -1)
{
// try 64bit
cursize = ftello64(handle);
if (cursize < -1)
{
// zero top 32 bits
cursize &= 0xffffffff;
}
}
return cursize;
}
int _seekfile(void *handle, u64 offset, int whence)
{
int seekerr = fseeko64(handle, offset, whence);
if (seekerr == -1) Console::Error("Failed to seek.");
return seekerr;
}
int _readfile(void *handle, void *dst, int size)
{
return fread(dst, 1, size, handle);
}
int _writefile(void *handle, void *src, int size)
{
return fwrite(src, 1, size, handle);
}
void _closefile(void *handle)
{
fclose(handle);
}
#endif
int detect(isoFile *iso) int detect(isoFile *iso)
{ {
u8 buf[2448]; u8 buf[2448];
@ -256,7 +127,7 @@ isoFile *isoOpen(const char *filename)
memset(iso, 0, sizeof(isoFile)); memset(iso, 0, sizeof(isoFile));
strcpy(iso->filename, filename); strcpy(iso->filename, filename);
iso->handle = _openfile(iso->filename, O_RDONLY); iso->handle = _openfile( iso->filename, O_RDONLY);
if (iso->handle == NULL) if (iso->handle == NULL)
{ {
Console::Error("error loading %s", params iso->filename); Console::Error("error loading %s", params iso->filename);
@ -334,10 +205,7 @@ isoFile *isoCreate(const char *filename, int flags)
sprintf(Zfile, "%s.table", iso->filename); sprintf(Zfile, "%s.table", iso->filename);
iso->htable = _openfile(Zfile, O_WRONLY); iso->htable = _openfile(Zfile, O_WRONLY);
if (iso->htable == NULL) if (iso->htable == NULL) return NULL;
{
return NULL;
}
} }
iso->handle = _openfile(iso->filename, O_WRONLY | O_CREAT); iso->handle = _openfile(iso->filename, O_WRONLY | O_CREAT);
@ -490,7 +358,7 @@ int isoReadBlock(isoFile *iso, u8 *dst, int lsn)
else else
ret = _isoReadBlock(iso, dst, lsn); ret = _isoReadBlock(iso, dst, lsn);
if (ret == -1) return ret; if (ret == -1) return -1;
if (iso->type == ISOTYPE_CD) if (iso->type == ISOTYPE_CD)
{ {
@ -540,7 +408,7 @@ int isoWriteBlock(isoFile *iso, u8 *src, int lsn)
else else
ret = _isoWriteBlock(iso, src, lsn); ret = _isoWriteBlock(iso, src, lsn);
if (ret == -1) return ret; if (ret == -1) return -1;
return 0; return 0;
} }

View File

@ -19,26 +19,8 @@
#ifndef __LIBISO_H__ #ifndef __LIBISO_H__
#define __LIBISO_H__ #define __LIBISO_H__
#ifndef __USE_LARGEFILE64
#define __USE_LARGEFILE64
#endif
#ifndef _LARGEFILE64_SOURCE
#define _LARGEFILE_SOURCE
#endif
#ifndef _LARGEFILE64_SOURCE
#define _LARGEFILE64_SOURCE
#endif
#define __USE_FILE_OFFSET64
#define _FILE_OFFSET_BITS 64
#ifdef _MSC_VER
#pragma warning(disable:4018)
#endif
#include "CDVD.h" #include "CDVD.h"
#include "IsoFileTools.h"
enum isoType enum isoType
{ {
@ -99,11 +81,4 @@ int isoReadBlock(isoFile *iso, u8 *dst, int lsn);
int isoWriteBlock(isoFile *iso, u8 *src, int lsn); int isoWriteBlock(isoFile *iso, u8 *src, int lsn);
void isoClose(isoFile *iso); void isoClose(isoFile *iso);
void *_openfile(const char *filename, int flags);
u64 _tellfile(void *handle);
int _seekfile(void *handle, u64 offset, int whence);
int _readfile(void *handle, void *dst, int size);
int _writefile(void *handle, void *src, int size);
void _closefile(void *handle);
#endif /* __LIBISO_H__ */ #endif /* __LIBISO_H__ */

142
pcsx2/CDVD/IsoFileTools.cpp Normal file
View File

@ -0,0 +1,142 @@
/* Pcsx2 - Pc Ps2 Emulator
* Copyright (C) 2002-2009 Pcsx2 Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "PrecompiledHeader.h"
#include "IsoFileTools.h"
#ifdef _WIN32
#include <windows.h>
void *_openfile(const char *filename, int flags)
{
HANDLE handle;
// Console::WriteLn("_openfile %s, %d", params filename, flags & O_RDONLY);
if (flags & O_WRONLY)
{
int _flags = CREATE_NEW;
if (flags & O_CREAT) _flags = CREATE_ALWAYS;
handle = CreateFile(wxString::FromAscii(filename).c_str(), GENERIC_WRITE, 0, NULL, _flags, 0, NULL);
}
else
{
handle = CreateFile(wxString::FromAscii(filename).c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);
}
return handle == INVALID_HANDLE_VALUE ? NULL : handle;
}
u64 _tellfile(void *handle)
{
u64 ofs;
PLONG _ofs = (LONG*) & ofs;
_ofs[1] = 0;
_ofs[0] = SetFilePointer(handle, 0, &_ofs[1], FILE_CURRENT);
return ofs;
}
int _seekfile(void *handle, u64 offset, int whence)
{
u64 ofs = (u64)offset;
PLONG _ofs = (LONG*) & ofs;
// Console::WriteLn("_seekfile %p, %d_%d", params handle, _ofs[1], _ofs[0]);
SetFilePointer(handle, _ofs[0], &_ofs[1], (whence == SEEK_SET) ? FILE_BEGIN : FILE_END);
return 0;
}
int _readfile(void *handle, void *dst, int size)
{
DWORD ret;
ReadFile(handle, dst, size, &ret, NULL);
// Console::WriteLn("_readfile(%p, %d) = %d; %d", params handle, size, ret, GetLastError());
return ret;
}
int _writefile(void *handle, void *src, int size)
{
DWORD ret;
// _seekfile(handle, _tellfile(handle));
WriteFile(handle, src, size, &ret, NULL);
// Console::WriteLn("_readfile(%p, %d) = %d", params handle, size, ret);
return ret;
}
void _closefile(void *handle)
{
CloseHandle(handle);
}
#else
void *_openfile(const char *filename, int flags)
{
// Console::WriteLn("_openfile %s %x", params filename, flags);
if (flags & O_WRONLY)
return fopen64(filename, "wb");
else
return fopen64(filename, "rb");
}
u64 _tellfile(void *handle)
{
s64 cursize = ftell(handle);
if (cursize == -1)
{
// try 64bit
cursize = ftello64(handle);
if (cursize < -1)
{
// zero top 32 bits
cursize &= 0xffffffff;
}
}
return cursize;
}
int _seekfile(void *handle, u64 offset, int whence)
{
int seekerr = fseeko64(handle, offset, whence);
if (seekerr == -1) Console::Error("Failed to seek.");
return seekerr;
}
int _readfile(void *handle, void *dst, int size)
{
return fread(dst, 1, size, handle);
}
int _writefile(void *handle, void *src, int size)
{
return fwrite(src, 1, size, handle);
}
void _closefile(void *handle)
{
fclose(handle);
}
#endif

50
pcsx2/CDVD/IsoFileTools.h Normal file
View File

@ -0,0 +1,50 @@
/* Pcsx2 - Pc Ps2 Emulator
* Copyright (C) 2002-2009 Pcsx2 Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __ISO_FILE_TOOLS_H__
#define __ISO_FILE_TOOLS_H__
#ifndef _LARGEFILE_SOURCE
#define _LARGEFILE_SOURCE
#endif
#ifndef _LARGEFILE64_SOURCE
#define _LARGEFILE64_SOURCE
#endif
#define __USE_FILE_OFFSET64
#define _FILE_OFFSET_BITS 64
#ifdef _MSC_VER
#pragma warning(disable:4018)
#endif
#include "IopCommon.h"
#include <stdio.h>
#include <fcntl.h>
#include <errno.h>
void *_openfile(const char *filename, int flags);
u64 _tellfile(void *handle);
int _seekfile(void *handle, u64 offset, int whence);
int _readfile(void *handle, void *dst, int size);
int _writefile(void *handle, void *src, int size);
void _closefile(void *handle);
#endif

View File

@ -1,11 +1,29 @@
/* Pcsx2 - Pc Ps2 Emulator
* Copyright (C) 2002-2009 Pcsx2 Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef _PCSX2_PATHS_H_ #ifndef _PCSX2_PATHS_H_
#define _PCSX2_PATHS_H_ #define _PCSX2_PATHS_H_
#define g_MaxPath 255 // 255 is safer with antiquated Win32 ASCII APIs. #define g_MaxPath 255 // 255 is safer with antiquated Win32 ASCII APIs.
#ifdef __LINUX__ //#ifdef __LINUX__
extern char MAIN_DIR[g_MaxPath]; //extern char MAIN_DIR[g_MaxPath];
#endif //#endif
// Windows.h namespace pollution! // Windows.h namespace pollution!
#undef CreateDirectory #undef CreateDirectory
@ -133,7 +151,8 @@ namespace Path
extern void CreateDirectory( const wxString& src ); extern void CreateDirectory( const wxString& src );
extern void RemoveDirectory( const wxString& src ); extern void RemoveDirectory( const wxString& src );
} }
extern std::string GetWorkingDirectory(void);
extern void ChangeDirectory(const std::string& src);
enum FoldersEnum_t enum FoldersEnum_t
{ {
FolderId_Plugins = 0, FolderId_Plugins = 0,

View File

@ -19,16 +19,88 @@
#include "PrecompiledHeader.h" #include "PrecompiledHeader.h"
#include "Utilities/RedtapeWindows.h" #include "Utilities/RedtapeWindows.h"
#include <wx/dynlib.h>
#include <wx/dir.h>
#include <wx/file.h>
#include "IopCommon.h" #include "IopCommon.h"
#include "GS.h" #include "GS.h"
#include "HostGui.h" #include "HostGui.h"
#include "CDVD/CDVDisoReader.h" #include "CDVD/CDVDisoReader.h"
_GSinit GSinit; // ----------------------------------------------------------------------------
_GSopen GSopen; // Yay, order of this array shouldn't be important. :)
_GSclose GSclose; //
_GSshutdown GSshutdown; const PluginInfo tbl_PluginInfo[] =
{
{ "GS", PluginId_GS, PS2E_LT_GS, PS2E_GS_VERSION },
{ "PAD", PluginId_PAD, PS2E_LT_PAD, PS2E_PAD_VERSION },
{ "SPU2", PluginId_SPU2, PS2E_LT_SPU2, PS2E_SPU2_VERSION },
{ "CDVD", PluginId_CDVD, PS2E_LT_CDVD, PS2E_CDVD_VERSION },
{ "DEV9", PluginId_DEV9, PS2E_LT_DEV9, PS2E_DEV9_VERSION },
{ "USB", PluginId_USB, PS2E_LT_USB, PS2E_USB_VERSION },
{ "FW", PluginId_FW, PS2E_LT_FW, PS2E_FW_VERSION },
// SIO is currently unused (legacy?)
//{ "SIO", PluginId_SIO, PS2E_LT_SIO, PS2E_SIO_VERSION }
};
typedef void CALLBACK VoidMethod();
; // extra semicolon fixes VA-X intellisense breakage caused by CALLBACK in the above typedef >_<
// ----------------------------------------------------------------------------
struct LegacyApi_CommonMethod
{
const char* MethodName;
// fallback is used if the method is null. If the method is null and fallback is null
// also, the plugin is considered incomplete or invalid, and an error is generated.
VoidMethod* Fallback;
// returns the method name as a wxString, converted from UTF8.
wxString& GetMethodName( PluginsEnum_t pid ) const
{
return wxString::FromUTF8( tbl_PluginInfo[pid].shortname) + wxString::FromUTF8( MethodName );
}
};
// ----------------------------------------------------------------------------
struct LegacyApi_ReqMethod
{
const char* MethodName;
VoidMethod** Dest; // Target function where the binding is saved.
// fallback is used if the method is null. If the method is null and fallback is null
// also, the plugin is considered incomplete or invalid, and an error is generated.
VoidMethod* Fallback;
// returns the method name as a wxString, converted from UTF8.
wxString& GetMethodName( ) const
{
return wxString::FromUTF8( MethodName );
}
};
// ----------------------------------------------------------------------------
struct LegacyApi_OptMethod
{
const char* MethodName;
VoidMethod** Dest; // Target function where the binding is saved.
// returns the method name as a wxString, converted from UTF8.
wxString& GetMethodName() const { return wxString::FromUTF8( MethodName ); }
};
static s32 CALLBACK fallback_freeze(int mode, freezeData *data) { data->size = 0; return 0; }
static void CALLBACK fallback_keyEvent(keyEvent *ev) {}
static void CALLBACK fallback_configure() {}
static void CALLBACK fallback_about() {}
static s32 CALLBACK fallback_test() { return 0; }
_GSvsync GSvsync; _GSvsync GSvsync;
_GSopen GSopen;
_GSgifTransfer1 GSgifTransfer1; _GSgifTransfer1 GSgifTransfer1;
_GSgifTransfer2 GSgifTransfer2; _GSgifTransfer2 GSgifTransfer2;
_GSgifTransfer3 GSgifTransfer3; _GSgifTransfer3 GSgifTransfer3;
@ -36,8 +108,6 @@ _GSgetLastTag GSgetLastTag;
_GSgifSoftReset GSgifSoftReset; _GSgifSoftReset GSgifSoftReset;
_GSreadFIFO GSreadFIFO; _GSreadFIFO GSreadFIFO;
_GSreadFIFO2 GSreadFIFO2; _GSreadFIFO2 GSreadFIFO2;
_GSkeyEvent GSkeyEvent;
_GSchangeSaveState GSchangeSaveState; _GSchangeSaveState GSchangeSaveState;
_GSmakeSnapshot GSmakeSnapshot; _GSmakeSnapshot GSmakeSnapshot;
_GSmakeSnapshot2 GSmakeSnapshot2; _GSmakeSnapshot2 GSmakeSnapshot2;
@ -47,57 +117,41 @@ _GSsetBaseMem GSsetBaseMem;
_GSsetGameCRC GSsetGameCRC; _GSsetGameCRC GSsetGameCRC;
_GSsetFrameSkip GSsetFrameSkip; _GSsetFrameSkip GSsetFrameSkip;
_GSsetFrameLimit GSsetFrameLimit; _GSsetFrameLimit GSsetFrameLimit;
_GSsetupRecording GSsetupRecording; _GSsetupRecording GSsetupRecording;
_GSreset GSreset; _GSreset GSreset;
_GSwriteCSR GSwriteCSR; _GSwriteCSR GSwriteCSR;
_GSgetDriverInfo GSgetDriverInfo; _GSgetDriverInfo GSgetDriverInfo;
#ifdef _WINDOWS_ #ifdef _WINDOWS_
_GSsetWindowInfo GSsetWindowInfo; _GSsetWindowInfo GSsetWindowInfo;
#endif #endif
_GSfreeze GSfreeze;
_GSconfigure GSconfigure;
_GStest GStest;
_GSabout GSabout;
// PAD1 static void CALLBACK GS_makeSnapshot(const char *path) {}
_PADinit PAD1init; static void CALLBACK GS_irqCallback(void (*callback)()) {}
_PADopen PAD1open; static void CALLBACK GS_printf(int timeout, char *fmt, ...)
_PADclose PAD1close; {
_PADshutdown PAD1shutdown; va_list list;
_PADkeyEvent PAD1keyEvent; char msg[512];
_PADstartPoll PAD1startPoll;
_PADpoll PAD1poll;
_PADquery PAD1query;
_PADupdate PAD1update;
_PADgsDriverInfo PAD1gsDriverInfo; va_start(list, fmt);
_PADconfigure PAD1configure; vsprintf(msg, fmt, list);
_PADtest PAD1test; va_end(list);
_PADabout PAD1about;
_PADfreeze PAD1freeze;
_PADsetSlot PAD1setSlot;
_PADqueryMtap PAD1queryMtap;
// PAD2 Console::WriteLn(msg);
_PADinit PAD2init; }
_PADopen PAD2open;
_PADclose PAD2close;
_PADshutdown PAD2shutdown;
_PADkeyEvent PAD2keyEvent;
_PADstartPoll PAD2startPoll;
_PADpoll PAD2poll;
_PADquery PAD2query;
_PADupdate PAD2update;
_PADgsDriverInfo PAD2gsDriverInfo; // PAD
_PADconfigure PAD2configure; _PADopen PADopen;
_PADtest PAD2test; _PADstartPoll PADstartPoll;
_PADabout PAD2about; _PADpoll PADpoll;
_PADfreeze PAD2freeze; _PADquery PADquery;
_PADsetSlot PAD2setSlot; _PADupdate PADupdate;
_PADqueryMtap PAD2queryMtap; _PADkeyEvent PADkeyEvent;
_PADgsDriverInfo PADgsDriverInfo;
_PADsetSlot PADsetSlot;
_PADqueryMtap PADqueryMtap;
// SIO[2] // SIO[2]
/*
_SIOinit SIOinit[2][9]; _SIOinit SIOinit[2][9];
_SIOopen SIOopen[2][9]; _SIOopen SIOopen[2][9];
_SIOclose SIOclose[2][9]; _SIOclose SIOclose[2][9];
@ -108,13 +162,10 @@ _SIOquery SIOquery[2][9];
_SIOconfigure SIOconfigure[2][9]; _SIOconfigure SIOconfigure[2][9];
_SIOtest SIOtest[2][9]; _SIOtest SIOtest[2][9];
_SIOabout SIOabout[2][9]; _SIOabout SIOabout[2][9];*/
// SPU2 // SPU2
_SPU2init SPU2init;
_SPU2open SPU2open; _SPU2open SPU2open;
_SPU2close SPU2close;
_SPU2shutdown SPU2shutdown;
_SPU2write SPU2write; _SPU2write SPU2write;
_SPU2read SPU2read; _SPU2read SPU2read;
_SPU2readDMA4Mem SPU2readDMA4Mem; _SPU2readDMA4Mem SPU2readDMA4Mem;
@ -130,23 +181,14 @@ _SPU2WriteMemAddr SPU2WriteMemAddr;
_SPU2irqCallback SPU2irqCallback; _SPU2irqCallback SPU2irqCallback;
_SPU2setClockPtr SPU2setClockPtr; _SPU2setClockPtr SPU2setClockPtr;
_SPU2setTimeStretcher SPU2setTimeStretcher;
_SPU2async SPU2async; _SPU2async SPU2async;
_SPU2freeze SPU2freeze;
_SPU2configure SPU2configure;
_SPU2test SPU2test;
_SPU2about SPU2about;
// CDVD // CDVD
CDVDplugin CDVD_plugin = {0}; CDVDplugin CDVD_plugin = {0};
CDVDplugin CDVD = {0}; CDVDplugin CDVD = {0};
// DEV9 // DEV9
_DEV9init DEV9init;
_DEV9open DEV9open; _DEV9open DEV9open;
_DEV9close DEV9close;
_DEV9shutdown DEV9shutdown;
_DEV9read8 DEV9read8; _DEV9read8 DEV9read8;
_DEV9read16 DEV9read16; _DEV9read16 DEV9read16;
_DEV9read32 DEV9read32; _DEV9read32 DEV9read32;
@ -158,16 +200,8 @@ _DEV9writeDMA8Mem DEV9writeDMA8Mem;
_DEV9irqCallback DEV9irqCallback; _DEV9irqCallback DEV9irqCallback;
_DEV9irqHandler DEV9irqHandler; _DEV9irqHandler DEV9irqHandler;
_DEV9configure DEV9configure;
_DEV9freeze DEV9freeze;
_DEV9test DEV9test;
_DEV9about DEV9about;
// USB // USB
_USBinit USBinit; _USBopen USB9open;
_USBopen USBopen;
_USBclose USBclose;
_USBshutdown USBshutdown;
_USBread8 USBread8; _USBread8 USBread8;
_USBread16 USBread16; _USBread16 USBread16;
_USBread32 USBread32; _USBread32 USBread32;
@ -180,33 +214,241 @@ _USBirqCallback USBirqCallback;
_USBirqHandler USBirqHandler; _USBirqHandler USBirqHandler;
_USBsetRAM USBsetRAM; _USBsetRAM USBsetRAM;
_USBconfigure USBconfigure;
_USBfreeze USBfreeze;
_USBtest USBtest;
_USBabout USBabout;
// FW // FW
_FWinit FWinit; _FW9open FW9open;
_FWopen FWopen;
_FWclose FWclose;
_FWshutdown FWshutdown;
_FWread32 FWread32; _FWread32 FWread32;
_FWwrite32 FWwrite32; _FWwrite32 FWwrite32;
_FWirqCallback FWirqCallback; _FWirqCallback FWirqCallback;
_FWconfigure FWconfigure;
_FWfreeze FWfreeze;
_FWtest FWtest;
_FWabout FWabout;
DEV9handler dev9Handler; DEV9handler dev9Handler;
USBhandler usbHandler; USBhandler usbHandler;
uptr pDsp; uptr pDsp;
// ------------------------------------------------------------------------ // ----------------------------------------------------------------------------
int OpenPlugins(const char* pTitleFilename) // Important: Contents of this array must match the order of the contents of the
// LegacyPluginAPI_Common structure defined in Plugins.h.
//
static const LegacyApi_CommonMethod s_MethMessCommon[] =
{ {
return 0; { "init", NULL },
{ "close", NULL },
{ "shutdown", NULL },
{ "freeze", (VoidMethod*)fallback_freeze },
{ "test", (VoidMethod*)fallback_test },
{ "configure", fallback_configure },
{ "about", fallback_about },
{ NULL }
};
// ----------------------------------------------------------------------------
// GS Mess!
// ----------------------------------------------------------------------------
static const LegacyApi_ReqMethod s_MethMessReq_GS[] =
{
{ "GSvsync", (VoidMethod**)&GSinit, NULL },
{ "GSvsync", (VoidMethod**)&GSvsync, NULL },
{ "GSgifTransfer1", (VoidMethod**)&GSgifTransfer1, NULL },
{ "GSgifTransfer2", (VoidMethod**)&GSgifTransfer2, NULL },
{ "GSgifTransfer3", (VoidMethod**)&GSgifTransfer3, NULL },
{ "GSreadFIFO2", (VoidMethod**)&GSreadFIFO2, NULL },
{ "GSmakeSnapshot", (VoidMethod**)&GSmakeSnapshot, (VoidMethod*)GS_makeSnapshot },
{ "GSirqCallback", (VoidMethod**)&GSirqCallback, (VoidMethod*)GS_irqCallback },
{ "GSprintf", (VoidMethod**)&GSprintf, (VoidMethod*)GS_printf },
{ "GSsetBaseMem", (VoidMethod**)&GSsetBaseMem, NULL },
{ "GSwriteCSR", (VoidMethod**)&GSwriteCSR, NULL },
{ NULL }
};
static const LegacyApi_OptMethod s_MethMessOpt_GS[] =
{
{ "GSgetDriverInfo" },
{ "GSreset" },
{ "GSsetupRecording" },
{ "GSsetGameCRC" },
{ "GSsetFrameSkip" },
{ "GSsetFrameLimit" },
{ "GSchangeSaveState" },
{ "GSmakeSnapshot2" },
#ifdef _WINDOWS_
{ "GSsetWindowInfo" },
#endif
{ "GSgetLastTag" },
{ "GSgifSoftReset" },
{ "GSreadFIFO" },
{ NULL }
};
static const LegacyApi_ReqMethod* const s_MethMessReq[] =
{
s_MethMessReq_GS,
};
static const LegacyApi_OptMethod* const s_MethMessOpt[] =
{
s_MethMessOpt_GS
};
//////////////////////////////////////////////////////////////////////////////////////////
//
class PluginManager
{
protected:
bool m_initialized;
bool m_loaded;
LegacyPluginAPI_Common m_CommonBindings[PluginId_Count];
wxDynamicLibrary m_libs[PluginId_Count];
public:
~PluginManager();
PluginManager() :
m_initialized( false )
, m_loaded( false )
{
}
void LoadPlugins();
void UnloadPlugins();
protected:
void BindCommon( PluginsEnum_t pid );
void BindRequired( PluginsEnum_t pid );
void BindOptional( PluginsEnum_t pid );
};
void PluginManager::BindCommon( PluginsEnum_t pid )
{
const LegacyApi_CommonMethod* current = s_MethMessCommon;
int fid = 0; // function id
VoidMethod** target = (VoidMethod**)&m_CommonBindings[pid];
while( current->MethodName != NULL )
{
*target = (VoidMethod*)m_libs[pid].GetSymbol( current->GetMethodName( pid ) );
target++;
current++;
}
}
void PluginManager::BindRequired( PluginsEnum_t pid )
{
const LegacyApi_ReqMethod* current = s_MethMessReq[pid];
const wxDynamicLibrary& lib = m_libs[pid];
while( current->MethodName != NULL )
{
*(current->Dest) = (VoidMethod*)lib.GetSymbol( current->GetMethodName() );
if( *(current->Dest) == NULL )
*(current->Dest) = current->Fallback;
if( *(current->Dest) == NULL )
{
throw Exception::NotPcsxPlugin( pid );
}
current++;
}
}
void PluginManager::BindOptional( PluginsEnum_t pid )
{
const LegacyApi_OptMethod* current = s_MethMessOpt[pid];
const wxDynamicLibrary& lib = m_libs[pid];
while( current->MethodName != NULL )
{
*(current->Dest) = (VoidMethod*)lib.GetSymbol( current->GetMethodName() );
current++;
}
}
// Exceptions:
// FileNotFound - Thrown if one of th configured plugins doesn't exist.
// NotPcsxPlugin - Thrown if one of the configured plugins is an invalid or unsupported DLL
void PluginManager::LoadPlugins()
{
if( m_loaded ) return;
m_loaded = true;
for( int i=0; i<PluginId_Count; ++i )
{
PluginsEnum_t pid = (PluginsEnum_t)i;
wxString plugpath( g_Conf->FullpathTo( pid ) );
if( !wxFile::Exists( plugpath ) )
throw Exception::FileNotFound( plugpath );
if( !m_libs[i].Load( plugpath ) )
throw Exception::NotPcsxPlugin( plugpath );
// Try to enumerate the new v2.0 plugin interface first.
// If that fails, fall back on the old style interface.
//m_libs[i].GetSymbol( L"PS2E_InitAPI" );
// Bind Required Functions
// (generate critical error if binding fails)
BindCommon( pid );
BindRequired( pid );
BindOptional( pid );
// Bind Optional Functions
// (leave pointer null and do not generate error)
}
}
void InitPlugins()
{
/*if (plugins_initialized) return;
// Ensure plugins have been loaded....
LoadPlugins();*/
//if( !plugins_loaded ) throw Exception::InvalidOperation( "Bad coder mojo - InitPlugins called prior to plugins having been loaded." );
/*if (ReportError(GSinit(), "GSinit")) return -1;
if (ReportError(PAD1init(1), "PAD1init")) return -1;
if (ReportError(PAD2init(2), "PAD2init")) return -1;
if (ReportError(SPU2init(), "SPU2init")) return -1;
if (ReportError(DoCDVDinit(), "CDVDinit")) return -1;
if (ReportError(DEV9init(), "DEV9init")) return -1;
if (ReportError(USBinit(), "USBinit")) return -1;
if (ReportError(FWinit(), "FWinit")) return -1;
only_loading_elf = false;
plugins_initialized = true;
return 0;*/
}
// ----------------------------------------------------------------------------
// Opens all plugins and initializes the CDVD plugin to use the given filename. If the filename is null
// then the cdvd plugin uses whatever file it has been configured to use. If plugin have not been
// initialized by an explicit call to InitializePlugins, this method will do so for you.
//
// fixme: the cdvd filename really should be passed to the cdvd plugin as a separate API call. >_<
//
void OpenPlugins(const char* cdvdFilename)
{
/*if (!plugins_initialized)
{
if( InitPlugins() == -1 ) return -1;
}*/
/*if ((!OpenCDVD(pTitleFilename)) || (!OpenGS()) || (!OpenPAD1()) || (!OpenPAD2()) ||
(!OpenSPU2()) || (!OpenDEV9()) || (!OpenUSB()) || (!OpenFW()))
return -1;
if (!only_loading_elf) cdvdDetectDisk();
return 0;*/
} }
@ -312,17 +554,6 @@ static __forceinline bool TestPS2Esyms(void* &drv, PluginTypes::PluginTypes type
return true; return true;
} }
void CALLBACK GS_printf(int timeout, char *fmt, ...) {
va_list list;
char msg[512];
va_start(list, fmt);
vsprintf(msg, fmt, list);
va_end(list);
Console::WriteLn(msg);
}
s32 CALLBACK GS_freeze(int mode, freezeData *data) { data->size = 0; return 0; } s32 CALLBACK GS_freeze(int mode, freezeData *data) { data->size = 0; return 0; }
void CALLBACK GS_keyEvent(keyEvent *ev) {} void CALLBACK GS_keyEvent(keyEvent *ev) {}
void CALLBACK GS_makeSnapshot(const char *path) {} void CALLBACK GS_makeSnapshot(const char *path) {}
@ -744,14 +975,14 @@ int LoadPlugins()
{ {
if (plugins_loaded) return 0; if (plugins_loaded) return 0;
if (LoadGSplugin( Path::Combine( Config.PluginsDir, Config.GS )) == -1) return -1; if (LoadGSplugin( Path::Combine( Config.Paths.Plugins, Config.Plugins.GS )) == -1) return -1;
if (LoadPAD1plugin( Path::Combine( Config.PluginsDir, Config.PAD1 )) == -1) return -1; if (LoadPAD1plugin( Path::Combine( Config.Paths.Plugins, Config.Plugins.PAD1 )) == -1) return -1;
if (LoadPAD2plugin( Path::Combine( Config.PluginsDir, Config.PAD2 )) == -1) return -1; if (LoadPAD2plugin( Path::Combine( Config.Paths.Plugins, Config.Plugins.PAD2 )) == -1) return -1;
if (LoadSPU2plugin( Path::Combine( Config.PluginsDir, Config.SPU2 )) == -1) return -1; if (LoadSPU2plugin( Path::Combine( Config.Paths.Plugins, Config.Plugins.SPU2 )) == -1) return -1;
if (LoadCDVDplugin( Path::Combine( Config.PluginsDir, Config.CDVD )) == -1) return -1; if (LoadCDVDplugin( Path::Combine( Config.Paths.Plugins, Config.Plugins.CDVD )) == -1) return -1;
if (LoadDEV9plugin( Path::Combine( Config.PluginsDir, Config.DEV9 )) == -1) return -1; if (LoadDEV9plugin( Path::Combine( Config.Paths.Plugins, Config.Plugins.DEV9 )) == -1) return -1;
if (LoadUSBplugin( Path::Combine( Config.PluginsDir, Config.USB )) == -1) return -1; if (LoadUSBplugin( Path::Combine( Config.Paths.Plugins, Config.Plugins.USB )) == -1) return -1;
if (LoadFWplugin( Path::Combine( Config.PluginsDir, Config.FW )) == -1) return -1; if (LoadFWplugin( Path::Combine( Config.Paths.Plugins, Config.Plugins.FW )) == -1) return -1;
plugins_loaded = true; plugins_loaded = true;

View File

@ -23,18 +23,56 @@
#define PLUGINfuncs #define PLUGINfuncs
#include "PS2Edefs.h" #include "PS2Edefs.h"
// Loads plugins as specified in the Config global. struct PluginInfo
int LoadPlugins(); {
const char* shortname;
PluginsEnum_t id;
int typemask;
int version; // minimum version required / supported
};
// Unloads all plugin DLLs. To change plugins, call ReleasePlugins followed by extern const PluginInfo tbl_PluginInfo[];
// changes to Config.Plugins filenames, and then call LoadPlugins.
namespace Exception
{
class NotPcsxPlugin : public Stream
{
public:
virtual ~NotPcsxPlugin() throw() {}
explicit NotPcsxPlugin( const wxString& objname ) :
Stream( objname, wxLt("File is not a PCSX2 plugin") ) {}
explicit NotPcsxPlugin( const PluginsEnum_t& pid ) :
Stream( wxString::FromUTF8( tbl_PluginInfo[pid].shortname ), wxLt("File is not a PCSX2 plugin") ) {}
};
};
//////////////////////////////////////////////////////////////////////////////////////////
// Important: Contents of this structure must match the order of the contents of the
// s_MethMessCommon[] array defined in Plugins.cpp.
//
// Note: Open is excluded from this list because the GS and CDVD have custom signatures >_<
//
struct LegacyPluginAPI_Common
{
s32 (CALLBACK* Init)();
void (CALLBACK* Close)();
void (CALLBACK* Shutdown)();
s32 (CALLBACK* Freeze)(int mode, freezeData *data);
s32 (CALLBACK* Test)();
void (CALLBACK* Configure)();
void (CALLBACK* About)();
};
void LoadPlugins();
void ReleasePlugins(); void ReleasePlugins();
int OpenPlugins(const char* pTitleFilename); void OpenPlugins(const char* pTitleFilename);
void ClosePlugins( bool closegs ); void ClosePlugins( bool closegs );
void CloseGS(); void CloseGS();
int InitPlugins(); void InitPlugins();
void ShutdownPlugins(); void ShutdownPlugins();
void PluginsResetGS(); void PluginsResetGS();

View File

@ -66,13 +66,13 @@ void SysDetect()
L"\tx86PType = %s\n" L"\tx86PType = %s\n"
L"\tx86Flags = %8.8x %8.8x\n" L"\tx86Flags = %8.8x %8.8x\n"
L"\tx86EFlags = %8.8x\n", L"\tx86EFlags = %8.8x\n",
wxString::FromAscii( cpuinfo.x86ID ).c_str(), cpuinfo.x86StepID, wxString::FromAscii( x86caps.VendorName ).c_str(), x86caps.StepID,
wxString::FromAscii( cpuinfo.x86Fam ).Trim().Trim(false).c_str(), wxString::FromAscii( x86caps.FamilyName ).Trim().Trim(false).c_str(),
cpuinfo.cpuspeed / 1000, cpuinfo.cpuspeed%1000, x86caps.Speed / 1000, x86caps.Speed%1000,
cpuinfo.PhysicalCores, cpuinfo.LogicalCores, x86caps.PhysicalCores, x86caps.LogicalCores,
wxString::FromAscii( cpuinfo.x86Type ).c_str(), wxString::FromAscii( x86caps.TypeName ).c_str(),
cpuinfo.x86Flags, cpuinfo.x86Flags2, x86caps.Flags, x86caps.Flags2,
cpuinfo.x86EFlags x86caps.EFlags
) ); ) );
WriteLn( "Features:" ); WriteLn( "Features:" );
@ -84,16 +84,16 @@ void SysDetect()
"\t%sDetected SSSE3\n" "\t%sDetected SSSE3\n"
"\t%sDetected SSE4.1\n" "\t%sDetected SSE4.1\n"
"\t%sDetected SSE4.2\n", params "\t%sDetected SSE4.2\n", params
cpucaps.hasMultimediaExtensions ? "" : "Not ", x86caps.hasMultimediaExtensions ? "" : "Not ",
cpucaps.hasStreamingSIMDExtensions ? "" : "Not ", x86caps.hasStreamingSIMDExtensions ? "" : "Not ",
cpucaps.hasStreamingSIMD2Extensions ? "" : "Not ", x86caps.hasStreamingSIMD2Extensions ? "" : "Not ",
cpucaps.hasStreamingSIMD3Extensions ? "" : "Not ", x86caps.hasStreamingSIMD3Extensions ? "" : "Not ",
cpucaps.hasSupplementalStreamingSIMD3Extensions ? "" : "Not ", x86caps.hasSupplementalStreamingSIMD3Extensions ? "" : "Not ",
cpucaps.hasStreamingSIMD4Extensions ? "" : "Not ", x86caps.hasStreamingSIMD4Extensions ? "" : "Not ",
cpucaps.hasStreamingSIMD4Extensions2 ? "" : "Not " x86caps.hasStreamingSIMD4Extensions2 ? "" : "Not "
); );
if ( cpuinfo.x86ID[0] == 'A' ) //AMD cpu if ( x86caps.VendorName[0] == 'A' ) //AMD cpu
{ {
WriteLn( " Extended AMD Features:" ); WriteLn( " Extended AMD Features:" );
WriteLn( WriteLn(
@ -101,10 +101,10 @@ void SysDetect()
"\t%sDetected 3DNOW\n" "\t%sDetected 3DNOW\n"
"\t%sDetected 3DNOW2\n" "\t%sDetected 3DNOW2\n"
"\t%sDetected SSE4a\n", params "\t%sDetected SSE4a\n", params
cpucaps.hasMultimediaExtensionsExt ? "" : "Not ", x86caps.hasMultimediaExtensionsExt ? "" : "Not ",
cpucaps.has3DNOWInstructionExtensions ? "" : "Not ", x86caps.has3DNOWInstructionExtensions ? "" : "Not ",
cpucaps.has3DNOWInstructionExtensionsExt ? "" : "Not ", x86caps.has3DNOWInstructionExtensionsExt ? "" : "Not ",
cpucaps.hasStreamingSIMD4ExtensionsA ? "" : "Not " x86caps.hasStreamingSIMD4ExtensionsA ? "" : "Not "
); );
} }

View File

@ -24,16 +24,14 @@
using namespace wxHelpers; using namespace wxHelpers;
Dialogs::PickUserModeDialog::PickUserModeDialog( wxWindow* parent, int id ) : Dialogs::PickUserModeDialog::PickUserModeDialog( wxWindow* parent, int id ) :
wxDialogWithHelpers( parent, id, _("PCSX2 First Time configuration"), false ) wxDialogWithHelpers( parent, id, _("PCSX2 First Time configuration"), false )
, m_panel_usersel( new Panels::UsermodeSelectionPanel( this ) ) , m_panel_usersel( new Panels::UsermodeSelectionPanel( this, 620 ) )
, m_panel_langsel( new Panels::LanguageSelectionPanel( this ) ) , m_panel_langsel( new Panels::LanguageSelectionPanel( this, 620 ) )
{ {
wxBoxSizer& s_main = *new wxBoxSizer( wxVERTICAL ); wxBoxSizer& s_main = *new wxBoxSizer( wxVERTICAL );
AddStaticText( s_main, _("PCSX2 is starting from a new or unknown folder and needs to be configured."), AddStaticText( s_main, _("PCSX2 is starting from a new or unknown folder and needs to be configured.") );
0, wxALIGN_CENTRE );
s_main.Add( m_panel_langsel, SizerFlags::StdCenter() ); s_main.Add( m_panel_langsel, SizerFlags::StdCenter() );
s_main.Add( m_panel_usersel, wxSizerFlags().Expand().Border( wxALL, 8 ) ); s_main.Add( m_panel_usersel, wxSizerFlags().Expand().Border( wxALL, 8 ) );

View File

@ -41,12 +41,11 @@ void MainEmuFrame::Menu_RunIso_Click(wxCommandEvent &event)
if( ctrl.ShowModal() == wxID_CANCEL ) return; if( ctrl.ShowModal() == wxID_CANCEL ) return;
g_Conf->Folders.RunIso = ctrl.GetPath(); g_Conf->Folders.RunIso = ctrl.GetPath();
} }
void MainEmuFrame::Menu_RunWithoutDisc_Click(wxCommandEvent &event) void MainEmuFrame::Menu_RunWithoutDisc_Click(wxCommandEvent &event)
{ {
SysPrepareExecution( wxEmptyString, true );
} }
void MainEmuFrame::Menu_IsoRecent_Click(wxCommandEvent &event) void MainEmuFrame::Menu_IsoRecent_Click(wxCommandEvent &event)

View File

@ -25,7 +25,7 @@ Panels::GameFixesPanel::GameFixesPanel( wxWindow& parent, int idealWidth ) :
BaseApplicableConfigPanel( &parent, idealWidth) BaseApplicableConfigPanel( &parent, idealWidth)
{ {
wxBoxSizer& mainSizer = *new wxBoxSizer( wxVERTICAL ); wxBoxSizer& mainSizer = *new wxBoxSizer( wxVERTICAL );
AddStaticText( mainSizer, _("Some games need special settings.\nEnable them here."), wxALIGN_CENTRE ); AddStaticText( mainSizer, _("Some games need special settings.\nEnable them here.") );
wxStaticBoxSizer& groupSizer = *new wxStaticBoxSizer( wxVERTICAL, this, _("PCSX2 Gamefixes") ); wxStaticBoxSizer& groupSizer = *new wxStaticBoxSizer( wxVERTICAL, this, _("PCSX2 Gamefixes") );
AddCheckBox( groupSizer, _("DMA Execution Hack - for Fatal Frame.") ); AddCheckBox( groupSizer, _("DMA Execution Hack - for Fatal Frame.") );
@ -36,10 +36,10 @@ Panels::GameFixesPanel::GameFixesPanel( wxWindow& parent, int idealWidth ) :
mainSizer.Add( &groupSizer, wxSizerFlags().Centre() ); mainSizer.Add( &groupSizer, wxSizerFlags().Centre() );
AddStaticText( mainSizer, pxE( "Gamefixes Dialog:Compat Warning", AddStaticText( mainSizer, pxE( ".Panels:Gamefixes:Compat Warning",
L"Enabling game fixes can cause compatibility or performance issues in other games. You " L"Enabling game fixes can cause compatibility or performance issues in other games. You "
L"will need to turn off fixes manually when changing games." L"will need to turn off fixes manually when changing games."
), wxALIGN_CENTRE ); ));
SetSizerAndFit( &mainSizer ); SetSizerAndFit( &mainSizer );

View File

@ -90,11 +90,11 @@ Panels::UsermodeSelectionPanel::UsermodeSelectionPanel( wxWindow* parent, int id
, m_radio_cwd( NULL ) , m_radio_cwd( NULL )
{ {
wxStaticBoxSizer& s_boxer = *new wxStaticBoxSizer( wxVERTICAL, this, _( "Usermode Selection" ) ); wxStaticBoxSizer& s_boxer = *new wxStaticBoxSizer( wxVERTICAL, this, _( "Usermode Selection" ) );
AddStaticText( s_boxer, AddStaticText( s_boxer, pxE( ".Panels:Usermode:Explained",
L"Please select your preferred default location for PCSX2 user-level documents below " L"Please select your preferred default location for PCSX2 user-level documents below "
L"(includes memory cards, screenshots, settings, and savestates). " L"(includes memory cards, screenshots, settings, and savestates). "
L"These folder locations can be overridden at any time using the Core Settings panel.", L"These folder locations can be overridden at any time using the Core Settings panel."
wxALIGN_CENTRE ); ) );
m_radio_user = &AddRadioButton( s_boxer, _("User Documents (recommended)"), _("Location: ") + wxStandardPaths::Get().GetDocumentsDir() ); m_radio_user = &AddRadioButton( s_boxer, _("User Documents (recommended)"), _("Location: ") + wxStandardPaths::Get().GetDocumentsDir() );
s_boxer.AddSpacer( 4 ); s_boxer.AddSpacer( 4 );

View File

@ -100,7 +100,7 @@ Panels::PathsPanel::StandardPanel::StandardPanel( wxWindow& parent ) :
AddDirPicker( s_main, FolderId_Bios, AddDirPicker( s_main, FolderId_Bios,
_("Bios:"), _("Bios:"),
_("Select folder with PS2 Bios") ). _("Select folder with PS2 Bios") ).
SetToolTip( pxE( "Setting Tooltip:Bios Folder", SetToolTip( pxE( ".Tooltips:Folders:Bios",
L"This folder is where PCSX2 looks to find PS2 bios files. The actual bios used can be " L"This folder is where PCSX2 looks to find PS2 bios files. The actual bios used can be "
L"selected from the CPU dialog." L"selected from the CPU dialog."
) ); ) );
@ -109,7 +109,7 @@ Panels::PathsPanel::StandardPanel::StandardPanel( wxWindow& parent ) :
AddDirPicker( s_main, FolderId_Savestates, AddDirPicker( s_main, FolderId_Savestates,
_("Savestates:"), _("Savestates:"),
_("Select folder for Savestates") ). _("Select folder for Savestates") ).
SetToolTip( pxE( "Setting Tooltip:Savestates Folder", SetToolTip( pxE( ".Tooltips:Folders:Savestates",
L"This folder is where PCSX2 records savestates; which are recorded either by using " L"This folder is where PCSX2 records savestates; which are recorded either by using "
L"menus/toolbars, or by pressing F1/F3 (load/save)." L"menus/toolbars, or by pressing F1/F3 (load/save)."
) ); ) );
@ -118,7 +118,7 @@ Panels::PathsPanel::StandardPanel::StandardPanel( wxWindow& parent ) :
AddDirPicker( s_main, FolderId_Snapshots, AddDirPicker( s_main, FolderId_Snapshots,
_("Snapshots:"), _("Snapshots:"),
_("Select a folder for Snapshots") ). _("Select a folder for Snapshots") ).
SetToolTip( pxE( "Setting Tooltip:Snapshots Folder", SetToolTip( pxE( ".Tooltips:Folders:Snapshots",
L"This folder is where PCSX2 saves screenshots. Actual screenshot image format and style " L"This folder is where PCSX2 saves screenshots. Actual screenshot image format and style "
L"may vary depending on the GS plugin being used." L"may vary depending on the GS plugin being used."
) ); ) );
@ -127,7 +127,7 @@ Panels::PathsPanel::StandardPanel::StandardPanel( wxWindow& parent ) :
AddDirPicker( s_main, FolderId_Logs, AddDirPicker( s_main, FolderId_Logs,
_("Logs/Dumps:" ), _("Logs/Dumps:" ),
_("Select a folder for logs/dumps") ). _("Select a folder for logs/dumps") ).
SetToolTip( pxE( "Setting Tooltip:Logs Folder", SetToolTip( pxE( ".Tooltips:Folders:Logs",
L"This folder is where PCSX2 saves its logfiles and diagnostic dumps. Most plugins will " L"This folder is where PCSX2 saves its logfiles and diagnostic dumps. Most plugins will "
L"also adhere to this folder, however some older plugins may ignore it." L"also adhere to this folder, however some older plugins may ignore it."
) ); ) );
@ -136,7 +136,7 @@ Panels::PathsPanel::StandardPanel::StandardPanel( wxWindow& parent ) :
AddDirPicker( s_main, FolderId_MemoryCards, AddDirPicker( s_main, FolderId_MemoryCards,
_("Memorycards:"), _("Memorycards:"),
_("Select a default Memorycards folder") ). _("Select a default Memorycards folder") ).
SetToolTip( pxE( "Setting Tooltip:Memorycards Folder", SetToolTip( pxE( ".Tooltips:Folders:Memorycards",
L"This is the default path where PCSX2 loads or creates its memory cards, and can be " L"This is the default path where PCSX2 loads or creates its memory cards, and can be "
L"overridden in the MemoryCard Configuration by using absolute filenames." L"overridden in the MemoryCard Configuration by using absolute filenames."
) ); ) );
@ -150,15 +150,15 @@ Panels::PathsPanel::AdvancedPanel::AdvancedPanel( wxWindow& parent, int idealWid
MyBasePanel( parent, idealWidth-9 ) MyBasePanel( parent, idealWidth-9 )
{ {
wxStaticBoxSizer& advanced = *new wxStaticBoxSizer( wxVERTICAL, this, _("Advanced") ); wxStaticBoxSizer& advanced = *new wxStaticBoxSizer( wxVERTICAL, this, _("Advanced") );
AddStaticText( advanced, pxE( "Settings Dialog:Advanced Paths", AddStaticText( advanced, pxE( ".Panels:Folders:Advanced",
L"Warning!! These advanced options are provided for developers and advanced testers only. " L"Warning!! These advanced options are provided for developers and advanced testers only. "
L"Changing these settings can cause program errors, so please be weary." L"Changing these settings can cause program errors, so please be weary."
), wxALIGN_CENTRE ); ) );
AddDirPicker( advanced, FolderId_Plugins, AddDirPicker( advanced, FolderId_Plugins,
_("Plugins:"), _("Plugins:"),
_("Select folder for PCSX2 plugins") ). _("Select folder for PCSX2 plugins") ).
SetToolTip( pxE( "Setting Tooltip:Plugins Path", SetToolTip( pxE( ".Tooltips:Folders:Plugins",
L"This is the location where PCSX2 will expect to find its plugins. Plugins found in this folder " L"This is the location where PCSX2 will expect to find its plugins. Plugins found in this folder "
L"will be enumerated and are selectable from the Plugins panel." L"will be enumerated and are selectable from the Plugins panel."
) ); ) );
@ -167,7 +167,7 @@ Panels::PathsPanel::AdvancedPanel::AdvancedPanel( wxWindow& parent, int idealWid
AddDirPicker( advanced, FolderId_Settings, AddDirPicker( advanced, FolderId_Settings,
_("Settings:"), _("Settings:"),
_("Select a folder for PCSX2 settings/inis") ). _("Select a folder for PCSX2 settings/inis") ).
SetToolTip( pxE( "Settings Tooltip:Settings Path", SetToolTip( pxE( ".Tooltips:Folders:Settings",
L"This is the folder where PCSX2 saves all settings, including settings generated " L"This is the folder where PCSX2 saves all settings, including settings generated "
L"by most plugins.\n\nWarning: Some older versions of plugins may not respect this value." L"by most plugins.\n\nWarning: Some older versions of plugins may not respect this value."
) ); ) );

View File

@ -26,42 +26,6 @@
using namespace wxHelpers; using namespace wxHelpers;
using namespace Threading; using namespace Threading;
struct PluginInfo
{
const char* shortname;
PluginsEnum_t id;
int typemask;
int version; // minimum version required / supported
};
// Yay, order of this array shouldn't be important. :)
static const PluginInfo tbl_PluginInfo[] =
{
{ "GS", PluginId_GS, PS2E_LT_GS, PS2E_GS_VERSION },
{ "PAD", PluginId_PAD, PS2E_LT_PAD, PS2E_PAD_VERSION },
{ "SPU2", PluginId_SPU2, PS2E_LT_SPU2, PS2E_SPU2_VERSION },
{ "CDVD", PluginId_CDVD, PS2E_LT_CDVD, PS2E_CDVD_VERSION },
{ "DEV9", PluginId_DEV9, PS2E_LT_DEV9, PS2E_DEV9_VERSION },
{ "USB", PluginId_USB, PS2E_LT_USB, PS2E_USB_VERSION },
{ "FW", PluginId_FW, PS2E_LT_FW, PS2E_FW_VERSION },
// SIO is currently unused (legacy?)
//{ "SIO", PluginId_SIO, PS2E_LT_SIO, PS2E_SIO_VERSION }
};
namespace Exception
{
class NotPcsxPlugin : public Stream
{
public:
virtual ~NotPcsxPlugin() throw() {}
explicit NotPcsxPlugin( const wxString& objname ) :
Stream( objname, wxLt("Dynamic library is not a PCSX2 plugin (or is an unsupported m_version)") ) {}
};
};
DECLARE_EVENT_TYPE(wxEVT_EnumeratedNext, -1) DECLARE_EVENT_TYPE(wxEVT_EnumeratedNext, -1)
DECLARE_EVENT_TYPE(wxEVT_EnumerationFinished, -1) DECLARE_EVENT_TYPE(wxEVT_EnumerationFinished, -1)
@ -158,7 +122,7 @@ Panels::PluginSelectorPanel::StatusPanel::StatusPanel( wxWindow* parent, int plu
{ {
wxBoxSizer& s_main = *new wxBoxSizer( wxVERTICAL ); wxBoxSizer& s_main = *new wxBoxSizer( wxVERTICAL );
AddStaticText( s_main, _( "Enumerating available plugins..." ), wxALIGN_CENTRE ); AddStaticText( s_main, _( "Enumerating available plugins..." ) );
s_main.Add( &m_gauge, wxSizerFlags().Expand().Border( wxLEFT | wxRIGHT, 32 ) ); s_main.Add( &m_gauge, wxSizerFlags().Expand().Border( wxLEFT | wxRIGHT, 32 ) );
s_main.Add( &m_label, SizerFlags::StdExpand() ); s_main.Add( &m_label, SizerFlags::StdExpand() );
@ -223,7 +187,7 @@ Panels::PluginSelectorPanel::PluginSelectorPanel( wxWindow& parent, int idealWid
s_main.Add( &m_ComboBoxes, SizerFlags::StdExpand().ReserveSpaceEvenIfHidden() ); s_main.Add( &m_ComboBoxes, SizerFlags::StdExpand().ReserveSpaceEvenIfHidden() );
s_main.AddSpacer( 4 ); s_main.AddSpacer( 4 );
AddStaticText( s_main, _("Tip: Installed plugins that are not compatible with your hardware or operating system will be listed below a separator."), wxALIGN_CENTRE ); AddStaticText( s_main, _("Tip: Installed plugins that are not compatible with your hardware or operating system will be listed below a separator.") );
s_main.AddSpacer( 4 ); s_main.AddSpacer( 4 );
s_main.Add( &m_StatusPanel, SizerFlags::StdExpand().ReserveSpaceEvenIfHidden() ); s_main.Add( &m_StatusPanel, SizerFlags::StdExpand().ReserveSpaceEvenIfHidden() );
@ -315,7 +279,7 @@ void Panels::PluginSelectorPanel::OnEnumComplete( wxCommandEvent& evt )
if( emptyBoxes > 0 ) if( emptyBoxes > 0 )
{ {
wxMessageBox( pxE( "Popup Error:Missing Plugins", wxMessageBox( pxE( ".Popup Error:Missing Plugins",
L"Critical Error: A valid plugin for one or more components of PCSX2 could not be found. " L"Critical Error: A valid plugin for one or more components of PCSX2 could not be found. "
L"Your installation of PCSX2 is incomplete, and will be unable to run games."), L"Your installation of PCSX2 is incomplete, and will be unable to run games."),
_("PCSX2 Error - Plugin components not found") _("PCSX2 Error - Plugin components not found")

View File

@ -36,17 +36,17 @@ const wxChar* Panels::SpeedHacksPanel::GetEEcycleSliderMsg( int val )
switch( val ) switch( val )
{ {
case 1: case 1:
return pxE( ":Panels:Speedhacks:EECycleX1", return pxE( ".Panels:Speedhacks:EECycleX1",
L"1 - Default cyclerate. This closely matches the actual speed of a real PS2 EmotionEngine." L"1 - Default cyclerate. This closely matches the actual speed of a real PS2 EmotionEngine."
); );
case 2: case 2:
return pxE( ":Panels:Speedhacks:EECycleX2", return pxE( ".Panels:Speedhacks:EECycleX2",
L"2 - Reduces the EE's cyclerate by about 33%. Mild speedup for most games with high compatibility." L"2 - Reduces the EE's cyclerate by about 33%. Mild speedup for most games with high compatibility."
); );
case 3: case 3:
return pxE( ":Panels:Speedhacks:EECycleX3", return pxE( ".Panels:Speedhacks:EECycleX3",
L"3 - Reduces the EE's cyclerate by about 50%. Moderate speedup, but *will* cause studdering " L"3 - Reduces the EE's cyclerate by about 50%. Moderate speedup, but *will* cause studdering "
L"audio on many FMVs." L"audio on many FMVs."
); );
@ -62,23 +62,23 @@ const wxChar* Panels::SpeedHacksPanel::GetVUcycleSliderMsg( int val )
switch( val ) switch( val )
{ {
case 0: case 0:
return pxE( ":Panels:Speedhacks:VUCycleStealOff", return pxE( ".Panels:Speedhacks:VUCycleStealOff",
L"0 - Disables VU Cycle Stealing. Most compatible setting!" L"0 - Disables VU Cycle Stealing. Most compatible setting!"
); );
case 1: case 1:
return pxE( ":Panels:Speedhacks:VUCycleSteal1", return pxE( ".Panels:Speedhacks:VUCycleSteal1",
L"1 - Mild VU Cycle Stealing. High compatibility with some speedup for most games." L"1 - Mild VU Cycle Stealing. High compatibility with some speedup for most games."
); );
case 2: case 2:
return pxE( ":Panels:Speedhacks:VUCycleSteal2", return pxE( ".Panels:Speedhacks:VUCycleSteal2",
L"2 - Moderate VU Cycle Stealing. Moderate compatibility with significant speedups in some games." L"2 - Moderate VU Cycle Stealing. Moderate compatibility with significant speedups in some games."
); );
case 3: case 3:
// TODO: Mention specific games that benefit from this setting here. // TODO: Mention specific games that benefit from this setting here.
return pxE( ":Panels:Speedhacks:VUCycleSteal3", return pxE( ".Panels:Speedhacks:VUCycleSteal3",
L"3 - Maximum VU Cycle Stealing. Usefulness is limited, as this will cause flickering " L"3 - Maximum VU Cycle Stealing. Usefulness is limited, as this will cause flickering "
L"visuals or slowdown in most games." L"visuals or slowdown in most games."
); );
@ -102,10 +102,10 @@ Panels::SpeedHacksPanel::SpeedHacksPanel( wxWindow& parent, int idealWidth ) :
wxStaticBoxSizer& stealerSizer = *new wxStaticBoxSizer( wxVERTICAL, this, _("VU Cycle Stealing") ); wxStaticBoxSizer& stealerSizer = *new wxStaticBoxSizer( wxVERTICAL, this, _("VU Cycle Stealing") );
wxStaticBoxSizer& miscSizer = *new wxStaticBoxSizer( wxVERTICAL, this, _("Other Hacks") ); wxStaticBoxSizer& miscSizer = *new wxStaticBoxSizer( wxVERTICAL, this, _("Other Hacks") );
AddStaticText( mainSizer, pxE( ":Panels:Speedhacks:Overview", AddStaticText( mainSizer, pxE( ".Panels:Speedhacks:Overview",
L"These hacks will usually improve the speed of PCSX2 emulation, but compromise compatibility. " L"These hacks will usually improve the speed of PCSX2 emulation, but compromise compatibility. "
L"If you have issues, always try disabling these hacks first." L"If you have issues, always try disabling these hacks first."
), wxALIGN_CENTRE ); ) );
const wxChar* tooltip; // needed because we duplicate tooltips across multiple controls. const wxChar* tooltip; // needed because we duplicate tooltips across multiple controls.
const wxSizerFlags sliderFlags( wxSizerFlags().Border( wxLEFT | wxRIGHT, 8 ).Expand() ); const wxSizerFlags sliderFlags( wxSizerFlags().Border( wxLEFT | wxRIGHT, 8 ).Expand() );
@ -116,7 +116,7 @@ Panels::SpeedHacksPanel::SpeedHacksPanel( wxWindow& parent, int idealWidth ) :
m_slider_eecycle = new wxSlider( this, wxID_ANY, g_Conf->Speedhacks.EECycleRate+1, 1, 3, m_slider_eecycle = new wxSlider( this, wxID_ANY, g_Conf->Speedhacks.EECycleRate+1, 1, 3,
wxDefaultPosition, wxDefaultSize, wxHORIZONTAL | wxSL_AUTOTICKS | wxSL_LABELS ); wxDefaultPosition, wxDefaultSize, wxHORIZONTAL | wxSL_AUTOTICKS | wxSL_LABELS );
tooltip = pxE( ":Tooltips:Speedhacks:EECycleRate Slider", tooltip = pxE( ".Tooltips:Speedhacks:EECycleRate Slider",
L"Setting higher values on this slider effectively reduces the clock speed of the EmotionEngine's " L"Setting higher values on this slider effectively reduces the clock speed of the EmotionEngine's "
L"R5900 core cpu, and typically brings big speedups to games that fail to utilize " L"R5900 core cpu, and typically brings big speedups to games that fail to utilize "
L"the full potential of the real PS2 hardware." L"the full potential of the real PS2 hardware."
@ -136,7 +136,7 @@ Panels::SpeedHacksPanel::SpeedHacksPanel( wxWindow& parent, int idealWidth ) :
m_slider_vustealer = new wxSlider( this, wxID_ANY, g_Conf->Speedhacks.VUCycleSteal, 0, 4, wxDefaultPosition, wxDefaultSize, m_slider_vustealer = new wxSlider( this, wxID_ANY, g_Conf->Speedhacks.VUCycleSteal, 0, 4, wxDefaultPosition, wxDefaultSize,
wxHORIZONTAL | wxSL_AUTOTICKS | wxSL_LABELS ); wxHORIZONTAL | wxSL_AUTOTICKS | wxSL_LABELS );
tooltip = pxE( ":Tooltips:Speedhacks:VUCycleStealing Slider", tooltip = pxE( ".Tooltips:Speedhacks:VUCycleStealing Slider",
L"This slider controls the amount of cycles the VU unit steals from the EmotionEngine. Higher values increase the number of " L"This slider controls the amount of cycles the VU unit steals from the EmotionEngine. Higher values increase the number of "
L"cycles stolen from the EE for each VU microprogram the game runs." L"cycles stolen from the EE for each VU microprogram the game runs."
); );
@ -157,14 +157,14 @@ Panels::SpeedHacksPanel::SpeedHacksPanel( wxWindow& parent, int idealWidth ) :
m_check_intc = &AddCheckBox(miscSizer, _("Enable INTC Spin Detection"), m_check_intc = &AddCheckBox(miscSizer, _("Enable INTC Spin Detection"),
_("Huge speedup for some games, with almost no compatibility side effects. [Recommended]"), _("Huge speedup for some games, with almost no compatibility side effects. [Recommended]"),
pxE( ":Tooltips:Speedhacks:INTC", pxE( ".Tooltips:Speedhacks:INTC",
L"This hack works best for games that use the INTC Status register to wait for vsyncs, which includes primarily non-3D " L"This hack works best for games that use the INTC Status register to wait for vsyncs, which includes primarily non-3D "
L"RPG titles. Games that do not use this method of vsync will see little or no speeup from this hack." L"RPG titles. Games that do not use this method of vsync will see little or no speeup from this hack."
) ); ) );
m_check_b1fc0 = &AddCheckBox(miscSizer, _("Enable BIFC0 Spin Detection"), m_check_b1fc0 = &AddCheckBox(miscSizer, _("Enable BIFC0 Spin Detection"),
_("Moderate speedup for some games, with no known side effects. [Recommended]" ), _("Moderate speedup for some games, with no known side effects. [Recommended]" ),
pxE( ":Tooltips:Speedhacks:BIFC0", pxE( ".Tooltips:Speedhacks:BIFC0",
L"This hack works especially well for Final Fantasy X and Kingdom Hearts. BIFC0 is the address of a specific block of " L"This hack works especially well for Final Fantasy X and Kingdom Hearts. BIFC0 is the address of a specific block of "
L"code in the EE kernel that's run repeatedly when the EE is waiting for the IOP to complete a task. This hack detects " L"code in the EE kernel that's run repeatedly when the EE is waiting for the IOP to complete a task. This hack detects "
L"that and responds by fast-forwarding the EE until the IOP signals that the task is complete." L"that and responds by fast-forwarding the EE until the IOP signals that the task is complete."
@ -172,7 +172,7 @@ Panels::SpeedHacksPanel::SpeedHacksPanel( wxWindow& parent, int idealWidth ) :
m_check_IOPx2 = &AddCheckBox(miscSizer, _("IOP x2 cycle rate hack"), m_check_IOPx2 = &AddCheckBox(miscSizer, _("IOP x2 cycle rate hack"),
_("Small Speedup and works well with most games; may cause some games to hang during startup."), _("Small Speedup and works well with most games; may cause some games to hang during startup."),
pxE( ":Tooltips:Speedhacks:IOPx2", pxE( ".Tooltips:Speedhacks:IOPx2",
L"Halves the cycle rate of the IOP, giving it an effective emulated speed of roughly 18 MHz. " L"Halves the cycle rate of the IOP, giving it an effective emulated speed of roughly 18 MHz. "
L"The speedup is very minor, so this hack is generally not recommended." L"The speedup is very minor, so this hack is generally not recommended."
) ); ) );

View File

@ -118,8 +118,9 @@ void i18n_EnumeratePackages( LangPackList& langs )
// //
const wxChar* __fastcall pxExpandMsg( const wxChar* key, const wxChar* englishContent ) const wxChar* __fastcall pxExpandMsg( const wxChar* key, const wxChar* englishContent )
{ {
int curlangid = wxLocale::GetLanguageInfo( g_Conf->LanguageId )->Language; const wxLanguageInfo* info = wxLocale::GetLanguageInfo( g_Conf->LanguageId );
if( IsEnglish( curlangid ) )
if( ( info == NULL ) || IsEnglish( info->Language ) )
return englishContent; return englishContent;
const wxChar* retval = wxGetTranslation( key ); const wxChar* retval = wxGetTranslation( key );

View File

@ -7,7 +7,7 @@ namespace wxHelpers
{ {
extern wxCheckBox& AddCheckBoxTo( wxWindow* parent, wxSizer& sizer, const wxString& label, const wxString& subtext=wxEmptyString, const wxString& tooltip=wxEmptyString, int wrapLen=wxDefaultCoord ); extern wxCheckBox& AddCheckBoxTo( wxWindow* parent, wxSizer& sizer, const wxString& label, const wxString& subtext=wxEmptyString, const wxString& tooltip=wxEmptyString, int wrapLen=wxDefaultCoord );
extern wxRadioButton& AddRadioButtonTo( wxWindow* parent, wxSizer& sizer, const wxString& label, const wxString& subtext=wxEmptyString, const wxString& tooltip=wxEmptyString, int wrapLen=wxDefaultCoord, bool isFirst = false ); extern wxRadioButton& AddRadioButtonTo( wxWindow* parent, wxSizer& sizer, const wxString& label, const wxString& subtext=wxEmptyString, const wxString& tooltip=wxEmptyString, int wrapLen=wxDefaultCoord, bool isFirst = false );
extern wxStaticText& AddStaticTextTo(wxWindow* parent, wxSizer& sizer, const wxString& label, int alignFlags=wxALIGN_LEFT, int wrapLen=wxDefaultCoord ); extern wxStaticText& AddStaticTextTo(wxWindow* parent, wxSizer& sizer, const wxString& label, int alignFlags=wxALIGN_CENTRE, int wrapLen=wxDefaultCoord );
namespace SizerFlags namespace SizerFlags
{ {
@ -127,7 +127,7 @@ public:
wxDialogWithHelpers(wxWindow* parent, int id, const wxString& title, bool hasContextHelp, const wxPoint& pos=wxDefaultPosition, const wxSize& size=wxDefaultSize ); wxDialogWithHelpers(wxWindow* parent, int id, const wxString& title, bool hasContextHelp, const wxPoint& pos=wxDefaultPosition, const wxSize& size=wxDefaultSize );
wxCheckBox& AddCheckBox( wxSizer& sizer, const wxString& label, const wxString& subtext=wxEmptyString, const wxString& tooltip=wxEmptyString ); wxCheckBox& AddCheckBox( wxSizer& sizer, const wxString& label, const wxString& subtext=wxEmptyString, const wxString& tooltip=wxEmptyString );
wxStaticText& AddStaticText(wxSizer& sizer, const wxString& label, int alignFlags=wxALIGN_LEFT, int size=wxDefaultCoord ); wxStaticText& AddStaticText(wxSizer& sizer, const wxString& label, int alignFlags=wxALIGN_CENTRE, int size=wxDefaultCoord );
void AddOkCancel( wxSizer& sizer, bool hasApply=false ); void AddOkCancel( wxSizer& sizer, bool hasApply=false );
protected: protected:
@ -147,7 +147,7 @@ public:
wxCheckBox& AddCheckBox( wxSizer& sizer, const wxString& label, const wxString& subtext=wxEmptyString, const wxString& tooltip=wxEmptyString ); wxCheckBox& AddCheckBox( wxSizer& sizer, const wxString& label, const wxString& subtext=wxEmptyString, const wxString& tooltip=wxEmptyString );
wxRadioButton& AddRadioButton( wxSizer& sizer, const wxString& label, const wxString& subtext=wxEmptyString, const wxString& tooltip=wxEmptyString ); wxRadioButton& AddRadioButton( wxSizer& sizer, const wxString& label, const wxString& subtext=wxEmptyString, const wxString& tooltip=wxEmptyString );
wxStaticText& AddStaticText(wxSizer& sizer, const wxString& label, int alignFlags=wxALIGN_LEFT, int size=wxDefaultCoord ); wxStaticText& AddStaticText(wxSizer& sizer, const wxString& label, int alignFlags=wxALIGN_CENTRE, int size=wxDefaultCoord );
int GetIdealWidth() const { return m_idealWidth; } int GetIdealWidth() const { return m_idealWidth; }
bool HasIdealWidth() const { return m_idealWidth != wxDefaultCoord; } bool HasIdealWidth() const { return m_idealWidth != wxDefaultCoord; }

View File

@ -1796,6 +1796,14 @@
RelativePath="..\..\CDVD\CDVDlib.h" RelativePath="..\..\CDVD\CDVDlib.h"
> >
</File> </File>
<File
RelativePath="..\..\CDVD\IsoFileTools.cpp"
>
</File>
<File
RelativePath="..\..\CDVD\IsoFileTools.h"
>
</File>
</Filter> </Filter>
</Filter> </Filter>
<Filter <Filter

View File

@ -24,7 +24,7 @@
static const u32 IniVersion = 102; static const u32 IniVersion = 102;
const char* g_CustomConfigFile; const char* g_CustomConfigFile;
char g_WorkingFolder[g_MaxPath]; // Working folder at application startup //char g_WorkingFolder[g_MaxPath]; // Working folder at application startup
// Returns TRUE if the user has invoked the -cfg command line option. // Returns TRUE if the user has invoked the -cfg command line option.
static bool hasCustomConfig() static bool hasCustomConfig()
@ -38,7 +38,7 @@ static wxString GetConfigFilename()
// Load a user-specified configuration, or use the ini relative to the application's working directory. // Load a user-specified configuration, or use the ini relative to the application's working directory.
// (Our current working directory can change, so we use the one we detected at startup) // (Our current working directory can change, so we use the one we detected at startup)
return Path::Combine( g_WorkingFolder, hasCustomConfig() ? g_CustomConfigFile : (DEFAULT_INIS_DIR "\\pcsx2.ini") ); return Path::Combine( Config.Paths.Working, hasCustomConfig() ? g_CustomConfigFile : (DEFAULT_INIS_DIR "\\pcsx2.ini") );
} }
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
@ -189,9 +189,9 @@ void IniFile::DoConfig( PcsxConfig& Conf )
Entry( "Bios", Conf.Bios ); Entry( "Bios", Conf.Bios );
Entry( "Language", Conf.Lang ); Entry( "Language", Conf.Lang );
wxString plug = DEFAULT_PLUGINS_DIR; wxString plug = DEFAULT_PLUGINS_DIR;
Entry( "PluginsDir", Conf.PluginsDir, plug ); Entry( "PluginsDir", Conf.Paths.Plugins, plug );
wxString bios = DEFAULT_BIOS_DIR; wxString bios = DEFAULT_BIOS_DIR;
Entry( "BiosDir", Conf.BiosDir, bios ); Entry( "BiosDir", Conf.Paths.Bios, bios );
Entry( "CloseGsOnEscape", Conf.closeGSonEsc, true ); Entry( "CloseGsOnEscape", Conf.closeGSonEsc, true );
SetCurrentSection( "Console" ); SetCurrentSection( "Console" );
@ -209,14 +209,14 @@ void IniFile::DoConfig( PcsxConfig& Conf )
SetCurrentSection( "Plugins" ); SetCurrentSection( "Plugins" );
Entry( "GS", Conf.GS ); Entry( "GS", Conf.Plugins.GS );
Entry( "SPU2", Conf.SPU2 ); Entry( "SPU2", Conf.Plugins.SPU2 );
Entry( "CDVD", Conf.CDVD ); Entry( "CDVD", Conf.Plugins.CDVD );
Entry( "PAD1", Conf.PAD1 ); Entry( "PAD1", Conf.Plugins.PAD1 );
Entry( "PAD2", Conf.PAD2 ); Entry( "PAD2", Conf.Plugins.PAD2 );
Entry( "DEV9", Conf.DEV9 ); Entry( "DEV9", Conf.Plugins.DEV9 );
Entry( "USB", Conf.USB ); Entry( "USB", Conf.Plugins.USB );
Entry( "FW", Conf.FW ); Entry( "FW", Conf.Plugins.FW );
//cpu //cpu
SetCurrentSection( "Cpu" ); SetCurrentSection( "Cpu" );
@ -309,14 +309,14 @@ void SaveConfig()
{ {
PcsxConfig tmpConf = Config; PcsxConfig tmpConf = Config;
strcpy( tmpConf.GS, winConfig.GS ); strcpy( tmpConf.Plugins.GS, winConfig.Plugins.GS );
strcpy( tmpConf.SPU2, winConfig.SPU2 ); strcpy( tmpConf.Plugins.SPU2, winConfig.Plugins.SPU2 );
strcpy( tmpConf.CDVD, winConfig.CDVD ); strcpy( tmpConf.Plugins.CDVD, winConfig.Plugins.CDVD );
strcpy( tmpConf.PAD1, winConfig.PAD1 ); strcpy( tmpConf.Plugins.PAD1, winConfig.Plugins.PAD1 );
strcpy( tmpConf.PAD2, winConfig.PAD2 ); strcpy( tmpConf.Plugins.PAD2, winConfig.Plugins.PAD2 );
strcpy( tmpConf.DEV9, winConfig.DEV9 ); strcpy( tmpConf.Plugins.DEV9, winConfig.Plugins.DEV9 );
strcpy( tmpConf.USB, winConfig.USB ); strcpy( tmpConf.Plugins.USB, winConfig.Plugins.USB );
strcpy( tmpConf.FW, winConfig.FW ); strcpy( tmpConf.Plugins.FW, winConfig.Plugins.FW );
IniFileSaver().DoConfig( tmpConf ); IniFileSaver().DoConfig( tmpConf );
} }

View File

@ -257,7 +257,7 @@ void recPMTHL()
int info = eeRecompileCodeXMM( XMMINFO_READS|XMMINFO_READLO|XMMINFO_READHI|XMMINFO_WRITELO|XMMINFO_WRITEHI ); int info = eeRecompileCodeXMM( XMMINFO_READS|XMMINFO_READLO|XMMINFO_READHI|XMMINFO_WRITELO|XMMINFO_WRITEHI );
if ( cpucaps.hasStreamingSIMD4Extensions ) { if ( x86caps.hasStreamingSIMD4Extensions ) {
SSE4_BLENDPS_XMM_to_XMM(EEREC_LO, EEREC_S, 0x5); SSE4_BLENDPS_XMM_to_XMM(EEREC_LO, EEREC_S, 0x5);
SSE_SHUFPS_XMM_to_XMM(EEREC_HI, EEREC_S, 0xdd); SSE_SHUFPS_XMM_to_XMM(EEREC_HI, EEREC_S, 0xdd);
SSE_SHUFPS_XMM_to_XMM(EEREC_HI, EEREC_HI, 0x72); SSE_SHUFPS_XMM_to_XMM(EEREC_HI, EEREC_HI, 0x72);
@ -469,7 +469,7 @@ void recPMAXW()
if ( ! _Rd_ ) return; if ( ! _Rd_ ) return;
int info = eeRecompileCodeXMM( XMMINFO_READS|XMMINFO_READT|XMMINFO_WRITED ); int info = eeRecompileCodeXMM( XMMINFO_READS|XMMINFO_READT|XMMINFO_WRITED );
if ( cpucaps.hasStreamingSIMD4Extensions ) { if ( x86caps.hasStreamingSIMD4Extensions ) {
if( EEREC_S == EEREC_T ) SSEX_MOVDQA_XMM_to_XMM(EEREC_D, EEREC_S); if( EEREC_S == EEREC_T ) SSEX_MOVDQA_XMM_to_XMM(EEREC_D, EEREC_S);
else if( EEREC_D == EEREC_S ) SSE4_PMAXSD_XMM_to_XMM(EEREC_D, EEREC_T); else if( EEREC_D == EEREC_S ) SSE4_PMAXSD_XMM_to_XMM(EEREC_D, EEREC_T);
else if ( EEREC_D == EEREC_T ) SSE4_PMAXSD_XMM_to_XMM(EEREC_D, EEREC_S); else if ( EEREC_D == EEREC_T ) SSE4_PMAXSD_XMM_to_XMM(EEREC_D, EEREC_S);
@ -1196,7 +1196,7 @@ void recPABSW() //needs clamping
SSE2_PCMPEQD_XMM_to_XMM(t0reg, t0reg); SSE2_PCMPEQD_XMM_to_XMM(t0reg, t0reg);
SSE2_PSLLD_I8_to_XMM(t0reg, 31); SSE2_PSLLD_I8_to_XMM(t0reg, 31);
SSE2_PCMPEQD_XMM_to_XMM(t0reg, EEREC_T); //0xffffffff if equal to 0x80000000 SSE2_PCMPEQD_XMM_to_XMM(t0reg, EEREC_T); //0xffffffff if equal to 0x80000000
if( cpucaps.hasSupplementalStreamingSIMD3Extensions ) { if( x86caps.hasSupplementalStreamingSIMD3Extensions ) {
SSSE3_PABSD_XMM_to_XMM(EEREC_D, EEREC_T); //0x80000000 -> 0x80000000 SSSE3_PABSD_XMM_to_XMM(EEREC_D, EEREC_T); //0x80000000 -> 0x80000000
} }
else { else {
@ -1224,7 +1224,7 @@ void recPABSH()
SSE2_PCMPEQW_XMM_to_XMM(t0reg, t0reg); SSE2_PCMPEQW_XMM_to_XMM(t0reg, t0reg);
SSE2_PSLLW_I8_to_XMM(t0reg, 15); SSE2_PSLLW_I8_to_XMM(t0reg, 15);
SSE2_PCMPEQW_XMM_to_XMM(t0reg, EEREC_T); //0xffff if equal to 0x8000 SSE2_PCMPEQW_XMM_to_XMM(t0reg, EEREC_T); //0xffff if equal to 0x8000
if( cpucaps.hasSupplementalStreamingSIMD3Extensions ) { if( x86caps.hasSupplementalStreamingSIMD3Extensions ) {
SSSE3_PABSW_XMM_to_XMM(EEREC_D, EEREC_T); //0x8000 -> 0x8000 SSSE3_PABSW_XMM_to_XMM(EEREC_D, EEREC_T); //0x8000 -> 0x8000
} }
else { else {
@ -1247,7 +1247,7 @@ void recPMINW()
if ( ! _Rd_ ) return; if ( ! _Rd_ ) return;
int info = eeRecompileCodeXMM( XMMINFO_READS|XMMINFO_READT|XMMINFO_WRITED ); int info = eeRecompileCodeXMM( XMMINFO_READS|XMMINFO_READT|XMMINFO_WRITED );
if ( cpucaps.hasStreamingSIMD4Extensions ) { if ( x86caps.hasStreamingSIMD4Extensions ) {
if( EEREC_S == EEREC_T ) SSEX_MOVDQA_XMM_to_XMM(EEREC_D, EEREC_S); if( EEREC_S == EEREC_T ) SSEX_MOVDQA_XMM_to_XMM(EEREC_D, EEREC_S);
else if( EEREC_D == EEREC_S ) SSE4_PMINSD_XMM_to_XMM(EEREC_D, EEREC_T); else if( EEREC_D == EEREC_S ) SSE4_PMINSD_XMM_to_XMM(EEREC_D, EEREC_T);
else if ( EEREC_D == EEREC_T ) SSE4_PMINSD_XMM_to_XMM(EEREC_D, EEREC_S); else if ( EEREC_D == EEREC_T ) SSE4_PMINSD_XMM_to_XMM(EEREC_D, EEREC_S);
@ -1735,7 +1735,7 @@ void recPMADDW()
EEINST_SETSIGNEXT(_Rs_); EEINST_SETSIGNEXT(_Rs_);
EEINST_SETSIGNEXT(_Rt_); EEINST_SETSIGNEXT(_Rt_);
if( _Rd_ ) EEINST_SETSIGNEXT(_Rd_); if( _Rd_ ) EEINST_SETSIGNEXT(_Rd_);
if( !cpucaps.hasStreamingSIMD4Extensions ) { if( !x86caps.hasStreamingSIMD4Extensions ) {
recCall( Interp::PMADDW, _Rd_ ); recCall( Interp::PMADDW, _Rd_ );
return; return;
} }
@ -1790,7 +1790,7 @@ void recPSLLVW()
SSEX_PXOR_XMM_to_XMM(EEREC_D, EEREC_D); SSEX_PXOR_XMM_to_XMM(EEREC_D, EEREC_D);
} }
else { else {
if ( cpucaps.hasStreamingSIMD4Extensions ) { if ( x86caps.hasStreamingSIMD4Extensions ) {
SSE2_PSHUFD_XMM_to_XMM(EEREC_D, EEREC_T, 0x88); SSE2_PSHUFD_XMM_to_XMM(EEREC_D, EEREC_T, 0x88);
SSE4_PMOVSXDQ_XMM_to_XMM(EEREC_D, EEREC_D); SSE4_PMOVSXDQ_XMM_to_XMM(EEREC_D, EEREC_D);
} }
@ -1828,7 +1828,7 @@ void recPSLLVW()
SSE2_PSLLD_XMM_to_XMM(t1reg, t0reg); SSE2_PSLLD_XMM_to_XMM(t1reg, t0reg);
// merge & sign extend // merge & sign extend
if ( cpucaps.hasStreamingSIMD4Extensions ) { if ( x86caps.hasStreamingSIMD4Extensions ) {
SSE2_PUNPCKLDQ_XMM_to_XMM(EEREC_D, t1reg); SSE2_PUNPCKLDQ_XMM_to_XMM(EEREC_D, t1reg);
SSE4_PMOVSXDQ_XMM_to_XMM(EEREC_D, EEREC_D); SSE4_PMOVSXDQ_XMM_to_XMM(EEREC_D, EEREC_D);
} }
@ -1857,7 +1857,7 @@ void recPSRLVW()
SSEX_PXOR_XMM_to_XMM(EEREC_D, EEREC_D); SSEX_PXOR_XMM_to_XMM(EEREC_D, EEREC_D);
} }
else { else {
if ( cpucaps.hasStreamingSIMD4Extensions ) { if ( x86caps.hasStreamingSIMD4Extensions ) {
SSE2_PSHUFD_XMM_to_XMM(EEREC_D, EEREC_T, 0x88); SSE2_PSHUFD_XMM_to_XMM(EEREC_D, EEREC_T, 0x88);
SSE4_PMOVSXDQ_XMM_to_XMM(EEREC_D, EEREC_D); SSE4_PMOVSXDQ_XMM_to_XMM(EEREC_D, EEREC_D);
} }
@ -1895,7 +1895,7 @@ void recPSRLVW()
SSE2_PSRLD_XMM_to_XMM(t1reg, t0reg); SSE2_PSRLD_XMM_to_XMM(t1reg, t0reg);
// merge & sign extend // merge & sign extend
if ( cpucaps.hasStreamingSIMD4Extensions ) { if ( x86caps.hasStreamingSIMD4Extensions ) {
SSE2_PUNPCKLDQ_XMM_to_XMM(EEREC_D, t1reg); SSE2_PUNPCKLDQ_XMM_to_XMM(EEREC_D, t1reg);
SSE4_PMOVSXDQ_XMM_to_XMM(EEREC_D, EEREC_D); SSE4_PMOVSXDQ_XMM_to_XMM(EEREC_D, EEREC_D);
} }
@ -1918,7 +1918,7 @@ void recPMSUBW()
EEINST_SETSIGNEXT(_Rs_); EEINST_SETSIGNEXT(_Rs_);
EEINST_SETSIGNEXT(_Rt_); EEINST_SETSIGNEXT(_Rt_);
if( _Rd_ ) EEINST_SETSIGNEXT(_Rd_); if( _Rd_ ) EEINST_SETSIGNEXT(_Rd_);
if( !cpucaps.hasStreamingSIMD4Extensions ) { if( !x86caps.hasStreamingSIMD4Extensions ) {
recCall( Interp::PMSUBW, _Rd_ ); recCall( Interp::PMSUBW, _Rd_ );
return; return;
} }
@ -1972,7 +1972,7 @@ void recPMULTW()
EEINST_SETSIGNEXT(_Rs_); EEINST_SETSIGNEXT(_Rs_);
EEINST_SETSIGNEXT(_Rt_); EEINST_SETSIGNEXT(_Rt_);
if( _Rd_ ) EEINST_SETSIGNEXT(_Rd_); if( _Rd_ ) EEINST_SETSIGNEXT(_Rd_);
if( !cpucaps.hasStreamingSIMD4Extensions ) { if( !x86caps.hasStreamingSIMD4Extensions ) {
recCall( Interp::PMULTW, _Rd_ ); recCall( Interp::PMULTW, _Rd_ );
return; return;
} }
@ -2436,7 +2436,7 @@ void recPSRAVW()
SSEX_PXOR_XMM_to_XMM(EEREC_D, EEREC_D); SSEX_PXOR_XMM_to_XMM(EEREC_D, EEREC_D);
} }
else { else {
if ( cpucaps.hasStreamingSIMD4Extensions ) { if ( x86caps.hasStreamingSIMD4Extensions ) {
SSE2_PSHUFD_XMM_to_XMM(EEREC_D, EEREC_T, 0x88); SSE2_PSHUFD_XMM_to_XMM(EEREC_D, EEREC_T, 0x88);
SSE4_PMOVSXDQ_XMM_to_XMM(EEREC_D, EEREC_D); SSE4_PMOVSXDQ_XMM_to_XMM(EEREC_D, EEREC_D);
} }
@ -2474,7 +2474,7 @@ void recPSRAVW()
SSE2_PSRAD_XMM_to_XMM(t1reg, t0reg); SSE2_PSRAD_XMM_to_XMM(t1reg, t0reg);
// merge & sign extend // merge & sign extend
if ( cpucaps.hasStreamingSIMD4Extensions ) { if ( x86caps.hasStreamingSIMD4Extensions ) {
SSE2_PUNPCKLDQ_XMM_to_XMM(EEREC_D, t1reg); SSE2_PUNPCKLDQ_XMM_to_XMM(EEREC_D, t1reg);
SSE4_PMOVSXDQ_XMM_to_XMM(EEREC_D, EEREC_D); SSE4_PMOVSXDQ_XMM_to_XMM(EEREC_D, EEREC_D);
} }
@ -2574,7 +2574,7 @@ void recPMULTUW()
} }
// interleave & sign extend // interleave & sign extend
if ( cpucaps.hasStreamingSIMD4Extensions ) { if ( x86caps.hasStreamingSIMD4Extensions ) {
SSE2_PSHUFD_XMM_to_XMM(EEREC_LO, EEREC_HI, 0x88); SSE2_PSHUFD_XMM_to_XMM(EEREC_LO, EEREC_HI, 0x88);
SSE2_PSHUFD_XMM_to_XMM(EEREC_HI, EEREC_HI, 0xdd); SSE2_PSHUFD_XMM_to_XMM(EEREC_HI, EEREC_HI, 0xdd);
SSE4_PMOVSXDQ_XMM_to_XMM(EEREC_LO, EEREC_LO); SSE4_PMOVSXDQ_XMM_to_XMM(EEREC_LO, EEREC_LO);
@ -2629,7 +2629,7 @@ void recPMADDUW()
else SSE2_PADDQ_XMM_to_XMM(EEREC_HI, EEREC_LO); else SSE2_PADDQ_XMM_to_XMM(EEREC_HI, EEREC_LO);
// interleave & sign extend // interleave & sign extend
if ( cpucaps.hasStreamingSIMD4Extensions ) { if ( x86caps.hasStreamingSIMD4Extensions ) {
SSE2_PSHUFD_XMM_to_XMM(EEREC_LO, EEREC_HI, 0x88); SSE2_PSHUFD_XMM_to_XMM(EEREC_LO, EEREC_HI, 0x88);
SSE2_PSHUFD_XMM_to_XMM(EEREC_HI, EEREC_HI, 0xdd); SSE2_PSHUFD_XMM_to_XMM(EEREC_HI, EEREC_HI, 0xdd);
SSE4_PMOVSXDQ_XMM_to_XMM(EEREC_LO, EEREC_LO); SSE4_PMOVSXDQ_XMM_to_XMM(EEREC_LO, EEREC_LO);

View File

@ -34,7 +34,7 @@ void SetCPUState(u32 sseMXCSR, u32 sseVUMXCSR)
sseMXCSR &= 0xffff; // clear the upper 16 bits since they shouldn't be set sseMXCSR &= 0xffff; // clear the upper 16 bits since they shouldn't be set
sseVUMXCSR &= 0xffff; sseVUMXCSR &= 0xffff;
if( !cpucaps.hasStreamingSIMD2Extensions ) if( !x86caps.hasStreamingSIMD2Extensions )
{ {
// SSE1 cpus do not support Denormals Are Zero flag (throws an exception // SSE1 cpus do not support Denormals Are Zero flag (throws an exception
// if we don't mask them off) // if we don't mask them off)

View File

@ -822,7 +822,7 @@ void SetFPUstate() {
_freeMMXreg(7); _freeMMXreg(7);
if (x86FpuState == MMX_STATE) { if (x86FpuState == MMX_STATE) {
if (cpucaps.has3DNOWInstructionExtensions) if (x86caps.has3DNOWInstructionExtensions)
FEMMS(); FEMMS();
else else
EMMS(); EMMS();

View File

@ -391,13 +391,13 @@ static void recAlloc()
{ {
// Hardware Requirements Check... // Hardware Requirements Check...
if ( !( cpucaps.hasMultimediaExtensions ) ) if ( !( x86caps.hasMultimediaExtensions ) )
throw Exception::HardwareDeficiency( "Processor doesn't support MMX" ); throw Exception::HardwareDeficiency( "Processor doesn't support MMX" );
if ( !( cpucaps.hasStreamingSIMDExtensions ) ) if ( !( x86caps.hasStreamingSIMDExtensions ) )
throw Exception::HardwareDeficiency( "Processor doesn't support SSE" ); throw Exception::HardwareDeficiency( "Processor doesn't support SSE" );
if ( !( cpucaps.hasStreamingSIMD2Extensions ) ) if ( !( x86caps.hasStreamingSIMD2Extensions ) )
throw Exception::HardwareDeficiency( "Processor doesn't support SSE2" ); throw Exception::HardwareDeficiency( "Processor doesn't support SSE2" );
if( recMem == NULL ) if( recMem == NULL )
@ -758,10 +758,10 @@ void recClear(u32 addr, u32 size)
__asm__("emms"); __asm__("emms");
#else #else
#ifdef _MSC_VER #ifdef _MSC_VER
if (cpucaps.has3DNOWInstructionExtensions) __asm femms; if (x86caps.has3DNOWInstructionExtensions) __asm femms;
else __asm emms; else __asm emms;
#else #else
if( cpucaps.has3DNOWInstructionExtensions )__asm__("femms"); if( x86caps.has3DNOWInstructionExtensions )__asm__("femms");
else else
__asm__("emms"); __asm__("emms");
#endif #endif
@ -960,7 +960,7 @@ void iFlushCall(int flushtype)
_flushConstRegs(); _flushConstRegs();
if (x86FpuState==MMX_STATE) { if (x86FpuState==MMX_STATE) {
if (cpucaps.has3DNOWInstructionExtensions) FEMMS(); if (x86caps.has3DNOWInstructionExtensions) FEMMS();
else EMMS(); else EMMS();
x86FpuState=FPU_STATE; x86FpuState=FPU_STATE;
} }

View File

@ -158,7 +158,7 @@ static __forceinline void SET_HWLOC_R5900() {
} }
if (x86FpuState==MMX_STATE) { if (x86FpuState==MMX_STATE) {
if (cpucaps.has3DNOWInstructionExtensions) if (x86caps.has3DNOWInstructionExtensions)
FEMMS(); FEMMS();
else else
EMMS(); EMMS();

View File

@ -134,6 +134,7 @@ microVUf(void) mVUclearProg(int progIndex) {
microVU* mVU = mVUx; microVU* mVU = mVUx;
mVUprogI.used = 0; mVUprogI.used = 0;
mVUprogI.isDead = 1; mVUprogI.isDead = 1;
mVUprogI.isOld = 1;
mVUprogI.frame = mVU->prog.curFrame; mVUprogI.frame = mVU->prog.curFrame;
for (int j = 0; j <= mVUprogI.ranges.max; j++) { for (int j = 0; j <= mVUprogI.ranges.max; j++) {
mVUprogI.ranges.range[j][0] = -1; // Set range to mVUprogI.ranges.range[j][0] = -1; // Set range to
@ -173,8 +174,9 @@ microVUf(int) mVUfindLeastUsedProg() {
if (mVU->prog.prog[i].isDead) { if (mVU->prog.prog[i].isDead) {
mVU->prog.total++; mVU->prog.total++;
mVUcacheProg<vuIndex>(i); // Cache Micro Program mVUcacheProg<vuIndex>(i); // Cache Micro Program
mVU->prog.prog[i].isDead = 0; mVU->prog.prog[i].isDead = 0;
mVU->prog.prog[i].used = 1; mVU->prog.prog[i].isOld = 0;
mVU->prog.prog[i].used = 1;
mVUsortProg(mVU, i); mVUsortProg(mVU, i);
Console::Notice("microVU%d: Cached MicroPrograms = [%03d] [%03d]", params vuIndex, i+1, mVU->prog.total+1); Console::Notice("microVU%d: Cached MicroPrograms = [%03d] [%03d]", params vuIndex, i+1, mVU->prog.total+1);
return i; return i;
@ -189,14 +191,15 @@ microVUf(int) mVUfindLeastUsedProg() {
} }
mVU->prog.total -= ((mVU->prog.max+1)/4)-1; mVU->prog.total -= ((mVU->prog.max+1)/4)-1;
mVUcacheProg<vuIndex>(pIdx); // Cache Micro Program mVUcacheProg<vuIndex>(pIdx); // Cache Micro Program
mVU->prog.prog[pIdx].isDead = 0; mVU->prog.prog[pIdx].isDead = 0;
mVU->prog.prog[pIdx].used = 1; mVU->prog.prog[pIdx].isOld = 0;
mVU->prog.prog[pIdx].used = 1;
mVUsortProg(mVU, pIdx); mVUsortProg(mVU, pIdx);
Console::Notice("microVU%d: Cached MicroPrograms = [%03d] [%03d]", params vuIndex, pIdx+1, mVU->prog.total+1); Console::Notice("microVU%d: Cached MicroPrograms = [%03d] [%03d]", params vuIndex, pIdx+1, mVU->prog.total+1);
return pIdx; return pIdx;
} }
// Finds and Kills Programs if they haven't been used in a while. // Finds and Ages/Kills Programs if they haven't been used in a while.
microVUt(void) mVUvsyncUpdate(mV) { microVUt(void) mVUvsyncUpdate(mV) {
for (int i = 0; i <= mVU->prog.max; i++) { for (int i = 0; i <= mVU->prog.max; i++) {
if (mVU->prog.prog[i].isDead) continue; if (mVU->prog.prog[i].isDead) continue;
@ -204,12 +207,16 @@ microVUt(void) mVUvsyncUpdate(mV) {
mVU->prog.prog[i].used = 0; mVU->prog.prog[i].used = 0;
mVU->prog.prog[i].frame = mVU->prog.curFrame; mVU->prog.prog[i].frame = mVU->prog.curFrame;
} }
if((mVU->prog.curFrame - mVU->prog.prog[i].frame) >= (60 * 7)) { if((mVU->prog.curFrame - mVU->prog.prog[i].frame) >= (360 * 10)) {
mVU->prog.total--; mVU->prog.total--;
if (!mVU->index) mVUclearProg<0>(i); if (!mVU->index) mVUclearProg<0>(i);
else mVUclearProg<1>(i); else mVUclearProg<1>(i);
DevCon::Status("microVU%d: Killing Dead Program [%03d]", params mVU->index, i+1); DevCon::Status("microVU%d: Killing Dead Program [%03d]", params mVU->index, i+1);
} }
else if (!mVU->prog.prog[i].isOld && ((mVU->prog.curFrame - mVU->prog.prog[i].frame) >= (30 * 1))) {
mVU->prog.prog[i].isOld = 1;
//DevCon::Status("microVU%d: Aging Old Program [%03d]", params mVU->index, i+1);
}
} }
mVU->prog.curFrame++; mVU->prog.curFrame++;
} }
@ -227,15 +234,16 @@ microVUf(bool) mVUcmpPartial(int progIndex) {
} }
// Compare Cached microProgram to mVU->regs->Micro // Compare Cached microProgram to mVU->regs->Micro
microVUf(bool) mVUcmpProg(int progIndex, const bool cmpWholeProg) { microVUf(bool) mVUcmpProg(int progIndex, const bool checkOld, const bool cmpWholeProg) {
microVU* mVU = mVUx; microVU* mVU = mVUx;
if (!mVUprogI.isDead) { if (!mVUprogI.isDead && (checkOld == mVUprogI.isOld)) {
if ((cmpWholeProg && !memcmp_mmx((u8*)mVUprogI.data, mVU->regs->Micro, mVU->microMemSize)) if ((cmpWholeProg && !memcmp_mmx((u8*)mVUprogI.data, mVU->regs->Micro, mVU->microMemSize))
|| (!cmpWholeProg && mVUcmpPartial<vuIndex>(progIndex))) { || (!cmpWholeProg && mVUcmpPartial<vuIndex>(progIndex))) {
mVU->prog.cur = progIndex; mVU->prog.cur = progIndex;
mVU->prog.cleared = 0; mVU->prog.cleared = 0;
mVU->prog.isSame = cmpWholeProg ? 1 : -1; mVU->prog.isSame = cmpWholeProg ? 1 : -1;
mVU->prog.prog[progIndex].used = 1; mVU->prog.prog[progIndex].used = 1;
mVU->prog.prog[progIndex].isOld = 0;
return 1; return 1;
} }
} }
@ -247,8 +255,12 @@ microVUf(int) mVUsearchProg() {
microVU* mVU = mVUx; microVU* mVU = mVUx;
if (mVU->prog.cleared) { // If cleared, we need to search for new program if (mVU->prog.cleared) { // If cleared, we need to search for new program
for (int i = mVU->prog.max; i >= 0; i--) { for (int i = mVU->prog.max; i >= 0; i--) {
if (mVUcmpProg<vuIndex>(mVU->prog.progList[i], 0)) if (mVUcmpProg<vuIndex>(mVU->prog.progList[i], 0, 0))
return 1; return 1; // Check Young Programs
}
for (int i = mVU->prog.max; i >= 0; i--) {
if (mVUcmpProg<vuIndex>(mVU->prog.progList[i], 1, 0))
return 1; // Check Old Programs
} }
mVU->prog.cur = mVUfindLeastUsedProg<vuIndex>(); // If cleared and program not found, make a new program instance mVU->prog.cur = mVUfindLeastUsedProg<vuIndex>(); // If cleared and program not found, make a new program instance
mVU->prog.cleared = 0; mVU->prog.cleared = 0;

View File

@ -110,7 +110,8 @@ struct microProgram {
microRange ranges; // The ranges of the microProgram that have already been recompiled microRange ranges; // The ranges of the microProgram that have already been recompiled
u32 frame; // Frame # the program was last used on u32 frame; // Frame # the program was last used on
u32 used; // Program was used this frame? u32 used; // Program was used this frame?
bool isDead; // Program is dead? bool isDead; // Program is Dead?
bool isOld; // Program is Old? (Program hasn't been used in a while)
}; };
#define mMaxProg ((mVU->index)?400:8) // The amount of Micro Programs Recs will 'remember' (For n = 1, 2, 4, 8, 16, etc...) #define mMaxProg ((mVU->index)?400:8) // The amount of Micro Programs Recs will 'remember' (For n = 1, 2, 4, 8, 16, etc...)
@ -136,7 +137,6 @@ struct microVU {
PCSX2_ALIGNED16(u32 macFlag[4]); // 4 instances of mac flag (used in execution) PCSX2_ALIGNED16(u32 macFlag[4]); // 4 instances of mac flag (used in execution)
PCSX2_ALIGNED16(u32 clipFlag[4]); // 4 instances of clip flag (used in execution) PCSX2_ALIGNED16(u32 clipFlag[4]); // 4 instances of clip flag (used in execution)
PCSX2_ALIGNED16(u32 xmmPQb[4]); // Backup for xmmPQ PCSX2_ALIGNED16(u32 xmmPQb[4]); // Backup for xmmPQ
PCSX2_ALIGNED16(u32 xmmVFb[4]); // Backup for VF regs
u32 index; // VU Index (VU0 or VU1) u32 index; // VU Index (VU0 or VU1)
u32 vuMemSize; // VU Main Memory Size (in bytes) u32 vuMemSize; // VU Main Memory Size (in bytes)

View File

@ -118,9 +118,8 @@ microVUt(void) mVUallocVIb(mV, int GPRreg, int _reg_) {
//------------------------------------------------------------------ //------------------------------------------------------------------
#define getIreg(reg, modXYZW) { \ #define getIreg(reg, modXYZW) { \
MOV32MtoR(gprT1, (uptr)&mVU->regs->VI[REG_I].UL); \ SSE_MOVSS_M32_to_XMM(reg, (uptr)&mVU->regs->VI[REG_I].UL); \
SSE2_MOVD_R_to_XMM(reg, gprT1); \ if (CHECK_VU_EXTRA_OVERFLOW) mVUclamp2(reg, -1, 8); \
if (CHECK_VU_EXTRA_OVERFLOW) mVUclamp2(reg, xmmT2, 8); \
if (!((_XYZW_SS && modXYZW) || (_X_Y_Z_W == 8))) { mVUunpack_xyzw(reg, reg, 0); } \ if (!((_XYZW_SS && modXYZW) || (_X_Y_Z_W == 8))) { mVUunpack_xyzw(reg, reg, 0); } \
} }
@ -138,38 +137,6 @@ microVUt(void) mVUallocVIb(mV, int GPRreg, int _reg_) {
// Lower Instruction Allocator Helpers // Lower Instruction Allocator Helpers
//------------------------------------------------------------------ //------------------------------------------------------------------
#define getReg(reg, _reg_) { \
mVUloadReg(reg, (uptr)&mVU->regs->VF[_reg_].UL[0], _X_Y_Z_W); \
if (CHECK_VU_EXTRA_OVERFLOW) mVUclamp2(reg, xmmT2, _X_Y_Z_W); \
}
#define getZero(reg) { \
if (_W) { mVUloadReg(reg, (uptr)&mVU->regs->VF[0].UL[0], _X_Y_Z_W); } \
else { SSE_XORPS_XMM_to_XMM(reg, reg); } \
}
#define getReg6(reg, _reg_) { \
if (!_reg_) { getZero(reg); } \
else { getReg(reg, _reg_); } \
}
#define getReg5(reg, _reg_, _fxf_) { \
if (!_reg_) { \
if (_fxf_ < 3) { SSE_XORPS_XMM_to_XMM(reg, reg); } \
else { mVUloadReg(reg, (uptr)&mVU->regs->VF[_reg_].UL[0], 1); } \
} \
else { \
mVUloadReg(reg, (uptr)&mVU->regs->VF[_reg_].UL[0], (1 << (3 - _fxf_))); \
if (CHECK_VU_EXTRA_OVERFLOW) mVUclamp2(reg, xmmT2, (1 << (3 - _fxf_))); \
} \
}
// Doesn't Clamp
#define getReg7(reg, _reg_) { \
if (!_reg_) { getZero(reg); } \
else { mVUloadReg(reg, (uptr)&mVU->regs->VF[_reg_].UL[0], _X_Y_Z_W); } \
}
// VF to GPR // VF to GPR
#define getReg8(GPRreg, _reg_, _fxf_) { \ #define getReg8(GPRreg, _reg_, _fxf_) { \
if (!_reg_ && (_fxf_ < 3)) { XOR32RtoR(GPRreg, GPRreg); } \ if (!_reg_ && (_fxf_ < 3)) { XOR32RtoR(GPRreg, GPRreg); } \

View File

@ -31,30 +31,6 @@
} \ } \
} }
#define doBackupVF1() { \
if (mVUinfo.backupVF && !mVUlow.noWriteVF) { \
DevCon::Status("microVU%d: Backing Up VF Reg [%04x]", params getIndex, xPC); \
SSE_MOVAPS_M128_to_XMM(xmmT1, (uptr)&mVU->regs->VF[mVUlow.VF_write.reg].UL[0]); \
SSE_MOVAPS_XMM_to_M128((uptr)mVU->xmmVFb, xmmT1); \
} \
}
#define doBackupVF2() { \
if (mVUinfo.backupVF && !mVUlow.noWriteVF) { \
SSE_MOVAPS_M128_to_XMM(xmmT1, (uptr)mVU->xmmVFb); \
SSE_MOVAPS_M128_to_XMM(xmmT2, (uptr)&mVU->regs->VF[mVUlow.VF_write.reg].UL[0]); \
SSE_MOVAPS_XMM_to_M128((uptr)&mVU->regs->VF[mVUlow.VF_write.reg].UL[0], xmmT1); \
SSE_MOVAPS_XMM_to_M128((uptr)mVU->xmmVFb, xmmT2); \
} \
}
#define doBackupVF3() { \
if (mVUinfo.backupVF && !mVUlow.noWriteVF) { \
SSE_MOVAPS_M128_to_XMM(xmmT1, (uptr)mVU->xmmVFb); \
SSE_MOVAPS_XMM_to_M128((uptr)&mVU->regs->VF[mVUlow.VF_write.reg].UL[0], xmmT1); \
} \
}
#define startLoop() { \ #define startLoop() { \
mVUdebug1(); \ mVUdebug1(); \
memset(&mVUinfo, 0, sizeof(mVUinfo)); \ memset(&mVUinfo, 0, sizeof(mVUinfo)); \
@ -68,7 +44,6 @@
#define incQ() { mVU->q = (mVU->q+1) & 1; } #define incQ() { mVU->q = (mVU->q+1) & 1; }
#define doUpperOp() { mVUopU(mVU, 1); mVUdivSet(mVU); } #define doUpperOp() { mVUopU(mVU, 1); mVUdivSet(mVU); }
#define doLowerOp() { incPC(-1); mVUopL(mVU, 1); incPC(1); } #define doLowerOp() { incPC(-1); mVUopL(mVU, 1); incPC(1); }
#define doSwapOp() { doBackupVF1(); mVUopL(mVU, 1); doBackupVF2(); incPC(1); doUpperOp(); doBackupVF3(); }
#define doIbit() { if (mVUup.iBit) { incPC(-1); MOV32ItoM((uptr)&mVU->regs->VI[REG_I].UL, curI); incPC(1); } } #define doIbit() { if (mVUup.iBit) { incPC(-1); MOV32ItoM((uptr)&mVU->regs->VI[REG_I].UL, curI); incPC(1); } }
#define blockCreate(addr) { if (!mVUblocks[addr]) mVUblocks[addr] = new microBlockManager(); } #define blockCreate(addr) { if (!mVUblocks[addr]) mVUblocks[addr] = new microBlockManager(); }
@ -76,6 +51,29 @@
// Helper Functions // Helper Functions
//------------------------------------------------------------------ //------------------------------------------------------------------
microVUt(void) doSwapOp(mV) {
if (mVUinfo.backupVF && !mVUlow.noWriteVF) {
DevCon::Status("microVU%d: Backing Up VF Reg [%04x]", params getIndex, xPC);
int t1 = mVU->regAlloc->allocReg(mVUlow.VF_write.reg);
int t2 = mVU->regAlloc->allocReg();
SSE_MOVAPS_XMM_to_XMM(t2, t1);
mVU->regAlloc->clearNeeded(t1);
mVUopL(mVU, 1);
t1 = mVU->regAlloc->allocReg(mVUlow.VF_write.reg, mVUlow.VF_write.reg, 0xf, 0);
SSE_XORPS_XMM_to_XMM(t2, t1);
SSE_XORPS_XMM_to_XMM(t1, t2);
SSE_XORPS_XMM_to_XMM(t2, t1);
mVU->regAlloc->clearNeeded(t1);
incPC(1);
doUpperOp();
t1 = mVU->regAlloc->allocReg(-1, mVUlow.VF_write.reg, 0xf);
SSE_MOVAPS_XMM_to_XMM(t1, t2);
mVU->regAlloc->clearNeeded(t1);
mVU->regAlloc->clearNeeded(t2);
}
else { mVUopL(mVU, 1); incPC(1); doUpperOp(); }
}
// Used by mVUsetupRange // Used by mVUsetupRange
microVUt(void) mVUcheckIsSame(mV) { microVUt(void) mVUcheckIsSame(mV) {
@ -169,14 +167,14 @@ microVUt(void) mVUoptimizePipeState(mV) {
microVUt(void) mVUsetupBranch(mV, int* xStatus, int* xMac, int* xClip, int xCycles) { microVUt(void) mVUsetupBranch(mV, int* xStatus, int* xMac, int* xClip, int xCycles) {
mVUprint("mVUsetupBranch"); mVUprint("mVUsetupBranch");
// Flush Allocated Regs
mVU->regAlloc->flushAll();
// Shuffle Flag Instances // Shuffle Flag Instances
mVUsetupFlags(mVU, xStatus, xMac, xClip, xCycles); mVUsetupFlags(mVU, xStatus, xMac, xClip, xCycles);
// Shuffle P/Q regs since every block starts at instance #0 // Shuffle P/Q regs since every block starts at instance #0
if (mVU->p || mVU->q) { SSE2_PSHUFD_XMM_to_XMM(xmmPQ, xmmPQ, shufflePQ); } if (mVU->p || mVU->q) { SSE2_PSHUFD_XMM_to_XMM(xmmPQ, xmmPQ, shufflePQ); }
// Flush Allocated Regs
mVU->regAlloc->flushAll();
} }
microVUt(void) mVUincCycles(mV, int x) { microVUt(void) mVUincCycles(mV, int x) {
@ -261,6 +259,7 @@ microVUt(void) mVUendProgram(mV, int isEbit, int* xStatus, int* xMac, int* xClip
int fClip = (isEbit) ? findFlagInst(xClip, 0x7fffffff) : cI; int fClip = (isEbit) ? findFlagInst(xClip, 0x7fffffff) : cI;
int qInst = 0; int qInst = 0;
int pInst = 0; int pInst = 0;
mVU->regAlloc->flushAll();
if (isEbit) { if (isEbit) {
mVUprint("mVUcompile ebit"); mVUprint("mVUcompile ebit");
@ -372,6 +371,7 @@ microVUr(void*) mVUcompile(microVU* mVU, u32 startPC, uptr pState) {
mVUsetupRange(mVU, startPC, 1); mVUsetupRange(mVU, startPC, 1);
// Reset regAlloc // Reset regAlloc
mVU->regAlloc->flushAll();
mVU->regAlloc->reset(); mVU->regAlloc->reset();
// First Pass // First Pass
@ -435,8 +435,9 @@ microVUr(void*) mVUcompile(microVU* mVU, u32 startPC, uptr pState) {
if (mVUup.mBit) { OR32ItoM((uptr)&mVU->regs->flags, VUFLAG_MFLAGSET); } if (mVUup.mBit) { OR32ItoM((uptr)&mVU->regs->flags, VUFLAG_MFLAGSET); }
if (mVUlow.isNOP) { incPC(1); doUpperOp(); doIbit(); } if (mVUlow.isNOP) { incPC(1); doUpperOp(); doIbit(); }
else if (!mVUinfo.swapOps) { incPC(1); doUpperOp(); doLowerOp(); } else if (!mVUinfo.swapOps) { incPC(1); doUpperOp(); doLowerOp(); }
else { doSwapOp(); } else { doSwapOp(mVU); }
if (mVUinfo.doXGKICK) { mVU_XGKICK_DELAY(mVU, 1); } if (mVUinfo.doXGKICK) { mVU_XGKICK_DELAY(mVU, 1); }
if (!doRegAlloc) { mVU->regAlloc->flushAll(); }
if (!mVUinfo.isBdelay) { incPC(1); } if (!mVUinfo.isBdelay) { incPC(1); }
else { else {

View File

@ -68,7 +68,6 @@ void mVUdispatcherA(mV) {
SSE_SHUFPS_XMM_to_XMM (xmmT1, xmmT1, 0); SSE_SHUFPS_XMM_to_XMM (xmmT1, xmmT1, 0);
SSE_MOVAPS_XMM_to_M128((uptr)mVU->clipFlag, xmmT1); SSE_MOVAPS_XMM_to_M128((uptr)mVU->clipFlag, xmmT1);
//SSE_MOVAPS_M128_to_XMM(xmmACC, (uptr)&mVU->regs->ACC.UL[0]);
SSE_MOVAPS_M128_to_XMM(xmmT1, (uptr)&mVU->regs->VI[REG_P].UL); SSE_MOVAPS_M128_to_XMM(xmmT1, (uptr)&mVU->regs->VI[REG_P].UL);
SSE_MOVAPS_M128_to_XMM(xmmPQ, (uptr)&mVU->regs->VI[REG_Q].UL); SSE_MOVAPS_M128_to_XMM(xmmPQ, (uptr)&mVU->regs->VI[REG_Q].UL);
SSE_SHUFPS_XMM_to_XMM(xmmPQ, xmmT1, 0); // wzyx = PPQQ SSE_SHUFPS_XMM_to_XMM(xmmPQ, xmmT1, 0); // wzyx = PPQQ
@ -84,9 +83,6 @@ void mVUdispatcherB(mV) {
// Load EE's MXCSR state // Load EE's MXCSR state
SSE_LDMXCSR((uptr)&g_sseMXCSR); SSE_LDMXCSR((uptr)&g_sseMXCSR);
// Save Regs (Other Regs Saved in mVUcompile)
//SSE_MOVAPS_XMM_to_M128((uptr)&mVU->regs->ACC.UL[0], xmmACC);
// __fastcall = The first two DWORD or smaller arguments are passed in ECX and EDX registers; all other arguments are passed right to left. // __fastcall = The first two DWORD or smaller arguments are passed in ECX and EDX registers; all other arguments are passed right to left.
if (!isVU1) { CALLFunc((uptr)mVUcleanUpVU0); } if (!isVU1) { CALLFunc((uptr)mVUcleanUpVU0); }
else { CALLFunc((uptr)mVUcleanUpVU1); } else { CALLFunc((uptr)mVUcleanUpVU1); }

View File

@ -215,9 +215,9 @@ microVUt(void) mVUsetupFlags(mV, int* xStatus, int* xMac, int* xClip, int cycles
if (__Clip) { if (__Clip) {
int bClip[4]; int bClip[4];
sortFlag(xClip, bClip, cycles); sortFlag(xClip, bClip, cycles);
SSE_MOVAPS_M128_to_XMM(xmmT1, (uptr)mVU->clipFlag); SSE_MOVAPS_M128_to_XMM(xmmT2, (uptr)mVU->clipFlag);
SSE_SHUFPS_XMM_to_XMM (xmmT1, xmmT1, shuffleClip); SSE_SHUFPS_XMM_to_XMM (xmmT2, xmmT2, shuffleClip);
SSE_MOVAPS_XMM_to_M128((uptr)mVU->clipFlag, xmmT1); SSE_MOVAPS_XMM_to_M128((uptr)mVU->clipFlag, xmmT2);
} }
} }

View File

@ -150,11 +150,11 @@ struct microIR {
microOp info[pSize/2]; // Info for Instructions in current block microOp info[pSize/2]; // Info for Instructions in current block
microConstInfo constReg[16]; // Simple Const Propagation Info for VI regs within blocks microConstInfo constReg[16]; // Simple Const Propagation Info for VI regs within blocks
u8 branch; u8 branch;
u32 cycles; // Cycles for current block u32 cycles; // Cycles for current block
u32 count; // Number of VU 64bit instructions ran (starts at 0 for each block) u32 count; // Number of VU 64bit instructions ran (starts at 0 for each block)
u32 curPC; // Current PC u32 curPC; // Current PC
u32 startPC; // Start PC for Cur Block u32 startPC; // Start PC for Cur Block
u32 sFlagHack; // Optimize out all Status flag updates if microProgram doesn't use Status flags u32 sFlagHack; // Optimize out all Status flag updates if microProgram doesn't use Status flags
}; };
//------------------------------------------------------------------ //------------------------------------------------------------------
@ -181,7 +181,6 @@ private:
int findFreeRegRec(int startIdx) { int findFreeRegRec(int startIdx) {
for (int i = startIdx; i < xmmTotal; i++) { for (int i = startIdx; i < xmmTotal; i++) {
if (!xmmReg[i].isNeeded) { if (!xmmReg[i].isNeeded) {
if ((i+1) >= xmmTotal) return i;
int x = findFreeRegRec(i+1); int x = findFreeRegRec(i+1);
if (x == -1) return i; if (x == -1) return i;
return ((xmmReg[i].count < xmmReg[x].count) ? i : x); return ((xmmReg[i].count < xmmReg[x].count) ? i : x);
@ -211,9 +210,10 @@ public:
} }
counter = 0; counter = 0;
} }
void flushAll() { void flushAll(bool clearState = 1) {
for (int i = 0; i < xmmTotal; i++) { for (int i = 0; i < xmmTotal; i++) {
writeBackReg(i); writeBackReg(i);
if (clearState) clearReg(i);
} }
} }
void clearReg(int reg) { void clearReg(int reg) {
@ -222,14 +222,17 @@ public:
xmmReg[reg].xyzw = 0; xmmReg[reg].xyzw = 0;
xmmReg[reg].isNeeded = 0; xmmReg[reg].isNeeded = 0;
} }
void writeBackReg(int reg) { void writeBackReg(int reg, bool invalidateRegs = 1) {
if ((xmmReg[reg].reg > 0) && xmmReg[reg].xyzw) { // Reg was modified and not Temp or vf0 if ((xmmReg[reg].reg > 0) && xmmReg[reg].xyzw) { // Reg was modified and not Temp or vf0
if (xmmReg[reg].reg == 32) mVUsaveReg(reg, (uptr)&vuRegs->ACC.UL[0], xmmReg[reg].xyzw, 1); if (xmmReg[reg].reg == 32) mVUsaveReg(reg, (uptr)&vuRegs->ACC.UL[0], xmmReg[reg].xyzw, 1);
else mVUsaveReg(reg, (uptr)&vuRegs->VF[xmmReg[reg].reg].UL[0], xmmReg[reg].xyzw, 1); else mVUsaveReg(reg, (uptr)&vuRegs->VF[xmmReg[reg].reg].UL[0], xmmReg[reg].xyzw, 1);
for (int i = 0; i < xmmTotal; i++) { if (invalidateRegs) {
if (i == reg) continue; for (int i = 0; i < xmmTotal; i++) {
if (xmmReg[i].reg == xmmReg[reg].reg) { if ((i == reg) || xmmReg[i].isNeeded) continue;
clearReg(i); // Invalidate any Cached Regs of same vf Reg if (xmmReg[i].reg == xmmReg[reg].reg) {
if (xmmReg[i].xyzw && xmmReg[i].xyzw < 0xf) DevCon::Error("microVU Error: writeBackReg() [%d]", params xmmReg[i].reg);
clearReg(i); // Invalidate any Cached Regs of same vf Reg
}
} }
} }
if (xmmReg[reg].xyzw == 0xf) { // Make Cached Reg if All Vectors were Modified if (xmmReg[reg].xyzw == 0xf) { // Make Cached Reg if All Vectors were Modified
@ -270,8 +273,8 @@ public:
counter++; counter++;
if (vfLoadReg >= 0) { // Search For Cached Regs if (vfLoadReg >= 0) { // Search For Cached Regs
for (int i = 0; i < xmmTotal; i++) { for (int i = 0; i < xmmTotal; i++) {
if ((xmmReg[i].reg == vfLoadReg) && (!xmmReg[i].xyzw // Reg Was Not Modified if ((xmmReg[i].reg == vfLoadReg) && (!xmmReg[i].xyzw // Reg Was Not Modified
|| (/*!xmmReg[i].isNeeded &&*/ xmmReg[i].reg && (xmmReg[i].xyzw==0xf)))) { // Reg Had All Vectors Modified and != VF0 || (xmmReg[i].reg && (xmmReg[i].xyzw==0xf)))) { // Reg Had All Vectors Modified and != VF0
int z = i; int z = i;
if (vfWriteReg >= 0) { // Reg will be modified if (vfWriteReg >= 0) { // Reg will be modified
if (cloneWrite) { // Clone Reg so as not to use the same Cached Reg if (cloneWrite) { // Clone Reg so as not to use the same Cached Reg
@ -286,7 +289,7 @@ public:
} }
else { // Don't clone reg, but shuffle to adjust for SS ops else { // Don't clone reg, but shuffle to adjust for SS ops
if ((vfLoadReg != vfWriteReg) || (xyzw != 0xf)) { writeBackReg(z); } if ((vfLoadReg != vfWriteReg) || (xyzw != 0xf)) { writeBackReg(z); }
else if (xyzw == 4) SSE2_PSHUFD_XMM_to_XMM(z, i, 1); if (xyzw == 4) SSE2_PSHUFD_XMM_to_XMM(z, i, 1);
else if (xyzw == 2) SSE2_PSHUFD_XMM_to_XMM(z, i, 2); else if (xyzw == 2) SSE2_PSHUFD_XMM_to_XMM(z, i, 2);
else if (xyzw == 1) SSE2_PSHUFD_XMM_to_XMM(z, i, 3); else if (xyzw == 1) SSE2_PSHUFD_XMM_to_XMM(z, i, 3);
} }

View File

@ -46,13 +46,14 @@ mVUop(mVU_DIV) {
pass1 { mVUanalyzeFDIV(mVU, _Fs_, _Fsf_, _Ft_, _Ftf_, 7); } pass1 { mVUanalyzeFDIV(mVU, _Fs_, _Fsf_, _Ft_, _Ftf_, 7); }
pass2 { pass2 {
u8 *ajmp, *bjmp, *cjmp, *djmp; u8 *ajmp, *bjmp, *cjmp, *djmp;
getReg5(xmmFs, _Fs_, _Fsf_); int Fs = mVU->regAlloc->allocReg(_Fs_, 0, (1 << (3 - _Fsf_)));
getReg5(xmmFt, _Ft_, _Ftf_); int Ft = mVU->regAlloc->allocReg(_Ft_, 0, (1 << (3 - _Ftf_)));
int t1 = mVU->regAlloc->allocReg();
testZero(xmmFt, xmmT1, gprT1); // Test if Ft is zero testZero(Ft, t1, gprT1); // Test if Ft is zero
cjmp = JZ8(0); // Skip if not zero cjmp = JZ8(0); // Skip if not zero
testZero(xmmFs, xmmT1, gprT1); // Test if Fs is zero testZero(Fs, t1, gprT1); // Test if Fs is zero
ajmp = JZ8(0); ajmp = JZ8(0);
MOV32ItoM((uptr)&mVU->divFlag, divI); // Set invalid flag (0/0) MOV32ItoM((uptr)&mVU->divFlag, divI); // Set invalid flag (0/0)
bjmp = JMP8(0); bjmp = JMP8(0);
@ -60,20 +61,24 @@ mVUop(mVU_DIV) {
MOV32ItoM((uptr)&mVU->divFlag, divD); // Zero divide (only when not 0/0) MOV32ItoM((uptr)&mVU->divFlag, divD); // Zero divide (only when not 0/0)
x86SetJ8(bjmp); x86SetJ8(bjmp);
SSE_XORPS_XMM_to_XMM (xmmFs, xmmFt); SSE_XORPS_XMM_to_XMM (Fs, Ft);
SSE_ANDPS_M128_to_XMM(xmmFs, (uptr)mVU_signbit); SSE_ANDPS_M128_to_XMM(Fs, (uptr)mVU_signbit);
SSE_ORPS_M128_to_XMM (xmmFs, (uptr)mVU_maxvals); // If division by zero, then xmmFs = +/- fmax SSE_ORPS_M128_to_XMM (Fs, (uptr)mVU_maxvals); // If division by zero, then xmmFs = +/- fmax
djmp = JMP8(0); djmp = JMP8(0);
x86SetJ8(cjmp); x86SetJ8(cjmp);
MOV32ItoM((uptr)&mVU->divFlag, 0); // Clear I/D flags MOV32ItoM((uptr)&mVU->divFlag, 0); // Clear I/D flags
SSE_DIVSS_XMM_to_XMM(xmmFs, xmmFt); SSE_DIVSS_XMM_to_XMM(Fs, Ft);
if (CHECK_VU_OVERFLOW) mVUclamp1(xmmFs, xmmFt, 8); mVUclamp1(Fs, t1, 8);
x86SetJ8(djmp); x86SetJ8(djmp);
if (mVUinfo.writeQ) SSE2_PSHUFD_XMM_to_XMM(xmmPQ, xmmPQ, 0xe1); if (mVUinfo.writeQ) SSE2_PSHUFD_XMM_to_XMM(xmmPQ, xmmPQ, 0xe1);
SSE_MOVSS_XMM_to_XMM(xmmPQ, xmmFs); SSE_MOVSS_XMM_to_XMM(xmmPQ, Fs);
if (mVUinfo.writeQ) SSE2_PSHUFD_XMM_to_XMM(xmmPQ, xmmPQ, 0xe1); if (mVUinfo.writeQ) SSE2_PSHUFD_XMM_to_XMM(xmmPQ, xmmPQ, 0xe1);
mVU->regAlloc->clearNeeded(Fs);
mVU->regAlloc->clearNeeded(Ft);
mVU->regAlloc->clearNeeded(t1);
} }
pass3 { mVUlog("DIV Q, vf%02d%s, vf%02d%s", _Fs_, _Fsf_String, _Ft_, _Ftf_String); } pass3 { mVUlog("DIV Q, vf%02d%s, vf%02d%s", _Fs_, _Fsf_String, _Ft_, _Ftf_String); }
} }
@ -82,16 +87,18 @@ mVUop(mVU_SQRT) {
pass1 { mVUanalyzeFDIV(mVU, 0, 0, _Ft_, _Ftf_, 7); } pass1 { mVUanalyzeFDIV(mVU, 0, 0, _Ft_, _Ftf_, 7); }
pass2 { pass2 {
u8 *ajmp; u8 *ajmp;
getReg5(xmmFt, _Ft_, _Ftf_); int Ft = mVU->regAlloc->allocReg(_Ft_, 0, (1 << (3 - _Ftf_)));
MOV32ItoM((uptr)&mVU->divFlag, 0); // Clear I/D flags MOV32ItoM((uptr)&mVU->divFlag, 0); // Clear I/D flags
testNeg(xmmFt, gprT1, ajmp); // Check for negative sqrt testNeg(Ft, gprT1, ajmp); // Check for negative sqrt
if (CHECK_VU_OVERFLOW) SSE_MINSS_M32_to_XMM(xmmFt, (uptr)mVU_maxvals); // Clamp infinities (only need to do positive clamp since xmmFt is positive) if (CHECK_VU_OVERFLOW) SSE_MINSS_M32_to_XMM(Ft, (uptr)mVU_maxvals); // Clamp infinities (only need to do positive clamp since xmmFt is positive)
SSE_SQRTSS_XMM_to_XMM(xmmFt, xmmFt); SSE_SQRTSS_XMM_to_XMM(Ft, Ft);
if (mVUinfo.writeQ) SSE2_PSHUFD_XMM_to_XMM(xmmPQ, xmmPQ, 0xe1); if (mVUinfo.writeQ) SSE2_PSHUFD_XMM_to_XMM(xmmPQ, xmmPQ, 0xe1);
SSE_MOVSS_XMM_to_XMM(xmmPQ, xmmFt); SSE_MOVSS_XMM_to_XMM(xmmPQ, Ft);
if (mVUinfo.writeQ) SSE2_PSHUFD_XMM_to_XMM(xmmPQ, xmmPQ, 0xe1); if (mVUinfo.writeQ) SSE2_PSHUFD_XMM_to_XMM(xmmPQ, xmmPQ, 0xe1);
mVU->regAlloc->clearNeeded(Ft);
} }
pass3 { mVUlog("SQRT Q, vf%02d%s", _Ft_, _Ftf_String); } pass3 { mVUlog("SQRT Q, vf%02d%s", _Ft_, _Ftf_String); }
} }
@ -100,17 +107,18 @@ mVUop(mVU_RSQRT) {
pass1 { mVUanalyzeFDIV(mVU, _Fs_, _Fsf_, _Ft_, _Ftf_, 13); } pass1 { mVUanalyzeFDIV(mVU, _Fs_, _Fsf_, _Ft_, _Ftf_, 13); }
pass2 { pass2 {
u8 *ajmp, *bjmp, *cjmp, *djmp; u8 *ajmp, *bjmp, *cjmp, *djmp;
getReg5(xmmFs, _Fs_, _Fsf_); int Fs = mVU->regAlloc->allocReg(_Fs_, 0, (1 << (3 - _Fsf_)));
getReg5(xmmFt, _Ft_, _Ftf_); int Ft = mVU->regAlloc->allocReg(_Ft_, 0, (1 << (3 - _Ftf_)));
int t1 = mVU->regAlloc->allocReg();
MOV32ItoM((uptr)&mVU->divFlag, 0); // Clear I/D flags MOV32ItoM((uptr)&mVU->divFlag, 0); // Clear I/D flags
testNeg(xmmFt, gprT1, ajmp); // Check for negative sqrt testNeg(Ft, gprT1, ajmp); // Check for negative sqrt
SSE_SQRTSS_XMM_to_XMM(xmmFt, xmmFt); SSE_SQRTSS_XMM_to_XMM(Ft, Ft);
testZero(xmmFt, xmmT1, gprT1); // Test if Ft is zero testZero(Ft, t1, gprT1); // Test if Ft is zero
ajmp = JZ8(0); // Skip if not zero ajmp = JZ8(0); // Skip if not zero
testZero(xmmFs, xmmT1, gprT1); // Test if Fs is zero testZero(Fs, t1, gprT1); // Test if Fs is zero
bjmp = JZ8(0); // Skip if none are bjmp = JZ8(0); // Skip if none are
MOV32ItoM((uptr)&mVU->divFlag, divI); // Set invalid flag (0/0) MOV32ItoM((uptr)&mVU->divFlag, divI); // Set invalid flag (0/0)
cjmp = JMP8(0); cjmp = JMP8(0);
@ -118,18 +126,22 @@ mVUop(mVU_RSQRT) {
MOV32ItoM((uptr)&mVU->divFlag, divD); // Zero divide flag (only when not 0/0) MOV32ItoM((uptr)&mVU->divFlag, divD); // Zero divide flag (only when not 0/0)
x86SetJ8(cjmp); x86SetJ8(cjmp);
SSE_ANDPS_M128_to_XMM(xmmFs, (uptr)mVU_signbit); SSE_ANDPS_M128_to_XMM(Fs, (uptr)mVU_signbit);
SSE_ORPS_M128_to_XMM (xmmFs, (uptr)mVU_maxvals); // xmmFs = +/-Max SSE_ORPS_M128_to_XMM (Fs, (uptr)mVU_maxvals); // xmmFs = +/-Max
djmp = JMP8(0); djmp = JMP8(0);
x86SetJ8(ajmp); x86SetJ8(ajmp);
SSE_DIVSS_XMM_to_XMM(xmmFs, xmmFt); SSE_DIVSS_XMM_to_XMM(Fs, Ft);
if (CHECK_VU_OVERFLOW) mVUclamp1(xmmFs, xmmFt, 8); mVUclamp1(Fs, t1, 8);
x86SetJ8(djmp); x86SetJ8(djmp);
if (mVUinfo.writeQ) SSE2_PSHUFD_XMM_to_XMM(xmmPQ, xmmPQ, 0xe1); if (mVUinfo.writeQ) SSE2_PSHUFD_XMM_to_XMM(xmmPQ, xmmPQ, 0xe1);
SSE_MOVSS_XMM_to_XMM(xmmPQ, xmmFs); SSE_MOVSS_XMM_to_XMM(xmmPQ, Fs);
if (mVUinfo.writeQ) SSE2_PSHUFD_XMM_to_XMM(xmmPQ, xmmPQ, 0xe1); if (mVUinfo.writeQ) SSE2_PSHUFD_XMM_to_XMM(xmmPQ, xmmPQ, 0xe1);
mVU->regAlloc->clearNeeded(Fs);
mVU->regAlloc->clearNeeded(Ft);
mVU->regAlloc->clearNeeded(t1);
} }
pass3 { mVUlog("RSQRT Q, vf%02d%s, vf%02d%s", _Fs_, _Fsf_String, _Ft_, _Ftf_String); } pass3 { mVUlog("RSQRT Q, vf%02d%s, vf%02d%s", _Fs_, _Fsf_String, _Ft_, _Ftf_String); }
} }
@ -138,21 +150,19 @@ mVUop(mVU_RSQRT) {
// EATAN/EEXP/ELENG/ERCPR/ERLENG/ERSADD/ERSQRT/ESADD/ESIN/ESQRT/ESUM // EATAN/EEXP/ELENG/ERCPR/ERLENG/ERSADD/ERSQRT/ESADD/ESIN/ESQRT/ESUM
//------------------------------------------------------------------ //------------------------------------------------------------------
#define EATANhelper(addr) { \ #define EATANhelper(addr) { \
SSE_MULSS_XMM_to_XMM(xmmT1, xmmFs); \ SSE_MULSS_XMM_to_XMM (t2, Fs); \
SSE_MULSS_XMM_to_XMM(xmmT1, xmmFs); \ SSE_MULSS_XMM_to_XMM (t2, Fs); \
SSE_MOVAPS_XMM_to_XMM(xmmFt, xmmT1); \ SSE_MOVAPS_XMM_to_XMM(t1, t2); \
SSE_MULSS_M32_to_XMM(xmmFt, (uptr)addr); \ SSE_MULSS_M32_to_XMM (t1, (uptr)addr); \
SSE_ADDSS_XMM_to_XMM(xmmPQ, xmmFt); \ SSE_ADDSS_XMM_to_XMM (PQ, t1); \
} }
microVUt(void) mVU_EATAN_(mV) { // ToDo: Can Be Optimized Further? (takes approximately (~115 cycles + mem access time) on a c2d)
microVUt(void) mVU_EATAN_(mV, int PQ, int Fs, int t1, int t2) {
// ToDo: Can Be Optimized Further? (takes approximately (~115 cycles + mem access time) on a c2d) SSE_MOVSS_XMM_to_XMM (PQ, Fs);
SSE_MOVSS_XMM_to_XMM(xmmPQ, xmmFs); SSE_MULSS_M32_to_XMM (PQ, (uptr)mVU_T1);
SSE_MULSS_M32_to_XMM(xmmPQ, (uptr)mVU_T1); SSE_MOVAPS_XMM_to_XMM(t2, Fs);
SSE_MOVAPS_XMM_to_XMM(xmmT1, xmmFs);
EATANhelper(mVU_T2); EATANhelper(mVU_T2);
EATANhelper(mVU_T3); EATANhelper(mVU_T3);
EATANhelper(mVU_T4); EATANhelper(mVU_T4);
@ -160,23 +170,25 @@ microVUt(void) mVU_EATAN_(mV) {
EATANhelper(mVU_T6); EATANhelper(mVU_T6);
EATANhelper(mVU_T7); EATANhelper(mVU_T7);
EATANhelper(mVU_T8); EATANhelper(mVU_T8);
SSE_ADDSS_M32_to_XMM (PQ, (uptr)mVU_Pi4);
SSE_ADDSS_M32_to_XMM(xmmPQ, (uptr)mVU_Pi4); SSE2_PSHUFD_XMM_to_XMM(PQ, PQ, mVUinfo.writeP ? 0x27 : 0xC6);
SSE2_PSHUFD_XMM_to_XMM(xmmPQ, xmmPQ, mVUinfo.writeP ? 0x27 : 0xC6);
} }
mVUop(mVU_EATAN) { mVUop(mVU_EATAN) {
pass1 { mVUanalyzeEFU1(mVU, _Fs_, _Fsf_, 54); } pass1 { mVUanalyzeEFU1(mVU, _Fs_, _Fsf_, 54); }
pass2 { pass2 {
getReg5(xmmFs, _Fs_, _Fsf_); int Fs = mVU->regAlloc->allocReg(_Fs_, 0, (1 << (3 - _Fsf_)));
int t1 = mVU->regAlloc->allocReg();
int t2 = mVU->regAlloc->allocReg();
SSE2_PSHUFD_XMM_to_XMM(xmmPQ, xmmPQ, mVUinfo.writeP ? 0x27 : 0xC6); // Flip xmmPQ to get Valid P instance SSE2_PSHUFD_XMM_to_XMM(xmmPQ, xmmPQ, mVUinfo.writeP ? 0x27 : 0xC6); // Flip xmmPQ to get Valid P instance
SSE_MOVSS_XMM_to_XMM (xmmPQ, Fs);
SSE_MOVSS_XMM_to_XMM(xmmPQ, xmmFs); SSE_SUBSS_M32_to_XMM (Fs, (uptr)mVU_one);
SSE_SUBSS_M32_to_XMM(xmmFs, (uptr)mVU_one); SSE_ADDSS_M32_to_XMM (xmmPQ, (uptr)mVU_one);
SSE_ADDSS_M32_to_XMM(xmmPQ, (uptr)mVU_one); SSE_DIVSS_XMM_to_XMM (Fs, xmmPQ);
SSE_DIVSS_XMM_to_XMM(xmmFs, xmmPQ); mVU_EATAN_(mVU, xmmPQ, Fs, t1, t2);
mVU->regAlloc->clearNeeded(Fs);
mVU_EATAN_(mVU); mVU->regAlloc->clearNeeded(t1);
mVU->regAlloc->clearNeeded(t2);
} }
pass3 { mVUlog("EATAN P"); } pass3 { mVUlog("EATAN P"); }
} }
@ -184,16 +196,19 @@ mVUop(mVU_EATAN) {
mVUop(mVU_EATANxy) { mVUop(mVU_EATANxy) {
pass1 { mVUanalyzeEFU2(mVU, _Fs_, 54); } pass1 { mVUanalyzeEFU2(mVU, _Fs_, 54); }
pass2 { pass2 {
getReg6(xmmFt, _Fs_); int t1 = mVU->regAlloc->allocReg(_Fs_, 0, 0xf);
SSE2_PSHUFD_XMM_to_XMM(xmmFs, xmmFt, 0x01); int Fs = mVU->regAlloc->allocReg();
int t2 = mVU->regAlloc->allocReg();
SSE2_PSHUFD_XMM_to_XMM(Fs, t1, 0x01);
SSE2_PSHUFD_XMM_to_XMM(xmmPQ, xmmPQ, mVUinfo.writeP ? 0x27 : 0xC6); // Flip xmmPQ to get Valid P instance SSE2_PSHUFD_XMM_to_XMM(xmmPQ, xmmPQ, mVUinfo.writeP ? 0x27 : 0xC6); // Flip xmmPQ to get Valid P instance
SSE_MOVSS_XMM_to_XMM (xmmPQ, Fs);
SSE_MOVSS_XMM_to_XMM(xmmPQ, xmmFs); SSE_SUBSS_XMM_to_XMM (Fs, t1); // y-x, not y-1? ><
SSE_SUBSS_XMM_to_XMM(xmmFs, xmmFt); // y-x, not y-1? >< SSE_ADDSS_XMM_to_XMM (t1, xmmPQ);
SSE_ADDSS_XMM_to_XMM(xmmFt, xmmPQ); SSE_DIVSS_XMM_to_XMM (Fs, t1);
SSE_DIVSS_XMM_to_XMM(xmmFs, xmmFt); mVU_EATAN_(mVU, xmmPQ, Fs, t1, t2);
mVU->regAlloc->clearNeeded(Fs);
mVU_EATAN_(mVU); mVU->regAlloc->clearNeeded(t1);
mVU->regAlloc->clearNeeded(t2);
} }
pass3 { mVUlog("EATANxy P"); } pass3 { mVUlog("EATANxy P"); }
} }
@ -201,83 +216,89 @@ mVUop(mVU_EATANxy) {
mVUop(mVU_EATANxz) { mVUop(mVU_EATANxz) {
pass1 { mVUanalyzeEFU2(mVU, _Fs_, 54); } pass1 { mVUanalyzeEFU2(mVU, _Fs_, 54); }
pass2 { pass2 {
getReg6(xmmFt, _Fs_); int t1 = mVU->regAlloc->allocReg(_Fs_, 0, 0xf);
SSE2_PSHUFD_XMM_to_XMM(xmmFs, xmmFt, 0x02); int Fs = mVU->regAlloc->allocReg();
int t2 = mVU->regAlloc->allocReg();
SSE2_PSHUFD_XMM_to_XMM(Fs, t1, 0x02);
SSE2_PSHUFD_XMM_to_XMM(xmmPQ, xmmPQ, mVUinfo.writeP ? 0x27 : 0xC6); // Flip xmmPQ to get Valid P instance SSE2_PSHUFD_XMM_to_XMM(xmmPQ, xmmPQ, mVUinfo.writeP ? 0x27 : 0xC6); // Flip xmmPQ to get Valid P instance
SSE_MOVSS_XMM_to_XMM (xmmPQ, Fs);
SSE_MOVSS_XMM_to_XMM(xmmPQ, xmmFs); SSE_SUBSS_XMM_to_XMM (Fs, t1);
SSE_SUBSS_XMM_to_XMM(xmmFs, xmmFt); SSE_ADDSS_XMM_to_XMM (t1, xmmPQ);
SSE_ADDSS_XMM_to_XMM(xmmFt, xmmPQ); SSE_DIVSS_XMM_to_XMM (Fs, t1);
SSE_DIVSS_XMM_to_XMM(xmmFs, xmmFt); mVU_EATAN_(mVU, xmmPQ, Fs, t1, t2);
mVU->regAlloc->clearNeeded(Fs);
mVU_EATAN_(mVU); mVU->regAlloc->clearNeeded(t1);
mVU->regAlloc->clearNeeded(t2);
} }
pass3 { mVUlog("EATANxz P"); } pass3 { mVUlog("EATANxz P"); }
} }
#define eexpHelper(addr) { \ #define eexpHelper(addr) { \
SSE_MULSS_XMM_to_XMM(xmmT1, xmmFs); \ SSE_MULSS_XMM_to_XMM (t2, Fs); \
SSE_MOVAPS_XMM_to_XMM(xmmFt, xmmT1); \ SSE_MOVAPS_XMM_to_XMM(t1, t2); \
SSE_MULSS_M32_to_XMM(xmmFt, (uptr)addr); \ SSE_MULSS_M32_to_XMM (t1, (uptr)addr); \
SSE_ADDSS_XMM_to_XMM(xmmPQ, xmmFt); \ SSE_ADDSS_XMM_to_XMM (xmmPQ, t1); \
} }
mVUop(mVU_EEXP) { mVUop(mVU_EEXP) {
pass1 { mVUanalyzeEFU1(mVU, _Fs_, _Fsf_, 44); } pass1 { mVUanalyzeEFU1(mVU, _Fs_, _Fsf_, 44); }
pass2 { pass2 {
getReg5(xmmFs, _Fs_, _Fsf_); int Fs = mVU->regAlloc->allocReg(_Fs_, 0, (1 << (3 - _Fsf_)));
int t1 = mVU->regAlloc->allocReg();
int t2 = mVU->regAlloc->allocReg();
SSE2_PSHUFD_XMM_to_XMM(xmmPQ, xmmPQ, mVUinfo.writeP ? 0x27 : 0xC6); // Flip xmmPQ to get Valid P instance SSE2_PSHUFD_XMM_to_XMM(xmmPQ, xmmPQ, mVUinfo.writeP ? 0x27 : 0xC6); // Flip xmmPQ to get Valid P instance
SSE_MOVSS_XMM_to_XMM(xmmPQ, xmmFs); SSE_MOVSS_XMM_to_XMM (xmmPQ, Fs);
SSE_MULSS_M32_to_XMM(xmmPQ, (uptr)mVU_E1); SSE_MULSS_M32_to_XMM (xmmPQ, (uptr)mVU_E1);
SSE_ADDSS_M32_to_XMM(xmmPQ, (uptr)mVU_one); SSE_ADDSS_M32_to_XMM (xmmPQ, (uptr)mVU_one);
SSE_MOVAPS_XMM_to_XMM (t1, Fs);
SSE_MOVAPS_XMM_to_XMM(xmmFt, xmmFs); SSE_MULSS_XMM_to_XMM (t1, Fs);
SSE_MULSS_XMM_to_XMM(xmmFt, xmmFs); SSE_MOVAPS_XMM_to_XMM (t2, t1);
SSE_MOVAPS_XMM_to_XMM(xmmT1, xmmFt); SSE_MULSS_M32_to_XMM (t1, (uptr)mVU_E2);
SSE_MULSS_M32_to_XMM(xmmFt, (uptr)mVU_E2); SSE_ADDSS_XMM_to_XMM (xmmPQ, t1);
SSE_ADDSS_XMM_to_XMM(xmmPQ, xmmFt);
eexpHelper(mVU_E3); eexpHelper(mVU_E3);
eexpHelper(mVU_E4); eexpHelper(mVU_E4);
eexpHelper(mVU_E5); eexpHelper(mVU_E5);
SSE_MULSS_XMM_to_XMM (t2, Fs);
SSE_MULSS_XMM_to_XMM(xmmT1, xmmFs); SSE_MULSS_M32_to_XMM (t2, (uptr)mVU_E6);
SSE_MULSS_M32_to_XMM(xmmT1, (uptr)mVU_E6); SSE_ADDSS_XMM_to_XMM (xmmPQ, t2);
SSE_ADDSS_XMM_to_XMM(xmmPQ, xmmT1); SSE_MULSS_XMM_to_XMM (xmmPQ, xmmPQ);
SSE_MULSS_XMM_to_XMM(xmmPQ, xmmPQ); SSE_MULSS_XMM_to_XMM (xmmPQ, xmmPQ);
SSE_MULSS_XMM_to_XMM(xmmPQ, xmmPQ); SSE_MOVSS_M32_to_XMM (t2, (uptr)mVU_one);
SSE_MOVSS_M32_to_XMM(xmmT1, (uptr)mVU_one); SSE_DIVSS_XMM_to_XMM (t2, xmmPQ);
SSE_DIVSS_XMM_to_XMM(xmmT1, xmmPQ); SSE_MOVSS_XMM_to_XMM (xmmPQ, t2);
SSE_MOVSS_XMM_to_XMM(xmmPQ, xmmT1);
SSE2_PSHUFD_XMM_to_XMM(xmmPQ, xmmPQ, mVUinfo.writeP ? 0x27 : 0xC6); // Flip back SSE2_PSHUFD_XMM_to_XMM(xmmPQ, xmmPQ, mVUinfo.writeP ? 0x27 : 0xC6); // Flip back
mVU->regAlloc->clearNeeded(Fs);
mVU->regAlloc->clearNeeded(t1);
mVU->regAlloc->clearNeeded(t2);
} }
pass3 { mVUlog("EEXP P"); } pass3 { mVUlog("EEXP P"); }
} }
microVUt(void) mVU_sumXYZ() { // sumXYZ(): PQ.x = x ^ 2 + y ^ 2 + z ^ 2
// xmmPQ.x = x ^ 2 + y ^ 2 + z ^ 2 microVUt(void) mVU_sumXYZ(int PQ, int Fs) {
if( cpucaps.hasStreamingSIMD4Extensions ) { if( x86caps.hasStreamingSIMD4Extensions ) {
SSE4_DPPS_XMM_to_XMM(xmmFs, xmmFs, 0x71); SSE4_DPPS_XMM_to_XMM(Fs, Fs, 0x71);
SSE_MOVSS_XMM_to_XMM(xmmPQ, xmmFs); SSE_MOVSS_XMM_to_XMM(PQ, Fs);
} }
else { else {
SSE_MULPS_XMM_to_XMM(xmmFs, xmmFs); // wzyx ^ 2 SSE_MULPS_XMM_to_XMM (Fs, Fs); // wzyx ^ 2
SSE_MOVSS_XMM_to_XMM(xmmPQ, xmmFs); // x ^ 2 SSE_MOVSS_XMM_to_XMM (PQ, Fs); // x ^ 2
SSE2_PSHUFD_XMM_to_XMM(xmmFs, xmmFs, 0xe1); // wzyx -> wzxy SSE2_PSHUFD_XMM_to_XMM(Fs, Fs, 0xe1); // wzyx -> wzxy
SSE_ADDSS_XMM_to_XMM(xmmPQ, xmmFs); // x ^ 2 + y ^ 2 SSE_ADDSS_XMM_to_XMM (PQ, Fs); // x ^ 2 + y ^ 2
SSE2_PSHUFD_XMM_to_XMM(xmmFs, xmmFs, 0xD2); // wzxy -> wxyz SSE2_PSHUFD_XMM_to_XMM(Fs, Fs, 0xD2); // wzxy -> wxyz
SSE_ADDSS_XMM_to_XMM(xmmPQ, xmmFs); // x ^ 2 + y ^ 2 + z ^ 2 SSE_ADDSS_XMM_to_XMM (PQ, Fs); // x ^ 2 + y ^ 2 + z ^ 2
} }
} }
mVUop(mVU_ELENG) { mVUop(mVU_ELENG) {
pass1 { mVUanalyzeEFU2(mVU, _Fs_, 18); } pass1 { mVUanalyzeEFU2(mVU, _Fs_, 18); }
pass2 { pass2 {
getReg6(xmmFs, _Fs_); int Fs = mVU->regAlloc->allocReg(_Fs_, 0, _X_Y_Z_W);
SSE2_PSHUFD_XMM_to_XMM(xmmPQ, xmmPQ, mVUinfo.writeP ? 0x27 : 0xC6); // Flip xmmPQ to get Valid P instance SSE2_PSHUFD_XMM_to_XMM(xmmPQ, xmmPQ, mVUinfo.writeP ? 0x27 : 0xC6); // Flip xmmPQ to get Valid P instance
mVU_sumXYZ(); mVU_sumXYZ(xmmPQ, Fs);
SSE_SQRTSS_XMM_to_XMM(xmmPQ, xmmPQ); SSE_SQRTSS_XMM_to_XMM (xmmPQ, xmmPQ);
SSE2_PSHUFD_XMM_to_XMM(xmmPQ, xmmPQ, mVUinfo.writeP ? 0x27 : 0xC6); // Flip back SSE2_PSHUFD_XMM_to_XMM(xmmPQ, xmmPQ, mVUinfo.writeP ? 0x27 : 0xC6); // Flip back
mVU->regAlloc->clearNeeded(Fs);
} }
pass3 { mVUlog("ELENG P"); } pass3 { mVUlog("ELENG P"); }
} }
@ -285,13 +306,14 @@ mVUop(mVU_ELENG) {
mVUop(mVU_ERCPR) { mVUop(mVU_ERCPR) {
pass1 { mVUanalyzeEFU1(mVU, _Fs_, _Fsf_, 12); } pass1 { mVUanalyzeEFU1(mVU, _Fs_, _Fsf_, 12); }
pass2 { pass2 {
getReg5(xmmFs, _Fs_, _Fsf_); int Fs = mVU->regAlloc->allocReg(_Fs_, 0, (1 << (3 - _Fsf_)));
SSE2_PSHUFD_XMM_to_XMM(xmmPQ, xmmPQ, mVUinfo.writeP ? 0x27 : 0xC6); // Flip xmmPQ to get Valid P instance SSE2_PSHUFD_XMM_to_XMM(xmmPQ, xmmPQ, mVUinfo.writeP ? 0x27 : 0xC6); // Flip xmmPQ to get Valid P instance
SSE_MOVSS_XMM_to_XMM(xmmPQ, xmmFs); SSE_MOVSS_XMM_to_XMM (xmmPQ, Fs);
SSE_MOVSS_M32_to_XMM(xmmFs, (uptr)mVU_one); SSE_MOVSS_M32_to_XMM (Fs, (uptr)mVU_one);
SSE_DIVSS_XMM_to_XMM(xmmFs, xmmPQ); SSE_DIVSS_XMM_to_XMM (Fs, xmmPQ);
SSE_MOVSS_XMM_to_XMM(xmmPQ, xmmFs); SSE_MOVSS_XMM_to_XMM (xmmPQ, Fs);
SSE2_PSHUFD_XMM_to_XMM(xmmPQ, xmmPQ, mVUinfo.writeP ? 0x27 : 0xC6); // Flip back SSE2_PSHUFD_XMM_to_XMM(xmmPQ, xmmPQ, mVUinfo.writeP ? 0x27 : 0xC6); // Flip back
mVU->regAlloc->clearNeeded(Fs);
} }
pass3 { mVUlog("ERCPR P"); } pass3 { mVUlog("ERCPR P"); }
} }
@ -299,14 +321,15 @@ mVUop(mVU_ERCPR) {
mVUop(mVU_ERLENG) { mVUop(mVU_ERLENG) {
pass1 { mVUanalyzeEFU2(mVU, _Fs_, 24); } pass1 { mVUanalyzeEFU2(mVU, _Fs_, 24); }
pass2 { pass2 {
getReg6(xmmFs, _Fs_); int Fs = mVU->regAlloc->allocReg(_Fs_, 0, _X_Y_Z_W);
SSE2_PSHUFD_XMM_to_XMM(xmmPQ, xmmPQ, mVUinfo.writeP ? 0x27 : 0xC6); // Flip xmmPQ to get Valid P instance SSE2_PSHUFD_XMM_to_XMM(xmmPQ, xmmPQ, mVUinfo.writeP ? 0x27 : 0xC6); // Flip xmmPQ to get Valid P instance
mVU_sumXYZ(); mVU_sumXYZ(xmmPQ, Fs);
SSE_SQRTSS_XMM_to_XMM(xmmPQ, xmmPQ); SSE_SQRTSS_XMM_to_XMM (xmmPQ, xmmPQ);
SSE_MOVSS_M32_to_XMM(xmmFs, (uptr)mVU_one); SSE_MOVSS_M32_to_XMM (Fs, (uptr)mVU_one);
SSE_DIVSS_XMM_to_XMM(xmmFs, xmmPQ); SSE_DIVSS_XMM_to_XMM (Fs, xmmPQ);
SSE_MOVSS_XMM_to_XMM(xmmPQ, xmmFs); SSE_MOVSS_XMM_to_XMM (xmmPQ, Fs);
SSE2_PSHUFD_XMM_to_XMM(xmmPQ, xmmPQ, mVUinfo.writeP ? 0x27 : 0xC6); // Flip back SSE2_PSHUFD_XMM_to_XMM(xmmPQ, xmmPQ, mVUinfo.writeP ? 0x27 : 0xC6); // Flip back
mVU->regAlloc->clearNeeded(Fs);
} }
pass3 { mVUlog("ERLENG P"); } pass3 { mVUlog("ERLENG P"); }
} }
@ -314,14 +337,14 @@ mVUop(mVU_ERLENG) {
mVUop(mVU_ERSADD) { mVUop(mVU_ERSADD) {
pass1 { mVUanalyzeEFU2(mVU, _Fs_, 18); } pass1 { mVUanalyzeEFU2(mVU, _Fs_, 18); }
pass2 { pass2 {
getReg6(xmmFs, _Fs_); int Fs = mVU->regAlloc->allocReg(_Fs_, 0, _X_Y_Z_W);
SSE2_PSHUFD_XMM_to_XMM(xmmPQ, xmmPQ, mVUinfo.writeP ? 0x27 : 0xC6); // Flip xmmPQ to get Valid P instance SSE2_PSHUFD_XMM_to_XMM(xmmPQ, xmmPQ, mVUinfo.writeP ? 0x27 : 0xC6); // Flip xmmPQ to get Valid P instance
mVU_sumXYZ(); mVU_sumXYZ(xmmPQ, Fs);
//SSE_RCPSS_XMM_to_XMM(xmmPQ, xmmPQ); // Lower Precision is bad? SSE_MOVSS_M32_to_XMM (Fs, (uptr)mVU_one);
SSE_MOVSS_M32_to_XMM(xmmFs, (uptr)mVU_one); SSE_DIVSS_XMM_to_XMM (Fs, xmmPQ);
SSE_DIVSS_XMM_to_XMM(xmmFs, xmmPQ); SSE_MOVSS_XMM_to_XMM (xmmPQ, Fs);
SSE_MOVSS_XMM_to_XMM(xmmPQ, xmmFs);
SSE2_PSHUFD_XMM_to_XMM(xmmPQ, xmmPQ, mVUinfo.writeP ? 0x27 : 0xC6); // Flip back SSE2_PSHUFD_XMM_to_XMM(xmmPQ, xmmPQ, mVUinfo.writeP ? 0x27 : 0xC6); // Flip back
mVU->regAlloc->clearNeeded(Fs);
} }
pass3 { mVUlog("ERSADD P"); } pass3 { mVUlog("ERSADD P"); }
} }
@ -329,13 +352,14 @@ mVUop(mVU_ERSADD) {
mVUop(mVU_ERSQRT) { mVUop(mVU_ERSQRT) {
pass1 { mVUanalyzeEFU1(mVU, _Fs_, _Fsf_, 18); } pass1 { mVUanalyzeEFU1(mVU, _Fs_, _Fsf_, 18); }
pass2 { pass2 {
getReg5(xmmFs, _Fs_, _Fsf_); int Fs = mVU->regAlloc->allocReg(_Fs_, 0, (1 << (3 - _Fsf_)));
SSE2_PSHUFD_XMM_to_XMM(xmmPQ, xmmPQ, mVUinfo.writeP ? 0x27 : 0xC6); // Flip xmmPQ to get Valid P instance SSE2_PSHUFD_XMM_to_XMM(xmmPQ, xmmPQ, mVUinfo.writeP ? 0x27 : 0xC6); // Flip xmmPQ to get Valid P instance
SSE_SQRTSS_XMM_to_XMM(xmmPQ, xmmFs); SSE_SQRTSS_XMM_to_XMM (xmmPQ, Fs);
SSE_MOVSS_M32_to_XMM(xmmFs, (uptr)mVU_one); SSE_MOVSS_M32_to_XMM (Fs, (uptr)mVU_one);
SSE_DIVSS_XMM_to_XMM(xmmFs, xmmPQ); SSE_DIVSS_XMM_to_XMM (Fs, xmmPQ);
SSE_MOVSS_XMM_to_XMM(xmmPQ, xmmFs); SSE_MOVSS_XMM_to_XMM (xmmPQ, Fs);
SSE2_PSHUFD_XMM_to_XMM(xmmPQ, xmmPQ, mVUinfo.writeP ? 0x27 : 0xC6); // Flip back SSE2_PSHUFD_XMM_to_XMM(xmmPQ, xmmPQ, mVUinfo.writeP ? 0x27 : 0xC6); // Flip back
mVU->regAlloc->clearNeeded(Fs);
} }
pass3 { mVUlog("ERSQRT P"); } pass3 { mVUlog("ERSQRT P"); }
} }
@ -343,43 +367,46 @@ mVUop(mVU_ERSQRT) {
mVUop(mVU_ESADD) { mVUop(mVU_ESADD) {
pass1 { mVUanalyzeEFU2(mVU, _Fs_, 11); } pass1 { mVUanalyzeEFU2(mVU, _Fs_, 11); }
pass2 { pass2 {
getReg6(xmmFs, _Fs_); int Fs = mVU->regAlloc->allocReg(_Fs_, 0, _X_Y_Z_W);
SSE2_PSHUFD_XMM_to_XMM(xmmPQ, xmmPQ, mVUinfo.writeP ? 0x27 : 0xC6); // Flip xmmPQ to get Valid P instance SSE2_PSHUFD_XMM_to_XMM(xmmPQ, xmmPQ, mVUinfo.writeP ? 0x27 : 0xC6); // Flip xmmPQ to get Valid P instance
mVU_sumXYZ(); mVU_sumXYZ(xmmPQ, Fs);
SSE2_PSHUFD_XMM_to_XMM(xmmPQ, xmmPQ, mVUinfo.writeP ? 0x27 : 0xC6); // Flip back SSE2_PSHUFD_XMM_to_XMM(xmmPQ, xmmPQ, mVUinfo.writeP ? 0x27 : 0xC6); // Flip back
mVU->regAlloc->clearNeeded(Fs);
} }
pass3 { mVUlog("ESADD P"); } pass3 { mVUlog("ESADD P"); }
} }
#define esinHelper(addr) { \ #define esinHelper(addr) { \
SSE_MULSS_XMM_to_XMM(xmmT1, xmmFt); \ SSE_MULSS_XMM_to_XMM (t2, t1); \
SSE_MOVAPS_XMM_to_XMM(xmmFs, xmmT1); \ SSE_MOVAPS_XMM_to_XMM(Fs, t2); \
SSE_MULSS_M32_to_XMM(xmmFs, (uptr)addr); \ SSE_MULSS_M32_to_XMM (Fs, (uptr)addr); \
SSE_ADDSS_XMM_to_XMM(xmmPQ, xmmFs); \ SSE_ADDSS_XMM_to_XMM (xmmPQ, Fs); \
} }
mVUop(mVU_ESIN) { mVUop(mVU_ESIN) {
pass1 { mVUanalyzeEFU2(mVU, _Fs_, 29); } pass1 { mVUanalyzeEFU2(mVU, _Fs_, 29); }
pass2 { pass2 {
getReg5(xmmFs, _Fs_, _Fsf_); int Fs = mVU->regAlloc->allocReg(_Fs_, 0, (1 << (3 - _Fsf_)));
int t1 = mVU->regAlloc->allocReg();
int t2 = mVU->regAlloc->allocReg();
SSE2_PSHUFD_XMM_to_XMM(xmmPQ, xmmPQ, mVUinfo.writeP ? 0x27 : 0xC6); // Flip xmmPQ to get Valid P instance SSE2_PSHUFD_XMM_to_XMM(xmmPQ, xmmPQ, mVUinfo.writeP ? 0x27 : 0xC6); // Flip xmmPQ to get Valid P instance
SSE_MOVSS_XMM_to_XMM(xmmPQ, xmmFs); SSE_MOVSS_XMM_to_XMM (xmmPQ, Fs);
//SSE_MULSS_M32_to_XMM(xmmPQ, (uptr)mVU_one); // Multiplying by 1 is redundant? SSE_MOVAPS_XMM_to_XMM (t1, Fs);
SSE_MOVAPS_XMM_to_XMM(xmmFt, xmmFs); SSE_MULSS_XMM_to_XMM (Fs, t1);
SSE_MULSS_XMM_to_XMM(xmmFs, xmmFt); SSE_MOVAPS_XMM_to_XMM (t2, Fs);
SSE_MOVAPS_XMM_to_XMM(xmmT1, xmmFs); SSE_MULSS_XMM_to_XMM (Fs, t1);
SSE_MULSS_XMM_to_XMM(xmmFs, xmmFt); SSE_MOVAPS_XMM_to_XMM (t1, Fs);
SSE_MOVAPS_XMM_to_XMM(xmmFt, xmmFs); SSE_MULSS_M32_to_XMM (Fs, (uptr)mVU_S2);
SSE_MULSS_M32_to_XMM(xmmFs, (uptr)mVU_S2); SSE_ADDSS_XMM_to_XMM (xmmPQ, Fs);
SSE_ADDSS_XMM_to_XMM(xmmPQ, xmmFs);
esinHelper(mVU_S3); esinHelper(mVU_S3);
esinHelper(mVU_S4); esinHelper(mVU_S4);
SSE_MULSS_XMM_to_XMM (t2, t1);
SSE_MULSS_XMM_to_XMM(xmmT1, xmmFt); SSE_MULSS_M32_to_XMM (t2, (uptr)mVU_S5);
SSE_MULSS_M32_to_XMM(xmmT1, (uptr)mVU_S5); SSE_ADDSS_XMM_to_XMM (xmmPQ, t2);
SSE_ADDSS_XMM_to_XMM(xmmPQ, xmmT1);
SSE2_PSHUFD_XMM_to_XMM(xmmPQ, xmmPQ, mVUinfo.writeP ? 0x27 : 0xC6); // Flip back SSE2_PSHUFD_XMM_to_XMM(xmmPQ, xmmPQ, mVUinfo.writeP ? 0x27 : 0xC6); // Flip back
mVU->regAlloc->clearNeeded(Fs);
mVU->regAlloc->clearNeeded(t1);
mVU->regAlloc->clearNeeded(t2);
} }
pass3 { mVUlog("ESIN P"); } pass3 { mVUlog("ESIN P"); }
} }
@ -387,10 +414,11 @@ mVUop(mVU_ESIN) {
mVUop(mVU_ESQRT) { mVUop(mVU_ESQRT) {
pass1 { mVUanalyzeEFU1(mVU, _Fs_, _Fsf_, 12); } pass1 { mVUanalyzeEFU1(mVU, _Fs_, _Fsf_, 12); }
pass2 { pass2 {
getReg5(xmmFs, _Fs_, _Fsf_); int Fs = mVU->regAlloc->allocReg(_Fs_, 0, (1 << (3 - _Fsf_)));
SSE2_PSHUFD_XMM_to_XMM(xmmPQ, xmmPQ, mVUinfo.writeP ? 0x27 : 0xC6); // Flip xmmPQ to get Valid P instance SSE2_PSHUFD_XMM_to_XMM(xmmPQ, xmmPQ, mVUinfo.writeP ? 0x27 : 0xC6); // Flip xmmPQ to get Valid P instance
SSE_SQRTSS_XMM_to_XMM(xmmPQ, xmmFs); SSE_SQRTSS_XMM_to_XMM (xmmPQ, Fs);
SSE2_PSHUFD_XMM_to_XMM(xmmPQ, xmmPQ, mVUinfo.writeP ? 0x27 : 0xC6); // Flip back SSE2_PSHUFD_XMM_to_XMM(xmmPQ, xmmPQ, mVUinfo.writeP ? 0x27 : 0xC6); // Flip back
mVU->regAlloc->clearNeeded(Fs);
} }
pass3 { mVUlog("ESQRT P"); } pass3 { mVUlog("ESQRT P"); }
} }
@ -398,14 +426,17 @@ mVUop(mVU_ESQRT) {
mVUop(mVU_ESUM) { mVUop(mVU_ESUM) {
pass1 { mVUanalyzeEFU2(mVU, _Fs_, 12); } pass1 { mVUanalyzeEFU2(mVU, _Fs_, 12); }
pass2 { pass2 {
getReg6(xmmFs, _Fs_); int Fs = mVU->regAlloc->allocReg(_Fs_, 0, _X_Y_Z_W);
int t1 = mVU->regAlloc->allocReg();
SSE2_PSHUFD_XMM_to_XMM(xmmPQ, xmmPQ, mVUinfo.writeP ? 0x27 : 0xC6); // Flip xmmPQ to get Valid P instance SSE2_PSHUFD_XMM_to_XMM(xmmPQ, xmmPQ, mVUinfo.writeP ? 0x27 : 0xC6); // Flip xmmPQ to get Valid P instance
SSE2_PSHUFD_XMM_to_XMM(xmmFt, xmmFs, 0x1b); SSE2_PSHUFD_XMM_to_XMM(t1, Fs, 0x1b);
SSE_ADDPS_XMM_to_XMM(xmmFs, xmmFt); SSE_ADDPS_XMM_to_XMM (Fs, t1);
SSE2_PSHUFD_XMM_to_XMM(xmmFt, xmmFs, 0x01); SSE2_PSHUFD_XMM_to_XMM(t1, Fs, 0x01);
SSE_ADDSS_XMM_to_XMM(xmmFs, xmmFt); SSE_ADDSS_XMM_to_XMM (Fs, t1);
SSE_MOVSS_XMM_to_XMM(xmmPQ, xmmFs); SSE_MOVSS_XMM_to_XMM (xmmPQ, Fs);
SSE2_PSHUFD_XMM_to_XMM(xmmPQ, xmmPQ, mVUinfo.writeP ? 0x27 : 0xC6); // Flip back SSE2_PSHUFD_XMM_to_XMM(xmmPQ, xmmPQ, mVUinfo.writeP ? 0x27 : 0xC6); // Flip back
mVU->regAlloc->clearNeeded(Fs);
mVU->regAlloc->clearNeeded(t1);
} }
pass3 { mVUlog("ESUM P"); } pass3 { mVUlog("ESUM P"); }
} }
@ -691,11 +722,12 @@ mVUop(mVU_ISUBIU) {
mVUop(mVU_MFIR) { mVUop(mVU_MFIR) {
pass1 { if (!_Ft_) { mVUlow.isNOP = 1; } analyzeVIreg1(_Is_, mVUlow.VI_read[0]); analyzeReg2(_Ft_, mVUlow.VF_write, 1); } pass1 { if (!_Ft_) { mVUlow.isNOP = 1; } analyzeVIreg1(_Is_, mVUlow.VI_read[0]); analyzeReg2(_Ft_, mVUlow.VF_write, 1); }
pass2 { pass2 {
int Ft = mVU->regAlloc->allocReg(-1, _Ft_, _X_Y_Z_W);
mVUallocVIa(mVU, gprT1, _Is_); mVUallocVIa(mVU, gprT1, _Is_);
MOVSX32R16toR(gprT1, gprT1); MOVSX32R16toR(gprT1, gprT1);
SSE2_MOVD_R_to_XMM(xmmT1, gprT1); SSE2_MOVD_R_to_XMM(Ft, gprT1);
if (!_XYZW_SS) { mVUunpack_xyzw(xmmT1, xmmT1, 0); } if (!_XYZW_SS) { mVUunpack_xyzw(Ft, Ft, 0); }
mVUsaveReg(xmmT1, (uptr)&mVU->regs->VF[_Ft_].UL[0], _X_Y_Z_W, 1); mVU->regAlloc->clearNeeded(Ft);
} }
pass3 { mVUlog("MFIR.%s vf%02d, vi%02d", _XYZW_String, _Ft_, _Fs_); } pass3 { mVUlog("MFIR.%s vf%02d, vi%02d", _XYZW_String, _Ft_, _Fs_); }
} }
@ -703,8 +735,9 @@ mVUop(mVU_MFIR) {
mVUop(mVU_MFP) { mVUop(mVU_MFP) {
pass1 { mVUanalyzeMFP(mVU, _Ft_); } pass1 { mVUanalyzeMFP(mVU, _Ft_); }
pass2 { pass2 {
getPreg(xmmFt); int Ft = mVU->regAlloc->allocReg(-1, _Ft_, _X_Y_Z_W);
mVUsaveReg(xmmFt, (uptr)&mVU->regs->VF[_Ft_].UL[0], _X_Y_Z_W, 1); getPreg(Ft);
mVU->regAlloc->clearNeeded(Ft);
} }
pass3 { mVUlog("MFP.%s vf%02d, P", _XYZW_String, _Ft_); } pass3 { mVUlog("MFP.%s vf%02d, P", _XYZW_String, _Ft_); }
} }
@ -712,8 +745,8 @@ mVUop(mVU_MFP) {
mVUop(mVU_MOVE) { mVUop(mVU_MOVE) {
pass1 { mVUanalyzeMOVE(mVU, _Fs_, _Ft_); } pass1 { mVUanalyzeMOVE(mVU, _Fs_, _Ft_); }
pass2 { pass2 {
mVUloadReg(xmmT1, (uptr)&mVU->regs->VF[_Fs_].UL[0], _X_Y_Z_W); int Fs = mVU->regAlloc->allocReg(_Fs_, _Ft_, _X_Y_Z_W);
mVUsaveReg(xmmT1, (uptr)&mVU->regs->VF[_Ft_].UL[0], _X_Y_Z_W, 1); mVU->regAlloc->clearNeeded(Fs);
} }
pass3 { mVUlog("MOVE.%s vf%02d, vf%02d", _XYZW_String, _Ft_, _Fs_); } pass3 { mVUlog("MOVE.%s vf%02d, vf%02d", _XYZW_String, _Ft_, _Fs_); }
} }
@ -721,9 +754,12 @@ mVUop(mVU_MOVE) {
mVUop(mVU_MR32) { mVUop(mVU_MR32) {
pass1 { mVUanalyzeMR32(mVU, _Fs_, _Ft_); } pass1 { mVUanalyzeMR32(mVU, _Fs_, _Ft_); }
pass2 { pass2 {
mVUloadReg(xmmT1, (uptr)&mVU->regs->VF[_Fs_].UL[0], (_X_Y_Z_W == 8) ? 4 : 15); int Fs = mVU->regAlloc->allocReg(_Fs_, 0, 0xf);
if (_X_Y_Z_W != 8) { SSE2_PSHUFD_XMM_to_XMM(xmmT1, xmmT1, 0x39); } int Ft = mVU->regAlloc->allocReg(-1, _Ft_, _X_Y_Z_W);
mVUsaveReg(xmmT1, (uptr)&mVU->regs->VF[_Ft_].UL[0], _X_Y_Z_W, 0); if (_XYZW_SS) mVUunpack_xyzw(Ft, Fs, (_X ? 1 : (_Y ? 2 : (_Z ? 3 : 0))));
else SSE2_PSHUFD_XMM_to_XMM(Ft, Fs, 0x39);
mVU->regAlloc->clearNeeded(Ft);
mVU->regAlloc->clearNeeded(Fs);
} }
pass3 { mVUlog("MR32.%s vf%02d, vf%02d", _XYZW_String, _Ft_, _Fs_); } pass3 { mVUlog("MR32.%s vf%02d, vf%02d", _XYZW_String, _Ft_, _Fs_); }
} }
@ -731,8 +767,10 @@ mVUop(mVU_MR32) {
mVUop(mVU_MTIR) { mVUop(mVU_MTIR) {
pass1 { if (!_It_) { mVUlow.isNOP = 1; } analyzeReg5(_Fs_, _Fsf_, mVUlow.VF_read[0]); analyzeVIreg2(_It_, mVUlow.VI_write, 1); } pass1 { if (!_It_) { mVUlow.isNOP = 1; } analyzeReg5(_Fs_, _Fsf_, mVUlow.VF_read[0]); analyzeVIreg2(_It_, mVUlow.VI_write, 1); }
pass2 { pass2 {
MOVZX32M16toR(gprT1, (uptr)&mVU->regs->VF[_Fs_].UL[_Fsf_]); int Fs = mVU->regAlloc->allocReg(_Fs_, 0, (1 << (3 - _Fsf_)));
SSE2_MOVD_XMM_to_R(gprT1, Fs);
mVUallocVIb(mVU, gprT1, _It_); mVUallocVIb(mVU, gprT1, _It_);
mVU->regAlloc->clearNeeded(Fs);
} }
pass3 { mVUlog("MTIR vi%02d, vf%02d%s", _Ft_, _Fs_, _Fsf_String); } pass3 { mVUlog("MTIR vi%02d, vf%02d%s", _Ft_, _Fs_, _Fsf_String); }
} }
@ -818,7 +856,7 @@ mVUop(mVU_ISWR) {
else { else {
mVUallocVIa(mVU, gprT1, _Is_); mVUallocVIa(mVU, gprT1, _Is_);
mVUallocVIa(mVU, gprT2, _It_); mVUallocVIa(mVU, gprT2, _It_);
mVUaddrFix(mVU, gprT1); mVUaddrFix (mVU, gprT1);
if (_X) MOV32RtoRm(gprT1, gprT2, (uptr)mVU->regs->Mem); if (_X) MOV32RtoRm(gprT1, gprT2, (uptr)mVU->regs->Mem);
if (_Y) MOV32RtoRm(gprT1, gprT2, (uptr)mVU->regs->Mem+4); if (_Y) MOV32RtoRm(gprT1, gprT2, (uptr)mVU->regs->Mem+4);
if (_Z) MOV32RtoRm(gprT1, gprT2, (uptr)mVU->regs->Mem+8); if (_Z) MOV32RtoRm(gprT1, gprT2, (uptr)mVU->regs->Mem+8);
@ -835,17 +873,15 @@ mVUop(mVU_ISWR) {
mVUop(mVU_LQ) { mVUop(mVU_LQ) {
pass1 { mVUanalyzeLQ(mVU, _Ft_, _Is_, 0); } pass1 { mVUanalyzeLQ(mVU, _Ft_, _Is_, 0); }
pass2 { pass2 {
if (!_Is_) { int Ft = mVU->regAlloc->allocReg(-1, _Ft_, _X_Y_Z_W);
mVUloadReg(xmmFt, (uptr)mVU->regs->Mem + getVUmem(_Imm11_), _X_Y_Z_W); if (_Is_) {
mVUsaveReg(xmmFt, (uptr)&mVU->regs->VF[_Ft_].UL[0], _X_Y_Z_W, 1);
}
else {
mVUallocVIa(mVU, gprT1, _Is_); mVUallocVIa(mVU, gprT1, _Is_);
ADD32ItoR(gprT1, _Imm11_); ADD32ItoR(gprT1, _Imm11_);
mVUaddrFix(mVU, gprT1); mVUaddrFix(mVU, gprT1);
mVUloadReg2(xmmFt, gprT1, (uptr)mVU->regs->Mem, _X_Y_Z_W); mVUloadReg2(Ft, gprT1, (uptr)mVU->regs->Mem, _X_Y_Z_W);
mVUsaveReg(xmmFt, (uptr)&mVU->regs->VF[_Ft_].UL[0], _X_Y_Z_W, 1);
} }
else mVUloadReg(Ft, (uptr)mVU->regs->Mem + getVUmem(_Imm11_), _X_Y_Z_W);
mVU->regAlloc->clearNeeded(Ft);
} }
pass3 { mVUlog("LQ.%s vf%02d, vi%02d + %d", _XYZW_String, _Ft_, _Fs_, _Imm11_); } pass3 { mVUlog("LQ.%s vf%02d, vi%02d + %d", _XYZW_String, _Ft_, _Fs_, _Imm11_); }
} }
@ -853,20 +889,22 @@ mVUop(mVU_LQ) {
mVUop(mVU_LQD) { mVUop(mVU_LQD) {
pass1 { mVUanalyzeLQ(mVU, _Ft_, _Is_, 1); } pass1 { mVUanalyzeLQ(mVU, _Ft_, _Is_, 1); }
pass2 { pass2 {
if (!_Is_ && !mVUlow.noWriteVF) { if (_Is_) {
mVUloadReg(xmmFt, (uptr)mVU->regs->Mem, _X_Y_Z_W);
mVUsaveReg(xmmFt, (uptr)&mVU->regs->VF[_Ft_].UL[0], _X_Y_Z_W, 1);
}
else {
mVUallocVIa(mVU, gprT1, _Is_); mVUallocVIa(mVU, gprT1, _Is_);
SUB16ItoR(gprT1, 1); SUB16ItoR(gprT1, 1);
mVUallocVIb(mVU, gprT1, _Is_); mVUallocVIb(mVU, gprT1, _Is_);
if (!mVUlow.noWriteVF) { if (!mVUlow.noWriteVF) {
int Ft = mVU->regAlloc->allocReg(-1, _Ft_, _X_Y_Z_W);
mVUaddrFix(mVU, gprT1); mVUaddrFix(mVU, gprT1);
mVUloadReg2(xmmFt, gprT1, (uptr)mVU->regs->Mem, _X_Y_Z_W); mVUloadReg2(Ft, gprT1, (uptr)mVU->regs->Mem, _X_Y_Z_W);
mVUsaveReg(xmmFt, (uptr)&mVU->regs->VF[_Ft_].UL[0], _X_Y_Z_W, 1); mVU->regAlloc->clearNeeded(Ft);
} }
} }
else if (!mVUlow.noWriteVF) {
int Ft = mVU->regAlloc->allocReg(-1, _Ft_, _X_Y_Z_W);
mVUloadReg(Ft, (uptr)mVU->regs->Mem, _X_Y_Z_W);
mVU->regAlloc->clearNeeded(Ft);
}
} }
pass3 { mVUlog("LQD.%s vf%02d, --vi%02d", _XYZW_String, _Ft_, _Is_); } pass3 { mVUlog("LQD.%s vf%02d, --vi%02d", _XYZW_String, _Ft_, _Is_); }
} }
@ -874,21 +912,23 @@ mVUop(mVU_LQD) {
mVUop(mVU_LQI) { mVUop(mVU_LQI) {
pass1 { mVUanalyzeLQ(mVU, _Ft_, _Is_, 1); } pass1 { mVUanalyzeLQ(mVU, _Ft_, _Is_, 1); }
pass2 { pass2 {
if (!_Is_ && !mVUlow.noWriteVF) { if (_Is_) {
mVUloadReg(xmmFt, (uptr)mVU->regs->Mem, _X_Y_Z_W);
mVUsaveReg(xmmFt, (uptr)&mVU->regs->VF[_Ft_].UL[0], _X_Y_Z_W, 1);
}
else {
mVUallocVIa(mVU, (!mVUlow.noWriteVF) ? gprT1 : gprT2, _Is_); mVUallocVIa(mVU, (!mVUlow.noWriteVF) ? gprT1 : gprT2, _Is_);
if (!mVUlow.noWriteVF) { if (!mVUlow.noWriteVF) {
int Ft = mVU->regAlloc->allocReg(-1, _Ft_, _X_Y_Z_W);
MOV32RtoR(gprT2, gprT1); MOV32RtoR(gprT2, gprT1);
mVUaddrFix(mVU, gprT1); mVUaddrFix(mVU, gprT1);
mVUloadReg2(xmmFt, gprT1, (uptr)mVU->regs->Mem, _X_Y_Z_W); mVUloadReg2(Ft, gprT1, (uptr)mVU->regs->Mem, _X_Y_Z_W);
mVUsaveReg(xmmFt, (uptr)&mVU->regs->VF[_Ft_].UL[0], _X_Y_Z_W, 1); mVU->regAlloc->clearNeeded(Ft);
} }
ADD16ItoR(gprT2, 1); ADD16ItoR(gprT2, 1);
mVUallocVIb(mVU, gprT2, _Is_); mVUallocVIb(mVU, gprT2, _Is_);
} }
else if (!mVUlow.noWriteVF) {
int Ft = mVU->regAlloc->allocReg(-1, _Ft_, _X_Y_Z_W);
mVUloadReg(Ft, (uptr)mVU->regs->Mem, _X_Y_Z_W);
mVU->regAlloc->clearNeeded(Ft);
}
} }
pass3 { mVUlog("LQI.%s vf%02d, vi%02d++", _XYZW_String, _Ft_, _Fs_); } pass3 { mVUlog("LQI.%s vf%02d, vi%02d++", _XYZW_String, _Ft_, _Fs_); }
} }
@ -900,17 +940,15 @@ mVUop(mVU_LQI) {
mVUop(mVU_SQ) { mVUop(mVU_SQ) {
pass1 { mVUanalyzeSQ(mVU, _Fs_, _It_, 0); } pass1 { mVUanalyzeSQ(mVU, _Fs_, _It_, 0); }
pass2 { pass2 {
if (!_It_) { int Fs = mVU->regAlloc->allocReg(_Fs_, 0, _X_Y_Z_W);
getReg7(xmmFs, _Fs_); if (_It_) {
mVUsaveReg(xmmFs, (uptr)mVU->regs->Mem + getVUmem(_Imm11_), _X_Y_Z_W, 1);
}
else {
mVUallocVIa(mVU, gprT1, _It_); mVUallocVIa(mVU, gprT1, _It_);
ADD32ItoR(gprT1, _Imm11_); ADD32ItoR(gprT1, _Imm11_);
mVUaddrFix(mVU, gprT1); mVUaddrFix(mVU, gprT1);
getReg7(xmmFs, _Fs_); mVUsaveReg2(Fs, gprT1, (uptr)mVU->regs->Mem, _X_Y_Z_W);
mVUsaveReg2(xmmFs, gprT1, (uptr)mVU->regs->Mem, _X_Y_Z_W);
} }
else mVUsaveReg(Fs, (uptr)mVU->regs->Mem + getVUmem(_Imm11_), _X_Y_Z_W, 1);
mVU->regAlloc->clearNeeded(Fs);
} }
pass3 { mVUlog("SQ.%s vf%02d, vi%02d + %d", _XYZW_String, _Fs_, _Ft_, _Imm11_); } pass3 { mVUlog("SQ.%s vf%02d, vi%02d + %d", _XYZW_String, _Fs_, _Ft_, _Imm11_); }
} }
@ -918,18 +956,16 @@ mVUop(mVU_SQ) {
mVUop(mVU_SQD) { mVUop(mVU_SQD) {
pass1 { mVUanalyzeSQ(mVU, _Fs_, _It_, 1); } pass1 { mVUanalyzeSQ(mVU, _Fs_, _It_, 1); }
pass2 { pass2 {
if (!_It_) { int Fs = mVU->regAlloc->allocReg(_Fs_, 0, _X_Y_Z_W);
getReg7(xmmFs, _Fs_); if (_It_) {
mVUsaveReg(xmmFs, (uptr)mVU->regs->Mem, _X_Y_Z_W, 1);
}
else {
mVUallocVIa(mVU, gprT1, _It_); mVUallocVIa(mVU, gprT1, _It_);
SUB16ItoR(gprT1, 1); SUB16ItoR(gprT1, 1);
mVUallocVIb(mVU, gprT1, _It_); mVUallocVIb(mVU, gprT1, _It_);
mVUaddrFix(mVU, gprT1); mVUaddrFix(mVU, gprT1);
getReg7(xmmFs, _Fs_); mVUsaveReg2(Fs, gprT1, (uptr)mVU->regs->Mem, _X_Y_Z_W);
mVUsaveReg2(xmmFs, gprT1, (uptr)mVU->regs->Mem, _X_Y_Z_W);
} }
else mVUsaveReg(Fs, (uptr)mVU->regs->Mem, _X_Y_Z_W, 1);
mVU->regAlloc->clearNeeded(Fs);
} }
pass3 { mVUlog("SQD.%s vf%02d, --vi%02d", _XYZW_String, _Fs_, _Ft_); } pass3 { mVUlog("SQD.%s vf%02d, --vi%02d", _XYZW_String, _Fs_, _Ft_); }
} }
@ -937,19 +973,17 @@ mVUop(mVU_SQD) {
mVUop(mVU_SQI) { mVUop(mVU_SQI) {
pass1 { mVUanalyzeSQ(mVU, _Fs_, _It_, 1); } pass1 { mVUanalyzeSQ(mVU, _Fs_, _It_, 1); }
pass2 { pass2 {
if (!_It_) { int Fs = mVU->regAlloc->allocReg(_Fs_, 0, _X_Y_Z_W);
getReg7(xmmFs, _Fs_); if (_It_) {
mVUsaveReg(xmmFs, (uptr)mVU->regs->Mem, _X_Y_Z_W, 1);
}
else {
mVUallocVIa(mVU, gprT1, _It_); mVUallocVIa(mVU, gprT1, _It_);
MOV32RtoR(gprT2, gprT1); MOV32RtoR(gprT2, gprT1);
mVUaddrFix(mVU, gprT1); mVUaddrFix(mVU, gprT1);
getReg7(xmmFs, _Fs_); mVUsaveReg2(Fs, gprT1, (uptr)mVU->regs->Mem, _X_Y_Z_W);
mVUsaveReg2(xmmFs, gprT1, (uptr)mVU->regs->Mem, _X_Y_Z_W);
ADD16ItoR(gprT2, 1); ADD16ItoR(gprT2, 1);
mVUallocVIb(mVU, gprT2, _It_); mVUallocVIb(mVU, gprT2, _It_);
} }
else mVUsaveReg(Fs, (uptr)mVU->regs->Mem, _X_Y_Z_W, 1);
mVU->regAlloc->clearNeeded(Fs);
} }
pass3 { mVUlog("SQI.%s vf%02d, vi%02d++", _XYZW_String, _Fs_, _Ft_); } pass3 { mVUlog("SQI.%s vf%02d, vi%02d++", _XYZW_String, _Fs_, _Ft_); }
} }
@ -962,10 +996,12 @@ mVUop(mVU_RINIT) {
pass1 { mVUanalyzeR1(mVU, _Fs_, _Fsf_); } pass1 { mVUanalyzeR1(mVU, _Fs_, _Fsf_); }
pass2 { pass2 {
if (_Fs_ || (_Fsf_ == 3)) { if (_Fs_ || (_Fsf_ == 3)) {
getReg8(gprT1, _Fs_, _Fsf_); int Fs = mVU->regAlloc->allocReg(_Fs_, 0, (1 << (3 - _Fsf_)));
SSE2_MOVD_XMM_to_R(gprT1, Fs);
AND32ItoR(gprT1, 0x007fffff); AND32ItoR(gprT1, 0x007fffff);
OR32ItoR (gprT1, 0x3f800000); OR32ItoR (gprT1, 0x3f800000);
MOV32RtoM(Rmem, gprT1); MOV32RtoM(Rmem, gprT1);
mVU->regAlloc->clearNeeded(Fs);
} }
else MOV32ItoM(Rmem, 0x3f800000); else MOV32ItoM(Rmem, 0x3f800000);
} }
@ -974,10 +1010,10 @@ mVUop(mVU_RINIT) {
microVUt(void) mVU_RGET_(mV, int Rreg) { microVUt(void) mVU_RGET_(mV, int Rreg) {
if (!mVUlow.noWriteVF) { if (!mVUlow.noWriteVF) {
if (_X) MOV32RtoM((uptr)&mVU->regs->VF[_Ft_].UL[0], Rreg); int Ft = mVU->regAlloc->allocReg(-1, _Ft_, _X_Y_Z_W);
if (_Y) MOV32RtoM((uptr)&mVU->regs->VF[_Ft_].UL[1], Rreg); SSE2_MOVD_R_to_XMM(Ft, Rreg);
if (_Z) MOV32RtoM((uptr)&mVU->regs->VF[_Ft_].UL[2], Rreg); if (!_XYZW_SS) mVUunpack_xyzw(Ft, Ft, 0);
if (_W) MOV32RtoM((uptr)&mVU->regs->VF[_Ft_].UL[3], Rreg); mVU->regAlloc->clearNeeded(Ft);
} }
} }
@ -1016,9 +1052,11 @@ mVUop(mVU_RXOR) {
pass1 { mVUanalyzeR1(mVU, _Fs_, _Fsf_); } pass1 { mVUanalyzeR1(mVU, _Fs_, _Fsf_); }
pass2 { pass2 {
if (_Fs_ || (_Fsf_ == 3)) { if (_Fs_ || (_Fsf_ == 3)) {
getReg8(gprT1, _Fs_, _Fsf_); int Fs = mVU->regAlloc->allocReg(_Fs_, 0, (1 << (3 - _Fsf_)));
SSE2_MOVD_XMM_to_R(gprT1, Fs);
AND32ItoR(gprT1, 0x7fffff); AND32ItoR(gprT1, 0x7fffff);
XOR32RtoM(Rmem, gprT1); XOR32RtoM(Rmem, gprT1);
mVU->regAlloc->clearNeeded(Fs);
} }
} }
pass3 { mVUlog("RXOR R, vf%02d%s", _Fs_, _Fsf_String); } pass3 { mVUlog("RXOR R, vf%02d%s", _Fs_, _Fsf_String); }

View File

@ -80,9 +80,9 @@ declareAllVariables
#define _Z ((mVU->code>>22) & 0x1) #define _Z ((mVU->code>>22) & 0x1)
#define _W ((mVU->code>>21) & 0x1) #define _W ((mVU->code>>21) & 0x1)
#define _XYZW_SS (_X+_Y+_Z+_W==1)
#define _X_Y_Z_W (((mVU->code >> 21 ) & 0xF )) #define _X_Y_Z_W (((mVU->code >> 21 ) & 0xF ))
#define _xyzw_ACC ((_XYZW_SS && !_X) ? 15 : _X_Y_Z_W) #define _XYZW_SS (_X+_Y+_Z+_W==1)
#define _XYZW_SS2 (_XYZW_SS && (_X_Y_Z_W != 8))
#define _bc_ (mVU->code & 0x3) #define _bc_ (mVU->code & 0x3)
#define _bc_x ((mVU->code & 0x3) == 0) #define _bc_x ((mVU->code & 0x3) == 0)
@ -115,13 +115,13 @@ declareAllVariables
#define offsetSS ((_X) ? (0) : ((_Y) ? (4) : ((_Z) ? 8: 12))) #define offsetSS ((_X) ? (0) : ((_Y) ? (4) : ((_Z) ? 8: 12)))
#define offsetReg ((_X) ? (0) : ((_Y) ? (1) : ((_Z) ? 2: 3))) #define offsetReg ((_X) ? (0) : ((_Y) ? (1) : ((_Z) ? 2: 3)))
#define xmmT1 0 // Temp Reg #define xmmT1 0 // Used for regAlloc
#define xmmFs 1 // Holds the Value of Fs (writes back result Fd) #define xmmT2 1 // Used for regAlloc
#define xmmFt 2 // Holds the Value of Ft #define xmmT3 2 // Used for regAlloc
#define xmmT2 3 // Temp Reg? #define xmmT4 3 // Used for regAlloc
#define xmmT3 4 // Temp Reg? #define xmmT5 4 // Used for regAlloc
#define xmmT4 5 // Temp Reg? #define xmmT6 5 // Used for regAlloc
#define xmmACC 6 // Holds ACC #define xmmT7 6 // Used for regAlloc
#define xmmPQ 7 // Holds the Value and Backup Values of P and Q regs #define xmmPQ 7 // Holds the Value and Backup Values of P and Q regs
#define gprT1 0 // Temp Reg #define gprT1 0 // Temp Reg
@ -267,6 +267,9 @@ typedef u32 (__fastcall *mVUCall)(void*, void*);
#define mVUdumpProg 0&& #define mVUdumpProg 0&&
#endif #endif
// Reg Alloc
#define doRegAlloc 1 // Set to 0 to flush every 64bit Instruction (Turns off regAlloc)
// Speed Hacks // Speed Hacks
#define CHECK_VU_CONSTHACK 0 // Only use for GoW (will be slower on other games) #define CHECK_VU_CONSTHACK 0 // Only use for GoW (will be slower on other games)
#define CHECK_VU_FLAGHACK (u32)Config.Hacks.vuFlagHack // (Can cause Infinite loops, SPS, etc...) #define CHECK_VU_FLAGHACK (u32)Config.Hacks.vuFlagHack // (Can cause Infinite loops, SPS, etc...)

View File

@ -24,35 +24,37 @@
// Used for Result Clamping // Used for Result Clamping
void mVUclamp1(int reg, int regT1, int xyzw) { void mVUclamp1(int reg, int regT1, int xyzw) {
switch (xyzw) { if (CHECK_VU_OVERFLOW) {
case 1: case 2: case 4: case 8: switch (xyzw) {
SSE_MINSS_M32_to_XMM(reg, (uptr)mVU_maxvals); case 1: case 2: case 4: case 8:
SSE_MAXSS_M32_to_XMM(reg, (uptr)mVU_minvals); SSE_MINSS_M32_to_XMM(reg, (uptr)mVU_maxvals);
break; SSE_MAXSS_M32_to_XMM(reg, (uptr)mVU_minvals);
default: break;
SSE_MINPS_M128_to_XMM(reg, (uptr)mVU_maxvals); default:
SSE_MAXPS_M128_to_XMM(reg, (uptr)mVU_minvals); SSE_MINPS_M128_to_XMM(reg, (uptr)mVU_maxvals);
break; SSE_MAXPS_M128_to_XMM(reg, (uptr)mVU_minvals);
break;
}
} }
} }
// Used for Operand Clamping // Used for Operand Clamping
void mVUclamp2(int reg, int regT1, int xyzw) { void mVUclamp2(int reg, int regT1, int xyzw) {
if (CHECK_VU_SIGN_OVERFLOW) { if (CHECK_VU_SIGN_OVERFLOW && (regT1 >= 0)) {
switch (xyzw) { switch (xyzw) {
case 1: case 2: case 4: case 8: case 1: case 2: case 4: case 8:
SSE_MOVSS_XMM_to_XMM(regT1, reg); SSE_MOVSS_XMM_to_XMM (regT1, reg);
SSE_ANDPS_M128_to_XMM(regT1, (uptr)mVU_signbit); SSE_ANDPS_M128_to_XMM(regT1, (uptr)mVU_signbit);
SSE_MINSS_M32_to_XMM(reg, (uptr)mVU_maxvals); SSE_MINSS_M32_to_XMM (reg, (uptr)mVU_maxvals);
SSE_MAXSS_M32_to_XMM(reg, (uptr)mVU_minvals); SSE_MAXSS_M32_to_XMM (reg, (uptr)mVU_minvals);
SSE_ORPS_XMM_to_XMM(reg, regT1); SSE_ORPS_XMM_to_XMM (reg, regT1);
break; break;
default: default:
SSE_MOVAPS_XMM_to_XMM(regT1, reg); SSE_MOVAPS_XMM_to_XMM(regT1, reg);
SSE_ANDPS_M128_to_XMM(regT1, (uptr)mVU_signbit); SSE_ANDPS_M128_to_XMM(regT1, (uptr)mVU_signbit);
SSE_MINPS_M128_to_XMM(reg, (uptr)mVU_maxvals); SSE_MINPS_M128_to_XMM(reg, (uptr)mVU_maxvals);
SSE_MAXPS_M128_to_XMM(reg, (uptr)mVU_minvals); SSE_MAXPS_M128_to_XMM(reg, (uptr)mVU_minvals);
SSE_ORPS_XMM_to_XMM(reg, regT1); SSE_ORPS_XMM_to_XMM (reg, regT1);
break; break;
} }
} }
@ -104,7 +106,7 @@ void mVUsaveReg(int reg, uptr offset, int xyzw, bool modXYZW) {
return;*/ return;*/
switch ( xyzw ) { switch ( xyzw ) {
case 5: if (cpucaps.hasStreamingSIMD4Extensions) { case 5: if (x86caps.hasStreamingSIMD4Extensions) {
SSE4_EXTRACTPS_XMM_to_M32(offset+4, reg, 1); SSE4_EXTRACTPS_XMM_to_M32(offset+4, reg, 1);
SSE4_EXTRACTPS_XMM_to_M32(offset+12, reg, 3); SSE4_EXTRACTPS_XMM_to_M32(offset+12, reg, 3);
} }
@ -213,7 +215,7 @@ void mVUsaveReg2(int reg, int gprReg, u32 offset, int xyzw) {
void mVUmergeRegs(int dest, int src, int xyzw, bool modXYZW = 0) { void mVUmergeRegs(int dest, int src, int xyzw, bool modXYZW = 0) {
xyzw &= 0xf; xyzw &= 0xf;
if ( (dest != src) && (xyzw != 0) ) { if ( (dest != src) && (xyzw != 0) ) {
if (cpucaps.hasStreamingSIMD4Extensions && (xyzw != 0x8) && (xyzw != 0xf)) { if (x86caps.hasStreamingSIMD4Extensions && (xyzw != 0x8) && (xyzw != 0xf)) {
if (modXYZW) { if (modXYZW) {
if (xyzw == 1) { SSE4_INSERTPS_XMM_to_XMM(dest, src, _MM_MK_INSERTPS_NDX(0, 3, 0)); return; } if (xyzw == 1) { SSE4_INSERTPS_XMM_to_XMM(dest, src, _MM_MK_INSERTPS_NDX(0, 3, 0)); return; }
else if (xyzw == 2) { SSE4_INSERTPS_XMM_to_XMM(dest, src, _MM_MK_INSERTPS_NDX(0, 2, 0)); return; } else if (xyzw == 2) { SSE4_INSERTPS_XMM_to_XMM(dest, src, _MM_MK_INSERTPS_NDX(0, 2, 0)); return; }
@ -317,67 +319,60 @@ microVUt(void) mVUrestoreRegs(microVU* mVU) {
static const u32 PCSX2_ALIGNED16(MIN_MAX_MASK1[4]) = {0xffffffff, 0x80000000, 0xffffffff, 0x80000000}; static const u32 PCSX2_ALIGNED16(MIN_MAX_MASK1[4]) = {0xffffffff, 0x80000000, 0xffffffff, 0x80000000};
static const u32 PCSX2_ALIGNED16(MIN_MAX_MASK2[4]) = {0x00000000, 0x40000000, 0x00000000, 0x40000000}; static const u32 PCSX2_ALIGNED16(MIN_MAX_MASK2[4]) = {0x00000000, 0x40000000, 0x00000000, 0x40000000};
// Warning: Modifies xmmT1 and xmmT2 // Warning: Modifies t1 and t2
void MIN_MAX_(x86SSERegType to, x86SSERegType from, bool min) { void MIN_MAX_PS(microVU* mVU, int to, int from, int t1, int t2, bool min) {
bool t1b = 0, t2b = 0;
if (t1 < 0) { t1 = mVU->regAlloc->allocReg(); t1b = 1; }
if (t2 < 0) { t2 = mVU->regAlloc->allocReg(); t2b = 1; }
// ZW // ZW
SSE2_PSHUFD_XMM_to_XMM(xmmT1, to, 0xfa); SSE2_PSHUFD_XMM_to_XMM(t1, to, 0xfa);
SSE2_PAND_M128_to_XMM (xmmT1, (uptr)MIN_MAX_MASK1); SSE2_PAND_M128_to_XMM (t1, (uptr)MIN_MAX_MASK1);
SSE2_POR_M128_to_XMM (xmmT1, (uptr)MIN_MAX_MASK2); SSE2_POR_M128_to_XMM (t1, (uptr)MIN_MAX_MASK2);
SSE2_PSHUFD_XMM_to_XMM(xmmT2, from, 0xfa); SSE2_PSHUFD_XMM_to_XMM(t2, from, 0xfa);
SSE2_PAND_M128_to_XMM (xmmT2, (uptr)MIN_MAX_MASK1); SSE2_PAND_M128_to_XMM (t2, (uptr)MIN_MAX_MASK1);
SSE2_POR_M128_to_XMM (xmmT2, (uptr)MIN_MAX_MASK2); SSE2_POR_M128_to_XMM (t2, (uptr)MIN_MAX_MASK2);
if (min) SSE2_MINPD_XMM_to_XMM(xmmT1, xmmT2); if (min) SSE2_MINPD_XMM_to_XMM(t1, t2);
else SSE2_MAXPD_XMM_to_XMM(xmmT1, xmmT2); else SSE2_MAXPD_XMM_to_XMM(t1, t2);
// XY // XY
SSE2_PSHUFD_XMM_to_XMM(xmmT2, from, 0x50); SSE2_PSHUFD_XMM_to_XMM(t2, from, 0x50);
SSE2_PAND_M128_to_XMM (xmmT2, (uptr)MIN_MAX_MASK1); SSE2_PAND_M128_to_XMM (t2, (uptr)MIN_MAX_MASK1);
SSE2_POR_M128_to_XMM (xmmT2, (uptr)MIN_MAX_MASK2); SSE2_POR_M128_to_XMM (t2, (uptr)MIN_MAX_MASK2);
SSE2_PSHUFD_XMM_to_XMM(to, to, 0x50); SSE2_PSHUFD_XMM_to_XMM(to, to, 0x50);
SSE2_PAND_M128_to_XMM (to, (uptr)MIN_MAX_MASK1); SSE2_PAND_M128_to_XMM (to, (uptr)MIN_MAX_MASK1);
SSE2_POR_M128_to_XMM (to, (uptr)MIN_MAX_MASK2); SSE2_POR_M128_to_XMM (to, (uptr)MIN_MAX_MASK2);
if (min) SSE2_MINPD_XMM_to_XMM(to, xmmT2); if (min) SSE2_MINPD_XMM_to_XMM(to, t2);
else SSE2_MAXPD_XMM_to_XMM(to, xmmT2); else SSE2_MAXPD_XMM_to_XMM(to, t2);
SSE_SHUFPS_XMM_to_XMM(to, xmmT1, 0x88); SSE_SHUFPS_XMM_to_XMM(to, t1, 0x88);
if (t1b) mVU->regAlloc->clearNeeded(t1);
if (t2b) mVU->regAlloc->clearNeeded(t2);
} }
// Warning: Modifies from and to's upper 3 vectors // Warning: Modifies from's upper 3 vectors, and t1
void MIN_MAX_SS(x86SSERegType to, x86SSERegType from, bool min) { void MIN_MAX_SS(mV, int to, int from, int t1, bool min) {
bool t1b = 0;
if (t1 < 0) { t1 = mVU->regAlloc->allocReg(); t1b = 1; }
SSE_SHUFPS_XMM_to_XMM (to, from, 0); SSE_SHUFPS_XMM_to_XMM (to, from, 0);
SSE2_PAND_M128_to_XMM (to, (uptr)MIN_MAX_MASK1); SSE2_PAND_M128_to_XMM (to, (uptr)MIN_MAX_MASK1);
SSE2_POR_M128_to_XMM (to, (uptr)MIN_MAX_MASK2); SSE2_POR_M128_to_XMM (to, (uptr)MIN_MAX_MASK2);
SSE2_PSHUFD_XMM_to_XMM(from, to, 0xee); SSE2_PSHUFD_XMM_to_XMM(t1, to, 0xee);
if (min) SSE2_MINPD_XMM_to_XMM(to, from); if (min) SSE2_MINPD_XMM_to_XMM(to, t1);
else SSE2_MAXPD_XMM_to_XMM(to, from); else SSE2_MAXPD_XMM_to_XMM(to, t1);
} if (t1b) mVU->regAlloc->clearNeeded(t1);
void SSE_MAX2PS_XMM_to_XMM(x86SSERegType to, x86SSERegType from) {
if (CHECK_VU_MINMAXHACK) { SSE_MAXPS_XMM_to_XMM(to, from); }
else { MIN_MAX_(to, from, 0); }
}
void SSE_MIN2PS_XMM_to_XMM(x86SSERegType to, x86SSERegType from) {
if (CHECK_VU_MINMAXHACK) { SSE_MINPS_XMM_to_XMM(to, from); }
else { MIN_MAX_(to, from, 1); }
}
void SSE_MAX2SS_XMM_to_XMM(x86SSERegType to, x86SSERegType from) {
if (CHECK_VU_MINMAXHACK) { SSE_MAXSS_XMM_to_XMM(to, from); }
else { MIN_MAX_SS(to, from, 0); }
}
void SSE_MIN2SS_XMM_to_XMM(x86SSERegType to, x86SSERegType from) {
if (CHECK_VU_MINMAXHACK) { SSE_MINSS_XMM_to_XMM(to, from); }
else { MIN_MAX_SS(to, from, 1); }
} }
// Warning: Modifies all vectors in 'to' and 'from', and Modifies xmmT1 and xmmT2 // Warning: Modifies all vectors in 'to' and 'from', and Modifies xmmT1 and xmmT2
void SSE_ADD2SS_XMM_to_XMM(x86SSERegType to, x86SSERegType from) { void ADD_SS(microVU* mVU, int to, int from, int t1, int t2) {
if (!CHECK_VUADDSUBHACK) { SSE_ADDSS_XMM_to_XMM(to, from); return; }
u8 *localptr[8]; u8 *localptr[8];
bool t1b = 0, t2b = 0;
if (t1 < 0) { t1 = mVU->regAlloc->allocReg(); t1b = 1; }
if (t2 < 0) { t2 = mVU->regAlloc->allocReg(); t2b = 1; }
SSE_MOVAPS_XMM_to_XMM(xmmT1, to); SSE_MOVAPS_XMM_to_XMM(t1, to);
SSE_MOVAPS_XMM_to_XMM(xmmT2, from); SSE_MOVAPS_XMM_to_XMM(t2, from);
SSE2_MOVD_XMM_to_R(gprT2, to); SSE2_MOVD_XMM_to_R(gprT2, to);
SHR32ItoR(gprT2, 23); SHR32ItoR(gprT2, 23);
SSE2_MOVD_XMM_to_R(gprT1, from); SSE2_MOVD_XMM_to_R(gprT1, from);
@ -435,15 +430,54 @@ void SSE_ADD2SS_XMM_to_XMM(x86SSERegType to, x86SSERegType from) {
x86SetJ8(localptr[6]); x86SetJ8(localptr[6]);
x86SetJ8(localptr[7]); x86SetJ8(localptr[7]);
SSE_ANDPS_XMM_to_XMM(to, xmmT1); //to contains mask SSE_ANDPS_XMM_to_XMM(to, t1); // to contains mask
SSE_ANDPS_XMM_to_XMM(from, xmmT2); //from contains mask SSE_ANDPS_XMM_to_XMM(from, t2); // from contains mask
SSE_ADDSS_XMM_to_XMM(to, from); SSE_ADDSS_XMM_to_XMM(to, from);
if (t1b) mVU->regAlloc->clearNeeded(t1);
if (t2b) mVU->regAlloc->clearNeeded(t2);
} }
// Note: Wrapper function, Tri-Ace Games just need the SS implementation void SSE_MAXPS(mV, int to, int from, int t1, int t2) {
void SSE_ADD2PS_XMM_to_XMM(x86SSERegType to, x86SSERegType from) { if (CHECK_VU_MINMAXHACK) { SSE_MAXPS_XMM_to_XMM(to, from); }
else { MIN_MAX_PS(mVU, to, from, t1, t2, 0); }
}
void SSE_MINPS(mV, int to, int from, int t1, int t2) {
if (CHECK_VU_MINMAXHACK) { SSE_MINPS_XMM_to_XMM(to, from); }
else { MIN_MAX_PS(mVU, to, from, t1, t2, 1); }
}
void SSE_MAXSS(mV, int to, int from, int t1, int t2) {
if (CHECK_VU_MINMAXHACK) { SSE_MAXSS_XMM_to_XMM(to, from); }
else { MIN_MAX_SS(mVU, to, from, t1, 0); }
}
void SSE_MINSS(mV, int to, int from, int t1, int t2) {
if (CHECK_VU_MINMAXHACK) { SSE_MINSS_XMM_to_XMM(to, from); }
else { MIN_MAX_SS(mVU, to, from, t1, 1); }
}
void SSE_ADD2SS(mV, int to, int from, int t1, int t2) {
if (!CHECK_VUADDSUBHACK) { SSE_ADDSS_XMM_to_XMM(to, from); }
else { ADD_SS(mVU, to, from, t1, t2); }
}
void SSE_ADD2PS(mV, int to, int from, int t1, int t2) {
SSE_ADDPS_XMM_to_XMM(to, from); SSE_ADDPS_XMM_to_XMM(to, from);
} }
void SSE_ADDPS(mV, int to, int from, int t1, int t2) {
SSE_ADDPS_XMM_to_XMM(to, from);
}
void SSE_ADDSS(mV, int to, int from, int t1, int t2) {
SSE_ADDSS_XMM_to_XMM(to, from);
}
void SSE_SUBPS(mV, int to, int from, int t1, int t2) {
SSE_SUBPS_XMM_to_XMM(to, from);
}
void SSE_SUBSS(mV, int to, int from, int t1, int t2) {
SSE_SUBSS_XMM_to_XMM(to, from);
}
void SSE_MULPS(mV, int to, int from, int t1, int t2) {
SSE_MULPS_XMM_to_XMM(to, from);
}
void SSE_MULSS(mV, int to, int from, int t1, int t2) {
SSE_MULSS_XMM_to_XMM(to, from);
}
//------------------------------------------------------------------ //------------------------------------------------------------------
// Micro VU - Custom Quick Search // Micro VU - Custom Quick Search

View File

@ -27,31 +27,33 @@
#define SHIFT_XYZW(gprReg) { if (_XYZW_SS && modXYZW && !_W) { SHL32ItoR(gprReg, ADD_XYZW); } } #define SHIFT_XYZW(gprReg) { if (_XYZW_SS && modXYZW && !_W) { SHL32ItoR(gprReg, ADD_XYZW); } }
// Note: If modXYZW is true, then it adjusts XYZW for Single Scalar operations // Note: If modXYZW is true, then it adjusts XYZW for Single Scalar operations
microVUt(void) mVUupdateFlags(mV, int reg, int regT1, bool modXYZW = 1) { microVUt(void) mVUupdateFlags(mV, int reg, int regT1 = -1, int regT2 = -1, bool modXYZW = 1) {
int sReg, mReg = gprT1, xyzw = _X_Y_Z_W; int sReg, mReg = gprT1, xyzw = _X_Y_Z_W, regT1b = 0, regT2b = 0;
static const u16 flipMask[16] = {0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15}; static const u16 flipMask[16] = {0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15};
//SysPrintf("Status = %d; Mac = %d\n", sFLAG.doFlag, mFLAG.doFlag); //SysPrintf("Status = %d; Mac = %d\n", sFLAG.doFlag, mFLAG.doFlag);
if (mVUsFlagHack) { sFLAG.doFlag = 0; } if (mVUsFlagHack) { sFLAG.doFlag = 0; }
if (!sFLAG.doFlag && !mFLAG.doFlag) { return; } if (!sFLAG.doFlag && !mFLAG.doFlag) { return; }
if (!(!mFLAG.doFlag || (_XYZW_SS && modXYZW))) { if (!(!mFLAG.doFlag || (_XYZW_SS && modXYZW))) {
SSE2_PSHUFD_XMM_to_XMM(reg, reg, 0x1B); // Flip wzyx to xyzw if (regT2 < 0) { regT2 = mVU->regAlloc->allocReg(); regT2b = 1; }
SSE2_PSHUFD_XMM_to_XMM(regT2, reg, 0x1B); // Flip wzyx to xyzw
} }
else regT2 = reg;
if (sFLAG.doFlag) { if (sFLAG.doFlag) {
getFlagReg(sReg, sFLAG.write); // Set sReg to valid GPR by Cur Flag Instance getFlagReg(sReg, sFLAG.write); // Set sReg to valid GPR by Cur Flag Instance
mVUallocSFLAGa(sReg, sFLAG.lastWrite); // Get Prev Status Flag mVUallocSFLAGa(sReg, sFLAG.lastWrite); // Get Prev Status Flag
if (sFLAG.doNonSticky) AND32ItoR(sReg, 0xfffc00ff); // Clear O,U,S,Z flags if (sFLAG.doNonSticky) AND32ItoR(sReg, 0xfffc00ff); // Clear O,U,S,Z flags
} }
if (regT1 < 0) { regT1 = mVU->regAlloc->allocReg(); } if (regT1 < 0) { regT1 = mVU->regAlloc->allocReg(); regT1b = 1; }
//-------------------------Check for Signed flags------------------------------ //-------------------------Check for Signed flags------------------------------
// The following code makes sure the Signed Bit isn't set with Negative Zero // The following code makes sure the Signed Bit isn't set with Negative Zero
SSE_XORPS_XMM_to_XMM (regT1, regT1); // Clear regT2 SSE_XORPS_XMM_to_XMM (regT1, regT1); // Clear regT2
SSE_CMPEQPS_XMM_to_XMM (regT1, reg); // Set all F's if each vector is zero SSE_CMPEQPS_XMM_to_XMM (regT1, regT2); // Set all F's if each vector is zero
SSE_MOVMSKPS_XMM_to_R32(gprT2, regT1); // Used for Zero Flag Calculation SSE_MOVMSKPS_XMM_to_R32(gprT2, regT1); // Used for Zero Flag Calculation
SSE_ANDNPS_XMM_to_XMM (regT1, reg); // Used for Sign Flag Calculation SSE_ANDNPS_XMM_to_XMM (regT1, regT2); // Used for Sign Flag Calculation
SSE_MOVMSKPS_XMM_to_R32(mReg, regT1); // Move the Sign Bits of the t1reg SSE_MOVMSKPS_XMM_to_R32(mReg, regT1); // Move the Sign Bits of the t1reg
AND32ItoR(mReg, AND_XYZW); // Grab "Is Signed" bits from the previous calculation AND32ItoR(mReg, AND_XYZW); // Grab "Is Signed" bits from the previous calculation
SHL32ItoR(mReg, 4 + ADD_XYZW); SHL32ItoR(mReg, 4 + ADD_XYZW);
@ -64,9 +66,6 @@ microVUt(void) mVUupdateFlags(mV, int reg, int regT1, bool modXYZW = 1) {
//-------------------------Write back flags------------------------------ //-------------------------Write back flags------------------------------
if (!(!mFLAG.doFlag || (_XYZW_SS && modXYZW))) {
SSE2_PSHUFD_XMM_to_XMM(reg, reg, 0x1B); // Flip wzyx to xyzw
}
if (mFLAG.doFlag) mVUallocMFLAGb(mVU, mReg, mFLAG.write); // Set Mac Flag if (mFLAG.doFlag) mVUallocMFLAGb(mVU, mReg, mFLAG.write); // Set Mac Flag
if (sFLAG.doFlag) { if (sFLAG.doFlag) {
OR32RtoR (sReg, mReg); OR32RtoR (sReg, mReg);
@ -75,30 +74,34 @@ microVUt(void) mVUupdateFlags(mV, int reg, int regT1, bool modXYZW = 1) {
OR32RtoR (sReg, mReg); OR32RtoR (sReg, mReg);
} }
} }
if (regT1b) mVU->regAlloc->clearNeeded(regT1);
if (regT2b) mVU->regAlloc->clearNeeded(regT2);
} }
//------------------------------------------------------------------ //------------------------------------------------------------------
// Helper Macros and Functions // Helper Macros and Functions
//------------------------------------------------------------------ //------------------------------------------------------------------
static void (*SSE_PS[]) (x86SSERegType, x86SSERegType) = { static void (*SSE_PS[]) (microVU*, int, int, int, int) = {
SSE_ADDPS_XMM_to_XMM, // 0 SSE_ADDPS, // 0
SSE_SUBPS_XMM_to_XMM, // 1 SSE_SUBPS, // 1
SSE_MULPS_XMM_to_XMM, // 2 SSE_MULPS, // 2
SSE_MAXPS_XMM_to_XMM, // 3 SSE_MAXPS, // 3
SSE_MINPS_XMM_to_XMM // 4 SSE_MINPS, // 4
SSE_ADD2PS // 5
}; };
static void (*SSE_SS[]) (x86SSERegType, x86SSERegType) = { static void (*SSE_SS[]) (microVU*, int, int, int, int) = {
SSE_ADDSS_XMM_to_XMM, // 0 SSE_ADDSS, // 0
SSE_SUBSS_XMM_to_XMM, // 1 SSE_SUBSS, // 1
SSE_MULSS_XMM_to_XMM, // 2 SSE_MULSS, // 2
SSE_MAXSS_XMM_to_XMM, // 3 SSE_MAXSS, // 3
SSE_MINSS_XMM_to_XMM // 4 SSE_MINSS, // 4
SSE_ADD2SS // 5
}; };
// Prints Opcode to MicroProgram Logs // Prints Opcode to MicroProgram Logs
void mVU_printOP(microVU* mVU, int opCase, char* opName, bool isACC) { void mVU_printOP(microVU* mVU, int opCase, const char* opName, bool isACC) {
mVUlog(opName); mVUlog(opName);
opCase1 { if (isACC) { mVUlogACC(); } else { mVUlogFd(); } mVUlogFt(); } opCase1 { if (isACC) { mVUlogACC(); } else { mVUlogFd(); } mVUlogFt(); }
opCase2 { if (isACC) { mVUlogACC(); } else { mVUlogFd(); } mVUlogBC(); } opCase2 { if (isACC) { mVUlogACC(); } else { mVUlogFd(); } mVUlogBC(); }
@ -117,161 +120,136 @@ void setupPass1(microVU* mVU, int opCase, bool isACC, bool noFlagUpdate) {
// Sets Up Ft Reg for Normal, BC, I, and Q Cases // Sets Up Ft Reg for Normal, BC, I, and Q Cases
void setupFtReg(microVU* mVU, int& Ft, int opCase) { void setupFtReg(microVU* mVU, int& Ft, int opCase) {
opCase1 { Ft = mVU->regAlloc->allocReg(_Ft_); } opCase1 {
if (_XYZW_SS2) Ft = mVU->regAlloc->allocReg(_Ft_, 0, _X_Y_Z_W);
else Ft = mVU->regAlloc->allocReg(_Ft_);
}
opCase2 { opCase2 {
if (!_XYZW_SS) { int tempFt = mVU->regAlloc->allocReg(_Ft_);
Ft = mVU->regAlloc->allocReg(_Ft_, 0, 0xf); Ft = mVU->regAlloc->allocReg();
mVUunpack_xyzw(Ft, Ft, _bc_); mVUunpack_xyzw(Ft, tempFt, _bc_);
} mVU->regAlloc->clearNeeded(tempFt);
else Ft = mVU->regAlloc->allocReg(_Ft_);
} }
opCase3 { Ft = mVU->regAlloc->allocReg(); getIreg(Ft, 1); } opCase3 { Ft = mVU->regAlloc->allocReg(); getIreg(Ft, 1); }
opCase4 { Ft = mVU->regAlloc->allocReg(); getQreg(Ft); } opCase4 { Ft = mVU->regAlloc->allocReg(); getQreg(Ft); }
} }
// Normal FMAC Opcodes // Normal FMAC Opcodes
void mVU_FMACa(microVU* mVU, int recPass, int opCase, int opType, bool isACC, char* opName) { void mVU_FMACa(microVU* mVU, int recPass, int opCase, int opType, bool isACC, const char* opName) {
pass1 { setupPass1(mVU, opCase, isACC, ((opType == 3) || (opType == 4))); } pass1 { setupPass1(mVU, opCase, isACC, ((opType == 3) || (opType == 4))); }
pass2 { pass2 {
int Fs, Ft, ACC; int Fs, Ft, ACC;
mVU->regAlloc->reset(); // Reset for Testing
setupFtReg(mVU, Ft, opCase); setupFtReg(mVU, Ft, opCase);
if (isACC) { if (isACC) {
ACC = mVU->regAlloc->allocReg((_X_Y_Z_W == 0xf) ? -1 : 32, 32, 0xf, 0);
Fs = mVU->regAlloc->allocReg(_Fs_, 0, _X_Y_Z_W); Fs = mVU->regAlloc->allocReg(_Fs_, 0, _X_Y_Z_W);
if (_XYZW_SS && _X_Y_Z_W != 8) SSE2_PSHUFD_XMM_to_XMM(ACC, ACC, shuffleSS(_X_Y_Z_W)); ACC = mVU->regAlloc->allocReg((_X_Y_Z_W == 0xf) ? -1 : 32, 32, 0xf, 0);
if (_XYZW_SS2) SSE2_PSHUFD_XMM_to_XMM(ACC, ACC, shuffleSS(_X_Y_Z_W));
} }
else { Fs = mVU->regAlloc->allocReg(_Fs_, _Fd_, _X_Y_Z_W); } else { Fs = mVU->regAlloc->allocReg(_Fs_, _Fd_, _X_Y_Z_W); }
opCase1 { if (_XYZW_SS && _X_Y_Z_W != 8) { SSE2_PSHUFD_XMM_to_XMM(Ft, Ft, shuffleSS(_X_Y_Z_W)); } } opCase2 { if (opType == 2) { mVUclamp1(Fs, -1, _X_Y_Z_W); } } // Clamp Needed for alot of games (TOTA, DoM, etc...)
opCase2 { if (_XYZW_SS && (!_bc_x)) { SSE2_PSHUFD_XMM_to_XMM(Ft, Ft, shuffleSS((1 << (3 - _bc_)))); } }
if (_XYZW_SS) SSE_SS[opType](Fs, Ft); if (_XYZW_SS) SSE_SS[opType](mVU, Fs, Ft, -1, -1);
else SSE_PS[opType](Fs, Ft); else SSE_PS[opType](mVU, Fs, Ft, -1, -1);
opCase1 { if (_XYZW_SS && _X_Y_Z_W != 8) { SSE2_PSHUFD_XMM_to_XMM(Ft, Ft, shuffleSS(_X_Y_Z_W)); } }
opCase2 { if (_XYZW_SS && (!_bc_x)) { SSE2_PSHUFD_XMM_to_XMM(Ft, Ft, shuffleSS((1 << (3 - _bc_)))); } }
if (isACC) { if (isACC) {
if (_XYZW_SS) SSE_MOVSS_XMM_to_XMM(ACC, Fs); if (_XYZW_SS) SSE_MOVSS_XMM_to_XMM(ACC, Fs);
else mVUmergeRegs(ACC, Fs, _X_Y_Z_W); else mVUmergeRegs(ACC, Fs, _X_Y_Z_W);
mVUupdateFlags(mVU, ACC, Fs); mVUupdateFlags(mVU, ACC, Fs, ((opCase==2) ? Ft : (((opCase==1) && _XYZW_SS2) ? Ft : -1)));
if (_XYZW_SS && _X_Y_Z_W != 8) SSE2_PSHUFD_XMM_to_XMM(ACC, ACC, shuffleSS(_X_Y_Z_W)); if (_XYZW_SS2) SSE2_PSHUFD_XMM_to_XMM(ACC, ACC, shuffleSS(_X_Y_Z_W));
mVU->regAlloc->clearNeeded(ACC); mVU->regAlloc->clearNeeded(ACC);
} }
else mVUupdateFlags(mVU, Fs, (((opCase==2)&&(!_XYZW_SS)) ? Ft : -1)); else mVUupdateFlags(mVU, Fs, ((opCase==2) ? Ft : -1), (((opCase==1) && _XYZW_SS2) ? Ft : -1));
//if (isACC) SSE_MOVAPS_XMM_to_XMM(xmmACC, ACC); // For Testing
mVU->regAlloc->clearNeeded(Fs); // Always Clear Written Reg First mVU->regAlloc->clearNeeded(Fs); // Always Clear Written Reg First
mVU->regAlloc->clearNeeded(Ft); mVU->regAlloc->clearNeeded(Ft);
mVU->regAlloc->flushAll(); // Flush All for Testing
} }
pass3 { mVU_printOP(mVU, opCase, opName, isACC); } pass3 { mVU_printOP(mVU, opCase, opName, isACC); }
} }
// MADDA/MSUBA Opcodes // MADDA/MSUBA Opcodes
void mVU_FMACb(microVU* mVU, int recPass, int opCase, int opType, char* opName) { void mVU_FMACb(microVU* mVU, int recPass, int opCase, int opType, const char* opName) {
pass1 { setupPass1(mVU, opCase, 1, 0); } pass1 { setupPass1(mVU, opCase, 1, 0); }
pass2 { pass2 {
int Fs, Ft, ACC; int Fs, Ft, ACC;
mVU->regAlloc->reset(); // Reset for Testing
setupFtReg(mVU, Ft, opCase); setupFtReg(mVU, Ft, opCase);
ACC = mVU->regAlloc->allocReg(32, 32, 0xf, 0);
Fs = mVU->regAlloc->allocReg(_Fs_, 0, _X_Y_Z_W); Fs = mVU->regAlloc->allocReg(_Fs_, 0, _X_Y_Z_W);
ACC = mVU->regAlloc->allocReg(32, 32, 0xf, 0);
if (_XYZW_SS && _X_Y_Z_W != 8) { SSE2_PSHUFD_XMM_to_XMM(ACC, ACC, shuffleSS(_X_Y_Z_W)); } if (_XYZW_SS2) { SSE2_PSHUFD_XMM_to_XMM(ACC, ACC, shuffleSS(_X_Y_Z_W)); }
opCase1 { if (_XYZW_SS && _X_Y_Z_W != 8) { SSE2_PSHUFD_XMM_to_XMM(Ft, Ft, shuffleSS(_X_Y_Z_W)); } } opCase2 { mVUclamp1(Fs, -1, _X_Y_Z_W); } // Clamp Needed for alot of games (TOTA, DoM, etc...)
opCase2 { if (_XYZW_SS && (!_bc_x)) { SSE2_PSHUFD_XMM_to_XMM(Ft, Ft, shuffleSS((1 << (3 - _bc_)))); } }
if (_XYZW_SS) SSE_SS[2](Fs, Ft); if (_XYZW_SS) SSE_SS[2](mVU, Fs, Ft, -1, -1);
else SSE_PS[2](Fs, Ft); else SSE_PS[2](mVU, Fs, Ft, -1, -1);
opCase1 { if (_XYZW_SS && _X_Y_Z_W != 8) { SSE2_PSHUFD_XMM_to_XMM(Ft, Ft, shuffleSS(_X_Y_Z_W)); } }
opCase2 { if (_XYZW_SS && (!_bc_x)) { SSE2_PSHUFD_XMM_to_XMM(Ft, Ft, shuffleSS((1 << (3 - _bc_)))); } }
if (_XYZW_SS || _X_Y_Z_W == 0xf) { if (_XYZW_SS || _X_Y_Z_W == 0xf) {
if (_XYZW_SS) SSE_SS[opType](ACC, Fs); if (_XYZW_SS) SSE_SS[opType](mVU, ACC, Fs, -1, -1);
else SSE_PS[opType](ACC, Fs); else SSE_PS[opType](mVU, ACC, Fs, -1, -1);
mVUupdateFlags(mVU, ACC, Fs); mVUupdateFlags(mVU, ACC, Fs, ((opCase==2) ? Ft : (((opCase==1) && _XYZW_SS2) ? Ft : -1)));
if (_XYZW_SS && _X_Y_Z_W != 8) SSE2_PSHUFD_XMM_to_XMM(ACC, ACC, shuffleSS(_X_Y_Z_W)); if (_XYZW_SS && _X_Y_Z_W != 8) SSE2_PSHUFD_XMM_to_XMM(ACC, ACC, shuffleSS(_X_Y_Z_W));
} }
else { else {
int tempACC = mVU->regAlloc->allocReg(); int tempACC = mVU->regAlloc->allocReg();
SSE_MOVAPS_XMM_to_XMM(tempACC, ACC); SSE_MOVAPS_XMM_to_XMM(tempACC, ACC);
SSE_PS[opType](tempACC, Fs); SSE_PS[opType](mVU, tempACC, Fs, -1, -1);
mVUmergeRegs(ACC, tempACC, _X_Y_Z_W); mVUmergeRegs(ACC, tempACC, _X_Y_Z_W);
mVU->regAlloc->clearNeeded(tempACC); mVU->regAlloc->clearNeeded(tempACC);
} }
//SSE_MOVAPS_XMM_to_XMM(xmmACC, ACC); // For Testing
mVU->regAlloc->clearNeeded(ACC); mVU->regAlloc->clearNeeded(ACC);
mVU->regAlloc->clearNeeded(Fs); mVU->regAlloc->clearNeeded(Fs);
mVU->regAlloc->clearNeeded(Ft); mVU->regAlloc->clearNeeded(Ft);
mVU->regAlloc->flushAll(); // Flush All for Testing
} }
pass3 { mVU_printOP(mVU, opCase, opName, 1); } pass3 { mVU_printOP(mVU, opCase, opName, 1); }
} }
// MADD Opcodes // MADD Opcodes
void mVU_FMACc(microVU* mVU, int recPass, int opCase, char* opName) { void mVU_FMACc(microVU* mVU, int recPass, int opCase, const char* opName) {
pass1 { setupPass1(mVU, opCase, 0, 0); } pass1 { setupPass1(mVU, opCase, 0, 0); }
pass2 { pass2 {
int Fs, Ft, ACC; int Fs, Ft, ACC;
mVU->regAlloc->reset(); // Reset for Testing
setupFtReg(mVU, Ft, opCase); setupFtReg(mVU, Ft, opCase);
ACC = mVU->regAlloc->allocReg(32); ACC = mVU->regAlloc->allocReg(32);
Fs = mVU->regAlloc->allocReg(_Fs_, _Fd_, _X_Y_Z_W); Fs = mVU->regAlloc->allocReg(_Fs_, _Fd_, _X_Y_Z_W);
if (_XYZW_SS && _X_Y_Z_W != 8) { SSE2_PSHUFD_XMM_to_XMM(ACC, ACC, shuffleSS(_X_Y_Z_W)); } if (_XYZW_SS2) { SSE2_PSHUFD_XMM_to_XMM(ACC, ACC, shuffleSS(_X_Y_Z_W)); }
opCase1 { if (_XYZW_SS && _X_Y_Z_W != 8) { SSE2_PSHUFD_XMM_to_XMM(Ft, Ft, shuffleSS(_X_Y_Z_W)); } } opCase2 { mVUclamp1(Fs, -1, _X_Y_Z_W); } // Clamp Needed for alot of games (TOTA, DoM, etc...)
opCase2 { if (_XYZW_SS && (!_bc_x)) { SSE2_PSHUFD_XMM_to_XMM(Ft, Ft, shuffleSS((1 << (3 - _bc_)))); } }
if (_XYZW_SS) { SSE_SS[2](Fs, Ft); SSE_SS[0](Fs, ACC); } if (_XYZW_SS) { SSE_SS[2](mVU, Fs, Ft, -1, -1); SSE_SS[0](mVU, Fs, ACC, -1, -1); }
else { SSE_PS[2](Fs, Ft); SSE_PS[0](Fs, ACC); } else { SSE_PS[2](mVU, Fs, Ft, -1, -1); SSE_PS[0](mVU, Fs, ACC, -1, -1); }
mVUupdateFlags(mVU, Fs, -1); if (_XYZW_SS2) { SSE2_PSHUFD_XMM_to_XMM(ACC, ACC, shuffleSS(_X_Y_Z_W)); }
if (_XYZW_SS && _X_Y_Z_W != 8) { SSE2_PSHUFD_XMM_to_XMM(ACC, ACC, shuffleSS(_X_Y_Z_W)); } mVUupdateFlags(mVU, Fs, ((opCase==2) ? Ft : -1), (((opCase==1) && _XYZW_SS2) ? Ft : -1));
opCase1 { if (_XYZW_SS && _X_Y_Z_W != 8) { SSE2_PSHUFD_XMM_to_XMM(Ft, Ft, shuffleSS(_X_Y_Z_W)); } }
opCase2 { if (_XYZW_SS && (!_bc_x)) { SSE2_PSHUFD_XMM_to_XMM(Ft, Ft, shuffleSS((1 << (3 - _bc_)))); } }
mVU->regAlloc->clearNeeded(ACC);
mVU->regAlloc->clearNeeded(Fs); // Always Clear Written Reg First mVU->regAlloc->clearNeeded(Fs); // Always Clear Written Reg First
mVU->regAlloc->clearNeeded(Ft); mVU->regAlloc->clearNeeded(Ft);
mVU->regAlloc->flushAll(); // Flush All for Testing mVU->regAlloc->clearNeeded(ACC);
} }
pass3 { mVU_printOP(mVU, opCase, opName, 0); } pass3 { mVU_printOP(mVU, opCase, opName, 0); }
} }
// MSUB Opcodes // MSUB Opcodes
void mVU_FMACd(microVU* mVU, int recPass, int opCase, char* opName) { void mVU_FMACd(microVU* mVU, int recPass, int opCase, const char* opName) {
pass1 { setupPass1(mVU, opCase, 0, 0); } pass1 { setupPass1(mVU, opCase, 0, 0); }
pass2 { pass2 {
int Fs, Ft, Fd; int Fs, Ft, Fd;
mVU->regAlloc->reset(); // Reset for Testing
setupFtReg(mVU, Ft, opCase); setupFtReg(mVU, Ft, opCase);
Fs = mVU->regAlloc->allocReg(_Fs_, 0, _X_Y_Z_W); Fs = mVU->regAlloc->allocReg(_Fs_, 0, _X_Y_Z_W);
Fd = mVU->regAlloc->allocReg(32, _Fd_, _X_Y_Z_W); Fd = mVU->regAlloc->allocReg(32, _Fd_, _X_Y_Z_W);
opCase1 { if (_XYZW_SS && _X_Y_Z_W != 8) { SSE2_PSHUFD_XMM_to_XMM(Ft, Ft, shuffleSS(_X_Y_Z_W)); } } if (_XYZW_SS) { SSE_SS[2](mVU, Fs, Ft, -1, -1); SSE_SS[1](mVU, Fd, Fs, -1, -1); }
opCase2 { if (_XYZW_SS && (!_bc_x)) { SSE2_PSHUFD_XMM_to_XMM(Ft, Ft, shuffleSS((1 << (3 - _bc_)))); } } else { SSE_PS[2](mVU, Fs, Ft, -1, -1); SSE_PS[1](mVU, Fd, Fs, -1, -1); }
if (_XYZW_SS) { SSE_SS[2](Fs, Ft); SSE_SS[1](Fd, Fs); } mVUupdateFlags(mVU, Fd, Fs, ((opCase==2) ? Ft : (((opCase==1) && _XYZW_SS2) ? Ft : -1)));
else { SSE_PS[2](Fs, Ft); SSE_PS[1](Fd, Fs); }
mVUupdateFlags(mVU, Fd, Fs);
opCase1 { if (_XYZW_SS && _X_Y_Z_W != 8) { SSE2_PSHUFD_XMM_to_XMM(Ft, Ft, shuffleSS(_X_Y_Z_W)); } }
opCase2 { if (_XYZW_SS && (!_bc_x)) { SSE2_PSHUFD_XMM_to_XMM(Ft, Ft, shuffleSS((1 << (3 - _bc_)))); } }
mVU->regAlloc->clearNeeded(Fd); // Always Clear Written Reg First mVU->regAlloc->clearNeeded(Fd); // Always Clear Written Reg First
mVU->regAlloc->clearNeeded(Ft); mVU->regAlloc->clearNeeded(Ft);
mVU->regAlloc->clearNeeded(Fs); mVU->regAlloc->clearNeeded(Fs);
mVU->regAlloc->flushAll(); // Flush All for Testing
} }
pass3 { mVU_printOP(mVU, opCase, opName, 0); } pass3 { mVU_printOP(mVU, opCase, opName, 0); }
} }
@ -281,11 +259,9 @@ mVUop(mVU_ABS) {
pass1 { mVUanalyzeFMAC2(mVU, _Fs_, _Ft_); } pass1 { mVUanalyzeFMAC2(mVU, _Fs_, _Ft_); }
pass2 { pass2 {
if (!_Ft_) return; if (!_Ft_) return;
mVU->regAlloc->reset(); // Reset for Testing int Fs = mVU->regAlloc->allocReg(_Fs_, _Ft_, _X_Y_Z_W, !((_Fs_ == _Ft_) && (_X_Y_Z_W == 0xf)));
int Fs = mVU->regAlloc->allocReg(_Fs_, _Ft_, _X_Y_Z_W, ((_Fs_ == _Ft_) && (_X_Y_Z_W == 0xf)));
SSE_ANDPS_M128_to_XMM(Fs, (uptr)mVU_absclip); SSE_ANDPS_M128_to_XMM(Fs, (uptr)mVU_absclip);
mVU->regAlloc->clearNeeded(Fs); mVU->regAlloc->clearNeeded(Fs);
mVU->regAlloc->flushAll(); // Flush All for Testing
} }
pass3 { mVUlog("ABS"); mVUlogFtFs(); } pass3 { mVUlog("ABS"); mVUlogFtFs(); }
} }
@ -294,18 +270,15 @@ mVUop(mVU_ABS) {
mVUop(mVU_OPMULA) { mVUop(mVU_OPMULA) {
pass1 { mVUanalyzeFMAC1(mVU, 0, _Fs_, _Ft_); } pass1 { mVUanalyzeFMAC1(mVU, 0, _Fs_, _Ft_); }
pass2 { pass2 {
mVU->regAlloc->reset(); // Reset for Testing
int Fs = mVU->regAlloc->allocReg(_Fs_, 32, _X_Y_Z_W);
int Ft = mVU->regAlloc->allocReg(_Ft_, 0, _X_Y_Z_W); int Ft = mVU->regAlloc->allocReg(_Ft_, 0, _X_Y_Z_W);
int Fs = mVU->regAlloc->allocReg(_Fs_, 32, _X_Y_Z_W);
SSE2_PSHUFD_XMM_to_XMM(Fs, Fs, 0xC9); // WXZY SSE2_PSHUFD_XMM_to_XMM(Fs, Fs, 0xC9); // WXZY
SSE2_PSHUFD_XMM_to_XMM(Ft, Ft, 0xD2); // WYXZ SSE2_PSHUFD_XMM_to_XMM(Ft, Ft, 0xD2); // WYXZ
SSE_MULPS_XMM_to_XMM(Fs, Ft); SSE_MULPS_XMM_to_XMM(Fs, Ft);
mVUupdateFlags(mVU, Fs, Ft);
mVU->regAlloc->clearNeeded(Fs);
mVU->regAlloc->clearNeeded(Ft); mVU->regAlloc->clearNeeded(Ft);
mVU->regAlloc->flushAll(); // Flush All for Testing mVUupdateFlags(mVU, Fs);
mVU->regAlloc->clearNeeded(Fs);
} }
pass3 { mVUlog("OPMULA"); mVUlogACC(); mVUlogFt(); } pass3 { mVUlog("OPMULA"); mVUlogACC(); mVUlogFt(); }
} }
@ -314,33 +287,29 @@ mVUop(mVU_OPMULA) {
mVUop(mVU_OPMSUB) { mVUop(mVU_OPMSUB) {
pass1 { mVUanalyzeFMAC1(mVU, _Fd_, _Fs_, _Ft_); } pass1 { mVUanalyzeFMAC1(mVU, _Fd_, _Fs_, _Ft_); }
pass2 { pass2 {
mVU->regAlloc->reset(); // Reset for Testing int Ft = mVU->regAlloc->allocReg(_Ft_, 0, 0xf);
int Ft = mVU->regAlloc->allocReg(_Ft_); int Fs = mVU->regAlloc->allocReg(_Fs_, 0, 0xf);
int Fs = mVU->regAlloc->allocReg(_Fs_, 0, _X_Y_Z_W);
int ACC = mVU->regAlloc->allocReg(32, _Fd_, _X_Y_Z_W); int ACC = mVU->regAlloc->allocReg(32, _Fd_, _X_Y_Z_W);
SSE2_PSHUFD_XMM_to_XMM(Fs, Fs, 0xC9); // WXZY SSE2_PSHUFD_XMM_to_XMM(Fs, Fs, 0xC9); // WXZY
SSE2_PSHUFD_XMM_to_XMM(Ft, Ft, 0xD2); // WYXZ SSE2_PSHUFD_XMM_to_XMM(Ft, Ft, 0xD2); // WYXZ
SSE_MULPS_XMM_to_XMM(Fs, Ft); SSE_MULPS_XMM_to_XMM(Fs, Ft);
SSE_SUBPS_XMM_to_XMM(ACC, Fs); SSE_SUBPS_XMM_to_XMM(ACC, Fs);
mVUupdateFlags(mVU, ACC, Fs);
mVU->regAlloc->clearNeeded(32);
mVU->regAlloc->clearNeeded(Fs); mVU->regAlloc->clearNeeded(Fs);
mVU->regAlloc->clearNeeded(Ft); mVU->regAlloc->clearNeeded(Ft);
mVU->regAlloc->flushAll(); // Flush All for Testing mVUupdateFlags(mVU, ACC);
mVU->regAlloc->clearNeeded(ACC);
} }
pass3 { mVUlog("OPMSUB"); mVUlogFd(); mVUlogFt(); } pass3 { mVUlog("OPMSUB"); mVUlogFd(); mVUlogFt(); }
} }
// FTOI0/FTIO4/FTIO12/FTIO15 Opcodes // FTOI0/FTIO4/FTIO12/FTIO15 Opcodes
void mVU_FTOIx(mP, uptr addr, char* opName) { void mVU_FTOIx(mP, uptr addr, const char* opName) {
pass1 { mVUanalyzeFMAC2(mVU, _Fs_, _Ft_); } pass1 { mVUanalyzeFMAC2(mVU, _Fs_, _Ft_); }
pass2 { pass2 {
if (!_Ft_) return; if (!_Ft_) return;
mVU->regAlloc->reset(); // Reset for Testing int Fs = mVU->regAlloc->allocReg(_Fs_, _Ft_, _X_Y_Z_W, !((_Fs_ == _Ft_) && (_X_Y_Z_W == 0xf)));
int Fs = mVU->regAlloc->allocReg(_Fs_, _Ft_, _X_Y_Z_W, ((_Fs_ == _Ft_) && (_X_Y_Z_W == 0xf)));
int t1 = mVU->regAlloc->allocReg(); int t1 = mVU->regAlloc->allocReg();
int t2 = mVU->regAlloc->allocReg(); int t2 = mVU->regAlloc->allocReg();
@ -358,25 +327,22 @@ void mVU_FTOIx(mP, uptr addr, char* opName) {
mVU->regAlloc->clearNeeded(Fs); mVU->regAlloc->clearNeeded(Fs);
mVU->regAlloc->clearNeeded(t1); mVU->regAlloc->clearNeeded(t1);
mVU->regAlloc->clearNeeded(t2); mVU->regAlloc->clearNeeded(t2);
mVU->regAlloc->flushAll(); // Flush All for Testing
} }
pass3 { mVUlog(opName); mVUlogFtFs(); } pass3 { mVUlog(opName); mVUlogFtFs(); }
} }
// ITOF0/ITOF4/ITOF12/ITOF15 Opcodes // ITOF0/ITOF4/ITOF12/ITOF15 Opcodes
void mVU_ITOFx(mP, uptr addr, char* opName) { void mVU_ITOFx(mP, uptr addr, const char* opName) {
pass1 { mVUanalyzeFMAC2(mVU, _Fs_, _Ft_); } pass1 { mVUanalyzeFMAC2(mVU, _Fs_, _Ft_); }
pass2 { pass2 {
if (!_Ft_) return; if (!_Ft_) return;
mVU->regAlloc->reset(); // Reset for Testing int Fs = mVU->regAlloc->allocReg(_Fs_, _Ft_, _X_Y_Z_W, !((_Fs_ == _Ft_) && (_X_Y_Z_W == 0xf)));
int Fs = mVU->regAlloc->allocReg(_Fs_, _Ft_, _X_Y_Z_W, ((_Fs_ == _Ft_) && (_X_Y_Z_W == 0xf)));
SSE2_CVTDQ2PS_XMM_to_XMM(Fs, Fs); SSE2_CVTDQ2PS_XMM_to_XMM(Fs, Fs);
if (addr) { SSE_MULPS_M128_to_XMM(Fs, addr); } if (addr) { SSE_MULPS_M128_to_XMM(Fs, addr); }
//mVUclamp2(Fs, xmmT1, 15); // Clamp (not sure if this is needed) //mVUclamp2(Fs, xmmT1, 15); // Clamp (not sure if this is needed)
mVU->regAlloc->clearNeeded(Fs); mVU->regAlloc->clearNeeded(Fs);
mVU->regAlloc->flushAll(); // Flush All for Testing
} }
pass3 { mVUlog(opName); mVUlogFtFs(); } pass3 { mVUlog(opName); mVUlogFtFs(); }
} }
@ -385,9 +351,8 @@ void mVU_ITOFx(mP, uptr addr, char* opName) {
mVUop(mVU_CLIP) { mVUop(mVU_CLIP) {
pass1 { mVUanalyzeFMAC4(mVU, _Fs_, _Ft_); } pass1 { mVUanalyzeFMAC4(mVU, _Fs_, _Ft_); }
pass2 { pass2 {
mVU->regAlloc->reset(); // Reset for Testing int Fs = mVU->regAlloc->allocReg(_Fs_, 0, 0xf);
int Fs = mVU->regAlloc->allocReg(_Fs_); int Ft = mVU->regAlloc->allocReg(_Ft_, 0, 0x1);
int Ft = mVU->regAlloc->allocReg(_Ft_, 0, 1);
int t1 = mVU->regAlloc->allocReg(); int t1 = mVU->regAlloc->allocReg();
mVUunpack_xyzw(Ft, Ft, 0); mVUunpack_xyzw(Ft, Ft, 0);
@ -419,7 +384,6 @@ mVUop(mVU_CLIP) {
mVU->regAlloc->clearNeeded(Fs); mVU->regAlloc->clearNeeded(Fs);
mVU->regAlloc->clearNeeded(Ft); mVU->regAlloc->clearNeeded(Ft);
mVU->regAlloc->clearNeeded(t1); mVU->regAlloc->clearNeeded(t1);
mVU->regAlloc->flushAll(); // Flush All for Testing
} }
pass3 { mVUlog("CLIP"); mVUlogCLIP(); } pass3 { mVUlog("CLIP"); mVUlogCLIP(); }
} }
@ -429,7 +393,7 @@ mVUop(mVU_CLIP) {
//------------------------------------------------------------------ //------------------------------------------------------------------
mVUop(mVU_ADD) { mVU_FMACa(mVU, recPass, 1, 0, 0, "ADD"); } mVUop(mVU_ADD) { mVU_FMACa(mVU, recPass, 1, 0, 0, "ADD"); }
mVUop(mVU_ADDi) { mVU_FMACa(mVU, recPass, 3, 0, 0, "ADDi"); } mVUop(mVU_ADDi) { mVU_FMACa(mVU, recPass, 3, 5, 0, "ADDi"); }
mVUop(mVU_ADDq) { mVU_FMACa(mVU, recPass, 4, 0, 0, "ADDq"); } mVUop(mVU_ADDq) { mVU_FMACa(mVU, recPass, 4, 0, 0, "ADDq"); }
mVUop(mVU_ADDx) { mVU_FMACa(mVU, recPass, 2, 0, 0, "ADDx"); } mVUop(mVU_ADDx) { mVU_FMACa(mVU, recPass, 2, 0, 0, "ADDx"); }
mVUop(mVU_ADDy) { mVU_FMACa(mVU, recPass, 2, 0, 0, "ADDy"); } mVUop(mVU_ADDy) { mVU_FMACa(mVU, recPass, 2, 0, 0, "ADDy"); }

View File

@ -1560,7 +1560,7 @@ void recVUMI_WAITP(VURegs *VU, int info)
void vuSqSumXYZ(int regd, int regs, int regtemp) // regd.x = x ^ 2 + y ^ 2 + z ^ 2 void vuSqSumXYZ(int regd, int regs, int regtemp) // regd.x = x ^ 2 + y ^ 2 + z ^ 2
{ {
//Console::WriteLn("VU: SUMXYZ"); //Console::WriteLn("VU: SUMXYZ");
if( cpucaps.hasStreamingSIMD4Extensions ) if( x86caps.hasStreamingSIMD4Extensions )
{ {
SSE_MOVAPS_XMM_to_XMM(regd, regs); SSE_MOVAPS_XMM_to_XMM(regd, regs);
if (CHECK_VU_EXTRA_OVERFLOW) vuFloat2(regd, regtemp, 0xf); if (CHECK_VU_EXTRA_OVERFLOW) vuFloat2(regd, regtemp, 0xf);
@ -1572,7 +1572,7 @@ void vuSqSumXYZ(int regd, int regs, int regtemp) // regd.x = x ^ 2 + y ^ 2 + z
if (CHECK_VU_EXTRA_OVERFLOW) vuFloat2(regtemp, regd, 0xf); if (CHECK_VU_EXTRA_OVERFLOW) vuFloat2(regtemp, regd, 0xf);
SSE_MULPS_XMM_to_XMM(regtemp, regtemp); // xyzw ^ 2 SSE_MULPS_XMM_to_XMM(regtemp, regtemp); // xyzw ^ 2
if( cpucaps.hasStreamingSIMD3Extensions ) { if( x86caps.hasStreamingSIMD3Extensions ) {
SSE3_HADDPS_XMM_to_XMM(regd, regtemp); SSE3_HADDPS_XMM_to_XMM(regd, regtemp);
SSE_ADDPS_XMM_to_XMM(regd, regtemp); // regd.z = x ^ 2 + y ^ 2 + z ^ 2 SSE_ADDPS_XMM_to_XMM(regd, regtemp); // regd.z = x ^ 2 + y ^ 2 + z ^ 2
SSE_MOVHLPS_XMM_to_XMM(regd, regd); // regd.x = regd.z SSE_MOVHLPS_XMM_to_XMM(regd, regd); // regd.x = regd.z
@ -1721,7 +1721,7 @@ void recVUMI_ESUM( VURegs *VU, int info )
//Console::WriteLn("VU: ESUM"); //Console::WriteLn("VU: ESUM");
assert( VU == &VU1 ); assert( VU == &VU1 );
if( cpucaps.hasStreamingSIMD3Extensions ) { if( x86caps.hasStreamingSIMD3Extensions ) {
SSE_MOVAPS_XMM_to_XMM(EEREC_TEMP, EEREC_S); SSE_MOVAPS_XMM_to_XMM(EEREC_TEMP, EEREC_S);
if (CHECK_VU_EXTRA_OVERFLOW) vuFloat_useEAX(info, EEREC_TEMP, 0xf); if (CHECK_VU_EXTRA_OVERFLOW) vuFloat_useEAX(info, EEREC_TEMP, 0xf);
SSE3_HADDPS_XMM_to_XMM(EEREC_TEMP, EEREC_TEMP); SSE3_HADDPS_XMM_to_XMM(EEREC_TEMP, EEREC_TEMP);

View File

@ -748,11 +748,11 @@ void _unpackVFSS_xyzw(int dstreg, int srcreg, int xyzw)
{ {
switch (xyzw) { switch (xyzw) {
case 0: SSE_MOVSS_XMM_to_XMM(dstreg, srcreg); break; case 0: SSE_MOVSS_XMM_to_XMM(dstreg, srcreg); break;
case 1: if ( cpucaps.hasStreamingSIMD4Extensions ) SSE4_INSERTPS_XMM_to_XMM(dstreg, srcreg, _MM_MK_INSERTPS_NDX(1, 0, 0)); case 1: if ( x86caps.hasStreamingSIMD4Extensions ) SSE4_INSERTPS_XMM_to_XMM(dstreg, srcreg, _MM_MK_INSERTPS_NDX(1, 0, 0));
else SSE2_PSHUFLW_XMM_to_XMM(dstreg, srcreg, 0xee); else SSE2_PSHUFLW_XMM_to_XMM(dstreg, srcreg, 0xee);
break; break;
case 2: SSE_MOVHLPS_XMM_to_XMM(dstreg, srcreg); break; case 2: SSE_MOVHLPS_XMM_to_XMM(dstreg, srcreg); break;
case 3: if ( cpucaps.hasStreamingSIMD4Extensions ) SSE4_INSERTPS_XMM_to_XMM(dstreg, srcreg, _MM_MK_INSERTPS_NDX(3, 0, 0)); case 3: if ( x86caps.hasStreamingSIMD4Extensions ) SSE4_INSERTPS_XMM_to_XMM(dstreg, srcreg, _MM_MK_INSERTPS_NDX(3, 0, 0));
else { SSE_MOVHLPS_XMM_to_XMM(dstreg, srcreg); SSE2_PSHUFLW_XMM_to_XMM(dstreg, dstreg, 0xee); } else { SSE_MOVHLPS_XMM_to_XMM(dstreg, srcreg); SSE2_PSHUFLW_XMM_to_XMM(dstreg, dstreg, 0xee); }
break; break;
} }
@ -959,7 +959,7 @@ static VUMERGEFN s_VuMerge2[16] = {
void VU_MERGE_REGS_CUSTOM(int dest, int src, int xyzw) { void VU_MERGE_REGS_CUSTOM(int dest, int src, int xyzw) {
xyzw &= 0xf; xyzw &= 0xf;
if ( (dest != src) && (xyzw != 0) ) { if ( (dest != src) && (xyzw != 0) ) {
if ( cpucaps.hasStreamingSIMD4Extensions && (xyzw != 0x8) && (xyzw != 0xf) ) { if ( x86caps.hasStreamingSIMD4Extensions && (xyzw != 0x8) && (xyzw != 0xf) ) {
xyzw = ((xyzw & 1) << 3) | ((xyzw & 2) << 1) | ((xyzw & 4) >> 1) | ((xyzw & 8) >> 3); xyzw = ((xyzw & 1) << 3) | ((xyzw & 2) << 1) | ((xyzw & 4) >> 1) | ((xyzw & 8) >> 3);
SSE4_BLENDPS_XMM_to_XMM(dest, src, xyzw); SSE4_BLENDPS_XMM_to_XMM(dest, src, xyzw);
} }
@ -970,7 +970,7 @@ void VU_MERGE_REGS_CUSTOM(int dest, int src, int xyzw) {
void VU_MERGE_REGS_SAFE(int dest, int src, int xyzw) { void VU_MERGE_REGS_SAFE(int dest, int src, int xyzw) {
xyzw &= 0xf; xyzw &= 0xf;
if ( (dest != src) && (xyzw != 0) ) { if ( (dest != src) && (xyzw != 0) ) {
if ( cpucaps.hasStreamingSIMD4Extensions && (xyzw != 0x8) && (xyzw != 0xf) ) { if ( x86caps.hasStreamingSIMD4Extensions && (xyzw != 0x8) && (xyzw != 0xf) ) {
xyzw = ((xyzw & 1) << 3) | ((xyzw & 2) << 1) | ((xyzw & 4) >> 1) | ((xyzw & 8) >> 3); xyzw = ((xyzw & 1) << 3) | ((xyzw & 2) << 1) | ((xyzw & 4) >> 1) | ((xyzw & 8) >> 3);
SSE4_BLENDPS_XMM_to_XMM(dest, src, xyzw); SSE4_BLENDPS_XMM_to_XMM(dest, src, xyzw);
} }
@ -1004,7 +1004,7 @@ void vFloat1(int regd, int regTemp) { //1000
SSE_SHUFPS_XMM_to_XMM(regd, regd, 0x27); SSE_SHUFPS_XMM_to_XMM(regd, regd, 0x27);
} }
void vFloat1c(int regd, int regTemp) { //1000 void vFloat1c(int regd, int regTemp) { //1000
if ( cpucaps.hasStreamingSIMD4Extensions ) { if ( x86caps.hasStreamingSIMD4Extensions ) {
CLAMP_SIGN_SSE4(1); CLAMP_SIGN_SSE4(1);
} }
else { else {
@ -1024,7 +1024,7 @@ void vFloat2(int regd, int regTemp) { //0100
SSE_SHUFPS_XMM_to_XMM(regd, regd, 0xc6); SSE_SHUFPS_XMM_to_XMM(regd, regd, 0xc6);
} }
void vFloat2c(int regd, int regTemp) { //0100 void vFloat2c(int regd, int regTemp) { //0100
if ( cpucaps.hasStreamingSIMD4Extensions ) { if ( x86caps.hasStreamingSIMD4Extensions ) {
CLAMP_SIGN_SSE4(2); CLAMP_SIGN_SSE4(2);
} }
else { else {
@ -1053,7 +1053,7 @@ void vFloat3b(int regd, int regTemp) { //1100 //regTemp is Modified
SSE2_MOVSD_XMM_to_XMM(regd, regTemp); SSE2_MOVSD_XMM_to_XMM(regd, regTemp);
} }
void vFloat3c(int regd, int regTemp) { //1100 void vFloat3c(int regd, int regTemp) { //1100
if ( cpucaps.hasStreamingSIMD4Extensions ) { if ( x86caps.hasStreamingSIMD4Extensions ) {
CLAMP_SIGN_SSE4(3); CLAMP_SIGN_SSE4(3);
} }
else { else {
@ -1076,7 +1076,7 @@ void vFloat4(int regd, int regTemp) { //0010
SSE2_PSHUFLW_XMM_to_XMM(regd, regd, 0x4e); SSE2_PSHUFLW_XMM_to_XMM(regd, regd, 0x4e);
} }
void vFloat4c(int regd, int regTemp) { //0010 void vFloat4c(int regd, int regTemp) { //0010
if ( cpucaps.hasStreamingSIMD4Extensions ) { if ( x86caps.hasStreamingSIMD4Extensions ) {
CLAMP_SIGN_SSE4(4); CLAMP_SIGN_SSE4(4);
} }
else { else {
@ -1099,7 +1099,7 @@ void vFloat5(int regd, int regTemp) { //1010
SSE_SHUFPS_XMM_to_XMM(regd, regd, 0x2d); SSE_SHUFPS_XMM_to_XMM(regd, regd, 0x2d);
} }
void vFloat5b(int regd, int regTemp) { //1010 //regTemp is Modified void vFloat5b(int regd, int regTemp) { //1010 //regTemp is Modified
if ( cpucaps.hasStreamingSIMD4Extensions ) { if ( x86caps.hasStreamingSIMD4Extensions ) {
CLAMP_NORMAL_SSE4(5); CLAMP_NORMAL_SSE4(5);
} }
else { else {
@ -1113,7 +1113,7 @@ void vFloat5b(int regd, int regTemp) { //1010 //regTemp is Modified
} }
} }
void vFloat5c(int regd, int regTemp) { //1010 void vFloat5c(int regd, int regTemp) { //1010
if ( cpucaps.hasStreamingSIMD4Extensions ) { if ( x86caps.hasStreamingSIMD4Extensions ) {
CLAMP_SIGN_SSE4(5); CLAMP_SIGN_SSE4(5);
} }
else { else {
@ -1139,7 +1139,7 @@ void vFloat6(int regd, int regTemp) { //0110
SSE_SHUFPS_XMM_to_XMM(regd, regd, 0xc9); SSE_SHUFPS_XMM_to_XMM(regd, regd, 0xc9);
} }
void vFloat6b(int regd, int regTemp) { //0110 //regTemp is Modified void vFloat6b(int regd, int regTemp) { //0110 //regTemp is Modified
if ( cpucaps.hasStreamingSIMD4Extensions ) { if ( x86caps.hasStreamingSIMD4Extensions ) {
CLAMP_NORMAL_SSE4(6); CLAMP_NORMAL_SSE4(6);
} }
else { else {
@ -1153,7 +1153,7 @@ void vFloat6b(int regd, int regTemp) { //0110 //regTemp is Modified
} }
} }
void vFloat6c(int regd, int regTemp) { //0110 void vFloat6c(int regd, int regTemp) { //0110
if ( cpucaps.hasStreamingSIMD4Extensions ) { if ( x86caps.hasStreamingSIMD4Extensions ) {
CLAMP_SIGN_SSE4(6); CLAMP_SIGN_SSE4(6);
} }
else { else {
@ -1185,7 +1185,7 @@ void vFloat7_useEAX(int regd, int regTemp) { //1110 //EAX is Modified
SSE2_MOVD_XMM_to_R(EAX, regd); SSE2_MOVD_XMM_to_R(EAX, regd);
SSE_MINPS_M128_to_XMM(regd, (uptr)g_maxvals); SSE_MINPS_M128_to_XMM(regd, (uptr)g_maxvals);
SSE_MAXPS_M128_to_XMM(regd, (uptr)g_minvals); SSE_MAXPS_M128_to_XMM(regd, (uptr)g_minvals);
if ( cpucaps.hasStreamingSIMD4Extensions ) if ( x86caps.hasStreamingSIMD4Extensions )
SSE4_PINSRD_R32_to_XMM(regd, EAX, 0x00); SSE4_PINSRD_R32_to_XMM(regd, EAX, 0x00);
else { else {
SSE_PINSRW_R32_to_XMM(regd, EAX, 0); SSE_PINSRW_R32_to_XMM(regd, EAX, 0);
@ -1200,7 +1200,7 @@ void vFloat7b(int regd, int regTemp) { //1110 //regTemp is Modified
SSE_MOVSS_XMM_to_XMM(regd, regTemp); SSE_MOVSS_XMM_to_XMM(regd, regTemp);
} }
void vFloat7c(int regd, int regTemp) { //1110 void vFloat7c(int regd, int regTemp) { //1110
if ( cpucaps.hasStreamingSIMD4Extensions ) { if ( x86caps.hasStreamingSIMD4Extensions ) {
CLAMP_SIGN_SSE4(7); CLAMP_SIGN_SSE4(7);
} }
else { else {
@ -1220,7 +1220,7 @@ void vFloat7c(int regd, int regTemp) { //1110
} }
} }
void vFloat7c_useEAX(int regd, int regTemp) { //1110 //EAX is Modified void vFloat7c_useEAX(int regd, int regTemp) { //1110 //EAX is Modified
if ( cpucaps.hasStreamingSIMD4Extensions ) { if ( x86caps.hasStreamingSIMD4Extensions ) {
CLAMP_SIGN_SSE4(7); CLAMP_SIGN_SSE4(7);
} }
else { else {
@ -1239,7 +1239,7 @@ void vFloat8(int regd, int regTemp) { //0001
SSE_MAXSS_M32_to_XMM(regd, (uptr)g_minvals); SSE_MAXSS_M32_to_XMM(regd, (uptr)g_minvals);
} }
void vFloat8c(int regd, int regTemp) { //0001 void vFloat8c(int regd, int regTemp) { //0001
if ( cpucaps.hasStreamingSIMD4Extensions ) { if ( x86caps.hasStreamingSIMD4Extensions ) {
CLAMP_SIGN_SSE4(8); CLAMP_SIGN_SSE4(8);
} }
else { else {
@ -1259,7 +1259,7 @@ void vFloat9(int regd, int regTemp) { //1001
SSE_SHUFPS_XMM_to_XMM(regd, regd, 0x27); SSE_SHUFPS_XMM_to_XMM(regd, regd, 0x27);
} }
void vFloat9b(int regd, int regTemp) { //1001 //regTemp is Modified void vFloat9b(int regd, int regTemp) { //1001 //regTemp is Modified
if ( cpucaps.hasStreamingSIMD4Extensions ) { if ( x86caps.hasStreamingSIMD4Extensions ) {
CLAMP_NORMAL_SSE4(9); CLAMP_NORMAL_SSE4(9);
} }
else { else {
@ -1272,7 +1272,7 @@ void vFloat9b(int regd, int regTemp) { //1001 //regTemp is Modified
} }
} }
void vFloat9c(int regd, int regTemp) { //1001 void vFloat9c(int regd, int regTemp) { //1001
if ( cpucaps.hasStreamingSIMD4Extensions ) { if ( x86caps.hasStreamingSIMD4Extensions ) {
CLAMP_SIGN_SSE4(9); CLAMP_SIGN_SSE4(9);
} }
else { else {
@ -1296,7 +1296,7 @@ void vFloat10(int regd, int regTemp) { //0101
SSE_SHUFPS_XMM_to_XMM(regd, regd, 0xc6); SSE_SHUFPS_XMM_to_XMM(regd, regd, 0xc6);
} }
void vFloat10b(int regd, int regTemp) { //0101 //regTemp is Modified void vFloat10b(int regd, int regTemp) { //0101 //regTemp is Modified
if ( cpucaps.hasStreamingSIMD4Extensions ) { if ( x86caps.hasStreamingSIMD4Extensions ) {
CLAMP_NORMAL_SSE4(10); CLAMP_NORMAL_SSE4(10);
} }
else { else {
@ -1309,7 +1309,7 @@ void vFloat10b(int regd, int regTemp) { //0101 //regTemp is Modified
} }
} }
void vFloat10c(int regd, int regTemp) { //0101 void vFloat10c(int regd, int regTemp) { //0101
if ( cpucaps.hasStreamingSIMD4Extensions ) { if ( x86caps.hasStreamingSIMD4Extensions ) {
CLAMP_SIGN_SSE4(10); CLAMP_SIGN_SSE4(10);
} }
else { else {
@ -1340,7 +1340,7 @@ void vFloat11_useEAX(int regd, int regTemp) { //1101 //EAX is Modified
SSE2_MOVD_XMM_to_R(EAX, regd); SSE2_MOVD_XMM_to_R(EAX, regd);
SSE_MINPS_M128_to_XMM(regd, (uptr)g_maxvals); SSE_MINPS_M128_to_XMM(regd, (uptr)g_maxvals);
SSE_MAXPS_M128_to_XMM(regd, (uptr)g_minvals); SSE_MAXPS_M128_to_XMM(regd, (uptr)g_minvals);
if ( cpucaps.hasStreamingSIMD4Extensions ) if ( x86caps.hasStreamingSIMD4Extensions )
SSE4_PINSRD_R32_to_XMM(regd, EAX, 0x00); SSE4_PINSRD_R32_to_XMM(regd, EAX, 0x00);
else { else {
SSE_PINSRW_R32_to_XMM(regd, EAX, 0); SSE_PINSRW_R32_to_XMM(regd, EAX, 0);
@ -1357,7 +1357,7 @@ void vFloat11b(int regd, int regTemp) { //1101 //regTemp is Modified
SSE2_MOVSD_XMM_to_XMM(regd, regTemp); SSE2_MOVSD_XMM_to_XMM(regd, regTemp);
} }
void vFloat11c(int regd, int regTemp) { //1101 void vFloat11c(int regd, int regTemp) { //1101
if ( cpucaps.hasStreamingSIMD4Extensions ) { if ( x86caps.hasStreamingSIMD4Extensions ) {
CLAMP_SIGN_SSE4(11); CLAMP_SIGN_SSE4(11);
} }
else { else {
@ -1376,7 +1376,7 @@ void vFloat11c(int regd, int regTemp) { //1101
} }
} }
void vFloat11c_useEAX(int regd, int regTemp) { //1101 // EAX is modified void vFloat11c_useEAX(int regd, int regTemp) { //1101 // EAX is modified
if ( cpucaps.hasStreamingSIMD4Extensions ) { if ( x86caps.hasStreamingSIMD4Extensions ) {
CLAMP_SIGN_SSE4(11); CLAMP_SIGN_SSE4(11);
} }
else { else {
@ -1407,7 +1407,7 @@ void vFloat12b(int regd, int regTemp) { //0011 //regTemp is Modified
SSE2_PUNPCKLQDQ_XMM_to_XMM(regd, regTemp); SSE2_PUNPCKLQDQ_XMM_to_XMM(regd, regTemp);
} }
void vFloat12c(int regd, int regTemp) { //0011 void vFloat12c(int regd, int regTemp) { //0011
if ( cpucaps.hasStreamingSIMD4Extensions ) { if ( x86caps.hasStreamingSIMD4Extensions ) {
CLAMP_SIGN_SSE4(12); CLAMP_SIGN_SSE4(12);
} }
else { else {
@ -1438,7 +1438,7 @@ void vFloat13_useEAX(int regd, int regTemp) { //1011 // EAX is modified
SSE2_MOVD_XMM_to_R(EAX, regd); SSE2_MOVD_XMM_to_R(EAX, regd);
SSE_MINPS_M128_to_XMM(regd, (uptr)g_maxvals); SSE_MINPS_M128_to_XMM(regd, (uptr)g_maxvals);
SSE_MAXPS_M128_to_XMM(regd, (uptr)g_minvals); SSE_MAXPS_M128_to_XMM(regd, (uptr)g_minvals);
if ( cpucaps.hasStreamingSIMD4Extensions ) if ( x86caps.hasStreamingSIMD4Extensions )
SSE4_PINSRD_R32_to_XMM(regd, EAX, 0x00); SSE4_PINSRD_R32_to_XMM(regd, EAX, 0x00);
else { else {
SSE_PINSRW_R32_to_XMM(regd, EAX, 0); SSE_PINSRW_R32_to_XMM(regd, EAX, 0);
@ -1455,7 +1455,7 @@ void vFloat13b(int regd, int regTemp) { //1011 //regTemp is Modified
SSE_SHUFPS_XMM_to_XMM(regd, regTemp, 0x64); SSE_SHUFPS_XMM_to_XMM(regd, regTemp, 0x64);
} }
void vFloat13c(int regd, int regTemp) { //1011 void vFloat13c(int regd, int regTemp) { //1011
if ( cpucaps.hasStreamingSIMD4Extensions ) { if ( x86caps.hasStreamingSIMD4Extensions ) {
CLAMP_SIGN_SSE4(13); CLAMP_SIGN_SSE4(13);
} }
else { else {
@ -1474,7 +1474,7 @@ void vFloat13c(int regd, int regTemp) { //1011
} }
} }
void vFloat13c_useEAX(int regd, int regTemp) { //1011 // EAX is modified void vFloat13c_useEAX(int regd, int regTemp) { //1011 // EAX is modified
if ( cpucaps.hasStreamingSIMD4Extensions ) { if ( x86caps.hasStreamingSIMD4Extensions ) {
CLAMP_SIGN_SSE4(13); CLAMP_SIGN_SSE4(13);
} }
else { else {
@ -1506,7 +1506,7 @@ void vFloat14_useEAX(int regd, int regTemp) { //0111 // EAX is modified
SSE2_MOVD_XMM_to_R(EAX, regd); SSE2_MOVD_XMM_to_R(EAX, regd);
SSE_MINPS_M128_to_XMM(regd, (uptr)g_maxvals); SSE_MINPS_M128_to_XMM(regd, (uptr)g_maxvals);
SSE_MAXPS_M128_to_XMM(regd, (uptr)g_minvals); SSE_MAXPS_M128_to_XMM(regd, (uptr)g_minvals);
if ( cpucaps.hasStreamingSIMD4Extensions ) if ( x86caps.hasStreamingSIMD4Extensions )
SSE4_PINSRD_R32_to_XMM(regd, EAX, 0x00); SSE4_PINSRD_R32_to_XMM(regd, EAX, 0x00);
else { else {
SSE_PINSRW_R32_to_XMM(regd, EAX, 0); SSE_PINSRW_R32_to_XMM(regd, EAX, 0);
@ -1523,7 +1523,7 @@ void vFloat14b(int regd, int regTemp) { //0111 //regTemp is Modified
SSE_SHUFPS_XMM_to_XMM(regd, regTemp, 0xc4); SSE_SHUFPS_XMM_to_XMM(regd, regTemp, 0xc4);
} }
void vFloat14c(int regd, int regTemp) { //0111 void vFloat14c(int regd, int regTemp) { //0111
if ( cpucaps.hasStreamingSIMD4Extensions ) { if ( x86caps.hasStreamingSIMD4Extensions ) {
CLAMP_SIGN_SSE4(14); CLAMP_SIGN_SSE4(14);
} }
else { else {
@ -1542,7 +1542,7 @@ void vFloat14c(int regd, int regTemp) { //0111
} }
} }
void vFloat14c_useEAX(int regd, int regTemp) { //0111 // EAX is modified void vFloat14c_useEAX(int regd, int regTemp) { //0111 // EAX is modified
if ( cpucaps.hasStreamingSIMD4Extensions ) { if ( x86caps.hasStreamingSIMD4Extensions ) {
CLAMP_SIGN_SSE4(14); CLAMP_SIGN_SSE4(14);
} }
else { else {
@ -1563,7 +1563,7 @@ void vFloat15(int regd, int regTemp) { //1111
SSE_MAXPS_M128_to_XMM(regd, (uptr)g_minvals); SSE_MAXPS_M128_to_XMM(regd, (uptr)g_minvals);
} }
void vFloat15c(int regd, int regTemp) { //1111 void vFloat15c(int regd, int regTemp) { //1111
if ( cpucaps.hasStreamingSIMD4Extensions ) { if ( x86caps.hasStreamingSIMD4Extensions ) {
CLAMP_SIGN_SSE4(15); CLAMP_SIGN_SSE4(15);
} }
else { else {

View File

@ -0,0 +1,582 @@
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug SSE2|Win32">
<Configuration>Debug SSE2</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug SSE2|Win32">
<Configuration>Debug SSE2</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug SSE2|x64">
<Configuration>Debug SSE2</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug SSE2|x64">
<Configuration>Debug SSE2</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug SSE4|Win32">
<Configuration>Debug SSE4</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug SSE4|Win32">
<Configuration>Debug SSE4</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug SSE4|x64">
<Configuration>Debug SSE4</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug SSE4|x64">
<Configuration>Debug SSE4</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug SSSE3|Win32">
<Configuration>Debug SSSE3</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug SSSE3|Win32">
<Configuration>Debug SSSE3</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug SSSE3|x64">
<Configuration>Debug SSSE3</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug SSSE3|x64">
<Configuration>Debug SSSE3</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release SSE2|Win32">
<Configuration>Release SSE2</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release SSE2|Win32">
<Configuration>Release SSE2</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release SSE2|x64">
<Configuration>Release SSE2</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release SSE2|x64">
<Configuration>Release SSE2</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release SSE4|Win32">
<Configuration>Release SSE4</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release SSE4|Win32">
<Configuration>Release SSE4</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release SSE4|x64">
<Configuration>Release SSE4</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release SSE4|x64">
<Configuration>Release SSE4</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release SSSE3|Win32">
<Configuration>Release SSSE3</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release SSSE3|Win32">
<Configuration>Release SSSE3</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release SSSE3|x64">
<Configuration>Release SSSE3</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release SSSE3|x64">
<Configuration>Release SSSE3</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectName>CDVDolio</ProjectName>
<ProjectGUID>{FCDF5AE2-EA47-4CC6-9F20-23A0517FEBCB}</ProjectGUID>
<RootNamespace>cdvd</RootNamespace>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>Static</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|X64'">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>Static</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug SSE2|Win32'">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug SSE2|X64'">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>Static</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>false</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release SSE2|Win32'">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release SSE2|X64'">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>Static</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release SSSE3|Win32'">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release SSSE3|X64'">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>Static</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug SSSE3|Win32'">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug SSSE3|X64'">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>Static</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug SSE4|Win32'">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug SSE4|X64'">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>Static</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release SSE4|Win32'">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release SSE4|X64'">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>Static</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets">
<Import Project="$(LocalAppData)\Microsoft\VisualStudio\10.0\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(LocalAppData)\Microsoft\VisualStudio\10.0\Microsoft.Cpp.$(Platform).user.props')" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="vsprops\common.props" Condition="exists('.\vsprops\common.props')" />
<Import Project="vsprops\ProjectRootDir.props" Condition="exists('.\vsprops\ProjectRootDir.props')" />
<Import Project="..\..\common\vsprops\BaseProperties.props" Condition="exists('..\..\common\vsprops\BaseProperties.props')" />
<Import Project="vsprops\debug.props" Condition="exists('.\vsprops\debug.props')" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">
<Import Project="vsprops\common.props" Condition="exists('.\vsprops\common.props')" />
<Import Project="vsprops\ProjectRootDir.props" Condition="exists('.\vsprops\ProjectRootDir.props')" />
<Import Project="..\..\common\vsprops\BaseProperties.props" Condition="exists('..\..\common\vsprops\BaseProperties.props')" />
<Import Project="vsprops\debug.props" Condition="exists('.\vsprops\debug.props')" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="vsprops\common.props" Condition="exists('.\vsprops\common.props')" />
<Import Project="vsprops\ProjectRootDir.props" Condition="exists('.\vsprops\ProjectRootDir.props')" />
<Import Project="..\..\common\vsprops\BaseProperties.props" Condition="exists('..\..\common\vsprops\BaseProperties.props')" />
<Import Project="vsprops\release.props" Condition="exists('.\vsprops\release.props')" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|X64'">
<Import Project="vsprops\common.props" Condition="exists('.\vsprops\common.props')" />
<Import Project="vsprops\ProjectRootDir.props" Condition="exists('.\vsprops\ProjectRootDir.props')" />
<Import Project="..\..\common\vsprops\BaseProperties.props" Condition="exists('..\..\common\vsprops\BaseProperties.props')" />
<Import Project="vsprops\release.props" Condition="exists('.\vsprops\release.props')" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug SSE2|Win32'">
<Import Project="vsprops\common.props" Condition="exists('.\vsprops\common.props')" />
<Import Project="vsprops\ProjectRootDir.props" Condition="exists('.\vsprops\ProjectRootDir.props')" />
<Import Project="..\..\common\vsprops\BaseProperties.props" Condition="exists('..\..\common\vsprops\BaseProperties.props')" />
<Import Project="vsprops\debug.props" Condition="exists('.\vsprops\debug.props')" />
<Import Project="vsprops\sse2.props" Condition="exists('.\vsprops\sse2.props')" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug SSE2|X64'">
<Import Project="vsprops\common.props" Condition="exists('.\vsprops\common.props')" />
<Import Project="vsprops\ProjectRootDir.props" Condition="exists('.\vsprops\ProjectRootDir.props')" />
<Import Project="..\..\common\vsprops\BaseProperties.props" Condition="exists('..\..\common\vsprops\BaseProperties.props')" />
<Import Project="vsprops\debug.props" Condition="exists('.\vsprops\debug.props')" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release SSE2|Win32'">
<Import Project="vsprops\common.props" Condition="exists('.\vsprops\common.props')" />
<Import Project="vsprops\ProjectRootDir.props" Condition="exists('.\vsprops\ProjectRootDir.props')" />
<Import Project="..\..\common\vsprops\BaseProperties.props" Condition="exists('..\..\common\vsprops\BaseProperties.props')" />
<Import Project="vsprops\release.props" Condition="exists('.\vsprops\release.props')" />
<Import Project="vsprops\sse2.props" Condition="exists('.\vsprops\sse2.props')" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release SSE2|X64'">
<Import Project="vsprops\common.props" Condition="exists('.\vsprops\common.props')" />
<Import Project="vsprops\ProjectRootDir.props" Condition="exists('.\vsprops\ProjectRootDir.props')" />
<Import Project="..\..\common\vsprops\BaseProperties.props" Condition="exists('..\..\common\vsprops\BaseProperties.props')" />
<Import Project="vsprops\release.props" Condition="exists('.\vsprops\release.props')" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release SSSE3|Win32'">
<Import Project="vsprops\common.props" Condition="exists('.\vsprops\common.props')" />
<Import Project="vsprops\ProjectRootDir.props" Condition="exists('.\vsprops\ProjectRootDir.props')" />
<Import Project="..\..\common\vsprops\BaseProperties.props" Condition="exists('..\..\common\vsprops\BaseProperties.props')" />
<Import Project="vsprops\release.props" Condition="exists('.\vsprops\release.props')" />
<Import Project="vsprops\sse2.props" Condition="exists('.\vsprops\sse2.props')" />
<Import Project="vsprops\ssse3.props" Condition="exists('.\vsprops\ssse3.props')" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release SSSE3|X64'">
<Import Project="vsprops\common.props" Condition="exists('.\vsprops\common.props')" />
<Import Project="vsprops\ProjectRootDir.props" Condition="exists('.\vsprops\ProjectRootDir.props')" />
<Import Project="..\..\common\vsprops\BaseProperties.props" Condition="exists('..\..\common\vsprops\BaseProperties.props')" />
<Import Project="vsprops\release.props" Condition="exists('.\vsprops\release.props')" />
<Import Project="vsprops\ssse3.props" Condition="exists('.\vsprops\ssse3.props')" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug SSSE3|Win32'">
<Import Project="vsprops\common.props" Condition="exists('.\vsprops\common.props')" />
<Import Project="vsprops\ProjectRootDir.props" Condition="exists('.\vsprops\ProjectRootDir.props')" />
<Import Project="..\..\common\vsprops\BaseProperties.props" Condition="exists('..\..\common\vsprops\BaseProperties.props')" />
<Import Project="vsprops\debug.props" Condition="exists('.\vsprops\debug.props')" />
<Import Project="vsprops\sse2.props" Condition="exists('.\vsprops\sse2.props')" />
<Import Project="vsprops\ssse3.props" Condition="exists('.\vsprops\ssse3.props')" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug SSSE3|X64'">
<Import Project="vsprops\common.props" Condition="exists('.\vsprops\common.props')" />
<Import Project="vsprops\ProjectRootDir.props" Condition="exists('.\vsprops\ProjectRootDir.props')" />
<Import Project="..\..\common\vsprops\BaseProperties.props" Condition="exists('..\..\common\vsprops\BaseProperties.props')" />
<Import Project="vsprops\debug.props" Condition="exists('.\vsprops\debug.props')" />
<Import Project="vsprops\ssse3.props" Condition="exists('.\vsprops\ssse3.props')" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug SSE4|Win32'">
<Import Project="vsprops\common.props" Condition="exists('.\vsprops\common.props')" />
<Import Project="vsprops\ProjectRootDir.props" Condition="exists('.\vsprops\ProjectRootDir.props')" />
<Import Project="..\..\common\vsprops\BaseProperties.props" Condition="exists('..\..\common\vsprops\BaseProperties.props')" />
<Import Project="vsprops\debug.props" Condition="exists('.\vsprops\debug.props')" />
<Import Project="vsprops\sse2.props" Condition="exists('.\vsprops\sse2.props')" />
<Import Project="vsprops\sse4.props" Condition="exists('.\vsprops\sse4.props')" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug SSE4|X64'">
<Import Project="vsprops\common.props" Condition="exists('.\vsprops\common.props')" />
<Import Project="vsprops\ProjectRootDir.props" Condition="exists('.\vsprops\ProjectRootDir.props')" />
<Import Project="..\..\common\vsprops\BaseProperties.props" Condition="exists('..\..\common\vsprops\BaseProperties.props')" />
<Import Project="vsprops\debug.props" Condition="exists('.\vsprops\debug.props')" />
<Import Project="vsprops\sse4.props" Condition="exists('.\vsprops\sse4.props')" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release SSE4|Win32'">
<Import Project="vsprops\common.props" Condition="exists('.\vsprops\common.props')" />
<Import Project="vsprops\ProjectRootDir.props" Condition="exists('.\vsprops\ProjectRootDir.props')" />
<Import Project="..\..\common\vsprops\BaseProperties.props" Condition="exists('..\..\common\vsprops\BaseProperties.props')" />
<Import Project="vsprops\release.props" Condition="exists('.\vsprops\release.props')" />
<Import Project="vsprops\sse2.props" Condition="exists('.\vsprops\sse2.props')" />
<Import Project="vsprops\sse4.props" Condition="exists('.\vsprops\sse4.props')" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release SSE4|X64'">
<Import Project="vsprops\common.props" Condition="exists('.\vsprops\common.props')" />
<Import Project="vsprops\ProjectRootDir.props" Condition="exists('.\vsprops\ProjectRootDir.props')" />
<Import Project="..\..\common\vsprops\BaseProperties.props" Condition="exists('..\..\common\vsprops\BaseProperties.props')" />
<Import Project="vsprops\release.props" Condition="exists('.\vsprops\release.props')" />
<Import Project="vsprops\sse4.props" Condition="exists('.\vsprops\sse4.props')" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.20506.1</_ProjectFileVersion>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug SSE4|Win32'">$(Configuration)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
</ClCompile>
<Link>
<ModuleDefinitionFile>.\cdvd.def</ModuleDefinitionFile>
<DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
</ClCompile>
<Link>
<ModuleDefinitionFile>
</ModuleDefinitionFile>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
</ClCompile>
<Link>
<ModuleDefinitionFile>.\cdvd.def</ModuleDefinitionFile>
<DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|X64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
</ClCompile>
<Link>
<ModuleDefinitionFile>
</ModuleDefinitionFile>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug SSE2|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
</ClCompile>
<Link>
<ModuleDefinitionFile>.\cdvd.def</ModuleDefinitionFile>
<DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug SSE2|X64'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
</ClCompile>
<Link>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release SSE2|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
</ClCompile>
<Link>
<ModuleDefinitionFile>.\cdvd.def</ModuleDefinitionFile>
<DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release SSE2|X64'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
</ClCompile>
<Link>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release SSSE3|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
</ClCompile>
<Link>
<ModuleDefinitionFile>.\cdvd.def</ModuleDefinitionFile>
<DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release SSSE3|X64'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
</ClCompile>
<Link>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug SSSE3|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
</ClCompile>
<Link>
<ModuleDefinitionFile>.\cdvd.def</ModuleDefinitionFile>
<DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug SSSE3|X64'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
</ClCompile>
<Link>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug SSE4|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
</ClCompile>
<Link>
<ModuleDefinitionFile>.\cdvd.def</ModuleDefinitionFile>
<DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug SSE4|X64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
</ClCompile>
<Link>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release SSE4|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
</ClCompile>
<Link>
<ModuleDefinitionFile>.\cdvd.def</ModuleDefinitionFile>
<DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release SSE4|X64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
</ClCompile>
<Link>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="cdvd.cpp" />
<ClCompile Include="CDVDDialog.cpp" />
<ClCompile Include="SettingsDlg.cpp" />
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|X64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug SSE2|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug SSE2|X64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release SSE2|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release SSE2|X64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release SSSE3|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release SSSE3|X64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug SSSE3|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug SSSE3|X64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug SSE4|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug SSE4|X64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release SSE4|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release SSE4|X64'">Create</PrecompiledHeader>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="cdvd.rc" />
</ItemGroup>
<ItemGroup>
<None Include="cdvd.def" />
<None Include="res\cdvd.rc2" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="cdvd.h" />
<ClInclude Include="CDVDDialog.h" />
<ClInclude Include="resource.h" />
<ClInclude Include="SettingsDlg.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="svnrev.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -0,0 +1,64 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
</Filter>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="cdvd.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="CDVDDialog.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="SettingsDlg.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="cdvd.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<None Include="cdvd.def">
<Filter>Source Files</Filter>
</None>
<None Include="res\cdvd.rc2">
<Filter>Resource Files</Filter>
</None>
</ItemGroup>
<ItemGroup>
<ClInclude Include="cdvd.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="CDVDDialog.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="resource.h">
<Filter>Resource Files</Filter>
</ClInclude>
<ClInclude Include="SettingsDlg.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="stdafx.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="svnrev.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Globals_RESOURCE_FILE>cdvd.rc</Globals_RESOURCE_FILE>
</PropertyGroup>
</Project>

View File

@ -0,0 +1,25 @@
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Label="UserMacros">
<ProjectRootDir>$(ProjectDir).</ProjectRootDir>
<SvnRootDir>$(ProjectRootDir)\..\..</SvnRootDir>
<SvnCommonDir>$(SvnRootDir)\common</SvnCommonDir>
<PcsxSubsection>plugins</PcsxSubsection>
</PropertyGroup>
<PropertyGroup>
<_PropertySheetDisplayName>ProjectRootDir</_PropertySheetDisplayName>
</PropertyGroup>
<ItemGroup>
<BuildMacro Include="ProjectRootDir">
<Value>$(ProjectRootDir)</Value>
</BuildMacro>
<BuildMacro Include="SvnRootDir">
<Value>$(SvnRootDir)</Value>
</BuildMacro>
<BuildMacro Include="SvnCommonDir">
<Value>$(SvnCommonDir)</Value>
</BuildMacro>
<BuildMacro Include="PcsxSubsection">
<Value>$(PcsxSubsection)</Value>
</BuildMacro>
</ItemGroup>
</Project>

View File

@ -0,0 +1,27 @@
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<_PropertySheetDisplayName>common</_PropertySheetDisplayName>
<OutDir>..\..\bin\plugins\</OutDir>
<IntDir>$(PlatformName)\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)</TargetName>
<TargetExt>.dll</TargetExt>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;_WINDOWS;_WIN32_WINNT=0x500;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<FloatingPointModel>Fast</FloatingPointModel>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<DisableSpecificWarnings>4995;4324;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
<Link>
<AdditionalDependencies>d3d10.lib;d3dx10.lib;d3d9.lib;d3dx9.lib;ddraw.lib;dxguid.lib;winmm.lib;strmiids.lib;xinput.lib;%(AdditionalDependencies)</AdditionalDependencies>
<DelayLoadDLLs>d3d9.dll;d3dx9_40.dll;d3d10.dll;d3dx10_40.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
</Link>
</ItemDefinitionGroup>
</Project>

View File

@ -0,0 +1,15 @@
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<_PropertySheetDisplayName>debug</_PropertySheetDisplayName>
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>StackFrameRuntimeCheck</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
</ClCompile>
</ItemDefinitionGroup>
</Project>

View File

@ -0,0 +1,24 @@
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<_PropertySheetDisplayName>release</_PropertySheetDisplayName>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PreprocessorDefinitions>NDEBUG;_SECURE_SCL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<BufferSecurityCheck>false</BufferSecurityCheck>
</ClCompile>
<Link>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
</Link>
</ItemDefinitionGroup>
</Project>

View File

@ -12,7 +12,7 @@
FavorSizeOrSpeed="1" FavorSizeOrSpeed="1"
OmitFramePointers="true" OmitFramePointers="true"
WholeProgramOptimization="true" WholeProgramOptimization="true"
PreprocessorDefinitions="NDEBUG" PreprocessorDefinitions="NDEBUG;_SECURE_SCL=0"
StringPooling="true" StringPooling="true"
RuntimeLibrary="2" RuntimeLibrary="2"
BufferSecurityCheck="false" BufferSecurityCheck="false"

View File

@ -0,0 +1,11 @@
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<_PropertySheetDisplayName>sse3</_PropertySheetDisplayName>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
<PreprocessorDefinitions>_M_SSE=0x301;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
</Project>

View File

@ -769,9 +769,9 @@ REG64_(GIFReg, TEST)
uint32 _PAD1:13; uint32 _PAD1:13;
uint32 _PAD2:32; uint32 _PAD2:32;
REG_END2 REG_END2
__forceinline bool DoFirstPass() {return !ATE || ATST != 0;} // not all pixels fail automatically __forceinline bool DoFirstPass() {return !ATE || ATST != ATST_NEVER;} // not all pixels fail automatically
__forceinline bool DoSecondPass() {return ATE && ATST != 1 && AFAIL != 0;} // pixels may fail, write fb/z __forceinline bool DoSecondPass() {return ATE && ATST != ATST_ALWAYS && AFAIL != AFAIL_KEEP;} // pixels may fail, write fb/z
__forceinline bool NoSecondPass() {return ATE && ATST != 1 && AFAIL == 0;} // pixels may fail, no output __forceinline bool NoSecondPass() {return ATE && ATST != ATST_ALWAYS && AFAIL == AFAIL_KEEP;} // pixels may fail, no output
REG_END2 REG_END2
REG64_(GIFReg, TEX0) REG64_(GIFReg, TEX0)

View File

@ -71,7 +71,7 @@ __declspec(align(16)) class GSClut : public GSAlignedClass<16>
template<int n> void WriteCLUT16_CSM2(const GIFRegTEX0& TEX0, const GIFRegTEXCLUT& TEXCLUT); template<int n> void WriteCLUT16_CSM2(const GIFRegTEX0& TEX0, const GIFRegTEXCLUT& TEXCLUT);
template<int n> void WriteCLUT16S_CSM2(const GIFRegTEX0& TEX0, const GIFRegTEXCLUT& TEXCLUT); template<int n> void WriteCLUT16S_CSM2(const GIFRegTEX0& TEX0, const GIFRegTEXCLUT& TEXCLUT);
void WriteCLUT_NULL(const GIFRegTEX0& TEX0, const GIFRegTEXCLUT& TEXCLUT) {} void WriteCLUT_NULL(const GIFRegTEX0& TEX0, const GIFRegTEXCLUT& TEXCLUT) {ASSERT(0);} // xenosaga 3
static void WriteCLUT_T32_I8_CSM1(const uint32* RESTRICT src, uint16* RESTRICT clut); static void WriteCLUT_T32_I8_CSM1(const uint32* RESTRICT src, uint16* RESTRICT clut);
static void WriteCLUT_T32_I4_CSM1(const uint32* RESTRICT src, uint16* RESTRICT clut); static void WriteCLUT_T32_I4_CSM1(const uint32* RESTRICT src, uint16* RESTRICT clut);

View File

@ -79,8 +79,8 @@ void GSDevice::Present(const GSVector4i& r, int shader, bool limit)
{ {
GSVector4i cr = m_wnd->GetClientRect(); GSVector4i cr = m_wnd->GetClientRect();
int w = std::max(cr.width(), 1); int w = std::max<int>(cr.width(), 1);
int h = std::max(cr.height(), 1); int h = std::max<int>(cr.height(), 1);
if(!m_backbuffer || m_backbuffer->m_size.x != w || m_backbuffer->m_size.y != h) if(!m_backbuffer || m_backbuffer->m_size.x != w || m_backbuffer->m_size.y != h)
{ {

View File

@ -86,8 +86,8 @@ bool GSDevice10::Create(GSWnd* wnd, bool vsync)
scd.SampleDesc.Quality = 0; scd.SampleDesc.Quality = 0;
scd.Windowed = TRUE; scd.Windowed = TRUE;
uint32 flags = 0; uint32 flags = D3D10_CREATE_DEVICE_SINGLETHREADED; //disables thread safety, should be fine (speedup)
flags = D3D10_CREATE_DEVICE_SINGLETHREADED; //disables thread safety, should be fine (speedup)
#ifdef DEBUG #ifdef DEBUG
flags |= D3D10_CREATE_DEVICE_DEBUG; flags |= D3D10_CREATE_DEVICE_DEBUG;
#endif #endif
@ -113,8 +113,6 @@ bool GSDevice10::Create(GSWnd* wnd, bool vsync)
} }
} }
// hr = D3D10CreateDeviceAndSwapChain(NULL, D3D10_DRIVER_TYPE_HARDWARE, NULL, flags, D3D10_SDK_VERSION, &scd, &m_swapchain, &m_dev);
if(FAILED(hr)) return false; if(FAILED(hr)) return false;
// convert // convert
@ -420,7 +418,7 @@ void GSDevice10::CopyRect(GSTexture* st, GSTexture* dt, const GSVector4i& r)
{ {
D3D10_BOX box = {r.left, r.top, 0, r.right, r.bottom, 1}; D3D10_BOX box = {r.left, r.top, 0, r.right, r.bottom, 1};
m_dev->CopySubresourceRegion(*(GSTexture10*)dt, 0, 0, 0, 0, *(GSTexture10*)st, 0, &box); m_dev->CopySubresourceRegion(*(GSTexture10*)dt, 0, r.left, r.top, 0, *(GSTexture10*)st, 0, &box);
} }
void GSDevice10::StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dt, const GSVector4& dr, int shader, bool linear) void GSDevice10::StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dt, const GSVector4& dr, int shader, bool linear)

View File

@ -86,8 +86,8 @@ bool GSDevice11::Create(GSWnd* wnd, bool vsync)
scd.SampleDesc.Quality = 0; scd.SampleDesc.Quality = 0;
scd.Windowed = TRUE; scd.Windowed = TRUE;
uint32 flags = 0; uint32 flags = D3D11_CREATE_DEVICE_SINGLETHREADED; //disables thread safety, should be fine (speedup)
flags = D3D11_CREATE_DEVICE_SINGLETHREADED; //disables thread safety, should be fine (speedup)
#ifdef DEBUG #ifdef DEBUG
flags |= D3D11_CREATE_DEVICE_DEBUG; flags |= D3D11_CREATE_DEVICE_DEBUG;
#endif #endif
@ -417,7 +417,7 @@ void GSDevice11::CopyRect(GSTexture* st, GSTexture* dt, const GSVector4i& r)
{ {
D3D11_BOX box = {r.left, r.top, 0, r.right, r.bottom, 1}; D3D11_BOX box = {r.left, r.top, 0, r.right, r.bottom, 1};
m_ctx->CopySubresourceRegion(*(GSTexture11*)dt, 0, 0, 0, 0, *(GSTexture11*)st, 0, &box); m_ctx->CopySubresourceRegion(*(GSTexture11*)dt, 0, r.left, r.top, 0, *(GSTexture11*)st, 0, &box);
} }
void GSDevice11::StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dt, const GSVector4& dr, int shader, bool linear) void GSDevice11::StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dt, const GSVector4& dr, int shader, bool linear)

View File

@ -142,8 +142,8 @@ void GSDevice7::Present(const GSVector4i& r, int shader, bool limit)
GSVector4i cr = m_wnd->GetClientRect(); GSVector4i cr = m_wnd->GetClientRect();
int w = std::max(cr.width(), 1); int w = std::max<int>(cr.width(), 1);
int h = std::max(cr.height(), 1); int h = std::max<int>(cr.height(), 1);
if(!m_backbuffer || m_backbuffer->m_size.x != w || m_backbuffer->m_size.y != h) if(!m_backbuffer || m_backbuffer->m_size.x != w || m_backbuffer->m_size.y != h)
{ {

View File

@ -969,29 +969,6 @@ void GSDevice9::OMSetRenderTargets(GSTexture* rt, GSTexture* ds, const GSVector4
} }
} }
// FIXME: D3DXCompileShaderFromResource of d3dx9 v37 (march 2008) calls GetFullPathName on id for some reason and then crashes
static HRESULT LoadShader(uint32 id, LPCSTR& data, uint32& size)
{
CComPtr<ID3DXBuffer> shader, error;
HRSRC hRes = FindResource(theApp.GetModuleHandle(), MAKEINTRESOURCE(id), RT_RCDATA);
if(!hRes) return E_FAIL;
size = SizeofResource(theApp.GetModuleHandle(), hRes);
if(size == 0) return E_FAIL;
HGLOBAL hResData = LoadResource(theApp.GetModuleHandle(), hRes);
if(!hResData) return E_FAIL;
data = (LPCSTR)LockResource(hResData);
return S_OK;
}
HRESULT GSDevice9::CompileShader(uint32 id, const string& entry, const D3DXMACRO* macro, IDirect3DVertexShader9** vs, const D3DVERTEXELEMENT9* layout, int count, IDirect3DVertexDeclaration9** il) HRESULT GSDevice9::CompileShader(uint32 id, const string& entry, const D3DXMACRO* macro, IDirect3DVertexShader9** vs, const D3DVERTEXELEMENT9* layout, int count, IDirect3DVertexDeclaration9** il)
{ {
vector<D3DXMACRO> m; vector<D3DXMACRO> m;
@ -1002,16 +979,7 @@ HRESULT GSDevice9::CompileShader(uint32 id, const string& entry, const D3DXMACRO
CComPtr<ID3DXBuffer> shader, error; CComPtr<ID3DXBuffer> shader, error;
// FIXME: hr = D3DXCompileShaderFromResource(theApp.GetModuleHandle(), MAKEINTRESOURCE(id), &m[0], NULL, entry.c_str(), target, 0, &shader, &error, NULL); hr = D3DXCompileShaderFromResource(theApp.GetModuleHandle(), MAKEINTRESOURCE(id), &m[0], NULL, entry.c_str(), m_shader.vs.c_str(), 0, &shader, &error, NULL);
LPCSTR data;
uint32 size;
hr = LoadShader(id, data, size);
if(FAILED(hr)) return E_FAIL;
hr = D3DXCompileShader(data, size, &m[0], NULL, entry.c_str(), m_shader.vs.c_str(), 0, &shader, &error, NULL);
if(SUCCEEDED(hr)) if(SUCCEEDED(hr))
{ {
@ -1047,6 +1015,10 @@ HRESULT GSDevice9::CompileShader(uint32 id, const string& entry, const D3DXMACRO
{ {
flags |= D3DXSHADER_AVOID_FLOW_CONTROL; flags |= D3DXSHADER_AVOID_FLOW_CONTROL;
} }
else
{
flags |= D3DXSHADER_SKIPVALIDATION;
}
vector<D3DXMACRO> m; vector<D3DXMACRO> m;
@ -1056,16 +1028,7 @@ HRESULT GSDevice9::CompileShader(uint32 id, const string& entry, const D3DXMACRO
CComPtr<ID3DXBuffer> shader, error; CComPtr<ID3DXBuffer> shader, error;
// FIXME: hr = D3DXCompileShaderFromResource(theApp.GetModuleHandle(), MAKEINTRESOURCE(id), &m[0], NULL, entry.c_str(), target, flags, &shader, &error, NULL); hr = D3DXCompileShaderFromResource(theApp.GetModuleHandle(), MAKEINTRESOURCE(id), &m[0], NULL, entry.c_str(), m_shader.ps.c_str(), flags, &shader, &error, NULL);
LPCSTR data;
uint32 size;
hr = LoadShader(id, data, size);
if(FAILED(hr)) return E_FAIL;
hr = D3DXCompileShader(data, size, &m[0], NULL, entry.c_str(), m_shader.ps.c_str(), 0, &shader, &error, NULL);
if(SUCCEEDED(hr)) if(SUCCEEDED(hr))
{ {

View File

@ -355,7 +355,7 @@ void GSRenderer::VSync(int field)
} }
else else
{ {
if(m_dump) if(m_dump)D3DFMT_D32
{ {
m_dump.VSync(field, !(::GetAsyncKeyState(VK_CONTROL) & 0x8000), m_regs); m_dump.VSync(field, !(::GetAsyncKeyState(VK_CONTROL) & 0x8000), m_regs);
} }
@ -709,7 +709,10 @@ bool GSRenderer::IsLinear()
bool mmin = TEX1.IsMinLinear(); bool mmin = TEX1.IsMinLinear();
bool mmag = TEX1.IsMagLinear(); bool mmag = TEX1.IsMagLinear();
if(mmag == mmin) return mmag; if(mmag == mmin || TEX1.MXL == 0) // MXL == 0 => MMIN ignored, tested it on ps2
{
return mmag;
}
if(!TEX1.LCM && !PRIM->FST) // if FST => assume Q = 1.0f (should not, but Q is very often bogus, 0 or DEN) if(!TEX1.LCM && !PRIM->FST) // if FST => assume Q = 1.0f (should not, but Q is very often bogus, 0 or DEN)
{ {
@ -761,7 +764,7 @@ bool GSRenderer::IsOpaque()
amin = amax = 0x80; amin = amax = 0x80;
} }
} }
else if(context->ALPHA.C == 1) else if(context->ALPHA.C == 2)
{ {
amin = amax = context->ALPHA.FIX; amin = amax = context->ALPHA.FIX;
} }

View File

@ -199,7 +199,6 @@ public:
if(context->TEST.ATE) if(context->TEST.ATE)
{ {
ps_sel.ate = 1;
ps_sel.atst = context->TEST.ATST; ps_sel.atst = context->TEST.ATST;
switch(ps_sel.atst) switch(ps_sel.atst)
@ -215,6 +214,10 @@ public:
break; break;
} }
} }
else
{
ps_sel.atst = ATST_ALWAYS;
}
if(tex) if(tex)
{ {

View File

@ -624,7 +624,7 @@ protected:
{ {
if(TryAlphaTest(fm, zm)) if(TryAlphaTest(fm, zm))
{ {
context->TEST.ATE = 0; context->TEST.ATST = ATST_ALWAYS;
} }
} }

View File

@ -951,7 +951,7 @@ void GSTextureCache::Target::Update()
if(GSTexture* t = m_renderer->m_dev->CreateTexture(w, h)) if(GSTexture* t = m_renderer->m_dev->CreateTexture(w, h))
{ {
const GSOffset* o = m_renderer->m_mem.GetOffset(m_TEX0.TBP0, m_TEX0.TBW, m_TEX0.PSM); // TODO: m_renderer->m_context->bo.tex; const GSOffset* o = m_renderer->m_mem.GetOffset(m_TEX0.TBP0, m_TEX0.TBW, m_TEX0.PSM);
GIFRegTEXA TEXA; GIFRegTEXA TEXA;

View File

@ -260,7 +260,7 @@ bool GSTextureCacheSW::GSTexture::Update(const GIFRegTEX0& TEX0, const GIFRegTEX
return false; return false;
} }
m_tw = std::max<int>(psm.pal > 0 ? 5 : 3, TEX0.TW); // makes one row 32 bytes at least, matches the smallest block size that is allocated above for m_buff m_tw = std::max<int>(TEX0.TW, psm.pal > 0 ? 5 : 3); // makes one row 32 bytes at least, matches the smallest block size that is allocated above for m_buff
} }
GSLocalMemory& mem = m_state->m_mem; GSLocalMemory& mem = m_state->m_mem;

View File

@ -174,7 +174,6 @@ public:
uint32 aem:1; uint32 aem:1;
uint32 tfx:3; uint32 tfx:3;
uint32 tcc:1; uint32 tcc:1;
uint32 ate:1;
uint32 atst:3; uint32 atst:3;
uint32 fog:1; uint32 fog:1;
uint32 clr1:1; uint32 clr1:1;
@ -187,7 +186,7 @@ public:
uint32 key; uint32 key;
}; };
operator uint32() {return key & 0x7fffff;} operator uint32() {return key & 0x3fffff;}
PSSelector() : key(0) {} PSSelector() : key(0) {}
}; };

View File

@ -197,7 +197,7 @@ void GSTextureFX10::SetupPS(PSSelector sel, const PSConstantBuffer* cb, PSSample
if(i == m_ps.end()) if(i == m_ps.end())
{ {
string str[14]; string str[13];
str[0] = format("%d", sel.fst); str[0] = format("%d", sel.fst);
str[1] = format("%d", sel.wms); str[1] = format("%d", sel.wms);
@ -206,13 +206,12 @@ void GSTextureFX10::SetupPS(PSSelector sel, const PSConstantBuffer* cb, PSSample
str[4] = format("%d", sel.aem); str[4] = format("%d", sel.aem);
str[5] = format("%d", sel.tfx); str[5] = format("%d", sel.tfx);
str[6] = format("%d", sel.tcc); str[6] = format("%d", sel.tcc);
str[7] = format("%d", sel.ate); str[7] = format("%d", sel.atst);
str[8] = format("%d", sel.atst); str[8] = format("%d", sel.fog);
str[9] = format("%d", sel.fog); str[9] = format("%d", sel.clr1);
str[10] = format("%d", sel.clr1); str[10] = format("%d", sel.fba);
str[11] = format("%d", sel.fba); str[11] = format("%d", sel.aout);
str[12] = format("%d", sel.aout); str[12] = format("%d", sel.ltf);
str[13] = format("%d", sel.ltf);
D3D10_SHADER_MACRO macro[] = D3D10_SHADER_MACRO macro[] =
{ {
@ -223,13 +222,12 @@ void GSTextureFX10::SetupPS(PSSelector sel, const PSConstantBuffer* cb, PSSample
{"PS_AEM", str[4].c_str()}, {"PS_AEM", str[4].c_str()},
{"PS_TFX", str[5].c_str()}, {"PS_TFX", str[5].c_str()},
{"PS_TCC", str[6].c_str()}, {"PS_TCC", str[6].c_str()},
{"PS_ATE", str[7].c_str()}, {"PS_ATST", str[7].c_str()},
{"PS_ATST", str[8].c_str()}, {"PS_FOG", str[8].c_str()},
{"PS_FOG", str[9].c_str()}, {"PS_CLR1", str[9].c_str()},
{"PS_CLR1", str[10].c_str()}, {"PS_FBA", str[10].c_str()},
{"PS_FBA", str[11].c_str()}, {"PS_AOUT", str[11].c_str()},
{"PS_AOUT", str[12].c_str()}, {"PS_LTF", str[12].c_str()},
{"PS_LTF", str[13].c_str()},
{NULL, NULL}, {NULL, NULL},
}; };

View File

@ -199,7 +199,7 @@ void GSTextureFX11::SetupPS(PSSelector sel, const PSConstantBuffer* cb, PSSample
if(i == m_ps.end()) if(i == m_ps.end())
{ {
string str[14]; string str[13];
str[0] = format("%d", sel.fst); str[0] = format("%d", sel.fst);
str[1] = format("%d", sel.wms); str[1] = format("%d", sel.wms);
@ -208,13 +208,12 @@ void GSTextureFX11::SetupPS(PSSelector sel, const PSConstantBuffer* cb, PSSample
str[4] = format("%d", sel.aem); str[4] = format("%d", sel.aem);
str[5] = format("%d", sel.tfx); str[5] = format("%d", sel.tfx);
str[6] = format("%d", sel.tcc); str[6] = format("%d", sel.tcc);
str[7] = format("%d", sel.ate); str[7] = format("%d", sel.atst);
str[8] = format("%d", sel.atst); str[8] = format("%d", sel.fog);
str[9] = format("%d", sel.fog); str[9] = format("%d", sel.clr1);
str[10] = format("%d", sel.clr1); str[10] = format("%d", sel.fba);
str[11] = format("%d", sel.fba); str[11] = format("%d", sel.aout);
str[12] = format("%d", sel.aout); str[12] = format("%d", sel.ltf);
str[13] = format("%d", sel.ltf);
D3D11_SHADER_MACRO macro[] = D3D11_SHADER_MACRO macro[] =
{ {
@ -225,13 +224,12 @@ void GSTextureFX11::SetupPS(PSSelector sel, const PSConstantBuffer* cb, PSSample
{"PS_AEM", str[4].c_str()}, {"PS_AEM", str[4].c_str()},
{"PS_TFX", str[5].c_str()}, {"PS_TFX", str[5].c_str()},
{"PS_TCC", str[6].c_str()}, {"PS_TCC", str[6].c_str()},
{"PS_ATE", str[7].c_str()}, {"PS_ATST", str[7].c_str()},
{"PS_ATST", str[8].c_str()}, {"PS_FOG", str[8].c_str()},
{"PS_FOG", str[9].c_str()}, {"PS_CLR1", str[9].c_str()},
{"PS_CLR1", str[10].c_str()}, {"PS_FBA", str[10].c_str()},
{"PS_FBA", str[11].c_str()}, {"PS_AOUT", str[11].c_str()},
{"PS_AOUT", str[12].c_str()}, {"PS_LTF", str[12].c_str()},
{"PS_LTF", str[13].c_str()},
{NULL, NULL}, {NULL, NULL},
}; };

View File

@ -177,7 +177,7 @@ void GSTextureFX9::SetupPS(PSSelector sel, const PSConstantBuffer* cb, PSSampler
if(i == m_ps.end()) if(i == m_ps.end())
{ {
string str[13]; string str[12];
str[0] = format("%d", sel.fst); str[0] = format("%d", sel.fst);
str[1] = format("%d", sel.wms); str[1] = format("%d", sel.wms);
@ -186,12 +186,11 @@ void GSTextureFX9::SetupPS(PSSelector sel, const PSConstantBuffer* cb, PSSampler
str[4] = format("%d", sel.aem); str[4] = format("%d", sel.aem);
str[5] = format("%d", sel.tfx); str[5] = format("%d", sel.tfx);
str[6] = format("%d", sel.tcc); str[6] = format("%d", sel.tcc);
str[7] = format("%d", sel.ate); str[7] = format("%d", sel.atst);
str[8] = format("%d", sel.atst); str[8] = format("%d", sel.fog);
str[9] = format("%d", sel.fog); str[9] = format("%d", sel.clr1);
str[10] = format("%d", sel.clr1); str[10] = format("%d", sel.rt);
str[11] = format("%d", sel.rt); str[11] = format("%d", sel.ltf);
str[12] = format("%d", sel.ltf);
D3DXMACRO macro[] = D3DXMACRO macro[] =
{ {
@ -202,12 +201,11 @@ void GSTextureFX9::SetupPS(PSSelector sel, const PSConstantBuffer* cb, PSSampler
{"PS_AEM", str[4].c_str()}, {"PS_AEM", str[4].c_str()},
{"PS_TFX", str[5].c_str()}, {"PS_TFX", str[5].c_str()},
{"PS_TCC", str[6].c_str()}, {"PS_TCC", str[6].c_str()},
{"PS_ATE", str[7].c_str()}, {"PS_ATST", str[7].c_str()},
{"PS_ATST", str[8].c_str()}, {"PS_FOG", str[8].c_str()},
{"PS_FOG", str[9].c_str()}, {"PS_CLR1", str[9].c_str()},
{"PS_CLR1", str[10].c_str()}, {"PS_RT", str[10].c_str()},
{"PS_RT", str[11].c_str()}, {"PS_LTF", str[11].c_str()},
{"PS_LTF", str[12].c_str()},
{NULL, NULL}, {NULL, NULL},
}; };

View File

@ -148,7 +148,7 @@ bool GSUtil::CheckSSE()
bool GSUtil::IsDirect3D10Available() bool GSUtil::IsDirect3D10Available()
{ {
if(HMODULE hModule = LoadLibrary(_T("d3d10.dll"))) if(HMODULE hModule = LoadLibrary(_T("d3d10_1.dll")))
{ {
FreeLibrary(hModule); FreeLibrary(hModule);

View File

@ -56,7 +56,6 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
OutputFile="$(OutDir)\$(ProjectName)-$(SSEtype).dll"
ModuleDefinitionFile=".\GSdx.def" ModuleDefinitionFile=".\GSdx.def"
TargetMachine="1" TargetMachine="1"
/> />
@ -184,7 +183,6 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
OutputFile="$(OutDir)\$(ProjectName)-$(SSEtype).dll"
ModuleDefinitionFile=".\GSdx.def" ModuleDefinitionFile=".\GSdx.def"
TargetMachine="1" TargetMachine="1"
/> />
@ -310,7 +308,6 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
OutputFile="$(OutDir)\$(ProjectName)-$(SSEtype).dll"
ModuleDefinitionFile=".\GSdx.def" ModuleDefinitionFile=".\GSdx.def"
TargetMachine="1" TargetMachine="1"
/> />
@ -681,7 +678,7 @@
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
DataExecutionPrevention="0" DataExecutionPrevention="0"
TargetMachine="17" TargetMachine="1"
/> />
<Tool <Tool
Name="VCALinkTool" Name="VCALinkTool"

View File

@ -251,9 +251,9 @@
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug SSE2|Win32'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug SSE2|Win32'">
<Import Project="vsprops\ProjectRootDir.props" Condition="exists('.\vsprops\ProjectRootDir.props')" /> <Import Project="vsprops\ProjectRootDir.props" Condition="exists('.\vsprops\ProjectRootDir.props')" />
<Import Project="vsprops\sse2.props" Condition="exists('.\vsprops\sse2.props')" />
<Import Project="vsprops\common.props" Condition="exists('.\vsprops\common.props')" /> <Import Project="vsprops\common.props" Condition="exists('.\vsprops\common.props')" />
<Import Project="vsprops\debug.props" Condition="exists('.\vsprops\debug.props')" /> <Import Project="vsprops\debug.props" Condition="exists('.\vsprops\debug.props')" />
<Import Project="vsprops\sse2.props" Condition="exists('.\vsprops\sse2.props')" />
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug SSE2|X64'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug SSE2|X64'">
<Import Project="vsprops\common.props" Condition="exists('.\vsprops\common.props')" /> <Import Project="vsprops\common.props" Condition="exists('.\vsprops\common.props')" />
@ -261,9 +261,9 @@
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release SSE2|Win32'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release SSE2|Win32'">
<Import Project="vsprops\ProjectRootDir.props" Condition="exists('.\vsprops\ProjectRootDir.props')" /> <Import Project="vsprops\ProjectRootDir.props" Condition="exists('.\vsprops\ProjectRootDir.props')" />
<Import Project="vsprops\sse2.props" Condition="exists('.\vsprops\sse2.props')" />
<Import Project="vsprops\common.props" Condition="exists('.\vsprops\common.props')" /> <Import Project="vsprops\common.props" Condition="exists('.\vsprops\common.props')" />
<Import Project="vsprops\release.props" Condition="exists('.\vsprops\release.props')" /> <Import Project="vsprops\release.props" Condition="exists('.\vsprops\release.props')" />
<Import Project="vsprops\sse2.props" Condition="exists('.\vsprops\sse2.props')" />
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release SSE2|X64'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release SSE2|X64'">
<Import Project="vsprops\common.props" Condition="exists('.\vsprops\common.props')" /> <Import Project="vsprops\common.props" Condition="exists('.\vsprops\common.props')" />
@ -271,47 +271,47 @@
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release SSSE3|Win32'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release SSSE3|Win32'">
<Import Project="vsprops\ProjectRootDir.props" Condition="exists('.\vsprops\ProjectRootDir.props')" /> <Import Project="vsprops\ProjectRootDir.props" Condition="exists('.\vsprops\ProjectRootDir.props')" />
<Import Project="vsprops\ssse3.props" Condition="exists('.\vsprops\ssse3.props')" />
<Import Project="vsprops\common.props" Condition="exists('.\vsprops\common.props')" /> <Import Project="vsprops\common.props" Condition="exists('.\vsprops\common.props')" />
<Import Project="vsprops\release.props" Condition="exists('.\vsprops\release.props')" /> <Import Project="vsprops\release.props" Condition="exists('.\vsprops\release.props')" />
<Import Project="vsprops\ssse3.props" Condition="exists('.\vsprops\ssse3.props')" />
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release SSSE3|X64'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release SSSE3|X64'">
<Import Project="vsprops\ssse3.props" Condition="exists('.\vsprops\ssse3.props')" />
<Import Project="vsprops\common.props" Condition="exists('.\vsprops\common.props')" /> <Import Project="vsprops\common.props" Condition="exists('.\vsprops\common.props')" />
<Import Project="vsprops\release.props" Condition="exists('.\vsprops\release.props')" /> <Import Project="vsprops\release.props" Condition="exists('.\vsprops\release.props')" />
<Import Project="vsprops\ssse3.props" Condition="exists('.\vsprops\ssse3.props')" />
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug SSSE3|Win32'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug SSSE3|Win32'">
<Import Project="vsprops\ProjectRootDir.props" Condition="exists('.\vsprops\ProjectRootDir.props')" /> <Import Project="vsprops\ProjectRootDir.props" Condition="exists('.\vsprops\ProjectRootDir.props')" />
<Import Project="vsprops\ssse3.props" Condition="exists('.\vsprops\ssse3.props')" />
<Import Project="vsprops\common.props" Condition="exists('.\vsprops\common.props')" /> <Import Project="vsprops\common.props" Condition="exists('.\vsprops\common.props')" />
<Import Project="vsprops\debug.props" Condition="exists('.\vsprops\debug.props')" /> <Import Project="vsprops\debug.props" Condition="exists('.\vsprops\debug.props')" />
<Import Project="vsprops\ssse3.props" Condition="exists('.\vsprops\ssse3.props')" />
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug SSSE3|X64'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug SSSE3|X64'">
<Import Project="vsprops\ssse3.props" Condition="exists('.\vsprops\ssse3.props')" />
<Import Project="vsprops\common.props" Condition="exists('.\vsprops\common.props')" /> <Import Project="vsprops\common.props" Condition="exists('.\vsprops\common.props')" />
<Import Project="vsprops\debug.props" Condition="exists('.\vsprops\debug.props')" /> <Import Project="vsprops\debug.props" Condition="exists('.\vsprops\debug.props')" />
<Import Project="vsprops\ssse3.props" Condition="exists('.\vsprops\ssse3.props')" />
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug SSE4|Win32'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug SSE4|Win32'">
<Import Project="vsprops\ProjectRootDir.props" Condition="exists('.\vsprops\ProjectRootDir.props')" /> <Import Project="vsprops\ProjectRootDir.props" Condition="exists('.\vsprops\ProjectRootDir.props')" />
<Import Project="vsprops\sse4.props" Condition="exists('.\vsprops\sse4.props')" />
<Import Project="vsprops\common.props" Condition="exists('.\vsprops\common.props')" /> <Import Project="vsprops\common.props" Condition="exists('.\vsprops\common.props')" />
<Import Project="vsprops\debug.props" Condition="exists('.\vsprops\debug.props')" /> <Import Project="vsprops\debug.props" Condition="exists('.\vsprops\debug.props')" />
<Import Project="vsprops\sse4.props" Condition="exists('.\vsprops\sse4.props')" />
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug SSE4|X64'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug SSE4|X64'">
<Import Project="vsprops\sse4.props" Condition="exists('.\vsprops\sse4.props')" />
<Import Project="vsprops\common.props" Condition="exists('.\vsprops\common.props')" /> <Import Project="vsprops\common.props" Condition="exists('.\vsprops\common.props')" />
<Import Project="vsprops\debug.props" Condition="exists('.\vsprops\debug.props')" /> <Import Project="vsprops\debug.props" Condition="exists('.\vsprops\debug.props')" />
<Import Project="vsprops\sse4.props" Condition="exists('.\vsprops\sse4.props')" />
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release SSE4|Win32'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release SSE4|Win32'">
<Import Project="vsprops\ProjectRootDir.props" Condition="exists('.\vsprops\ProjectRootDir.props')" /> <Import Project="vsprops\ProjectRootDir.props" Condition="exists('.\vsprops\ProjectRootDir.props')" />
<Import Project="vsprops\sse4.props" Condition="exists('.\vsprops\sse4.props')" />
<Import Project="vsprops\common.props" Condition="exists('.\vsprops\common.props')" /> <Import Project="vsprops\common.props" Condition="exists('.\vsprops\common.props')" />
<Import Project="vsprops\release.props" Condition="exists('.\vsprops\release.props')" /> <Import Project="vsprops\release.props" Condition="exists('.\vsprops\release.props')" />
<Import Project="vsprops\sse4.props" Condition="exists('.\vsprops\sse4.props')" />
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release SSE4|X64'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release SSE4|X64'">
<Import Project="vsprops\sse4.props" Condition="exists('.\vsprops\sse4.props')" />
<Import Project="vsprops\common.props" Condition="exists('.\vsprops\common.props')" /> <Import Project="vsprops\common.props" Condition="exists('.\vsprops\common.props')" />
<Import Project="vsprops\release.props" Condition="exists('.\vsprops\release.props')" /> <Import Project="vsprops\release.props" Condition="exists('.\vsprops\release.props')" />
<Import Project="vsprops\sse4.props" Condition="exists('.\vsprops\sse4.props')" />
</ImportGroup> </ImportGroup>
<PropertyGroup Label="UserMacros" /> <PropertyGroup Label="UserMacros" />
<PropertyGroup> <PropertyGroup>
@ -1319,6 +1319,7 @@
<ClCompile Include="GSPerfMon.cpp" /> <ClCompile Include="GSPerfMon.cpp" />
<ClCompile Include="GSRasterizer.cpp" /> <ClCompile Include="GSRasterizer.cpp" />
<ClCompile Include="GSRenderer.cpp" /> <ClCompile Include="GSRenderer.cpp" />
<ClCompile Include="GSRendererDX.cpp" />
<ClCompile Include="GSRendererHW.cpp" /> <ClCompile Include="GSRendererHW.cpp" />
<ClCompile Include="GSRendererDX10.cpp" /> <ClCompile Include="GSRendererDX10.cpp" />
<ClCompile Include="GSRendererDX11.cpp" /> <ClCompile Include="GSRendererDX11.cpp" />
@ -1444,6 +1445,7 @@
<ClInclude Include="GSPerfMon.h" /> <ClInclude Include="GSPerfMon.h" />
<ClInclude Include="GSRasterizer.h" /> <ClInclude Include="GSRasterizer.h" />
<ClInclude Include="GSRenderer.h" /> <ClInclude Include="GSRenderer.h" />
<ClInclude Include="GSRendererDX.h" />
<ClInclude Include="GSRendererHW.h" /> <ClInclude Include="GSRendererHW.h" />
<ClInclude Include="GSRendererDX10.h" /> <ClInclude Include="GSRendererDX10.h" />
<ClInclude Include="GSRendererDX11.h" /> <ClInclude Include="GSRendererDX11.h" />

View File

@ -198,6 +198,9 @@
<ClCompile Include="GSRenderer.cpp"> <ClCompile Include="GSRenderer.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="GSRendererDX.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GSRendererHW.cpp"> <ClCompile Include="GSRendererHW.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
@ -518,6 +521,9 @@
<ClInclude Include="GSRenderer.h"> <ClInclude Include="GSRenderer.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="GSRendererDX.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GSRendererHW.h"> <ClInclude Include="GSRendererHW.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>

View File

@ -27,8 +27,7 @@
#define PS_AEM 0 #define PS_AEM 0
#define PS_TFX 0 #define PS_TFX 0
#define PS_TCC 1 #define PS_TCC 1
#define PS_ATE 0 #define PS_ATST 1
#define PS_ATST 4
#define PS_FOG 0 #define PS_FOG 0
#define PS_CLR1 0 #define PS_CLR1 0
#define PS_FBA 0 #define PS_FBA 0
@ -100,15 +99,6 @@ float4 sample_p(float u)
return Palette.Sample(PaletteSampler, u); return Palette.Sample(PaletteSampler, u);
} }
#if SHADER_MODEL >= 0x401
float4 gather_c(float2 uv)
{
return Texture.Gather(TextureSampler, uv, int2(0, 0));
}
#endif
#elif SHADER_MODEL <= 0x300 #elif SHADER_MODEL <= 0x300
#ifndef VS_BPPZ #ifndef VS_BPPZ
@ -126,7 +116,6 @@ float4 gather_c(float2 uv)
#define PS_AEM 0 #define PS_AEM 0
#define PS_TFX 0 #define PS_TFX 0
#define PS_TCC 0 #define PS_TCC 0
#define PS_ATE 0
#define PS_ATST 4 #define PS_ATST 4
#define PS_FOG 0 #define PS_FOG 0
#define PS_CLR1 0 #define PS_CLR1 0
@ -304,23 +293,15 @@ float4x4 sample_4c(float4 uv)
return c; return c;
} }
float4 sample_4a(float4 uv, float2 st) float4 sample_4a(float4 uv)
{ {
float4 c; float4 c;
/*
#if SHADER_MODEL >= 0x401 && PS_FMT == FMT_8 && PS_LTF && PS_WMS < 2 && PS_WMT < 2
c = gather_c(st); // the order of samples returned might not be the same as ours
#else
*/
c.x = sample_c(uv.xy).a; c.x = sample_c(uv.xy).a;
c.y = sample_c(uv.zy).a; c.y = sample_c(uv.zy).a;
c.z = sample_c(uv.xw).a; c.z = sample_c(uv.xw).a;
c.w = sample_c(uv.zw).a; c.w = sample_c(uv.zw).a;
/*
#endif
*/
#if SHADER_MODEL <= 0x300 #if SHADER_MODEL <= 0x300
if(PS_RT) c *= 128.0f / 255; if(PS_RT) c *= 128.0f / 255;
#endif #endif
@ -379,19 +360,19 @@ float4 sample(float2 st, float q)
if(PS_FMT == FMT_8H) if(PS_FMT == FMT_8H)
{ {
c = sample_4p(sample_4a(uv, st.xy)); c = sample_4p(sample_4a(uv));
} }
else if(PS_FMT == FMT_4HL) else if(PS_FMT == FMT_4HL)
{ {
c = sample_4p(fmod(sample_4a(uv, st.xy), 1.0f / 16)); c = sample_4p(fmod(sample_4a(uv), 1.0f / 16));
} }
else if(PS_FMT == FMT_4HH) else if(PS_FMT == FMT_4HH)
{ {
c = sample_4p(fmod(sample_4a(uv, st.xy) * 16, 1.0f / 16)); c = sample_4p(fmod(sample_4a(uv) * 16, 1.0f / 16));
} }
else if(PS_FMT == FMT_8) else if(PS_FMT == FMT_8)
{ {
c = sample_4p(sample_4a(uv, st.xy)); c = sample_4p(sample_4a(uv));
} }
else else
{ {
@ -476,30 +457,31 @@ float4 tfx(float4 t, float4 c)
void atst(float4 c) void atst(float4 c)
{ {
if(PS_ATE) float a = trunc(c.a * 255);
{
float a = trunc(c.a * 255);
if(PS_ATST == 0) if(PS_ATST == 0) // never
{ {
discard; discard;
} }
else if(PS_ATST == 2 || PS_ATST == 3) // l, le else if(PS_ATST == 1) // always
{ {
clip(AREF - a); // nothing to do
} }
else if(PS_ATST == 4) // e else if(PS_ATST == 2 || PS_ATST == 3) // l, le
{ {
clip(0.5f - abs(a - AREF)); clip(AREF - a);
} }
else if(PS_ATST == 5 || PS_ATST == 6) // ge, g else if(PS_ATST == 4) // e
{ {
clip(a - AREF); clip(0.5f - abs(a - AREF));
} }
else if(PS_ATST == 7) // ne else if(PS_ATST == 5 || PS_ATST == 6) // ge, g
{ {
clip(abs(a - AREF) - 0.5f); clip(a - AREF);
} }
else if(PS_ATST == 7) // ne
{
clip(abs(a - AREF) - 0.5f);
} }
} }

View File

@ -3,6 +3,7 @@
<_PropertySheetDisplayName>common</_PropertySheetDisplayName> <_PropertySheetDisplayName>common</_PropertySheetDisplayName>
<OutDir>$(SolutionDir)\bin\$(PcsxSubsection)\</OutDir> <OutDir>$(SolutionDir)\bin\$(PcsxSubsection)\</OutDir>
<IntDir>$(PlatformName)\$(Configuration)\</IntDir> <IntDir>$(PlatformName)\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)-$(SSEtype)</TargetName>
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup> <ItemDefinitionGroup>
<ClCompile> <ClCompile>
@ -15,9 +16,9 @@
<DisableSpecificWarnings>4995;4324;%(DisableSpecificWarnings)</DisableSpecificWarnings> <DisableSpecificWarnings>4995;4324;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile> </ClCompile>
<Link> <Link>
<AdditionalDependencies>JITProfiling.lib;d3d11_beta.lib;d3dx11.lib;d3d10.lib;d3dx10.lib;d3d9.lib;d3dx9.lib;ddraw.lib;dxguid.lib;winmm.lib;strmiids.lib;xinput.lib;cg.lib;cgGL.lib;glut32.lib;glew32.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>JITProfiling.lib;d3d11_beta.lib;d3dx11.lib;d3d10.lib;d3d10_1.lib;d3dx10.lib;d3d9.lib;d3dx9.lib;ddraw.lib;dxguid.lib;winmm.lib;strmiids.lib;xinput.lib;cg.lib;cgGL.lib;glut32.lib;glew32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>./vtune;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>./vtune;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<DelayLoadDLLs>d3d9.dll;d3dx9_41.dll;d3d10.dll;d3dx10_41.dll;d3d11.dll;d3d11_beta.dll;d3dx11_41.dll;%(DelayLoadDLLs)</DelayLoadDLLs> <DelayLoadDLLs>d3d9.dll;d3dx9_41.dll;d3d10.dll;d3d10_1.dll;d3dx10_41.dll;d3d11.dll;d3d11_beta.dll;d3dx11_41.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress> <RandomizedBaseAddress>false</RandomizedBaseAddress>

View File

@ -19,6 +19,7 @@
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="JITProfiling.lib d3d11_beta.lib d3dx11.lib d3d10_1.lib d3dx10.lib d3d9.lib d3dx9.lib ddraw.lib dxguid.lib winmm.lib strmiids.lib xinput.lib cg.lib cgGL.lib glut32.lib glew32.lib" AdditionalDependencies="JITProfiling.lib d3d11_beta.lib d3dx11.lib d3d10_1.lib d3dx10.lib d3d9.lib d3dx9.lib ddraw.lib dxguid.lib winmm.lib strmiids.lib xinput.lib cg.lib cgGL.lib glut32.lib glew32.lib"
OutputFile="$(OutDir)\$(ProjectName)-$(SSEtype).dll"
AdditionalLibraryDirectories="./vtune" AdditionalLibraryDirectories="./vtune"
DelayLoadDLLs="d3d9.dll;d3dx9_41.dll;d3d10.dll;d3d10_1.dll;d3dx10_41.dll;d3d11.dll;d3d11_beta.dll;d3dx11_41.dll;cg.dll;cgGL.dll;glut32.dll" DelayLoadDLLs="d3d9.dll;d3dx9_41.dll;d3d10.dll;d3d10_1.dll;d3dx10_41.dll;d3d11.dll;d3d11_beta.dll;d3dx11_41.dll;cg.dll;cgGL.dll;glut32.dll"
GenerateDebugInformation="true" GenerateDebugInformation="true"

View File

@ -1,4 +1,7 @@
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Label="UserMacros">
<SSEtype>SSE2</SSEtype>
</PropertyGroup>
<PropertyGroup> <PropertyGroup>
<_PropertySheetDisplayName>sse2</_PropertySheetDisplayName> <_PropertySheetDisplayName>sse2</_PropertySheetDisplayName>
</PropertyGroup> </PropertyGroup>
@ -8,4 +11,9 @@
<PreprocessorDefinitions>_M_SSE=0x200;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_M_SSE=0x200;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile> </ClCompile>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup>
<BuildMacro Include="SSEtype">
<Value>$(SSEtype)</Value>
</BuildMacro>
</ItemGroup>
</Project> </Project>

View File

@ -1,4 +1,7 @@
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Label="UserMacros">
<SSEtype>SSE4</SSEtype>
</PropertyGroup>
<PropertyGroup> <PropertyGroup>
<_PropertySheetDisplayName>sse4</_PropertySheetDisplayName> <_PropertySheetDisplayName>sse4</_PropertySheetDisplayName>
</PropertyGroup> </PropertyGroup>
@ -8,4 +11,9 @@
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet> <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
</ClCompile> </ClCompile>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup>
<BuildMacro Include="SSEtype">
<Value>$(SSEtype)</Value>
</BuildMacro>
</ItemGroup>
</Project> </Project>

View File

@ -1,4 +1,7 @@
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Label="UserMacros">
<SSEtype>SSSE3</SSEtype>
</PropertyGroup>
<PropertyGroup> <PropertyGroup>
<_PropertySheetDisplayName>sse3</_PropertySheetDisplayName> <_PropertySheetDisplayName>sse3</_PropertySheetDisplayName>
</PropertyGroup> </PropertyGroup>
@ -8,4 +11,9 @@
<PreprocessorDefinitions>_M_SSE=0x301;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_M_SSE=0x301;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile> </ClCompile>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup>
<BuildMacro Include="SSEtype">
<Value>$(SSEtype)</Value>
</BuildMacro>
</ItemGroup>
</Project> </Project>

View File

@ -574,7 +574,7 @@ struct VoiceMixSet
} }
}; };
const VoiceMixSet VoiceMixSet::Empty( StereoOut32(), StereoOut32() ); // Don't use SteroOut32::Empty because C++ doesn't make any dep/order checks on global initializers. const VoiceMixSet VoiceMixSet::Empty( (StereoOut32()), (StereoOut32()) ); // Don't use SteroOut32::Empty because C++ doesn't make any dep/order checks on global initializers.
static __forceinline void MixCoreVoices( VoiceMixSet& dest, const uint coreidx ) static __forceinline void MixCoreVoices( VoiceMixSet& dest, const uint coreidx )
{ {

View File

@ -0,0 +1,25 @@
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Label="UserMacros">
<ProjectRootDir>$(ProjectDir).</ProjectRootDir>
<SvnRootDir>$(ProjectRootDir)\..\..</SvnRootDir>
<SvnCommonDir>$(SvnRootDir)\common</SvnCommonDir>
<PcsxSubsection>plugins</PcsxSubsection>
</PropertyGroup>
<PropertyGroup>
<_PropertySheetDisplayName>ProjectRootDir</_PropertySheetDisplayName>
</PropertyGroup>
<ItemGroup>
<BuildMacro Include="ProjectRootDir">
<Value>$(ProjectRootDir)</Value>
</BuildMacro>
<BuildMacro Include="SvnRootDir">
<Value>$(SvnRootDir)</Value>
</BuildMacro>
<BuildMacro Include="SvnCommonDir">
<Value>$(SvnCommonDir)</Value>
</BuildMacro>
<BuildMacro Include="PcsxSubsection">
<Value>$(PcsxSubsection)</Value>
</BuildMacro>
</ItemGroup>
</Project>

View File

@ -0,0 +1,27 @@
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<_PropertySheetDisplayName>common</_PropertySheetDisplayName>
<OutDir>..\..\bin\plugins\</OutDir>
<IntDir>$(PlatformName)\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)</TargetName>
<TargetExt>.dll</TargetExt>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;_WINDOWS;_WIN32_WINNT=0x500;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<FloatingPointModel>Fast</FloatingPointModel>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<DisableSpecificWarnings>4995;4324;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
<Link>
<AdditionalDependencies>d3d10.lib;d3dx10.lib;d3d9.lib;d3dx9.lib;ddraw.lib;dxguid.lib;winmm.lib;strmiids.lib;xinput.lib;%(AdditionalDependencies)</AdditionalDependencies>
<DelayLoadDLLs>d3d9.dll;d3dx9_40.dll;d3d10.dll;d3dx10_40.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
</Link>
</ItemDefinitionGroup>
</Project>

View File

@ -0,0 +1,15 @@
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<_PropertySheetDisplayName>debug</_PropertySheetDisplayName>
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>StackFrameRuntimeCheck</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
</ClCompile>
</ItemDefinitionGroup>
</Project>

View File

@ -0,0 +1,24 @@
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<_PropertySheetDisplayName>release</_PropertySheetDisplayName>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PreprocessorDefinitions>NDEBUG;_SECURE_SCL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<BufferSecurityCheck>false</BufferSecurityCheck>
</ClCompile>
<Link>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
</Link>
</ItemDefinitionGroup>
</Project>

View File

@ -12,7 +12,7 @@
FavorSizeOrSpeed="1" FavorSizeOrSpeed="1"
OmitFramePointers="true" OmitFramePointers="true"
WholeProgramOptimization="true" WholeProgramOptimization="true"
PreprocessorDefinitions="NDEBUG" PreprocessorDefinitions="NDEBUG;_SECURE_SCL=0"
StringPooling="true" StringPooling="true"
RuntimeLibrary="2" RuntimeLibrary="2"
BufferSecurityCheck="false" BufferSecurityCheck="false"

View File

@ -0,0 +1,11 @@
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<_PropertySheetDisplayName>sse2</_PropertySheetDisplayName>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
<PreprocessorDefinitions>_M_SSE=0x200;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
</Project>

View File

@ -0,0 +1,11 @@
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<_PropertySheetDisplayName>sse4</_PropertySheetDisplayName>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<PreprocessorDefinitions>_M_SSE=0x401;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
</ClCompile>
</ItemDefinitionGroup>
</Project>

View File

@ -0,0 +1,11 @@
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<_PropertySheetDisplayName>sse3</_PropertySheetDisplayName>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
<PreprocessorDefinitions>_M_SSE=0x301;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
</Project>

View File

@ -0,0 +1,577 @@
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug SSE2|Win32">
<Configuration>Debug SSE2</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug SSE2|Win32">
<Configuration>Debug SSE2</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug SSE2|x64">
<Configuration>Debug SSE2</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug SSE2|x64">
<Configuration>Debug SSE2</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug SSE4|Win32">
<Configuration>Debug SSE4</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug SSE4|Win32">
<Configuration>Debug SSE4</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug SSE4|x64">
<Configuration>Debug SSE4</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug SSE4|x64">
<Configuration>Debug SSE4</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug SSSE3|Win32">
<Configuration>Debug SSSE3</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug SSSE3|Win32">
<Configuration>Debug SSSE3</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug SSSE3|x64">
<Configuration>Debug SSSE3</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug SSSE3|x64">
<Configuration>Debug SSSE3</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release SSE2|Win32">
<Configuration>Release SSE2</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release SSE2|Win32">
<Configuration>Release SSE2</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release SSE2|x64">
<Configuration>Release SSE2</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release SSE2|x64">
<Configuration>Release SSE2</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release SSE4|Win32">
<Configuration>Release SSE4</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release SSE4|Win32">
<Configuration>Release SSE4</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release SSE4|x64">
<Configuration>Release SSE4</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release SSE4|x64">
<Configuration>Release SSE4</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release SSSE3|Win32">
<Configuration>Release SSSE3</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release SSSE3|Win32">
<Configuration>Release SSSE3</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release SSSE3|x64">
<Configuration>Release SSSE3</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release SSSE3|x64">
<Configuration>Release SSSE3</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectName>xpad</ProjectName>
<ProjectGUID>{6F3C4136-5801-4EBC-AC6E-37DF6FAB150A}</ProjectGUID>
<RootNamespace>xpad</RootNamespace>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>Static</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|X64'">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>Static</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug SSE2|Win32'">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug SSE2|X64'">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>Static</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>false</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release SSE2|Win32'">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release SSE2|X64'">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>Static</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release SSSE3|Win32'">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release SSSE3|X64'">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>Static</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug SSSE3|Win32'">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug SSSE3|X64'">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>Static</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug SSE4|Win32'">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug SSE4|X64'">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>Static</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release SSE4|Win32'">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release SSE4|X64'">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>Static</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets">
<Import Project="$(LocalAppData)\Microsoft\VisualStudio\10.0\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(LocalAppData)\Microsoft\VisualStudio\10.0\Microsoft.Cpp.$(Platform).user.props')" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="vsprops\common.props" Condition="exists('.\vsprops\common.props')" />
<Import Project="vsprops\ProjectRootDir.props" Condition="exists('.\vsprops\ProjectRootDir.props')" />
<Import Project="..\..\common\vsprops\BaseProperties.props" Condition="exists('..\..\common\vsprops\BaseProperties.props')" />
<Import Project="vsprops\debug.props" Condition="exists('.\vsprops\debug.props')" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">
<Import Project="vsprops\common.props" Condition="exists('.\vsprops\common.props')" />
<Import Project="vsprops\ProjectRootDir.props" Condition="exists('.\vsprops\ProjectRootDir.props')" />
<Import Project="..\..\common\vsprops\BaseProperties.props" Condition="exists('..\..\common\vsprops\BaseProperties.props')" />
<Import Project="vsprops\debug.props" Condition="exists('.\vsprops\debug.props')" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="vsprops\common.props" Condition="exists('.\vsprops\common.props')" />
<Import Project="vsprops\ProjectRootDir.props" Condition="exists('.\vsprops\ProjectRootDir.props')" />
<Import Project="..\..\common\vsprops\BaseProperties.props" Condition="exists('..\..\common\vsprops\BaseProperties.props')" />
<Import Project="vsprops\release.props" Condition="exists('.\vsprops\release.props')" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|X64'">
<Import Project="vsprops\common.props" Condition="exists('.\vsprops\common.props')" />
<Import Project="vsprops\ProjectRootDir.props" Condition="exists('.\vsprops\ProjectRootDir.props')" />
<Import Project="..\..\common\vsprops\BaseProperties.props" Condition="exists('..\..\common\vsprops\BaseProperties.props')" />
<Import Project="vsprops\release.props" Condition="exists('.\vsprops\release.props')" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug SSE2|Win32'">
<Import Project="vsprops\common.props" Condition="exists('.\vsprops\common.props')" />
<Import Project="vsprops\ProjectRootDir.props" Condition="exists('.\vsprops\ProjectRootDir.props')" />
<Import Project="..\..\common\vsprops\BaseProperties.props" Condition="exists('..\..\common\vsprops\BaseProperties.props')" />
<Import Project="vsprops\debug.props" Condition="exists('.\vsprops\debug.props')" />
<Import Project="vsprops\sse2.props" Condition="exists('.\vsprops\sse2.props')" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug SSE2|X64'">
<Import Project="vsprops\common.props" Condition="exists('.\vsprops\common.props')" />
<Import Project="vsprops\ProjectRootDir.props" Condition="exists('.\vsprops\ProjectRootDir.props')" />
<Import Project="..\..\common\vsprops\BaseProperties.props" Condition="exists('..\..\common\vsprops\BaseProperties.props')" />
<Import Project="vsprops\debug.props" Condition="exists('.\vsprops\debug.props')" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release SSE2|Win32'">
<Import Project="vsprops\common.props" Condition="exists('.\vsprops\common.props')" />
<Import Project="vsprops\ProjectRootDir.props" Condition="exists('.\vsprops\ProjectRootDir.props')" />
<Import Project="..\..\common\vsprops\BaseProperties.props" Condition="exists('..\..\common\vsprops\BaseProperties.props')" />
<Import Project="vsprops\release.props" Condition="exists('.\vsprops\release.props')" />
<Import Project="vsprops\sse2.props" Condition="exists('.\vsprops\sse2.props')" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release SSE2|X64'">
<Import Project="vsprops\common.props" Condition="exists('.\vsprops\common.props')" />
<Import Project="vsprops\ProjectRootDir.props" Condition="exists('.\vsprops\ProjectRootDir.props')" />
<Import Project="..\..\common\vsprops\BaseProperties.props" Condition="exists('..\..\common\vsprops\BaseProperties.props')" />
<Import Project="vsprops\release.props" Condition="exists('.\vsprops\release.props')" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release SSSE3|Win32'">
<Import Project="vsprops\common.props" Condition="exists('.\vsprops\common.props')" />
<Import Project="vsprops\ProjectRootDir.props" Condition="exists('.\vsprops\ProjectRootDir.props')" />
<Import Project="..\..\common\vsprops\BaseProperties.props" Condition="exists('..\..\common\vsprops\BaseProperties.props')" />
<Import Project="vsprops\release.props" Condition="exists('.\vsprops\release.props')" />
<Import Project="vsprops\sse2.props" Condition="exists('.\vsprops\sse2.props')" />
<Import Project="vsprops\ssse3.props" Condition="exists('.\vsprops\ssse3.props')" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release SSSE3|X64'">
<Import Project="vsprops\common.props" Condition="exists('.\vsprops\common.props')" />
<Import Project="vsprops\ProjectRootDir.props" Condition="exists('.\vsprops\ProjectRootDir.props')" />
<Import Project="..\..\common\vsprops\BaseProperties.props" Condition="exists('..\..\common\vsprops\BaseProperties.props')" />
<Import Project="vsprops\release.props" Condition="exists('.\vsprops\release.props')" />
<Import Project="vsprops\ssse3.props" Condition="exists('.\vsprops\ssse3.props')" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug SSSE3|Win32'">
<Import Project="vsprops\common.props" Condition="exists('.\vsprops\common.props')" />
<Import Project="vsprops\ProjectRootDir.props" Condition="exists('.\vsprops\ProjectRootDir.props')" />
<Import Project="..\..\common\vsprops\BaseProperties.props" Condition="exists('..\..\common\vsprops\BaseProperties.props')" />
<Import Project="vsprops\debug.props" Condition="exists('.\vsprops\debug.props')" />
<Import Project="vsprops\sse2.props" Condition="exists('.\vsprops\sse2.props')" />
<Import Project="vsprops\ssse3.props" Condition="exists('.\vsprops\ssse3.props')" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug SSSE3|X64'">
<Import Project="vsprops\common.props" Condition="exists('.\vsprops\common.props')" />
<Import Project="vsprops\ProjectRootDir.props" Condition="exists('.\vsprops\ProjectRootDir.props')" />
<Import Project="..\..\common\vsprops\BaseProperties.props" Condition="exists('..\..\common\vsprops\BaseProperties.props')" />
<Import Project="vsprops\debug.props" Condition="exists('.\vsprops\debug.props')" />
<Import Project="vsprops\ssse3.props" Condition="exists('.\vsprops\ssse3.props')" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug SSE4|Win32'">
<Import Project="vsprops\common.props" Condition="exists('.\vsprops\common.props')" />
<Import Project="vsprops\ProjectRootDir.props" Condition="exists('.\vsprops\ProjectRootDir.props')" />
<Import Project="..\..\common\vsprops\BaseProperties.props" Condition="exists('..\..\common\vsprops\BaseProperties.props')" />
<Import Project="vsprops\debug.props" Condition="exists('.\vsprops\debug.props')" />
<Import Project="vsprops\sse2.props" Condition="exists('.\vsprops\sse2.props')" />
<Import Project="vsprops\sse4.props" Condition="exists('.\vsprops\sse4.props')" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug SSE4|X64'">
<Import Project="vsprops\common.props" Condition="exists('.\vsprops\common.props')" />
<Import Project="vsprops\ProjectRootDir.props" Condition="exists('.\vsprops\ProjectRootDir.props')" />
<Import Project="..\..\common\vsprops\BaseProperties.props" Condition="exists('..\..\common\vsprops\BaseProperties.props')" />
<Import Project="vsprops\debug.props" Condition="exists('.\vsprops\debug.props')" />
<Import Project="vsprops\sse4.props" Condition="exists('.\vsprops\sse4.props')" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release SSE4|Win32'">
<Import Project="vsprops\common.props" Condition="exists('.\vsprops\common.props')" />
<Import Project="vsprops\ProjectRootDir.props" Condition="exists('.\vsprops\ProjectRootDir.props')" />
<Import Project="..\..\common\vsprops\BaseProperties.props" Condition="exists('..\..\common\vsprops\BaseProperties.props')" />
<Import Project="vsprops\release.props" Condition="exists('.\vsprops\release.props')" />
<Import Project="vsprops\sse2.props" Condition="exists('.\vsprops\sse2.props')" />
<Import Project="vsprops\sse4.props" Condition="exists('.\vsprops\sse4.props')" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release SSE4|X64'">
<Import Project="vsprops\common.props" Condition="exists('.\vsprops\common.props')" />
<Import Project="vsprops\ProjectRootDir.props" Condition="exists('.\vsprops\ProjectRootDir.props')" />
<Import Project="..\..\common\vsprops\BaseProperties.props" Condition="exists('..\..\common\vsprops\BaseProperties.props')" />
<Import Project="vsprops\release.props" Condition="exists('.\vsprops\release.props')" />
<Import Project="vsprops\sse4.props" Condition="exists('.\vsprops\sse4.props')" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.20506.1</_ProjectFileVersion>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
</ClCompile>
<Link>
<ModuleDefinitionFile>.\xpad.def</ModuleDefinitionFile>
<DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
</ClCompile>
<Link>
<ModuleDefinitionFile>
</ModuleDefinitionFile>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
</ClCompile>
<Link>
<ModuleDefinitionFile>.\xpad.def</ModuleDefinitionFile>
<DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|X64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
</ClCompile>
<Link>
<ModuleDefinitionFile>
</ModuleDefinitionFile>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug SSE2|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
</ClCompile>
<Link>
<ModuleDefinitionFile>.\xpad.def</ModuleDefinitionFile>
<DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug SSE2|X64'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
</ClCompile>
<Link>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release SSE2|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
</ClCompile>
<Link>
<ModuleDefinitionFile>.\xpad.def</ModuleDefinitionFile>
<DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release SSE2|X64'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
</ClCompile>
<Link>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release SSSE3|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
</ClCompile>
<Link>
<ModuleDefinitionFile>.\xpad.def</ModuleDefinitionFile>
<DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release SSSE3|X64'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
</ClCompile>
<Link>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug SSSE3|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
</ClCompile>
<Link>
<ModuleDefinitionFile>.\xpad.def</ModuleDefinitionFile>
<DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug SSSE3|X64'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
</ClCompile>
<Link>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug SSE4|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
</ClCompile>
<Link>
<ModuleDefinitionFile>.\xpad.def</ModuleDefinitionFile>
<DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug SSE4|X64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
</ClCompile>
<Link>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release SSE4|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
</ClCompile>
<Link>
<ModuleDefinitionFile>.\xpad.def</ModuleDefinitionFile>
<DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release SSE4|X64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
</ClCompile>
<Link>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|X64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|X64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug SSE2|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug SSE2|X64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release SSE2|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release SSE2|X64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release SSSE3|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release SSSE3|X64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug SSSE3|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug SSSE3|X64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug SSE4|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug SSE4|X64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release SSE4|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release SSE4|X64'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="xpad.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="resource.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="svnrev.h" />
<ClInclude Include="xpad.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="xpad.rc" />
</ItemGroup>
<ItemGroup>
<None Include="res\xpad.rc2" />
<None Include="xpad.def" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -0,0 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
</Filter>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="xpad.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="resource.h">
<Filter>Resource Files</Filter>
</ClInclude>
<ClInclude Include="stdafx.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="svnrev.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="xpad.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="xpad.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<None Include="res\xpad.rc2">
<Filter>Resource Files</Filter>
</None>
<None Include="xpad.def">
<Filter>Source Files</Filter>
</None>
</ItemGroup>
</Project>

Some files were not shown because too many files have changed in this diff Show More