git-svn-id: https://localhost/svn/Project64/trunk@33 111125ac-702d-7242-af9c-5ba8ae61c1ef

This commit is contained in:
zilmar 2010-06-07 02:23:58 +00:00
parent b00856cd86
commit 41d4f7ff04
123 changed files with 1151 additions and 6709 deletions

BIN
Bin/Debug/pifdata.bin Normal file

Binary file not shown.

View File

@ -1,7 +1,4 @@
#include "..\\Multilanguage.h"
#include "..\\Settings.h"
#include <windows.h>
#include "..\User Interface\resource.h"
#include "stdafx.h"
CLanguage * _Lang = NULL;

View File

@ -1,3 +1,5 @@
#include "stdafx.h"
/*
* Project 64 - A Nintendo 64 emulator.
*

View File

@ -1,11 +1,8 @@
#include "stdafx.h"
#include "C Core.h"
#include "eeprom.h"
#include "mempak.h"
#include "Plugin.h"
#include "Logging.h"
#include "Interpreter CPU.h"
#include "Recompiler CPU.h"
#include "CPU Log.h"
#include "sram.h"
#include "flashram.h"
@ -27,87 +24,13 @@ char g_RomName [300];
DWORD * _AudioIntrReg = NULL;
enum SystemType g_SystemType;
#ifdef toremove
/******** All DLLs have this function **************/
void (__cdecl *GetDllInfo) ( PLUGIN_INFO * PluginInfo );
/********** RSP DLL: Functions *********************/
//void (__cdecl *GetRspDebugInfo) ( RSPDEBUG_INFO * DebugInfo );
//void (__cdecl *RSPCloseDLL) ( void );
//void (__cdecl *RSPDllAbout) ( HWND hWnd );
//void (__cdecl *RSPDllConfig) ( HWND hWnd );
//void (__cdecl *RSPRomClosed) ( void );
DWORD (__cdecl *DoRspCycles) ( DWORD );
//void (__cdecl *InitiateRSP_1_0) ( RSP_INFO_1_0 Rsp_Info, DWORD * Cycles);
//void (__cdecl *InitiateRSP_1_1) ( RSP_INFO_1_1 Rsp_Info, DWORD * Cycles);
//void (__cdecl *InitiateRSPDebugger)( DEBUG_INFO DebugInfo);
/********** GFX DLL: Functions *********************/
void (__cdecl *CaptureScreen) ( const char * );
void (__cdecl *ChangeWindow) ( void );
//void (__cdecl *GetGfxDebugInfo) ( GFXDEBUG_INFO * GFXDebugInfo );
//void (__cdecl *GFXCloseDLL) ( void );
//void (__cdecl *GFXDllAbout) ( HWND hParent );
//void (__cdecl *GFXDllConfig) ( HWND hParent );
//void (__cdecl *GfxRomClosed) ( void );
//void (__cdecl *GfxRomOpen) ( void );
void (__cdecl *DrawScreen) ( void );
//void (__cdecl *FrameBufferRead) ( DWORD addr );
//void (__cdecl *FrameBufferWrite) ( DWORD addr, DWORD Bytes );
//BOOL (__cdecl *InitiateGFX) ( GFX_INFO Gfx_Info );
//void (__cdecl *InitiateGFXDebugger)( DEBUG_INFO DebugInfo);
void (__cdecl *MoveScreen) ( int xpos, int ypos );
void (__cdecl *ProcessDList) ( void );
void (__cdecl *ProcessRDPList) ( void );
void (__cdecl *ShowCFB) ( void );
void (__cdecl *UpdateScreen) ( void );
void (__cdecl *ViStatusChanged) ( void );
void (__cdecl *ViWidthChanged) ( void );
/************ Audio DLL: Functions *****************/
//void (__cdecl *AiCloseDLL) ( void );
//void (__cdecl *AiDacrateChanged) ( int SystemType );
void (__cdecl *AiLenChanged) ( void );
//void (__cdecl *AiDllAbout) ( HWND hParent );
//void (__cdecl *AiDllConfig) ( HWND hParent );
//void (__cdecl *AiDllTest) ( HWND hParent );
DWORD (__cdecl *AiReadLength) ( void );
//void (__cdecl *AiRomClosed) ( void );
//void (__cdecl *AiUpdate) ( BOOL Wait );
//BOOL (__cdecl *InitiateAudio) ( AUDIO_INFO Audio_Info );
void (__cdecl *ProcessAList) ( void );
/********** Controller DLL: Functions **************/
//void (__cdecl *ContCloseDLL) ( void );
void (__cdecl *ControllerCommand)( int Control, BYTE * Command );
//void (__cdecl *ContDllAbout) ( HWND hParent );
//void (__cdecl *ContConfig) ( HWND hParent );
//void (__cdecl *InitiateControllers_1_0)( HWND hMainWindow, CONTROL Controls[4] );
//void (__cdecl *InitiateControllers_1_1)( CONTROL_INFO ControlInfo );
void (__cdecl *GetKeys) ( int Control, BUTTONS * Keys );
void (__cdecl *ReadController) ( int Control, BYTE * Command );
//void (__cdecl *ContRomOpen) ( void );
//void (__cdecl *ContRomClosed) ( void );
//void (__cdecl *WM_KeyDown) ( WPARAM wParam, LPARAM lParam );
//void (__cdecl *WM_KeyUp) ( WPARAM wParam, LPARAM lParam );
void (__cdecl *RumbleCommand) ( int Control, BOOL bRumble );
#endif
//Memory
DWORD g_RdramSize;
BOOL g_IndvidualBlock, g_Profiling;
DWORD g_CurrentFrame;
QWORD g_Frequency, g_Frames[NoOfFrames], g_LastFrame;
void CC_Core::SetSyncCpu ( CN64System * System )
{
_SyncSystem = System;
}
void CC_Core::SetSettings ( )
{
_Settings = _Settings;
if (_Settings)
{
g_HaveDebugger = _Settings->LoadBool(Debugger_Enabled);
@ -142,122 +65,6 @@ void CC_Core::SetSettings ( )
}
}
#ifdef toremove
void CC_Core::SetCurrentSystem (CN64System * System )
{
_MMU = NULL;
_Reg = NULL;
_TLB = NULL;
_Audio = NULL;
_Recompiler = NULL;
_N64System = System;
if (_N64System)
{
_Recompiler = System->m_Recomp;
_MMU = &System->m_MMU_VM;
_TLB = &System->m_TLB;
_Plugins = System->m_Plugins;
_Audio = &System->m_Audio;
_Reg = &System->m_Reg;
}
if (_Reg)
{
_GPR = _Reg->m_GPR;
_CP0 = _Reg->m_CP0;
_FPR = _Reg->m_FPR;
_FPCR = _Reg->m_FPCR;
_FPRFloatLocation = _Reg->m_FPR_S;
_FPRDoubleLocation = _Reg->m_FPR_D;
_RegHI = &_Reg->m_HI;
_RegLO = &_Reg->m_LO;
_LLBit = &_Reg->m_LLBit;
_LLAddr = &_Reg->m_LLAddr;
_RegRI = _Reg->m_RDRAM_Interface;
_RegRDRAM = _Reg->m_RDRAM_Registers;
_RegMI = _Reg->m_Mips_Interface;
_RegVI = _Reg->m_Video_Interface;
_RegDPC = _Reg->m_Display_ControlReg;
_RegAI = _Reg->m_Audio_Interface;
_RegSP = _Reg->m_SigProcessor_Interface;
_RegPI = _Reg->m_Peripheral_Interface;
_RegSI = _Reg->m_SerialInterface;
_AudioIntrReg = &_Reg->m_AudioIntrReg;
_PROGRAM_COUNTER = &_Reg->m_PROGRAM_COUNTER;
_NextTimer = &_N64System->m_NextTimer;
}
CaptureScreen = _Plugins->Gfx()->CaptureScreen;
ChangeWindow = _Plugins->Gfx()->ChangeWindow;
DrawScreen = _Plugins->Gfx()->DrawScreen;
MoveScreen = _Plugins->Gfx()->MoveScreen;
ProcessDList = _Plugins->Gfx()->ProcessDList;
ProcessRDPList = _Plugins->Gfx()->ProcessRDPList;
ShowCFB = _Plugins->Gfx()->ShowCFB;
UpdateScreen = _Plugins->Gfx()->UpdateScreen;
ViStatusChanged = _Plugins->Gfx()->ViStatusChanged;
ViWidthChanged = _Plugins->Gfx()->ViWidthChanged;
#ifdef tofix
// GetGfxDebugInfo = _Plugins->Gfx()->GetGfxDebugInfo;
// GFXCloseDLL = _Plugins->Gfx()->GFXCloseDLL;
// GFXDllAbout = _Plugins->Gfx()->GFXDllAbout;
// GFXDllConfig = _Plugins->Gfx()->GFXDllConfig;
// GfxRomClosed = _Plugins->Gfx()->GfxRomClosed;
// GfxRomOpen = _Plugins->Gfx()->GfxRomOpen;
// FrameBufferRead = _Plugins->Gfx()->FrameBufferRead;
// FrameBufferWrite = _Plugins->Gfx()->FrameBufferWrite;
// InitiateGFX = _Plugins->Gfx()->InitiateGFX;
// InitiateGFXDebugger = _Plugins->Gfx()->InitiateGFXDebugger;
#endif
ControllerCommand = _Plugins->Control()->ControllerCommand;
GetKeys = _Plugins->Control()->GetKeys;
ReadController = _Plugins->Control()->ReadController;
RumbleCommand = _Plugins->Control()->RumbleCommand;
g_Controllers = _Plugins->Control()->m_PluginControllers;
#ifdef tofix
// ContCloseDLL = _Plugins->Control()->ContCloseDLL;
// ContDllAbout = _Plugins->Control()->ContDllAbout;
// ContConfig = _Plugins->Control()->ContConfig;
// InitiateControllers_1_0= _Plugins->Control()->InitiateControllers_1_0;
// InitiateControllers_1_1= _Plugins->Control()->InitiateControllers_1_1;
// ContRomOpen = _Plugins->Control()->ContRomOpen;
// ContRomClosed = _Plugins->Control()->ContRomClosed;
// WM_KeyDown = _Plugins->Control()->WM_KeyDown;
// WM_KeyUp = _Plugins->Control()->WM_KeyUp;
#endif
DoRspCycles = _Plugins->RSP()->DoRspCycles;
#ifdef tofix
// GetRspDebugInfo = _Plugins->RSP()->GetRspDebugInfo;
// RSPCloseDLL = _Plugins->RSP()->RSPCloseDLL;
// RSPDllAbout = _Plugins->RSP()->RSPDllAbout;
// RSPDllConfig = _Plugins->RSP()->RSPDllConfig;
// RSPRomClosed = _Plugins->RSP()->RSPRomClosed;
// InitiateRSP_1_0 = _Plugins->RSP()->InitiateRSP_1_0;
// InitiateRSP_1_1 = _Plugins->RSP()->InitiateRSP_1_1;
// InitiateRSPDebugger = _Plugins->RSP()->InitiateRSPDebugger;
#endif
AiLenChanged = _Plugins->Audio()->LenChanged;
AiReadLength = _Plugins->Audio()->ReadLength;
ProcessAList = _Plugins->Audio()->ProcessAList;
#ifdef tofix
// AiCloseDLL = _Plugins->Audio()->AiCloseDLL;
// AiDacrateChanged = _Plugins->Audio()->AiDacrateChanged;
// AiDllAbout = _Plugins->Audio()->AiDllAbout;
// AiDllConfig = _Plugins->Audio()->AiDllConfig;
// AiDllTest = _Plugins->Audio()->AiDllTest;
// AiRomClosed = _Plugins->Audio()->AiRomClosed;
// AiUpdate = _Plugins->Audio()->Update;
// InitiateAudio = _Plugins->Audio()->InitiateAudio;
g_MemorStack = &_MMU->m_MemoryStack;
#endif
}
#endif
void CC_Core::PauseExecution ( void )
{
_N64System->Pause();
@ -277,18 +84,6 @@ void CC_Core::RunRsp ( void )
}
}
void CC_Core::RefreshScreen(void)
{
try
{
_N64System->RefreshScreen();
}
catch (...)
{
WriteTraceF(TraceError,"Exception caught\nFile: %s\nLine: %d",__FILE__,__LINE__);
}
}
void CC_Core::GenerateProfileLog ( void )
{
_N64System->m_Profile.GenerateLog();
@ -390,11 +185,6 @@ void RunRsp( void )
CC_Core::RunRsp();
}
void RefreshScreen( void )
{
CC_Core::RefreshScreen();
}
void SyncSystem (void)
{
_N64System->SyncCPU(_SyncSystem);

View File

@ -10,9 +10,7 @@ class CC_Core
{
public:
static void SetSettings ( );
static void SetSyncCpu ( CN64System * System );
static void RunRsp (void );
static void RefreshScreen (void );
static void ApplyCheats (CN64System * System );
static void ApplyGSButtonCheats (CN64System * System );
static void PauseExecution ( void );
@ -86,11 +84,6 @@ extern enum SystemType g_SystemType;
extern DWORD g_RdramSize;
//Misc
enum { NoOfFrames = 7 };
extern DWORD g_CurrentFrame;
extern QWORD g_Frequency, g_Frames[NoOfFrames], g_LastFrame;
#ifdef __cplusplus
}
#endif

View File

@ -1,3 +1,5 @@
#include "stdafx.h"
/*
* Project 64 - A Nintendo 64 emulator.
*

View File

@ -1,58 +1,19 @@
#include <windows.h>
#include "Plugin.h"
#include "c core.h"
#include "C Global Variable.h"
#include "..\\Types.h"
#include "Interpreter CPU.h"
#include "Recompiler CPU.h"
#include "c memory.h"
#include "Registers.h"
#include "Exception.h"
#include "r4300i Commands.h"
#include "TLB.h"
#include "DMA.h"
#include "eeprom.h"
#include "sram.h"
#include "flashram.h"
#include "mempak.h"
#include "pif.h"
#include "Sync Cpu.h"
//extern int NextInstruction/*, ManualPaused*/;
extern DWORD JumpToLocation;
extern BOOL TestTimer;
/*#define MaxTimers 5
#define CompareTimer 0
#define SiTimer 1
#define PiTimer 2
#define ViTimer 3
#define RspTimer 4
typedef struct {
int NextTimer[MaxTimers];
BOOL Active[MaxTimers];
int CurrentTimerType;
int Timer;
} SYSTEM_TIMERS;
extern SYSTEM_TIMERS Timers;*/
//extern DWORD MemoryStack;
/*extern BOOL HaveDebugger, AutoLoadMapFile,
AutoStart,
AutoSleep, UseIni, RomBrowser,
IgnoreMove, Rercursion, ShowCPUPer, AutoZip,
AutoFullScreen, SystemABL, AlwaysOnTop, BasicMode, RememberCheats,AudioSignal;
void ChangeCompareTimer ( void );
void CheckTimer ( void );
void TimerDone ( void );
void DoSomething ( void );
*/
int DelaySlotEffectsCompare ( DWORD PC, DWORD Reg1, DWORD Reg2 );
int DelaySlotEffectsJump (DWORD JumpPC);
void InPermLoop ( void );

View File

@ -29,7 +29,6 @@
#include "BreakPoints.h"
#include "R4300i Registers.h"
#include "R4300i Memory.h"
#include "TLB Display.h"
#include "Logging.h"
//#include "Reverse Code.h"

View File

@ -27,4 +27,3 @@
#include "main.h"
#include "cpu.h"
#include "plugin.h"
#include "stdafx.h"

View File

@ -1,77 +0,0 @@
#ifdef toremove
/*
* Project 64 - A Nintendo 64 emulator.
*
* (c) Copyright 2001 zilmar (zilmar@emulation64.com) and
* Jabo (jabo@emulation64.com).
*
* pj64 homepage: www.pj64.net
*
* Permission to use, copy, modify and distribute Project64 in both binary and
* source form, for non-commercial purposes, is hereby granted without fee,
* providing that this license information and copyright notice appear with
* all copies and any derived work.
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event shall the authors be held liable for any damages
* arising from the use of this software.
*
* Project64 is freeware for PERSONAL USE only. Commercial users should
* seek permission of the copyright holders first. Commercial use includes
* charging money for Project64 or software derived from Project64.
*
* The copyright holders request that bug fixes and improvements to the code
* should be forwarded to them so if they want them.
*
*/
#define EXC_CODE(x) ((x)<<2)
#define EXC_INT EXC_CODE(0) /* interrupt */
#define EXC_MOD EXC_CODE(1) /* TLB mod */
#define EXC_RMISS EXC_CODE(2) /* Read TLB Miss */
#define EXC_WMISS EXC_CODE(3) /* Write TLB Miss */
#define EXC_RADE EXC_CODE(4) /* Read Address Error */
#define EXC_WADE EXC_CODE(5) /* Write Address Error */
#define EXC_IBE EXC_CODE(6) /* Instruction Bus Error */
#define EXC_DBE EXC_CODE(7) /* Data Bus Error */
#define EXC_SYSCALL EXC_CODE(8) /* SYSCALL */
#define EXC_BREAK EXC_CODE(9) /* BREAKpoint */
#define EXC_II EXC_CODE(10)/* Illegal Instruction */
#define EXC_CPU EXC_CODE(11)/* CoProcessor Unusable */
#define EXC_OV EXC_CODE(12)/* OVerflow */
#define EXC_TRAP EXC_CODE(13)/* Trap exception */
#define EXC_VCEI EXC_CODE(14)/* Virt. Coherency on Inst. fetch */
#define EXC_FPE EXC_CODE(15)/* Floating Point Exception */
#define EXC_WATCH EXC_CODE(23)/* Watchpoint reference */
#define EXC_VCED EXC_CODE(31)/* Virt. Coherency on data read */
#define Exception_Name(Except)\
(Except) == EXC_INT ? "interrupt" :\
(Except) == EXC_MOD ? "TLB mod" :\
(Except) == EXC_RMISS ? "Read TLB Miss" :\
(Except) == EXC_WMISS ? "Write TLB Miss" :\
(Except) == EXC_RADE ? "Read Address Error" :\
(Except) == EXC_WADE ? "Write Address Error" :\
(Except) == EXC_IBE ? "Instruction Bus Error" :\
(Except) == EXC_DBE ? "Data Bus Error" :\
(Except) == EXC_SYSCALL ? "SYSCALL" :\
(Except) == EXC_BREAK ? "Break" :\
(Except) == EXC_II ? "Illegal Instruction" :\
(Except) == EXC_CPU ? "CoProcessor Unusable" :\
(Except) == EXC_OV ? "OVerflow" :\
(Except) == EXC_TRAP ? "Trap exception" :\
(Except) == EXC_VCEI ? "Virt. Coherency on Inst. fetch" :\
(Except) == EXC_FPE ? "Floating Point Exception" :\
(Except) == EXC_WATCH ? "Watchpoint reference" :\
(Except) == EXC_VCED ? "Virt. Coherency on data read" :\
"Unkown"
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,243 +0,0 @@
/*
* Project 64 - A Nintendo 64 emulator.
*
* (c) Copyright 2001 zilmar (zilmar@emulation64.com) and
* Jabo (jabo@emulation64.com).
*
* pj64 homepage: www.pj64.net
*
* Permission to use, copy, modify and distribute Project64 in both binary and
* source form, for non-commercial purposes, is hereby granted without fee,
* providing that this license information and copyright notice appear with
* all copies and any derived work.
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event shall the authors be held liable for any damages
* arising from the use of this software.
*
* Project64 is freeware for PERSONAL USE only. Commercial users should
* seek permission of the copyright holders first. Commercial use includes
* charging money for Project64 or software derived from Project64.
*
* The copyright holders request that bug fixes and improvements to the code
* should be forwarded to them so if they want them.
*
*/
#include <windows.h>
#include <stdio.h>
#include "main.h"
#include "CPU.h"
typedef enum TFlashRam_Modes {
FLASHRAM_MODE_NOPES = 0,
FLASHRAM_MODE_ERASE = 1,
FLASHRAM_MODE_WRITE,
FLASHRAM_MODE_READ,
FLASHRAM_MODE_STATUS,
};
BOOL LoadFlashram (void);
DWORD FlashRAM_Offset, FlashFlag = FLASHRAM_MODE_NOPES;
static HANDLE hFlashRamFile = NULL;
BYTE * FlashRamPointer;
QWORD FlashStatus = 0;
void CloseFlashRam ( void)
{
if (hFlashRamFile) {
CloseHandle(hFlashRamFile);
hFlashRamFile = NULL;
}
}
void DmaFromFlashram(BYTE * dest, int StartOffset, int len) {
BYTE FlipBuffer[0x10000];
DWORD dwRead, count;
switch (FlashFlag) {
case FLASHRAM_MODE_READ:
if (hFlashRamFile == NULL) {
if (!LoadFlashram()) { return; }
}
if (len > 0x10000) {
#ifndef EXTERNAL_RELEASE
DisplayError("DmaFromFlashram FlipBuffer to small (len: %d)",len);
#endif
len = 0x10000;
}
if ((len & 3) != 0) {
#ifndef EXTERNAL_RELEASE
DisplayError("Unaligned flash ram read ???");
#endif
return;
}
memset(FlipBuffer,0,sizeof(FlipBuffer));
StartOffset = StartOffset << 1;
SetFilePointer(hFlashRamFile,StartOffset,NULL,FILE_BEGIN);
ReadFile(hFlashRamFile,FlipBuffer,len,&dwRead,NULL);
for (count = dwRead; (int)count < len; count ++) {
FlipBuffer[count] = 0xFF;
}
_asm {
mov edi, dest
lea ecx, [FlipBuffer]
mov edx, 0
mov ebx, len
memcpyloop:
mov eax, dword ptr [ecx + edx]
;bswap eax
mov dword ptr [edi + edx],eax
add edx, 4
cmp edx, ebx
jb memcpyloop
}
break;
case FLASHRAM_MODE_STATUS:
if (StartOffset != 0 && len != 8) {
#ifndef EXTERNAL_RELEASE
DisplayError("Reading flashstatus not being handled correctly\nStart: %X len: %X",StartOffset,len);
#endif
}
*((DWORD *)(dest)) = (DWORD)(FlashStatus >> 32);
*((DWORD *)(dest) + 1) = (DWORD)(FlashStatus);
break;
#ifndef EXTERNAL_RELEASE
default:
DisplayError("DmaFromFlashram Start: %X, Offset: %X len: %X",dest - N64MEM,StartOffset,len);
#endif
}
}
void DmaToFlashram(BYTE * Source, int StartOffset, int len) {
switch (FlashFlag) {
case FLASHRAM_MODE_WRITE:
FlashRamPointer = Source;
break;
#ifndef EXTERNAL_RELEASE
default:
DisplayError("DmaToFlashram Start: %X, Offset: %X len: %X",Source - N64MEM,StartOffset,len);
#endif
}
}
DWORD ReadFromFlashStatus (DWORD PAddr) {
switch (PAddr) {
case 0x08000000: return (DWORD)(FlashStatus >> 32);
default:
#ifndef EXTERNAL_RELEASE
DisplayError("Reading from flash ram status (%X)",PAddr);
#endif
break;
}
return (DWORD)(FlashStatus >> 32);
}
BOOL LoadFlashram (void) {
char File[255], Directory[255];
GetAutoSaveDir(Directory);
sprintf(File,"%s%s.fla",Directory,RomName);
hFlashRamFile = CreateFile(File,GENERIC_WRITE | GENERIC_READ, FILE_SHARE_READ,NULL,OPEN_ALWAYS,
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS, NULL);
if (hFlashRamFile == INVALID_HANDLE_VALUE) {
switch (GetLastError()) {
case ERROR_PATH_NOT_FOUND:
CreateDirectory(Directory,NULL);
hFlashRamFile = CreateFile(File,GENERIC_WRITE | GENERIC_READ, FILE_SHARE_READ,
NULL,OPEN_ALWAYS,FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS, NULL);
if (hFlashRamFile == INVALID_HANDLE_VALUE) {
DisplayError(GS(MSG_FAIL_OPEN_FLASH));
return FALSE;
}
break;
default:
DisplayError(GS(MSG_FAIL_OPEN_FLASH));
return FALSE;
}
}
return TRUE;
}
void WriteToFlashCommand(DWORD FlashRAM_Command) {
BYTE EmptyBlock[128];
DWORD dwWritten;
switch (FlashRAM_Command & 0xFF000000) {
case 0xD2000000:
switch (FlashFlag) {
case FLASHRAM_MODE_NOPES: break;
case FLASHRAM_MODE_READ: break;
case FLASHRAM_MODE_STATUS: break;
case FLASHRAM_MODE_ERASE:
memset(EmptyBlock,0xFF,sizeof(EmptyBlock));
if (hFlashRamFile == NULL) {
if (!LoadFlashram()) { return; }
}
SetFilePointer(hFlashRamFile,FlashRAM_Offset,NULL,FILE_BEGIN);
WriteFile(hFlashRamFile,EmptyBlock,128,&dwWritten,NULL);
break;
case FLASHRAM_MODE_WRITE:
if (hFlashRamFile == NULL) {
if (!LoadFlashram()) { return; }
}
{
BYTE FlipBuffer[128];
DWORD dwWritten;
memset(FlipBuffer,0,sizeof(FlipBuffer));
_asm {
lea edi, [FlipBuffer]
mov ecx, FlashRamPointer
mov edx, 0
memcpyloop:
mov eax, dword ptr [ecx + edx]
;bswap eax
mov dword ptr [edi + edx],eax
add edx, 4
cmp edx, 128
jb memcpyloop
}
SetFilePointer(hFlashRamFile,FlashRAM_Offset,NULL,FILE_BEGIN);
WriteFile(hFlashRamFile,FlipBuffer,128,&dwWritten,NULL);
}
break;
default:
DisplayError("Writing %X to flash ram command register\nFlashFlag: %d",FlashRAM_Command,FlashFlag);
}
FlashFlag = FLASHRAM_MODE_NOPES;
break;
case 0xE1000000:
FlashFlag = FLASHRAM_MODE_STATUS;
FlashStatus = 0x1111800100C20000;
break;
case 0xF0000000:
FlashFlag = FLASHRAM_MODE_READ;
FlashStatus = 0x11118004F0000000;
break;
case 0x4B000000:
FlashRAM_Offset = (FlashRAM_Command & 0xffff) * 128;
break;
case 0x78000000:
FlashFlag = FLASHRAM_MODE_ERASE;
FlashStatus = 0x1111800800C20000;
break;
case 0xB4000000:
FlashFlag = FLASHRAM_MODE_WRITE; //????
break;
case 0xA5000000:
FlashRAM_Offset = (FlashRAM_Command & 0xffff) * 128;
FlashStatus = 0x1111800400C20000;
break;
#ifndef EXTERNAL_RELEASE
default:
DisplayError("Writing %X to flash ram command register",FlashRAM_Command);
#endif
}
}

View File

@ -30,7 +30,6 @@
#include "..\N64 Types.h"
#include "..\\Types.h"
#include "plugin.h"
#include "c core.h"
#include "..\\..\\Multilanguage.h"
#include "win32Timer.h"

View File

@ -1,403 +0,0 @@
#ifdef toremove
/*
* Project 64 - A Nintendo 64 emulator.
*
* (c) Copyright 2001 zilmar (zilmar@emulation64.com) and
* Jabo (jabo@emulation64.com).
*
* pj64 homepage: www.pj64.net
*
* Permission to use, copy, modify and distribute Project64 in both binary and
* source form, for non-commercial purposes, is hereby granted without fee,
* providing that this license information and copyright notice appear with
* all copies and any derived work.
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event shall the authors be held liable for any damages
* arising from the use of this software.
*
* Project64 is freeware for PERSONAL USE only. Commercial users should
* seek permission of the copyright holders first. Commercial use includes
* charging money for Project64 or software derived from Project64.
*
* The copyright holders request that bug fixes and improvements to the code
* should be forwarded to them so if they want them.
*
*/
#ifndef __PLUGIN_C_H__
#define __PLUGIN_C_H__
#include <Windows.h>
/*
#define DefaultGFXDll "Jabo_Direct3D8.dll"
#define DefaultRSPDll "RSP.dll"
#define DefaultAudioDll "Jabo_Dsound.dll"
#define DefaultControllerDll "Jabo_DInput.dll"
#define PLUGIN_TYPE_RSP 1
#define PLUGIN_TYPE_GFX 2
#define PLUGIN_TYPE_AUDIO 3
#define PLUGIN_TYPE_CONTROLLER 4
*/
//#define SYSTEM_NTSC 0
//#define SYSTEM_PAL 1
//#define SYSTEM_MPAL 2
#ifndef PLUGIN_INFO_STRUCT
#define PLUGIN_INFO_STRUCT
typedef struct {
WORD Version; /* Should be set to 1 */
WORD Type; /* Set to PLUGIN_TYPE_GFX */
char Name[100]; /* Name of the DLL */
/* If DLL supports memory these memory options then set them to TRUE or FALSE
if it does not support it */
BOOL NormalMemory; /* a normal BYTE array */
BOOL MemoryBswaped; /* a normal BYTE array where the memory has been pre
bswap on a dword (32 bits) boundry */
} PLUGIN_INFO;
#endif
typedef struct {
HWND hWnd; /* Render window */
HWND hStatusBar; /* if render window does not have a status bar then this is NULL */
BOOL MemoryBswaped; // If this is set to TRUE, then the memory has been pre
// bswap on a dword (32 bits) boundry
// eg. the first 8 bytes are stored like this:
// 4 3 2 1 8 7 6 5
BYTE * HEADER; // This is the rom header (first 40h bytes of the rom
// This will be in the same memory format as the rest of the memory.
BYTE * RDRAM;
BYTE * DMEM;
BYTE * IMEM;
DWORD * MI__INTR_REG;
DWORD * DPC__START_REG;
DWORD * DPC__END_REG;
DWORD * DPC__CURRENT_REG;
DWORD * DPC__STATUS_REG;
DWORD * DPC__CLOCK_REG;
DWORD * DPC__BUFBUSY_REG;
DWORD * DPC__PIPEBUSY_REG;
DWORD * DPC__TMEM_REG;
DWORD * VI__STATUS_REG;
DWORD * VI__ORIGIN_REG;
DWORD * VI__WIDTH_REG;
DWORD * VI__INTR_REG;
DWORD * VI__V_CURRENT_LINE_REG;
DWORD * VI__TIMING_REG;
DWORD * VI__V_SYNC_REG;
DWORD * VI__H_SYNC_REG;
DWORD * VI__LEAP_REG;
DWORD * VI__H_START_REG;
DWORD * VI__V_START_REG;
DWORD * VI__V_BURST_REG;
DWORD * VI__X_SCALE_REG;
DWORD * VI__Y_SCALE_REG;
void (__cdecl *CheckInterrupts)( void );
} GFX_INFO;
typedef struct {
HINSTANCE hInst;
BOOL MemoryBswaped; /* If this is set to TRUE, then the memory has been pre
bswap on a dword (32 bits) boundry */
BYTE * RDRAM;
BYTE * DMEM;
BYTE * IMEM;
DWORD * MI__INTR_REG;
DWORD * SP__MEM_ADDR_REG;
DWORD * SP__DRAM_ADDR_REG;
DWORD * SP__RD_LEN_REG;
DWORD * SP__WR_LEN_REG;
DWORD * SP__STATUS_REG;
DWORD * SP__DMA_FULL_REG;
DWORD * SP__DMA_BUSY_REG;
DWORD * SP__PC_REG;
DWORD * SP__SEMAPHORE_REG;
DWORD * DPC__START_REG;
DWORD * DPC__END_REG;
DWORD * DPC__CURRENT_REG;
DWORD * DPC__STATUS_REG;
DWORD * DPC__CLOCK_REG;
DWORD * DPC__BUFBUSY_REG;
DWORD * DPC__PIPEBUSY_REG;
DWORD * DPC__TMEM_REG;
void ( __cdecl *CheckInterrupts)( void );
void (__cdecl *ProcessDlist)( void );
void (__cdecl *ProcessAlist)( void );
void (__cdecl *ProcessRdpList)( void );
} RSP_INFO_1_0;
#ifndef CONTROL_STRUCTS
#define CONTROL_STRUCTS
typedef union {
DWORD Value;
struct {
unsigned R_DPAD : 1;
unsigned L_DPAD : 1;
unsigned D_DPAD : 1;
unsigned U_DPAD : 1;
unsigned START_BUTTON : 1;
unsigned Z_TRIG : 1;
unsigned B_BUTTON : 1;
unsigned A_BUTTON : 1;
unsigned R_CBUTTON : 1;
unsigned L_CBUTTON : 1;
unsigned D_CBUTTON : 1;
unsigned U_CBUTTON : 1;
unsigned R_TRIG : 1;
unsigned L_TRIG : 1;
unsigned Reserved1 : 1;
unsigned Reserved2 : 1;
signed Y_AXIS : 8;
signed X_AXIS : 8;
};
} BUTTONS;
typedef struct {
BOOL Present;
BOOL RawData;
int Plugin;
} CONTROL;
#endif
typedef struct {
HWND hMainWindow;
HINSTANCE hinst;
BOOL MemoryBswaped; // If this is set to TRUE, then the memory has been pre
// bswap on a dword (32 bits) boundry, only effects header.
// eg. the first 8 bytes are stored like this:
// 4 3 2 1 8 7 6 5
BYTE * HEADER; // This is the rom header (first 40h bytes of the rom)
CONTROL *Controls; // A pointer to an array of 4 controllers .. eg:
// CONTROL Controls[4];
} CONTROL_INFO;
typedef struct {
HINSTANCE hInst;
BOOL MemoryBswaped; /* If this is set to TRUE, then the memory has been pre
bswap on a dword (32 bits) boundry */
BYTE * RDRAM;
BYTE * DMEM;
BYTE * IMEM;
DWORD * MI__INTR_REG;
DWORD * SP__MEM_ADDR_REG;
DWORD * SP__DRAM_ADDR_REG;
DWORD * SP__RD_LEN_REG;
DWORD * SP__WR_LEN_REG;
DWORD * SP__STATUS_REG;
DWORD * SP__DMA_FULL_REG;
DWORD * SP__DMA_BUSY_REG;
DWORD * SP__PC_REG;
DWORD * SP__SEMAPHORE_REG;
DWORD * DPC__START_REG;
DWORD * DPC__END_REG;
DWORD * DPC__CURRENT_REG;
DWORD * DPC__STATUS_REG;
DWORD * DPC__CLOCK_REG;
DWORD * DPC__BUFBUSY_REG;
DWORD * DPC__PIPEBUSY_REG;
DWORD * DPC__TMEM_REG;
void ( __cdecl *CheckInterrupts)( void );
void (__cdecl *ProcessDlist)( void );
void (__cdecl *ProcessAlist)( void );
void (__cdecl *ProcessRdpList)( void );
void (__cdecl *ShowCFB)( void );
} RSP_INFO_1_1;
typedef struct {
/* Menu */
/* Items should have an ID between 5001 and 5100 */
HMENU hRSPMenu;
void (__cdecl *ProcessMenuItem) ( int ID );
/* Break Points */
BOOL UseBPoints;
char BPPanelName[20];
void (__cdecl *Add_BPoint) ( void );
void (__cdecl *CreateBPPanel) ( HWND hDlg, RECT rcBox );
void (__cdecl *HideBPPanel) ( void );
void (__cdecl *PaintBPPanel) ( PAINTSTRUCT ps );
void (__cdecl *ShowBPPanel) ( void );
void (__cdecl *RefreshBpoints) ( HWND hList );
void (__cdecl *RemoveBpoint) ( HWND hList, int index );
void (__cdecl *RemoveAllBpoint) ( void );
/* RSP command Window */
void (__cdecl *Enter_RSP_Commands_Window) ( void );
} RSPDEBUG_INFO;
typedef struct {
/* Menu */
/* Items should have an ID between 5101 and 5200 */
HMENU hGFXMenu;
void (__cdecl *ProcessMenuItem) ( int ID );
/* Break Points */
BOOL UseBPoints;
char BPPanelName[20];
void (__cdecl *Add_BPoint) ( void );
void (__cdecl *CreateBPPanel) ( HWND hDlg, RECT rcBox );
void (__cdecl *HideBPPanel) ( void );
void (__cdecl *PaintBPPanel) ( PAINTSTRUCT ps );
void (__cdecl *ShowBPPanel) ( void );
void (__cdecl *RefreshBpoints) ( HWND hList );
void (__cdecl *RemoveBpoint) ( HWND hList, int index );
void (__cdecl *RemoveAllBpoint) ( void );
/* GFX command Window */
void (__cdecl *Enter_GFX_Commands_Window) ( void );
} GFXDEBUG_INFO;
typedef struct {
void (__cdecl *UpdateBreakPoints)( void );
void (__cdecl *UpdateMemory)( void );
void (__cdecl *UpdateR4300iRegisters)( void );
void (__cdecl *Enter_BPoint_Window)( void );
void (__cdecl *Enter_R4300i_Commands_Window)( void );
void (__cdecl *Enter_R4300i_Register_Window)( void );
void (__cdecl *Enter_RSP_Commands_Window) ( void );
void (__cdecl *Enter_Memory_Window)( void );
} DEBUG_INFO;
typedef struct {
HWND hwnd;
HINSTANCE hinst;
BOOL MemoryBswaped; // If this is set to TRUE, then the memory has been pre
// bswap on a dword (32 bits) boundry
// eg. the first 8 bytes are stored like this:
// 4 3 2 1 8 7 6 5
BYTE * HEADER; // This is the rom header (first 40h bytes of the rom
// This will be in the same memory format as the rest of the memory.
BYTE * RDRAM;
BYTE * DMEM;
BYTE * IMEM;
DWORD * MI__INTR_REG;
DWORD * AI__DRAM_ADDR_REG;
DWORD * AI__LEN_REG;
DWORD * AI__CONTROL_REG;
DWORD * AI__STATUS_REG;
DWORD * AI__DACRATE_REG;
DWORD * AI__BITRATE_REG;
void (__cdecl *CheckInterrupts)( void );
} AUDIO_INFO;
/*** Conteroller plugin's ****/
#ifndef __cplusplus
#define PLUGIN_NONE 1
#define PLUGIN_MEMPAK 2
#define PLUGIN_RUMBLE_PAK 3
#define PLUGIN_TANSFER_PAK 4 // not implemeted for non raw data
#define PLUGIN_RAW 5 // the controller plugin is passed in raw data
#endif
#ifdef __cplusplus
extern "C" {
#endif
/******** All DLLs have this function **************/
extern void (__cdecl *GetDllInfo) ( PLUGIN_INFO * PluginInfo );
/********** RSP DLL: Functions *********************/
//void (__cdecl *GetRspDebugInfo) ( RSPDEBUG_INFO * DebugInfo );
//extern void (__cdecl *RSPCloseDLL) ( void );
//extern void (__cdecl *RSPDllAbout) ( HWND hWnd );
//extern void (__cdecl *RSPDllConfig) ( HWND hWnd );
//extern void (__cdecl *RSPRomClosed) ( void );
extern DWORD (__cdecl *DoRspCycles) ( DWORD );
//extern void (__cdecl *InitiateRSP_1_0) ( RSP_INFO_1_0 Rsp_Info, DWORD * Cycles);
//extern void (__cdecl *InitiateRSP_1_1) ( RSP_INFO_1_1 Rsp_Info, DWORD * Cycles);
//extern void (__cdecl *InitiateRSPDebugger)( DEBUG_INFO DebugInfo);
/********** GFX DLL: Functions *********************/
extern void (__cdecl *CaptureScreen) ( const char * );
extern void (__cdecl *ChangeWindow) ( void );
//extern void (__cdecl *GetGfxDebugInfo) ( GFXDEBUG_INFO * GFXDebugInfo );
//extern void (__cdecl *GFXCloseDLL) ( void );
//extern void (__cdecl *GFXDllAbout) ( HWND hParent );
//extern void (__cdecl *GFXDllConfig) ( HWND hParent );
//extern void (__cdecl *GfxRomClosed) ( void );
//extern void (__cdecl *GfxRomOpen) ( void );
extern void (__cdecl *DrawScreen) ( void );
//extern void (__cdecl *FrameBufferRead) ( DWORD addr );
//extern void (__cdecl *FrameBufferWrite) ( DWORD addr, DWORD Bytes );
//BOOL (__cdecl *InitiateGFX) ( GFX_INFO Gfx_Info );
//extern void (__cdecl *InitiateGFXDebugger)( DEBUG_INFO DebugInfo);
extern void (__cdecl *MoveScreen) ( int xpos, int ypos );
extern void (__cdecl *ProcessDList) ( void );
extern void (__cdecl *ProcessRDPList) ( void );
extern void (__cdecl *ShowCFB) ( void );
extern void (__cdecl *UpdateScreen) ( void );
extern void (__cdecl *ViStatusChanged) ( void );
extern void (__cdecl *ViWidthChanged) ( void );
/************ Audio DLL: Functions *****************/
//extern void (__cdecl *AiCloseDLL) ( void );
//extern void (__cdecl *AiDacrateChanged) ( int SystemType );
extern void (__cdecl *AiLenChanged) ( void );
//extern void (__cdecl *AiDllAbout) ( HWND hParent );
//extern void (__cdecl *AiDllConfig) ( HWND hParent );
//extern void (__cdecl *AiDllTest) ( HWND hParent );
extern DWORD (__cdecl *AiReadLength) ( void );
//extern void (__cdecl *AiRomClosed) ( void );
//extern void (__cdecl *AiUpdate) ( BOOL Wait );
//extern BOOL (__cdecl *InitiateAudio) ( AUDIO_INFO Audio_Info );
extern void (__cdecl *ProcessAList) ( void );
/********** Controller DLL: Functions **************/
extern void (__cdecl *ControllerCommand)( int Control, BYTE * Command );
extern void (__cdecl *GetKeys) ( int Control, BUTTONS * Keys );
extern void (__cdecl *ReadController) ( int Control, BYTE * Command );
extern void (__cdecl *RumbleCommand) ( int Control, BOOL bRumble );
#ifdef __cplusplus
}
#endif
#endif
/********** Plugin: Functions *********************/
void GetPluginDir ( char * Directory );
void GetSnapShotDir ( char * Directory );
void PluginConfiguration ( HWND hWnd );
void SetupPlugins ( HWND hWnd );
void SetupPluginScreen ( HWND hDlg );
void ShutdownPlugins ( void );
/********** External Global Variables ***************/
#define MaxDlls 100
extern char RspDLL[100], GfxDLL[100], AudioDLL[100],ControllerDLL[100], * PluginNames[MaxDlls];
extern DWORD PluginCount, RspTaskValue;
extern GFXDEBUG_INFO GFXDebug;
extern RSPDEBUG_INFO RspDebug;
extern WORD RSPVersion;
extern BOOL PluginsInitilized;
#endif

View File

@ -1,385 +0,0 @@
/*
* Project 64 - A Nintendo 64 emulator.
*
* (c) Copyright 2001 zilmar (zilmar@emulation64.com) and
* Jabo (jabo@emulation64.com).
*
* pj64 homepage: www.pj64.net
*
* Permission to use, copy, modify and distribute Project64 in both binary and
* source form, for non-commercial purposes, is hereby granted without fee,
* providing that this license information and copyright notice appear with
* all copies and any derived work.
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event shall the authors be held liable for any damages
* arising from the use of this software.
*
* Project64 is freeware for PERSONAL USE only. Commercial users should
* seek permission of the copyright holders first. Commercial use includes
* charging money for Project64 or software derived from Project64.
*
* The copyright holders request that bug fixes and improvements to the code
* should be forwarded to them so if they want them.
*
*/
#ifdef tofix
#include <Windows.h>
#include <commctrl.h>
#include <stdio.h>
#include "c core.h"
#include "main.h"
#include "C Global Variable.h"
#include "cpu.h"
#include "x86.h"
#include "debugger.h"
#include "plugin.h"
#include "Recompiler CPU.h"
N64_BLOCKS N64_Blocks;
DWORD TLBLoadAddress, TLBStoreAddress;
void FixRandomReg (void) {
while ((int)_CP0[1] < (int)_CP0[6]) {
_CP0[1] += 32 - _CP0[6];
}
}
BOOL DisplaySectionInformation (BLOCK_SECTION * Section, DWORD ID, DWORD Test);
BLOCK_SECTION * ExistingSection(BLOCK_SECTION * StartSection, DWORD Addr, DWORD Test);
void _fastcall FillSectionInfo(BLOCK_SECTION * Section);
void _fastcall FixConstants ( BLOCK_SECTION * Section, DWORD Test,int * Changed );
BOOL GenerateX86Code (BLOCK_SECTION * Section, DWORD Test );
DWORD GetNewTestValue( void );
void _fastcall InheritConstants(BLOCK_SECTION * Section);
BOOL InheritParentInfo (BLOCK_SECTION * Section);
void _fastcall InitilzeSection(BLOCK_SECTION * Section, BLOCK_SECTION * Parent, DWORD StartAddr, DWORD ID);
void InitilizeRegSet(REG_INFO * RegSet);
BOOL IsAllParentLoops(BLOCK_SECTION * Section, BLOCK_SECTION * Parent, BOOL IgnoreIfCompiled, DWORD Test);
void MarkCodeBlock (DWORD PAddr);
void SyncRegState (BLOCK_SECTION * Section, REG_INFO * SyncTo);
DWORD TLBLoadAddress, TargetIndex;
TARGET_INFO * TargetInfo = NULL;
BLOCK_INFO BlockInfo;
ORIGINAL_MEMMARKER * OrigMem = NULL;
void InitilizeInitialCompilerVariable ( void)
{
memset(&BlockInfo,0,sizeof(BlockInfo));
}
void _fastcall AddParent(BLOCK_SECTION * Section, BLOCK_SECTION * Parent){
int NoOfParents, count;
if (Section == NULL) { return; }
if (Parent == NULL) {
InitilizeRegSet(&Section->RegStart);
memcpy(&Section->RegWorking,&Section->RegStart,sizeof(REG_INFO));
return;
}
if (Section->ParentSection != NULL) {
for (NoOfParents = 0;Section->ParentSection[NoOfParents] != NULL;NoOfParents++) {
if (Section->ParentSection[NoOfParents] == Parent) {
return;
}
}
for (NoOfParents = 0;Section->ParentSection[NoOfParents] != NULL;NoOfParents++);
NoOfParents += 1;
} else {
NoOfParents = 1;
}
if (NoOfParents == 1) {
Section->ParentSection = (void **)malloc((NoOfParents + 1)*sizeof(void *));
} else {
Section->ParentSection = (void **)realloc(Section->ParentSection,(NoOfParents + 1)*sizeof(void *));
}
Section->ParentSection[NoOfParents - 1] = Parent;
Section->ParentSection[NoOfParents] = NULL;
if (NoOfParents == 1) {
if (Parent->ContinueSection == Section) {
memcpy(&Section->RegStart,&Parent->Cont.RegSet,sizeof(REG_INFO));
} else if (Parent->JumpSection == Section) {
memcpy(&Section->RegStart,&Parent->Jump.RegSet,sizeof(REG_INFO));
} else {
#ifndef EXTERNAL_RELEASE
DisplayError("How are these sections joined?????");
#endif
}
memcpy(&Section->RegWorking,&Section->RegStart,sizeof(REG_INFO));
} else {
if (Parent->ContinueSection == Section) {
for (count = 0; count < 32; count++) {
if (Section->RegStart.MIPS_RegState[count] != Parent->Cont.RegSet.MIPS_RegState[count]) {
Section->RegStart.MIPS_RegState[count] = STATE_UNKNOWN;
}
}
}
if (Parent->JumpSection == Section) {
for (count = 0; count < 32; count++) {
if (Section->RegStart.MIPS_RegState[count] != Parent->Jump.RegSet.MIPS_RegState[count]) {
Section->RegStart.MIPS_RegState[count] = STATE_UNKNOWN;
}
}
}
memcpy(&Section->RegWorking,&Section->RegStart,sizeof(REG_INFO));
}
}
void _fastcall DetermineLoop(BLOCK_SECTION * Section, DWORD Test, DWORD Test2, DWORD TestID) {
if (Section == NULL) { return; }
if (Section->SectionID != TestID) {
if (Section->Test2 == Test2) {
return;
}
Section->Test2 = Test2;
DetermineLoop((BLOCK_SECTION *)Section->ContinueSection,Test,Test2,TestID);
DetermineLoop((BLOCK_SECTION *)Section->JumpSection,Test,Test2,TestID);
return;
}
if (Section->Test2 == Test2) {
Section->InLoop = TRUE;
return;
}
Section->Test2 = Test2;
DetermineLoop((BLOCK_SECTION *)Section->ContinueSection,Test,Test2,TestID);
DetermineLoop((BLOCK_SECTION *)Section->JumpSection,Test,Test2,TestID);
if (Section->Test == Test) { return; }
Section->Test = Test;
if (Section->ContinueSection != NULL) {
DetermineLoop((BLOCK_SECTION *)Section->ContinueSection,Test,GetNewTestValue(),((BLOCK_SECTION *)Section->ContinueSection)->SectionID);
}
if (Section->JumpSection != NULL) {
DetermineLoop((BLOCK_SECTION *)Section->JumpSection,Test,GetNewTestValue(),((BLOCK_SECTION *)Section->JumpSection)->SectionID);
}
}
void _fastcall FixConstants (BLOCK_SECTION * Section, DWORD Test, int * Changed) {
BLOCK_SECTION * Parent;
int count, NoOfParents;
REG_INFO Original[2];
if (Section == NULL) { return; }
if (Section->Test == Test) { return; }
Section->Test = Test;
InheritConstants(Section);
memcpy(&Original[0],&Section->Cont.RegSet,sizeof(REG_INFO));
memcpy(&Original[1],&Section->Jump.RegSet,sizeof(REG_INFO));
if (Section->ParentSection) {
for (NoOfParents = 0;Section->ParentSection[NoOfParents] != NULL;NoOfParents++) {
Parent = (BLOCK_SECTION *)Section->ParentSection[NoOfParents];
if (Parent->ContinueSection == Section) {
for (count = 0; count < 32; count++) {
if (Section->RegStart.MIPS_RegState[count] != Parent->Cont.RegSet.MIPS_RegState[count]) {
Section->RegStart.MIPS_RegState[count] = STATE_UNKNOWN;
//*Changed = TRUE;
}
Section->RegStart.MIPS_RegState[count] = STATE_UNKNOWN;
}
}
if (Parent->JumpSection == Section) {
for (count = 0; count < 32; count++) {
if (Section->RegStart.MIPS_RegState[count] != Parent->Jump.RegSet.MIPS_RegState[count]) {
Section->RegStart.MIPS_RegState[count] = STATE_UNKNOWN;
//*Changed = TRUE;
}
}
}
memcpy(&Section->RegWorking,&Section->RegStart,sizeof(REG_INFO));
}
}
FillSectionInfo(Section);
if (memcmp(&Original[0],&Section->Cont.RegSet,sizeof(REG_INFO)) != 0) { *Changed = TRUE; }
if (memcmp(&Original[1],&Section->Jump.RegSet,sizeof(REG_INFO)) != 0) { *Changed = TRUE; }
if (Section->JumpSection) { FixConstants((BLOCK_SECTION *)Section->JumpSection,Test,Changed); }
if (Section->ContinueSection) { FixConstants((BLOCK_SECTION *)Section->ContinueSection,Test,Changed); }
}
void FreeSection (BLOCK_SECTION * Section, BLOCK_SECTION * Parent) {
if (Section == NULL) { return; }
if (Section->ParentSection) {
int NoOfParents, count;
for (NoOfParents = 0;Section->ParentSection[NoOfParents] != NULL;NoOfParents++);
for (count = 0; count < NoOfParents; count++) {
if (Section->ParentSection[count] == Parent) {
if (NoOfParents == 1) {
free(Section->ParentSection);
//CPU_Message("Free Parent Section (Section: %d)",Section->SectionID);
Section->ParentSection = NULL;
} else {
memmove(&Section->ParentSection[count],&Section->ParentSection[count + 1],
sizeof(void*) * (NoOfParents - count));
Section->ParentSection = (void **)realloc(Section->ParentSection,NoOfParents*sizeof(void *));
}
NoOfParents -= 1;
}
}
if (Parent->JumpSection == Section) { Parent->JumpSection = NULL; }
if (Parent->ContinueSection == Section) { Parent->ContinueSection = NULL; }
if (Section->ParentSection) {
for (count = 0; count < NoOfParents; count++) {
if (!IsAllParentLoops(Section,(BLOCK_SECTION *)Section->ParentSection[count],FALSE,GetNewTestValue())) { return; }
}
for (count = 0; count < NoOfParents; count++) {
Parent = (BLOCK_SECTION *)Section->ParentSection[count];
if (Parent->JumpSection == Section) { Parent->JumpSection = NULL; }
if (Parent->ContinueSection == Section) { Parent->ContinueSection = NULL; }
}
free(Section->ParentSection);
//CPU_Message("Free Parent Section (Section: %d)",Section->SectionID);
Section->ParentSection = NULL;
}
}
if (Section->ParentSection == NULL) {
FreeSection((BLOCK_SECTION *)Section->JumpSection,Section);
FreeSection((BLOCK_SECTION *)Section->ContinueSection,Section);
//CPU_Message("Free Section (Section: %d)",Section->SectionID);
free(Section);
}
}
void GenerateBasicSectionLinkage (BLOCK_SECTION * Section) {
BreakPoint(__FILE__,__LINE__);
}
DWORD GetNewTestValue(void) {
static DWORD LastTest = 0;
if (LastTest == 0xFFFFFFFF) { LastTest = 0; }
LastTest += 1;
return LastTest;
}
void InitilizeRegSet(REG_INFO * RegSet) {
int count;
RegSet->MIPS_RegState[0] = STATE_CONST_32;
RegSet->MIPS_RegVal[0].DW = 0;
for (count = 1; count < 32; count ++ ) {
RegSet->MIPS_RegState[count] = STATE_UNKNOWN;
RegSet->MIPS_RegVal[count].DW = 0;
}
for (count = 0; count < 10; count ++ ) {
RegSet->x86reg_MappedTo[count] = NotMapped;
RegSet->x86reg_Protected[count] = FALSE;
RegSet->x86reg_MapOrder[count] = 0;
}
RegSet->CycleCount = 0;
RegSet->RandomModifier = 0;
RegSet->Stack_TopPos = 0;
for (count = 0; count < 8; count ++ ) {
RegSet->x86fpu_MappedTo[count] = -1;
RegSet->x86fpu_State[count] = FPU_Unkown;
RegSet->x86fpu_RoundingModel[count] = RoundDefault;
}
RegSet->Fpu_Used = FALSE;
RegSet->RoundingModel = RoundUnknown;
}
void _fastcall InheritConstants(BLOCK_SECTION * Section) {
int NoOfParents, count;
BLOCK_SECTION * Parent;
REG_INFO * RegSet;
if (Section->ParentSection == NULL) {
InitilizeRegSet(&Section->RegStart);
memcpy(&Section->RegWorking,&Section->RegStart,sizeof(REG_INFO));
return;
}
Parent = (BLOCK_SECTION *)Section->ParentSection[0];
RegSet = Section == Parent->ContinueSection?&Parent->Cont.RegSet:&Parent->Jump.RegSet;
memcpy(&Section->RegStart,RegSet,sizeof(REG_INFO));
memcpy(&Section->RegWorking,&Section->RegStart,sizeof(REG_INFO));
for (NoOfParents = 1;Section->ParentSection[NoOfParents] != NULL;NoOfParents++) {
Parent = (BLOCK_SECTION *)Section->ParentSection[NoOfParents];
RegSet = Section == Parent->ContinueSection?&Parent->Cont.RegSet:&Parent->Jump.RegSet;
for (count = 0; count < 32; count++) {
if (IsConst(count)) {
if (MipsRegState(count) != RegSet->MIPS_RegState[count]) {
MipsRegState(count) = STATE_UNKNOWN;
} else if (Is32Bit(count) && MipsRegLo(count) != RegSet->MIPS_RegVal[count].UW[0]) {
MipsRegState(count) = STATE_UNKNOWN;
} else if (Is64Bit(count) && MipsReg(count) != RegSet->MIPS_RegVal[count].UDW) {
MipsRegState(count) = STATE_UNKNOWN;
}
}
}
}
memcpy(&Section->RegStart,&Section->RegWorking,sizeof(REG_INFO));
}
void _fastcall InitilzeSection (BLOCK_SECTION * Section, BLOCK_SECTION * Parent, DWORD StartAddr, DWORD ID) {
Section->ParentSection = NULL;
Section->JumpSection = NULL;
Section->ContinueSection = NULL;
Section->CompiledLocation = NULL;
Section->SectionID = ID;
Section->Test = 0;
Section->Test2 = 0;
Section->InLoop = FALSE;
Section->StartPC = StartAddr;
Section->CompilePC = Section->StartPC;
Section->Jump.BranchLabel = NULL;
Section->Jump.LinkLocation = NULL;
Section->Jump.LinkLocation2 = NULL;
Section->Jump.FallThrough = FALSE;
Section->Jump.PermLoop = FALSE;
Section->Jump.TargetPC = (DWORD)-1;
Section->Cont.BranchLabel = NULL;
Section->Cont.LinkLocation = NULL;
Section->Cont.LinkLocation2 = NULL;
Section->Cont.FallThrough = FALSE;
Section->Cont.PermLoop = FALSE;
Section->Cont.TargetPC = (DWORD)-1;
AddParent(Section,Parent);
}
void MarkCodeBlock (DWORD PAddr) {
if (PAddr < RdramSize) {
N64_Blocks.NoOfRDRamBlocks[PAddr >> 12] += 1;
} else if (PAddr >= 0x04000000 && PAddr <= 0x04000FFC) {
N64_Blocks.NoOfDMEMBlocks += 1;
} else if (PAddr >= 0x04001000 && PAddr <= 0x04001FFC) {
N64_Blocks.NoOfIMEMBlocks += 1;
} else if (PAddr >= 0x1FC00000 && PAddr <= 0x1FC00800) {
N64_Blocks.NoOfPifRomBlocks += 1;
} else {
#ifndef ROM_IN_MAPSPACE
#ifndef EXTERNAL_RELEASE
DisplayError("Ummm... Which code block should be marked on\nPC = 0x%08X\nRdramSize: %X",PAddr,RdramSize);
#endif
ExitThread(0);
#endif
}
}
#endif

View File

@ -1,246 +0,0 @@
#ifdef toremove
/*
* Project 64 - A Nintendo 64 emulator.
*
* (c) Copyright 2001 zilmar (zilmar@emulation64.com) and
* Jabo (jabo@emulation64.com).
*
* pj64 homepage: www.pj64.net
*
* Permission to use, copy, modify and distribute Project64 in both binary and
* source form, for non-commercial purposes, is hereby granted without fee,
* providing that this license information and copyright notice appear with
* all copies and any derived work.
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event shall the authors be held liable for any damages
* arising from the use of this software.
*
* Project64 is freeware for PERSONAL USE only. Commercial users should
* seek permission of the copyright holders first. Commercial use includes
* charging money for Project64 or software derived from Project64.
*
* The copyright holders request that bug fixes and improvements to the code
* should be forwarded to them so if they want them.
*
*/
#ifndef _RECOMPILER_CPU__H_
#define _RECOMPILER_CPU__H_
#define MaxCodeBlocks 50000
#define MaxOrigMem 65000
#ifdef toremove
#define NotMapped 0
#define GPR_Mapped 1
#define Temp_Mapped 2
#define Stack_Mapped 3
//Exit Block Methods
#define Normal 0
#define Normal_NoSysCheck 1
#define DoCPU_Action 2
#define COP1_Unuseable 3
#define DoSysCall 4
#define TLBReadMiss 5
#define ExitResetRecompCode 6
#define BranchTypeCop1 0
#define BranchTypeRs 1
#define BranchTypeRsRt 2
#define STATE_KNOWN_VALUE 1
//#define STATE_UNKNOW_VALUE
#define STATE_X86_MAPPED 2
//#define STATE_CONST
#define STATE_SIGN 4
//#define STATE_ZERO
#define STATE_32BIT 8
//#define STATE_64BIT
#define STATE_UNKNOWN 0
//STATE_MAPPED_64 = 3;
//STATE_MAPPED_32_ZERO = 11
//STATE_MAPPED_32_SIGN = 15
#define STATE_MAPPED_64 (STATE_KNOWN_VALUE | STATE_X86_MAPPED)
#define STATE_MAPPED_32_ZERO (STATE_KNOWN_VALUE | STATE_X86_MAPPED | STATE_32BIT)
#define STATE_MAPPED_32_SIGN (STATE_KNOWN_VALUE | STATE_X86_MAPPED | STATE_32BIT | STATE_SIGN)
//STATE_CONST_64 = 1
//STATE_CONST_32 = 13
#define STATE_CONST_64 (STATE_KNOWN_VALUE)
#define STATE_CONST_32 (STATE_KNOWN_VALUE | STATE_32BIT | STATE_SIGN)
#define IsKnown(Reg) ((MipsRegState(Reg) & STATE_KNOWN_VALUE) != 0)
#define IsUnknown(Reg) (!IsKnown(Reg))
#define IsMapped(Reg) (IsKnown(Reg) && (MipsRegState(Reg) & STATE_X86_MAPPED) != 0)
#define IsConst(Reg) (IsKnown(Reg) && !IsMapped(Reg))
#define IsSigned(Reg) (IsKnown(Reg) && (MipsRegState(Reg) & STATE_SIGN) != 0)
#define IsUnsigned(Reg) (IsKnown(Reg) && !IsSigned(Reg))
#define Is32Bit(Reg) (IsKnown(Reg) && (MipsRegState(Reg) & STATE_32BIT) != 0)
#define Is64Bit(Reg) (IsKnown(Reg) && !Is32Bit(Reg))
#define Is32BitMapped(Reg) (Is32Bit(Reg) && (MipsRegState(Reg) & STATE_X86_MAPPED) != 0)
#define Is64BitMapped(Reg) (Is64Bit(Reg) && !Is32BitMapped(Reg))
/*#define MipsRegState(Reg) Section->RegWorking.MIPS_RegState[Reg]
#define MipsReg(Reg) Section->RegWorking.MIPS_RegVal[Reg].UDW
#define MipsReg_S(Reg) Section->RegWorking.MIPS_RegVal[Reg].DW
#define MipsRegLo(Reg) Section->RegWorking.MIPS_RegVal[Reg].UW[0]
#define MipsRegLo_S(Reg) Section->RegWorking.MIPS_RegVal[Reg].W[0]
#define MipsRegHi(Reg) Section->RegWorking.MIPS_RegVal[Reg].UW[1]
#define MipsRegHi_S(Reg) Section->RegWorking.MIPS_RegVal[Reg].W[1]
#define x86MapOrder(Reg) Section->RegWorking.x86reg_MapOrder[Reg]
#define x86Protected(Reg) Section->RegWorking.x86reg_Protected[Reg]
#define x86Mapped(Reg) Section->RegWorking.x86reg_MappedTo[Reg]
*/
#define BlockCycleCount Section->RegWorking.CycleCount
#define BlockRandomModifier Section->RegWorking.RandomModifier
#define StackTopPos Section->RegWorking.Stack_TopPos
#define FpuMappedTo(Reg) Section->RegWorking.x86fpu_MappedTo[Reg]
#define FpuState(Reg) Section->RegWorking.x86fpu_State[Reg]
#define FpuRoundingModel(Reg) Section->RegWorking.x86fpu_RoundingModel[Reg]
#define FpuBeenUsed Section->RegWorking.Fpu_Used
#define CurrentRoundingModel Section->RegWorking.RoundingModel
typedef struct {
//r4k
int MIPS_RegState[32];
MIPS_DWORD MIPS_RegVal[32];
DWORD x86reg_MappedTo[10];
DWORD x86reg_MapOrder[10];
BOOL x86reg_Protected[10];
DWORD CycleCount;
DWORD RandomModifier;
//FPU
DWORD Stack_TopPos;
DWORD x86fpu_MappedTo[8];
DWORD x86fpu_State[8];
DWORD x86fpu_RoundingModel[8];
BOOL Fpu_Used;
DWORD RoundingModel;
} REG_INFO;
typedef struct {
DWORD TargetPC;
char * BranchLabel;
BYTE * LinkLocation;
BYTE * LinkLocation2;
BOOL FallThrough;
BOOL PermLoop;
BOOL DoneDelaySlot;
REG_INFO RegSet;
} JUMP_INFO;
typedef struct {
/* Block Connection info */
void ** ParentSection;
void * ContinueSection;
void * JumpSection;
BYTE * CompiledLocation;
DWORD SectionID;
DWORD Test;
DWORD Test2;
BOOL InLoop;
DWORD StartPC;
DWORD CompilePC;
/* Register Info */
REG_INFO RegStart;
REG_INFO RegWorking;
/* Jump Info */
JUMP_INFO Jump;
JUMP_INFO Cont;
} BLOCK_SECTION;
typedef struct {
BLOCK_SECTION * Parent;
JUMP_INFO * JumpInfo;
} BLOCK_PARENT;
typedef struct {
DWORD TargetPC;
REG_INFO ExitRegSet;
int reason;
int NextInstruction;
BYTE * JumpLoc; //32bit jump
} EXIT_INFO;
typedef struct {
DWORD StartVAddr;
BYTE * CompiledLocation;
int NoOfSections;
BLOCK_SECTION BlockInfo;
EXIT_INFO ** ExitInfo;
int ExitCount;
} BLOCK_INFO;
#endif
typedef struct {
void * CodeBlock;
QWORD OriginalMemory;
} TARGET_INFO;
typedef struct {
DWORD PAddr;
DWORD VAddr;
DWORD OriginalValue;
void * CompiledLocation;
} ORIGINAL_MEMMARKER;
typedef struct {
DWORD NoOfRDRamBlocks[2048];
DWORD NoOfDMEMBlocks;
DWORD NoOfIMEMBlocks;
DWORD NoOfPifRomBlocks;
} N64_BLOCKS;
#ifdef __cplusplus
//void CompileSystemCheck ( DWORD TargetPC, CRegInfo RegSet );
//void FreeSection ( CCodeSection * Section, CCodeSection * Parent);
void GenerateSectionLinkage ( CCodeSection * Section );
extern "C" {
#endif
BYTE *CompileDelaySlot ( void );
void FixRandomReg ( void );
void StartRecompilerCPU ( void );
void InitilizeInitialCompilerVariable ( void);
extern DWORD TLBLoadAddress, TLBStoreAddress, TargetIndex;
extern ORIGINAL_MEMMARKER * OrigMem;
extern TARGET_INFO * TargetInfo;
extern N64_BLOCKS N64_Blocks;
#ifdef __cplusplus
}
#endif
//#define SetJump32(Loc,JumpLoc) *(DWORD *)(Loc)= (DWORD)(((DWORD)(JumpLoc)) - (((DWORD)(Loc)) + 4));
//#define SetJump8(Loc,JumpLoc) *(BYTE *)(Loc)= (BYTE )(((BYTE )(JumpLoc)) - (((BYTE )(Loc)) + 1));
#endif
#endif

View File

@ -1,26 +0,0 @@
/*
* Project 64 - A Nintendo 64 emulator.
*
* (c) Copyright 2001 zilmar (zilmar@emulation64.com) and
* Jabo (jabo@emulation64.com).
*
* pj64 homepage: www.pj64.net
*
* Permission to use, copy, modify and distribute Project64 in both binary and
* source form, for non-commercial purposes, is hereby granted without fee,
* providing that this license information and copyright notice appear with
* all copies and any derived work.
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event shall the authors be held liable for any damages
* arising from the use of this software.
*
* Project64 is freeware for PERSONAL USE only. Commercial users should
* seek permission of the copyright holders first. Commercial use includes
* charging money for Project64 or software derived from Project64.
*
* The copyright holders request that bug fixes and improvements to the code
* should be forwarded to them so if they want them.
*
*/

View File

@ -1,660 +0,0 @@
/*
* Project 64 - A Nintendo 64 emulator.
*
* (c) Copyright 2001 zilmar (zilmar@emulation64.com) and
* Jabo (jabo@emulation64.com).
*
* pj64 homepage: www.pj64.net
*
* Permission to use, copy, modify and distribute Project64 in both binary and
* source form, for non-commercial purposes, is hereby granted without fee,
* providing that this license information and copyright notice appear with
* all copies and any derived work.
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event shall the authors be held liable for any damages
* arising from the use of this software.
*
* Project64 is freeware for PERSONAL USE only. Commercial users should
* seek permission of the copyright holders first. Commercial use includes
* charging money for Project64 or software derived from Project64.
*
* The copyright holders request that bug fixes and improvements to the code
* should be forwarded to them so if they want them.
*
*/
#ifdef todelete
#include <Windows.h>
#include <stdio.h>
#include "main.h"
#include "cpu.h"
#include "debugger.h"
#include "plugin.h"
#define MaxMemory 2000
void StartErrorLog ( void );
void StopErrorLog ( void );
void WriteSyncMemoryLineDump ( char * Label, BYTE * Memory );
DWORD CurrentBlock, *TLB_SyncReadMap, *TLB_SyncWriteMap, * MemAddrUsed[2] = { NULL,NULL };
int SyncNextInstruction, SyncJumpToLocation;
HANDLE hErrorLogFile = NULL;
N64_REGISTERS SyncRegisters;
int MemAddrUsedCount[2];
BYTE * SyncMemory;
#ifdef toremove
//TLB
//FASTTLB SyncFastTlb[64];
//TLB SyncTlb[32];
#endif
int Sync_MemoryFilter( DWORD dwExptCode, LPEXCEPTION_POINTERS lpEP);
void AllocateSyncMemory ( void ) {
DWORD * TempReadMap, *TempWriteMap;
BYTE * TempMemPtr;
FreeSyncMemory();
if(SyncMemory==NULL) {
DisplayError(GS(MSG_MEM_ALLOC_ERROR));
ExitThread(0);
}
if(VirtualAlloc(SyncMemory, RdramSize, MEM_COMMIT, PAGE_READWRITE)==NULL) {
DisplayError(GS(MSG_MEM_ALLOC_ERROR));
ExitThread(0);
}
if(VirtualAlloc(SyncMemory + 0x04000000, 0x2000, MEM_COMMIT, PAGE_READWRITE)==NULL) {
DisplayError(GS(MSG_MEM_ALLOC_ERROR));
ExitThread(0);
}
TLB_SyncReadMap = (DWORD *)VirtualAlloc(NULL,0xFFFFF * sizeof(DWORD),MEM_RESERVE|MEM_COMMIT,PAGE_READWRITE);
if (TLB_SyncReadMap == NULL) {
DisplayError(GS(MSG_MEM_ALLOC_ERROR));
ExitThread(0);
}
TLB_SyncWriteMap = (DWORD *)VirtualAlloc(NULL,0xFFFFF * sizeof(DWORD),MEM_RESERVE|MEM_COMMIT,PAGE_READWRITE);
if (TLB_SyncWriteMap == NULL) {
DisplayError(GS(MSG_MEM_ALLOC_ERROR));
ExitThread(0);
}
MemAddrUsed[0] = (DWORD *)malloc(MaxMemory * sizeof(DWORD *));
MemAddrUsed[1] = (DWORD *)malloc(MaxMemory * sizeof(DWORD *));
TempReadMap = TLB_ReadMap;
TLB_ReadMap = TLB_SyncReadMap;
TLB_SyncReadMap = TempReadMap;
TempWriteMap = TLB_WriteMap;
TLB_WriteMap = TLB_SyncWriteMap;
TLB_SyncWriteMap = TempWriteMap;
TempMemPtr = N64MEM;
N64MEM = SyncMemory;
RDRAM = (unsigned char *)(N64MEM);
DMEM = (unsigned char *)(N64MEM+0x04000000);
IMEM = (unsigned char *)(N64MEM+0x04001000);
SyncMemory = TempMemPtr;
InitilizeTLB();
memcpy(SyncFastTlb,FastTlb,sizeof(FastTlb));
memcpy(SyncTlb,tlb,sizeof(tlb));
}
void __cdecl Error_Message (char * Message, ...) {
DWORD dwWritten;
char Msg[400];
va_list ap;
if (hErrorLogFile == NULL) { StartErrorLog(); }
va_start( ap, Message );
vsprintf( Msg, Message, ap );
va_end( ap );
strcat(Msg,"\r\n");
WriteFile( hErrorLogFile,Msg,strlen(Msg),&dwWritten,NULL );
}
void FreeSyncMemory (void) {
if (TLB_SyncReadMap) {
VirtualFree( TLB_SyncReadMap, 0 , MEM_RELEASE);
TLB_SyncReadMap = NULL;
}
if (TLB_SyncWriteMap) {
VirtualFree( TLB_SyncWriteMap, 0 , MEM_RELEASE);
TLB_SyncWriteMap = NULL;
}
if (MemAddrUsed[0]) { free(MemAddrUsed[0]); }
MemAddrUsed[0] = NULL;
if (MemAddrUsed[1]) { free(MemAddrUsed[1]); }
MemAddrUsed[1] = NULL;
}
void ProtectMemory (void) {
DWORD OldProtect;
VirtualProtect(N64MEM,RdramSize,PAGE_READONLY,&OldProtect);
VirtualProtect(N64MEM + 0x04000000,0x2000,PAGE_READONLY,&OldProtect);
}
void ReInitializeRSP (void) {
#ifdef hhhh
RSP_INFO_1_0 RspInfo10;
RSP_INFO_1_1 RspInfo11;
RspInfo10.CheckInterrupts = CheckInterrupts;
RspInfo11.CheckInterrupts = CheckInterrupts;
RspInfo10.ProcessDlist = ProcessDList;
RspInfo11.ProcessDlist = ProcessDList;
RspInfo10.ProcessAlist = ProcessAList;
RspInfo11.ProcessAlist = ProcessAList;
RspInfo10.ProcessRdpList = ProcessRDPList;
RspInfo11.ProcessRdpList = ProcessRDPList;
RspInfo11.ShowCFB = ShowCFB;
RspInfo10.hInst = hInst;
RspInfo11.hInst = hInst;
RspInfo10.RDRAM = N64MEM;
RspInfo11.RDRAM = N64MEM;
RspInfo10.DMEM = DMEM;
RspInfo11.DMEM = DMEM;
RspInfo10.IMEM = IMEM;
RspInfo11.IMEM = IMEM;
RspInfo10.MemoryBswaped = FALSE;
RspInfo11.MemoryBswaped = FALSE;
RspInfo10.MI__INTR_REG = &MI_INTR_REG;
RspInfo11.MI__INTR_REG = &MI_INTR_REG;
RspInfo10.SP__MEM_ADDR_REG = &SP_MEM_ADDR_REG;
RspInfo11.SP__MEM_ADDR_REG = &SP_MEM_ADDR_REG;
RspInfo10.SP__DRAM_ADDR_REG = &SP_DRAM_ADDR_REG;
RspInfo11.SP__DRAM_ADDR_REG = &SP_DRAM_ADDR_REG;
RspInfo10.SP__RD_LEN_REG = &SP_RD_LEN_REG;
RspInfo11.SP__RD_LEN_REG = &SP_RD_LEN_REG;
RspInfo10.SP__WR_LEN_REG = &SP_WR_LEN_REG;
RspInfo11.SP__WR_LEN_REG = &SP_WR_LEN_REG;
RspInfo10.SP__STATUS_REG = &SP_STATUS_REG;
RspInfo11.SP__STATUS_REG = &SP_STATUS_REG;
RspInfo10.SP__DMA_FULL_REG = &SP_DMA_FULL_REG;
RspInfo11.SP__DMA_FULL_REG = &SP_DMA_FULL_REG;
RspInfo10.SP__DMA_BUSY_REG = &SP_DMA_BUSY_REG;
RspInfo11.SP__DMA_BUSY_REG = &SP_DMA_BUSY_REG;
RspInfo10.SP__PC_REG = &SP_PC_REG;
RspInfo11.SP__PC_REG = &SP_PC_REG;
RspInfo10.SP__SEMAPHORE_REG = &SP_SEMAPHORE_REG;
RspInfo11.SP__SEMAPHORE_REG = &SP_SEMAPHORE_REG;
RspInfo10.DPC__START_REG = &DPC_START_REG;
RspInfo11.DPC__START_REG = &DPC_START_REG;
RspInfo10.DPC__END_REG = &DPC_END_REG;
RspInfo11.DPC__END_REG = &DPC_END_REG;
RspInfo10.DPC__CURRENT_REG = &DPC_CURRENT_REG;
RspInfo11.DPC__CURRENT_REG = &DPC_CURRENT_REG;
RspInfo10.DPC__STATUS_REG = &DPC_STATUS_REG;
RspInfo11.DPC__STATUS_REG = &DPC_STATUS_REG;
RspInfo10.DPC__CLOCK_REG = &DPC_CLOCK_REG;
RspInfo11.DPC__CLOCK_REG = &DPC_CLOCK_REG;
RspInfo10.DPC__BUFBUSY_REG = &DPC_BUFBUSY_REG;
RspInfo11.DPC__BUFBUSY_REG = &DPC_BUFBUSY_REG;
RspInfo10.DPC__PIPEBUSY_REG = &DPC_PIPEBUSY_REG;
RspInfo11.DPC__PIPEBUSY_REG = &DPC_PIPEBUSY_REG;
RspInfo10.DPC__TMEM_REG = &DPC_TMEM_REG;
RspInfo11.DPC__TMEM_REG = &DPC_TMEM_REG;
if (RSPVersion == 0x0100) { InitiateRSP_1_0(RspInfo10, &RspTaskValue); }
if (RSPVersion == 0x0101) { InitiateRSP_1_1(RspInfo11, &RspTaskValue); }
#else
BreakPoint(__FILE__,__LINE__);
#endif
}
void StartErrorLog (void) {
#ifdef ggg
char path_buffer[_MAX_PATH], drive[_MAX_DRIVE] ,dir[_MAX_DIR];
char fname[_MAX_FNAME],ext[_MAX_EXT], LogFileName[_MAX_PATH];
GetModuleFileName(NULL,path_buffer,sizeof(path_buffer));
_splitpath( path_buffer, drive, dir, fname, ext );
_makepath( LogFileName, drive, dir, "CPU Error", "log" );
hErrorLogFile = CreateFile(LogFileName,GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,
CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
SetFilePointer(hErrorLogFile,0,NULL,FILE_BEGIN);
Error_Message("=== Error Has occured !?! ===");
Error_Message("Block Address: 0x%X",CurrentBlock);
if (PROGRAM_COUNTER != Registers.PROGRAM_COUNTER) {
Error_Message("interp PC: 0x%08X",PROGRAM_COUNTER);
Error_Message("Recomp PC: 0x%08X",Registers.PROGRAM_COUNTER);
} else {
Error_Message("PC: 0x%08X",PROGRAM_COUNTER);
}
Error_Message("");
#else
BreakPoint(__FILE__,__LINE__);
#endif
}
#ifdef todelete
void StartSyncCPU (void ) {
#ifdef hhh
DWORD Addr;
BYTE * Block;
#ifdef Log_x86Code
Start_x86_Log();
#endif
ResetRecompCode();
AllocateSyncMemory();
Registers.PROGRAM_COUNTER = PROGRAM_COUNTER;
Registers.HI.DW = HI.DW;
Registers.LO.DW = LO.DW;
Registers.DMAUsed = DMAUsed;
memcpy(&SyncRegisters,&Registers,sizeof(Registers));
memcpy(N64MEM,SyncMemory,RdramSize);
memcpy(N64MEM + 0x04000000,SyncMemory + 0x04000000,0x2000);
ProtectMemory();
SyncNextInstruction = NORMAL;
SyncJumpToLocation = -1;
__try {
for (;;) {
Addr = PROGRAM_COUNTER;
if (UseTlb) {
if (!TranslateVaddr(&Addr)) {
DoTLBMiss(NextInstruction == DELAY_SLOT,PROGRAM_COUNTER);
NextInstruction = NORMAL;
Addr = PROGRAM_COUNTER;
if (!TranslateVaddr(&Addr)) {
DisplayError("Failed to tranlate PC to a PAddr: %X\n\nEmulation stopped",PROGRAM_COUNTER);
ExitThread(0);
}
}
} else {
Addr &= 0x1FFFFFFF;
}
if (NextInstruction == DELAY_SLOT) {
__try {
Block = *(DelaySlotTable + (Addr >> 12));
} __except(EXCEPTION_EXECUTE_HANDLER) {
DisplayError("Executing Delay Slot from non maped space");
ExitThread(0);
}
if (Block == NULL) {
Block = CompileDelaySlot();
*(DelaySlotTable + (Addr >> 12)) = Block;
NextInstruction = NORMAL;
}
_asm {
pushad
call Block
popad
}
continue;
}
__try {
Block = *(JumpTable + (Addr >> 2));
} __except(EXCEPTION_EXECUTE_HANDLER) {
DisplayError(GS(MSG_NONMAPPED_SPACE));
ExitThread(0);
}
if (Block == NULL) {
__try {
Block = Compiler4300iBlock();
} __except(EXCEPTION_EXECUTE_HANDLER) {
DisplayError("Reset Recompiler Code");
//ResetRecompCode();
//Block = Compiler4300iBlock();
}
*(JumpTable + (Addr >> 2)) = Block;
NextInstruction = NORMAL;
}
_asm {
pushad
call Block
popad
}
}
} __except( Sync_MemoryFilter( GetExceptionCode(), GetExceptionInformation()) ) {
DisplayError(GS(MSG_UNKNOWN_MEM_ACTION));
ExitThread(0);
}
#else
BreakPoint(__FILE__,__LINE__);
#endif
}
#endif
void StopErrorLog (void) {
if (hErrorLogFile) {
CloseHandle(hErrorLogFile);
hErrorLogFile = NULL;
}
}
void SwitchSyncRegisters (void) {
_Notify->BreakPoint(__FILE__,__LINE__);
#ifdef tofix
FASTTLB TempFastTlb[64];
TLB Temptlb[32];
BYTE * TempMemPtr;
DWORD * Temp;
if (GPR == Registers.GPR) {
Registers.PROGRAM_COUNTER = PROGRAM_COUNTER;
Registers.HI.DW = HI.DW;
Registers.LO.DW = LO.DW;
Registers.DMAUsed = DMAUsed;
SetupRegisters(&SyncRegisters);
} else {
SyncRegisters.PROGRAM_COUNTER = PROGRAM_COUNTER;
SyncRegisters.HI.DW = HI.DW;
SyncRegisters.LO.DW = LO.DW;
SyncRegisters.DMAUsed = DMAUsed;
SetupRegisters(&Registers);
}
Temp = MemAddrUsed[1];
MemAddrUsed[1] = MemAddrUsed[0];
MemAddrUsed[0] = Temp;
MemAddrUsedCount[1] = MemAddrUsedCount[0];
MemAddrUsedCount[0] = 0;
memcpy(TempFastTlb,FastTlb,sizeof(FastTlb));
memcpy(FastTlb,SyncFastTlb,sizeof(FastTlb));
memcpy(SyncFastTlb,TempFastTlb,sizeof(FastTlb));
memcpy(Temptlb,tlb,sizeof(tlb));
memcpy(tlb,SyncTlb,sizeof(tlb));
memcpy(SyncTlb,Temptlb,sizeof(tlb));
Temp = TLB_ReadMap;
TLB_ReadMap = TLB_SyncReadMap;
TLB_SyncReadMap = Temp;
Temp = TLB_WriteMap;
TLB_WriteMap = TLB_SyncWriteMap;
TLB_SyncWriteMap = Temp;
TempMemPtr = N64MEM;
N64MEM = SyncMemory;
RDRAM = (unsigned char *)(N64MEM);
DMEM = (unsigned char *)(N64MEM+0x04000000);
IMEM = (unsigned char *)(N64MEM+0x04001000);
SyncMemory = TempMemPtr;
ReInitializeRSP();
ProtectMemory();
#else
BreakPoint(__FILE__,__LINE__);
#endif
}
/*void SyncSystem (void) {
#ifdef hhhh
int count, i, error;
error = FALSE;
if (PROGRAM_COUNTER != Registers.PROGRAM_COUNTER) {
error = TRUE;
Error_Message("*** Program counter is not equal!!!");
Error_Message("");
}
//GPR
for (count = 0; count < 32; count ++) {
if (Registers.GPR[count].DW != SyncRegisters.GPR[count].DW) {
error = TRUE;
Error_Message("*** %s (GPR %d) is not equal!!!",GPR_Name[count],count);
Error_Message("interp value: 0x%08X%08X",SyncRegisters.GPR[count].UW[1],SyncRegisters.GPR[count].UW[0]);
Error_Message("Recomp value: 0x%08X%08X",Registers.GPR[count].UW[1],Registers.GPR[count].UW[0]);
Error_Message("");
}
}
//COP0
FixRandomReg();
for (count = 0; count < 33; count ++) {
if (Registers.CP0[count] != SyncRegisters.CP0[count]) {
error = TRUE;
Error_Message("*** %s (CP0 %d) is not equal!!!",count == 32?"Fake cause":Cop0_Name[count],count);
Error_Message("interp value: 0x%08X",SyncRegisters.CP0[count]);
Error_Message("Recomp value: 0x%08X",Registers.CP0[count]);
Error_Message("");
}
}
//FPU
for (count = 0; count < 32; count ++) {
if (Registers.FPR[count].DW != SyncRegisters.FPR[count].DW) {
error = TRUE;
Error_Message("*** %s (FPR %d) is not equal!!!",FPR_Name[count],count);
Error_Message("interp value: 0x%08X%08X",SyncRegisters.FPR[count].UW[1],SyncRegisters.FPR[count].UW[0]);
Error_Message("Recomp value: 0x%08X%08X",Registers.FPR[count].UW[1],Registers.FPR[count].UW[0]);
Error_Message("");
}
}
if (Registers.FPCR[31] != SyncRegisters.FPCR[31]) {
error = TRUE;
Error_Message("*** %s is not equal!!!",FPR_Ctrl_Name[31]);
Error_Message("interp value: 0x%08X",SyncRegisters.FPCR[31]);
Error_Message("Recomp value: 0x%08X",Registers.FPCR[31]);
Error_Message("");
}
//HI
if (Registers.HI.DW != HI.DW) {
error = TRUE;
Error_Message("*** HI register is not equal!!!");
Error_Message("interp value: 0x%08X",HI.DW);
Error_Message("Recomp value: 0x%08X",Registers.HI.DW);
Error_Message("");
}
//LO
if (Registers.LO.DW != LO.DW) {
error = TRUE;
Error_Message("*** LO register is not equal!!!");
Error_Message("interp value: 0x%08X",LO.DW);
Error_Message("Recomp value: 0x%08X",Registers.LO.DW);
Error_Message("");
}
//TLB
for (count = 0; count < 32; count ++) {
if (tlb[count].PageMask.Value != SyncTlb[count].PageMask.Value) {
error = TRUE;
Error_Message("*** tlb[%d].PageMask is not equal!!!",count);
Error_Message("interp value: 0x%08X",SyncTlb[count].PageMask.Value);
Error_Message("Recomp value: 0x%08X",tlb[count].PageMask.Value );
Error_Message("");
}
if (tlb[count].EntryHi.Value != SyncTlb[count].EntryHi.Value) {
error = TRUE;
Error_Message("*** tlb[%d].EntryHi is not equal!!!",count);
Error_Message("interp value: 0x%08X",SyncTlb[count].EntryHi.Value);
Error_Message("Recomp value: 0x%08X",tlb[count].EntryHi.Value );
Error_Message("");
}
if (tlb[count].EntryLo0.Value != SyncTlb[count].EntryLo0.Value) {
error = TRUE;
Error_Message("*** tlb[%d].PageMask is not equal!!!",count);
Error_Message("interp value: 0x%08X",SyncTlb[count].EntryLo0.Value);
Error_Message("Recomp value: 0x%08X",tlb[count].EntryLo0.Value );
Error_Message("");
}
if (tlb[count].EntryLo1.Value != SyncTlb[count].EntryLo1.Value) {
error = TRUE;
Error_Message("*** tlb[%d].PageMask is not equal!!!",count);
Error_Message("interp value: 0x%08X",SyncTlb[count].EntryLo1.Value);
Error_Message("Recomp value: 0x%08X",tlb[count].EntryLo1.Value );
Error_Message("");
}
}
//Mips Interface
for (count = 0; count < 4; count ++) {
if (Registers.MI[count] != SyncRegisters.MI[count]) {
error = TRUE;
Error_Message("*** MI %d is not equal!!!",count);
Error_Message("interp value: 0x%08X",SyncRegisters.MI[count]);
Error_Message("Recomp value: 0x%08X",Registers.MI[count]);
Error_Message("");
}
}
//PI Interface
for (count = 0; count < 12; count ++) {
if (Registers.PI[count] != SyncRegisters.PI[count]) {
error = TRUE;
Error_Message("*** PI %d is not equal!!!",count);
Error_Message("interp value: 0x%08X",SyncRegisters.PI[count]);
Error_Message("Recomp value: 0x%08X",Registers.PI[count]);
Error_Message("");
}
}
//Memory
for (count = 0; count < MemAddrUsedCount[0]; count ++) {
int count2;
for (count2 = 0; count2 < MemAddrUsedCount[1]; count2 ++) {
if (MemAddrUsed[0][count] == MemAddrUsed[1][count2]) {
MemAddrUsed[1][count2] = (DWORD)-1;
}
}
}
for (i = 0; i < 2; i++) {
for (count = 0; count < MemAddrUsedCount[i]; count ++) {
DWORD count2;
if (MemAddrUsed[i][count] == (DWORD)-1) { continue; }
if (memcmp(N64MEM + MemAddrUsed[i][count], SyncMemory + MemAddrUsed[i][count],0xFFF) == 0) {
continue;
}
error = TRUE;
for (count2 = MemAddrUsed[i][count]; count2 < (MemAddrUsed[i][count] + 0x1000); count2 += 0x10) {
if (memcmp(N64MEM + count2, SyncMemory + count2,0x10) == 0) { continue; }
Error_Message("*** Memory (Address: %X) is not equal!!!",count2);
WriteSyncMemoryLineDump("Interp",N64MEM + count2);
WriteSyncMemoryLineDump("Recomp",SyncMemory + count2);
Error_Message("");
}
}
}
if (error) {
SwitchSyncRegisters();
DisplayError("Sync Error has occured see log for details\n\nEmulation Has stoped");
ExitThread(0);
}
#else
BreakPoint(__FILE__,__LINE__);
#endif
}*/
void SyncToPC (void) {
FixRandomReg();
SyncSystem ();
return;
#ifdef toremove
{
int RecNextInstruction, RecJumpToLocation;
//LogMessage("Recompiler (PC: %X count: %X)",PROGRAM_COUNTER,CP0[9]);
RecNextInstruction = NextInstruction;
RecJumpToLocation = JumpToLocation;
NextInstruction = SyncNextInstruction;
JumpToLocation = SyncJumpToLocation;
SwitchSyncRegisters();
/*if ((DWORD)RecompPos > 0x609844D8) {
while (PROGRAM_COUNTER != Registers.PROGRAM_COUNTER) {
ExecuteInterpreterOpCode();
}
} else {
while (CP0[9] != Registers.CP0[9]) {
ExecuteInterpreterOpCode();
}
}*/
while (CP0[9] != Registers.CP0[9]) {
ExecuteInterpreterOpCode();
}
SyncRegisters.MI[2] = Registers.MI[2]; //MI_INTR_REG
SyncRegisters.CP0[32] = Registers.CP0[32]; //FAKE_CAUSE_REGISTER
SyncSystem ();
SwitchSyncRegisters();
SyncNextInstruction = NextInstruction;
SyncJumpToLocation = JumpToLocation;
NextInstruction = RecNextInstruction;
JumpToLocation = RecJumpToLocation;
MemAddrUsedCount[0] = 0;
MemAddrUsedCount[1] = 0;
}
#endif
}
int Sync_MemoryFilter( DWORD dwExptCode, LPEXCEPTION_POINTERS lpEP) {
DWORD MemAddress = (char *)lpEP->ExceptionRecord->ExceptionInformation[1] - (char *)N64MEM;
EXCEPTION_RECORD exRec;
if (dwExptCode != EXCEPTION_ACCESS_VIOLATION) {
return EXCEPTION_CONTINUE_SEARCH;
}
exRec = *lpEP->ExceptionRecord;
if ((int)((char *)lpEP->ExceptionRecord->ExceptionInformation[1] - N64MEM) < 0) {
return EXCEPTION_CONTINUE_SEARCH;
}
if ((int)((char *)lpEP->ExceptionRecord->ExceptionInformation[1] - N64MEM) > 0x1FFFFFFF) {
return EXCEPTION_CONTINUE_SEARCH;
}
if (MemAddress < RdramSize || (MemAddress >= 0x4000000 && MemAddress < 0x4002000)) {
DWORD OldProtect;
VirtualProtect(N64MEM+(MemAddress & 0xFFFFF000),0xFFF,PAGE_READWRITE,&OldProtect);
MemAddrUsed[0][MemAddrUsedCount[0]] = (MemAddress & 0xFFFFF000);
MemAddrUsedCount[0] += 1;
if (MemAddrUsedCount[0] == MaxMemory) {
DisplayError("Used up all sync blocks ????");
ExitThread(0);
}
if (CPU_Type != ModCode_ProtectedMemory) { return EXCEPTION_CONTINUE_EXECUTION; }
}
return r4300i_CPU_MemoryFilter(dwExptCode,lpEP);
}
void WriteSyncMemoryLineDump (char * Label, BYTE * Memory) {
char Hex[100], Ascii[30];
DWORD count;
memset(&Hex,0,sizeof(Hex));
memset(&Ascii,0,sizeof(Ascii));
for (count = 0; count < 0x10; count ++ ) {
if ((count % 4) != 0 || count == 0) {
sprintf(Hex,"%s %02X",Hex,Memory[count]);
} else {
sprintf(Hex,"%s - %02X",Hex,Memory[count]);
}
if (Memory[count] < 30 || Memory[count] > 127) {
strcat(Ascii,".");
} else {
sprintf(Ascii,"%s%c",Ascii,Memory[count]);
}
}
Error_Message("%s:%s %s",Label,Hex,Ascii);
}
#endif

View File

@ -1,41 +0,0 @@
/*
* Project 64 - A Nintendo 64 emulator.
*
* (c) Copyright 2001 zilmar (zilmar@emulation64.com) and
* Jabo (jabo@emulation64.com).
*
* pj64 homepage: www.pj64.net
*
* Permission to use, copy, modify and distribute Project64 in both binary and
* source form, for non-commercial purposes, is hereby granted without fee,
* providing that this license information and copyright notice appear with
* all copies and any derived work.
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event shall the authors be held liable for any damages
* arising from the use of this software.
*
* Project64 is freeware for PERSONAL USE only. Commercial users should
* seek permission of the copyright holders first. Commercial use includes
* charging money for Project64 or software derived from Project64.
*
* The copyright holders request that bug fixes and improvements to the code
* should be forwarded to them so if they want them.
*
*/
#ifdef todelete
void StartSyncCPU ( void );
void SwitchSyncRegisters (void);
void SyncToPC ( void );
void FreeSyncMemory ( void );
extern int SyncNextInstruction, SyncJumpToLocation, MemAddrUsedCount[2];
extern DWORD CurrentBlock, *TLB_SyncReadMap, *TLB_SyncWriteMap;
extern N64_REGISTERS SyncRegisters;
extern BYTE * SyncMemory;
extern FASTTLB SyncFastTlb[64];
extern TLB SyncTlb[32];
#endif

View File

@ -1,291 +0,0 @@
/*
* Project 64 - A Nintendo 64 emulator.
*
* (c) Copyright 2001 zilmar (zilmar@emulation64.com) and
* Jabo (jabo@emulation64.com).
*
* pj64 homepage: www.pj64.net
*
* Permission to use, copy, modify and distribute Project64 in both binary and
* source form, for non-commercial purposes, is hereby granted without fee,
* providing that this license information and copyright notice appear with
* all copies and any derived work.
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event shall the authors be held liable for any damages
* arising from the use of this software.
*
* Project64 is freeware for PERSONAL USE only. Commercial users should
* seek permission of the copyright holders first. Commercial use includes
* charging money for Project64 or software derived from Project64.
*
* The copyright holders request that bug fixes and improvements to the code
* should be forwarded to them so if they want them.
*
*/
#ifdef todelete
#if (!defined(EXTERNAL_RELEASE))
#include <windows.h>
#include <commctrl.h>
#include <stdio.h>
#include "main.h"
#include "cpu.h"
#include "..\..\User Interface\resource.h"
LRESULT CALLBACK TLB_Proc (HWND, UINT, WPARAM, LPARAM);
HWND TlbDlg = NULL;
void Create_TLB_Window ( int Child ) {
if ( Child ) {
DialogBox( GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_Debugger_TLB), NULL,(DLGPROC) TLB_Proc );
TlbDlg = NULL;
} else {
if (TlbDlg == NULL) {
DWORD ThreadID;
CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)Create_TLB_Window,(LPVOID)TRUE,0,
&ThreadID);
} else {
SetForegroundWindow(TlbDlg);
}
}
}
void Enter_TLB_Window ( void ) {
if (!HaveDebugger) { return; }
Create_TLB_Window ( FALSE );
}
void RefreshTLBWindow (void) {
HWND hList = GetDlgItem(TlbDlg,IDC_LIST);
char Output[100], OldText[100];
LV_ITEM item, OldItem;
int count;
if (!TlbDlg) { return; }
for (count = 0; count < 32; count ++) {
sprintf(Output,"0x%02X",count);
item.mask = LVIF_TEXT;
item.iItem = count;
item.pszText = Output;
item.iSubItem = 0;
OldItem.mask = LVIF_TEXT;
OldItem.iItem = count;
OldItem.pszText = OldText;
OldItem.cchTextMax = sizeof( OldText )-1;
OldItem.iSubItem = 0;
if (ListView_GetItemCount(hList) <= count) {
ListView_InsertItem(hList,&item);
} else {
ListView_GetItem(hList,&OldItem);
if ( strcmp( item.pszText, OldItem.pszText ) != 0 ) {
ListView_SetItem(hList,&item);
}
}
if (tlb[count].EntryDefined) {
sprintf(Output,"0x%08X",tlb[count].PageMask.Value);
} else {
strcpy(Output,"................");
}
item.iSubItem = 1;
OldItem.iSubItem = 1;
ListView_GetItem(hList,&OldItem);
if ( strcmp( item.pszText, OldItem.pszText ) != 0 ) {
ListView_SetItem(hList,&item);
}
if (tlb[count].EntryDefined) {
sprintf(Output,"0x%08X",tlb[count].EntryHi.Value);
} else {
strcpy(Output,"................");
}
item.iSubItem = 2;
OldItem.iSubItem = 2;
ListView_GetItem(hList,&OldItem);
if ( strcmp( item.pszText, OldItem.pszText ) != 0 ) {
ListView_SetItem(hList,&item);
}
if (tlb[count].EntryDefined) {
sprintf(Output,"0x%08X",tlb[count].EntryLo0.Value);
} else {
strcpy(Output,"................");
}
item.iSubItem = 3;
OldItem.iSubItem = 3;
ListView_GetItem(hList,&OldItem);
if ( strcmp( item.pszText, OldItem.pszText ) != 0 ) {
ListView_SetItem(hList,&item);
}
if (tlb[count].EntryDefined) {
sprintf(Output,"0x%08X",tlb[count].EntryLo1.Value);
} else {
strcpy(Output,"................");
}
item.iSubItem = 4;
OldItem.iSubItem = 4;
ListView_GetItem(hList,&OldItem);
if ( strcmp( item.pszText, OldItem.pszText ) != 0 ) {
ListView_SetItem(hList,&item);
}
}
hList = GetDlgItem(TlbDlg,IDC_LIST2);
for (count = 0; count < 64; count ++) {
sprintf(Output,"0x%02X",count);
item.mask = LVIF_TEXT;
item.iItem = count;
item.pszText = Output;
item.iSubItem = 0;
OldItem.mask = LVIF_TEXT;
OldItem.iItem = count;
OldItem.pszText = OldText;
OldItem.cchTextMax = sizeof( OldText )-1;
OldItem.iSubItem = 0;
if (ListView_GetItemCount(hList) <= count) {
item.iItem = ListView_InsertItem(hList,&item);
} else {
ListView_GetItem(hList,&OldItem);
if ( strcmp( item.pszText, OldItem.pszText ) != 0 ) {
ListView_SetItem(hList,&item);
}
}
if (FastTlb[count].ValidEntry) {
sprintf(Output,"%s",FastTlb[count].VALID?"Yes":"No");
} else {
strcpy(Output,"................");
}
item.iSubItem = 1;
OldItem.iSubItem = 1;
ListView_GetItem(hList,&OldItem);
if ( strcmp( item.pszText, OldItem.pszText ) != 0 ) {
ListView_SetItem(hList,&item);
}
if (FastTlb[count].ValidEntry && FastTlb[count].VALID) {
sprintf(Output,"%s",FastTlb[count].DIRTY?"Yes":"No");
} else {
strcpy(Output,"................");
}
item.iSubItem = 2;
OldItem.iSubItem = 2;
ListView_GetItem(hList,&OldItem);
if ( strcmp( item.pszText, OldItem.pszText ) != 0 ) {
ListView_SetItem(hList,&item);
}
if (FastTlb[count].ValidEntry && FastTlb[count].VALID) {
sprintf(Output,"%08X:%08X -> %08X:%08X",FastTlb[count].VSTART,FastTlb[count].VEND,
FastTlb[count].PHYSSTART,FastTlb[count].VEND - FastTlb[count].VSTART + FastTlb[count].PHYSSTART);
} else {
strcpy(Output,"................");
}
item.iSubItem = 3;
OldItem.iSubItem = 3;
ListView_GetItem(hList,&OldItem);
if ( strcmp( item.pszText, OldItem.pszText ) != 0 ) {
ListView_SetItem(hList,&item);
}
}
}
void SetupTLBWindow (HWND hDlg) {
LV_COLUMN col;
DWORD X, Y;
col.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
col.fmt = LVCFMT_LEFT;
col.pszText = "Index";
col.cx = 40;
col.iSubItem = 0;
ListView_InsertColumn ( GetDlgItem(hDlg,IDC_LIST), 0, &col);
col.pszText = "Page Mask";
col.cx = 90;
col.iSubItem = 1;
ListView_InsertColumn ( GetDlgItem(hDlg,IDC_LIST), 1, &col);
col.pszText = "Entry Hi";
col.cx = 90;
col.iSubItem = 2;
ListView_InsertColumn ( GetDlgItem(hDlg,IDC_LIST), 2, &col);
col.pszText = "Entry Lo0";
col.cx = 90;
col.iSubItem = 3;
ListView_InsertColumn ( GetDlgItem(hDlg,IDC_LIST), 3, &col);
col.pszText = "Entry Lo1";
col.cx = 90;
col.iSubItem = 4;
ListView_InsertColumn ( GetDlgItem(hDlg,IDC_LIST), 4, &col);
col.pszText = "Index";
col.cx = 40;
col.iSubItem = 0;
ListView_InsertColumn ( GetDlgItem(hDlg,IDC_LIST2), 0, &col);
col.pszText = "Valid";
col.cx = 40;
col.iSubItem = 1;
ListView_InsertColumn ( GetDlgItem(hDlg,IDC_LIST2), 1, &col);
col.pszText = "Dirty";
col.cx = 40;
col.iSubItem = 2;
ListView_InsertColumn ( GetDlgItem(hDlg,IDC_LIST2), 2, &col);
col.pszText = "Rule";
col.cx = 280;
col.iSubItem = 3;
ListView_InsertColumn ( GetDlgItem(hDlg,IDC_LIST2), 3, &col);
RefreshTLBWindow();
SendMessage(GetDlgItem(hDlg,IDC_TLB_ENTRIES),BM_SETCHECK, BST_CHECKED,0);
if (GetStoredWinPos( "TLB Window", &X, &Y )) {
SetWindowPos(hDlg,NULL,X,Y,0,0, SWP_NOZORDER | SWP_NOSIZE | SWP_SHOWWINDOW);
}
}
LRESULT CALLBACK TLB_Proc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) {
switch (uMsg) {
case WM_INITDIALOG:
TlbDlg = hDlg;
SetupTLBWindow(hDlg);
break;
case WM_MOVE:
StoreCurrentWinPos("TLB Window",hDlg);
break;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_TLB_ENTRIES:
ShowWindow(GetDlgItem(hDlg,IDC_LIST),SW_SHOW);
ShowWindow(GetDlgItem(hDlg,IDC_LIST2),SW_HIDE);
break;
case IDC_TLB_RULES:
ShowWindow(GetDlgItem(hDlg,IDC_LIST),SW_HIDE);
ShowWindow(GetDlgItem(hDlg,IDC_LIST2),SW_SHOW);
break;
case IDCANCEL:
EndDialog( hDlg, IDCANCEL );
break;
}
break;
default:
return FALSE;
}
return TRUE;
}
#endif
#endif

View File

@ -1,108 +0,0 @@
/*
* Project 64 - A Nintendo 64 emulator.
*
* (c) Copyright 2001 zilmar (zilmar@emulation64.com) and
* Jabo (jabo@emulation64.com).
*
* pj64 homepage: www.pj64.net
*
* Permission to use, copy, modify and distribute Project64 in both binary and
* source form, for non-commercial purposes, is hereby granted without fee,
* providing that this license information and copyright notice appear with
* all copies and any derived work.
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event shall the authors be held liable for any damages
* arising from the use of this software.
*
* Project64 is freeware for PERSONAL USE only. Commercial users should
* seek permission of the copyright holders first. Commercial use includes
* charging money for Project64 or software derived from Project64.
*
* The copyright holders request that bug fixes and improvements to the code
* should be forwarded to them so if they want them.
*
*/
#ifdef todelete
typedef struct {
BOOL EntryDefined;
union {
unsigned long Value;
unsigned char A[4];
struct BreakDownPageMask{
unsigned zero : 13;
unsigned Mask : 12;
unsigned zero2 : 7;
} ;
} PageMask;
union {
unsigned long Value;
unsigned char A[4];
struct BreakDownEntryHi {
unsigned ASID : 8;
unsigned Zero : 4;
unsigned G : 1;
unsigned VPN2 : 19;
};
} EntryHi;
union {
unsigned long Value;
unsigned char A[4];
struct BreakDownEntryLo0{
unsigned GLOBAL: 1;
unsigned V : 1;
unsigned D : 1;
unsigned C : 3;
unsigned PFN : 20;
unsigned ZERO: 6;
} ;
} EntryLo0;
union {
unsigned long Value;
unsigned char A[4];
struct BreakDownEntryLo1{
unsigned GLOBAL: 1;
unsigned V : 1;
unsigned D : 1;
unsigned C : 3;
unsigned PFN : 20;
unsigned ZERO: 6;
} ;
} EntryLo1;
} TLB;
typedef struct {
DWORD VSTART;
DWORD VEND;
DWORD PHYSSTART;
DWORD PHYSEND;
BOOL VALID;
BOOL DIRTY;
BOOL GLOBAL;
BOOL ValidEntry;
} FASTTLB;
extern FASTTLB FastTlb[64];
extern TLB tlb[32];
BOOL AddressDefined ( DWORD VAddr);
void InitilizeTLB ( void );
void SetupTLB ( void );
void TLB_Probe ( void );
void TLB_Read ( void );
BOOL TranslateVaddr ( DWORD * Addr);
void _fastcall WriteTLBEntry ( int index );
#endif

View File

@ -1,366 +0,0 @@
/*
* Project 64 - A Nintendo 64 emulator.
*
* (c) Copyright 2001 zilmar (zilmar@emulation64.com) and
* Jabo (jabo@emulation64.com).
*
* pj64 homepage: www.pj64.net
*
* Permission to use, copy, modify and distribute Project64 in both binary and
* source form, for non-commercial purposes, is hereby granted without fee,
* providing that this license information and copyright notice appear with
* all copies and any derived work.
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event shall the authors be held liable for any damages
* arising from the use of this software.
*
* Project64 is freeware for PERSONAL USE only. Commercial users should
* seek permission of the copyright holders first. Commercial use includes
* charging money for Project64 or software derived from Project64.
*
* The copyright holders request that bug fixes and improvements to the code
* should be forwarded to them so if they want them.
*
*/
void __cdecl Refresh_Memory ( void ) {
}
#ifdef OLD_CODE
#if (!defined(EXTERNAL_RELEASE))
#include <windows.h>
#include <commctrl.h>
#include <stdio.h>
#include "main.h"
#include "CPU.h"
#include "debugger.h"
#include "resource.h"
#define IDC_VADDR 0x100
#define IDC_PADDR 0x101
#define IDC_LIST_VIEW 0x102
#define IDC_SCRL_BAR 0x103
void Setup_Memory_Window (HWND hDlg);
LRESULT CALLBACK Memory_Window_Proc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
static HWND Memory_Win_hDlg, hAddrEdit, hVAddr, hPAddr, hList, hScrlBar;
static int InMemoryWindow = FALSE;
void Create_Memory_Window ( int Child ) {
DWORD ThreadID;
if ( Child ) {
InMemoryWindow = TRUE;
DialogBox( hInst, "MEMORY", NULL,(DLGPROC) Memory_Window_Proc );
InMemoryWindow = FALSE;
} else {
if (!InMemoryWindow) {
CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)Create_Memory_Window,
(LPVOID)TRUE,0, &ThreadID);
} else {
SetForegroundWindow(Memory_Win_hDlg);
}
}
}
void __cdecl Enter_Memory_Window ( void ) {
if (!HaveDebugger) { return; }
Create_Memory_Window ( FALSE );
}
void Insert_MemoryLineDump (unsigned int location, int InsertPos) {
char Output[20], Hex[60], Ascii[20], HexAddOn[15], AsciiAddOn[15], OldText[100];
LV_ITEM item, OldItem;
int count;
MIPS_WORD word;
location = location << 4;
item.mask = LVIF_TEXT | LVIF_PARAM;
item.iItem = InsertPos;
item.lParam = location;
sprintf(Output,"0x%08X",location);
item.pszText = Output;
item.iSubItem = 0;
OldItem.mask = LVIF_TEXT | LVIF_PARAM;
OldItem.iItem = InsertPos;
OldItem.pszText = OldText;
OldItem.cchTextMax = sizeof( OldText )-1;
OldItem.iSubItem = 0;
if (ListView_GetItemCount(hList) <= InsertPos) {
ListView_InsertItem(hList,&item);
} else {
ListView_GetItem(hList,&OldItem);
if ( strcmp( item.pszText, OldItem.pszText ) != 0 ) {
ListView_SetItem(hList,&item);
}
}
sprintf(Hex,"\0"); sprintf(Ascii,"\0");
__try {
if ( SendMessage(hVAddr,BM_GETSTATE,0,0) & BST_CHECKED != 0 ) {
for (count = 0; count < 4; count ++) {
if (r4300i_LW_VAddr(location, &word.UW)) {
sprintf(HexAddOn,"%02X %02X %02X %02X",word.UB[3],
word.UB[2],word.UB[1],word.UB[0]);
sprintf(AsciiAddOn,"0x%08X",word.UW);
sprintf(AsciiAddOn,"%c%c%c%c",
word.UB[3]==0 ? ' ':word.UB[3],
word.UB[2]==0 ? ' ':word.UB[2],
word.UB[1]==0 ? ' ':word.UB[1],
word.UB[0]==0 ? ' ':word.UB[0]);
} else {
strcpy(HexAddOn,"** ** ** **");
strcpy(AsciiAddOn,"****");
}
if (count != 3) {
strcat(HexAddOn,"-");
}
strcat(Hex,HexAddOn);
strcat(Ascii,AsciiAddOn);
location += 4;
}
} else {
for (count = 0; count < 4; count ++) {
if (location < 0x1FFFFFFC) {
r4300i_LW_PAddr(location, &word.UW);
sprintf(HexAddOn,"%02X %02X %02X %02X",word.UB[3],
word.UB[2],word.UB[1],word.UB[0]);
sprintf(AsciiAddOn,"0x%08X",word.UW);
sprintf(AsciiAddOn,"%c%c%c%c",
word.UB[3]==0 ? ' ':word.UB[3],
word.UB[2]==0 ? ' ':word.UB[2],
word.UB[1]==0 ? ' ':word.UB[1],
word.UB[0]==0 ? ' ':word.UB[0]);
} else {
strcpy(HexAddOn,"** ** ** **");
strcpy(AsciiAddOn,"****");
}
if (count != 3) {
strcat(HexAddOn,"-");
}
strcat(Hex,HexAddOn);
strcat(Ascii,AsciiAddOn);
location += 4;
}
}
} __except( r4300i_Command_MemoryFilter( GetExceptionCode(), GetExceptionInformation()) ) {
DisplayError(GS(MSG_UNKNOWN_MEM_ACTION));
PostQuitMessage(0);
}
item.mask = LVIF_TEXT;
item.pszText = Hex;
item.iSubItem = 1;
OldItem.mask = LVIF_TEXT;
OldItem.iSubItem = 1;
ListView_GetItem(hList,&OldItem);
if ( strcmp( item.pszText, OldItem.pszText ) != 0 ) {
ListView_SetItem(hList,&item);
}
item.pszText = Ascii;
item.iSubItem = 2;
OldItem.iSubItem = 2;
ListView_GetItem(hList,&OldItem);
if ( strcmp( item.pszText, OldItem.pszText ) != 0 ) {
ListView_SetItem(hList,&item);
}
}
LRESULT CALLBACK Memory_Window_Proc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) {
PAINTSTRUCT ps;
RECT rcBox;
switch (uMsg) {
case WM_INITDIALOG:
Memory_Win_hDlg = hDlg;
Setup_Memory_Window ( hDlg );
break;
case WM_MOVE:
if (IsIconic(hDlg)) { break; }
StoreCurrentWinPos("Memory",hDlg);
break;
case WM_PAINT:
BeginPaint( hDlg, &ps );
SelectObject(ps.hdc, GetStockObject(ANSI_FIXED_FONT));
SetBkMode( ps.hdc, TRANSPARENT );
TextOut(ps.hdc,25,17,"Address:",8);
rcBox.left = 5;
rcBox.top = 5;
rcBox.right = 666;
rcBox.bottom = 310;
DrawEdge( ps.hdc, &rcBox, EDGE_RAISED, BF_RECT );
rcBox.left = 8;
rcBox.top = 8;
rcBox.right = 663;
rcBox.bottom = 307;
DrawEdge( ps.hdc, &rcBox, EDGE_ETCHED, BF_RECT );
EndPaint( hDlg, &ps );
return TRUE;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_ADDR_EDIT:
if (HIWORD(wParam) == EN_CHANGE ) {
Refresh_Memory();
}
break;
case IDC_VADDR:
case IDC_PADDR:
Refresh_Memory();
break;
case IDC_CLOSE_BUTTON:
case IDCANCEL:
EndDialog( hDlg, IDCANCEL );
break;
}
case WM_VSCROLL:
if ((HWND)lParam == hScrlBar) {
unsigned int location;
char Value[20];
GetWindowText(hAddrEdit,Value,sizeof(Value));
location = AsciiToHex(Value);
switch (LOWORD(wParam)) {
case SB_LINEDOWN:
if (location < 0xFFFFFFEF) {
sprintf(Value,"%08X",location + 0x10);
SetWindowText(hAddrEdit,Value);
} else {
sprintf(Value,"%08X",0xFFFFFFFF);
SetWindowText(hAddrEdit,Value);
}
break;
case SB_LINEUP:
if (location > 0x10 ) {
sprintf(Value,"%08X",location - 0x10);
SetWindowText(hAddrEdit,Value);
} else {
sprintf(Value,"%08X",0);
SetWindowText(hAddrEdit,Value);
}
break;
case SB_PAGEDOWN:
if (location < 0xFFFFFEFF) {
sprintf(Value,"%08X",location + 0x100);
SetWindowText(hAddrEdit,Value);
} else {
sprintf(Value,"%08X",0xFFFFFFFF);
SetWindowText(hAddrEdit,Value);
}
break;
case SB_PAGEUP:
if (location > 0x100 ) {
sprintf(Value,"%08X",location - 0x100);
SetWindowText(hAddrEdit,Value);
} else {
sprintf(Value,"%08X",0);
SetWindowText(hAddrEdit,Value);
}
break;
}
}
break;
default:
return FALSE;
}
return TRUE;
}
void __cdecl Refresh_Memory ( void ) {
DWORD location;
char Value[20];
int count;
if (InMemoryWindow == FALSE) { return; }
GetWindowText(hAddrEdit,Value,sizeof(Value));
location = (AsciiToHex(Value) >> 4);
if (location > 0x0FFFFFF0) { location = 0x0FFFFFF0; }
for (count = 0 ; count < 16;count ++ ){
Insert_MemoryLineDump ( count + location , count );
}
}
void Setup_Memory_Window (HWND hDlg) {
#define WindowWidth 683
#define WindowHeight 341
DWORD X, Y;
hVAddr = CreateWindowEx(0,"BUTTON", "Virtual Addressing", WS_CHILD | WS_VISIBLE |
BS_AUTORADIOBUTTON, 215,13,150,21,hDlg,(HMENU)IDC_VADDR,hInst,NULL );
SendMessage(hVAddr,BM_SETCHECK, BST_CHECKED,0);
hPAddr = CreateWindowEx(0,"BUTTON", "Physical Addressing", WS_CHILD | WS_VISIBLE |
BS_AUTORADIOBUTTON, 375,13,155,21,hDlg,(HMENU)IDC_PADDR,hInst,NULL );
hList = CreateWindowEx(WS_EX_CLIENTEDGE,WC_LISTVIEW, "", WS_CHILD | WS_VISIBLE |
/*LVS_OWNERDRAWFIXED | */ LVS_REPORT | LVS_NOSORTHEADER, 14,39,622,261,hDlg,
(HMENU)IDC_LIST_VIEW,hInst,NULL );
if (hList) {
LV_COLUMN col;
int count;
col.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
col.fmt = LVCFMT_LEFT;
col.pszText = "Address";
col.cx = 90;
col.iSubItem = 0;
ListView_InsertColumn ( hList, 0, &col);
col.pszText = "Memory Dump";
col.cx = 390;
col.iSubItem = 1;
ListView_InsertColumn ( hList, 1, &col);
col.cx = 140;
col.pszText = "Memory Ascii";
col.iSubItem = 2;
ListView_InsertColumn ( hList, 2, &col);
ListView_SetItemCount ( hList, 16);
SendMessage(hList,WM_SETFONT, (WPARAM)GetStockObject(ANSI_FIXED_FONT),0);
for (count = 0 ; count < 16;count ++ ){
Insert_MemoryLineDump (count,count);
}
}
SetWindowPos(GetDlgItem(hDlg,IDC_CLOSE_BUTTON),NULL, 560,13,90,21, SWP_NOZORDER |
SWP_SHOWWINDOW);
hAddrEdit = GetDlgItem(hDlg,IDC_ADDR_EDIT);
SetWindowText(hAddrEdit,"00000000");
SendMessage(hAddrEdit,EM_SETLIMITTEXT,(WPARAM)8,(LPARAM)0);
SetWindowPos(hAddrEdit,NULL, 100,13,100,21, SWP_NOZORDER | SWP_SHOWWINDOW);
SendMessage(hAddrEdit,WM_SETFONT, (WPARAM)GetStockObject(ANSI_FIXED_FONT),0);
hScrlBar = CreateWindowEx(WS_EX_STATICEDGE, "SCROLLBAR","", WS_CHILD | WS_VISIBLE |
WS_TABSTOP | SBS_VERT, 635,39,18,260, hDlg, (HMENU)IDC_SCRL_BAR, hInst, NULL );
if (hScrlBar) {
SCROLLINFO si;
si.cbSize = sizeof(si);
si.fMask = SIF_RANGE | SIF_POS | SIF_PAGE;
si.nMin = 0;
si.nMax = 300;
si.nPos = 145;
si.nPage = 10;
SetScrollInfo(hScrlBar,SB_CTL,&si,TRUE);
}
if ( !GetStoredWinPos( "Memory", &X, &Y ) ) {
X = (GetSystemMetrics( SM_CXSCREEN ) - WindowWidth) / 2;
Y = (GetSystemMetrics( SM_CYSCREEN ) - WindowHeight) / 2;
}
SetWindowPos(hDlg,NULL,X,Y,WindowWidth,WindowHeight, SWP_NOZORDER | SWP_SHOWWINDOW);
}
#endif
#endif

View File

@ -1,32 +0,0 @@
/*
* Project 64 - A Nintendo 64 emulator.
*
* (c) Copyright 2001 zilmar (zilmar@emulation64.com) and
* Jabo (jabo@emulation64.com).
*
* pj64 homepage: www.pj64.net
*
* Permission to use, copy, modify and distribute Project64 in both binary and
* source form, for non-commercial purposes, is hereby granted without fee,
* providing that this license information and copyright notice appear with
* all copies and any derived work.
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event shall the authors be held liable for any damages
* arising from the use of this software.
*
* Project64 is freeware for PERSONAL USE only. Commercial users should
* seek permission of the copyright holders first. Commercial use includes
* charging money for Project64 or software derived from Project64.
*
* The copyright holders request that bug fixes and improvements to the code
* should be forwarded to them so if they want them.
*
*/
#ifndef __r4300i_memory_h
#define __r4300i_memory_h
void __cdecl Enter_Memory_Window ( void );
void __cdecl Refresh_Memory ( void );
#endif

View File

@ -1,3 +1,5 @@
#include "stdafx.h"
/*
* Project 64 - A Nintendo 64 emulator.
*

View File

@ -1,27 +0,0 @@
/*
* Project 64 - A Nintendo 64 emulator.
*
* (c) Copyright 2001 zilmar (zilmar@emulation64.com) and
* Jabo (jabo@emulation64.com).
*
* pj64 homepage: www.pj64.net
*
* Permission to use, copy, modify and distribute Project64 in both binary and
* source form, for non-commercial purposes, is hereby granted without fee,
* providing that this license information and copyright notice appear with
* all copies and any derived work.
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event shall the authors be held liable for any damages
* arising from the use of this software.
*
* Project64 is freeware for PERSONAL USE only. Commercial users should
* seek permission of the copyright holders first. Commercial use includes
* charging money for Project64 or software derived from Project64.
*
* The copyright holders request that bug fixes and improvements to the code
* should be forwarded to them so if they want them.
*
*/
void Enter_TLB_Window ( void );
void RefreshTLBWindow ( void );

View File

@ -1,100 +0,0 @@
#ifdef tofix
/*
* Project 64 - A Nintendo 64 emulator.
*
* (c) Copyright 2001 zilmar (zilmar@emulation64.com) and
* Jabo (jabo@emulation64.com).
*
* pj64 homepage: www.pj64.net
*
* Permission to use, copy, modify and distribute Project64 in both binary and
* source form, for non-commercial purposes, is hereby granted without fee,
* providing that this license information and copyright notice appear with
* all copies and any derived work.
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event shall the authors be held liable for any damages
* arising from the use of this software.
*
* Project64 is freeware for PERSONAL USE only. Commercial users should
* seek permission of the copyright holders first. Commercial use includes
* charging money for Project64 or software derived from Project64.
*
* The copyright holders request that bug fixes and improvements to the code
* should be forwarded to them so if they want them.
*
*/
#include <windows.h>
#include <stdio.h>
#include "main.h"
#include "cpu.h"
#include "x86.h"
#include "debugger.h"
#define PUTDST8(dest,value) (*((BYTE *)(dest))=(BYTE)(value)); dest += 1;
#define PUTDST16(dest,value) (*((WORD *)(dest))=(WORD)(value)); dest += 2;
#define PUTDST32(dest,value) (*((DWORD *)(dest))=(DWORD)(value)); dest += 4;
#define fpu_Name(Reg) (Reg) == x86_ST0 ? "ST(0)" : (Reg) == x86_ST1 ? "ST(1)" :\
(Reg) == x86_ST2 ? "ST(2)" : (Reg) == x86_ST3 ? "ST(3)" :\
(Reg) == x86_ST4 ? "ST(4)" : (Reg) == x86_ST5 ? "ST(5)" :\
(Reg) == x86_ST6 ? "ST(6)" : (Reg) == x86_ST7 ? "ST(7)" :\
"Unknown x86fpu Register"
void fpuDivDwordReverse(void *Variable, const char * VariableName) {
CPU_Message(" fdivr ST(0), dword ptr [%s]", VariableName);
PUTDST16(RecompPos,0x3DD8);
PUTDST32(RecompPos,Variable);
}
void fpuDivQwordReverse(void *Variable, const char * VariableName) {
CPU_Message(" fdivr ST(0), qword ptr [%s]", VariableName);
PUTDST16(RecompPos,0x3DDC);
PUTDST32(RecompPos,Variable);
}
//
// FPU Utility
//
static unsigned int fpucontrol;
/* returns and pushes current fpu state, bool for set normal */
int fpuSaveControl(BOOL bSetNormal) {
_asm {
fnstcw word ptr [fpucontrol]
}
if (bSetNormal == TRUE) {
unsigned short fpunormal = fpucontrol & 0xF3FF;
_asm {
fldcw word ptr [fpunormal]
}
}
return fpucontrol;
}
/* returns and pops fpu state previously pushed */
int fpuRestoreControl() {
_asm {
fldcw word ptr [fpucontrol]
}
return fpucontrol;
}
void fpuSetupDouble(void) {
int temp = 0;
_asm {
fnstcw word ptr [temp]
or [temp], 0x300
and [temp], 0xFFFFF3FF
fldcw word ptr [temp]
}
}
#endif

View File

@ -1,3 +1,4 @@
#include "stdafx.h"
#include "Debugger UI.h"
CDumpMemory::CDumpMemory(CDebugger * debugger) :

View File

@ -1,3 +1,4 @@
#include "stdafx.h"
#include "Debugger UI.h"
CDebugMemorySearch::CDebugMemorySearch(CDebugger * debugger) :

View File

@ -1,3 +1,4 @@
#include "stdafx.h"
#include "Debugger UI.h"
CDebugTlb::CDebugTlb(CDebugger * debugger) :

View File

@ -1,3 +1,4 @@
#include "stdafx.h"
#include "Debugger UI.h"
CDebugMemoryView::CDebugMemoryView(CDebugger * debugger) :

View File

@ -1,8 +1,4 @@
#include <windows.h>
#include <INITGUID.H>
#include <ShlGuid.h>
#include "..\\..\\N64 System.h"
#include "stdafx.h"
#include "Debugger UI.h"
CPj64Module _Module;

View File

@ -239,7 +239,7 @@ void CInterpreterCPU::ExecuteCPU (void )
{
if (_MMU->LW_VAddr(PROGRAM_COUNTER, Opcode.Hex))
{
/*if (PROGRAM_COUNTER > 0x80323000 && PROGRAM_COUNTER< 0x80380000)
/*if (PROGRAM_COUNTER > 0x80000300 && PROGRAM_COUNTER< 0x80380000)
{
WriteTraceF((TraceType)(TraceError | TraceNoHeader),"%X: %s",*_PROGRAM_COUNTER,R4300iOpcodeName(Opcode.Hex,*_PROGRAM_COUNTER));
//WriteTraceF((TraceType)(TraceError | TraceNoHeader),"%X: %s t9: %08X v1: %08X",*_PROGRAM_COUNTER,R4300iOpcodeName(Opcode.Hex,*_PROGRAM_COUNTER),_GPR[0x19].UW[0],_GPR[0x03].UW[0]);
@ -308,6 +308,12 @@ void CInterpreterCPU::ExecuteOps ( int Cycles )
if (_MMU->LW_VAddr(PROGRAM_COUNTER, Opcode.Hex))
{
/*if (PROGRAM_COUNTER > 0x80000300 && PROGRAM_COUNTER< 0x80380000)
{
WriteTraceF((TraceType)(TraceError | TraceNoHeader),"%X: %s",*_PROGRAM_COUNTER,R4300iOpcodeName(Opcode.Hex,*_PROGRAM_COUNTER));
//WriteTraceF((TraceType)(TraceError | TraceNoHeader),"%X: %s t9: %08X v1: %08X",*_PROGRAM_COUNTER,R4300iOpcodeName(Opcode.Hex,*_PROGRAM_COUNTER),_GPR[0x19].UW[0],_GPR[0x03].UW[0]);
//WriteTraceF((TraceType)(TraceError | TraceNoHeader),"%X: %d %d",*_PROGRAM_COUNTER,*_NextTimer,_SystemTimer->CurrentType());
}*/
/*if (PROGRAM_COUNTER > 0x80323000 && PROGRAM_COUNTER< 0x80380000)
{
WriteTraceF((TraceType)(TraceError | TraceNoHeader),"%X: %s",*_PROGRAM_COUNTER,R4300iOpcodeName(Opcode.Hex,*_PROGRAM_COUNTER));

View File

@ -5,7 +5,8 @@ class CRSP_Plugin;
class CMipsMemoryVM :
public CMipsMemory,
public CTransVaddr,
private CRecompilerOps
private CRecompilerOps,
private R4300iOp
{
//Make sure plugins can directly access this information
friend CGfxPlugin;

File diff suppressed because it is too large Load Diff

View File

@ -152,7 +152,14 @@ void CSystemTimer::TimerDone (void)
_Reg->CheckInterrupts();
break;
case CSystemTimer::ViTimer:
RefreshScreen();
try
{
_N64System->RefreshScreen();
}
catch (...)
{
WriteTraceF(TraceError,"Exception caught in Refresh Screen\nFile: %s\nLine: %d",__FILE__,__LINE__);
}
_Reg->MI_INTR_REG |= MI_INTR_VI;
_Reg->CheckInterrupts();
break;

View File

@ -6,26 +6,18 @@
void InitializeCPUCore ( void )
{
LARGE_INTEGER PerformanceFrequency;
g_CurrentFrame = 0;
QueryPerformanceFrequency(&PerformanceFrequency);
g_Frequency = PerformanceFrequency.QuadPart;
switch (_Rom->GetCountry())
{
switch (_Rom->GetCountry())
{
case Germany: case french: case Italian:
case Europe: case Spanish: case Australia:
case X_PAL: case Y_PAL:
Timer_Initialize(50);
g_SystemType = SYSTEM_PAL;
break;
default:
Timer_Initialize(60);
g_SystemType = SYSTEM_NTSC;
break;
}
case Germany: case french: case Italian:
case Europe: case Spanish: case Australia:
case X_PAL: case Y_PAL:
Timer_Initialize(50);
g_SystemType = SYSTEM_PAL;
break;
default:
Timer_Initialize(60);
g_SystemType = SYSTEM_NTSC;
break;
}
#ifndef EXTERNAL_RELEASE
LogOptions.GenerateLog = g_GenerateLog;
@ -54,17 +46,6 @@ CN64System::CN64System ( CPlugins * Plugins, bool SavesReadOnly ) :
m_CPU_Handle(NULL),
m_CPU_ThreadID(0)
{
_Settings->RegisterChangeCB(Plugin_RSP_Current,this,(CSettings::SettingChangedFunc)PluginChanged);
_Settings->RegisterChangeCB(Plugin_GFX_Current,this,(CSettings::SettingChangedFunc)PluginChanged);
_Settings->RegisterChangeCB(Plugin_AUDIO_Current,this,(CSettings::SettingChangedFunc)PluginChanged);
_Settings->RegisterChangeCB(Plugin_CONT_Current,this,(CSettings::SettingChangedFunc)PluginChanged);
_Settings->RegisterChangeCB(Plugin_UseHleGfx,this,(CSettings::SettingChangedFunc)PluginChanged);
_Settings->RegisterChangeCB(Plugin_UseHleAudio,this,(CSettings::SettingChangedFunc)PluginChanged);
_Settings->RegisterChangeCB(Game_EditPlugin_Gfx,this,(CSettings::SettingChangedFunc)PluginChanged);
_Settings->RegisterChangeCB(Game_EditPlugin_Audio,this,(CSettings::SettingChangedFunc)PluginChanged);
_Settings->RegisterChangeCB(Game_EditPlugin_Contr,this,(CSettings::SettingChangedFunc)PluginChanged);
_Settings->RegisterChangeCB(Game_EditPlugin_RSP,this,(CSettings::SettingChangedFunc)PluginChanged);
//InterpreterOpcode = NULL;
m_hPauseEvent = CreateEvent(NULL,true,false,NULL);
@ -90,23 +71,6 @@ CN64System::CN64System ( CPlugins * Plugins, bool SavesReadOnly ) :
CN64System::~CN64System ( void ) {
}
void CN64System::PluginChanged ( CN64System * _this )
{
if (_Settings->LoadBool(GameRunning_LoadingInProgress))
{
return;
}
if (_Settings->LoadBool(GameRunning_CPU_Running) != 0) {
_this->ExternalEvent(SysEvent_ChangePlugins);
} else {
_this->Plugins()->Reset();
if (_Notify)
{
_Notify->RefreshMenu();
}
}
}
void CN64System::ExternalEvent ( SystemEvent action )
{
@ -247,7 +211,6 @@ bool CN64System::RunFileImage ( const char * FileLoc )
bool CN64System::EmulationStarting ( HANDLE hThread, DWORD ThreadId )
{
// _Plugins->Reset();
bool bRes = true;
if (_N64System)
@ -622,6 +585,7 @@ bool CN64System::SetActiveSystem( bool bActive )
_TransVaddr = &m_MMU_VM;
_SystemEvents = this;
_NextTimer = &m_NextTimer;
_Plugins = m_Plugins;
} else {
if (_N64System == this)
{
@ -637,6 +601,7 @@ bool CN64System::SetActiveSystem( bool bActive )
_TransVaddr = NULL;
_SystemEvents = NULL;
_NextTimer = NULL;
_Plugins = m_Plugins;
}
}
@ -826,11 +791,9 @@ void CN64System::ExecuteCPU ( void )
g_RomFileSize = _Rom->GetRomSize();
g_CicChip = _Rom->CicChipID();
g_CurrentFrame = 0;
CC_Core C_Core;
C_Core.SetSettings();
C_Core.SetSyncCpu(NULL);
switch ((CPU_TYPE)_Settings->LoadDword(Game_CpuType)) {
case CPU_Recompiler: ExecuteRecompiler(C_Core); break;
@ -843,6 +806,7 @@ void CN64System::ExecuteCPU ( void )
void CN64System::ExecuteInterpret (CC_Core & C_Core) {
InitializeCPUCore();
SetActiveSystem();
CInterpreterCPU::ExecuteCPU();
}
@ -851,6 +815,7 @@ void CN64System::ExecuteRecompiler (CC_Core & C_Core)
//execute opcodes while no errors
m_Recomp = new CRecompiler(m_Profile,m_EndEmulation);
InitializeCPUCore();
SetActiveSystem();
m_Recomp->Run();
}
@ -892,16 +857,6 @@ void CN64System::CpuStopped ( void ) {
m_hPauseEvent = NULL;
}
_Settings->UnregisterChangeCB(Plugin_RSP_Current,this,(CSettings::SettingChangedFunc)PluginChanged);
_Settings->UnregisterChangeCB(Plugin_GFX_Current,this,(CSettings::SettingChangedFunc)PluginChanged);
_Settings->UnregisterChangeCB(Plugin_AUDIO_Current,this,(CSettings::SettingChangedFunc)PluginChanged);
_Settings->UnregisterChangeCB(Plugin_CONT_Current,this,(CSettings::SettingChangedFunc)PluginChanged);
_Settings->UnregisterChangeCB(Plugin_UseHleGfx,this,(CSettings::SettingChangedFunc)PluginChanged);
_Settings->UnregisterChangeCB(Plugin_UseHleAudio,this,(CSettings::SettingChangedFunc)PluginChanged);
_Settings->UnregisterChangeCB(Game_EditPlugin_Gfx,this,(CSettings::SettingChangedFunc)PluginChanged);
_Settings->UnregisterChangeCB(Game_EditPlugin_Audio,this,(CSettings::SettingChangedFunc)PluginChanged);
_Settings->UnregisterChangeCB(Game_EditPlugin_Contr,this,(CSettings::SettingChangedFunc)PluginChanged);
_Settings->UnregisterChangeCB(Game_EditPlugin_RSP,this,(CSettings::SettingChangedFunc)PluginChanged);
_Notify->RefreshMenu();
_Notify->MakeWindowOnTop(false);
_Notify->DisplayMessage(5,MSG_EMULATION_ENDED);
@ -965,6 +920,9 @@ void CN64System::SyncCPU (CN64System * const SecondCPU) {
}
}
if (m_Reg.m_FPCR[0] != SecondCPU->m_Reg.m_FPCR[0]) { ErrorFound = true; }
if (m_Reg.m_FPCR[31] != SecondCPU->m_Reg.m_FPCR[31]) { ErrorFound = true; }
for (int z = 0; z < 0x100; z++)
{
if (m_MMU_VM.Rdram()[0x00325044 + z] != SecondCPU->m_MMU_VM.Rdram()[0x00325044 + z])
@ -984,6 +942,7 @@ void CN64System::SyncCPU (CN64System * const SecondCPU) {
#endif
}
if (m_Audio.AiGetLength() != SecondCPU->m_Audio.AiGetLength()) { ErrorFound = true; }
if (m_SystemTimer.CurrentType() != SecondCPU->m_SystemTimer.CurrentType()) { ErrorFound = true; }
if (m_NextTimer != SecondCPU->m_NextTimer) { ErrorFound = true; }
if (m_Reg.m_RoundingModel != SecondCPU->m_Reg.m_RoundingModel) { ErrorFound = true; }
@ -1033,10 +992,16 @@ void CN64System::DumpSyncErrors (CN64System * SecondCPU) {
SecondCPU->m_Reg.m_FPR[count].W[1],SecondCPU->m_Reg.m_FPR[count].W[0]);
}
}
for (count = 0; count < 32; count ++) {
if (m_Reg.m_FPCR[count] != SecondCPU->m_Reg.m_FPCR[count]) {
Error.LogF("FPCR[%s] Different,0x%08X, 0x%08X\r\n",CRegName::FPR_Ctrl[count],
m_Reg.m_FPCR[count], SecondCPU->m_Reg.m_FPCR[count]);
}
}
for (count = 0; count < 32; count ++) {
if (m_Reg.m_CP0[count] != SecondCPU->m_Reg.m_CP0[count]) {
Error.LogF("CP0[%s] Different,0x%08X, 0x%08X\r\n",CRegName::Cop0[count],
m_Reg.m_CP0[count], SecondCPU->m_Reg.m_CP0[count]);
m_Reg.m_CP0[count], SecondCPU->m_Reg.m_CP0[count]);
}
}
if (m_NextTimer != SecondCPU->m_NextTimer)

View File

@ -68,6 +68,7 @@ private:
//Recompiler has access to manipulate and call functions
friend CC_Core;
friend CSystemTimer;
//Used for loading and potentialy executing the CPU in its own thread.
static void stLoadFileImage ( FileImageInfo * Info );
@ -103,8 +104,6 @@ private:
void CpuStopped ( void );
void Pause ( void );
static void PluginChanged ( CN64System * _this );
//Function in CMipsMemory_CallBack
virtual bool WriteToProtectedMemory (DWORD Address, int length);

View File

@ -1,6 +1,4 @@
#include "..\N64 System.h"
#include <Windows.h>
#include "stdafx.h"
enum { MAX_FRAMES = 13 };

View File

@ -2,7 +2,7 @@ class CCodeBlock :
private CRecompilerOps
{
public:
CCodeBlock(DWORD VAddrEnter, BYTE * RecompPos);
CCodeBlock(DWORD VAddrEnter, BYTE * RecompPos, bool bDelaySlot );
bool Compile ( void );
@ -13,6 +13,7 @@ public:
inline int NoOfSections ( void ) const { return m_NoOfSections; }
inline const CCodeSection & EnterSection ( void ) const { return m_EnterSection; }
inline DWORD NextTest ( void ) const { return m_EnterSection.m_Test + 1; }
inline bool bDelaySlot ( void ) const { return m_bDelaySlot; }
inline void SetVAddrFirst ( DWORD VAddr ) { m_VAddrFirst = VAddr; }
inline void SetVAddrLast ( DWORD VAddr ) { m_VAddrLast = VAddr; }
@ -28,5 +29,6 @@ private:
DWORD m_VAddrLast; // the address of the first opcode in the block
BYTE * m_CompiledLocation; // What address is this compiled at
int m_NoOfSections; // The number of sections this block uses
bool m_bDelaySlot;
CCodeSection m_EnterSection;
};

View File

@ -82,6 +82,7 @@ CCodeSection::CCodeSection( CCodeBlock * CodeBlock, DWORD EnterPC, DWORD ID) :
m_JumpSection(NULL),
m_LinkAllowed(true),
m_CompiledLocation(NULL),
m_DelaySlotSection(CodeBlock? CodeBlock->bDelaySlot() : false),
m_Test(0)
{
/*
@ -329,8 +330,6 @@ void CCodeSection::GenerateSectionLinkage (void)
}
if ((CRecompilerOps::CompilePC() & 0xFFC) == 0xFFC) {
_Notify->BreakPoint(__FILE__,__LINE__);
#ifdef tofix
//Handle Fall througth
BYTE * Jump = NULL;
for (count = 0; count < 2; count ++) {
@ -344,7 +343,7 @@ void CCodeSection::GenerateSectionLinkage (void)
JumpInfo[count]->LinkLocation2 = NULL;
}
}
MoveConstToVariable(JumpInfo[count]->TargetPC,&JumpToLocation,"JumpToLocation");
PushImm32(stdstr_f("0x%08X",JumpInfo[count]->TargetPC).c_str(),JumpInfo[count]->TargetPC);
if (JumpInfo[(count + 1) & 1]->LinkLocation == NULL) { break; }
JmpLabel8("FinishBlock",0);
Jump = m_RecompPos - 1;
@ -360,7 +359,7 @@ void CCodeSection::GenerateSectionLinkage (void)
JumpInfo[count]->LinkLocation2 = NULL;
}
}
MoveConstToVariable(JumpInfo[count]->TargetPC,&JumpToLocation,"JumpToLocation");
PushImm32(stdstr_f("0x%08X",JumpInfo[count]->TargetPC).c_str(),JumpInfo[count]->TargetPC);
if (JumpInfo[(count + 1) & 1]->LinkLocation == NULL) { break; }
JmpLabel8("FinishBlock",0);
Jump = m_RecompPos - 1;
@ -369,31 +368,33 @@ void CCodeSection::GenerateSectionLinkage (void)
CPU_Message(" $FinishBlock:");
SetJump8(Jump,m_RecompPos);
}
MoveConstToVariable(CRecompilerOps::CompilePC() + 4,_PROGRAM_COUNTER,"PROGRAM_COUNTER");
//MoveConstToVariable(CRecompilerOps::CompilePC() + 4,_PROGRAM_COUNTER,"PROGRAM_COUNTER");
m_RegWorkingSet.WriteBackRegisters();
m_RegWorkingSet.UpdateCounters(&BlockCycleCount(),&BlockRandomModifier(),false);
UpdateCounters(m_RegWorkingSet,false,true);
// WriteBackRegisters(Section);
// if (_SyncSystem) { Call_Direct(SyncToPC, "SyncToPC"); }
MoveConstToVariable(DELAY_SLOT,&NextInstruction,"NextInstruction");
// MoveConstToVariable(DELAY_SLOT,&NextInstruction,"NextInstruction");
PushImm32(stdstr_f("0x%08X",CRecompilerOps::CompilePC() + 4).c_str(),CRecompilerOps::CompilePC() + 4);
// check if there is an existing section
MoveConstToX86reg((DWORD)_Recompiler,x86_ECX);
Call_Direct(AddressOf(CRecompiler::CompileDelaySlot), "CRecompiler::CompileDelaySlot");
JmpDirectReg(x86_EAX);
ExitCodeBlock();
#endif
return;
}
if (!g_UseLinking) {
if (CRecompilerOps::m_CompilePC == m_Jump.TargetPC && (m_Cont.FallThrough == false)) {
if (!DelaySlotEffectsJump(CRecompilerOps::CompilePC())) {
CPU_Message("PermLoop *** a");
_Notify->BreakPoint(__FILE__,__LINE__);
#ifdef tofix
MoveConstToVariable(CRecompilerOps::CompilePC(),_PROGRAM_COUNTER,"PROGRAM_COUNTER");
m_RegWorkingSet.WriteBackRegisters();
m_RegWorkingSet.BlockCycleCount() -= g_CountPerOp;
UpdateCounters(&m_RegWorkingSet.BlockCycleCount(),&m_RegWorkingSet.BlockRandomModifier(), false);
m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() - g_CountPerOp) ;
UpdateCounters(m_RegWorkingSet,false, true);
Call_Direct(InPermLoop,"InPermLoop");
m_RegWorkingSet.BlockCycleCount() += g_CountPerOp;
UpdateCounters(&m_RegWorkingSet.BlockCycleCount(),&m_RegWorkingSet.BlockRandomModifier(), true);
m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() + g_CountPerOp) ;
UpdateCounters(m_RegWorkingSet,true,true);
CompileSystemCheck(-1,m_RegWorkingSet);
#endif
}
}
}
@ -650,7 +651,7 @@ bool CCodeSection::GenerateX86Code ( DWORD Test )
m_RegWorkingSet = m_RegEnter;
m_CompiledLocation = m_RecompPos;
m_CompilePC = m_EnterPC;
m_NextInstruction = NORMAL;
m_NextInstruction = m_DelaySlotSection ? END_BLOCK : NORMAL;
m_RegWorkingSet = m_RegEnter;
m_Section = this;
@ -675,22 +676,26 @@ bool CCodeSection::GenerateX86Code ( DWORD Test )
{
m_BlockInfo->SetVAddrLast(m_CompilePC);
}
/*if (m_CompilePC == 0x80194A40)
{
// m_RegWorkingSet.UnMap_AllFPRs();
}*/
/*if (m_CompilePC >= 0x802CF644 && m_CompilePC <= 0x802CF650 && m_NextInstruction == NORMAL)
{
m_RegWorkingSet.WriteBackRegisters();
UpdateCounters(m_RegWorkingSet,false,true);
MoveConstToVariable(m_CompilePC,&_Reg->m_PROGRAM_COUNTER,"PROGRAM_COUNTER");
if (_SyncSystem) { Call_Direct(SyncToPC, "SyncToPC"); }
}*/
/*if (m_CompilePC >= 0x803259A0 && m_CompilePC < 0x803259D8 && m_NextInstruction == NORMAL)
/*if (m_CompilePC == 0x803254F0 && m_NextInstruction == NORMAL)
{
m_RegWorkingSet.WriteBackRegisters();
UpdateCounters(m_RegWorkingSet,false,true);
MoveConstToVariable(m_CompilePC,&_Reg->m_PROGRAM_COUNTER,"PROGRAM_COUNTER");
if (_SyncSystem) { Call_Direct(SyncToPC, "SyncToPC"); }
}
if (m_CompilePC == 0x803259AC && m_NextInstruction == NORMAL)
{
m_RegWorkingSet.WriteBackRegisters();
UpdateCounters(m_RegWorkingSet,false,true);
MoveConstToVariable(m_CompilePC,&_Reg->m_PROGRAM_COUNTER,"PROGRAM_COUNTER");
if (_SyncSystem) { Call_Direct(SyncToPC, "SyncToPC"); }
}
if (m_CompilePC == 0x803259C0)
}*/
/*if (m_CompilePC == 0x803254F0 && m_NextInstruction == NORMAL)
{
X86BreakPoint(__FILE__,__LINE__);
}*/
@ -933,46 +938,24 @@ bool CCodeSection::GenerateX86Code ( DWORD Test )
UnknownOpcode(); break;
}
#ifdef tofix
if (!bRegCaching()) { WriteBackRegisters(); }
/*if ((DWORD)RecompPos > 0x60B452E6) {
if (m_CompilePC == 0x8002D9B8 && m_CompilePC < 0x8002DA20) {
CurrentRoundingModel = RoundUnknown;
}
}*/
UnMap_AllFPRs();
/*if ((DWORD)RecompPos > 0x60AD0BD3) {
if (m_CompilePC >= 0x8008B804 && m_CompilePC < 0x800496D8) {
CPU_Message("Blah *");
WriteBackRegisters();
}
/*if (m_CompilePC >= 0x80000180 && m_CompilePC < 0x80000190) {
CPU_Message("Blah *");
//WriteBackRegisters();
}*/
//}
/*for (count = 1; count < 10; count ++) {
if (x86Mapped(count) == CRegInfo::Stack_Mapped) {
UnMap_X86reg (Section, count);
}
}*/
//CPU_Message("MemoryStack = %s",Map_MemoryStack(Section, false) > 0?x86_Name(Map_MemoryStack(Section, false)):"Not Mapped");
if ((m_CompilePC &0xFFC) == 0xFFC) {
if (NextInstruction == DO_DELAY_SLOT) {
#ifndef EXTERNAL_RELEASE
DisplayError("Wanting to do delay slot over end of block");
#endif
if ((m_CompilePC &0xFFC) == 0xFFC)
{
if (m_NextInstruction == DO_DELAY_SLOT)
{
DisplayError("Wanting to do delay slot over end of block");
}
if (NextInstruction == NORMAL) {
CompileExit (Section,m_CompilePC, m_CompilePC + 4,m_RegWorkingSet,CExitInfo::Normal,true,NULL);
NextInstruction = END_BLOCK;
if (m_NextInstruction == NORMAL) {
CompileExit (m_CompilePC, m_CompilePC + 4,m_RegWorkingSet,CExitInfo::Normal,true,NULL);
m_NextInstruction = END_BLOCK;
}
}
#ifdef tofix
if (DelaySlotSection)
{
Cont.RegSet = m_RegWorkingSet;
@ -997,5 +980,9 @@ bool CCodeSection::GenerateX86Code ( DWORD Test )
}
} while (m_NextInstruction != END_BLOCK);
if (m_DelaySlotSection)
{
CompileExit (m_CompilePC, -1,m_RegWorkingSet,CExitInfo::Normal,true,NULL);
}
return true;
}

View File

@ -24,12 +24,11 @@ public:
bool m_LinkAllowed; // are other sections allowed to find block to link to it
DWORD m_Test;
BYTE * m_CompiledLocation;
bool m_DelaySlotSection;
/* SECTION_LIST ParentSection;
DWORD Test2;
bool InLoop;
bool DelaySlotSection;
/* Register Info */
@ -39,54 +38,6 @@ public:
CJumpInfo m_Jump;
CJumpInfo m_Cont;
//Information about the opcode current being compiled
/* DWORD m_CompilePC;
OPCODE m_CompileOpcode;
void AddParent ( CCodeSection * Parent );
void UnlinkParent ( CCodeSection * Parent, bool AllowDelete, bool ContinueLink );
bool IsAllParentLoops ( CCodeSection * Parent, bool IgnoreIfCompiled, DWORD Test );
void ResetX86Protection ( void );
static DWORD GetNewTestValue ( void );
static void TestRegConstantStates ( CRegInfo & Base, CRegInfo & Reg );
//Handy Functions
inline CRegInfo::REG_STATE & MipsRegState ( int Reg ) { return RegWorking.MipsRegState(Reg); }
inline unsigned _int64 & MipsReg ( int Reg ) { return RegWorking.MipsReg(Reg); }
inline _int64 & MipsReg_S ( int Reg ) { return RegWorking.MipsReg_S(Reg); }
inline DWORD & MipsRegLo ( int Reg ) { return RegWorking.MipsRegLo(Reg); }
inline long & MipsRegLo_S ( int Reg ) { return RegWorking.MipsRegLo_S(Reg); }
inline DWORD & MipsRegHi ( int Reg ) { return RegWorking.MipsRegHi(Reg); }
inline long & MipsRegHi_S ( int Reg ) { return RegWorking.MipsRegHi_S(Reg); }
inline DWORD & BlockCycleCount(void) { return RegWorking.BlockCycleCount(); }
inline DWORD & BlockRandomModifier(void) { return RegWorking.BlockRandomModifier(); }
inline DWORD & x86MapOrder( int Reg ) { return RegWorking.x86MapOrder(Reg); }
inline bool & x86Protected( int Reg ) { return RegWorking.x86Protected(Reg); }
inline CRegInfo::REG_MAPPED & x86Mapped(int Reg) { return RegWorking.x86Mapped(Reg); }
inline bool IsKnown(int Reg) { return RegWorking.IsKnown(Reg); }
inline bool IsUnknown(int Reg) { return RegWorking.IsUnknown(Reg); }
inline bool IsMapped(int Reg) { return RegWorking.IsMapped(Reg); }
inline bool IsConst(int Reg) { return RegWorking.IsConst(Reg); }
inline bool IsSigned(int Reg) { return RegWorking.IsSigned(Reg); }
inline bool IsUnsigned(int Reg) { return RegWorking.IsUnsigned(Reg); }
inline bool Is32Bit(int Reg) { return RegWorking.Is32Bit(Reg); }
inline bool Is64Bit(int Reg) { return RegWorking.Is64Bit(Reg); }
inline bool Is32BitMapped(int Reg) { return RegWorking.Is32BitMapped(Reg); }
inline bool Is64BitMapped(int Reg) { return RegWorking.Is64BitMapped(Reg); }
inline int & StackTopPos ( void ) { return RegWorking.StackTopPos(); }
inline DWORD & FpuMappedTo( int Reg) { return RegWorking.FpuMappedTo(Reg); }
inline CRegInfo::FPU_STATE & FpuState(int Reg) { return RegWorking.FpuState(Reg); }
inline CRegInfo::FPU_ROUND & FpuRoundingModel(int Reg) { return RegWorking.FpuRoundingModel(Reg); }
inline bool & FpuBeenUsed (void ) { return RegWorking.FpuBeenUsed(); }
inline CRegInfo::FPU_ROUND & CurrentRoundingModel ( void ) { return RegWorking.CurrentRoundingModel(); }*/
private:

View File

@ -1,7 +1,8 @@
#include "stdafx.h"
CFunctionMap::CFunctionMap() :
m_FunctionTable(NULL)
m_FunctionTable(NULL),
m_DelaySlotTable(NULL)
{
}
@ -19,6 +20,11 @@ CFunctionMap::~CFunctionMap()
VirtualFree( m_FunctionTable, 0 , MEM_RELEASE);
m_FunctionTable = NULL;
}
if (m_DelaySlotTable)
{
VirtualFree( m_DelaySlotTable, 0 , MEM_RELEASE);
m_DelaySlotTable = NULL;
}
}
bool CFunctionMap::AllocateMemory()
@ -32,6 +38,15 @@ bool CFunctionMap::AllocateMemory()
}
memset(m_FunctionTable,0,0xFFFFF * sizeof(CCompiledFunc *));
}
if (m_DelaySlotTable == NULL)
{
m_DelaySlotTable = (BYTE **)VirtualAlloc(NULL,0xFFFFF * sizeof(BYTE *),MEM_RESERVE|MEM_COMMIT,PAGE_READWRITE);
if (m_DelaySlotTable == NULL) {
_Notify->FatalError(MSG_MEM_ALLOC_ERROR);
return false;
}
memset(m_DelaySlotTable,0,0xFFFFF * sizeof(BYTE *));
}
return true;
}

View File

@ -10,40 +10,5 @@ protected:
bool AllocateMemory ( void );
PCCompiledFunc_TABLE * m_FunctionTable;
/*public:
typedef CCompiledFunc * PCCompiledFunc;
typedef PCCompiledFunc * PCCompiledFunc_TABLE;
private:
void Reset ( bool AllocateMemory );
PCCompiledFunc_TABLE * m_FunctionTable;
public:
CFunctionMap ( void );
~CFunctionMap ( void );
CCompiledFunc * AddFunctionInfo ( DWORD vAddr, DWORD pAddr );
CCompiledFunc * FindFunction ( DWORD vAddr, int Length );
static void * __fastcall CFunctionMap::CompilerFindFunction( CFunctionMap * _this, DWORD vAddr );
inline CCompiledFunc * CFunctionMap::FindFunction( DWORD vAddr ) const
{
PCCompiledFunc_TABLE table = m_FunctionTable[vAddr >> 0xC];
if (table)
{
PCCompiledFunc & info = table[(vAddr & 0xFFF) >> 2];
if (info != NULL)
{
return info;
}
}
return NULL;
}
PCCompiledFunc_TABLE * GetFunctionTable ( void ) { return m_FunctionTable; }
inline void Reset (void) { Reset(true); }
void Remove (CCompiledFunc * info);*/
BYTE ** m_DelaySlotTable;
};

View File

@ -528,210 +528,33 @@ void CRecompiler::ResetRecompCode()
*/
}
CCompiledFunc * CRecompiler::CompileDelaySlot(DWORD PC)
BYTE * CRecompiler::CompileDelaySlot(DWORD PC)
{
int Index = PC >> 0xC;
BYTE * delayFunc = m_DelaySlotTable[Index];
if (delayFunc)
{
return delayFunc;
}
WriteTraceF(TraceRecompiler,"Compile Delay Slot: %X",PC);
_Notify->BreakPoint(__FILE__,__LINE__);
#ifdef tofix
if ((PC & 0xFFC) != 0) {
DisplayError("Why are you compiling the Delay Slot at %X",PC);
return NULL;
}
if (!_MMU->LW_VAddr(PC, g_Opcode.Hex)) {
DisplayError("TLB Miss in delay slot\nEmulation will know stop");
return NULL;
}
CheckRecompMem();
CCompiledFunc * info = m_FunctionsDelaySlot.AddFunctionInfo(PC, _TLB->TranslateVaddr(PC));
CCodeBlock BlockInfo(PROGRAM_COUNTER, RecompPos());
CCodeSection * Section = &BlockInfo.ParentSection;
BYTE * Block = RecompPos();
DWORD StartAddress;
if (!TranslateVaddr(PC, &StartAddress))
CCodeBlock CodeBlock(PC, RecompPos(), true);
if (!CodeBlock.Compile())
{
return NULL;
}
if (StartAddress < RdramSize()) {
CPU_Message("====== RDRAM: Delay Slot ======");
} else if (StartAddress >= 0x04000000 && StartAddress <= 0x04000FFC) {
CPU_Message("====== DMEM: Delay Slot ======");
} else if (StartAddress >= 0x04001000 && StartAddress <= 0x04001FFC) {
CPU_Message("====== IMEM: Delay Slot ======");
} else if (StartAddress >= 0x1FC00000 && StartAddress <= 0x1FC00800) {
CPU_Message("====== PIF ROM: Delay Slot ======");
} else {
CPU_Message("====== Unknown: Delay Slot ======");
}
CPU_Message("x86 code at: %X",Block);
CPU_Message("Delay Slot location: %X",PROGRAM_COUNTER );
CPU_Message("====== recompiled code ======");
Section->AddParent(NULL);
Section->BlockCycleCount() += CountPerOp();
Section->BlockRandomModifier() += 1;
switch (Opcode.op) {
case R4300i_SPECIAL:
switch (Opcode.funct) {
case R4300i_SPECIAL_SLL: Compile_R4300i_SPECIAL_SLL(Section); break;
case R4300i_SPECIAL_SRL: Compile_R4300i_SPECIAL_SRL(Section); break;
case R4300i_SPECIAL_SRA: Compile_R4300i_SPECIAL_SRA(Section); break;
case R4300i_SPECIAL_SLLV: Compile_R4300i_SPECIAL_SLLV(Section); break;
case R4300i_SPECIAL_SRLV: Compile_R4300i_SPECIAL_SRLV(Section); break;
case R4300i_SPECIAL_SRAV: Compile_R4300i_SPECIAL_SRAV(Section); break;
case R4300i_SPECIAL_MFLO: Compile_R4300i_SPECIAL_MFLO(Section); break;
case R4300i_SPECIAL_MTLO: Compile_R4300i_SPECIAL_MTLO(Section); break;
case R4300i_SPECIAL_MFHI: Compile_R4300i_SPECIAL_MFHI(Section); break;
case R4300i_SPECIAL_MTHI: Compile_R4300i_SPECIAL_MTHI(Section); break;
case R4300i_SPECIAL_MULT: Compile_R4300i_SPECIAL_MULT(Section); break;
case R4300i_SPECIAL_DIV: Compile_R4300i_SPECIAL_DIV(Section); break;
case R4300i_SPECIAL_DIVU: Compile_R4300i_SPECIAL_DIVU(Section); break;
case R4300i_SPECIAL_MULTU: Compile_R4300i_SPECIAL_MULTU(Section); break;
case R4300i_SPECIAL_DMULTU: Compile_R4300i_SPECIAL_DMULTU(Section); break;
case R4300i_SPECIAL_DDIVU: Compile_R4300i_SPECIAL_DDIVU(Section); break;
case R4300i_SPECIAL_ADD: Compile_R4300i_SPECIAL_ADD(Section); break;
case R4300i_SPECIAL_ADDU: Compile_R4300i_SPECIAL_ADDU(Section); break;
case R4300i_SPECIAL_SUB: Compile_R4300i_SPECIAL_SUB(Section); break;
case R4300i_SPECIAL_SUBU: Compile_R4300i_SPECIAL_SUBU(Section); break;
case R4300i_SPECIAL_AND: Compile_R4300i_SPECIAL_AND(Section); break;
case R4300i_SPECIAL_OR: Compile_R4300i_SPECIAL_OR(Section); break;
case R4300i_SPECIAL_XOR: Compile_R4300i_SPECIAL_XOR(Section); break;
case R4300i_SPECIAL_SLT: Compile_R4300i_SPECIAL_SLT(Section); break;
case R4300i_SPECIAL_SLTU: Compile_R4300i_SPECIAL_SLTU(Section); break;
case R4300i_SPECIAL_DADD: Compile_R4300i_SPECIAL_DADD(Section); break;
case R4300i_SPECIAL_DADDU: Compile_R4300i_SPECIAL_DADDU(Section); break;
case R4300i_SPECIAL_DSLL32: Compile_R4300i_SPECIAL_DSLL32(Section); break;
case R4300i_SPECIAL_DSRA32: Compile_R4300i_SPECIAL_DSRA32(Section); break;
default:
Compile_R4300i_UnknownOpcode(Section); break;
}
break;
case R4300i_ADDI: Compile_R4300i_ADDI(Section); break;
case R4300i_ADDIU: Compile_R4300i_ADDIU(Section); break;
case R4300i_SLTI: Compile_R4300i_SLTI(Section); break;
case R4300i_SLTIU: Compile_R4300i_SLTIU(Section); break;
case R4300i_ANDI: Compile_R4300i_ANDI(Section); break;
case R4300i_ORI: Compile_R4300i_ORI(Section); break;
case R4300i_XORI: Compile_R4300i_XORI(Section); break;
case R4300i_LUI: Compile_R4300i_LUI(Section); break;
case R4300i_CP1:
switch (Opcode.rs) {
case R4300i_COP1_CF: Compile_R4300i_COP1_CF(Section); break;
case R4300i_COP1_MT: Compile_R4300i_COP1_MT(Section); break;
case R4300i_COP1_CT: Compile_R4300i_COP1_CT(Section); break;
case R4300i_COP1_MF: Compile_R4300i_COP1_MF(Section); break;
case R4300i_COP1_S:
switch (Opcode.funct) {
case R4300i_COP1_FUNCT_ADD: Compile_R4300i_COP1_S_ADD(Section); break;
case R4300i_COP1_FUNCT_SUB: Compile_R4300i_COP1_S_SUB(Section); break;
case R4300i_COP1_FUNCT_MUL: Compile_R4300i_COP1_S_MUL(Section); break;
case R4300i_COP1_FUNCT_DIV: Compile_R4300i_COP1_S_DIV(Section); break;
case R4300i_COP1_FUNCT_ABS: Compile_R4300i_COP1_S_ABS(Section); break;
case R4300i_COP1_FUNCT_NEG: Compile_R4300i_COP1_S_NEG(Section); break;
case R4300i_COP1_FUNCT_SQRT: Compile_R4300i_COP1_S_SQRT(Section); break;
case R4300i_COP1_FUNCT_MOV: Compile_R4300i_COP1_S_MOV(Section); break;
case R4300i_COP1_FUNCT_CVT_D: Compile_R4300i_COP1_S_CVT_D(Section); break;
case R4300i_COP1_FUNCT_ROUND_W: Compile_R4300i_COP1_S_ROUND_W(Section); break;
case R4300i_COP1_FUNCT_TRUNC_W: Compile_R4300i_COP1_S_TRUNC_W(Section); break;
case R4300i_COP1_FUNCT_FLOOR_W: Compile_R4300i_COP1_S_FLOOR_W(Section); break;
case R4300i_COP1_FUNCT_C_F: case R4300i_COP1_FUNCT_C_UN:
case R4300i_COP1_FUNCT_C_EQ: case R4300i_COP1_FUNCT_C_UEQ:
case R4300i_COP1_FUNCT_C_OLT: case R4300i_COP1_FUNCT_C_ULT:
case R4300i_COP1_FUNCT_C_OLE: case R4300i_COP1_FUNCT_C_ULE:
case R4300i_COP1_FUNCT_C_SF: case R4300i_COP1_FUNCT_C_NGLE:
case R4300i_COP1_FUNCT_C_SEQ: case R4300i_COP1_FUNCT_C_NGL:
case R4300i_COP1_FUNCT_C_LT: case R4300i_COP1_FUNCT_C_NGE:
case R4300i_COP1_FUNCT_C_LE: case R4300i_COP1_FUNCT_C_NGT:
Compile_R4300i_COP1_S_CMP(Section); break;
default:
Compile_R4300i_UnknownOpcode(Section); break;
}
break;
case R4300i_COP1_D:
switch (Opcode.funct) {
case R4300i_COP1_FUNCT_ADD: Compile_R4300i_COP1_D_ADD(Section); break;
case R4300i_COP1_FUNCT_SUB: Compile_R4300i_COP1_D_SUB(Section); break;
case R4300i_COP1_FUNCT_MUL: Compile_R4300i_COP1_D_MUL(Section); break;
case R4300i_COP1_FUNCT_DIV: Compile_R4300i_COP1_D_DIV(Section); break;
case R4300i_COP1_FUNCT_ABS: Compile_R4300i_COP1_D_ABS(Section); break;
case R4300i_COP1_FUNCT_NEG: Compile_R4300i_COP1_D_NEG(Section); break;
case R4300i_COP1_FUNCT_SQRT: Compile_R4300i_COP1_D_SQRT(Section); break;
case R4300i_COP1_FUNCT_MOV: Compile_R4300i_COP1_D_MOV(Section); break;
case R4300i_COP1_FUNCT_TRUNC_W: Compile_R4300i_COP1_D_TRUNC_W(Section); break;
case R4300i_COP1_FUNCT_CVT_S: Compile_R4300i_COP1_D_CVT_S(Section); break;
case R4300i_COP1_FUNCT_CVT_W: Compile_R4300i_COP1_D_CVT_W(Section); break;
case R4300i_COP1_FUNCT_C_F: case R4300i_COP1_FUNCT_C_UN:
case R4300i_COP1_FUNCT_C_EQ: case R4300i_COP1_FUNCT_C_UEQ:
case R4300i_COP1_FUNCT_C_OLT: case R4300i_COP1_FUNCT_C_ULT:
case R4300i_COP1_FUNCT_C_OLE: case R4300i_COP1_FUNCT_C_ULE:
case R4300i_COP1_FUNCT_C_SF: case R4300i_COP1_FUNCT_C_NGLE:
case R4300i_COP1_FUNCT_C_SEQ: case R4300i_COP1_FUNCT_C_NGL:
case R4300i_COP1_FUNCT_C_LT: case R4300i_COP1_FUNCT_C_NGE:
case R4300i_COP1_FUNCT_C_LE: case R4300i_COP1_FUNCT_C_NGT:
Compile_R4300i_COP1_D_CMP(Section); break;
default:
Compile_R4300i_UnknownOpcode(Section); break;
}
break;
case R4300i_COP1_W:
switch (Opcode.funct) {
case R4300i_COP1_FUNCT_CVT_S: Compile_R4300i_COP1_W_CVT_S(Section); break;
case R4300i_COP1_FUNCT_CVT_D: Compile_R4300i_COP1_W_CVT_D(Section); break;
default:
Compile_R4300i_UnknownOpcode(Section); break;
}
break;
default:
Compile_R4300i_UnknownOpcode(Section); break;
}
break;
case R4300i_LB: Compile_R4300i_LB(Section); break;
case R4300i_LH: Compile_R4300i_LH(Section); break;
case R4300i_LW: Compile_R4300i_LW(Section); break;
case R4300i_LBU: Compile_R4300i_LBU(Section); break;
case R4300i_LHU: Compile_R4300i_LHU(Section); break;
case R4300i_SB: Compile_R4300i_SB(Section); break;
case R4300i_SH: Compile_R4300i_SH(Section); break;
case R4300i_SW: Compile_R4300i_SW(Section); break;
case R4300i_SWR: Compile_R4300i_SWR(Section); break;
case R4300i_CACHE: Compile_R4300i_CACHE(Section); break;
case R4300i_LWC1: Compile_R4300i_LWC1(Section); break;
case R4300i_LDC1: Compile_R4300i_LDC1(Section); break;
case R4300i_LD: Compile_R4300i_LD(Section); break;
case R4300i_SWC1: Compile_R4300i_SWC1(Section); break;
case R4300i_SDC1: Compile_R4300i_SDC1(Section); break;
case R4300i_SD: Compile_R4300i_SD(Section); break;
default:
Compile_R4300i_UnknownOpcode(Section); break;
}
Section->ResetX86Protection();
WriteBackRegisters(Section);
UpdateCounters(&Section->BlockCycleCount(),&Section->BlockRandomModifier(), FALSE);
int x86Reg = Map_TempReg(Section,x86_Any,-1,FALSE);
MoveVariableToX86reg(&JumpToLocation,"JumpToLocation",x86Reg);
MoveX86regToVariable(x86Reg,&PROGRAM_COUNTER,"PROGRAM_COUNTER");
MoveConstToVariable(NORMAL,&NextInstruction,"NextInstruction");
if (CPU_Type == CPU_SyncCores) { Call_Direct(SyncToPC, "SyncToPC"); }
ExitCodeBlock();
CompileExitCode(BlockInfo);
CPU_Message("====== End of recompiled code ======");
info->SetVEndPC(BlockInfo.EndVAddr);
info->SetFunctionAddr(BlockInfo.CompiledLocation);
_TLB->VAddrToRealAddr(info->VStartPC(),*(reinterpret_cast<void **>(&info->MemLocation[0])));
info->MemLocation[1] = info->MemLocation[0] + 1;
info->MemContents[0] = *info->MemLocation[0];
info->MemContents[1] = *info->MemLocation[1];
NextInstruction = NORMAL;
return info;
#endif
return NULL;
CCompiledFunc * Func = new CCompiledFunc(CodeBlock);
delayFunc = (BYTE *)Func->Function();
m_DelaySlotTable[Index] = delayFunc;
return delayFunc;
}
bool CRecompiler::AnalyseBlock ( CCodeBlock & BlockInfo)
@ -2014,7 +1837,7 @@ CCompiledFunc * CRecompiler::CompilerCode ( void )
WriteTraceF(TraceRecompiler,"Compile Block-Start: Program Counter: %X pAddr: %X",*_PROGRAM_COUNTER,pAddr);
CCodeBlock CodeBlock(*_PROGRAM_COUNTER, RecompPos());
CCodeBlock CodeBlock(*_PROGRAM_COUNTER, RecompPos(),false);
if (!CodeBlock.Compile())
{
return NULL;

View File

@ -15,6 +15,8 @@ public:
Remove_DMA,
};
typedef void (* DelayFunc)(void);
public:
CRecompiler (CProfiling & Profile, bool & EndEmulation );
~CRecompiler (void);
@ -23,6 +25,7 @@ public:
void ResetRecompCode ( void );
bool GenerateX86Code (CCodeBlock & BlockInfo, CCodeSection * Section, DWORD Test );
BYTE * CompileDelaySlot ( DWORD PC );
//Self modifying code methods
void ClearRecompCode_Virt ( DWORD VirtualAddress, int length, REMOVE_REASON Reason );
@ -41,7 +44,6 @@ private:
//CFunctionMap m_Functions;
CCompiledFunc * CompilerCode ( void );
CCompiledFunc * CompileDelaySlot ( DWORD PC );
bool Compiler4300iBlock ( CCompiledFunc * info );
// Compiling code

View File

@ -44,7 +44,7 @@ void CRecompilerOps::Compile_Branch (CRecompilerOps::BranchFunction CompareFunc,
{
OPCODE Command;
if (!_MMU ->LW_VAddr(m_CompilePC + 4, Command.Hex)) {
if (!_MMU->LW_VAddr(m_CompilePC + 4, Command.Hex)) {
DisplayError(GS(MSG_FAIL_LOAD_WORD));
ExitThread(0);
}
@ -1013,8 +1013,6 @@ void CRecompilerOps::BGEZ_Compare (void) {
}
void CRecompilerOps::COP1_BCF_Compare (void) {
_Notify->BreakPoint(__FILE__,__LINE__);
#ifdef tofix
TestVariable(FPCSR_C,&_FPCR[31],"_FPCR[31]");
if (m_Section->m_Cont.FallThrough) {
JeLabel32 ( m_Section->m_Jump.BranchLabel.c_str(), 0 );
@ -1028,12 +1026,9 @@ void CRecompilerOps::COP1_BCF_Compare (void) {
JmpLabel32(m_Section->m_Jump.BranchLabel.c_str(),0);
m_Section->m_Jump.LinkLocation = (DWORD *)(m_RecompPos - 4);
}
#endif
}
void CRecompilerOps::COP1_BCT_Compare (void) {
_Notify->BreakPoint(__FILE__,__LINE__);
#ifdef tofix
TestVariable(FPCSR_C,&_FPCR[31],"_FPCR[31]");
if (m_Section->m_Cont.FallThrough) {
JneLabel32 ( m_Section->m_Jump.BranchLabel.c_str(), 0 );
@ -1047,7 +1042,6 @@ void CRecompilerOps::COP1_BCT_Compare (void) {
JmpLabel32(m_Section->m_Jump.BranchLabel.c_str(),0);
m_Section->m_Jump.LinkLocation = (DWORD *)(m_RecompPos - 4);
}
#endif
}
/************************* OpCode functions *************************/
@ -1087,21 +1081,15 @@ void CRecompilerOps::JAL (void) {
UnMap_GPR( 31, FALSE);
MipsRegLo(31) = m_CompilePC + 8;
MipsRegState(31) = CRegInfo::STATE_CONST_32;
if ((m_CompilePC & 0xFFC) == 0xFFC) {
_Notify->BreakPoint(__FILE__,__LINE__);
#ifdef tofix
MoveConstToVariable((m_CompilePC & 0xF0000000) + (m_Opcode.target << 2),&JumpToLocation,"JumpToLocation");
MoveConstToVariable(m_CompilePC + 4,_PROGRAM_COUNTER,"_PROGRAM_COUNTER");
UpdateCounters(&m_RegWorkingSet.BlockCycleCount(),&m_RegWorkingSet.BlockRandomModifier(),FALSE);
m_RegWorkingSet.WriteBackRegisters();
if (CPU_Type == CPU_SyncCores) { Call_Direct(SyncToPC, "SyncToPC"); }
MoveConstToVariable(DELAY_SLOT,&m_NextInstruction,"m_NextInstruction");
Ret();
if ((m_CompilePC & 0xFFC) == 0xFFC)
{
DWORD TargetPC = (m_CompilePC & 0xF0000000) + (m_Opcode.target << 2);
PushImm32(stdstr_f("0x%08X",TargetPC).c_str(),TargetPC);
m_Section->GenerateSectionLinkage();
m_NextInstruction = END_BLOCK;
return;
#endif
} else {
m_NextInstruction = DO_DELAY_SLOT;
}
m_NextInstruction = DO_DELAY_SLOT;
} else if (m_NextInstruction == DELAY_SLOT_DONE ) {
DWORD TargetPC = (m_CompilePC & 0xF0000000) + (m_Opcode.target << 2);
m_Section->CompileExit(m_CompilePC,TargetPC,m_RegWorkingSet,CExitInfo::Normal,TRUE,NULL);
@ -1408,10 +1396,10 @@ void CRecompilerOps::DADDIU (void) {
if (m_Opcode.rs != 0) { UnMap_GPR(m_Opcode.rs,TRUE); }
if (m_Opcode.rs != 0) { UnMap_GPR(m_Opcode.rt,TRUE); }
Pushad();
BeforeCallDirect();
MoveConstToVariable(m_Opcode.Hex, &R4300iOp::m_Opcode.Hex, "R4300iOp::m_Opcode.Hex");
Call_Direct(R4300iOp::DADDIU, "R4300iOp::DADDIU");
Popad();
AfterCallDirect();
}
void CRecompilerOps::CACHE (void){
@ -1425,7 +1413,7 @@ void CRecompilerOps::CACHE (void){
switch(m_Opcode.rt) {
case 0:
case 16:
Pushad();
BeforeCallDirect();
PushImm32("CRecompiler::Remove_Cache",CRecompiler::Remove_Cache);
PushImm32("20",20);
if (IsConst(m_Opcode.base)) {
@ -1441,7 +1429,7 @@ void CRecompilerOps::CACHE (void){
}
MoveConstToX86reg((DWORD)_N64System->GetRecompiler(),x86_ECX);
Call_Direct(AddressOf(CRecompiler::ClearRecompCode_Virt), "CRecompiler::ClearRecompCode_Virt");
Popad();
AfterCallDirect();
break;
case 1:
case 3:
@ -1800,6 +1788,7 @@ void CRecompilerOps::SPECIAL_JR (void) {
} else {
MoveX86regToVariable(Map_TempReg(x86_Any,m_Opcode.rs,FALSE),_PROGRAM_COUNTER, "PROGRAM_COUNTER");
}
UpdateCounters(m_RegWorkingSet,true,true);
m_Section->CompileExit(-1, (DWORD)-1,m_RegWorkingSet,CExitInfo::Normal,TRUE,NULL);
}
}
@ -1858,6 +1847,7 @@ _Notify->BreakPoint(__FILE__,__LINE__);
} else {
MoveX86regToVariable(Map_TempReg(x86_Any,m_Opcode.rs,FALSE),_PROGRAM_COUNTER, "PROGRAM_COUNTER");
}
UpdateCounters(m_RegWorkingSet,true,true);
m_Section->CompileExit(m_CompilePC, (DWORD)-1,m_RegWorkingSet,CExitInfo::Normal,TRUE,NULL);
}
m_NextInstruction = END_BLOCK;
@ -2266,10 +2256,10 @@ void CRecompilerOps::SPECIAL_DMULT (void) {
if (m_Opcode.rs != 0) { UnMap_GPR(m_Opcode.rs,TRUE); }
if (m_Opcode.rs != 0) { UnMap_GPR(m_Opcode.rt,TRUE); }
Pushad();
BeforeCallDirect();
MoveConstToVariable(m_Opcode.Hex, &R4300iOp::m_Opcode.Hex, "R4300iOp::m_Opcode.Hex");
Call_Direct(R4300iOp::SPECIAL_DMULT, "R4300iOp::SPECIAL_DMULT");
Popad();
AfterCallDirect();
#endif
}
@ -2347,10 +2337,10 @@ void CRecompilerOps::SPECIAL_DDIV (void) {
UnMap_GPR(m_Opcode.rs,TRUE);
UnMap_GPR(m_Opcode.rt,TRUE);
Pushad();
BeforeCallDirect();
MoveConstToVariable(m_Opcode.Hex, &R4300iOp::m_Opcode.Hex, "R4300iOp::m_Opcode.Hex");
Call_Direct(R4300iOp::SPECIAL_DDIV, "R4300iOp::SPECIAL_DDIV");
Popad();
AfterCallDirect();
}
void CRecompilerOps::SPECIAL_DDIVU (void)
@ -2359,10 +2349,10 @@ void CRecompilerOps::SPECIAL_DDIVU (void)
UnMap_GPR(m_Opcode.rs,TRUE);
UnMap_GPR(m_Opcode.rt,TRUE);
Pushad();
BeforeCallDirect();
MoveConstToVariable(m_Opcode.Hex, &R4300iOp::m_Opcode.Hex, "R4300iOp::m_Opcode.Hex");
Call_Direct(R4300iOp::SPECIAL_DDIVU, "R4300iOp::SPECIAL_DDIVU");
Popad();
AfterCallDirect();
}
void CRecompilerOps::SPECIAL_ADD (void) {
@ -2800,8 +2790,6 @@ void CRecompilerOps::SPECIAL_XOR (void) {
}
void CRecompilerOps::SPECIAL_NOR (void) {
_Notify->BreakPoint(__FILE__,__LINE__);
#ifdef tofix
CPU_Message(" %X %s",m_CompilePC,R4300iOpcodeName(m_Opcode.Hex,m_CompilePC));
if (m_Section->IsKnown(m_Opcode.rt) && m_Section->IsKnown(m_Opcode.rs)) {
@ -2837,7 +2825,7 @@ void CRecompilerOps::SPECIAL_NOR (void) {
Map_GPR_32bit(m_Opcode.rd,m_Section->IsSigned(m_Opcode.rt),source1);
}
OrX86RegToX86Reg(cMipsRegMapLo(m_Opcode.rd),cMipsRegMapLo(source2));
NotX86Reg(cMipsRegLo(m_Opcode.rd));
NotX86Reg(cMipsRegMapLo(m_Opcode.rd));
}
} else {
DWORD ConstReg = IsConst(m_Opcode.rt)?m_Opcode.rt:m_Opcode.rs;
@ -2853,13 +2841,13 @@ void CRecompilerOps::SPECIAL_NOR (void) {
}
Map_GPR_64bit(m_Opcode.rd,MappedReg);
if ((Value >> 32) != 0) {
OrConstToX86Reg((DWORD)(Value >> 32),MipsRegHi(m_Opcode.rd));
OrConstToX86Reg((DWORD)(Value >> 32),MipsRegMapHi(m_Opcode.rd));
}
if ((DWORD)Value != 0) {
OrConstToX86Reg((DWORD)Value,cMipsRegLo(m_Opcode.rd));
OrConstToX86Reg((DWORD)Value,cMipsRegMapLo(m_Opcode.rd));
}
NotX86Reg(MipsRegHi(m_Opcode.rd));
NotX86Reg(cMipsRegLo(m_Opcode.rd));
NotX86Reg(cMipsRegMapHi(m_Opcode.rd));
NotX86Reg(cMipsRegMapLo(m_Opcode.rd));
} else {
int Value = cMipsRegLo(ConstReg);
if (m_Section->IsSigned(m_Opcode.rt) != m_Section->IsSigned(m_Opcode.rs)) {
@ -2867,8 +2855,8 @@ void CRecompilerOps::SPECIAL_NOR (void) {
} else {
Map_GPR_32bit(m_Opcode.rd,m_Section->IsSigned(MappedReg)?TRUE:FALSE, MappedReg);
}
if (Value != 0) { OrConstToX86Reg(Value,cMipsRegLo(m_Opcode.rd)); }
NotX86Reg(cMipsRegLo(m_Opcode.rd));
if (Value != 0) { OrConstToX86Reg(Value,cMipsRegMapLo(m_Opcode.rd)); }
NotX86Reg(cMipsRegMapLo(m_Opcode.rd));
}
}
} else if (m_Section->IsKnown(m_Opcode.rt) || m_Section->IsKnown(m_Opcode.rs)) {
@ -2881,26 +2869,25 @@ void CRecompilerOps::SPECIAL_NOR (void) {
Value = Is64Bit(KnownReg)?m_Section->MipsReg(KnownReg):m_Section->MipsRegLo_S(KnownReg);
Map_GPR_64bit(m_Opcode.rd,UnknownReg);
if ((Value >> 32) != 0) {
OrConstToX86Reg((DWORD)(Value >> 32),MipsRegHi(m_Opcode.rd));
OrConstToX86Reg((DWORD)(Value >> 32),MipsRegMapHi(m_Opcode.rd));
}
if ((DWORD)Value != 0) {
OrConstToX86Reg((DWORD)Value,cMipsRegLo(m_Opcode.rd));
OrConstToX86Reg((DWORD)Value,cMipsRegMapLo(m_Opcode.rd));
}
} else {
Map_GPR_64bit(m_Opcode.rd,KnownReg);
OrVariableToX86Reg(&_GPR[UnknownReg].W[1],CRegName::GPR_Hi[UnknownReg],MipsRegHi(m_Opcode.rd));
OrVariableToX86Reg(&_GPR[UnknownReg].W[0],CRegName::GPR_Lo[UnknownReg],cMipsRegLo(m_Opcode.rd));
OrVariableToX86Reg(&_GPR[UnknownReg].W[1],CRegName::GPR_Hi[UnknownReg],cMipsRegMapHi(m_Opcode.rd));
OrVariableToX86Reg(&_GPR[UnknownReg].W[0],CRegName::GPR_Lo[UnknownReg],cMipsRegMapLo(m_Opcode.rd));
}
NotX86Reg(MipsRegHi(m_Opcode.rd));
NotX86Reg(cMipsRegLo(m_Opcode.rd));
NotX86Reg(cMipsRegMapHi(m_Opcode.rd));
NotX86Reg(cMipsRegMapLo(m_Opcode.rd));
} else {
Map_GPR_64bit(m_Opcode.rd,m_Opcode.rt);
OrVariableToX86Reg(&_GPR[m_Opcode.rs].W[1],CRegName::GPR_Hi[m_Opcode.rs],MipsRegHi(m_Opcode.rd));
OrVariableToX86Reg(&_GPR[m_Opcode.rs].W[0],CRegName::GPR_Lo[m_Opcode.rs],cMipsRegLo(m_Opcode.rd));
NotX86Reg(MipsRegHi(m_Opcode.rd));
NotX86Reg(cMipsRegLo(m_Opcode.rd));
OrVariableToX86Reg(&_GPR[m_Opcode.rs].W[1],CRegName::GPR_Hi[m_Opcode.rs],cMipsRegMapHi(m_Opcode.rd));
OrVariableToX86Reg(&_GPR[m_Opcode.rs].W[0],CRegName::GPR_Lo[m_Opcode.rs],cMipsRegMapLo(m_Opcode.rd));
NotX86Reg(cMipsRegMapHi(m_Opcode.rd));
NotX86Reg(cMipsRegMapLo(m_Opcode.rd));
}
#endif
}
void CRecompilerOps::SPECIAL_SLT (void) {
@ -3668,10 +3655,10 @@ void CRecompilerOps::COP0_MT (void) {
break;
case 11: //Compare
UpdateCounters(m_RegWorkingSet,false,true);
Pushad();
BeforeCallDirect();
MoveConstToX86reg((DWORD)_SystemTimer,x86_ECX);
Call_Direct(AddressOf(CSystemTimer::UpdateTimers), "CSystemTimer::UpdateTimers");
Popad();
AfterCallDirect();
if (IsConst(m_Opcode.rt)) {
MoveConstToVariable(cMipsRegLo(m_Opcode.rt), &_CP0[m_Opcode.rd], CRegName::Cop0[m_Opcode.rd]);
} else if (IsMapped(m_Opcode.rt)) {
@ -3680,17 +3667,17 @@ void CRecompilerOps::COP0_MT (void) {
MoveX86regToVariable(Map_TempReg(x86_Any,m_Opcode.rt,FALSE), &_CP0[m_Opcode.rd], CRegName::Cop0[m_Opcode.rd]);
}
AndConstToVariable(~CAUSE_IP7,&_Reg->FAKE_CAUSE_REGISTER,"FAKE_CAUSE_REGISTER");
Pushad();
BeforeCallDirect();
MoveConstToX86reg((DWORD)_SystemTimer,x86_ECX);
Call_Direct(AddressOf(CSystemTimer::UpdateCompareTimer), "CSystemTimer::UpdateCompareTimer");
Popad();
AfterCallDirect();
break;
case 9: //Count
UpdateCounters(m_RegWorkingSet,false,true);
Pushad();
BeforeCallDirect();
MoveConstToX86reg((DWORD)_SystemTimer,x86_ECX);
Call_Direct(AddressOf(CSystemTimer::UpdateTimers), "CSystemTimer::UpdateTimers");
Popad();
AfterCallDirect();
if (IsConst(m_Opcode.rt)) {
MoveConstToVariable(cMipsRegLo(m_Opcode.rt), &_CP0[m_Opcode.rd], CRegName::Cop0[m_Opcode.rd]);
} else if (IsMapped(m_Opcode.rt)) {
@ -3698,10 +3685,10 @@ void CRecompilerOps::COP0_MT (void) {
} else {
MoveX86regToVariable(Map_TempReg(x86_Any,m_Opcode.rt,FALSE), &_CP0[m_Opcode.rd], CRegName::Cop0[m_Opcode.rd]);
}
Pushad();
BeforeCallDirect();
MoveConstToX86reg((DWORD)_SystemTimer,x86_ECX);
Call_Direct(AddressOf(CSystemTimer::UpdateCompareTimer), "CSystemTimer::UpdateCompareTimer");
Popad();
AfterCallDirect();
break;
case 12: //Status
{
@ -3718,28 +3705,28 @@ void CRecompilerOps::COP0_MT (void) {
TestConstToX86Reg(STATUS_FR,OldStatusReg);
JeLabel8("FpuFlagFine",0);
Jump = m_RecompPos - 1;
Pushad();
BeforeCallDirect();
Call_Direct(SetFpuLocations,"SetFpuLocations");
Popad();
AfterCallDirect();
*(BYTE *)(Jump)= (BYTE )(((BYTE )(m_RecompPos)) - (((BYTE )(Jump)) + 1));
//TestConstToX86Reg(STATUS_FR,OldStatusReg);
//BreakPoint(__FILE__,__LINE__); //m_Section->CompileExit(m_CompilePC+4,m_RegWorkingSet,ExitResetRecompCode,FALSE,JneLabel32);
Pushad();
BeforeCallDirect();
MoveConstToX86reg((DWORD)_Reg,x86_ECX);
Call_Direct(AddressOf(CRegisters::CheckInterrupts),"CRegisters::CheckInterrupts");
Popad();
AfterCallDirect();
}
break;
case 6: //Wired
_Notify->BreakPoint(__FILE__,__LINE__);
#ifdef tofix
Pushad();
BeforeCallDirect();
UpdateCounters(&m_RegWorkingSet.BlockCycleCount(),&m_RegWorkingSet.BlockRandomModifier(),FALSE);
m_RegWorkingSet.BlockCycleCount() = 0;
m_RegWorkingSet.BlockRandomModifier() = 0;
Call_Direct(FixRandomReg,"FixRandomReg");
Popad();
AfterCallDirect();
if (IsConst(m_Opcode.rt)) {
MoveConstToVariable(cMipsRegLo(m_Opcode.rt), &_CP0[m_Opcode.rd], CRegName::Cop0[m_Opcode.rd]);
} else if (IsMapped(m_Opcode.rt)) {
@ -3761,10 +3748,10 @@ void CRecompilerOps::COP0_MT (void) {
CRecompilerOps::UnknownOpcode();
#endif
}
Pushad();
BeforeCallDirect();
MoveConstToX86reg((DWORD)_Reg,x86_ECX);
Call_Direct(AddressOf(CRegisters::CheckInterrupts),"CRegisters::CheckInterrupts");
Popad();
AfterCallDirect();
break;
default:
_Notify->BreakPoint(__FILE__,__LINE__);
@ -3780,23 +3767,23 @@ void CRecompilerOps::COP0_CO_TLBR( void) {
#ifdef tofix
CPU_Message(" %X %s",m_CompilePC,R4300iOpcodeName(m_Opcode.Hex,m_CompilePC));
if (!g_UseTlb) { return; }
Pushad();
BeforeCallDirect();
Call_Direct(TLB_ReadEntry,"TLB_ReadEntry");
Popad();
AfterCallDirect();
#endif
}
void CRecompilerOps::COP0_CO_TLBWI( void) {
CPU_Message(" %X %s",m_CompilePC,R4300iOpcodeName(m_Opcode.Hex,m_CompilePC));
if (!g_UseTlb) { return; }
Pushad();
BeforeCallDirect();
PushImm32("FALSE",FALSE);
MoveVariableToX86reg(&_Reg->INDEX_REGISTER,"INDEX_REGISTER",x86_ECX);
AndConstToX86Reg(x86_ECX,0x1F);
Push(x86_ECX);
MoveConstToX86reg((DWORD)_TLB,x86_ECX);
Call_Direct(AddressOf(CTLB::WriteEntry),"CTLB::WriteEntry");
Popad();
AfterCallDirect();
}
void CRecompilerOps::COP0_CO_TLBWR( void) {
@ -3808,7 +3795,7 @@ void CRecompilerOps::COP0_CO_TLBWR( void) {
UpdateCounters(&m_RegWorkingSet.BlockCycleCount(),&m_RegWorkingSet.BlockRandomModifier(),FALSE);
m_RegWorkingSet.BlockCycleCount() = 0;
m_RegWorkingSet.BlockRandomModifier() = 0;
Pushad();
BeforeCallDirect();
Call_Direct(FixRandomReg,"FixRandomReg");
PushImm32("TRUE",TRUE);
MoveVariableToX86reg(&_Reg->RANDOM_REGISTER,"RANDOM_REGISTER",x86_ECX);
@ -3816,7 +3803,7 @@ void CRecompilerOps::COP0_CO_TLBWR( void) {
Push(x86_ECX);
Call_Direct(TLB_WriteEntry,"TLB_WriteEntry");
AddConstToX86Reg(x86_ESP,8);
Popad();
AfterCallDirect();
#endif
}
@ -3824,10 +3811,10 @@ void CRecompilerOps::COP0_CO_TLBP( void) {
CPU_Message(" %X %s",m_CompilePC,R4300iOpcodeName(m_Opcode.Hex,m_CompilePC));
if (!g_UseTlb) { return; }
Pushad();
BeforeCallDirect();
MoveConstToX86reg((DWORD)_TLB,x86_ECX);
Call_Direct(AddressOf(CTLB::Probe), "CTLB::TLB_Probe");
Popad();
AfterCallDirect();
}
void compiler_COP0_CO_ERET (void) {
@ -3847,6 +3834,8 @@ void CRecompilerOps::COP0_CO_ERET( void) {
m_RegWorkingSet.WriteBackRegisters();
Call_Direct(compiler_COP0_CO_ERET,"compiler_COP0_CO_ERET");
UpdateCounters(m_RegWorkingSet,true,true);
m_Section->CompileExit(m_CompilePC, (DWORD)-1,m_RegWorkingSet,CExitInfo::Normal,TRUE,NULL);
m_NextInstruction = END_BLOCK;
}
@ -3888,12 +3877,12 @@ void CRecompilerOps::COP1_DMF (void) {
UnMap_FPR(m_Opcode.fs,TRUE);
Map_GPR_64bit(m_Opcode.rt, -1);
TempReg = Map_TempReg(x86_Any,-1,FALSE);
sprintf(Name,"_FPRDoubleLocation[%d]",m_Opcode.fs);
MoveVariableToX86reg((BYTE *)&_FPRDoubleLocation[m_Opcode.fs],Name,TempReg);
sprintf(Name,"_FPR_D[%d]",m_Opcode.fs);
MoveVariableToX86reg((BYTE *)&_FPR_D[m_Opcode.fs],Name,TempReg);
AddConstToX86Reg(TempReg,4);
MoveX86PointerToX86reg(MipsRegHi(m_Opcode.rt),TempReg);
sprintf(Name,"_FPRDoubleLocation[%d]",m_Opcode.fs);
MoveVariableToX86reg((BYTE *)&_FPRDoubleLocation[m_Opcode.fs],Name,TempReg);
sprintf(Name,"_FPR_D[%d]",m_Opcode.fs);
MoveVariableToX86reg((BYTE *)&_FPR_D[m_Opcode.fs],Name,TempReg);
MoveX86PointerToX86reg(cMipsRegLo(m_Opcode.rt),TempReg);
#endif
}
@ -3949,8 +3938,8 @@ void CRecompilerOps::COP1_DMT( void) {
}
UnMap_FPR(m_Opcode.fs,TRUE);
TempReg = Map_TempReg(x86_Any,-1,FALSE);
sprintf(Name,"_FPRDoubleLocation[%d]",m_Opcode.fs);
MoveVariableToX86reg((BYTE *)&_FPRDoubleLocation[m_Opcode.fs],Name,TempReg);
sprintf(Name,"_FPR_D[%d]",m_Opcode.fs);
MoveVariableToX86reg((BYTE *)&_FPR_D[m_Opcode.fs],Name,TempReg);
if (IsConst(m_Opcode.rt)) {
MoveConstToX86Pointer(cMipsRegLo(m_Opcode.rt),TempReg);
@ -3990,9 +3979,9 @@ void CRecompilerOps::COP1_CT(void) {
} else {
MoveX86regToVariable(Map_TempReg(x86_Any,m_Opcode.rt,FALSE),&_FPCR[m_Opcode.fs],CRegName::FPR_Ctrl[m_Opcode.fs]);
}
Pushad();
BeforeCallDirect();
Call_Direct(ChangeDefaultRoundingModel, "ChangeDefaultRoundingModel");
Popad();
AfterCallDirect();
m_RegWorkingSet.CurrentRoundingModel() = CRegInfo::RoundUnknown;
}
@ -4024,11 +4013,10 @@ void CRecompilerOps::COP1_S_ADD (void) {
}
void CRecompilerOps::COP1_S_SUB (void) {
_Notify->BreakPoint(__FILE__,__LINE__);
#ifdef tofix
DWORD Reg1 = m_Opcode.ft == m_Opcode.fd?m_Opcode.ft:m_Opcode.fs;
DWORD Reg2 = m_Opcode.ft == m_Opcode.fd?m_Opcode.fs:m_Opcode.ft;
x86Reg TempReg;
char Name[50];
CPU_Message(" %X %s",m_CompilePC,R4300iOpcodeName(m_Opcode.Hex,m_CompilePC));
@ -4058,7 +4046,6 @@ void CRecompilerOps::COP1_S_SUB (void) {
}
}
UnMap_FPR(m_Opcode.fd,TRUE);
#endif
}
void CRecompilerOps::COP1_S_MUL (void) {
@ -4137,37 +4124,28 @@ void CRecompilerOps::COP1_S_ABS (void) {
}
void CRecompilerOps::COP1_S_NEG (void) {
_Notify->BreakPoint(__FILE__,__LINE__);
#ifdef tofix
CPU_Message(" %X %s",m_CompilePC,R4300iOpcodeName(m_Opcode.Hex,m_CompilePC));
m_Section->CompileCop1Test();
FixRoundModel(CRegInfo::RoundDefault);
Load_FPR_ToTop(m_Opcode.fd,m_Opcode.fs,CRegInfo::FPU_Float);
fpuNeg();
UnMap_FPR(m_Opcode.fd,TRUE);
#endif
}
void CRecompilerOps::COP1_S_SQRT (void) {
_Notify->BreakPoint(__FILE__,__LINE__);
#ifdef tofix
CPU_Message(" %X %s",m_CompilePC,R4300iOpcodeName(m_Opcode.Hex,m_CompilePC));
m_Section->CompileCop1Test();
FixRoundModel(CRegInfo::RoundDefault);
Load_FPR_ToTop(m_Opcode.fd,m_Opcode.fs,CRegInfo::FPU_Float);
fpuSqrt();
UnMap_FPR(m_Opcode.fd,TRUE);
#endif
}
void CRecompilerOps::COP1_S_MOV (void) {
_Notify->BreakPoint(__FILE__,__LINE__);
#ifdef tofix
CPU_Message(" %X %s",m_CompilePC,R4300iOpcodeName(m_Opcode.Hex,m_CompilePC));
m_Section->CompileCop1Test();
FixRoundModel(CRegInfo::RoundDefault);
Load_FPR_ToTop(m_Opcode.fd,m_Opcode.fs,CRegInfo::FPU_Float);
#endif
}
void CRecompilerOps::COP1_S_TRUNC_L (void) {
@ -4223,8 +4201,6 @@ void CRecompilerOps::COP1_S_ROUND_W (void) {
}
void CRecompilerOps::COP1_S_TRUNC_W (void) {
_Notify->BreakPoint(__FILE__,__LINE__);
#ifdef tofix
CPU_Message(" %X %s",m_CompilePC,R4300iOpcodeName(m_Opcode.Hex,m_CompilePC));
m_Section->CompileCop1Test();
@ -4232,7 +4208,6 @@ void CRecompilerOps::COP1_S_TRUNC_W (void) {
Load_FPR_ToTop(m_Opcode.fd,m_Opcode.fs,CRegInfo::FPU_Float);
}
ChangeFPURegFormat(m_Opcode.fd,CRegInfo::FPU_Float,CRegInfo::FPU_Dword,CRegInfo::RoundTruncate);
#endif
}
void CRecompilerOps::COP1_S_CEIL_W (void) { // added by Witten
@ -4249,8 +4224,6 @@ void CRecompilerOps::COP1_S_CEIL_W (void) { // added by Witten
}
void CRecompilerOps::COP1_S_FLOOR_W (void) {
_Notify->BreakPoint(__FILE__,__LINE__);
#ifdef tofix
CPU_Message(" %X %s",m_CompilePC,R4300iOpcodeName(m_Opcode.Hex,m_CompilePC));
m_Section->CompileCop1Test();
@ -4258,12 +4231,10 @@ void CRecompilerOps::COP1_S_FLOOR_W (void) {
Load_FPR_ToTop(m_Opcode.fd,m_Opcode.fs,CRegInfo::FPU_Float);
}
ChangeFPURegFormat(m_Opcode.fd,CRegInfo::FPU_Float,CRegInfo::FPU_Dword,CRegInfo::RoundDown);
#endif
}
void CRecompilerOps::COP1_S_CVT_D (void) {
_Notify->BreakPoint(__FILE__,__LINE__);
#ifdef tofix
void CRecompilerOps::COP1_S_CVT_D (void)
{
CPU_Message(" %X %s",m_CompilePC,R4300iOpcodeName(m_Opcode.Hex,m_CompilePC));
m_Section->CompileCop1Test();
@ -4271,7 +4242,6 @@ void CRecompilerOps::COP1_S_CVT_D (void) {
Load_FPR_ToTop(m_Opcode.fd,m_Opcode.fs,CRegInfo::FPU_Float);
}
ChangeFPURegFormat(m_Opcode.fd,CRegInfo::FPU_Float,CRegInfo::FPU_Double,CRegInfo::RoundDefault);
#endif
}
void CRecompilerOps::COP1_S_CVT_W (void) {
@ -4285,8 +4255,6 @@ void CRecompilerOps::COP1_S_CVT_W (void) {
}
void CRecompilerOps::COP1_S_CVT_L (void) {
_Notify->BreakPoint(__FILE__,__LINE__);
#ifdef tofix
CPU_Message(" %X %s",m_CompilePC,R4300iOpcodeName(m_Opcode.Hex,m_CompilePC));
m_Section->CompileCop1Test();
@ -4294,21 +4262,23 @@ void CRecompilerOps::COP1_S_CVT_L (void) {
Load_FPR_ToTop(m_Opcode.fd,m_Opcode.fs,CRegInfo::FPU_Float);
}
ChangeFPURegFormat(m_Opcode.fd,CRegInfo::FPU_Float,CRegInfo::FPU_Qword,CRegInfo::RoundDefault);
#endif
}
void CRecompilerOps::COP1_S_CMP (void) {
_Notify->BreakPoint(__FILE__,__LINE__);
#ifdef tofix
DWORD Reg1 = RegInStack(m_Opcode.ft, CRegInfo::FPU_Float)?m_Opcode.ft:m_Opcode.fs;
DWORD Reg2 = RegInStack(m_Opcode.ft, CRegInfo::FPU_Float)?m_Opcode.fs:m_Opcode.ft;
x86Reg Reg, cmp = 0;
DWORD Reg1 = m_Opcode.fs;
DWORD Reg2 = m_Opcode.ft;
DWORD cmp = 0;
if ((m_Opcode.funct & 4) == 0)
{
Reg1 = RegInStack(m_Opcode.ft, CRegInfo::FPU_Float)?m_Opcode.ft:m_Opcode.fs;
Reg2 = RegInStack(m_Opcode.ft, CRegInfo::FPU_Float)?m_Opcode.fs:m_Opcode.ft;
}
CPU_Message(" %X %s",m_CompilePC,R4300iOpcodeName(m_Opcode.Hex,m_CompilePC));
m_Section->CompileCop1Test();
//if ((m_Opcode.funct & 1) != 0) { CRecompilerOps::UnknownOpcode(Section); }
if ((m_Opcode.funct & 1) != 0) { CRecompilerOps::UnknownOpcode(); }
if ((m_Opcode.funct & 2) != 0) { cmp |= 0x4000; }
if ((m_Opcode.funct & 4) != 0) { cmp |= 0x0100; }
@ -4317,53 +4287,47 @@ void CRecompilerOps::COP1_S_CMP (void) {
if (RegInStack(Reg2, CRegInfo::FPU_Float)) {
fpuComReg(StackPosition(Reg2),FALSE);
} else {
x86Reg TempReg;
UnMap_FPR(Reg2,TRUE);
Load_FPR_ToTop(Reg1,Reg1, CRegInfo::FPU_Float);
TempReg = Map_TempReg(x86_Any,-1,FALSE);
x86Reg TempReg = Map_TempReg(x86_Any,-1,FALSE);
char Name[50];
sprintf(Name,"_FPR_S[%d]",Reg2);
MoveVariableToX86reg((BYTE *)&_FPR_S[Reg2],Name,TempReg);
fpuComDwordRegPointer(TempReg,FALSE);
}
_Notify->BreakPoint(__FILE__,__LINE__);
#ifdef tofix
AndConstToVariable(~FPCSR_C, &FSTATUS_REGISTER, "FSTATUS_REGISTER");
#endif
AndConstToVariable(~FPCSR_C, &_FPCR[31], "_FPCR[31]");
fpuStoreStatus();
x86reg = Map_TempReg(x86_Any8Bit, 0, FALSE);
x86Reg Reg = Map_TempReg(x86_Any8Bit, 0, FALSE);
TestConstToX86Reg(cmp,x86_EAX);
Setnz(x86reg);
Setnz(Reg);
if (cmp != 0) {
TestConstToX86Reg(cmp,x86_EAX);
Setnz(x86reg);
Setnz(Reg);
if ((m_Opcode.funct & 1) != 0) {
x86Reg Reg2 = Map_TempReg(x86_Any8Bit, 0, FALSE);
AndConstToX86Reg(x86_EAX, 0x4300);
CompConstToX86reg(x86_EAX, 0x4300);
Setz(x86reg2);
Setz(Reg2);
OrX86RegToX86Reg(x86reg, x86reg2);
OrX86RegToX86Reg(Reg, Reg2);
}
} else if ((m_Opcode.funct & 1) != 0) {
AndConstToX86Reg(x86_EAX, 0x4300);
CompConstToX86reg(x86_EAX, 0x4300);
Setz(x86reg);
Setz(Reg);
}
ShiftLeftSignImmed(x86reg, 23);
OrX86RegToVariable(&_FPCR[31], "_FPCR[31]", x86reg);
#endif
ShiftLeftSignImmed(Reg, 23);
OrX86RegToVariable(&_FPCR[31], "_FPCR[31]", Reg);
}
/************************** COP1: D functions ************************/
void CRecompilerOps::COP1_D_ADD (void) {
_Notify->BreakPoint(__FILE__,__LINE__);
#ifdef tofix
DWORD Reg1 = m_Opcode.ft == m_Opcode.fd?m_Opcode.ft:m_Opcode.fs;
DWORD Reg2 = m_Opcode.ft == m_Opcode.fd?m_Opcode.fs:m_Opcode.ft;
char Name[50];
CPU_Message(" %X %s",m_CompilePC,R4300iOpcodeName(m_Opcode.Hex,m_CompilePC));
@ -4377,20 +4341,18 @@ void CRecompilerOps::COP1_D_ADD (void) {
UnMap_FPR(Reg2,TRUE);
TempReg = Map_TempReg(x86_Any,-1,FALSE);
sprintf(Name,"_FPRDoubleLocation[%d]",Reg2);
MoveVariableToX86reg((BYTE *)&_FPRDoubleLocation[Reg2],Name,TempReg);
sprintf(Name,"_FPR_D[%d]",Reg2);
MoveVariableToX86reg((BYTE *)&_FPR_D[Reg2],Name,TempReg);
Load_FPR_ToTop(m_Opcode.fd,m_Opcode.fd, CRegInfo::FPU_Double);
fpuAddQwordRegPointer(TempReg);
}
#endif
}
void CRecompilerOps::COP1_D_SUB (void) {
_Notify->BreakPoint(__FILE__,__LINE__);
#ifdef tofix
DWORD Reg1 = m_Opcode.ft == m_Opcode.fd?m_Opcode.ft:m_Opcode.fs;
DWORD Reg2 = m_Opcode.ft == m_Opcode.fd?m_Opcode.fs:m_Opcode.ft;
x86Reg TempReg;
char Name[50];
CPU_Message(" %X %s",m_CompilePC,R4300iOpcodeName(m_Opcode.Hex,m_CompilePC));
@ -4399,8 +4361,8 @@ void CRecompilerOps::COP1_D_SUB (void) {
if (m_Opcode.fd == m_Opcode.ft) {
UnMap_FPR(m_Opcode.fd,TRUE);
TempReg = Map_TempReg(x86_Any,-1,FALSE);
sprintf(Name,"_FPRDoubleLocation[%d]",m_Opcode.ft);
MoveVariableToX86reg((BYTE *)&_FPRDoubleLocation[m_Opcode.ft],Name,TempReg);
sprintf(Name,"_FPR_D[%d]",m_Opcode.ft);
MoveVariableToX86reg((BYTE *)&_FPR_D[m_Opcode.ft],Name,TempReg);
Load_FPR_ToTop(m_Opcode.fd,m_Opcode.fs,CRegInfo::FPU_Double);
fpuSubQwordRegPointer(TempReg);
} else {
@ -4411,21 +4373,19 @@ void CRecompilerOps::COP1_D_SUB (void) {
UnMap_FPR(Reg2,TRUE);
TempReg = Map_TempReg(x86_Any,-1,FALSE);
sprintf(Name,"_FPRDoubleLocation[%d]",Reg2);
MoveVariableToX86reg((BYTE *)&_FPRDoubleLocation[Reg2],Name,TempReg);
sprintf(Name,"_FPR_D[%d]",Reg2);
MoveVariableToX86reg((BYTE *)&_FPR_D[Reg2],Name,TempReg);
Load_FPR_ToTop(m_Opcode.fd,m_Opcode.fd, CRegInfo::FPU_Double);
fpuSubQwordRegPointer(TempReg);
}
}
#endif
}
void CRecompilerOps::COP1_D_MUL (void) {
_Notify->BreakPoint(__FILE__,__LINE__);
#ifdef tofix
DWORD Reg1 = m_Opcode.ft == m_Opcode.fd?m_Opcode.ft:m_Opcode.fs;
DWORD Reg2 = m_Opcode.ft == m_Opcode.fd?m_Opcode.fs:m_Opcode.ft;
x86Reg TempReg;
char Name[50];
CPU_Message(" %X %s",m_CompilePC,R4300iOpcodeName(m_Opcode.Hex,m_CompilePC));
@ -4439,19 +4399,17 @@ void CRecompilerOps::COP1_D_MUL (void) {
UnMap_FPR(Reg2,TRUE);
Load_FPR_ToTop(m_Opcode.fd,m_Opcode.fd, CRegInfo::FPU_Double);
TempReg = Map_TempReg(x86_Any,-1,FALSE);
sprintf(Name,"_FPRDoubleLocation[%d]",Reg2);
MoveVariableToX86reg((BYTE *)&_FPRDoubleLocation[Reg2],Name,TempReg);
sprintf(Name,"_FPR_D[%d]",Reg2);
MoveVariableToX86reg((BYTE *)&_FPR_D[Reg2],Name,TempReg);
fpuMulQwordRegPointer(TempReg);
}
#endif
}
void CRecompilerOps::COP1_D_DIV (void) {
_Notify->BreakPoint(__FILE__,__LINE__);
#ifdef tofix
DWORD Reg1 = m_Opcode.ft == m_Opcode.fd?m_Opcode.ft:m_Opcode.fs;
DWORD Reg2 = m_Opcode.ft == m_Opcode.fd?m_Opcode.fs:m_Opcode.ft;
x86Reg TempReg;
char Name[50];
CPU_Message(" %X %s",m_CompilePC,R4300iOpcodeName(m_Opcode.Hex,m_CompilePC));
@ -4460,8 +4418,8 @@ void CRecompilerOps::COP1_D_DIV (void) {
if (m_Opcode.fd == m_Opcode.ft) {
UnMap_FPR(m_Opcode.fd,TRUE);
TempReg = Map_TempReg(x86_Any,-1,FALSE);
sprintf(Name,"_FPRDoubleLocation[%d]",m_Opcode.ft);
MoveVariableToX86reg((BYTE *)&_FPRDoubleLocation[m_Opcode.ft],Name,TempReg);
sprintf(Name,"_FPR_D[%d]",m_Opcode.ft);
MoveVariableToX86reg((BYTE *)&_FPR_D[m_Opcode.ft],Name,TempReg);
Load_FPR_ToTop(m_Opcode.fd,m_Opcode.fs,CRegInfo::FPU_Double);
fpuDivQwordRegPointer(TempReg);
} else {
@ -4471,13 +4429,12 @@ void CRecompilerOps::COP1_D_DIV (void) {
} else {
UnMap_FPR(Reg2,TRUE);
TempReg = Map_TempReg(x86_Any,-1,FALSE);
sprintf(Name,"_FPRDoubleLocation[%d]",Reg2);
MoveVariableToX86reg((BYTE *)&_FPRDoubleLocation[Reg2],Name,TempReg);
sprintf(Name,"_FPR_D[%d]",Reg2);
MoveVariableToX86reg((BYTE *)&_FPR_D[Reg2],Name,TempReg);
Load_FPR_ToTop(m_Opcode.fd,m_Opcode.fd, CRegInfo::FPU_Double);
fpuDivQwordRegPointer(TempReg);
}
}
#endif
}
void CRecompilerOps::COP1_D_ABS (void) {
@ -4508,11 +4465,8 @@ void CRecompilerOps::COP1_D_SQRT (void) {
}
void CRecompilerOps::COP1_D_MOV (void) {
_Notify->BreakPoint(__FILE__,__LINE__);
#ifdef tofix
CPU_Message(" %X %s",m_CompilePC,R4300iOpcodeName(m_Opcode.Hex,m_CompilePC));
Load_FPR_ToTop(m_Opcode.fd,m_Opcode.fs,CRegInfo::FPU_Double);
#endif
}
void CRecompilerOps::COP1_D_TRUNC_L (void) { //added by Witten
@ -4580,19 +4534,16 @@ void CRecompilerOps::COP1_D_ROUND_W (void) {
}
void CRecompilerOps::COP1_D_TRUNC_W (void) {
_Notify->BreakPoint(__FILE__,__LINE__);
#ifdef tofix
CPU_Message(" %X %s",m_CompilePC,R4300iOpcodeName(m_Opcode.Hex,m_CompilePC));
m_Section->CompileCop1Test();
if (RegInStack(m_Opcode.fs,CRegInfo::FPU_Double) || RegInStack(m_Opcode.fs,CRegInfo::FPU_Qword)) {
UnMap_FPR(m_Opcode.fs,TRUE);
if (RegInStack(m_Opcode.fd,CRegInfo::FPU_Double) || RegInStack(m_Opcode.fd,CRegInfo::FPU_Qword)) {
UnMap_FPR(m_Opcode.fd,TRUE);
}
if (m_Opcode.fd != m_Opcode.fs || !RegInStack(m_Opcode.fd,CRegInfo::FPU_Double)) {
Load_FPR_ToTop(m_Opcode.fd,m_Opcode.fs,CRegInfo::FPU_Double);
}
ChangeFPURegFormat(m_Opcode.fd,CRegInfo::FPU_Double,CRegInfo::FPU_Dword,CRegInfo::RoundTruncate);
#endif
}
void CRecompilerOps::COP1_D_CEIL_W (void) { // added by Witten
@ -4628,24 +4579,19 @@ void CRecompilerOps::COP1_D_FLOOR_W (void) { //added by Witten
}
void CRecompilerOps::COP1_D_CVT_S (void) {
_Notify->BreakPoint(__FILE__,__LINE__);
#ifdef tofix
CPU_Message(" %X %s",m_CompilePC,R4300iOpcodeName(m_Opcode.Hex,m_CompilePC));
m_Section->CompileCop1Test();
if (RegInStack(m_Opcode.fs,CRegInfo::FPU_Double) || RegInStack(m_Opcode.fs,CRegInfo::FPU_Qword)) {
UnMap_FPR(m_Opcode.fs,TRUE);
if (RegInStack(m_Opcode.fd,CRegInfo::FPU_Double) || RegInStack(m_Opcode.fd,CRegInfo::FPU_Qword)) {
UnMap_FPR(m_Opcode.fd,TRUE);
}
if (m_Opcode.fd != m_Opcode.fs || !RegInStack(m_Opcode.fd,CRegInfo::FPU_Double)) {
Load_FPR_ToTop(m_Opcode.fd,m_Opcode.fs,CRegInfo::FPU_Double);
}
ChangeFPURegFormat(m_Opcode.fd,CRegInfo::FPU_Double,CRegInfo::FPU_Float,CRegInfo::RoundDefault);
#endif
}
void CRecompilerOps::COP1_D_CVT_W (void) {
_Notify->BreakPoint(__FILE__,__LINE__);
#ifdef tofix
CPU_Message(" %X %s",m_CompilePC,R4300iOpcodeName(m_Opcode.Hex,m_CompilePC));
m_Section->CompileCop1Test();
@ -4656,7 +4602,6 @@ void CRecompilerOps::COP1_D_CVT_W (void) {
Load_FPR_ToTop(m_Opcode.fd,m_Opcode.fs,CRegInfo::FPU_Double);
}
ChangeFPURegFormat(m_Opcode.fd,CRegInfo::FPU_Double,CRegInfo::FPU_Dword,CRegInfo::RoundDefault);
#endif
}
void CRecompilerOps::COP1_D_CVT_L (void) {
@ -4676,17 +4621,19 @@ void CRecompilerOps::COP1_D_CVT_L (void) {
}
void CRecompilerOps::COP1_D_CMP (void) {
_Notify->BreakPoint(__FILE__,__LINE__);
#ifdef tofix
DWORD Reg1 = RegInStack(m_Opcode.ft, CRegInfo::FPU_Float)?m_Opcode.ft:m_Opcode.fs;
DWORD Reg2 = RegInStack(m_Opcode.ft, CRegInfo::FPU_Float)?m_Opcode.fs:m_Opcode.ft;
x86Reg Reg, cmp = 0;
DWORD Reg1 = m_Opcode.fs;
DWORD Reg2 = m_Opcode.ft;
DWORD cmp = 0;
if ((m_Opcode.funct & 4) == 0)
{
Reg1 = RegInStack(m_Opcode.ft, CRegInfo::FPU_Double)?m_Opcode.ft:m_Opcode.fs;
Reg2 = RegInStack(m_Opcode.ft, CRegInfo::FPU_Double)?m_Opcode.fs:m_Opcode.ft;
}
CPU_Message(" %X %s",m_CompilePC,R4300iOpcodeName(m_Opcode.Hex,m_CompilePC));
m_Section->CompileCop1Test();
//if ((m_Opcode.funct & 1) != 0) { CRecompilerOps::UnknownOpcode(Section); }
if ((m_Opcode.funct & 1) != 0) { CRecompilerOps::UnknownOpcode(); }
if ((m_Opcode.funct & 2) != 0) { cmp |= 0x4000; }
if ((m_Opcode.funct & 4) != 0) { cmp |= 0x0100; }
@ -4695,43 +4642,39 @@ void CRecompilerOps::COP1_D_CMP (void) {
if (RegInStack(Reg2, CRegInfo::FPU_Double)) {
fpuComReg(StackPosition(Reg2),FALSE);
} else {
x86Reg TempReg;
char Name[50];
UnMap_FPR(Reg2,TRUE);
TempReg = Map_TempReg(x86_Any,-1,FALSE);
sprintf(Name,"_FPRDoubleLocation[%d]",Reg2);
MoveVariableToX86reg((BYTE *)&_FPRDoubleLocation[Reg2],Name,TempReg);
x86Reg TempReg = Map_TempReg(x86_Any,-1,FALSE);
sprintf(Name,"_FPR_D[%d]",Reg2);
MoveVariableToX86reg((BYTE *)&_FPR_D[Reg2],Name,TempReg);
Load_FPR_ToTop(Reg1,Reg1, CRegInfo::FPU_Double);
fpuComQwordRegPointer(TempReg,FALSE);
}
_Notify->BreakPoint(__FILE__,__LINE__);
#ifdef tofix
AndConstToVariable(~FPCSR_C, &FSTATUS_REGISTER, "FSTATUS_REGISTER");
#endif
AndConstToVariable(~FPCSR_C, &_FPCR[31], "_FPCR[31]");
fpuStoreStatus();
x86reg = Map_TempReg(x86_Any8Bit, 0, FALSE);
x86Reg Reg = Map_TempReg(x86_Any8Bit, 0, FALSE);
TestConstToX86Reg(cmp,x86_EAX);
Setnz(x86reg);
Setnz(Reg);
if (cmp != 0) {
TestConstToX86Reg(cmp,x86_EAX);
Setnz(x86reg);
Setnz(Reg);
if ((m_Opcode.funct & 1) != 0) {
x86Reg Reg2 = Map_TempReg(x86_Any8Bit, 0, FALSE);
AndConstToX86Reg(x86_EAX, 0x4300);
CompConstToX86reg(x86_EAX, 0x4300);
Setz(x86reg2);
Setz(Reg2);
OrX86RegToX86Reg(x86reg, x86reg2);
OrX86RegToX86Reg(Reg, Reg2);
}
} else if ((m_Opcode.funct & 1) != 0) {
AndConstToX86Reg(x86_EAX, 0x4300);
CompConstToX86reg(x86_EAX, 0x4300);
Setz(x86reg);
Setz(Reg);
}
ShiftLeftSignImmed(x86reg, 23);
OrX86RegToVariable(&_FPCR[31], "_FPCR[31]", x86reg);
#endif
ShiftLeftSignImmed(Reg, 23);
OrX86RegToVariable(&_FPCR[31], "_FPCR[31]", Reg);
}
/************************** COP1: W functions ************************/
@ -4746,8 +4689,6 @@ void CRecompilerOps::COP1_W_CVT_S (void) {
}
void CRecompilerOps::COP1_W_CVT_D (void) {
_Notify->BreakPoint(__FILE__,__LINE__);
#ifdef tofix
CPU_Message(" %X %s",m_CompilePC,R4300iOpcodeName(m_Opcode.Hex,m_CompilePC));
m_Section->CompileCop1Test();
@ -4755,7 +4696,6 @@ void CRecompilerOps::COP1_W_CVT_D (void) {
Load_FPR_ToTop(m_Opcode.fd,m_Opcode.fs,CRegInfo::FPU_Dword);
}
ChangeFPURegFormat(m_Opcode.fd,CRegInfo::FPU_Dword,CRegInfo::FPU_Double,CRegInfo::RoundDefault);
#endif
}
/************************** COP1: L functions ************************/
@ -4806,6 +4746,18 @@ void CRecompilerOps::UnknownOpcode (void) {
#endif
}
void CRecompilerOps::BeforeCallDirect ( void )
{
UnMap_AllFPRs();
Pushad();
}
void CRecompilerOps::AfterCallDirect ( void )
{
Popad();
m_RegWorkingSet.CurrentRoundingModel() = CRegInfo::RoundUnknown;
}
void CRecompilerOps::EnterCodeBlock ( void )
{
#ifdef _DEBUG
@ -4828,12 +4780,12 @@ void CRecompilerOps::UpdateCounters ( CRegInfo & RegSet, bool CheckTimer, bool C
if (_SyncSystem) {
WriteX86Comment("Updating Sync CPU");
Pushad();
BeforeCallDirect();
PushImm32(stdstr_f("%d",RegSet.GetBlockCycleCount()).c_str(),RegSet.GetBlockCycleCount());
PushImm32("_SyncSystem",(DWORD)_SyncSystem);
MoveConstToX86reg((DWORD)_N64System,x86_ECX);
Call_Direct(AddressOf(CN64System::UpdateSyncCPU),"CN64System::UpdateSyncCPU");
Popad();
AfterCallDirect();
}
WriteX86Comment("Update Counter");
SubConstFromVariable(RegSet.GetBlockCycleCount(),_NextTimer,"_NextTimer"); // updates compare flag

View File

@ -182,8 +182,10 @@ protected:
static void UnknownOpcode ( void );
static void EnterCodeBlock ( void );
static void ExitCodeBlock ( void );
static void BeforeCallDirect ( void );
static void AfterCallDirect ( void );
static void EnterCodeBlock ( void );
static void ExitCodeBlock ( void );
static void CompileReadTLBMiss (int AddressReg, int LookUpReg );
static void CompileWriteTLBMiss (int AddressReg, int LookUpReg );
static void UpdateCounters (CRegInfo & RegSet, bool CheckTimer, bool ClearValues = false );

View File

@ -139,15 +139,26 @@ void CRegInfo::Load_FPR_ToTop ( int Reg, int RegToLoad, FPU_STATE Format)
if (Reg == RegToLoad) {
//if different format then unmap original reg from stack
for (i = 0; i < 8; i++) {
if (FpuMappedTo(i) == (DWORD)Reg) {
if (FpuState(i) != (DWORD)Format) {
UnMap_FPR(Reg,TRUE);
}
i = 8;
if (FpuMappedTo(i) != (DWORD)Reg)
{
continue;
}
if (FpuState(i) != (DWORD)Format) {
UnMap_FPR(Reg,TRUE);
}
break;
}
} else {
UnMap_FPR(Reg,FALSE);
//if different format then unmap original reg from stack
for (i = 0; i < 8; i++)
{
if (FpuMappedTo(i) != (DWORD)Reg)
{
continue;
}
UnMap_FPR(Reg,FpuState(i) != (DWORD)Format);
break;
}
}
if (RegInStack(RegToLoad,Format)) {

View File

@ -1,12 +1,13 @@
#include "stdafx.h"
CCodeBlock::CCodeBlock(DWORD VAddrEnter, BYTE * RecompPos) :
CCodeBlock::CCodeBlock(DWORD VAddrEnter, BYTE * RecompPos, bool bDelaySlot) :
m_VAddrEnter(VAddrEnter),
m_VAddrFirst(VAddrEnter),
m_VAddrLast(VAddrEnter),
m_CompiledLocation(RecompPos),
m_NoOfSections(1),
m_EnterSection(this, VAddrEnter, 1)
m_EnterSection(this, VAddrEnter, 1),
m_bDelaySlot(bDelaySlot)
{
AnalyseBlock();
}
@ -25,13 +26,29 @@ void CCodeBlock::AnalyseBlock ( void )
bool CCodeBlock::Compile()
{
CPU_Message("====== Code Block ======");
if (m_bDelaySlot)
{
CPU_Message("====== Delay Block ======");
} else {
CPU_Message("====== Code Block ======");
}
CPU_Message("x86 code at: %X",CompiledLocation());
CPU_Message("Start of Block: %X",VAddrEnter() );
CPU_Message("No of Sections: %d",NoOfSections() );
CPU_Message("====== recompiled code ======");
EnterCodeBlock();
if (m_bDelaySlot)
{
Pop(x86_EAX);
MoveX86regToVariable(x86_EAX,_PROGRAM_COUNTER,"_PROGRAM_COUNTER");
} else {
EnterCodeBlock();
}
if (m_bDelaySlot)
{
m_EnterSection.GenerateX86Code(m_EnterSection.m_Test + 1);
} else {
#ifdef tofix
if (bLinkBlocks()) {
for (int count = 0; count < BlockInfo.NoOfSections; count ++) {
@ -56,6 +73,7 @@ bool CCodeBlock::Compile()
#ifdef tofix
}
#endif
}
CompileExitCode();
return true;
}

View File

@ -125,8 +125,8 @@ void CX86Ops::AndVariableDispToX86Reg(void *Variable, const char * VariableName,
{
CPU_Message(" and %s, dword ptr [%s+%s*%i]",x86_Name(reg),VariableName, x86_Name(AddrReg), Multiply);
PUTDST16(m_RecompPos,0x0423 + (reg * 0x100));
PUTDST16(m_RecompPos,0x0505 + CalcMultiplyCode(Multiply) + (AddrReg * 0x100));
PUTDST16(m_RecompPos,0x0423 + (reg * 0x800));
PUTDST8(m_RecompPos,0x05 + CalcMultiplyCode(Multiply) + (AddrReg * 0x8));
PUTDST32(m_RecompPos,Variable);
}

View File

@ -1,5 +1,4 @@
#include "..\N64 System.h"
#include "..\\User Interface\\resource.h"
#include "stdafx.h"
RomInformation::RomInformation (const char * RomFile):
m_DeleteRomInfo(true),

View File

@ -1,6 +1,4 @@
#include "..\N64 System.h"
#include <WINDOWS.H>
#include "stdafx.h"
#pragma comment(lib, "winmm.lib")
CSpeedLimitor::CSpeedLimitor(CNotification * const _Notify ) :

View File

@ -1,5 +1,4 @@
#include "..\Plugin.h"
#include <windows.h>
#include "stdafx.h"
void FixUPXIssue ( BYTE * ProgramLocation );

View File

@ -1,5 +1,4 @@
#include "..\Plugin.h"
#include <windows.h>
#include "stdafx.h"
void FixUPXIssue ( BYTE * ProgramLocation );

View File

@ -1,5 +1,4 @@
#include "..\Plugin.h"
#include <windows.h>
#include "stdafx.h"
void FixUPXIssue ( BYTE * ProgramLocation );

View File

@ -1,17 +1,56 @@
#include "..\Settings.h"
#include "..\Plugin.h"
#include "stdafx.h"
CPlugins::CPlugins (const stdstr & PluginDir):
m_PluginDir(PluginDir),
m_Gfx(NULL), m_Audio(NULL), m_RSP(NULL), m_Control(NULL)
{
CreatePlugins();
_Settings->RegisterChangeCB(Plugin_RSP_Current,this,(CSettings::SettingChangedFunc)PluginChanged);
_Settings->RegisterChangeCB(Plugin_GFX_Current,this,(CSettings::SettingChangedFunc)PluginChanged);
_Settings->RegisterChangeCB(Plugin_AUDIO_Current,this,(CSettings::SettingChangedFunc)PluginChanged);
_Settings->RegisterChangeCB(Plugin_CONT_Current,this,(CSettings::SettingChangedFunc)PluginChanged);
_Settings->RegisterChangeCB(Plugin_UseHleGfx,this,(CSettings::SettingChangedFunc)PluginChanged);
_Settings->RegisterChangeCB(Plugin_UseHleAudio,this,(CSettings::SettingChangedFunc)PluginChanged);
_Settings->RegisterChangeCB(Game_EditPlugin_Gfx,this,(CSettings::SettingChangedFunc)PluginChanged);
_Settings->RegisterChangeCB(Game_EditPlugin_Audio,this,(CSettings::SettingChangedFunc)PluginChanged);
_Settings->RegisterChangeCB(Game_EditPlugin_Contr,this,(CSettings::SettingChangedFunc)PluginChanged);
_Settings->RegisterChangeCB(Game_EditPlugin_RSP,this,(CSettings::SettingChangedFunc)PluginChanged);
}
CPlugins::~CPlugins (void) {
_Settings->UnregisterChangeCB(Plugin_RSP_Current,this,(CSettings::SettingChangedFunc)PluginChanged);
_Settings->UnregisterChangeCB(Plugin_GFX_Current,this,(CSettings::SettingChangedFunc)PluginChanged);
_Settings->UnregisterChangeCB(Plugin_AUDIO_Current,this,(CSettings::SettingChangedFunc)PluginChanged);
_Settings->UnregisterChangeCB(Plugin_CONT_Current,this,(CSettings::SettingChangedFunc)PluginChanged);
_Settings->UnregisterChangeCB(Plugin_UseHleGfx,this,(CSettings::SettingChangedFunc)PluginChanged);
_Settings->UnregisterChangeCB(Plugin_UseHleAudio,this,(CSettings::SettingChangedFunc)PluginChanged);
_Settings->UnregisterChangeCB(Game_EditPlugin_Gfx,this,(CSettings::SettingChangedFunc)PluginChanged);
_Settings->UnregisterChangeCB(Game_EditPlugin_Audio,this,(CSettings::SettingChangedFunc)PluginChanged);
_Settings->UnregisterChangeCB(Game_EditPlugin_Contr,this,(CSettings::SettingChangedFunc)PluginChanged);
_Settings->UnregisterChangeCB(Game_EditPlugin_RSP,this,(CSettings::SettingChangedFunc)PluginChanged);
ShutDownPlugins();
}
void CPlugins::PluginChanged ( CPlugins * _this )
{
bool bGfxChange = stricmp(_this->m_GfxFile.c_str(),_Settings->LoadString(Game_Plugin_Gfx).c_str()) != 0;
bool bAudioChange = stricmp(_this->m_AudioFile.c_str(),_Settings->LoadString(Game_Plugin_Audio).c_str()) != 0;
bool bRspChange = stricmp(_this->m_RSPFile.c_str(),_Settings->LoadString(Game_Plugin_RSP).c_str()) != 0;
bool bContChange = stricmp(_this->m_ControlFile.c_str(),_Settings->LoadString(Game_Plugin_Controller).c_str()) != 0;
if ( bGfxChange || bAudioChange || bRspChange || bContChange )
{
if (_Settings->LoadBool(GameRunning_CPU_Running) != 0)
{
if (_N64System) { _N64System->ExternalEvent(SysEvent_ChangePlugins); }
} else {
_this->Reset();
_Notify->RefreshMenu();
}
}
}
void CPlugins::CreatePlugins( void ) {
Reset(PLUGIN_TYPE_GFX);
Reset(PLUGIN_TYPE_AUDIO);
@ -156,7 +195,8 @@ void CPlugins::Reset ( PLUGIN_TYPE Type )
m_RSP = NULL;
}
{
stdstr_f RspPluginFile("%s%s",m_PluginDir.c_str(),_Settings->LoadString(Plugin_RSP_Current).c_str());
m_RSPFile = _Settings->LoadString(Plugin_RSP_Current);
stdstr_f RspPluginFile("%s%s",m_PluginDir.c_str(),m_RSPFile.c_str());
WriteTraceF(TraceRSP,"Loading (%s): Starting",RspPluginFile.c_str());
m_RSP = new CRSP_Plugin(RspPluginFile.c_str());
WriteTrace(TraceRSP,"Loading Done");
@ -185,7 +225,8 @@ void CPlugins::Reset ( PLUGIN_TYPE Type )
m_Gfx = NULL;
}
{
stdstr_f GfxPluginFile("%s%s",m_PluginDir.c_str(),_Settings->LoadString(Game_Plugin_Gfx).c_str());
m_GfxFile = _Settings->LoadString(Game_Plugin_Gfx);
stdstr_f GfxPluginFile("%s%s",m_PluginDir.c_str(),m_GfxFile.c_str());
WriteTraceF(TraceGfxPlugin,"Loading (%s): Starting",GfxPluginFile.c_str());
m_Gfx = new CGfxPlugin(GfxPluginFile.c_str());
WriteTrace(TraceGfxPlugin,"Loading Done");
@ -204,7 +245,8 @@ void CPlugins::Reset ( PLUGIN_TYPE Type )
m_Audio = NULL;
}
{
stdstr_f PluginFile("%s%s",m_PluginDir.c_str(),_Settings->LoadString(Game_Plugin_Audio).c_str());
m_AudioFile = _Settings->LoadString(Game_Plugin_Audio);
stdstr_f PluginFile("%s%s",m_PluginDir.c_str(),m_AudioFile.c_str());
WriteTraceF(TraceDebug,"Loading (%s): Starting",PluginFile.c_str());
m_Audio = new CAudioPlugin(PluginFile.c_str());
WriteTrace(TraceDebug,"Loading Done");
@ -222,7 +264,8 @@ void CPlugins::Reset ( PLUGIN_TYPE Type )
m_Control = NULL;
}
{
stdstr_f PluginFile("%s%s",m_PluginDir.c_str(),_Settings->LoadString(Game_Plugin_Controller).c_str());
m_ControlFile = _Settings->LoadString(Game_Plugin_Controller);
stdstr_f PluginFile("%s%s",m_PluginDir.c_str(),m_ControlFile.c_str());
WriteTraceF(TraceDebug,"Loading (%s): Starting",PluginFile.c_str());
m_Control = new CControl_Plugin(PluginFile.c_str());
WriteTrace(TraceDebug,"Loading Done");

View File

@ -79,12 +79,19 @@ class CPlugins {
void CreatePlugins ( void );
void CreatePluginDir ( const stdstr & DstDir ) const;
static void PluginChanged ( CPlugins * _this );
//Plugins
CGfxPlugin * m_Gfx;
CAudioPlugin * m_Audio;
CRSP_Plugin * m_RSP;
CControl_Plugin * m_Control;
stdstr m_GfxFile;
stdstr m_AudioFile;
stdstr m_RSPFile;
stdstr m_ControlFile;
public:
//Functions
CPlugins (const stdstr & PluginDir );

View File

@ -1,5 +1,4 @@
#include "..\Plugin.h"
#include <windows.h>
#include "stdafx.h"
void FixUPXIssue ( BYTE * ProgramLocation );
void DummyFunc1 ( BOOL a) {}

View File

@ -44,7 +44,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "../" /I "./" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "../" /I "./" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /c
# SUBTRACT CPP /Fr
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
@ -71,7 +71,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../" /I "./" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../" /I "./" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
# SUBTRACT CPP /Fr
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
@ -100,7 +100,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "../" /I "./" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "EXTERNAL_RELEASE" /YX /FD /EHa /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "../" /I "./" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "EXTERNAL_RELEASE" /Yu"stdafx.h" /FD /EHa /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0xc09 /d "NDEBUG"
@ -211,10 +211,6 @@ SOURCE="Settings\Recompiler Settings.cpp"
# End Source File
# Begin Source File
SOURCE="Settings\Setting Config.cpp"
# End Source File
# Begin Source File
SOURCE="Settings\Settings Class.cpp"
# End Source File
# End Group
@ -307,10 +303,6 @@ SOURCE="N64 System\Debugger\Debugger.cpp"
# End Group
# Begin Source File
SOURCE="User Interface\Cheats.cpp"
# End Source File
# Begin Source File
SOURCE="User Interface\Frame Per Second Class.cpp"
# End Source File
# Begin Source File
@ -414,18 +406,10 @@ SOURCE=".\N64 System\C Core\C main.cpp"
# End Source File
# Begin Source File
SOURCE="N64 System\C Core\C Memory.cpp"
# End Source File
# Begin Source File
SOURCE=".\N64 System\C Core\CPU Log.cpp"
# End Source File
# Begin Source File
SOURCE="N64 System\C Core\CPU.cpp"
# End Source File
# Begin Source File
SOURCE="N64 System\C Core\Dma.cpp"
# End Source File
# Begin Source File
@ -434,10 +418,6 @@ SOURCE=".\N64 System\C Core\Eeprom.cpp"
# End Source File
# Begin Source File
SOURCE=".\N64 System\C Core\Exception.cpp"
# End Source File
# Begin Source File
SOURCE=".\N64 System\C Core\FlashRam.cpp"
# End Source File
# Begin Source File
@ -458,47 +438,15 @@ SOURCE=".\N64 System\C Core\r4300i Commands.cpp"
# End Source File
# Begin Source File
SOURCE=".\N64 System\C Core\r4300i Memory.cpp"
# End Source File
# Begin Source File
SOURCE=".\N64 System\C Core\r4300i Registers.cpp"
# End Source File
# Begin Source File
SOURCE="N64 System\C Core\Recompiler CPU.cpp"
# End Source File
# Begin Source File
SOURCE="N64 System\C Core\Recompiler Fpu Ops.cpp"
# End Source File
# Begin Source File
SOURCE="N64 System\C Core\Registers.cpp"
# End Source File
# Begin Source File
SOURCE=".\N64 System\C Core\Sram.cpp"
# End Source File
# Begin Source File
SOURCE="N64 System\C Core\Sync CPU.c"
# End Source File
# Begin Source File
SOURCE="N64 System\C Core\TLB Display.c"
# End Source File
# Begin Source File
SOURCE="N64 System\C Core\Win32Timer.c"
# End Source File
# Begin Source File
SOURCE=".\N64 System\C Core\x86 fpu.cpp"
# End Source File
# Begin Source File
SOURCE=".\N64 System\C Core\X86.cpp"
SOURCE=".\N64 System\C Core\Win32Timer.cpp"
# End Source File
# End Group
# Begin Group "Recompiler Files"
@ -635,19 +583,63 @@ SOURCE="Plugins\RSP Plugin.cpp"
# Begin Source File
SOURCE="3rd Party\zlib\UNZIP.C"
!IF "$(CFG)" == "Project64 - Win32 Release"
!ELSEIF "$(CFG)" == "Project64 - Win32 Debug"
# SUBTRACT CPP /YX /Yc /Yu
!ELSEIF "$(CFG)" == "Project64 - Win32 External Release"
!ENDIF
# End Source File
# Begin Source File
SOURCE="3rd Party\zlib\zip.c"
!IF "$(CFG)" == "Project64 - Win32 Release"
!ELSEIF "$(CFG)" == "Project64 - Win32 Debug"
# SUBTRACT CPP /YX /Yc /Yu
!ELSEIF "$(CFG)" == "Project64 - Win32 External Release"
!ENDIF
# End Source File
# End Group
# Begin Source File
SOURCE="3rd Party\7zip.cpp"
!IF "$(CFG)" == "Project64 - Win32 Release"
!ELSEIF "$(CFG)" == "Project64 - Win32 Debug"
# SUBTRACT CPP /YX /Yc /Yu
!ELSEIF "$(CFG)" == "Project64 - Win32 External Release"
!ENDIF
# End Source File
# Begin Source File
SOURCE="3rd Party\Processor Info.cpp"
!IF "$(CFG)" == "Project64 - Win32 Release"
!ELSEIF "$(CFG)" == "Project64 - Win32 Debug"
# SUBTRACT CPP /YX /Yc /Yu
!ELSEIF "$(CFG)" == "Project64 - Win32 External Release"
!ENDIF
# End Source File
# End Group
# Begin Source File
@ -660,6 +652,11 @@ SOURCE=main.cpp
# End Source File
# Begin Source File
SOURCE=.\stdafx.cpp
# ADD CPP /Yc"stdafx.h"
# End Source File
# Begin Source File
SOURCE=ValidateBinary.cpp
# End Source File
# End Group
@ -911,10 +908,6 @@ SOURCE=".\User Interface\WTL Controls\PartialGroupBox.h"
# End Group
# Begin Source File
SOURCE="User Interface\Cheats.h"
# End Source File
# Begin Source File
SOURCE="User Interface\Frame Per Second Class.h"
# End Source File
# Begin Source File
@ -1030,18 +1023,6 @@ SOURCE="N64 System\C Core\C Core Interface.h"
# End Source File
# Begin Source File
SOURCE="N64 System\C Core\C Core.h"
# End Source File
# Begin Source File
SOURCE="N64 System\C Core\C Global Variable.h"
# End Source File
# Begin Source File
SOURCE="N64 System\C Core\C Memory.h"
# End Source File
# Begin Source File
SOURCE="N64 System\C Core\Core Settings.h"
# End Source File
# Begin Source File
@ -1066,10 +1047,6 @@ SOURCE="N64 System\C Core\Eeprom.h"
# End Source File
# Begin Source File
SOURCE="N64 System\C Core\Exception.h"
# End Source File
# Begin Source File
SOURCE="N64 System\C Core\Flashram.h"
# End Source File
# Begin Source File
@ -1090,10 +1067,6 @@ SOURCE="N64 System\C Core\Pif.h"
# End Source File
# Begin Source File
SOURCE="N64 System\C Core\Plugin.h"
# End Source File
# Begin Source File
SOURCE="N64 System\C Core\r4300i Commands.h"
# End Source File
# Begin Source File
@ -1106,40 +1079,12 @@ SOURCE="N64 System\C Core\r4300i Registers.h"
# End Source File
# Begin Source File
SOURCE="N64 System\C Core\Recompiler CPU.h"
# End Source File
# Begin Source File
SOURCE="N64 System\C Core\Recompiler Ops.h"
# End Source File
# Begin Source File
SOURCE="N64 System\C Core\Registers.h"
# End Source File
# Begin Source File
SOURCE="N64 System\C Core\Sram.h"
# End Source File
# Begin Source File
SOURCE="N64 System\C Core\Sync CPU.h"
# End Source File
# Begin Source File
SOURCE="N64 System\C Core\tlb Display.h"
# End Source File
# Begin Source File
SOURCE="N64 System\C Core\Tlb.h"
# End Source File
# Begin Source File
SOURCE="N64 System\C Core\Win32Timer.h"
# End Source File
# Begin Source File
SOURCE="N64 System\C Core\X86.h"
# End Source File
# End Group
# Begin Group "Debugger Headers"

View File

@ -1,5 +1,4 @@
#include "..\support.h"
#include "..\Settings.h"
#include "stdafx.h"
int CGuiSettings::m_RefCount = 0;
bool CGuiSettings::m_bCPURunning;

View File

@ -1,5 +1,4 @@
#include "..\support.h"
#include "..\Settings.h"
#include "stdafx.h"
int CN64SystemSettings::m_RefCount = 0;

View File

@ -1,5 +1,4 @@
#include "..\Settings.h"
#include "Notification Settings.h"
#include "stdafx.h"
bool CNotificationSettings::m_bInFullScreen = false;

View File

@ -1,5 +1,4 @@
#pragma once
#include "..\Settings.h"
#include "stdafx.h"
bool CRecompilerSettings::m_bShowRecompMemSize;
bool CRecompilerSettings::m_bSMM_Protect;

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,4 @@
#include "..\..\Settings.h"
#include "..\..\User Interface.h"
#include "stdafx.h"
#include "SettingsType-Application.h"
bool CSettingTypeApplication::m_UseRegistry = false;

View File

@ -1,5 +1,4 @@
#include "..\..\Settings.h"
#include "..\..\User Interface.h"
#include "stdafx.h"
#include "SettingsType-Application.h"
#include "SettingsType-ApplicationIndex.h"

View File

@ -1,5 +1,4 @@
#include "..\..\Settings.h"
#include "..\..\User Interface.h"
#include "stdafx.h"
#include "SettingsType-Cheats.h"
CIniFile * CSettingTypeCheats::m_CheatIniFile = NULL;

View File

@ -1,5 +1,4 @@
#include "..\..\Settings.h"
#include "..\..\User Interface.h"
#include "stdafx.h"
#include "SettingsType-Application.h"
#include "SettingsType-GameSetting.h"

View File

@ -1,5 +1,4 @@
#include "..\..\Settings.h"
#include "..\..\User Interface.h"
#include "stdafx.h"
#include "SettingsType-Application.h"
#include "SettingsType-GameSetting.h"
#include "SettingsType-GameSettingIndex.h"

View File

@ -1,5 +1,4 @@
#include "..\..\Settings.h"
#include "..\..\User Interface.h"
#include "stdafx.h"
#include "SettingsType-RomDatabase.h"
#include "SettingsType-RDBCpuType.h"

View File

@ -1,5 +1,4 @@
#include "..\..\Settings.h"
#include "..\..\User Interface.h"
#include "stdafx.h"
#include "SettingsType-RomDatabase.h"
#include "SettingsType-RDBOnOff.h"

View File

@ -1,5 +1,4 @@
#include "..\..\Settings.h"
#include "..\..\User Interface.h"
#include "stdafx.h"
#include "SettingsType-RomDatabase.h"
#include "SettingsType-RDBRamSize.h"

View File

@ -1,5 +1,4 @@
#include "..\..\Settings.h"
#include "..\..\User Interface.h"
#include "stdafx.h"
#include "SettingsType-RomDatabase.h"
#include "SettingsType-RDBSaveChip.h"

View File

@ -1,5 +1,4 @@
#include "..\..\Settings.h"
#include "..\..\User Interface.h"
#include "stdafx.h"
#include "SettingsType-RomDatabase.h"
#include "SettingsType-RDBYesNo.h"

View File

@ -1,5 +1,4 @@
#include "..\..\Settings.h"
#include "..\..\User Interface.h"
#include "stdafx.h"
#include "SettingsType-RelativePath.h"
CSettingTypeRelativePath::CSettingTypeRelativePath(LPCSTR Path, LPCSTR FileName)

View File

@ -1,5 +1,4 @@
#include "..\..\Settings.h"
#include "..\..\User Interface.h"
#include "stdafx.h"
#include "SettingsType-RomDatabase.h"
CIniFile * CSettingTypeRomDatabase::m_SettingsIniFile = NULL;

View File

@ -1,5 +1,4 @@
#include "..\..\Settings.h"
#include "..\..\User Interface.h"
#include "stdafx.h"
#include "SettingsType-RomDatabase.h"
#include "SettingsType-RomDatabaseIndex.h"

View File

@ -1,5 +1,4 @@
#include "..\..\Settings.h"
#include "..\..\User Interface.h"
#include "stdafx.h"
#include "SettingsType-SelectedDirectory.h"

View File

@ -1,5 +1,4 @@
#include "..\..\Settings.h"
#include "..\..\User Interface.h"
#include "stdafx.h"
#include "SettingsType-TempBool.h"
CSettingTypeTempBool::CSettingTypeTempBool(bool initialValue) :

View File

@ -1,5 +1,4 @@
#include "..\..\Settings.h"
#include "..\..\User Interface.h"
#include "stdafx.h"
#include "SettingsType-TempNumber.h"
CSettingTypeTempNumber::CSettingTypeTempNumber(ULONG initialValue) :

View File

@ -1,5 +1,4 @@
#include "..\..\Settings.h"
#include "..\..\User Interface.h"
#include "stdafx.h"
#include "SettingsType-TempString.h"
CSettingTypeTempString::CSettingTypeTempString(LPCSTR initialValue) :

View File

@ -50,7 +50,6 @@ class CN64System;
#include ".\\User Interface\\Main Menu Class.h"
#include ".\\User Interface\\Notification Class.h"
#include ".\\User Interface\\Frame Per Second Class.h"
#include ".\\User Interface\\Cheats.h"
#include ".\\User Interface\\resource.h"
#include ".\\User Interface\\Settings Config.h"

View File

@ -1,5 +0,0 @@
#include "..\\User Interface.h"
#include "..\\N64 System.h"
#include <Windows.h>

View File

@ -1,7 +1,4 @@
#include "..\\User Interface.h"
#include "../N64 System/N64 Types.h"
#include <windows.h> //for QueryPerformanceCounter
#include "stdafx.h"
CFramePerSecond::CFramePerSecond (CNotification * Notification):
_Notify(Notification)

View File

@ -1,10 +1,5 @@
#include "..\\User Interface.h"
#include "..\\N64 System.h"
#include "..\\Plugin.h"
#include "..\\User Interface\\Settings Config.h"
#include <windows.h>
#include "stdafx.h"
#include "..\\3rd Party\\HTML Help\\HTMLHELP.H"
#include <common/CriticalSection.h>
CMainMenu::CMainMenu ( CMainGui * hMainWindow ):
CBaseMenu(),

View File

@ -1,5 +1,4 @@
#include "..\\User Interface.h"
#include <windows.h>
#include "stdafx.h"
CBaseMenu::CBaseMenu () :
m_MenuHandle((MENU_HANDLE)CreateMenu())

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