mirror of https://github.com/PCSX2/pcsx2.git
Lots of updates, mainly fixes for warnings, but also some optimizations
git-svn-id: http://pcsx2-playground.googlecode.com/svn/trunk@4 a6443dda-0b58-4228-96e9-037be469359c
This commit is contained in:
parent
c9cccd0164
commit
574237d451
|
@ -650,7 +650,7 @@ void cdvdReset()
|
|||
cdvd.RTC.hour = 1;
|
||||
cdvd.RTC.day = 25;
|
||||
cdvd.RTC.month = 5;
|
||||
cdvd.RTC.year = 2007;
|
||||
cdvd.RTC.year = 7; //2007
|
||||
|
||||
#ifndef _DEBUG
|
||||
#ifdef _WIN32
|
||||
|
|
|
@ -586,13 +586,13 @@ void cdrReadInterrupt() {
|
|||
cdr.StatP|= 0x22;
|
||||
cdr.Result[0] = cdr.StatP;
|
||||
|
||||
SysMessage("Reading From CDR");
|
||||
SysPrintf("Reading From CDR");
|
||||
buf = CDVDgetBuffer();
|
||||
if (buf == NULL) cdr.RErr = -1;
|
||||
|
||||
if (cdr.RErr == -1) {
|
||||
#ifdef CDR_LOG
|
||||
fprintf(emuLog, " err\n");
|
||||
CDR_LOG(" err\n");
|
||||
#endif
|
||||
memset(cdr.Transfer, 0, 2340);
|
||||
cdr.Stat = DiskError;
|
||||
|
@ -607,7 +607,7 @@ void cdrReadInterrupt() {
|
|||
cdr.Stat = DataReady;
|
||||
|
||||
#ifdef CDR_LOG
|
||||
fprintf(emuLog, " %x:%x:%x\n", cdr.Transfer[0], cdr.Transfer[1], cdr.Transfer[2]);
|
||||
CDR_LOG(" %x:%x:%x\n", cdr.Transfer[0], cdr.Transfer[1], cdr.Transfer[2]);
|
||||
#endif
|
||||
|
||||
/* if ((cdr.Muted == 1) && (cdr.Mode & 0x40) && (!Config.Xa) && (cdr.FirstSector != -1)) { // CD-XA
|
||||
|
|
|
@ -46,6 +46,9 @@ typedef struct {
|
|||
extern AppData gApp;
|
||||
#define pthread_mutex__unlock pthread_mutex_unlock
|
||||
|
||||
#define strnicmp _strnicmp
|
||||
#define stricmp _stricmp
|
||||
|
||||
#elif defined(__MINGW32__)
|
||||
|
||||
#include <sys/types.h>
|
||||
|
|
|
@ -647,11 +647,15 @@ void rcntWmode(int index, u32 value)
|
|||
}
|
||||
//if(change != 0) SysPrintf("Weee\n");
|
||||
//counters[index].sCycleT = cpuRegs.cycle - ((cpuRegs.cycle - counters[index].sCycleT) % counters[index].rate);
|
||||
#ifdef PCSX2_DEVBUILD
|
||||
if(!(value & 0x80)) SysPrintf("Stopping\n");
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
#ifdef PCSX2_DEVBUILD
|
||||
SysPrintf("Counter %d not running c%x s%x c%x\n", index, counters[index].count, counters[index].sCycleT, cpuRegs.cycle);
|
||||
if(value & 0x80) SysPrintf("Starting %d, v%x\n", index, value);
|
||||
#endif
|
||||
counters[index].sCycleT = cpuRegs.cycle;
|
||||
}
|
||||
//if((value & 0x80) && !(counters[index].mode & 0x80)) rcntUpd(index); //Counter wasnt started, so set the start cycle
|
||||
|
|
13
pcsx2/GS.cpp
13
pcsx2/GS.cpp
|
@ -123,7 +123,7 @@ u32 g_MTGSDebug = 0, g_MTGSId = 0;
|
|||
u32 CSRw;
|
||||
void gsWaitGS();
|
||||
|
||||
extern long pDsp;
|
||||
extern HWND pDsp;
|
||||
typedef u8* PU8;
|
||||
|
||||
PCSX2_ALIGNED16(u8 g_MTGSMem[0x2000]); // mtgs has to have its own memory
|
||||
|
@ -712,6 +712,7 @@ u64 gsRead64(u32 mem)
|
|||
|
||||
void gsIrq() {
|
||||
hwIntcIrq(0);
|
||||
//SysPrintf("GSIRQ called\n");
|
||||
}
|
||||
|
||||
static void GSRegHandlerSIGNAL(u32* data)
|
||||
|
@ -1030,7 +1031,7 @@ static u64 s_gstag=0; // used for querying the last tag
|
|||
|
||||
int _GIFchain() {
|
||||
#ifdef GSPATH3FIX
|
||||
u32 qwc = (psHu32(GIF_MODE) & 0x4 && vif1Regs->mskpath3) ? min(8, (int)gif->qwc) : gif->qwc;
|
||||
u32 qwc = (psHu32(GIF_MODE) & 0x4 && vif1Regs->mskpath3 && gif->qwc & ~7) ? 8 : gif->qwc;
|
||||
#else
|
||||
u32 qwc = gif->qwc;
|
||||
#endif
|
||||
|
@ -1608,18 +1609,18 @@ void* GSThreadProc(void* lpParam)
|
|||
int qsize = (tag>>16);
|
||||
MTGS_RECREAD(g_pGSRingPos+16, (qsize<<4));
|
||||
// make sure that tag>>16 is the MAX size readable
|
||||
GSgifTransfer1((u32*)(g_pGSRingPos+16) - 0x1000 + 4*qsize, 0x4000-qsize*16);
|
||||
InterlockedExchangeAdd((long*)&g_pGSRingPos, 16 + ((tag>>16)<<4));
|
||||
GSgifTransfer1((u32*)(g_pGSRingPos+0x10) - 0x1000 + 4*qsize, 0x4000-qsize*16);
|
||||
InterlockedExchangeAdd((long*)&g_pGSRingPos, 16 + (qsize<<4));
|
||||
break;
|
||||
}
|
||||
case GS_RINGTYPE_P2:
|
||||
MTGS_RECREAD(g_pGSRingPos+16, ((tag>>16)<<4));
|
||||
GSgifTransfer2((u32*)(g_pGSRingPos+16), tag>>16);
|
||||
GSgifTransfer2((u32*)(g_pGSRingPos+0x10), tag>>16);
|
||||
InterlockedExchangeAdd((long*)&g_pGSRingPos, 16 + ((tag>>16)<<4));
|
||||
break;
|
||||
case GS_RINGTYPE_P3:
|
||||
MTGS_RECREAD(g_pGSRingPos+16, ((tag>>16)<<4));
|
||||
GSgifTransfer3((u32*)(g_pGSRingPos+16), tag>>16);
|
||||
GSgifTransfer3((u32*)(g_pGSRingPos+0x10), tag>>16);
|
||||
InterlockedExchangeAdd((long*)&g_pGSRingPos, 16 + ((tag>>16)<<4));
|
||||
break;
|
||||
case GS_RINGTYPE_VSYNC:
|
||||
|
|
|
@ -1353,8 +1353,8 @@ void hwDmacIrq(int n) {
|
|||
}
|
||||
|
||||
/* Write 'size' bytes to memory address 'addr' from 'data'. */
|
||||
int hwMFIFOWrite(u32 addr, u8 *data, int size) {
|
||||
int msize = psHu32(DMAC_RBOR) + psHu32(DMAC_RBSR)+16;
|
||||
int hwMFIFOWrite(u32 addr, u8 *data, u32 size) {
|
||||
u32 msize = psHu32(DMAC_RBOR) + psHu32(DMAC_RBSR)+16;
|
||||
u8 *dst;
|
||||
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ void ConstWriteFIFO(u32 mem);
|
|||
// --- DMA ---
|
||||
//
|
||||
|
||||
typedef struct {
|
||||
typedef struct tagDMACh{
|
||||
u32 chcr;
|
||||
u32 null0[3];
|
||||
u32 madr;
|
||||
|
@ -407,8 +407,8 @@ void hwConstWrite128(u32 mem, int xmmreg);
|
|||
void hwIntcIrq(int n);
|
||||
void hwDmacIrq(int n);
|
||||
|
||||
int hwMFIFORead(u32 addr, u8 *data, int size);
|
||||
int hwMFIFOWrite(u32 addr, u8 *data, int size);
|
||||
int hwMFIFORead(u32 addr, u8 *data, u32 size);
|
||||
int hwMFIFOWrite(u32 addr, u8 *data, u32 size);
|
||||
|
||||
int hwDmacSrcChainWithStack(DMACh *dma, int id);
|
||||
int hwDmacSrcChain(DMACh *dma, int id);
|
||||
|
|
|
@ -132,7 +132,7 @@ PSMEMORYMAP initMemoryMap(ULONG_PTR* aPFNs, ULONG_PTR* aVFNs)
|
|||
|
||||
// only do vm hack for release
|
||||
#ifndef PCSX2_DEVBUILD
|
||||
#define VM_HACK
|
||||
//#define VM_HACK
|
||||
#endif
|
||||
|
||||
// virtual memory blocks
|
||||
|
@ -172,6 +172,7 @@ int memInit() {
|
|||
PHYSICAL_ALLOC(PS2MEM_VU0MICRO, 0x00010000, s_psVuMem);
|
||||
|
||||
VIRTUAL_ALLOC(PS2MEM_PSXHW, 0x00010000, PAGE_READWRITE);
|
||||
//VIRTUAL_ALLOC(PS2MEM_PSXHW2, 0x00010000, PAGE_READWRITE);
|
||||
VIRTUAL_ALLOC(PS2MEM_PSXHW4, 0x00010000, PAGE_NOACCESS);
|
||||
VIRTUAL_ALLOC(PS2MEM_GS, 0x00002000, PAGE_READWRITE);
|
||||
VIRTUAL_ALLOC(PS2MEM_DEV9, 0x00010000, PAGE_NOACCESS);
|
||||
|
@ -247,6 +248,7 @@ void memShutdown()
|
|||
VIRTUAL_FREE(PS2MEM_VU0MICRO, 0x00010000); // allocate for all VUs
|
||||
|
||||
VIRTUAL_FREE(PS2MEM_PSXHW, 0x00010000);
|
||||
//VIRTUAL_FREE(PS2MEM_PSXHW2, 0x00010000);
|
||||
VIRTUAL_FREE(PS2MEM_PSXHW4, 0x00010000);
|
||||
VIRTUAL_FREE(PS2MEM_GS, 0x00010000);
|
||||
VIRTUAL_FREE(PS2MEM_DEV9, 0x00010000);
|
||||
|
@ -344,59 +346,63 @@ int SysPageFaultExceptionFilter(struct _EXCEPTION_POINTERS* eps)
|
|||
// get bad virtual address
|
||||
addr = (u32)ExceptionRecord->ExceptionInformation[1];
|
||||
|
||||
if( addr >= (u32)PS2MEM_BASE && addr < (u32)PS2MEM_BASE+0x60000000) {
|
||||
if( (unsigned)(addr-(u32)PS2MEM_BASE) < 0x60000000) {
|
||||
PSMEMORYMAP* pmap;
|
||||
|
||||
pmap = &memLUT[(addr-(u32)PS2MEM_BASE)>>12];
|
||||
|
||||
if( pmap->aPFNs == NULL ) {
|
||||
if( !pmap->aPFNs ) {
|
||||
// NOTE: this is a hack because the address is truncated and there's no way
|
||||
// to tell what it's upper bits are (due to OS limitations).
|
||||
pmap += 0x80000;
|
||||
if( pmap->aPFNs == NULL ) {
|
||||
if( !pmap->aPFNs ) {
|
||||
pmap += 0x20000;
|
||||
if( !pmap->aPFNs ) goto OtherException;
|
||||
}
|
||||
//else addr += 0x20000000;
|
||||
}
|
||||
|
||||
if( pmap->aPFNs != NULL ) {
|
||||
LPVOID pnewaddr;
|
||||
DWORD oldaddr = pmap->aVFNs[0];
|
||||
{
|
||||
//LPVOID pnewaddr; not used
|
||||
uptr curvaddr = pmap->aVFNs[0];
|
||||
|
||||
if( pmap->aVFNs[0] != 0 ) {
|
||||
if( curvaddr ) {
|
||||
// delete the current mapping
|
||||
SysMapUserPhysicalPages((void*)pmap->aVFNs[0], 1, NULL, 0);
|
||||
SysMapUserPhysicalPages((void*)curvaddr, 1, NULL, 0);
|
||||
}
|
||||
|
||||
assert( pmap->aPFNs[0] != 0 );
|
||||
|
||||
pmap->aVFNs[0] = addr&~0xfff;
|
||||
if( SysMapUserPhysicalPages((void*)(addr&~0xfff), 1, pmap->aPFNs, 0) )
|
||||
pmap->aVFNs[0] = curvaddr = addr&~0xfff;
|
||||
if( SysMapUserPhysicalPages((void*)curvaddr, 1, pmap->aPFNs, 0) )
|
||||
return EXCEPTION_CONTINUE_EXECUTION;
|
||||
|
||||
// try allocing the virtual mem
|
||||
pnewaddr = VirtualAlloc((void*)(addr&~0xffff), 0x10000, MEM_RESERVE|MEM_PHYSICAL, PAGE_READWRITE);
|
||||
//pnewaddr = <- not used
|
||||
/* use here the size of allocation granularity and force rounding down,
|
||||
because in reserve mode the address is rounded up/down to the nearest
|
||||
multiple of this granularity; if you did it not this way, in some cases
|
||||
the same address would be used twice, so the api fails */
|
||||
VirtualAlloc((void*)(curvaddr&~0xffff), 0x10000, MEM_RESERVE|MEM_PHYSICAL, PAGE_READWRITE);
|
||||
|
||||
if( SysMapUserPhysicalPages((void*)(addr&~0xfff), 1, pmap->aPFNs, 0) )
|
||||
if( SysMapUserPhysicalPages((void*)curvaddr, 1, pmap->aPFNs, 0) )
|
||||
return EXCEPTION_CONTINUE_EXECUTION;
|
||||
|
||||
SysPrintf("Fatal error, virtual page 0x%x cannot be found %d (p:%x,v:%x)\n",
|
||||
addr-(u32)PS2MEM_BASE, GetLastError(), pmap->aPFNs[0], pmap->aVFNs[0]);
|
||||
addr-(u32)PS2MEM_BASE, GetLastError(), pmap->aPFNs[0], curvaddr);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// check if vumem
|
||||
// check if vumem
|
||||
else if( (addr&0xffff4000) == 0x11000000 ) {
|
||||
// vu0mem
|
||||
SysMapUserPhysicalPages((void*)s_psVuMem.aVFNs[1], 1, NULL, 0);
|
||||
|
||||
s_psVuMem.aVFNs[1] = addr&~0xfff;
|
||||
SysMapUserPhysicalPages((void*)addr, 1, s_psVuMem.aPFNs, 1);
|
||||
|
||||
if( (addr&0xffff4000) == 0x11000000 ) {
|
||||
// vu0mem
|
||||
SysMapUserPhysicalPages((void*)s_psVuMem.aVFNs[1], 1, NULL, 0);
|
||||
|
||||
s_psVuMem.aVFNs[1] = addr&~0xfff;
|
||||
SysMapUserPhysicalPages((void*)addr, 1, s_psVuMem.aPFNs, 1);
|
||||
|
||||
return EXCEPTION_CONTINUE_EXECUTION;
|
||||
}
|
||||
return EXCEPTION_CONTINUE_EXECUTION;
|
||||
}
|
||||
OtherException:
|
||||
|
||||
#ifdef VM_HACK
|
||||
{
|
||||
|
|
|
@ -55,6 +55,7 @@ typedef struct _PSMEMORYMAP
|
|||
|
||||
// function for mapping memory
|
||||
#define PS2MEM_PSXHW ((u8*)((u32)PS2MEM_BASE+0x1f800000))
|
||||
//#define PS2MEM_PSXHW2 ((u8*)((u32)PS2MEM_BASE+0x1fa00000))
|
||||
#define PS2MEM_PSXHW4 ((u8*)((u32)PS2MEM_BASE+0x1f400000))
|
||||
#define PS2MEM_GS ((u8*)((u32)PS2MEM_BASE+0x12000000))
|
||||
#define PS2MEM_DEV9 ((u8*)((u32)PS2MEM_BASE+0x14000000))
|
||||
|
|
10
pcsx2/Misc.c
10
pcsx2/Misc.c
|
@ -581,8 +581,8 @@ int SaveState(char *file) {
|
|||
SysPrintf("Saving GS\n");
|
||||
if( CHECK_MULTIGS ) {
|
||||
// have to call in thread, otherwise weird stuff will start happening
|
||||
uptr uf = (uptr)f;
|
||||
GSRingBufSimplePacket(GS_RINGTYPE_SAVE, (int)(uf&0xffffffff), (int)(uf>>32), 0);
|
||||
u64 uf = (uptr)f;
|
||||
GSRingBufSimplePacket(GS_RINGTYPE_SAVE, (u32)(uf&0xffffffff), (u32)(uf>>32), 0);
|
||||
gsWaitGS();
|
||||
}
|
||||
else {
|
||||
|
@ -713,8 +713,8 @@ int LoadState(char *file) {
|
|||
SysPrintf("Loading GS\n");
|
||||
if( CHECK_MULTIGS ) {
|
||||
// have to call in thread, otherwise weird stuff will start happening
|
||||
uptr uf = (uptr)f;
|
||||
GSRingBufSimplePacket(GS_RINGTYPE_LOAD, (int)(uf&0xffffffff), (int)(uf>>32), 0);
|
||||
u64 uf = (uptr)f;
|
||||
GSRingBufSimplePacket(GS_RINGTYPE_LOAD, (u32)(uf&0xffffffff), (u32)(uf>>32), 0);
|
||||
gsWaitGS();
|
||||
}
|
||||
else {
|
||||
|
@ -757,7 +757,7 @@ int SaveGSState(char *file)
|
|||
return 0;
|
||||
}
|
||||
|
||||
extern long pDsp;
|
||||
extern HWND pDsp;
|
||||
int LoadGSState(char *file)
|
||||
{
|
||||
int ret;
|
||||
|
|
|
@ -508,7 +508,7 @@ int LoadPlugins() {
|
|||
return 0;
|
||||
}
|
||||
|
||||
uptr pDsp;
|
||||
HWND pDsp;
|
||||
static pluginsopened = 0;
|
||||
extern void spu2DMA4Irq();
|
||||
extern void spu2DMA7Irq();
|
||||
|
|
|
@ -39,7 +39,7 @@ typedef struct _PSMEMORYBLOCK
|
|||
{
|
||||
#ifdef _WIN32
|
||||
int NumberPages;
|
||||
uptr* aPFNs;
|
||||
PULONG_PTR aPFNs;
|
||||
uptr* aVFNs; // virtual pages that own the physical pages
|
||||
#else
|
||||
int fd; // file descriptor
|
||||
|
|
|
@ -409,11 +409,11 @@ void UNPACK_V4_5(u32 *dest, u32 *data, int size) {
|
|||
|
||||
static int cycles;
|
||||
extern int g_vifCycles;
|
||||
int vifqwc = 0;
|
||||
u16 vifqwc = 0;
|
||||
__inline int mfifoVIF1rbTransfer() {
|
||||
u32 maddr = psHu32(DMAC_RBOR);
|
||||
int msize = psHu32(DMAC_RBOR) + psHu32(DMAC_RBSR) + 16, ret;
|
||||
int mfifoqwc = min(vif1ch->qwc, vifqwc);
|
||||
u32 ret, msize = psHu32(DMAC_RBOR) + psHu32(DMAC_RBSR) + 16;
|
||||
u16 mfifoqwc = min(vif1ch->qwc, vifqwc);
|
||||
u32 *src;
|
||||
|
||||
/* Check if the transfer should wrap around the ring buffer */
|
||||
|
|
|
@ -469,10 +469,10 @@ static void VIFunpack(u32 *data, vifCode *v, int size, const unsigned int VIFdma
|
|||
if (v->size != (size>>2))ProcessMemSkip(size, unpackType, VIFdmanum);
|
||||
|
||||
if(vifRegs->offset < (u32)ft->qsize){
|
||||
if((size/ft->dsize) < (ft->qsize - vifRegs->offset)){
|
||||
if(((u32)size/(u32)ft->dsize) < ((u32)ft->qsize - vifRegs->offset)){
|
||||
SysPrintf("wasnt enough left size/dsize = %x left to write %x\n", (size/ft->dsize), (ft->qsize - vifRegs->offset));
|
||||
}
|
||||
unpacksize = min((size/ft->dsize), (ft->qsize - vifRegs->offset));
|
||||
unpacksize = min(((u32)size/(u32)ft->dsize), ((u32)ft->qsize - vifRegs->offset));
|
||||
} else {
|
||||
unpacksize = 0;
|
||||
SysPrintf("Unpack align offset = 0\n");
|
||||
|
|
|
@ -356,7 +356,7 @@ class Dir
|
|||
|
||||
void Release()
|
||||
{
|
||||
for(int i=0;i<Sons.size();i++)
|
||||
for(unsigned int i=0;i<Sons.size();i++)
|
||||
{
|
||||
Sons[i].Release();
|
||||
}
|
||||
|
@ -409,7 +409,7 @@ class Dir
|
|||
u32 NumberOfFrames = *(u32 *)(File + AnimationSegmentOffset + 16);
|
||||
|
||||
u32 Offset = AnimationSegmentOffset + 20;
|
||||
for(int i=0;i<NumberOfFrames;i++)
|
||||
for(u32 i=0;i<NumberOfFrames;i++)
|
||||
{
|
||||
u32 KeyNum = *(u32 *)(File + Offset + 4);
|
||||
Offset += 16 + (KeyNum * 8) - 8; // The -8 is there because the doc with the ico format spec is either wrong or I'm stupid
|
||||
|
@ -501,7 +501,7 @@ class SaveGame
|
|||
D = _Dir;
|
||||
|
||||
// Find icon.sys
|
||||
for(int i=0;i<D->Sons.size();i++)
|
||||
for(unsigned int i=0;i<D->Sons.size();i++)
|
||||
{
|
||||
if(!strcmp("icon.sys", D->Sons[i].Name))
|
||||
{
|
||||
|
@ -546,7 +546,7 @@ class SaveGame
|
|||
}
|
||||
|
||||
// Find the icon now
|
||||
for(int i=0;i<D->Sons.size();i++)
|
||||
for(unsigned int i=0;i<D->Sons.size();i++)
|
||||
{
|
||||
if(!strcmp(IconName, D->Sons[i].Name))
|
||||
{
|
||||
|
@ -840,7 +840,7 @@ class MemoryCard
|
|||
|
||||
void AddDirToTreeView(HWND hWnd, HTREEITEM tree, Dir *d)
|
||||
{
|
||||
for(int i=0;i<d->Sons.size();i++)
|
||||
for(unsigned int i=0;i<d->Sons.size();i++)
|
||||
{
|
||||
HTREEITEM temptree = AddTreeItem(hWnd, tree, d->Sons[i].Name, 0);
|
||||
if(d->Sons[i].IsDirectory())
|
||||
|
@ -870,7 +870,7 @@ class MemoryCard
|
|||
item.iIndent = 0;
|
||||
item.lParam = 0;
|
||||
|
||||
for(int i=0;i<SaveGameList.size();i++)
|
||||
for(unsigned int i=0;i<SaveGameList.size();i++)
|
||||
{
|
||||
strcpy(item.pszText, SaveGameList[i].Name1);
|
||||
if(SaveGameList[i].Name2[0] != 0)
|
||||
|
@ -895,7 +895,7 @@ class MemoryCard
|
|||
Dir *FindFile(char *dir, char *file)
|
||||
{
|
||||
//Find the dir first
|
||||
int i;
|
||||
unsigned int i;
|
||||
for(i=0;i<Root.Sons.size();i++)
|
||||
{
|
||||
if(!strcmp(dir, Root.Sons[i].Name))
|
||||
|
@ -971,7 +971,7 @@ class MemoryCard
|
|||
u32 NumberOfFrames = *(u32 *)(d->File + AnimationSegmentOffset + 16);
|
||||
|
||||
u32 Offset = AnimationSegmentOffset + 20;
|
||||
for(int i=0;i<NumberOfFrames;i++)
|
||||
for(unsigned int i=0;i<NumberOfFrames;i++)
|
||||
{
|
||||
u32 KeyNum = *(u32 *)(d->File + Offset + 4);
|
||||
Offset += 16 + (KeyNum * 8) - 8; // The -8 is there because the doc with the ico format spec is either wrong or I'm stupid
|
||||
|
@ -1059,7 +1059,7 @@ class MemoryCard
|
|||
// Create the image list
|
||||
ImageList = ImageList_Create(64, 64, ILC_COLOR32, 10, 256);
|
||||
|
||||
for(int i=0;i<Root.Sons.size();i++)
|
||||
for(unsigned int i=0;i<Root.Sons.size();i++)
|
||||
{
|
||||
if(Root.Sons[i].Name[0] != '.')
|
||||
{
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||
# Visual Studio 2008
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pcsx2", "pcsx2_2008.vcproj", "{1CEFD830-2B76-4596-A4EE-BCD7280A60BD}"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="windows-1253"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
Version="9,00"
|
||||
Name="pcsx2"
|
||||
ProjectGUID="{1CEFD830-2B76-4596-A4EE-BCD7280A60BD}"
|
||||
RootNamespace="pcsx2"
|
||||
|
@ -265,6 +265,29 @@
|
|||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
InlineFunctionExpansion="1"
|
||||
EnableIntrinsicFunctions="true"
|
||||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="true"
|
||||
EnableFiberSafeOptimizations="true"
|
||||
WholeProgramOptimization="true"
|
||||
AdditionalIncludeDirectories="./;../../;../../IPU;../../ZLIB;../../DebugTools;../../x86;"../../x86/ix86-32";../libs"
|
||||
PreprocessorDefinitions="NDEBUG,WIN32,_WINDOWS,__MSCW32__,__WIN32__,__i386__,ENABLE_NLS,PACKAGE=\"pcsx2\";PCSX2_DEVBUILD;_CRT_SECURE_NO_DEPRECATE;TIXML_USE_STL"
|
||||
StringPooling="true"
|
||||
ExceptionHandling="1"
|
||||
RuntimeLibrary="0"
|
||||
StructMemberAlignment="5"
|
||||
BufferSecurityCheck="false"
|
||||
EnableFunctionLevelLinking="false"
|
||||
EnableEnhancedInstructionSet="2"
|
||||
PrecompiledHeaderFile=".\ReleaseTLB/pcsx2.pch"
|
||||
AssemblerListingLocation=".\ReleaseTLB/"
|
||||
ObjectFile=".\ReleaseTLB/"
|
||||
ProgramDataBaseFileName=".\ReleaseTLB/"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
CompileAs="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
|
@ -336,6 +359,8 @@
|
|||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
EnableFiberSafeOptimizations="true"
|
||||
EnableEnhancedInstructionSet="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
|
@ -349,6 +374,7 @@
|
|||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="..\..\..\bin\pcsx2r.exe"
|
||||
ProgramDatabaseFile=""$(TargetDir)$(TargetName).pdb""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
|
@ -405,7 +431,7 @@
|
|||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\McdsDlg.c"
|
||||
RelativePath="..\McdsDlg.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
|
|
|
@ -691,7 +691,7 @@ BOOL CALLBACK AddPatchProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
|
|||
|
||||
// Spin Control
|
||||
SendMessage(GetDlgItem(hWnd, IDC_SPIN1), UDM_SETBUDDY, (WPARAM)GetDlgItem(hWnd, IDC_GROUP), 0);
|
||||
SendMessage(GetDlgItem(hWnd, IDC_SPIN1), UDM_SETRANGE32, (WPARAM)-2147483648, (LPARAM)2147483647);
|
||||
SendMessage(GetDlgItem(hWnd, IDC_SPIN1), UDM_SETRANGE32, (WPARAM)(0-0x80000000), (LPARAM)0x7FFFFFFF);
|
||||
|
||||
break;
|
||||
case WM_COMMAND:
|
||||
|
@ -800,7 +800,7 @@ BOOL CALLBACK EditPatch(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
|
|||
|
||||
// Spin Control
|
||||
SendMessage(GetDlgItem(hWnd, IDC_SPIN1), UDM_SETBUDDY, (WPARAM)GetDlgItem(hWnd, IDC_GROUP), 0);
|
||||
SendMessage(GetDlgItem(hWnd, IDC_SPIN1), UDM_SETRANGE32, (WPARAM)-2147483648, (LPARAM)2147483647);
|
||||
SendMessage(GetDlgItem(hWnd, IDC_SPIN1), UDM_SETRANGE32, (WPARAM)(0-0x80000000), (LPARAM)0x7FFFFFFF);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,11 +19,14 @@
|
|||
#define CHEATS_H_INCLUDED
|
||||
|
||||
#ifndef __cplusplus
|
||||
typedef enum ebool
|
||||
{
|
||||
false,
|
||||
true
|
||||
} bool;
|
||||
//typedef enum ebool
|
||||
//{
|
||||
// false,
|
||||
// true
|
||||
//} bool;
|
||||
#define bool unsigned __int8
|
||||
#define false 0
|
||||
#define true 1
|
||||
#endif
|
||||
|
||||
extern HINSTANCE pInstance;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "afxres.h"
|
||||
#include "mingw\afxres.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
@ -1456,9 +1456,9 @@ BEGIN
|
|||
CONTROL "CDR log",IDC_IOPCDRLOG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,165,104,43,10
|
||||
CONTROL "VUMicro log",IDC_VUMICROLOG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,75,110,55,10
|
||||
CONTROL "RPC services log",IDC_RPCSERVICES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,5,125,67,10
|
||||
CONTROL "Log to STDOUT",IDC_STDOUTPUTLOG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,75,125,68,10
|
||||
CONTROL "Log to STDOUT",IDC_STDOUTPUTLOG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,75,140,53,10
|
||||
CONTROL "Log",IDC_LOGS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,5,140,28,10
|
||||
CONTROL "Symbols log",IDC_SYMLOG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,75,140,53,10
|
||||
CONTROL "Symbols log",IDC_SYMLOG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,75,125,68,10
|
||||
CONTROL "Counters log",IDC_IOPCNTLOG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,165,118,55,10
|
||||
CONTROL "EE Counters log",IDC_EECNTLOG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,165,139,73,11
|
||||
END
|
||||
|
|
|
@ -637,8 +637,8 @@
|
|||
#define IDC_IOPGPULOG 1527
|
||||
#define IDC_IOPCNTLOG 1529
|
||||
#define IDC_EECNTLOG 1530
|
||||
#define IDC_SYMLOG 1531
|
||||
#define IDC_STDOUTPUTLOG 1532
|
||||
#define IDC_STDOUTPUTLOG 1531
|
||||
#define IDC_SYMLOG 1532
|
||||
#define IDC_SEARCH 1701
|
||||
#define IDC_VALUE 1702
|
||||
#define IDC_OLD 1703
|
||||
|
|
|
@ -116,7 +116,7 @@ extern void _vu0WaitMicro();
|
|||
|
||||
static void recCFC2()
|
||||
{
|
||||
int mmreg, creg;
|
||||
int mmreg;
|
||||
|
||||
if (cpuRegs.code & 1) {
|
||||
iFlushCall(IS_X8664?(FLUSH_FREE_VU0|FLUSH_FREE_TEMPX86):FLUSH_NOCONST);
|
||||
|
@ -130,7 +130,7 @@ static void recCFC2()
|
|||
#ifdef __x86_64__
|
||||
mmreg = _allocX86reg(-1, X86TYPE_GPR, _Rt_, MODE_WRITE);
|
||||
|
||||
if( (creg = _checkX86reg(X86TYPE_VI, _Fs_, MODE_READ)) >= 0 ) {
|
||||
if( (int creg = _checkX86reg(X86TYPE_VI, _Fs_, MODE_READ)) >= 0 ) {
|
||||
if(EEINST_ISLIVE1(_Rt_)) {
|
||||
if( _Fs_ < 16 ) {
|
||||
// zero extending
|
||||
|
@ -211,8 +211,6 @@ static void recCFC2()
|
|||
|
||||
static void recCTC2()
|
||||
{
|
||||
int mmreg;
|
||||
|
||||
if (cpuRegs.code & 1) {
|
||||
iFlushCall(IS_X8664?(FLUSH_FREE_VU0|FLUSH_FREE_TEMPX86):FLUSH_NOCONST);
|
||||
CALLFunc((uptr)_vu0WaitMicro);
|
||||
|
@ -227,7 +225,7 @@ static void recCTC2()
|
|||
case REG_VPU_STAT: // read-only
|
||||
break;
|
||||
case REG_FBRST:
|
||||
|
||||
{
|
||||
if( g_cpuConstRegs[_Rt_].UL[0] & 0x202 )
|
||||
iFlushCall(FLUSH_FREE_TEMPX86);
|
||||
_deleteX86reg(X86TYPE_VI, REG_FBRST, 2);
|
||||
|
@ -242,9 +240,9 @@ static void recCTC2()
|
|||
|
||||
MOV16ItoM((uptr)&VU0.VI[REG_FBRST].UL,g_cpuConstRegs[_Rt_].UL[0]&0x0c0c);
|
||||
break;
|
||||
|
||||
}
|
||||
case REG_CMSAR1: // REG_CMSAR1
|
||||
|
||||
{
|
||||
iFlushCall(IS_X8664?FLUSH_FREE_TEMPX86:FLUSH_NOCONST); // since CALLFunc
|
||||
assert( _checkX86reg(X86TYPE_VI, REG_VPU_STAT, 0) < 0 &&
|
||||
_checkX86reg(X86TYPE_VI, REG_TPC, 0) < 0 );
|
||||
|
@ -271,12 +269,14 @@ static void recCTC2()
|
|||
#endif
|
||||
//x86SetJ8( j8Ptr[0] );
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
if( _Fs_ < 16 )
|
||||
assert( (g_cpuConstRegs[_Rt_].UL[0]&0xffff0000)==0);
|
||||
|
||||
#ifdef __x86_64__
|
||||
if( (mmreg = _checkX86reg(X86TYPE_VI, _Fs_, MODE_WRITE)) >= 0 )
|
||||
if( (int mmreg = _checkX86reg(X86TYPE_VI, _Fs_, MODE_WRITE)) >= 0 )
|
||||
MOV32ItoR(mmreg, g_cpuConstRegs[_Rt_].UL[0]);
|
||||
else
|
||||
#else
|
||||
|
@ -307,6 +307,7 @@ static void recCTC2()
|
|||
#endif
|
||||
//x86SetJ8(j8Ptr[0]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -316,6 +317,7 @@ static void recCTC2()
|
|||
case REG_VPU_STAT: // read-only
|
||||
break;
|
||||
case REG_FBRST:
|
||||
{
|
||||
iFlushCall(FLUSH_FREE_TEMPX86);
|
||||
assert( _checkX86reg(X86TYPE_VI, REG_FBRST, 0) < 0 );
|
||||
|
||||
|
@ -336,8 +338,9 @@ static void recCTC2()
|
|||
AND32ItoR(EAX,0x0C0C);
|
||||
MOV16RtoM((uptr)&VU0.VI[REG_FBRST].UL,EAX);
|
||||
break;
|
||||
}
|
||||
case REG_CMSAR1: // REG_CMSAR1
|
||||
|
||||
{
|
||||
iFlushCall(IS_X8664?FLUSH_FREE_TEMPX86:FLUSH_NOCONST); // since CALLFunc
|
||||
|
||||
// ignore if VU1 is operating
|
||||
|
@ -351,9 +354,11 @@ static void recCTC2()
|
|||
/*FreezeXMMRegs(0);*/
|
||||
//x86SetJ8( j8Ptr[0] );
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
#ifdef __x86_64__
|
||||
if( (mmreg = _checkX86reg(X86TYPE_VI, _Fs_, MODE_WRITE)) >= 0 )
|
||||
if( (int mmreg = _checkX86reg(X86TYPE_VI, _Fs_, MODE_WRITE)) >= 0 )
|
||||
_eeMoveGPRtoR(mmreg, _Rt_);
|
||||
else
|
||||
#else
|
||||
|
@ -381,6 +386,7 @@ static void recCTC2()
|
|||
#endif
|
||||
// x86SetJ8(j8Ptr[0]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -505,6 +505,7 @@ void recSQRT_S_(int info)
|
|||
|
||||
void recABS_S_(int info)
|
||||
{
|
||||
//AND32ItoM( (uptr)&fpuRegs.fpr[ _Fd_ ].f, 0x7fffffff ); // isn't this faster?
|
||||
MOV32MtoR( EAX, (uptr)&fpuRegs.fpr[ _Fs_ ].f );
|
||||
AND32ItoR( EAX, 0x7fffffff );
|
||||
MOV32RtoM( (uptr)&fpuRegs.fpr[ _Fd_ ].f, EAX );
|
||||
|
@ -518,6 +519,7 @@ void recMOV_S_(int info)
|
|||
|
||||
void recNEG_S_(int info)
|
||||
{
|
||||
//XOR32ItoM( (uptr)&fpuRegs.fpr[ _Fd_ ].f, 0x80000000 ); // isn't this faster?
|
||||
MOV32MtoR( EAX,(uptr)&fpuRegs.fpr[ _Fs_ ].f );
|
||||
XOR32ItoR( EAX, 0x80000000 );
|
||||
MOV32RtoM( (uptr)&fpuRegs.fpr[ _Fd_ ].f, EAX );
|
||||
|
@ -1088,8 +1090,8 @@ FPURECOMPILE_CONSTCODE(MULA_S, XMMINFO_WRITEACC|XMMINFO_READS|XMMINFO_READT);
|
|||
|
||||
void recMADDtemp(int info, int regd)
|
||||
{
|
||||
int vreg;
|
||||
u32 mreg;
|
||||
//int vreg;
|
||||
//u32 mreg;
|
||||
int t0reg;
|
||||
|
||||
switch(info & (PROCESS_EE_S|PROCESS_EE_T) ) {
|
||||
|
@ -1194,8 +1196,8 @@ FPURECOMPILE_CONSTCODE(MADDA_S, XMMINFO_WRITEACC|XMMINFO_READACC|XMMINFO_READS|X
|
|||
|
||||
void recMSUBtemp(int info, int regd)
|
||||
{
|
||||
int vreg;
|
||||
u32 mreg;
|
||||
//int vreg;
|
||||
//u32 mreg;
|
||||
int t0reg;
|
||||
|
||||
|
||||
|
|
|
@ -1481,7 +1481,7 @@ void SetCPUState(u32 sseMXCSR, u32 sseVUMXCSR)
|
|||
int recInit( void )
|
||||
{
|
||||
int i;
|
||||
const u8 macarr[16] = {0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15 };
|
||||
static const u8 macarr[16] = {0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15 };
|
||||
|
||||
recLUT = (uptr*) _aligned_malloc( 0x010000 * sizeof(uptr), 16 );
|
||||
memset( recLUT, 0, 0x010000 * sizeof(uptr) );
|
||||
|
@ -2136,7 +2136,6 @@ void SetBranchReg( u32 reg )
|
|||
|
||||
void SetBranchImm( u32 imm )
|
||||
{
|
||||
u32* ptr;
|
||||
branch = 1;
|
||||
|
||||
assert( imm );
|
||||
|
@ -2149,8 +2148,10 @@ void SetBranchImm( u32 imm )
|
|||
if( bExecBIOS ) CheckForBIOSEnd();
|
||||
|
||||
MOV32ItoR(EDX, 0);
|
||||
ptr = (u32*)(x86Ptr-4);
|
||||
*ptr = (u32)JMP32((u32)Dispatcher - ( (u32)x86Ptr + 5 ));
|
||||
{
|
||||
u32* ptr = (u32*)(x86Ptr-4);
|
||||
*ptr = (u32)JMP32((u32)Dispatcher - ( (u32)x86Ptr + 5 ));
|
||||
}
|
||||
}
|
||||
|
||||
void SaveBranchState()
|
||||
|
@ -2834,9 +2835,9 @@ void recRecompile( u32 startpc )
|
|||
else {
|
||||
s_pCurBlockEx = NULL;
|
||||
for(i = 0; i < EE_NUMBLOCKS; ++i) {
|
||||
if( recBlocks[(i+s_nNextBlock)%EE_NUMBLOCKS].size == 0 ) {
|
||||
s_pCurBlockEx = recBlocks+(i+s_nNextBlock)%EE_NUMBLOCKS;
|
||||
s_nNextBlock = (i+s_nNextBlock+1)%EE_NUMBLOCKS;
|
||||
if( recBlocks[(i+s_nNextBlock)&(EE_NUMBLOCKS-1)].size == 0 ) {
|
||||
s_pCurBlockEx = recBlocks+((i+s_nNextBlock)&(EE_NUMBLOCKS-1));
|
||||
s_nNextBlock = (i+s_nNextBlock+1)&(EE_NUMBLOCKS-1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -261,7 +261,7 @@ int recSetMemLocation(int regs, int imm, int mmreg, int msize, int j32)
|
|||
SetMMXstate();
|
||||
}
|
||||
else {
|
||||
MOV32MtoR( ECX, (int)&cpuRegs.GPR.r[ regs ].UL[ 0 ] );
|
||||
MOV32MtoR( ECX, (uptr)&cpuRegs.GPR.r[ regs ].UL[ 0 ] );
|
||||
}
|
||||
|
||||
if ( imm != 0 ) ADD32ItoR( ECX, imm );
|
||||
|
@ -313,7 +313,7 @@ int recSetMemLocation(int regs, int imm, int mmreg, int msize, int j32)
|
|||
AND8RtoR(ECX, EAX);
|
||||
ROR32ItoR(ECX, 4);
|
||||
|
||||
OR16RtoR(EAX, EAX);
|
||||
TEST16RtoR(EAX, EAX); // this is faster, because sets no dependend reg.
|
||||
|
||||
if( s_bCachingMem & 2 ) j32Ptr[2] = j32Ptr[3] = JS32(0);
|
||||
else j8Ptr[0] = j8Ptr[3] = JS8(0);
|
||||
|
@ -1327,8 +1327,8 @@ void recLQ( void )
|
|||
|
||||
SET_HWLOC();
|
||||
|
||||
PUSH32I( (int)&cpuRegs.GPR.r[ _Rt_ ].UL[ 0 ] );
|
||||
CALLFunc( (int)recMemRead128 );
|
||||
PUSH32I( (u32)&cpuRegs.GPR.r[ _Rt_ ].UL[ 0 ] );
|
||||
CALLFunc( (uptr)recMemRead128 );
|
||||
|
||||
if( mmreg >= 0 && (mmreg & MEM_MMXTAG) ) MOVQMtoR(mmreg&0xf, (int)&cpuRegs.GPR.r[ _Rt_ ].UL[ 0 ]);
|
||||
else if( mmreg >= 0 && (mmreg & MEM_XMMTAG) ) SSEX_MOVDQA_M128_to_XMM(mmreg&0xf, (int)&cpuRegs.GPR.r[ _Rt_ ].UL[ 0 ] );
|
||||
|
@ -1343,8 +1343,8 @@ void recLQ( void )
|
|||
|
||||
SET_HWLOC();
|
||||
|
||||
PUSH32I( (int)&retValues[0] );
|
||||
CALLFunc( (int)recMemRead128 );
|
||||
PUSH32I( (u32)&retValues[0] );
|
||||
CALLFunc( (uptr)recMemRead128 );
|
||||
ADD32ItoR(ESP, 4);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,16 +72,16 @@ void WriteRmOffset(x86IntRegType to, int offset)
|
|||
if( (to&7) == ESP ) {
|
||||
if( offset == 0 ) {
|
||||
ModRM( 0, 0, 4 );
|
||||
ModRM( 0, ESP, 4 );
|
||||
SibSB( 0, ESP, 4 );
|
||||
}
|
||||
else if( offset < 128 && offset >= -128 ) {
|
||||
ModRM( 1, 0, 4 );
|
||||
ModRM( 0, ESP, 4 );
|
||||
SibSB( 0, ESP, 4 );
|
||||
write8(offset);
|
||||
}
|
||||
else {
|
||||
ModRM( 2, 0, 4 );
|
||||
ModRM( 0, ESP, 4 );
|
||||
SibSB( 0, ESP, 4 );
|
||||
write32(offset);
|
||||
}
|
||||
}
|
||||
|
@ -148,14 +148,14 @@ void write64( u64 val )
|
|||
x86Ptr += 8;
|
||||
}
|
||||
|
||||
void ModRM( int mod, int rm, int reg )
|
||||
void ModRM( int mod, int reg, int rm )
|
||||
{
|
||||
write8( ( mod << 6 ) | ( (rm & 7) << 3 ) | ( reg & 7 ) );
|
||||
write8( ( mod << 6 ) | ( (reg & 7) << 3 ) | ( rm & 7 ) );
|
||||
}
|
||||
|
||||
void SibSB( int ss, int rm, int index )
|
||||
void SibSB( int ss, int index, int base )
|
||||
{
|
||||
write8( ( ss << 6 ) | ( rm << 3 ) | ( index ) );
|
||||
write8( ( ss << 6 ) | ( (index & 7) << 3 ) | ( base & 7 ) );
|
||||
}
|
||||
|
||||
void SET8R( int cc, int to )
|
||||
|
@ -555,8 +555,8 @@ void MOV16RmSOffsettoR( x86IntRegType to, x86IntRegType from1, u32 from2, int sc
|
|||
write8(0x66);
|
||||
RexRXB(0,to,from1,0);
|
||||
write8( 0x8B );
|
||||
ModRM( 0, to, 0x4 );
|
||||
ModRM( scale, from1, 5);
|
||||
ModRM( 0, to, SIB );
|
||||
SibSB( scale, from1, SIBDISP);
|
||||
write32(from2);
|
||||
}
|
||||
|
||||
|
@ -646,6 +646,15 @@ void MOV8RmtoROffset(x86IntRegType to, x86IntRegType from, int offset)
|
|||
WriteRmOffsetFrom(to, from, offset);
|
||||
}
|
||||
|
||||
void MOV8RmSOffsettoR( x86IntRegType to, x86IntRegType from1, u32 from2, int scale )
|
||||
{
|
||||
RexRXB(0,to,from1,0);
|
||||
write8( 0x8A );
|
||||
ModRM( 0, to, SIB );
|
||||
SibSB( scale, from1, SIBDISP);
|
||||
write32(from2);
|
||||
}
|
||||
|
||||
void MOV8RtoRm(x86IntRegType to, x86IntRegType from)
|
||||
{
|
||||
RexRB(0,from,to);
|
||||
|
@ -1108,32 +1117,56 @@ void ADD64RtoR( x86IntRegType to, x86IntRegType from )
|
|||
void ADD32ItoR( x86IntRegType to, u32 from )
|
||||
{
|
||||
RexB(0, to);
|
||||
if ( to == EAX) {
|
||||
write8( 0x05 );
|
||||
}
|
||||
else {
|
||||
write8( 0x81 );
|
||||
if(from < 0x80)
|
||||
{
|
||||
write8( 0x83 );
|
||||
ModRM( 3, 0, to );
|
||||
write8( from );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( to == EAX) {
|
||||
write8( 0x05 );
|
||||
}
|
||||
else {
|
||||
write8( 0x81 );
|
||||
ModRM( 3, 0, to );
|
||||
}
|
||||
write32( from );
|
||||
}
|
||||
write32( from );
|
||||
}
|
||||
|
||||
/* add imm32 to m32 */
|
||||
void ADD32ItoM( uptr to, u32 from )
|
||||
{
|
||||
write8( 0x81 );
|
||||
ModRM( 0, 0, DISP32 );
|
||||
write32( MEMADDR(to, 8) );
|
||||
write32( from );
|
||||
if(from < 0x80)
|
||||
{
|
||||
write8( 0x83 );
|
||||
ModRM( 0, 0, DISP32 );
|
||||
write32( MEMADDR(to, 8) );
|
||||
write8( from );
|
||||
} else {
|
||||
write8( 0x81 );
|
||||
ModRM( 0, 0, DISP32 );
|
||||
write32( MEMADDR(to, 8) );
|
||||
write32( from );
|
||||
}
|
||||
}
|
||||
|
||||
// add imm32 to [r32+off]
|
||||
void ADD32ItoRmOffset( x86IntRegType to, u32 from, int offset)
|
||||
{
|
||||
RexB(0,to);
|
||||
write8( 0x81 );
|
||||
WriteRmOffset(to,offset);
|
||||
write32(from);
|
||||
RexB(0,to);
|
||||
if(from < 0x80)
|
||||
{
|
||||
write8( 0x83 );
|
||||
WriteRmOffset(to,offset);
|
||||
write8(from);
|
||||
} else {
|
||||
write8( 0x81 );
|
||||
WriteRmOffset(to,offset);
|
||||
write32(from);
|
||||
}
|
||||
}
|
||||
|
||||
/* add r32 to r32 */
|
||||
|
@ -1174,28 +1207,46 @@ void ADD16RtoR( x86IntRegType to , x86IntRegType from )
|
|||
/* add imm16 to r16 */
|
||||
void ADD16ItoR( x86IntRegType to, u16 from )
|
||||
{
|
||||
write8( 0x66 );
|
||||
RexB(0,to);
|
||||
|
||||
write8( 0x66 );
|
||||
if ( to == EAX)
|
||||
{
|
||||
{
|
||||
write8( 0x05 );
|
||||
write16( from );
|
||||
}
|
||||
else
|
||||
{
|
||||
else if(from < 0x80)
|
||||
{
|
||||
write8( 0x83 );
|
||||
ModRM( 3, 0, to );
|
||||
write8( from );
|
||||
}
|
||||
else
|
||||
{
|
||||
write8( 0x81 );
|
||||
ModRM( 3, 0, to );
|
||||
write16( from );
|
||||
}
|
||||
write16( from );
|
||||
}
|
||||
|
||||
/* add imm16 to m16 */
|
||||
void ADD16ItoM( uptr to, u16 from )
|
||||
{
|
||||
write8( 0x66 );
|
||||
write8( 0x81 );
|
||||
ModRM( 0, 0, DISP32 );
|
||||
write32( MEMADDR(to, 6) );
|
||||
write16( from );
|
||||
if(from < 0x80)
|
||||
{
|
||||
write8( 0x83 );
|
||||
ModRM( 0, 0, DISP32 );
|
||||
write32( MEMADDR(to, 6) );
|
||||
write8( from );
|
||||
}
|
||||
else
|
||||
{
|
||||
write8( 0x81 );
|
||||
ModRM( 0, 0, DISP32 );
|
||||
write32( MEMADDR(to, 6) );
|
||||
write16( from );
|
||||
}
|
||||
}
|
||||
|
||||
/* add r16 to m16 */
|
||||
|
@ -1749,6 +1800,23 @@ void SHR32CLtoR( x86IntRegType to )
|
|||
ModRM( 3, 5, to );
|
||||
}
|
||||
|
||||
// shr imm8 to r16
|
||||
void SHR16ItoR( x86IntRegType to, u8 from )
|
||||
{
|
||||
RexB(0,to);
|
||||
if ( from == 1 )
|
||||
{
|
||||
write8( 0xD1 );
|
||||
ModRM( 3, 5, to );
|
||||
}
|
||||
else
|
||||
{
|
||||
write8( 0xC1 );
|
||||
ModRM( 3, 5, to );
|
||||
write8( from );
|
||||
}
|
||||
}
|
||||
|
||||
// shr imm8 to r8
|
||||
void SHR8ItoR( x86IntRegType to, u8 from )
|
||||
{
|
||||
|
@ -1857,12 +1925,29 @@ void RCR32ItoR( x86IntRegType to, u8 from )
|
|||
RexB(0,to);
|
||||
if ( from == 1 ) {
|
||||
write8( 0xd1 );
|
||||
write8( 0xd8 | to );
|
||||
ModRM(3, 3, to);
|
||||
}
|
||||
else
|
||||
{
|
||||
write8( 0xc1 );
|
||||
write8( 0xd8 | to );
|
||||
ModRM(3, 3, to);
|
||||
write8( from );
|
||||
}
|
||||
}
|
||||
|
||||
void RCR32ItoM( uptr to, u8 from )
|
||||
{
|
||||
RexB(0,to);
|
||||
if ( from == 1 ) {
|
||||
write8( 0xd1 );
|
||||
ModRM( 0, 3, DISP32 );
|
||||
write32( MEMADDR(to, 8) );
|
||||
}
|
||||
else
|
||||
{
|
||||
write8( 0xc1 );
|
||||
ModRM( 0, 3, DISP32 );
|
||||
write32( MEMADDR(to, 8) );
|
||||
write8( from );
|
||||
}
|
||||
}
|
||||
|
@ -2243,13 +2328,20 @@ void AND64I32toM( uptr to, u32 from )
|
|||
void AND32ItoR( x86IntRegType to, u32 from )
|
||||
{
|
||||
RexB(0,to);
|
||||
if ( to == EAX ) {
|
||||
write8( 0x25 );
|
||||
} else {
|
||||
write8( 0x81 );
|
||||
ModRM( 3, 0x4, to );
|
||||
if(from < 0x80)
|
||||
{
|
||||
AND32I8toR(to, (u8)from);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( to == EAX ) {
|
||||
write8( 0x25 );
|
||||
} else {
|
||||
write8( 0x81 );
|
||||
ModRM( 3, 0x4, to );
|
||||
}
|
||||
write32( from );
|
||||
}
|
||||
write32( from );
|
||||
}
|
||||
|
||||
/* and sign ext imm8 to r32 */
|
||||
|
@ -2264,10 +2356,17 @@ void AND32I8toR( x86IntRegType to, u8 from )
|
|||
/* and imm32 to m32 */
|
||||
void AND32ItoM( uptr to, u32 from )
|
||||
{
|
||||
write8( 0x81 );
|
||||
ModRM( 0, 0x4, DISP32 );
|
||||
write32( MEMADDR(to, 8) );
|
||||
write32( from );
|
||||
if(from < 0x80)
|
||||
{
|
||||
AND32I8toM(to, (u8)from);
|
||||
}
|
||||
else
|
||||
{
|
||||
write8( 0x81 );
|
||||
ModRM( 0, 0x4, DISP32 );
|
||||
write32( MEMADDR(to, 8) );
|
||||
write32( from );
|
||||
}
|
||||
}
|
||||
|
||||
/* and sign ext imm8 to m32 */
|
||||
|
@ -2317,24 +2416,38 @@ void AND16RtoR( x86IntRegType to, x86IntRegType from )
|
|||
/* and imm16 to r16 */
|
||||
void AND16ItoR( x86IntRegType to, u16 from )
|
||||
{
|
||||
write8(0x66);
|
||||
RexB(0,to);
|
||||
|
||||
write8(0x66);
|
||||
if ( to == EAX ) {
|
||||
write8( 0x25 );
|
||||
write16( from );
|
||||
} else if ( from < 0x80 ) {
|
||||
write8( 0x83 );
|
||||
ModRM( 3, 0x4, to );
|
||||
write8( from );
|
||||
} else {
|
||||
write8( 0x81 );
|
||||
ModRM( 3, 0x4, to );
|
||||
write16( from );
|
||||
}
|
||||
write16( from );
|
||||
}
|
||||
|
||||
/* and imm16 to m16 */
|
||||
void AND16ItoM( uptr to, u16 from )
|
||||
{
|
||||
write8( 0x8166 );
|
||||
ModRM( 0, 0x4, DISP32 );
|
||||
write32( MEMADDR(to, 6) );
|
||||
write16( from );
|
||||
write8(0x66);
|
||||
if ( from < 0x80 ) {
|
||||
write8( 0x83 );
|
||||
ModRM( 0, 0x4, DISP32 );
|
||||
write32( MEMADDR(to, 6) );
|
||||
write8( from );
|
||||
} else {
|
||||
write8( 0x81 );
|
||||
ModRM( 0, 0x4, DISP32 );
|
||||
write32( MEMADDR(to, 6) );
|
||||
write16( from );
|
||||
}
|
||||
}
|
||||
|
||||
/* and r16 to m16 */
|
||||
|
@ -3021,10 +3134,19 @@ void TEST16RtoR( x86IntRegType to, x86IntRegType from )
|
|||
{
|
||||
write8(0x66);
|
||||
RexRB(0,from,to);
|
||||
write16( 0x85 );
|
||||
write8( 0x85 );
|
||||
ModRM( 3, from, to );
|
||||
}
|
||||
|
||||
// test r8 to r8
|
||||
void TEST8RtoR( x86IntRegType to, x86IntRegType from )
|
||||
{
|
||||
RexRB(0, from, to);
|
||||
write8( 0x84 );
|
||||
ModRM( 3, from, to );
|
||||
}
|
||||
|
||||
|
||||
// test imm8 to r8
|
||||
void TEST8ItoR( x86IntRegType to, u8 from )
|
||||
{
|
||||
|
@ -3161,10 +3283,17 @@ void CDQE( void ) { RexR(1,0); write8( 0x98 ); }
|
|||
void LAHF() { write8(0x9f); }
|
||||
void SAHF() { write8(0x9e); }
|
||||
|
||||
void BT32ItoR( x86IntRegType to, x86IntRegType from )
|
||||
void BT32ItoR( x86IntRegType to, u8 from )
|
||||
{
|
||||
write16( 0xBA0F );
|
||||
write8( 0xE0 | to );
|
||||
ModRM(3, 4, to);
|
||||
write8( from );
|
||||
}
|
||||
|
||||
void BTR32ItoR( x86IntRegType to, u8 from )
|
||||
{
|
||||
write16( 0xBA0F );
|
||||
ModRM(3, 6, to);
|
||||
write8( from );
|
||||
}
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@ extern "C" {
|
|||
#define MMXREGS 8
|
||||
|
||||
#define SIB 4
|
||||
#define SIBDISP 5
|
||||
#define DISP32 5
|
||||
|
||||
// general types
|
||||
|
@ -258,8 +259,8 @@ void x86Align( int bytes );
|
|||
u64 GetCPUTick( void );
|
||||
|
||||
// General Helper functions
|
||||
void ModRM( int mod, int rm, int reg );
|
||||
void SibSB( int ss, int rm, int index );
|
||||
void ModRM( int mod, int reg, int rm );
|
||||
void SibSB( int ss, int index, int base );
|
||||
void SET8R( int cc, int to );
|
||||
u8* J8Rel( int cc, int to );
|
||||
u32* J32Rel( int cc, u32 to );
|
||||
|
@ -363,6 +364,7 @@ void MOV8MtoR( x86IntRegType to, uptr from );
|
|||
// mov [r32] to r8
|
||||
void MOV8RmtoR(x86IntRegType to, x86IntRegType from);
|
||||
void MOV8RmtoROffset(x86IntRegType to, x86IntRegType from, int offset);
|
||||
void MOV8RmSOffsettoR( x86IntRegType to, x86IntRegType from1, u32 from2, int scale );
|
||||
// mov r8 to [r32]
|
||||
void MOV8RtoRm(x86IntRegType to, x86IntRegType from);
|
||||
// mov imm8 to m8
|
||||
|
@ -640,6 +642,9 @@ void SHR32ItoM( uptr to, u8 from );
|
|||
// shr cl to r32
|
||||
void SHR32CLtoR( x86IntRegType to );
|
||||
|
||||
// shr imm8 to r16
|
||||
void SHR16ItoR( x86IntRegType to, u8 from );
|
||||
|
||||
// shr imm8 to r8
|
||||
void SHR8ItoR( x86IntRegType to, u8 from );
|
||||
|
||||
|
@ -654,9 +659,10 @@ void SAR32CLtoR( x86IntRegType to );
|
|||
void SAR16ItoR( x86IntRegType to, u8 from );
|
||||
|
||||
// ror imm8 to r32 (rotate right)
|
||||
void ROR32ItoR( x86IntRegType to,u8 from );
|
||||
void ROR32ItoR( x86IntRegType to, u8 from );
|
||||
|
||||
void RCR32ItoR( x86IntRegType to,u8 from );
|
||||
void RCR32ItoR( x86IntRegType to, u8 from );
|
||||
void RCR32ItoM( uptr to, u8 from );
|
||||
// shld imm8 to r32
|
||||
void SHLD32ItoR( x86IntRegType to, x86IntRegType from, u8 shift );
|
||||
// shrd imm8 to r32
|
||||
|
@ -954,6 +960,8 @@ void TEST32ItoRm( x86IntRegType to, u32 from );
|
|||
void TEST16ItoR( x86IntRegType to, u16 from );
|
||||
// test r16 to r16
|
||||
void TEST16RtoR( x86IntRegType to, x86IntRegType from );
|
||||
// test r8 to r8
|
||||
void TEST8RtoR( x86IntRegType to, x86IntRegType from );
|
||||
// test imm8 to r8
|
||||
void TEST8ItoR( x86IntRegType to, u8 from );
|
||||
// test imm8 to r8
|
||||
|
@ -1029,7 +1037,8 @@ void CDQE( void );
|
|||
void LAHF();
|
||||
void SAHF();
|
||||
|
||||
void BT32ItoR( x86IntRegType to, x86IntRegType from );
|
||||
void BT32ItoR( x86IntRegType to, u8 from );
|
||||
void BTR32ItoR( x86IntRegType to, u8 from );
|
||||
void BSRRtoR(x86IntRegType to, x86IntRegType from);
|
||||
void BSWAP32R( x86IntRegType to );
|
||||
|
||||
|
@ -1683,6 +1692,8 @@ void SSE4_DPPS_M128_to_XMM(x86SSERegType to, uptr from, u8 imm8);
|
|||
void SSE4_INSERTPS_XMM_to_XMM(x86SSERegType to, x86SSERegType from, u8 imm8);
|
||||
void SSE4_EXTRACTPS_XMM_to_R32(x86IntRegType to, x86SSERegType from, u8 imm8);
|
||||
void SSE4_BLENDPS_XMM_to_XMM(x86SSERegType to, x86SSERegType from, u8 imm8);
|
||||
void SSE4_BLENDVPS_XMM_to_XMM(x86SSERegType to, x86SSERegType from);
|
||||
void SSE4_BLENDVPS_M128_to_XMM(x86SSERegType to, uptr from);
|
||||
|
||||
//*********************
|
||||
// SSE-X - uses both SSE,SSE2 code and tries to keep consistensies between the data
|
||||
|
|
|
@ -1215,6 +1215,25 @@ void SSE4_BLENDPS_XMM_to_XMM(x86IntRegType to, x86SSERegType from, u8 imm8)
|
|||
write8(imm8);
|
||||
}
|
||||
|
||||
void SSE4_BLENDVPS_XMM_to_XMM(x86SSERegType to, x86SSERegType from)
|
||||
{
|
||||
write8(0x66);
|
||||
RexRB(0, to, from);
|
||||
write24(0x14380F);
|
||||
ModRM(3, to, from);
|
||||
}
|
||||
|
||||
void SSE4_BLENDVPS_M128_to_XMM(x86SSERegType to, uptr from)
|
||||
{
|
||||
const int overb = 0; // TODO: x64?
|
||||
|
||||
write8(0x66);
|
||||
RexR(0, to);
|
||||
write24(0x14380F);
|
||||
ModRM(0, to, DISP32);
|
||||
write32(MEMADDR(from, 4 + overb));
|
||||
}
|
||||
|
||||
// SSE-X
|
||||
void SSEX_MOVDQA_M128_to_XMM( x86SSERegType to, uptr from )
|
||||
{
|
||||
|
|
|
@ -55,6 +55,9 @@ extern "C" {
|
|||
#ifndef stricmp
|
||||
#define stricmp strcasecmp
|
||||
#endif
|
||||
#else
|
||||
#define strnicmp _strnicmp
|
||||
#define stricmp _stricmp
|
||||
#endif
|
||||
|
||||
#include "../cheatscpp.h"
|
||||
|
|
Loading…
Reference in New Issue