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

This commit is contained in:
zilmar 2010-06-17 11:01:42 +00:00
parent 7bbfde5297
commit a67155f8e4
27 changed files with 3 additions and 5804 deletions

View File

@ -1,5 +1,6 @@
#include "stdafx.h"
#ifdef tofix
/*
* Project 64 - A Nintendo 64 emulator.
*
@ -542,4 +543,6 @@ void UpdateBP_FunctionList (void) {
UpdateBPointGUI();
}
#endif
#endif
#endif

View File

@ -3,8 +3,6 @@
#include "Plugin.h"
#include "Logging.h"
#include "CPU Log.h"
#include "sram.h"
#include "flashram.h"
//settings
BOOL g_ShowUnhandledMemory = false, g_ShowCPUPer = false, g_ShowTLBMisses = false, g_UseTlb = true,
@ -15,7 +13,6 @@ BOOL g_ShowUnhandledMemory = false, g_ShowCPUPer = false, g_ShowTLBMisses = fals
DWORD g_RomFileSize = 0, g_CountPerOp = 2, g_ViRefreshRate = 1500;
enum CPU_TYPE g_CPU_Type;
enum SAVE_CHIP_TYPE g_SaveUsing;
enum CICChip g_CicChip;
enum FUNC_LOOKUP_METHOD g_LookUpMode;
char g_RomName [300];
@ -302,8 +299,6 @@ void ResetX86Logs ( void )
void CloseSaveChips ( void )
{
CloseMempak();
CloseSram();
CloseFlashRam();
}
void SyncToPC (void) {

View File

@ -73,7 +73,6 @@ extern BOOL g_ShowUnhandledMemory, g_ShowCPUPer, g_ShowTLBMisses, g_UseTlb,
extern DWORD g_RomFileSize, g_CountPerOp;
extern enum CPU_TYPE g_CPU_Type;
extern enum SAVE_CHIP_TYPE g_SaveUsing;
extern enum CICChip g_CicChip;
extern enum FUNC_LOOKUP_METHOD g_LookUpMode;
extern char g_RomName [300];

View File

@ -29,8 +29,6 @@
//#if (!defined(EXTERNAL_RELEASE))
#include <windows.h>
#include <stdio.h>
#include "main.h"
#include "debugger.h"
#ifdef Log_x86Code

View File

@ -1,19 +0,0 @@
#include <windows.h>
#include "Plugin.h"
#include "..\\Types.h"
#include "r4300i Commands.h"
#include "DMA.h"
#include "sram.h"
#include "flashram.h"
#include "mempak.h"
#include "pif.h"
extern DWORD JumpToLocation;
extern BOOL TestTimer;
int DelaySlotEffectsCompare ( DWORD PC, DWORD Reg1, DWORD Reg2 );
int DelaySlotEffectsJump (DWORD JumpPC);
void InPermLoop ( void );
void DisplayFPS ( void );

View File

@ -1,3 +0,0 @@
#include "..\\Types.h"
extern BOOL g_IndvidualBlock, g_Profiling;

View File

@ -1,39 +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.
*
*/
#if (!defined(EXTERNAL_RELEASE))
#include "Main.h"
#include "BreakPoints.h"
#include "R4300i Registers.h"
#include "R4300i Memory.h"
#include "Logging.h"
//#include "Reverse Code.h"
#endif
#include "R4300i Commands.h"
//#include "mapping.h"
#include "CPU Log.h"

View File

@ -1,218 +0,0 @@
#include "stdafx.h"
#include "Sram.h"
#include "Flashram.h"
void OnFirstDMA (void) {
switch (g_CicChip) {
case 1: *(DWORD *)&((_MMU->Rdram())[0x318]) = g_RdramSize; break;
case 2: *(DWORD *)&((_MMU->Rdram())[0x318]) = g_RdramSize; break;
case 3: *(DWORD *)&((_MMU->Rdram())[0x318]) = g_RdramSize; break;
case 5: *(DWORD *)&((_MMU->Rdram())[0x3F0]) = g_RdramSize; break;
case 6: *(DWORD *)&((_MMU->Rdram())[0x318]) = g_RdramSize; break;
default: DisplayError("Unhandled g_CicChip(%d) in first DMA",g_CicChip);
}
}
void PI_DMA_READ (void) {
// PI_STATUS_REG |= PI_STATUS_DMA_BUSY;
if ( _Reg->PI_DRAM_ADDR_REG + _Reg->PI_RD_LEN_REG + 1 > g_RdramSize) {
#ifndef EXTERNAL_RELEASE
DisplayError("PI_DMA_READ not in Memory");
#endif
_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
_Reg->MI_INTR_REG |= MI_INTR_PI;
_Reg->CheckInterrupts();
return;
}
if ( _Reg->PI_CART_ADDR_REG >= 0x08000000 && _Reg->PI_CART_ADDR_REG <= 0x08010000) {
if (g_SaveUsing == SaveChip_Auto) { g_SaveUsing = SaveChip_Sram; }
if (g_SaveUsing == SaveChip_Sram) {
DmaToSram(
_MMU->Rdram() + _Reg->PI_DRAM_ADDR_REG,
_Reg->PI_CART_ADDR_REG - 0x08000000,
_Reg->PI_RD_LEN_REG + 1
);
_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
_Reg->MI_INTR_REG |= MI_INTR_PI;
_Reg->CheckInterrupts();
return;
}
if (g_SaveUsing == SaveChip_FlashRam) {
DmaToFlashram(
_MMU->Rdram()+_Reg->PI_DRAM_ADDR_REG,
_Reg->PI_CART_ADDR_REG - 0x08000000,
_Reg->PI_WR_LEN_REG + 1
);
_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
_Reg->MI_INTR_REG |= MI_INTR_PI;
_Reg->CheckInterrupts();
return;
}
}
if (g_SaveUsing == SaveChip_FlashRam) {
#ifndef EXTERNAL_RELEASE
DisplayError("**** FLashRam DMA Read address %X *****",_Reg->PI_CART_ADDR_REG);
#endif
_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
_Reg->MI_INTR_REG |= MI_INTR_PI;
_Reg->CheckInterrupts();
return;
}
#ifndef EXTERNAL_RELEASE
DisplayError("PI_DMA_READ where are you dmaing to ?");
#endif
_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
_Reg->MI_INTR_REG |= MI_INTR_PI;
_Reg->CheckInterrupts();
return;
}
void PI_DMA_WRITE (void) {
_Reg->PI_STATUS_REG |= PI_STATUS_DMA_BUSY;
if ( _Reg->PI_DRAM_ADDR_REG + _Reg->PI_WR_LEN_REG + 1 > g_RdramSize)
{
if (g_ShowUnhandledMemory) { DisplayError("PI_DMA_WRITE not in Memory"); }
_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
_Reg->MI_INTR_REG |= MI_INTR_PI;
_Reg->CheckInterrupts();
return;
}
if ( _Reg->PI_CART_ADDR_REG >= 0x08000000 && _Reg->PI_CART_ADDR_REG <= 0x08010000) {
if (g_SaveUsing == SaveChip_Auto) { g_SaveUsing = SaveChip_Sram; }
if (g_SaveUsing == SaveChip_Sram) {
DmaFromSram(
_MMU->Rdram()+_Reg->PI_DRAM_ADDR_REG,
_Reg->PI_CART_ADDR_REG - 0x08000000,
_Reg->PI_WR_LEN_REG + 1
);
_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
_Reg->MI_INTR_REG |= MI_INTR_PI;
_Reg->CheckInterrupts();
return;
}
if (g_SaveUsing == SaveChip_FlashRam) {
DmaFromFlashram(
_MMU->Rdram()+_Reg->PI_DRAM_ADDR_REG,
_Reg->PI_CART_ADDR_REG - 0x08000000,
_Reg->PI_WR_LEN_REG + 1
);
_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
_Reg->MI_INTR_REG |= MI_INTR_PI;
_Reg->CheckInterrupts();
}
return;
}
if ( _Reg->PI_CART_ADDR_REG >= 0x10000000 && _Reg->PI_CART_ADDR_REG <= 0x1FBFFFFF) {
DWORD i;
#ifdef tofix
#ifdef ROM_IN_MAPSPACE
if (WrittenToRom) {
DWORD OldProtect;
VirtualProtect(ROM,g_RomFileSize,PAGE_READONLY, &OldProtect);
}
#endif
#endif
BYTE * ROM = _Rom->GetRomAddress();
BYTE * RDRAM = _MMU->Rdram();
_Reg->PI_CART_ADDR_REG -= 0x10000000;
if (_Reg->PI_CART_ADDR_REG + _Reg->PI_WR_LEN_REG + 1 < g_RomFileSize) {
for (i = 0; i < _Reg->PI_WR_LEN_REG + 1; i ++) {
*(RDRAM+((_Reg->PI_DRAM_ADDR_REG + i) ^ 3)) = *(ROM+((_Reg->PI_CART_ADDR_REG + i) ^ 3));
}
} else {
DWORD Len;
Len = g_RomFileSize - _Reg->PI_CART_ADDR_REG;
for (i = 0; i < Len; i ++) {
*(RDRAM+((_Reg->PI_DRAM_ADDR_REG + i) ^ 3)) = *(ROM+((_Reg->PI_CART_ADDR_REG + i) ^ 3));
}
for (i = Len; i < _Reg->PI_WR_LEN_REG + 1 - Len; i ++) {
*(RDRAM+((_Reg->PI_DRAM_ADDR_REG + i) ^ 3)) = 0;
}
}
_Reg->PI_CART_ADDR_REG += 0x10000000;
if (!_System->DmaUsed())
{
_System->SetDmaUsed(true);
OnFirstDMA();
}
if (_Recompiler && _Recompiler->bSMM_PIDMA())
{
_Recompiler->ClearRecompCode_Phys(_Reg->PI_DRAM_ADDR_REG, _Reg->PI_WR_LEN_REG,CRecompiler::Remove_DMA);
}
_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
_Reg->MI_INTR_REG |= MI_INTR_PI;
_Reg->CheckInterrupts();
//ChangeTimer(PiTimer,(int)(PI_WR_LEN_REG * 8.9) + 50);
//ChangeTimer(PiTimer,(int)(PI_WR_LEN_REG * 8.9));
return;
}
if (g_ShowUnhandledMemory) { DisplayError("PI_DMA_WRITE not in ROM"); }
_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
_Reg->MI_INTR_REG |= MI_INTR_PI;
_Reg->CheckInterrupts();
}
void SP_DMA_READ (void) {
_Reg->SP_DRAM_ADDR_REG &= 0x1FFFFFFF;
if (_Reg->SP_DRAM_ADDR_REG > g_RdramSize) {
#ifndef EXTERNAL_RELEASE
DisplayError("SP DMA\nSP_DRAM_ADDR_REG not in RDRam space");
#endif
_Reg->SP_DMA_BUSY_REG = 0;
_Reg->SP_STATUS_REG &= ~SP_STATUS_DMA_BUSY;
return;
}
if (_Reg->SP_RD_LEN_REG + 1 + (_Reg->SP_MEM_ADDR_REG & 0xFFF) > 0x1000) {
#ifndef EXTERNAL_RELEASE
DisplayError("SP DMA\ncould not fit copy in memory segement");
#endif
return;
}
if ((_Reg->SP_MEM_ADDR_REG & 3) != 0) { BreakPoint(__FILE__,__LINE__); }
if ((_Reg->SP_DRAM_ADDR_REG & 3) != 0) { BreakPoint(__FILE__,__LINE__); }
if (((_Reg->SP_RD_LEN_REG + 1) & 3) != 0) { BreakPoint(__FILE__,__LINE__); }
memcpy( _MMU->Dmem() + (_Reg->SP_MEM_ADDR_REG & 0x1FFF), _MMU->Rdram() + _Reg->SP_DRAM_ADDR_REG,
_Reg->SP_RD_LEN_REG + 1 );
_Reg->SP_DMA_BUSY_REG = 0;
_Reg->SP_STATUS_REG &= ~SP_STATUS_DMA_BUSY;
}
void SP_DMA_WRITE (void) {
if (_Reg->SP_DRAM_ADDR_REG > g_RdramSize) {
#ifndef EXTERNAL_RELEASE
DisplayError("SP DMA WRITE\nSP_DRAM_ADDR_REG not in RDRam space");
#endif
return;
}
if (_Reg->SP_WR_LEN_REG + 1 + (_Reg->SP_MEM_ADDR_REG & 0xFFF) > 0x1000) {
#ifndef EXTERNAL_RELEASE
DisplayError("SP DMA WRITE\ncould not fit copy in memory segement");
#endif
return;
}
if ((_Reg->SP_MEM_ADDR_REG & 3) != 0) { BreakPoint(__FILE__,__LINE__); }
if ((_Reg->SP_DRAM_ADDR_REG & 3) != 0) { BreakPoint(__FILE__,__LINE__); }
if (((_Reg->SP_WR_LEN_REG + 1) & 3) != 0) { BreakPoint(__FILE__,__LINE__); }
memcpy( _MMU->Rdram() + _Reg->SP_DRAM_ADDR_REG, _MMU->Dmem() + (_Reg->SP_MEM_ADDR_REG & 0x1FFF),
_Reg->SP_WR_LEN_REG + 1);
_Reg->SP_DMA_BUSY_REG = 0;
_Reg->SP_STATUS_REG &= ~SP_STATUS_DMA_BUSY;
}

View File

@ -1,33 +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 PI_DMA_READ ( void );
void PI_DMA_WRITE ( void );
void SI_DMA_READ ( void );
void SI_DMA_WRITE ( void );
void SP_DMA_READ ( void );
void SP_DMA_WRITE ( void );

View File

@ -1,12 +0,0 @@
#include "stdafx.h"
#include "Eeprom.h"
static HANDLE hEepromFile = NULL;
BYTE EEPROM[0x800];
void CloseEeprom (void) {
if (hEepromFile) {
CloseHandle(hEepromFile);
hEepromFile = NULL;
}
}

View File

@ -1,29 +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 CloseEeprom ( void );
void EepromCommand ( BYTE * Command );
void ReadFromEeprom ( BYTE * Buffer, int line);
void WriteToEeprom ( BYTE * Buffer, int line);

View File

@ -1,29 +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 "main.h"
#include "cpu.h"
#include "plugin.h"

View File

@ -1,214 +0,0 @@
#include "stdafx.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 - _MMU->Rdram(),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 - _MMU->Rdram(),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,g_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

@ -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.
*
*/
void DmaFromFlashram ( BYTE * dest, int StartOffset, int len );
void DmaToFlashram ( BYTE * Source, int StartOffset, int len );
DWORD ReadFromFlashStatus ( DWORD PAddr );
void WriteToFlashCommand ( DWORD Value );
void CloseFlashRam ( void );

File diff suppressed because it is too large Load Diff

View File

@ -1,183 +0,0 @@
typedef void (_fastcall * R4300iOp_FUNC )();
class R4300iOp32
{
public:
/************************* OpCode functions *************************/
static void _fastcall J ( void );
static void _fastcall JAL ( void );
static void _fastcall BNE ( void );
static void _fastcall BEQ ( void );
static void _fastcall BLEZ ( void );
static void _fastcall BGTZ ( void );
static void _fastcall ADDI ( void );
static void _fastcall ADDIU ( void );
static void _fastcall SLTI ( void );
static void _fastcall SLTIU ( void );
static void _fastcall ANDI ( void );
static void _fastcall ORI ( void );
static void _fastcall XORI ( void );
static void _fastcall LUI ( void );
static void _fastcall BEQL ( void );
static void _fastcall BNEL ( void );
static void _fastcall BLEZL ( void );
static void _fastcall BGTZL ( void );
static void _fastcall LB ( void );
static void _fastcall LH ( void );
static void _fastcall LWL ( void );
static void _fastcall LW ( void );
static void _fastcall LW_LOG ( void );
static void _fastcall LBU ( void );
static void _fastcall LHU ( void );
static void _fastcall LWR ( void );
static void _fastcall LWU ( void );
static void _fastcall SB ( void );
static void _fastcall SH ( void );
static void _fastcall SWL ( void );
static void _fastcall SW ( void );
static void _fastcall SWR ( void );
static void _fastcall CACHE ( void );
static void _fastcall LL ( void );
static void _fastcall LWC1 ( void );
static void _fastcall SC ( void );
static void _fastcall SWC1 ( void );
/********************** R4300i OpCodes: Special **********************/
static void _fastcall SPECIAL_SLL ( void );
static void _fastcall SPECIAL_SRL ( void );
static void _fastcall SPECIAL_SRA ( void );
static void _fastcall SPECIAL_SLLV ( void );
static void _fastcall SPECIAL_SRLV ( void );
static void _fastcall SPECIAL_SRAV ( void );
static void _fastcall SPECIAL_JR ( void );
static void _fastcall SPECIAL_JALR ( void );
static void _fastcall SPECIAL_SYSCALL ( void );
static void _fastcall SPECIAL_BREAK ( void );
static void _fastcall SPECIAL_SYNC ( void );
static void _fastcall SPECIAL_MTHI ( void );
static void _fastcall SPECIAL_MTLO ( void );
static void _fastcall SPECIAL_ADD ( void );
static void _fastcall SPECIAL_ADDU ( void );
static void _fastcall SPECIAL_SUB ( void );
static void _fastcall SPECIAL_SUBU ( void );
static void _fastcall SPECIAL_AND ( void );
static void _fastcall SPECIAL_OR ( void );
static void _fastcall SPECIAL_XOR ( void );
static void _fastcall SPECIAL_NOR ( void );
static void _fastcall SPECIAL_SLT ( void );
static void _fastcall SPECIAL_SLTU ( void );
static void _fastcall SPECIAL_TEQ ( void );
/********************** R4300i OpCodes: RegImm **********************/
static void _fastcall REGIMM_BLTZ ( void );
static void _fastcall REGIMM_BGEZ ( void );
static void _fastcall REGIMM_BLTZL ( void );
static void _fastcall REGIMM_BGEZL ( void );
static void _fastcall REGIMM_BLTZAL ( void );
static void _fastcall REGIMM_BGEZAL ( void );
/************************** COP0 functions **************************/
static void _fastcall COP0_MF ( void );
static void _fastcall COP0_MT ( void );
/************************** COP0 CO functions ***********************/
static void _fastcall COP0_CO_TLBR ( void );
static void _fastcall COP0_CO_TLBWI ( void );
static void _fastcall COP0_CO_TLBWR ( void );
static void _fastcall COP0_CO_TLBP ( void );
static void _fastcall COP0_CO_ERET ( void );
/************************** COP1 functions **************************/
static void _fastcall COP1_MF ( void );
static void _fastcall COP1_DMF ( void );
static void _fastcall COP1_CF ( void );
static void _fastcall COP1_MT ( void );
static void _fastcall COP1_DMT ( void );
static void _fastcall COP1_CT ( void );
/************************* COP1: BC1 functions ***********************/
static void _fastcall COP1_BCF ( void );
static void _fastcall COP1_BCT ( void );
static void _fastcall COP1_BCFL ( void );
static void _fastcall COP1_BCTL ( void );
/************************** COP1: S functions ************************/
static void _fastcall COP1_S_ADD ( void );
static void _fastcall COP1_S_SUB ( void );
static void _fastcall COP1_S_MUL ( void );
static void _fastcall COP1_S_DIV ( void );
static void _fastcall COP1_S_SQRT ( void );
static void _fastcall COP1_S_ABS ( void );
static void _fastcall COP1_S_MOV ( void );
static void _fastcall COP1_S_NEG ( void );
static void _fastcall COP1_S_TRUNC_L ( void );
static void _fastcall COP1_S_CEIL_L ( void ); //added by Witten
static void _fastcall COP1_S_FLOOR_L ( void ); //added by Witten
static void _fastcall COP1_S_ROUND_W ( void );
static void _fastcall COP1_S_TRUNC_W ( void );
static void _fastcall COP1_S_CEIL_W ( void ); //added by Witten
static void _fastcall COP1_S_FLOOR_W ( void );
static void _fastcall COP1_S_CVT_D ( void );
static void _fastcall COP1_S_CVT_W ( void );
static void _fastcall COP1_S_CVT_L ( void );
static void _fastcall COP1_S_CMP ( void );
/************************** COP1: D functions ************************/
static void _fastcall COP1_D_ADD ( void );
static void _fastcall COP1_D_SUB ( void );
static void _fastcall COP1_D_MUL ( void );
static void _fastcall COP1_D_DIV ( void );
static void _fastcall COP1_D_SQRT ( void );
static void _fastcall COP1_D_ABS ( void );
static void _fastcall COP1_D_MOV ( void );
static void _fastcall COP1_D_NEG ( void );
static void _fastcall COP1_D_TRUNC_L ( void ); //added by Witten
static void _fastcall COP1_D_CEIL_L ( void ); //added by Witten
static void _fastcall COP1_D_FLOOR_L ( void ); //added by Witten
static void _fastcall COP1_D_ROUND_W ( void );
static void _fastcall COP1_D_TRUNC_W ( void );
static void _fastcall COP1_D_CEIL_W ( void ); //added by Witten
static void _fastcall COP1_D_FLOOR_W ( void ); //added by Witten
static void _fastcall COP1_D_CVT_S ( void );
static void _fastcall COP1_D_CVT_W ( void );
static void _fastcall COP1_D_CVT_L ( void );
static void _fastcall COP1_D_CMP ( void );
/************************** COP1: W functions ************************/
static void _fastcall COP1_W_CVT_S ( void );
static void _fastcall COP1_W_CVT_D ( void );
/************************** COP1: L functions ************************/
static void _fastcall COP1_L_CVT_S ( void );
static void _fastcall COP1_L_CVT_D ( void );
/************************** Other functions **************************/
static void _fastcall UnknownOpcode ( void );
static R4300iOp_FUNC * BuildInterpreter (void );
private:
static void _fastcall SPECIAL (void);
static void _fastcall REGIMM (void);
static void _fastcall COP0 (void);
static void _fastcall COP0_CO (void);
static void _fastcall COP1 (void);
static void _fastcall COP1_BC (void);
static void _fastcall COP1_S (void);
static void _fastcall COP1_D (void);
static void _fastcall COP1_W (void);
static void _fastcall COP1_L (void);
static R4300iOp_FUNC Jump_Opcode[64];
static R4300iOp_FUNC Jump_Special[64];
static R4300iOp_FUNC Jump_Regimm[32];
static R4300iOp_FUNC Jump_CoP0[32];
static R4300iOp_FUNC Jump_CoP0_Function[64];
static R4300iOp_FUNC Jump_CoP1[32];
static R4300iOp_FUNC Jump_CoP1_BC[32];
static R4300iOp_FUNC Jump_CoP1_S[64];
static R4300iOp_FUNC Jump_CoP1_D[64];
static R4300iOp_FUNC Jump_CoP1_W[64];
static R4300iOp_FUNC Jump_CoP1_L[64];
};

File diff suppressed because it is too large Load Diff

View File

@ -1,238 +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.
*
*/
class R4300iOp
{
public:
/************************* OpCode functions *************************/
static void _fastcall J ( void );
static void _fastcall JAL ( void );
static void _fastcall BNE ( void );
static void _fastcall BEQ ( void );
static void _fastcall BLEZ ( void );
static void _fastcall BGTZ ( void );
static void _fastcall ADDI ( void );
static void _fastcall ADDIU ( void );
static void _fastcall SLTI ( void );
static void _fastcall SLTIU ( void );
static void _fastcall ANDI ( void );
static void _fastcall ORI ( void );
static void _fastcall XORI ( void );
static void _fastcall LUI ( void );
static void _fastcall BEQL ( void );
static void _fastcall BNEL ( void );
static void _fastcall BLEZL ( void );
static void _fastcall BGTZL ( void );
static void _fastcall DADDIU ( void );
static void _fastcall LDL ( void );
static void _fastcall LDR ( void );
static void _fastcall LB ( void );
static void _fastcall LH ( void );
static void _fastcall LWL ( void );
static void _fastcall LW ( void );
static void _fastcall LBU ( void );
static void _fastcall LHU ( void );
static void _fastcall LWR ( void );
static void _fastcall LWU ( void );
static void _fastcall SB ( void );
static void _fastcall SH ( void );
static void _fastcall SWL ( void );
static void _fastcall SW ( void );
static void _fastcall SDL ( void );
static void _fastcall SDR ( void );
static void _fastcall SWR ( void );
static void _fastcall CACHE ( void );
static void _fastcall LL ( void );
static void _fastcall LWC1 ( void );
static void _fastcall LDC1 ( void );
static void _fastcall LD ( void );
static void _fastcall SC ( void );
static void _fastcall SWC1 ( void );
static void _fastcall SDC1 ( void );
static void _fastcall SD ( void );
/********************** R4300i OpCodes: Special **********************/
static void _fastcall SPECIAL_SLL ( void );
static void _fastcall SPECIAL_SRL ( void );
static void _fastcall SPECIAL_SRA ( void );
static void _fastcall SPECIAL_SLLV ( void );
static void _fastcall SPECIAL_SRLV ( void );
static void _fastcall SPECIAL_SRAV ( void );
static void _fastcall SPECIAL_JR ( void );
static void _fastcall SPECIAL_JALR ( void );
static void _fastcall SPECIAL_SYSCALL ( void );
static void _fastcall SPECIAL_BREAK ( void );
static void _fastcall SPECIAL_SYNC ( void );
static void _fastcall SPECIAL_MFHI ( void );
static void _fastcall SPECIAL_MTHI ( void );
static void _fastcall SPECIAL_MFLO ( void );
static void _fastcall SPECIAL_MTLO ( void );
static void _fastcall SPECIAL_DSLLV ( void );
static void _fastcall SPECIAL_DSRLV ( void );
static void _fastcall SPECIAL_DSRAV ( void );
static void _fastcall SPECIAL_MULT ( void );
static void _fastcall SPECIAL_MULTU ( void );
static void _fastcall SPECIAL_DIV ( void );
static void _fastcall SPECIAL_DIVU ( void );
static void _fastcall SPECIAL_DMULT ( void );
static void _fastcall SPECIAL_DMULTU ( void );
static void _fastcall SPECIAL_DDIV ( void );
static void _fastcall SPECIAL_DDIVU ( void );
static void _fastcall SPECIAL_ADD ( void );
static void _fastcall SPECIAL_ADDU ( void );
static void _fastcall SPECIAL_SUB ( void );
static void _fastcall SPECIAL_SUBU ( void );
static void _fastcall SPECIAL_AND ( void );
static void _fastcall SPECIAL_OR ( void );
static void _fastcall SPECIAL_XOR ( void );
static void _fastcall SPECIAL_NOR ( void );
static void _fastcall SPECIAL_SLT ( void );
static void _fastcall SPECIAL_SLTU ( void );
static void _fastcall SPECIAL_DADD ( void );
static void _fastcall SPECIAL_DADDU ( void );
static void _fastcall SPECIAL_DSUB ( void );
static void _fastcall SPECIAL_DSUBU ( void );
static void _fastcall SPECIAL_TEQ ( void );
static void _fastcall SPECIAL_DSLL ( void );
static void _fastcall SPECIAL_DSRL ( void );
static void _fastcall SPECIAL_DSRA ( void );
static void _fastcall SPECIAL_DSLL32 ( void );
static void _fastcall SPECIAL_DSRL32 ( void );
static void _fastcall SPECIAL_DSRA32 ( void );
/********************** R4300i OpCodes: RegImm **********************/
static void _fastcall REGIMM_BLTZ ( void );
static void _fastcall REGIMM_BGEZ ( void );
static void _fastcall REGIMM_BLTZL ( void );
static void _fastcall REGIMM_BGEZL ( void );
static void _fastcall REGIMM_BLTZAL ( void );
static void _fastcall REGIMM_BGEZAL ( void );
/************************** COP0 functions **************************/
static void _fastcall COP0_MF ( void );
static void _fastcall COP0_MT ( void );
/************************** COP0 CO functions ***********************/
static void _fastcall COP0_CO_TLBR ( void );
static void _fastcall COP0_CO_TLBWI ( void );
static void _fastcall COP0_CO_TLBWR ( void );
static void _fastcall COP0_CO_TLBP ( void );
static void _fastcall COP0_CO_ERET ( void );
/************************** COP1 functions **************************/
static void _fastcall COP1_MF ( void );
static void _fastcall COP1_DMF ( void );
static void _fastcall COP1_CF ( void );
static void _fastcall COP1_MT ( void );
static void _fastcall COP1_DMT ( void );
static void _fastcall COP1_CT ( void );
/************************* COP1: BC1 functions ***********************/
static void _fastcall COP1_BCF ( void );
static void _fastcall COP1_BCT ( void );
static void _fastcall COP1_BCFL ( void );
static void _fastcall COP1_BCTL ( void );
/************************** COP1: S functions ************************/
static void _fastcall COP1_S_ADD ( void );
static void _fastcall COP1_S_SUB ( void );
static void _fastcall COP1_S_MUL ( void );
static void _fastcall COP1_S_DIV ( void );
static void _fastcall COP1_S_SQRT ( void );
static void _fastcall COP1_S_ABS ( void );
static void _fastcall COP1_S_MOV ( void );
static void _fastcall COP1_S_NEG ( void );
static void _fastcall COP1_S_TRUNC_L ( void );
static void _fastcall COP1_S_CEIL_L ( void ); //added by Witten
static void _fastcall COP1_S_FLOOR_L ( void ); //added by Witten
static void _fastcall COP1_S_ROUND_W ( void );
static void _fastcall COP1_S_TRUNC_W ( void );
static void _fastcall COP1_S_CEIL_W ( void ); //added by Witten
static void _fastcall COP1_S_FLOOR_W ( void );
static void _fastcall COP1_S_CVT_D ( void );
static void _fastcall COP1_S_CVT_W ( void );
static void _fastcall COP1_S_CVT_L ( void );
static void _fastcall COP1_S_CMP ( void );
/************************** COP1: D functions ************************/
static void _fastcall COP1_D_ADD ( void );
static void _fastcall COP1_D_SUB ( void );
static void _fastcall COP1_D_MUL ( void );
static void _fastcall COP1_D_DIV ( void );
static void _fastcall COP1_D_SQRT ( void );
static void _fastcall COP1_D_ABS ( void );
static void _fastcall COP1_D_MOV ( void );
static void _fastcall COP1_D_NEG ( void );
static void _fastcall COP1_D_TRUNC_L ( void ); //added by Witten
static void _fastcall COP1_D_CEIL_L ( void ); //added by Witten
static void _fastcall COP1_D_FLOOR_L ( void ); //added by Witten
static void _fastcall COP1_D_ROUND_W ( void );
static void _fastcall COP1_D_TRUNC_W ( void );
static void _fastcall COP1_D_CEIL_W ( void ); //added by Witten
static void _fastcall COP1_D_FLOOR_W ( void ); //added by Witten
static void _fastcall COP1_D_CVT_S ( void );
static void _fastcall COP1_D_CVT_W ( void );
static void _fastcall COP1_D_CVT_L ( void );
static void _fastcall COP1_D_CMP ( void );
/************************** COP1: W functions ************************/
static void _fastcall COP1_W_CVT_S ( void );
static void _fastcall COP1_W_CVT_D ( void );
/************************** COP1: L functions ************************/
static void _fastcall COP1_L_CVT_S ( void );
static void _fastcall COP1_L_CVT_D ( void );
/************************** Other functions **************************/
static void _fastcall UnknownOpcode ( void );
static R4300iOp_FUNC * BuildInterpreter (void );
private:
static void _fastcall SPECIAL (void);
static void _fastcall REGIMM (void);
static void _fastcall COP0 (void);
static void _fastcall COP0_CO (void);
static void _fastcall COP1 (void);
static void _fastcall COP1_BC (void);
static void _fastcall COP1_S (void);
static void _fastcall COP1_D (void);
static void _fastcall COP1_W (void);
static void _fastcall COP1_L (void);
static R4300iOp_FUNC Jump_Opcode[64];
static R4300iOp_FUNC Jump_Special[64];
static R4300iOp_FUNC Jump_Regimm[32];
static R4300iOp_FUNC Jump_CoP0[32];
static R4300iOp_FUNC Jump_CoP0_Function[64];
static R4300iOp_FUNC Jump_CoP1[32];
static R4300iOp_FUNC Jump_CoP1_BC[32];
static R4300iOp_FUNC Jump_CoP1_S[64];
static R4300iOp_FUNC Jump_CoP1_D[64];
static R4300iOp_FUNC Jump_CoP1_W[64];
static R4300iOp_FUNC Jump_CoP1_L[64];
};

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.
*
*/
#ifndef __main_h
#define __main_h
#include <common/memtest.h>
#include "..\N64 Types.h"
#include "..\\Types.h"
#include "plugin.h"
#include "..\\..\\Multilanguage.h"
#include "win32Timer.h"
int GetStoredWinPos ( char * WinName, DWORD * X, DWORD * Y );
void StoreCurrentWinPos ( char * WinName, HANDLE hWnd );
//#define OLD_CODE
#endif

View File

@ -1,122 +0,0 @@
#include "stdafx.h"
#ifdef toremove
#include "Eeprom.h"
#include "mempak.h"
void ProcessControllerCommand ( int Control, BYTE * Command);
void ReadControllerCommand (int Control, BYTE * Command);
#define IncreaseMaxPif2 300
int MaxPif2Cmds = 300;
unsigned __int64 * Pif2Reply[4];
BOOLEAN pif2valid = FALSE;
void LoadPIF2 () {
CPath Pif2FileName(CPath::MODULE_DIRECTORY,"pif2.dat");
FILE *pif2db = fopen (Pif2FileName, "rt");
// unsigned __int64 p1, p2, r1, r2;
char buff[255];
int cnt = 0;
Pif2Reply[0] = new unsigned __int64[MaxPif2Cmds + 1];
Pif2Reply[1] = new unsigned __int64[MaxPif2Cmds + 1];
Pif2Reply[2] = new unsigned __int64[MaxPif2Cmds + 1];
Pif2Reply[3] = new unsigned __int64[MaxPif2Cmds + 1];
if (Pif2Reply[0] == NULL || Pif2Reply[1] == NULL ||
Pif2Reply[2] == NULL || Pif2Reply[3] == NULL)
{
DisplayError(GS(MSG_MEM_ALLOC_ERROR));
ExitThread(0);
}
if (pif2db == NULL) {
Pif2Reply[0][0] = -1; Pif2Reply[1][0] = -1;
Pif2Reply[2][0] = -1; Pif2Reply[3][0] = -1;
return;
}
while (feof (pif2db) == 0) {
if (cnt == MaxPif2Cmds) {
/*MaxPif2Cmds += IncreaseMaxPif2;
Pif2Reply[0] = realloc(Pif2Reply[0],(MaxPif2Cmds + 1) * sizeof(__int64));
Pif2Reply[1] = realloc(Pif2Reply[1],(MaxPif2Cmds + 1) * sizeof(__int64));
Pif2Reply[2] = realloc(Pif2Reply[2],(MaxPif2Cmds + 1) * sizeof(__int64));
Pif2Reply[3] = realloc(Pif2Reply[3],(MaxPif2Cmds + 1) * sizeof(__int64));
if (Pif2Reply[0] == NULL || Pif2Reply[1] == NULL ||
Pif2Reply[2] == NULL || Pif2Reply[3] == NULL)
{*/
DisplayError(GS(MSG_MEM_ALLOC_ERROR));
ExitThread(0);
//}
}
fgets (buff, 255, pif2db);
if (buff[0] != ';') {
if (buff[0] != '\n') {
sscanf (buff, "0x%08X%08X, 0x%08X%08X, 0x%08X%08X, 0x%08X%08X",
((DWORD *)&Pif2Reply[0][cnt])+1, &Pif2Reply[0][cnt],
((DWORD *)&Pif2Reply[1][cnt])+1, &Pif2Reply[1][cnt],
((DWORD *)&Pif2Reply[2][cnt])+1, &Pif2Reply[2][cnt],
((DWORD *)&Pif2Reply[3][cnt])+1, &Pif2Reply[3][cnt]);
cnt++;
}
}
}
Pif2Reply[0][cnt] = Pif2Reply[1][cnt] = Pif2Reply[2][cnt] = Pif2Reply[3][cnt] = -1;
pif2valid = TRUE;
fclose (pif2db);
}
int LoadPifRom(int country) {
char path_buffer[_MAX_PATH], drive[_MAX_DRIVE] ,dir[_MAX_DIR];
char fname[_MAX_FNAME],ext[_MAX_EXT], PifRomName[255];
HANDLE hPifFile;
DWORD dwRead;
GetModuleFileName(NULL,path_buffer,sizeof(path_buffer));
_splitpath( path_buffer, drive, dir, fname, ext );
switch (country) {
case 0x44: //Germany
case 0x46: //french
case 0x49: //Italian
case 0x50: //Europe
case 0x53: //Spanish
case 0x55: //Australia
case 0x58: // X (PAL)
case 0x59: // X (PAL)
sprintf(PifRomName,"%s%sPifrom\\pifpal.raw",drive,dir);
break;
case 0: //None
case 0x37: // 7 (Beta)
case 0x41: // ????
case 0x45: //USA
case 0x4A: //Japan
sprintf(PifRomName,"%s%sPifrom\\pifntsc.raw",drive,dir);
break;
default:
DisplayError(GS(MSG_UNKNOWN_COUNTRY));
}
hPifFile = CreateFile(PifRomName,GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS, NULL);
if (hPifFile == INVALID_HANDLE_VALUE) {
memset(PifRom,0,0x7C0);
return FALSE;
}
SetFilePointer(hPifFile,0,NULL,FILE_BEGIN);
ReadFile(hPifFile,PifRom,0x7C0,&dwRead,NULL);
CloseHandle( hPifFile );
return TRUE;
}
#endif

View File

@ -1,40 +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.
*
*/
#ifdef __cplusplus
extern "C" {
#endif
extern BYTE PifRom[0x7C0];
int LoadPifRom ( int country );
void PifRamWrite ( void );
void PifRamRead ( void );
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,212 +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 <commctrl.h>
#include <stdio.h>
#include "main.h"
typedef struct {
char Label[100];
_int64 TimeTotal;
} TIME_STAMP_ENTRY;
DWORD StartTimeHi, StartTimeLo, StopTimeHi, StopTimeLo, TSE_Count, TSE_Max;
TIME_STAMP_ENTRY * TS_Entries = NULL;
char ProfilingLabel[100];
float CPUPercent[3][15];
int CurrentPercent = 0;
void ResetTimerList (void) {
if (TS_Entries) { free(TS_Entries); }
TS_Entries = NULL;
TSE_Count = 0;
TSE_Max = 0;
}
void SortTimerList(void) {
BOOL Changed;
DWORD i, n;
for (i = 1; i < TSE_Count; i++) {
Changed = FALSE;
for (n = 0; n < TSE_Count - i; n++) {
if (strcmp(TS_Entries[n].Label, TS_Entries[n+1].Label) > 0) {
TIME_STAMP_ENTRY TempEntry;
memcpy(&TempEntry,&TS_Entries[n],sizeof(TIME_STAMP_ENTRY));
memcpy(&TS_Entries[n],&TS_Entries[n+1],sizeof(TIME_STAMP_ENTRY));
memcpy(&TS_Entries[n + 1],&TempEntry,sizeof(TIME_STAMP_ENTRY));
Changed = TRUE;
}
}
if (!Changed) { return; }
}
}
int SearchTimerList(char * Key) {
int low = 0;
int high = TSE_Count -1;
int middle;
int cmp;
while (low <= high) {
middle = (low + high)/2;
cmp = strcmp(Key,TS_Entries[middle].Label);
if (cmp == 0) { return middle; }
if (cmp > 0) {
low = middle + 1;
} else {
high = middle - 1;
}
}
return TSE_Count;
}
void StartTimer (char * Label) {
if (Label == NULL) { BreakPoint(__FILE__,__LINE__); }
StopTimer();
strcpy(ProfilingLabel,Label);
_asm {
pushad
rdtsc
mov StartTimeHi, edx
mov StartTimeLo, eax
popad
}
}
void StopTimer (void) {
DWORD count;
_asm {
pushad
rdtsc
mov StopTimeHi, edx
mov StopTimeLo, eax
popad
}
if (strlen(ProfilingLabel) == 0) { return; }
count = SearchTimerList(ProfilingLabel);
if (count < TSE_Count) {
_int64 Time = ((unsigned _int64)StopTimeHi << 32) + (unsigned _int64)StopTimeLo;
Time -= ((unsigned _int64)StartTimeHi << 32) + (unsigned _int64)StartTimeLo;
TS_Entries[count].TimeTotal += Time;
//LogMessage("%-30s: time = %X",ProfilingLabel,Time);
memset(ProfilingLabel,0,sizeof(ProfilingLabel));
return;
}
if (TSE_Count == 0) {
TS_Entries = (TIME_STAMP_ENTRY *)malloc(sizeof(TIME_STAMP_ENTRY) * 100);
if (TS_Entries == NULL) {
MessageBox(NULL,"TIME_STAMP_ENTRY == NULL ??",GS(MSG_MSGBOX_TITLE),MB_OK|MB_ICONERROR|MB_SETFOREGROUND);
}
TSE_Max = 100;
} else if (TSE_Count == TSE_Max) {
TSE_Max += 100;
TS_Entries = (TIME_STAMP_ENTRY *)realloc(TS_Entries,sizeof(TIME_STAMP_ENTRY) * TSE_Max);
if (TS_Entries == NULL) {
MessageBox(NULL,"TIME_STAMP_ENTRY == NULL ??",GS(MSG_MSGBOX_TITLE),MB_OK|MB_ICONERROR|MB_SETFOREGROUND);
}
}
strcpy(TS_Entries[TSE_Count].Label,ProfilingLabel);
TS_Entries[TSE_Count].TimeTotal = ((unsigned _int64)StopTimeHi << 32) + (unsigned _int64)StopTimeLo;
TS_Entries[TSE_Count].TimeTotal -= ((unsigned _int64)StartTimeHi << 32) + (unsigned _int64)StartTimeLo;
TSE_Count +=1;
memset(ProfilingLabel,0,sizeof(ProfilingLabel));
SortTimerList();
}
void GenerateTimerResults (void) {
char buffer[_MAX_PATH], drive[_MAX_DRIVE] ,dir[_MAX_DIR];
char fname[_MAX_FNAME],ext[_MAX_EXT], LogFileName[_MAX_PATH];
DWORD dwWritten, count, count2;
HANDLE hLogFile = NULL;
_int64 TotalTime;
StopTimer();
GetModuleFileName(NULL,buffer,sizeof(buffer));
_splitpath( buffer, drive, dir, fname, ext );
_makepath( LogFileName, drive, dir, "Profiling", "log" );
hLogFile = CreateFile(LogFileName,GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,
CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
SetFilePointer(hLogFile,0,NULL,FILE_BEGIN);
for (count = 0; count < TSE_Count; count ++) {
for (count2 = 0; count2 < (TSE_Count - 1); count2 ++) {
if (TS_Entries[count2].TimeTotal < TS_Entries[count2 + 1].TimeTotal) {
TIME_STAMP_ENTRY Temp;
memcpy(&Temp,&TS_Entries[count2],sizeof(TIME_STAMP_ENTRY));
memcpy(&TS_Entries[count2],&TS_Entries[count2 + 1],sizeof(TIME_STAMP_ENTRY));
memcpy(&TS_Entries[count2 + 1],&Temp,sizeof(TIME_STAMP_ENTRY));
}
}
}
TotalTime = 0;
for (count = 0; count < TSE_Count; count ++) {
TotalTime += TS_Entries[count].TimeTotal;
}
for (count = 0; count < (TSE_Count < 200?TSE_Count:200); count ++) {
sprintf(buffer,"%-30s %2.2f%c\r\n",
TS_Entries[count].Label,
(((double)TS_Entries[count].TimeTotal / (double)TotalTime) * 100),'%'
);
WriteFile( hLogFile,buffer,strlen(buffer),&dwWritten,NULL );
}
CloseHandle(hLogFile);
ResetTimerList();
}
void DisplayCPUPer (void) {
__int64 TotalTime, CPU = 0, Alist = 0, Dlist = 0, Idle = 0;
DWORD count;
//CurrentPercent = (CurrentPercent & 0xF) + 1;
CurrentPercent += 1;
if (CurrentPercent < 30) { return; }
CurrentPercent = 0;
for (count = 0; count < TSE_Count; count ++) {
if (strcmp(TS_Entries[count].Label,"r4300i Running") == 0) { CPU = TS_Entries[count].TimeTotal; }
if (strcmp(TS_Entries[count].Label,"RSP: Dlist" ) == 0) { Dlist = TS_Entries[count].TimeTotal; }
if (strcmp(TS_Entries[count].Label,"RSP: Alist" ) == 0) { Alist = TS_Entries[count].TimeTotal; }
if (strcmp(TS_Entries[count].Label,"CPU Idel" ) == 0) { Idle = TS_Entries[count].TimeTotal; }
}
TotalTime = 0;
for (count = 0; count < TSE_Count; count ++) {
TotalTime += TS_Entries[count].TimeTotal;
}
DisplayMessage("r4300i: %0.1f%c Dlist: %0.1f%c Alist: %0.1f%c Idle: %0.1f%c",
(float)(((double)CPU / (double)TotalTime) * 100),'%',
(float)(((double)Dlist / (double)TotalTime) * 100),'%',
(float)(((double)Alist / (double)TotalTime) * 100),'%',
(float)(((double)Idle / (double)TotalTime) * 100),'%');
ResetTimerList();
}

View File

@ -1,33 +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 ResetTimerList ( void );
void StartTimer ( char * Label );
void StopTimer ( void );
void GenerateTimerResults ( void );
void DisplayCPUPer (void);
extern char ProfilingLabel[100];
extern int CurrentPercent;

View File

@ -1,73 +0,0 @@
#include "stdafx.h"
static HANDLE hSramFile = NULL;
void CloseSram (void) {
if (hSramFile) {
CloseHandle(hSramFile);
hSramFile = NULL;
}
}
BOOL LoadSram (void) {
char File[255], Directory[255];
LPVOID lpMsgBuf;
GetAutoSaveDir(Directory);
sprintf(File,"%s%s.sra",Directory,g_RomName);
hSramFile = CreateFile(File,GENERIC_WRITE | GENERIC_READ, FILE_SHARE_READ,NULL,OPEN_ALWAYS,
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS, NULL);
if (hSramFile == INVALID_HANDLE_VALUE) {
switch (GetLastError()) {
case ERROR_PATH_NOT_FOUND:
CreateDirectory(Directory,NULL);
hSramFile = CreateFile(File,GENERIC_WRITE | GENERIC_READ, FILE_SHARE_READ,
NULL,OPEN_ALWAYS,FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS, NULL);
if (hSramFile == INVALID_HANDLE_VALUE) {
FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,NULL,GetLastError(),MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR) &lpMsgBuf,0,NULL
);
DisplayError((const char *)lpMsgBuf);
LocalFree( lpMsgBuf );
return FALSE;
}
break;
default:
FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,NULL,GetLastError(),MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR) &lpMsgBuf,0,NULL
);
DisplayError((const char *)lpMsgBuf);
LocalFree( lpMsgBuf );
return FALSE;
}
}
return TRUE;
}
void DmaFromSram(BYTE * dest, int StartOffset, int len) {
DWORD dwRead;
if (hSramFile == NULL) {
if (!LoadSram()) {
return;
}
}
SetFilePointer(hSramFile,StartOffset,NULL,FILE_BEGIN);
ReadFile(hSramFile,dest,len,&dwRead,NULL);
}
void DmaToSram(BYTE * Source, int StartOffset, int len) {
DWORD dwWritten;
if (hSramFile == NULL) {
if (!LoadSram()) {
return;
}
}
SetFilePointer(hSramFile,StartOffset,NULL,FILE_BEGIN);
WriteFile(hSramFile,Source,len,&dwWritten,NULL);
}

View File

@ -1,28 +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 CloseSram ( void );
void DmaFromSram ( BYTE * dest, int StartOffset, int len);
void DmaToSram ( BYTE * Source, int StartOffset, int len);