Merge https://github.com/project64/project64 into crapware
This commit is contained in:
commit
6edfcbd77b
|
@ -4,6 +4,14 @@
|
||||||
*.sdf
|
*.sdf
|
||||||
*.suo
|
*.suo
|
||||||
*.user
|
*.user
|
||||||
|
|
||||||
|
# compiler-generated sources (MSVC, GCC)
|
||||||
|
*.asm
|
||||||
|
*.s
|
||||||
|
|
||||||
|
# assembled linker objects (GCC)
|
||||||
|
*.o
|
||||||
|
|
||||||
Thumbs.db
|
Thumbs.db
|
||||||
/Bin/Debug
|
/Bin/Debug
|
||||||
/Bin/Debug64
|
/Bin/Debug64
|
||||||
|
|
Binary file not shown.
|
@ -1430,6 +1430,7 @@ Plugin Note=[video] unsupported
|
||||||
Good Name=Dezaemon 3D (J)
|
Good Name=Dezaemon 3D (J)
|
||||||
Internal Name=DEZAEMON3D
|
Internal Name=DEZAEMON3D
|
||||||
Status=Compatible
|
Status=Compatible
|
||||||
|
Save Type=Sram
|
||||||
|
|
||||||
[FD73F775-9724755A-C:50]
|
[FD73F775-9724755A-C:50]
|
||||||
Good Name=Diddy Kong Racing (E) (M3) (V1.0)
|
Good Name=Diddy Kong Racing (E) (M3) (V1.0)
|
||||||
|
|
|
@ -318,7 +318,7 @@
|
||||||
#620# "Usar o Primeiro Tipo de Salvamento Usado"
|
#620# "Usar o Primeiro Tipo de Salvamento Usado"
|
||||||
#621# "4-kbit EEPROM"
|
#621# "4-kbit EEPROM"
|
||||||
#622# "16-kbit EEPROM"
|
#622# "16-kbit EEPROM"
|
||||||
#623# "32-kbyte SRAM"
|
#623# "SRAM"
|
||||||
#624# "Flash RAM"
|
#624# "Flash RAM"
|
||||||
|
|
||||||
//Shell Integration Tab
|
//Shell Integration Tab
|
||||||
|
|
|
@ -266,7 +266,7 @@
|
||||||
#620# "* открий първият използван тип"
|
#620# "* открий първият използван тип"
|
||||||
#621# "4-kbit EEPROM"
|
#621# "4-kbit EEPROM"
|
||||||
#622# "16-kbit EEPROM"
|
#622# "16-kbit EEPROM"
|
||||||
#623# "32-kbyte SRAM"
|
#623# "SRAM"
|
||||||
#624# "128-kbyte flash RAM"
|
#624# "128-kbyte flash RAM"
|
||||||
|
|
||||||
//Shell Intergration Tab
|
//Shell Intergration Tab
|
||||||
|
|
|
@ -318,7 +318,7 @@
|
||||||
#620# "Primer tipus de desat usat"
|
#620# "Primer tipus de desat usat"
|
||||||
#621# "EEPROM de 4 kbits"
|
#621# "EEPROM de 4 kbits"
|
||||||
#622# "EEPROM de 16 kbits"
|
#622# "EEPROM de 16 kbits"
|
||||||
#623# "SRAM de 32kbytes"
|
#623# "SRAM"
|
||||||
#624# "FlashRAM de 128kbytes"
|
#624# "FlashRAM de 128kbytes"
|
||||||
|
|
||||||
//Shell Integration Tab
|
//Shell Integration Tab
|
||||||
|
|
|
@ -88,6 +88,7 @@
|
||||||
#198# "插槽 8"
|
#198# "插槽 8"
|
||||||
#199# "插槽 9"
|
#199# "插槽 9"
|
||||||
#200# "插槽 10"
|
#200# "插槽 10"
|
||||||
|
#201# "插槽 (%ws) 被选"
|
||||||
|
|
||||||
//Pop up Menu
|
//Pop up Menu
|
||||||
#210# "运行游戏"
|
#210# "运行游戏"
|
||||||
|
@ -224,7 +225,7 @@
|
||||||
#452# " 选择材质包目录"
|
#452# " 选择材质包目录"
|
||||||
|
|
||||||
//Options Dialog
|
//Options Dialog
|
||||||
#460# "当窗口处于非活动状态时暂停模拟器"
|
#460# "当模拟器窗口不是处于屏幕最上方,暂停模拟器"
|
||||||
#461# "载入ROM后切换为全屏模式"
|
#461# "载入ROM后切换为全屏模式"
|
||||||
#462# "隐藏高级设置"
|
#462# "隐藏高级设置"
|
||||||
#463# "记住已选择的金手指"
|
#463# "记住已选择的金手指"
|
||||||
|
@ -255,7 +256,7 @@
|
||||||
#503# "自我修改码方案:"
|
#503# "自我修改码方案:"
|
||||||
#504# "默认存档容量:"
|
#504# "默认存档容量:"
|
||||||
#505# "高级模块连接"
|
#505# "高级模块连接"
|
||||||
#506# "当ROM加载后,开始模拟"
|
#506# "当读取完ROM后,开始模拟"
|
||||||
#507# "总是从 RDB 中覆盖默认设置"
|
#507# "总是从 RDB 中覆盖默认设置"
|
||||||
#508# "自动压缩即时存档文件"
|
#508# "自动压缩即时存档文件"
|
||||||
#509# "开启调试器"
|
#509# "开启调试器"
|
||||||
|
@ -318,7 +319,7 @@
|
||||||
#620# "使用最初的存档类型"
|
#620# "使用最初的存档类型"
|
||||||
#621# "4-kbit EEPROM"
|
#621# "4-kbit EEPROM"
|
||||||
#622# "16-kbit EEPROM"
|
#622# "16-kbit EEPROM"
|
||||||
#623# "32-kbyte SRAM"
|
#623# "SRAM"
|
||||||
#624# "Flash RAM"
|
#624# "Flash RAM"
|
||||||
|
|
||||||
//Shell Integration Tab
|
//Shell Integration Tab
|
||||||
|
|
|
@ -270,7 +270,7 @@
|
||||||
#620# "使用最初使用的存檔類型"
|
#620# "使用最初使用的存檔類型"
|
||||||
#621# "4-Kbit EEPROM"
|
#621# "4-Kbit EEPROM"
|
||||||
#622# "16-Kbit EEPROM"
|
#622# "16-Kbit EEPROM"
|
||||||
#623# "32-KByte SRAM"
|
#623# "SRAM"
|
||||||
#624# "Flash RAM"
|
#624# "Flash RAM"
|
||||||
|
|
||||||
//Shell Integration Tab
|
//Shell Integration Tab
|
||||||
|
|
|
@ -266,7 +266,7 @@ RDB není pøítomno nebo volba dole 'pøepsat' je nezaškrtnutá"
|
||||||
#620# "* detek. první užívaný typ"
|
#620# "* detek. první užívaný typ"
|
||||||
#621# "4-kbit EEPROM"
|
#621# "4-kbit EEPROM"
|
||||||
#622# "16-kbit EEPROM"
|
#622# "16-kbit EEPROM"
|
||||||
#623# "32-kbajtù SRAM"
|
#623# "SRAM"
|
||||||
#624# "128-kbajtù flash RAM"
|
#624# "128-kbajtù flash RAM"
|
||||||
|
|
||||||
//Shell Intergration Tab
|
//Shell Intergration Tab
|
||||||
|
|
|
@ -265,7 +265,7 @@
|
||||||
#620# "* Find den først anvendte type"
|
#620# "* Find den først anvendte type"
|
||||||
#621# "4kbit EEPROM"
|
#621# "4kbit EEPROM"
|
||||||
#622# "16kbit EEPROM"
|
#622# "16kbit EEPROM"
|
||||||
#623# "32kbyte SRAM"
|
#623# "SRAM"
|
||||||
#624# "128kbyte FlashRAM"
|
#624# "128kbyte FlashRAM"
|
||||||
|
|
||||||
//Shell Intergration Tab
|
//Shell Intergration Tab
|
||||||
|
|
|
@ -265,7 +265,7 @@
|
||||||
#620# "Gebruik de eerst gebruikte save"
|
#620# "Gebruik de eerst gebruikte save"
|
||||||
#621# "4kbit EEPROM"
|
#621# "4kbit EEPROM"
|
||||||
#622# "16kbit EEPROM"
|
#622# "16kbit EEPROM"
|
||||||
#623# "32kbytes SRAM"
|
#623# "SRAM"
|
||||||
#624# "Flashram"
|
#624# "Flashram"
|
||||||
|
|
||||||
//Shell Integration Tab
|
//Shell Integration Tab
|
||||||
|
|
|
@ -88,6 +88,7 @@
|
||||||
#198# "Slot 8"
|
#198# "Slot 8"
|
||||||
#199# "Slot 9"
|
#199# "Slot 9"
|
||||||
#200# "Slot 10"
|
#200# "Slot 10"
|
||||||
|
#201# "Save Slot (%ws) selected"
|
||||||
|
|
||||||
//Pop up Menu
|
//Pop up Menu
|
||||||
#210# "Play Game"
|
#210# "Play Game"
|
||||||
|
|
|
@ -277,7 +277,7 @@ no RDB is present, or 'overwrite' option below is unchecked"
|
||||||
#620# "* detect first-used type"
|
#620# "* detect first-used type"
|
||||||
#621# "4-kbit EEPROM"
|
#621# "4-kbit EEPROM"
|
||||||
#622# "16-kbit EEPROM"
|
#622# "16-kbit EEPROM"
|
||||||
#623# "32-kbyte SRAM"
|
#623# "SRAM"
|
||||||
#624# "128-kbyte flash RAM"
|
#624# "128-kbyte flash RAM"
|
||||||
|
|
||||||
//Shell Intergration Tab
|
//Shell Intergration Tab
|
||||||
|
|
|
@ -269,7 +269,7 @@
|
||||||
#620# "Käytä 1. tallennustyyppiä"
|
#620# "Käytä 1. tallennustyyppiä"
|
||||||
#621# "4-kbit EEPROM"
|
#621# "4-kbit EEPROM"
|
||||||
#622# "16-kbit EEPROM"
|
#622# "16-kbit EEPROM"
|
||||||
#623# "32-kbyte SRAM"
|
#623# "SRAM"
|
||||||
#624# "Flash RAM"
|
#624# "Flash RAM"
|
||||||
|
|
||||||
//Shell Integration Tab
|
//Shell Integration Tab
|
||||||
|
|
|
@ -318,7 +318,7 @@
|
||||||
#620# "Par défaut"
|
#620# "Par défaut"
|
||||||
#621# "4 kbit EEPROM"
|
#621# "4 kbit EEPROM"
|
||||||
#622# "16 kbit EEPROM"
|
#622# "16 kbit EEPROM"
|
||||||
#623# "32 ko SRAM"
|
#623# "SRAM"
|
||||||
#624# "Flash RAM"
|
#624# "Flash RAM"
|
||||||
|
|
||||||
//Shell Integration Tab
|
//Shell Integration Tab
|
||||||
|
|
|
@ -269,7 +269,7 @@
|
||||||
#620# "Automatisch"
|
#620# "Automatisch"
|
||||||
#621# "4-kbit EEPROM"
|
#621# "4-kbit EEPROM"
|
||||||
#622# "16-kbit EEPROM"
|
#622# "16-kbit EEPROM"
|
||||||
#623# "32-kbyte SRAM"
|
#623# "SRAM"
|
||||||
#624# "128-kbyte flash RAM"
|
#624# "128-kbyte flash RAM"
|
||||||
|
|
||||||
//Shell Intergration Tab
|
//Shell Intergration Tab
|
||||||
|
|
|
@ -265,7 +265,7 @@
|
||||||
#620# "Automatisch"
|
#620# "Automatisch"
|
||||||
#621# "4-kbit EEPROM"
|
#621# "4-kbit EEPROM"
|
||||||
#622# "16-kbit EEPROM"
|
#622# "16-kbit EEPROM"
|
||||||
#623# "32-kbyte SRAM"
|
#623# "SRAM"
|
||||||
#624# "128-kbyte flash RAM"
|
#624# "128-kbyte flash RAM"
|
||||||
|
|
||||||
//Shell Intergration Tab
|
//Shell Intergration Tab
|
||||||
|
|
|
@ -266,7 +266,7 @@
|
||||||
#620# "Αυτόματος"
|
#620# "Αυτόματος"
|
||||||
#621# "4-kbit EEPROM"
|
#621# "4-kbit EEPROM"
|
||||||
#622# "16-kbit EEPROM"
|
#622# "16-kbit EEPROM"
|
||||||
#623# "32-kbyte SRAM"
|
#623# "SRAM"
|
||||||
#624# "128-kbyte flash RAM"
|
#624# "128-kbyte flash RAM"
|
||||||
|
|
||||||
//Shell Integration Tab
|
//Shell Integration Tab
|
||||||
|
|
|
@ -269,7 +269,7 @@
|
||||||
#620# "Elõszöri mentés fajta használata"
|
#620# "Elõszöri mentés fajta használata"
|
||||||
#621# "4-kbit EEPROM"
|
#621# "4-kbit EEPROM"
|
||||||
#622# "16-kbit EEPROM"
|
#622# "16-kbit EEPROM"
|
||||||
#623# "32-kbyte SRAM"
|
#623# "SRAM"
|
||||||
#624# "Flash RAM"
|
#624# "Flash RAM"
|
||||||
|
|
||||||
//Shell Integration Tab
|
//Shell Integration Tab
|
||||||
|
|
|
@ -269,7 +269,7 @@
|
||||||
#620# "Riconosci automaticamente"
|
#620# "Riconosci automaticamente"
|
||||||
#621# "4-kbit EEPROM"
|
#621# "4-kbit EEPROM"
|
||||||
#622# "16-kbit EEPROM"
|
#622# "16-kbit EEPROM"
|
||||||
#623# "32-ko SRAM"
|
#623# "SRAM"
|
||||||
#624# "128-ko flash RAM"
|
#624# "128-ko flash RAM"
|
||||||
|
|
||||||
//Shell Intergration Tab
|
//Shell Intergration Tab
|
||||||
|
|
|
@ -265,7 +265,7 @@
|
||||||
#620# "Riconosci il salvataggio automaticamente"
|
#620# "Riconosci il salvataggio automaticamente"
|
||||||
#621# "4-kbit EEPROM"
|
#621# "4-kbit EEPROM"
|
||||||
#622# "16-kbit EEPROM"
|
#622# "16-kbit EEPROM"
|
||||||
#623# "32-ko SRAM"
|
#623# "SRAM"
|
||||||
#624# "128-ko flash RAM"
|
#624# "128-ko flash RAM"
|
||||||
|
|
||||||
//Shell Intergration Tab
|
//Shell Intergration Tab
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#1 # "Japanese" // LANGUAGE ID
|
#1 # "Japanese" // LANGUAGE ID
|
||||||
#2 # "Nekokabu" // Author
|
#2 # "Nekokabu" // Author
|
||||||
#3 # "2.2" // Version
|
#3 # "2.2" // Version
|
||||||
#4 # "2015/3/5" // Date
|
#4 # "2015/11/6" // Date
|
||||||
|
|
||||||
//About DLL Dialog
|
//About DLL Dialog
|
||||||
#5 # "現在の言語"
|
#5 # "現在の言語"
|
||||||
|
@ -317,7 +317,7 @@
|
||||||
#620# "自動検出"
|
#620# "自動検出"
|
||||||
#621# "4-kbit EEPROM"
|
#621# "4-kbit EEPROM"
|
||||||
#622# "16-kbit EEPROM"
|
#622# "16-kbit EEPROM"
|
||||||
#623# "32-kbyte SRAM"
|
#623# "SRAM"
|
||||||
#624# "Flash RAM"
|
#624# "Flash RAM"
|
||||||
|
|
||||||
//Shell Integration Tab
|
//Shell Integration Tab
|
||||||
|
|
|
@ -269,7 +269,7 @@
|
||||||
#620# "Naudoti pirmà naudotà tipà"
|
#620# "Naudoti pirmà naudotà tipà"
|
||||||
#621# "4-kbit EEPROM"
|
#621# "4-kbit EEPROM"
|
||||||
#622# "16-kbit EEPROM"
|
#622# "16-kbit EEPROM"
|
||||||
#623# "32-kbyte SRAM"
|
#623# "SRAM"
|
||||||
#624# "128-kbyte flash RAM"
|
#624# "128-kbyte flash RAM"
|
||||||
|
|
||||||
//Shell Intergration Tab
|
//Shell Intergration Tab
|
||||||
|
|
|
@ -271,7 +271,7 @@ De vil ta effekt når ROM'en er resatt eller en ny er startet."
|
||||||
#620# "bruk den første brukte lagrings typen"
|
#620# "bruk den første brukte lagrings typen"
|
||||||
#621# "4-kbit EEPROM"
|
#621# "4-kbit EEPROM"
|
||||||
#622# "16-kbit EEPROM"
|
#622# "16-kbit EEPROM"
|
||||||
#623# "32-kbyte SRAM"
|
#623# "SRAM"
|
||||||
#624# "128-kbyte flash RAM"
|
#624# "128-kbyte flash RAM"
|
||||||
|
|
||||||
//Shell Integration Tab
|
//Shell Integration Tab
|
||||||
|
|
|
@ -269,7 +269,7 @@
|
||||||
#620# "Pierwszy u¿yty format"
|
#620# "Pierwszy u¿yty format"
|
||||||
#621# "4-kbit EEPROM"
|
#621# "4-kbit EEPROM"
|
||||||
#622# "16-kbit EEPROM"
|
#622# "16-kbit EEPROM"
|
||||||
#623# "32-kbyte SRAM"
|
#623# "SRAM"
|
||||||
#624# "Flash RAM"
|
#624# "Flash RAM"
|
||||||
|
|
||||||
//Shell Integration Tab
|
//Shell Integration Tab
|
||||||
|
|
|
@ -267,7 +267,7 @@
|
||||||
#620# "По умолчанию"
|
#620# "По умолчанию"
|
||||||
#621# "4-kbit EEPROM"
|
#621# "4-kbit EEPROM"
|
||||||
#622# "16-kbit EEPROM"
|
#622# "16-kbit EEPROM"
|
||||||
#623# "32-kbyte SRAM"
|
#623# "SRAM"
|
||||||
#624# "128-kbyte flash RAM"
|
#624# "128-kbyte flash RAM"
|
||||||
|
|
||||||
//Shell Integration Tab
|
//Shell Integration Tab
|
||||||
|
|
|
@ -318,7 +318,7 @@
|
||||||
#620# "Usar primer tipo de guardado usado"
|
#620# "Usar primer tipo de guardado usado"
|
||||||
#621# "4-kbit EEPROM"
|
#621# "4-kbit EEPROM"
|
||||||
#622# "16-kbit EEPROM"
|
#622# "16-kbit EEPROM"
|
||||||
#623# "32-kbyte SRAM"
|
#623# "SRAM"
|
||||||
#624# "Flash RAM"
|
#624# "Flash RAM"
|
||||||
|
|
||||||
//Shell Integration Tab
|
//Shell Integration Tab
|
||||||
|
|
|
@ -269,7 +269,7 @@
|
||||||
#620# "Använd Första sparnings typ"
|
#620# "Använd Första sparnings typ"
|
||||||
#621# "4-kbit EEPROM"
|
#621# "4-kbit EEPROM"
|
||||||
#622# "16-kbit EEPROM"
|
#622# "16-kbit EEPROM"
|
||||||
#623# "32-kbytes SRAM"
|
#623# "SRAM"
|
||||||
#624# "Flash RAM"
|
#624# "Flash RAM"
|
||||||
|
|
||||||
//Shell Integration Tab
|
//Shell Integration Tab
|
||||||
|
|
|
@ -267,7 +267,7 @@
|
||||||
#620# "Обирає програма"
|
#620# "Обирає програма"
|
||||||
#621# "4-kbit EEPROM"
|
#621# "4-kbit EEPROM"
|
||||||
#622# "16-kbit EEPROM"
|
#622# "16-kbit EEPROM"
|
||||||
#623# "32-kbyte SRAM"
|
#623# "SRAM"
|
||||||
#624# "128-kbyte flash RAM"
|
#624# "128-kbyte flash RAM"
|
||||||
|
|
||||||
//Shell Integration Tab
|
//Shell Integration Tab
|
||||||
|
|
BIN
Project64.sln
BIN
Project64.sln
Binary file not shown.
|
@ -2,7 +2,7 @@
|
||||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
|
||||||
<PropertyGroup Label="Configuration">
|
<PropertyGroup Label="Configuration">
|
||||||
<PlatformToolset>v140_xp</PlatformToolset>
|
<PlatformToolset>$(DefaultPlatformToolset)_xp</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ImportGroup Label="PropertySheets">
|
<ImportGroup Label="PropertySheets">
|
||||||
|
@ -195,6 +195,9 @@
|
||||||
|
|
||||||
<!-- Win32 -->
|
<!-- Win32 -->
|
||||||
<ItemDefinitionGroup Condition="'$(Platform)'=='Win32'">
|
<ItemDefinitionGroup Condition="'$(Platform)'=='Win32'">
|
||||||
|
<Lib>
|
||||||
|
<TargetMachine>MachineX86</TargetMachine>
|
||||||
|
</Lib>
|
||||||
<Link>
|
<Link>
|
||||||
<TargetMachine>MachineX86</TargetMachine>
|
<TargetMachine>MachineX86</TargetMachine>
|
||||||
</Link>
|
</Link>
|
||||||
|
@ -212,6 +215,9 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemDefinitionGroup Condition="'$(Platform)'=='x64'">
|
<ItemDefinitionGroup Condition="'$(Platform)'=='x64'">
|
||||||
|
<Lib>
|
||||||
|
<TargetMachine>MachineX64</TargetMachine>
|
||||||
|
</Lib>
|
||||||
<Link>
|
<Link>
|
||||||
<TargetMachine>MachineX64</TargetMachine>
|
<TargetMachine>MachineX64</TargetMachine>
|
||||||
</Link>
|
</Link>
|
||||||
|
|
|
@ -0,0 +1,145 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* *
|
||||||
|
* XInput.h -- This module defines XBOX controller APIs *
|
||||||
|
* and constansts for the Windows platform. *
|
||||||
|
* *
|
||||||
|
* Copyright (c) Microsoft Corp. All rights reserved. *
|
||||||
|
* *
|
||||||
|
***************************************************************************/
|
||||||
|
#ifndef _XINPUT_H_
|
||||||
|
#define _XINPUT_H_
|
||||||
|
|
||||||
|
#include <windef.h>
|
||||||
|
|
||||||
|
// Current name of the DLL shipped in the same SDK as this header.
|
||||||
|
// The name reflects the current version
|
||||||
|
#define XINPUT_DLL_A "xinput9_1_0.dll"
|
||||||
|
#define XINPUT_DLL_W L"xinput9_1_0.dll"
|
||||||
|
#ifdef UNICODE
|
||||||
|
#define XINPUT_DLL XINPUT_DLL_W
|
||||||
|
#else
|
||||||
|
#define XINPUT_DLL XINPUT_DLL_A
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//
|
||||||
|
// Device types available in XINPUT_CAPABILITIES
|
||||||
|
//
|
||||||
|
#define XINPUT_DEVTYPE_GAMEPAD 0x01
|
||||||
|
|
||||||
|
//
|
||||||
|
// Device subtypes available in XINPUT_CAPABILITIES
|
||||||
|
//
|
||||||
|
#define XINPUT_DEVSUBTYPE_GAMEPAD 0x01
|
||||||
|
|
||||||
|
//
|
||||||
|
// Flags for XINPUT_CAPABILITIES
|
||||||
|
//
|
||||||
|
#define XINPUT_CAPS_VOICE_SUPPORTED 0x0004
|
||||||
|
|
||||||
|
//
|
||||||
|
// Constants for gamepad buttons
|
||||||
|
//
|
||||||
|
#define XINPUT_GAMEPAD_DPAD_UP 0x0001
|
||||||
|
#define XINPUT_GAMEPAD_DPAD_DOWN 0x0002
|
||||||
|
#define XINPUT_GAMEPAD_DPAD_LEFT 0x0004
|
||||||
|
#define XINPUT_GAMEPAD_DPAD_RIGHT 0x0008
|
||||||
|
#define XINPUT_GAMEPAD_START 0x0010
|
||||||
|
#define XINPUT_GAMEPAD_BACK 0x0020
|
||||||
|
#define XINPUT_GAMEPAD_LEFT_THUMB 0x0040
|
||||||
|
#define XINPUT_GAMEPAD_RIGHT_THUMB 0x0080
|
||||||
|
#define XINPUT_GAMEPAD_LEFT_SHOULDER 0x0100
|
||||||
|
#define XINPUT_GAMEPAD_RIGHT_SHOULDER 0x0200
|
||||||
|
#define XINPUT_GAMEPAD_A 0x1000
|
||||||
|
#define XINPUT_GAMEPAD_B 0x2000
|
||||||
|
#define XINPUT_GAMEPAD_X 0x4000
|
||||||
|
#define XINPUT_GAMEPAD_Y 0x8000
|
||||||
|
|
||||||
|
//
|
||||||
|
// Gamepad thresholds
|
||||||
|
//
|
||||||
|
#define XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE 7849
|
||||||
|
#define XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE 8689
|
||||||
|
#define XINPUT_GAMEPAD_TRIGGER_THRESHOLD 30
|
||||||
|
|
||||||
|
//
|
||||||
|
// Flags to pass to XInputGetCapabilities
|
||||||
|
//
|
||||||
|
#define XINPUT_FLAG_GAMEPAD 0x00000001
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// Structures used by XInput APIs
|
||||||
|
//
|
||||||
|
typedef struct _XINPUT_GAMEPAD
|
||||||
|
{
|
||||||
|
WORD wButtons;
|
||||||
|
BYTE bLeftTrigger;
|
||||||
|
BYTE bRightTrigger;
|
||||||
|
SHORT sThumbLX;
|
||||||
|
SHORT sThumbLY;
|
||||||
|
SHORT sThumbRX;
|
||||||
|
SHORT sThumbRY;
|
||||||
|
} XINPUT_GAMEPAD, *PXINPUT_GAMEPAD;
|
||||||
|
|
||||||
|
typedef struct _XINPUT_STATE
|
||||||
|
{
|
||||||
|
DWORD dwPacketNumber;
|
||||||
|
XINPUT_GAMEPAD Gamepad;
|
||||||
|
} XINPUT_STATE, *PXINPUT_STATE;
|
||||||
|
|
||||||
|
typedef struct _XINPUT_VIBRATION
|
||||||
|
{
|
||||||
|
WORD wLeftMotorSpeed;
|
||||||
|
WORD wRightMotorSpeed;
|
||||||
|
} XINPUT_VIBRATION, *PXINPUT_VIBRATION;
|
||||||
|
|
||||||
|
typedef struct _XINPUT_CAPABILITIES
|
||||||
|
{
|
||||||
|
BYTE Type;
|
||||||
|
BYTE SubType;
|
||||||
|
WORD Flags;
|
||||||
|
XINPUT_GAMEPAD Gamepad;
|
||||||
|
XINPUT_VIBRATION Vibration;
|
||||||
|
} XINPUT_CAPABILITIES, *PXINPUT_CAPABILITIES;
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// XInput APIs
|
||||||
|
//
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
DWORD WINAPI XInputGetState
|
||||||
|
(
|
||||||
|
DWORD dwUserIndex, // [in] Index of the gamer associated with the device
|
||||||
|
XINPUT_STATE* pState // [out] Receives the current state
|
||||||
|
);
|
||||||
|
|
||||||
|
DWORD WINAPI XInputSetState
|
||||||
|
(
|
||||||
|
DWORD dwUserIndex, // [in] Index of the gamer associated with the device
|
||||||
|
XINPUT_VIBRATION* pVibration // [in, out] The vibration information to send to the controller
|
||||||
|
);
|
||||||
|
|
||||||
|
DWORD WINAPI XInputGetCapabilities
|
||||||
|
(
|
||||||
|
DWORD dwUserIndex, // [in] Index of the gamer associated with the device
|
||||||
|
DWORD dwFlags, // [in] Input flags that identify the device type
|
||||||
|
XINPUT_CAPABILITIES* pCapabilities // [out] Receives the capabilities
|
||||||
|
);
|
||||||
|
|
||||||
|
DWORD WINAPI XInputGetDSoundAudioDeviceGuids
|
||||||
|
(
|
||||||
|
DWORD dwUserIndex, // [in] Index of the gamer associated with the device
|
||||||
|
GUID* pDSoundRenderGuid, // [out] DSound device ID for render
|
||||||
|
GUID* pDSoundCaptureGuid // [out] DSound device ID for capture
|
||||||
|
);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif //_XINPUT_H_
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,127 @@
|
||||||
|
/*
|
||||||
|
Name: wx/msw/gccpriv.h
|
||||||
|
Purpose: MinGW/Cygwin definitions
|
||||||
|
Author: Vadim Zeitlin
|
||||||
|
Modified by:
|
||||||
|
Created:
|
||||||
|
RCS-ID: $Id: gccpriv.h 36155 2005-11-10 16:16:05Z ABX $
|
||||||
|
Copyright: (c) Vadim Zeitlin
|
||||||
|
Licence: wxWindows Licence
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */
|
||||||
|
|
||||||
|
#ifndef _WX_MSW_GCCPRIV_H_
|
||||||
|
#define _WX_MSW_GCCPRIV_H_
|
||||||
|
|
||||||
|
#if defined(__MINGW32__) && !defined(__GNUWIN32__)
|
||||||
|
#define __GNUWIN32__
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__MINGW32__) && ( ( __GNUC__ > 2 ) || ( ( __GNUC__ == 2 ) && ( __GNUC_MINOR__ >= 95 ) ) )
|
||||||
|
#include <_mingw.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined( __MINGW32__ ) && !defined(__WINE__) && !defined( HAVE_W32API_H )
|
||||||
|
#if __MINGW32_MAJOR_VERSION >= 1
|
||||||
|
#define HAVE_W32API_H
|
||||||
|
#endif
|
||||||
|
#elif defined( __CYGWIN__ ) && !defined( HAVE_W32API_H )
|
||||||
|
#if ( __GNUC__ > 2 )
|
||||||
|
#define HAVE_W32API_H
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if wxCHECK_WATCOM_VERSION(1,0)
|
||||||
|
#define HAVE_W32API_H
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* check for MinGW/Cygwin w32api version ( releases >= 0.5, only ) */
|
||||||
|
#if defined( HAVE_W32API_H )
|
||||||
|
#include <w32api.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Watcom can't handle defined(xxx) here: */
|
||||||
|
#if defined(__W32API_MAJOR_VERSION) && defined(__W32API_MINOR_VERSION)
|
||||||
|
#define wxCHECK_W32API_VERSION( major, minor ) \
|
||||||
|
( ( ( __W32API_MAJOR_VERSION > (major) ) \
|
||||||
|
|| ( __W32API_MAJOR_VERSION == (major) && __W32API_MINOR_VERSION >= (minor) ) ) )
|
||||||
|
#else
|
||||||
|
#define wxCHECK_W32API_VERSION( major, minor ) (0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Cygwin / Mingw32 with gcc >= 2.95 use new windows headers which
|
||||||
|
are more ms-like (header author is Anders Norlander, hence the name) */
|
||||||
|
#if (defined(__MINGW32__) || defined(__CYGWIN__) || defined(__WINE__)) && ((__GNUC__>2) || ((__GNUC__==2) && (__GNUC_MINOR__>=95)))
|
||||||
|
#ifndef wxUSE_NORLANDER_HEADERS
|
||||||
|
#define wxUSE_NORLANDER_HEADERS 1
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#ifndef wxUSE_NORLANDER_HEADERS
|
||||||
|
#define wxUSE_NORLANDER_HEADERS 0
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* "old" GNUWIN32 is the one without Norlander's headers: it lacks the
|
||||||
|
standard Win32 headers and we define the used stuff ourselves for it
|
||||||
|
in wx/msw/gnuwin32/extra.h */
|
||||||
|
#if defined(__GNUC__) && !wxUSE_NORLANDER_HEADERS
|
||||||
|
#define __GNUWIN32_OLD__
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Cygwin 1.0 */
|
||||||
|
#if defined(__CYGWIN__) && ((__GNUC__==2) && (__GNUC_MINOR__==9))
|
||||||
|
#define __CYGWIN10__
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Check for Mingw runtime version: */
|
||||||
|
#if defined(__MINGW32_MAJOR_VERSION) && defined(__MINGW32_MINOR_VERSION)
|
||||||
|
#define wxCHECK_MINGW32_VERSION( major, minor ) \
|
||||||
|
( ( ( __MINGW32_MAJOR_VERSION > (major) ) \
|
||||||
|
|| ( __MINGW32_MAJOR_VERSION == (major) && __MINGW32_MINOR_VERSION >= (minor) ) ) )
|
||||||
|
#else
|
||||||
|
#define wxCHECK_MINGW32_VERSION( major, minor ) (0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Mingw runtime 1.0-20010604 has some missing _tXXXX functions,
|
||||||
|
so let's define them ourselves: */
|
||||||
|
#if defined(__GNUWIN32__) && wxCHECK_W32API_VERSION( 1, 0 ) \
|
||||||
|
&& !wxCHECK_W32API_VERSION( 1, 1 )
|
||||||
|
#ifndef _tsetlocale
|
||||||
|
#if wxUSE_UNICODE
|
||||||
|
#define _tsetlocale _wsetlocale
|
||||||
|
#else
|
||||||
|
#define _tsetlocale setlocale
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#ifndef _tgetenv
|
||||||
|
#if wxUSE_UNICODE
|
||||||
|
#define _tgetenv _wgetenv
|
||||||
|
#else
|
||||||
|
#define _tgetenv getenv
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#ifndef _tfopen
|
||||||
|
#if wxUSE_UNICODE
|
||||||
|
#define _tfopen _wfopen
|
||||||
|
#else
|
||||||
|
#define _tfopen fopen
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* current (= before mingw-runtime 3.3) mingw32 headers forget to
|
||||||
|
define _puttchar, this will probably be fixed in the next versions but
|
||||||
|
for now do it ourselves
|
||||||
|
*/
|
||||||
|
#if defined( __MINGW32__ ) && \
|
||||||
|
!wxCHECK_MINGW32_VERSION(3,3) && !defined( _puttchar )
|
||||||
|
#ifdef wxUSE_UNICODE
|
||||||
|
#define _puttchar putwchar
|
||||||
|
#else
|
||||||
|
#define _puttchar puttchar
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
/* _WX_MSW_GCCPRIV_H_ */
|
|
@ -94,7 +94,7 @@
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
AdditionalIncludeDirectories=""$(Root)Source\3rd Party\wx\lib\vc_lib\mswd";"$(Root)Source\3rd Party\wx\include";"$(Root)Source\3rd Party\wx\src\tiff\libtiff";"$(Root)Source\3rd Party\wx\src\jpeg";"$(Root)Source\3rd Party\wx\src\png";"$(Root)Source\3rd Party\wx\src\zlib""
|
AdditionalIncludeDirectories=""$(Root)Source\3rd Party\wx\lib\vc_lib\msw";"$(Root)Source\3rd Party\wx\include";"$(Root)Source\3rd Party\wx\src\tiff\libtiff";"$(Root)Source\3rd Party\wx\src\jpeg";"$(Root)Source\3rd Party\wx\src\png";"$(Root)Source\3rd Party\wx\src\zlib""
|
||||||
PreprocessorDefinitions="_LIB;__WXMSW__;WXBUILDING;wxUSE_BASE=0"
|
PreprocessorDefinitions="_LIB;__WXMSW__;WXBUILDING;wxUSE_BASE=0"
|
||||||
PrecompiledHeaderThrough="wx/wxprec.h"
|
PrecompiledHeaderThrough="wx/wxprec.h"
|
||||||
DisableSpecificWarnings="4005"
|
DisableSpecificWarnings="4005"
|
||||||
|
@ -2172,9 +2172,9 @@
|
||||||
>
|
>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCustomBuildTool"
|
Name="VCCustomBuildTool"
|
||||||
Description="Creating lib\vc_lib\mswu\wx\setup.h"
|
Description="Creating lib\vc_lib\msw\wx\setup.h"
|
||||||
CommandLine="copy "$(InputPath)" lib\vc_lib\mswu\wx\setup.h
"
|
CommandLine="copy "$(InputPath)" lib\vc_lib\msw\wx\setup.h
"
|
||||||
Outputs="lib\vc_lib\mswu\wx\setup.h"
|
Outputs="lib\vc_lib\msw\wx\setup.h"
|
||||||
/>
|
/>
|
||||||
</FileConfiguration>
|
</FileConfiguration>
|
||||||
</File>
|
</File>
|
||||||
|
@ -2394,9 +2394,9 @@
|
||||||
>
|
>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCustomBuildTool"
|
Name="VCCustomBuildTool"
|
||||||
Description="Creating lib\vc_lib\mswud\wx\msw\rcdefs.h"
|
Description="Creating lib\vc_lib\mswd\wx\msw\rcdefs.h"
|
||||||
CommandLine="cl /EP /nologo "$(InputPath)" > "lib\vc_lib\mswud\wx\msw\rcdefs.h"
"
|
CommandLine="cl /EP /nologo "$(InputPath)" > "lib\vc_lib\mswd\wx\msw\rcdefs.h"
"
|
||||||
Outputs="lib\vc_lib\mswud\wx\msw\rcdefs.h"
|
Outputs="lib\vc_lib\mswd\wx\msw\rcdefs.h"
|
||||||
/>
|
/>
|
||||||
</FileConfiguration>
|
</FileConfiguration>
|
||||||
<FileConfiguration
|
<FileConfiguration
|
||||||
|
@ -2404,8 +2404,8 @@
|
||||||
>
|
>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCustomBuildTool"
|
Name="VCCustomBuildTool"
|
||||||
Description="Creating lib\vc_lib\mswu\wx\msw\rcdefs.h"
|
Description="Creating lib\vc_lib\msw\wx\msw\rcdefs.h"
|
||||||
CommandLine="cl /EP /nologo "$(InputPath)" > "lib\vc_lib\mswu\wx\msw\rcdefs.h"
"
|
CommandLine="cl /EP /nologo "$(InputPath)" > "lib\vc_lib\msw\wx\msw\rcdefs.h"
"
|
||||||
Outputs="lib\vc_lib\mswu\wx\msw\rcdefs.h"
|
Outputs="lib\vc_lib\mswu\wx\msw\rcdefs.h"
|
||||||
/>
|
/>
|
||||||
</FileConfiguration>
|
</FileConfiguration>
|
||||||
|
@ -3763,11 +3763,11 @@
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="include\wx\splitter.h"
|
RelativePath="include\wx\persist\splitter.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="include\wx\persist\splitter.h"
|
RelativePath="include\wx\splitter.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
|
@ -3851,11 +3851,11 @@
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="include\wx\toolbar.h"
|
RelativePath="include\wx\ribbon\toolbar.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="include\wx\ribbon\toolbar.h"
|
RelativePath="include\wx\toolbar.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
|
@ -3867,11 +3867,11 @@
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="include\wx\toplevel.h"
|
RelativePath="include\wx\persist\toplevel.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="include\wx\persist\toplevel.h"
|
RelativePath="include\wx\toplevel.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
|
@ -3879,11 +3879,11 @@
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="include\wx\treebook.h"
|
RelativePath="include\wx\persist\treebook.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="include\wx\persist\treebook.h"
|
RelativePath="include\wx\treebook.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
|
|
|
@ -148,7 +148,19 @@
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="src\zlib\gzio.c"
|
RelativePath=".\src\zlib\gzclose.c"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\zlib\gzlib.c"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\zlib\gzread.c"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\zlib\gzwrite.c"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
|
|
|
@ -177,10 +177,18 @@
|
||||||
/>
|
/>
|
||||||
</FileConfiguration>
|
</FileConfiguration>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\SyncEvent.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="Trace.cpp"
|
RelativePath="Trace.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Util.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter
|
<Filter
|
||||||
Name="Header Files"
|
Name="Header Files"
|
||||||
|
@ -230,6 +238,10 @@
|
||||||
RelativePath=".\stdtypes.h"
|
RelativePath=".\stdtypes.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\SyncEvent.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="Trace.h"
|
RelativePath="Trace.h"
|
||||||
>
|
>
|
||||||
|
@ -238,6 +250,10 @@
|
||||||
RelativePath="TraceDefs.h"
|
RelativePath="TraceDefs.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Util.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
</Files>
|
</Files>
|
||||||
<Globals>
|
<Globals>
|
||||||
|
|
|
@ -43,7 +43,9 @@
|
||||||
<ClCompile Include="stdafx.cpp">
|
<ClCompile Include="stdafx.cpp">
|
||||||
<PrecompiledHeader>Create</PrecompiledHeader>
|
<PrecompiledHeader>Create</PrecompiledHeader>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="SyncEvent.cpp" />
|
||||||
<ClCompile Include="Trace.cpp" />
|
<ClCompile Include="Trace.cpp" />
|
||||||
|
<ClCompile Include="Util.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="CriticalSection.h" />
|
<ClInclude Include="CriticalSection.h" />
|
||||||
|
@ -57,7 +59,9 @@
|
||||||
<ClInclude Include="std string.h" />
|
<ClInclude Include="std string.h" />
|
||||||
<ClInclude Include="stdafx.h" />
|
<ClInclude Include="stdafx.h" />
|
||||||
<ClInclude Include="stdtypes.h" />
|
<ClInclude Include="stdtypes.h" />
|
||||||
|
<ClInclude Include="SyncEvent.h" />
|
||||||
<ClInclude Include="Trace.h" />
|
<ClInclude Include="Trace.h" />
|
||||||
<ClInclude Include="TraceDefs.h" />
|
<ClInclude Include="TraceDefs.h" />
|
||||||
|
<ClInclude Include="Util.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -41,6 +41,12 @@
|
||||||
<ClCompile Include="CriticalSection.cpp">
|
<ClCompile Include="CriticalSection.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="SyncEvent.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="Util.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="CriticalSection.h">
|
<ClInclude Include="CriticalSection.h">
|
||||||
|
@ -82,5 +88,11 @@
|
||||||
<ClInclude Include="stdtypes.h">
|
<ClInclude Include="stdtypes.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="SyncEvent.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="Util.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -79,20 +79,14 @@ bool CFile::Open(const char * lpszFileName, uint32_t nOpenFlags)
|
||||||
sa.bInheritHandle = (nOpenFlags & modeNoInherit) == 0;
|
sa.bInheritHandle = (nOpenFlags & modeNoInherit) == 0;
|
||||||
|
|
||||||
// map creation flags
|
// map creation flags
|
||||||
ULONG dwCreateFlag = 0;
|
ULONG dwCreateFlag = OPEN_EXISTING;
|
||||||
if (nOpenFlags & modeCreate)
|
if (nOpenFlags & modeCreate)
|
||||||
{
|
{
|
||||||
if (nOpenFlags & modeNoTruncate)
|
dwCreateFlag = ((nOpenFlags & modeNoTruncate) != 0) ? OPEN_ALWAYS : CREATE_ALWAYS;
|
||||||
dwCreateFlag = OPEN_ALWAYS;
|
|
||||||
else
|
|
||||||
dwCreateFlag = CREATE_ALWAYS;
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
dwCreateFlag = OPEN_EXISTING;
|
|
||||||
|
|
||||||
// attempt file creation
|
// attempt file creation
|
||||||
HANDLE hFile = ::CreateFile(lpszFileName, dwAccess, dwShareMode, &sa,
|
HANDLE hFile = ::CreateFile(lpszFileName, dwAccess, dwShareMode, &sa, dwCreateFlag, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||||
dwCreateFlag, FILE_ATTRIBUTE_NORMAL, NULL);
|
|
||||||
if (hFile == INVALID_HANDLE_VALUE)
|
if (hFile == INVALID_HANDLE_VALUE)
|
||||||
{ //#define ERROR_PATH_NOT_FOUND 3L
|
{ //#define ERROR_PATH_NOT_FOUND 3L
|
||||||
//ULONG err = GetLastError();
|
//ULONG err = GetLastError();
|
||||||
|
@ -169,12 +163,12 @@ uint32_t CFile::Read(void* lpBuf, uint32_t nCount)
|
||||||
return 0; // avoid Win32 "null-read"
|
return 0; // avoid Win32 "null-read"
|
||||||
}
|
}
|
||||||
|
|
||||||
ULONG dwRead = 0;
|
DWORD dwRead = 0;
|
||||||
if (!::ReadFile(m_hFile, lpBuf, nCount, &dwRead, NULL))
|
if (!::ReadFile(m_hFile, lpBuf, nCount, &dwRead, NULL))
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return (UINT)dwRead;
|
return (uint32_t)dwRead;
|
||||||
}
|
}
|
||||||
|
|
||||||
long CFile::Seek(long lOff, SeekPosition nFrom)
|
long CFile::Seek(long lOff, SeekPosition nFrom)
|
||||||
|
|
|
@ -5,7 +5,8 @@
|
||||||
class CFileBase
|
class CFileBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum OpenFlags {
|
enum OpenFlags
|
||||||
|
{
|
||||||
modeRead = 0x0000,
|
modeRead = 0x0000,
|
||||||
modeWrite = 0x0001,
|
modeWrite = 0x0001,
|
||||||
modeReadWrite = 0x0002,
|
modeReadWrite = 0x0002,
|
||||||
|
@ -19,7 +20,8 @@ public:
|
||||||
modeNoTruncate = 0x2000,
|
modeNoTruncate = 0x2000,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum Attribute {
|
enum Attribute
|
||||||
|
{
|
||||||
normal = 0x00,
|
normal = 0x00,
|
||||||
readOnly = 0x01,
|
readOnly = 0x01,
|
||||||
hidden = 0x02,
|
hidden = 0x02,
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <TChar.h>
|
|
||||||
|
|
||||||
CLog::CLog (void ) :
|
CLog::CLog (void ) :
|
||||||
m_FlushOnWrite(false),
|
m_FlushOnWrite(false),
|
||||||
|
@ -16,7 +15,7 @@ CLog::~CLog (void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CLog::Open( LPCTSTR FileName, LOG_OPEN_MODE mode /* = Log_New */)
|
bool CLog::Open( const char * FileName, LOG_OPEN_MODE mode /* = Log_New */)
|
||||||
{
|
{
|
||||||
if (FileName == NULL)
|
if (FileName == NULL)
|
||||||
{
|
{
|
||||||
|
@ -34,14 +33,14 @@ bool CLog::Open( LPCTSTR FileName, LOG_OPEN_MODE mode /* = Log_New */)
|
||||||
m_hLogFile.Close();
|
m_hLogFile.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
ULONG nOpenFlags = CFile::modeReadWrite | CFile::modeCreate;
|
uint32_t nOpenFlags = CFile::modeReadWrite | CFile::modeCreate;
|
||||||
if (mode == Log_Append) { nOpenFlags |= CFile::modeNoTruncate; }
|
if (mode == Log_Append) { nOpenFlags |= CFile::modeNoTruncate; }
|
||||||
|
|
||||||
if (!m_hLogFile.Open(File, nOpenFlags))
|
if (!m_hLogFile.Open(File, nOpenFlags))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
m_FileName = (LPCTSTR)File;
|
m_FileName = (const char *)File;
|
||||||
m_hLogFile.Seek(0,mode == Log_Append ? CFile::end : CFile::begin);
|
m_hLogFile.Seek(0,mode == Log_Append ? CFile::end : CFile::begin);
|
||||||
|
|
||||||
#ifdef _UNICODE
|
#ifdef _UNICODE
|
||||||
|
@ -64,7 +63,7 @@ void CLog::Close ( void )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLog::LogF(LPCTSTR Message, ...)
|
void CLog::LogF(const char * Message, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start( ap, Message );
|
va_start( ap, Message );
|
||||||
|
@ -72,7 +71,7 @@ void CLog::LogF(LPCTSTR Message, ...)
|
||||||
va_end( ap );
|
va_end( ap );
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLog::LogArgs(LPCTSTR Message, va_list & args )
|
void CLog::LogArgs(const char * Message, va_list & args )
|
||||||
{
|
{
|
||||||
if (!m_hLogFile.IsOpen()) { return; }
|
if (!m_hLogFile.IsOpen()) { return; }
|
||||||
|
|
||||||
|
@ -112,14 +111,16 @@ void CLog::LogArgs(LPCTSTR Message, va_list & args )
|
||||||
}
|
}
|
||||||
|
|
||||||
if (buffer)
|
if (buffer)
|
||||||
|
{
|
||||||
delete [] buffer;
|
delete [] buffer;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLog::Log( LPCTSTR Message )
|
void CLog::Log( const char * Message )
|
||||||
{
|
{
|
||||||
if (!m_hLogFile.IsOpen()) { return; }
|
if (!m_hLogFile.IsOpen()) { return; }
|
||||||
m_hLogFile.Write(Message,(ULONG)_tcslen(Message)*sizeof(TCHAR));
|
m_hLogFile.Write(Message,(uint32_t)strlen(Message)*sizeof(TCHAR));
|
||||||
if (m_FlushOnWrite)
|
if (m_FlushOnWrite)
|
||||||
{
|
{
|
||||||
m_hLogFile.Flush();
|
m_hLogFile.Flush();
|
||||||
|
@ -128,7 +129,7 @@ void CLog::Log( LPCTSTR Message )
|
||||||
if (m_TruncateFileLog)
|
if (m_TruncateFileLog)
|
||||||
{
|
{
|
||||||
// check file size
|
// check file size
|
||||||
ULONG FileSize = m_hLogFile.GetLength();
|
uint32_t FileSize = m_hLogFile.GetLength();
|
||||||
// if larger then max size then
|
// if larger then max size then
|
||||||
if (FileSize > m_MaxFileSize)
|
if (FileSize > m_MaxFileSize)
|
||||||
{
|
{
|
||||||
|
@ -138,16 +139,17 @@ void CLog::Log( LPCTSTR Message )
|
||||||
FileSize = m_hLogFile.GetLength();
|
FileSize = m_hLogFile.GetLength();
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD end = m_hLogFile.SeekToEnd();
|
uint32_t end = m_hLogFile.SeekToEnd();
|
||||||
|
|
||||||
// move to reduce size
|
// move to reduce size
|
||||||
m_hLogFile.Seek((end - m_MaxFileSize) + m_FileChangeSize,CFile::begin);
|
m_hLogFile.Seek((end - m_MaxFileSize) + m_FileChangeSize,CFile::begin);
|
||||||
|
|
||||||
// Find next end of line
|
// Find next end of line
|
||||||
DWORD NextEnter = 0, dwRead = 0;
|
uint32_t NextEnter = 0, dwRead = 0;
|
||||||
do {
|
do
|
||||||
|
{
|
||||||
BYTE Data[300];
|
BYTE Data[300];
|
||||||
DWORD dwRead;
|
uint32_t dwRead;
|
||||||
|
|
||||||
dwRead = m_hLogFile.Read(Data,sizeof(Data));
|
dwRead = m_hLogFile.Read(Data,sizeof(Data));
|
||||||
if (dwRead == 0)
|
if (dwRead == 0)
|
||||||
|
@ -168,9 +170,10 @@ void CLog::Log( LPCTSTR Message )
|
||||||
} while(dwRead != 0);
|
} while(dwRead != 0);
|
||||||
|
|
||||||
// copy content of log to the new file
|
// copy content of log to the new file
|
||||||
DWORD ReadPos = (end - m_MaxFileSize) + m_FileChangeSize + NextEnter;
|
uint32_t ReadPos = (end - m_MaxFileSize) + m_FileChangeSize + NextEnter;
|
||||||
DWORD SizeToRead, WritePos = 0;
|
uint32_t SizeToRead, WritePos = 0;
|
||||||
do {
|
do
|
||||||
|
{
|
||||||
enum { fIS_MvSize = 0x5000 };
|
enum { fIS_MvSize = 0x5000 };
|
||||||
unsigned char Data[fIS_MvSize + 1];
|
unsigned char Data[fIS_MvSize + 1];
|
||||||
|
|
||||||
|
@ -179,7 +182,7 @@ void CLog::Log( LPCTSTR Message )
|
||||||
|
|
||||||
m_hLogFile.Seek(ReadPos,CFile::begin);
|
m_hLogFile.Seek(ReadPos,CFile::begin);
|
||||||
|
|
||||||
DWORD dwRead;
|
uint32_t dwRead;
|
||||||
dwRead = m_hLogFile.Read(Data,SizeToRead);
|
dwRead = m_hLogFile.Read(Data,SizeToRead);
|
||||||
|
|
||||||
m_hLogFile.Seek(WritePos,CFile::begin);
|
m_hLogFile.Seek(WritePos,CFile::begin);
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
#ifndef __LOG_CLASS__H__
|
#pragma once
|
||||||
#define __LOG_CLASS__H__
|
#include "File Class.h"
|
||||||
|
|
||||||
enum LOG_OPEN_MODE {
|
enum LOG_OPEN_MODE
|
||||||
|
{
|
||||||
Log_New, Log_Append
|
Log_New, Log_Append
|
||||||
};
|
};
|
||||||
|
|
||||||
class CLog {
|
class CLog
|
||||||
|
{
|
||||||
enum { MB = 1024 * 1024 };
|
enum { MB = 1024 * 1024 };
|
||||||
enum { MAX_FILE_SIZE = 10 * MB };
|
enum { MAX_FILE_SIZE = 10 * MB };
|
||||||
|
|
||||||
|
@ -13,24 +15,24 @@ class CLog {
|
||||||
bool m_FlushOnWrite;
|
bool m_FlushOnWrite;
|
||||||
stdstr m_FileName;
|
stdstr m_FileName;
|
||||||
bool m_TruncateFileLog;
|
bool m_TruncateFileLog;
|
||||||
ULONG m_MaxFileSize;
|
uint32_t m_MaxFileSize;
|
||||||
ULONG m_FileChangeSize;
|
uint32_t m_FileChangeSize;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CLog ( void );
|
CLog ( void );
|
||||||
~CLog ( void );
|
~CLog ( void );
|
||||||
|
|
||||||
bool Open ( LPCTSTR FileName, LOG_OPEN_MODE mode = Log_New );
|
bool Open ( const char * FileName, LOG_OPEN_MODE mode = Log_New );
|
||||||
void Log ( LPCTSTR Message );
|
void Log ( const char * Message );
|
||||||
void LogF ( LPCTSTR Message, ... );
|
void LogF ( const char * Message, ... );
|
||||||
void LogArgs ( LPCTSTR Message, va_list & args );
|
void LogArgs ( const char * Message, va_list & args );
|
||||||
bool Empty ( void );
|
bool Empty ( void );
|
||||||
void Close ( void );
|
void Close ( void );
|
||||||
|
|
||||||
inline void SetMaxFileSize ( ULONG Size )
|
inline void SetMaxFileSize ( uint32_t Size )
|
||||||
{
|
{
|
||||||
m_MaxFileSize = Size;
|
m_MaxFileSize = Size;
|
||||||
m_FileChangeSize = (ULONG)(Size * 0.1);
|
m_FileChangeSize = (uint32_t)(Size * 0.1);
|
||||||
}
|
}
|
||||||
inline void SetTruncateFile( bool Truncate ) { m_TruncateFileLog = Truncate; }
|
inline void SetTruncateFile( bool Truncate ) { m_TruncateFileLog = Truncate; }
|
||||||
inline void SetFlush ( bool Always ) { m_FlushOnWrite = Always; }
|
inline void SetFlush ( bool Always ) { m_FlushOnWrite = Always; }
|
||||||
|
@ -38,5 +40,3 @@ public:
|
||||||
inline bool Flush ( void ) { return m_hLogFile.Flush(); }
|
inline bool Flush ( void ) { return m_hLogFile.Flush(); }
|
||||||
inline const stdstr & FileName ( void ) const { return m_FileName; }
|
inline const stdstr & FileName ( void ) const { return m_FileName; }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
#include "stdafx.h"
|
||||||
|
|
||||||
|
SyncEvent::SyncEvent(bool bManualReset)
|
||||||
|
{
|
||||||
|
m_Event = CreateEvent(NULL, bManualReset, FALSE, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
SyncEvent::~SyncEvent()
|
||||||
|
{
|
||||||
|
CloseHandle(m_Event);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SyncEvent::Trigger()
|
||||||
|
{
|
||||||
|
SetEvent(m_Event);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SyncEvent::IsTriggered(int32_t iWaitTime)
|
||||||
|
{
|
||||||
|
return (WAIT_OBJECT_0 == WaitForSingleObject(m_Event,iWaitTime));
|
||||||
|
}
|
||||||
|
|
||||||
|
void SyncEvent::Reset()
|
||||||
|
{
|
||||||
|
ResetEvent(m_Event);
|
||||||
|
}
|
||||||
|
|
||||||
|
void * SyncEvent::GetHandle()
|
||||||
|
{
|
||||||
|
return m_Event;
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
class SyncEvent
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
enum { INFINITE_TIMEOUT = 0xFFFFFFFF };
|
||||||
|
|
||||||
|
SyncEvent(bool bManualReset = true);
|
||||||
|
~SyncEvent(void);
|
||||||
|
|
||||||
|
void Trigger (void);
|
||||||
|
bool IsTriggered (int32_t iWaitTime = 0);
|
||||||
|
void Reset();
|
||||||
|
void * GetHandle();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
SyncEvent(const SyncEvent&); // Disable copy constructor
|
||||||
|
SyncEvent& operator=(const SyncEvent&); // Disable assignment
|
||||||
|
|
||||||
|
void * m_Event;
|
||||||
|
};
|
|
@ -134,7 +134,6 @@ void CTraceLog::WriteTrace ( TraceType Type, LPCTSTR Message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CTraceLog & GetTraceObjet(void)
|
CTraceLog & GetTraceObjet(void)
|
||||||
{
|
{
|
||||||
static CTraceLog TraceLog;
|
static CTraceLog TraceLog;
|
||||||
|
@ -192,7 +191,7 @@ CTraceFileLog::CTraceFileLog(LPCTSTR FileName, bool FlushFile ) :
|
||||||
m_hLogFile.Open(FileName, Log_Append);
|
m_hLogFile.Open(FileName, Log_Append);
|
||||||
}
|
}
|
||||||
|
|
||||||
CTraceFileLog::CTraceFileLog (LPCTSTR FileName, bool FlushFile, LOG_OPEN_MODE eMode, DWORD dwMaxFileSize) :
|
CTraceFileLog::CTraceFileLog(LPCTSTR FileName, bool FlushFile, LOG_OPEN_MODE eMode, size_t dwMaxFileSize) :
|
||||||
m_FlushFile(FlushFile)
|
m_FlushFile(FlushFile)
|
||||||
{
|
{
|
||||||
enum { MB = 1024 * 1024 };
|
enum { MB = 1024 * 1024 };
|
||||||
|
@ -200,15 +199,15 @@ CTraceFileLog::CTraceFileLog (LPCTSTR FileName, bool FlushFile, LOG_OPEN_MODE eM
|
||||||
m_hLogFile.SetFlush(false);
|
m_hLogFile.SetFlush(false);
|
||||||
m_hLogFile.SetTruncateFile(true);
|
m_hLogFile.SetTruncateFile(true);
|
||||||
|
|
||||||
if(dwMaxFileSize < 2048 && dwMaxFileSize > 2)
|
if (dwMaxFileSize < 3 || dwMaxFileSize > 2047)
|
||||||
|
{ /* Clamp file size to 5 MB if it exceeds 2047 or falls short of 3. */
|
||||||
|
dwMaxFileSize = 5;
|
||||||
|
}
|
||||||
m_hLogFile.SetMaxFileSize(dwMaxFileSize * MB);
|
m_hLogFile.SetMaxFileSize(dwMaxFileSize * MB);
|
||||||
else
|
|
||||||
m_hLogFile.SetMaxFileSize(5 * MB);
|
|
||||||
|
|
||||||
m_hLogFile.Open(FileName, eMode);
|
m_hLogFile.Open(FileName, eMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CTraceFileLog::~CTraceFileLog()
|
CTraceFileLog::~CTraceFileLog()
|
||||||
{
|
{
|
||||||
TraceClosed = true;
|
TraceClosed = true;
|
||||||
|
@ -234,3 +233,12 @@ void CTraceFileLog::SetFlushFile( bool bFlushFile )
|
||||||
{
|
{
|
||||||
m_FlushFile = bFlushFile;
|
m_FlushFile = bFlushFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CDebugTraceLog::Write(const char * Message, bool EndOfLine)
|
||||||
|
{
|
||||||
|
OutputDebugString(Message);
|
||||||
|
if (EndOfLine)
|
||||||
|
{
|
||||||
|
OutputDebugString("\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "CriticalSection.h"
|
||||||
|
#include "Log Class.h"
|
||||||
|
|
||||||
class CTraceModule
|
class CTraceModule
|
||||||
{
|
{
|
||||||
TraceLevel m_Type;
|
TraceLevel m_Type;
|
||||||
|
@ -10,7 +13,7 @@ public:
|
||||||
|
|
||||||
inline void SetTraceLevel ( TraceLevel Type ) { m_Type = Type; }
|
inline void SetTraceLevel ( TraceLevel Type ) { m_Type = Type; }
|
||||||
inline TraceLevel GetTraceLevel ( void ) const { return m_Type; }
|
inline TraceLevel GetTraceLevel ( void ) const { return m_Type; }
|
||||||
virtual void Write ( LPCTSTR Message, bool EndOfLine ) = 0;
|
virtual void Write ( const char * Message, bool EndOfLine ) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CTraceFileLog : public CTraceModule
|
class CTraceFileLog : public CTraceModule
|
||||||
|
@ -22,25 +25,18 @@ class CTraceFileLog : public CTraceModule
|
||||||
bool m_FlushFile;
|
bool m_FlushFile;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CTraceFileLog (LPCTSTR FileName, bool FlushFile = true);
|
CTraceFileLog (const char * FileName, bool FlushFile = true);
|
||||||
CTraceFileLog (LPCTSTR FileName, bool FlushFile, LOG_OPEN_MODE eMode, DWORD dwMaxFileSize = 5);
|
CTraceFileLog(const char * FileName, bool FlushFile, LOG_OPEN_MODE eMode, size_t dwMaxFileSize = 5);
|
||||||
virtual ~CTraceFileLog ();
|
virtual ~CTraceFileLog ();
|
||||||
|
|
||||||
void Write ( LPCTSTR Message, bool EndOfLine );
|
void Write ( const char * Message, bool EndOfLine );
|
||||||
void SetFlushFile ( bool bFlushFile );
|
void SetFlushFile ( bool bFlushFile );
|
||||||
};
|
};
|
||||||
|
|
||||||
class CDebugTraceLog : public CTraceModule
|
class CDebugTraceLog : public CTraceModule
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void Write ( LPCTSTR Message, bool EndOfLine )
|
void Write ( const char * Message, bool EndOfLine );
|
||||||
{
|
|
||||||
OutputDebugString(Message);
|
|
||||||
if (EndOfLine)
|
|
||||||
{
|
|
||||||
OutputDebugString("\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
CTraceModule * AddTraceModule ( CTraceModule * TraceModule ); // Must be created with new
|
CTraceModule * AddTraceModule ( CTraceModule * TraceModule ); // Must be created with new
|
||||||
|
|
|
@ -0,0 +1,61 @@
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "Util.h"
|
||||||
|
#include <Tlhelp32.h>
|
||||||
|
|
||||||
|
void pjutil::Sleep(uint32_t timeout)
|
||||||
|
{
|
||||||
|
::Sleep(timeout);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool pjutil::TerminatedExistingExe()
|
||||||
|
{
|
||||||
|
bool bTerminated = false;
|
||||||
|
bool AskedUser = false;
|
||||||
|
DWORD pid = GetCurrentProcessId();
|
||||||
|
|
||||||
|
HANDLE nSearch = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
|
||||||
|
if (nSearch != INVALID_HANDLE_VALUE)
|
||||||
|
{
|
||||||
|
PROCESSENTRY32 lppe;
|
||||||
|
|
||||||
|
memset(&lppe, 0, sizeof(PROCESSENTRY32));
|
||||||
|
lppe.dwSize = sizeof(PROCESSENTRY32);
|
||||||
|
stdstr ModuleName = CPath(CPath::MODULE_FILE).GetNameExtension();
|
||||||
|
|
||||||
|
if (Process32First(nSearch, &lppe))
|
||||||
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
if (_stricmp(lppe.szExeFile, ModuleName.c_str()) != 0 ||
|
||||||
|
lppe.th32ProcessID == pid)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!AskedUser)
|
||||||
|
{
|
||||||
|
AskedUser = true;
|
||||||
|
int res = MessageBox(NULL, stdstr_f("%s currently running\n\nTerminate pid %d now?", ModuleName.c_str(), lppe.th32ProcessID).c_str(), stdstr_f("Terminate %s",ModuleName.c_str()).c_str(), MB_YESNO | MB_ICONEXCLAMATION);
|
||||||
|
if (res != IDYES)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
HANDLE hHandle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, lppe.th32ProcessID);
|
||||||
|
if (hHandle != NULL)
|
||||||
|
{
|
||||||
|
if (TerminateProcess(hHandle, 0))
|
||||||
|
{
|
||||||
|
bTerminated = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox(NULL, stdstr_f("Failed to terminate pid %d", lppe.th32ProcessID).c_str(), stdstr_f("Terminate %s failed!",ModuleName.c_str()).c_str(), MB_YESNO | MB_ICONEXCLAMATION);
|
||||||
|
}
|
||||||
|
CloseHandle(hHandle);
|
||||||
|
}
|
||||||
|
} while (Process32Next(nSearch, &lppe));
|
||||||
|
}
|
||||||
|
CloseHandle(nSearch);
|
||||||
|
}
|
||||||
|
return bTerminated;
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
#pragma once
|
||||||
|
#include "stdtypes.h"
|
||||||
|
|
||||||
|
class pjutil
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static void Sleep(uint32_t timeout);
|
||||||
|
static bool TerminatedExistingExe();
|
||||||
|
|
||||||
|
private:
|
||||||
|
pjutil(void); // Disable default constructor
|
||||||
|
pjutil(const pjutil&); // Disable copy constructor
|
||||||
|
pjutil& operator=(const pjutil&); // Disable assignment
|
||||||
|
};
|
|
@ -39,11 +39,7 @@ documentation and/or software.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if !defined(AFX_MD5_H__6DD6923B_E241_40CE_81A3_4C2C88C140E4__INCLUDED_)
|
#pragma once
|
||||||
#define AFX_MD5_H__6DD6923B_E241_40CE_81A3_4C2C88C140E4__INCLUDED_
|
|
||||||
|
|
||||||
/* sprintf() */
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
@ -55,11 +51,13 @@ struct MD5Digest
|
||||||
unsigned char digest[16];
|
unsigned char digest[16];
|
||||||
|
|
||||||
void Reset() { ::memset(digest, 0, sizeof(digest)); }
|
void Reset() { ::memset(digest, 0, sizeof(digest)); }
|
||||||
BOOL IsClear()
|
bool IsClear()
|
||||||
{
|
{
|
||||||
int isClear = 0;
|
int isClear = 0;
|
||||||
for (int i=0; i < 16; i++)
|
for (int i=0; i < 16; i++)
|
||||||
|
{
|
||||||
isClear += digest[i];
|
isClear += digest[i];
|
||||||
|
}
|
||||||
return (isClear == 0);
|
return (isClear == 0);
|
||||||
}
|
}
|
||||||
std::string String ( void )
|
std::string String ( void )
|
||||||
|
@ -88,7 +86,6 @@ struct MD5Digest_less : std::binary_function<MD5Digest, MD5Digest, bool>
|
||||||
|
|
||||||
class MD5
|
class MD5
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// methods for controlled operation:
|
// methods for controlled operation:
|
||||||
MD5 (); // simple initializer
|
MD5 (); // simple initializer
|
||||||
|
@ -148,9 +145,4 @@ private:
|
||||||
uint4 s, uint4 ac);
|
uint4 s, uint4 ac);
|
||||||
static inline void II (uint4& a, uint4 b, uint4 c, uint4 d, uint4 x,
|
static inline void II (uint4& a, uint4 b, uint4 c, uint4 d, uint4 x,
|
||||||
uint4 s, uint4 ac);
|
uint4 s, uint4 ac);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif // !defined(AFX_MD5_H__6DD6923B_E241_40CE_81A3_4C2C88C140E4__INCLUDED_)
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
|
#include <malloc.h>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
stdstr::stdstr()
|
stdstr::stdstr()
|
||||||
|
|
|
@ -51,5 +51,22 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class stdwstr_f : public std::wstring
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
stdwstr_f(const wchar_t * strFormat, ...)
|
||||||
|
{
|
||||||
|
va_list args;
|
||||||
|
va_start(args, strFormat);
|
||||||
|
|
||||||
|
wchar_t Msg[1000];
|
||||||
|
_vsnwprintf(Msg, sizeof(Msg) - 1, strFormat, args);
|
||||||
|
|
||||||
|
va_end(args);
|
||||||
|
|
||||||
|
this->assign(Msg);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
typedef std::list<stdstr> strlist;
|
typedef std::list<stdstr> strlist;
|
||||||
typedef strlist::iterator strlist_iter;
|
typedef strlist::iterator strlist_iter;
|
||||||
|
|
|
@ -16,3 +16,4 @@
|
||||||
#include "Trace.h"
|
#include "Trace.h"
|
||||||
#include "md5.h"
|
#include "md5.h"
|
||||||
#include "Smart Pointer.h"
|
#include "Smart Pointer.h"
|
||||||
|
#include "SyncEvent.h"
|
||||||
|
|
|
@ -87,41 +87,17 @@ static int left_z, left_dzdy;
|
||||||
|
|
||||||
__inline int imul16(int x, int y) // (x * y) >> 16
|
__inline int imul16(int x, int y) // (x * y) >> 16
|
||||||
{
|
{
|
||||||
return (((long long)x) * ((long long)y)) >> 16;
|
return ((int64_t)x * (int64_t)y) >> 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
__inline int imul14(int x, int y) // (x * y) >> 14
|
__inline int imul14(int x, int y) // (x * y) >> 14
|
||||||
{
|
{
|
||||||
return (((long long)x) * ((long long)y)) >> 14;
|
return ((int64_t)x * (int64_t)y) >> 14;
|
||||||
}
|
}
|
||||||
|
|
||||||
__inline int idiv16(int x, int y) // (x << 16) / y
|
__inline int idiv16(int x, int y) // (x << 16) / y
|
||||||
{
|
{
|
||||||
//x = (((long long)x) << 16) / ((long long)y);
|
x = ((int64_t)x << 16) / (int64_t)y;
|
||||||
/*
|
|
||||||
eax = x;
|
|
||||||
ebx = y;
|
|
||||||
edx = x;
|
|
||||||
(x << 16) | ()
|
|
||||||
*/
|
|
||||||
#if !defined(__GNUC__) && !defined(NO_ASM)
|
|
||||||
__asm {
|
|
||||||
mov eax, x
|
|
||||||
mov ebx, y
|
|
||||||
mov edx,eax
|
|
||||||
sar edx,16
|
|
||||||
shl eax,16
|
|
||||||
idiv ebx
|
|
||||||
mov x, eax
|
|
||||||
}
|
|
||||||
#elif !defined(NO_ASM)
|
|
||||||
int reminder;
|
|
||||||
asm ("idivl %[divisor]"
|
|
||||||
: "=a" (x), "=d" (reminder)
|
|
||||||
: [divisor] "g" (y), "d" (x >> 16), "a" (x << 16));
|
|
||||||
#else
|
|
||||||
x = (((long long)x) << 16) / ((long long)y);
|
|
||||||
#endif
|
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,9 +37,9 @@
|
||||||
//
|
//
|
||||||
//****************************************************************
|
//****************************************************************
|
||||||
|
|
||||||
|
#include <Common/std string.h>
|
||||||
#include "Gfx_1.3.h"
|
#include "Gfx_1.3.h"
|
||||||
#include "Version.h"
|
#include "Version.h"
|
||||||
#include <Common/std string.h>
|
|
||||||
#include <Settings/Settings.h>
|
#include <Settings/Settings.h>
|
||||||
|
|
||||||
#include <wx/fileconf.h>
|
#include <wx/fileconf.h>
|
||||||
|
@ -1197,7 +1197,7 @@ int DllUnload(void)
|
||||||
void wxSetInstance(HINSTANCE hInstance);
|
void wxSetInstance(HINSTANCE hInstance);
|
||||||
|
|
||||||
extern "C" int WINAPI DllMain (HINSTANCE hinst,
|
extern "C" int WINAPI DllMain (HINSTANCE hinst,
|
||||||
wxUint32 fdwReason,
|
DWORD fdwReason,
|
||||||
LPVOID /*lpReserved*/)
|
LPVOID /*lpReserved*/)
|
||||||
{
|
{
|
||||||
sprintf (out_buf, "DllMain (%0p - %d)\n", hinst, fdwReason);
|
sprintf (out_buf, "DllMain (%0p - %d)\n", hinst, fdwReason);
|
||||||
|
|
|
@ -830,12 +830,20 @@ extern const char *CIStatus[];
|
||||||
#define FBL_D_1 2
|
#define FBL_D_1 2
|
||||||
#define FBL_D_0 3
|
#define FBL_D_0 3
|
||||||
|
|
||||||
|
/*
|
||||||
|
* taken straight from MSVC <windef.h> in case of other compilers
|
||||||
|
*
|
||||||
|
* Careful! These macros can sabotage std::max and std::min from <vector>.
|
||||||
|
* The only solution is to include <vector> first, before <windef.h> or
|
||||||
|
* before defining the below macros (or just don't use <windows.h>).
|
||||||
|
*/
|
||||||
#ifndef max
|
#ifndef max
|
||||||
#define max(a, b) (((a) > (b)) ? (a) : (b))
|
#define max(a, b) (((a) > (b)) ? (a) : (b))
|
||||||
#endif
|
#endif
|
||||||
#ifndef min
|
#ifndef min
|
||||||
#define min(a, b) (((a) < (b)) ? (a) : (b))
|
#define min(a, b) (((a) < (b)) ? (a) : (b))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef TRUE
|
#ifndef TRUE
|
||||||
#define TRUE 1
|
#define TRUE 1
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -0,0 +1,139 @@
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include <Common\Util.h>
|
||||||
|
|
||||||
|
void FixDirectories(void);
|
||||||
|
void FixLocale(void);
|
||||||
|
|
||||||
|
static void IncreaseThreadPriority(void);
|
||||||
|
|
||||||
|
static CTraceFileLog * g_LogFile = NULL;
|
||||||
|
|
||||||
|
void LogLevelChanged(CTraceFileLog * LogFile)
|
||||||
|
{
|
||||||
|
LogFile->SetTraceLevel((TraceLevel)g_Settings->LoadDword(Debugger_AppLogLevel));
|
||||||
|
}
|
||||||
|
|
||||||
|
void LogFlushChanged(CTraceFileLog * LogFile)
|
||||||
|
{
|
||||||
|
LogFile->SetFlushFile(g_Settings->LoadDword(Debugger_AppLogFlush) != 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void InitializeLog(void)
|
||||||
|
{
|
||||||
|
CPath LogFilePath(CPath::MODULE_DIRECTORY);
|
||||||
|
LogFilePath.AppendDirectory("Logs");
|
||||||
|
if (!LogFilePath.DirectoryExists())
|
||||||
|
{
|
||||||
|
LogFilePath.DirectoryCreate();
|
||||||
|
}
|
||||||
|
LogFilePath.SetNameExtension("Project64.log");
|
||||||
|
|
||||||
|
g_LogFile = new CTraceFileLog(LogFilePath, g_Settings->LoadDword(Debugger_AppLogFlush) != 0, Log_New, 500);
|
||||||
|
#ifdef VALIDATE_DEBUG
|
||||||
|
g_LogFile->SetTraceLevel((TraceLevel)(g_Settings->LoadDword(Debugger_AppLogLevel) | TraceValidate | TraceDebug));
|
||||||
|
#else
|
||||||
|
g_LogFile->SetTraceLevel((TraceLevel)g_Settings->LoadDword(Debugger_AppLogLevel));
|
||||||
|
#endif
|
||||||
|
AddTraceModule(g_LogFile);
|
||||||
|
|
||||||
|
g_Settings->RegisterChangeCB(Debugger_AppLogLevel, g_LogFile, (CSettings::SettingChangedFunc)LogLevelChanged);
|
||||||
|
g_Settings->RegisterChangeCB(Debugger_AppLogFlush, g_LogFile, (CSettings::SettingChangedFunc)LogFlushChanged);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AppInit(CNotification * Notify)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
g_Notify = Notify;
|
||||||
|
|
||||||
|
FixDirectories();
|
||||||
|
FixLocale();
|
||||||
|
|
||||||
|
stdstr_f AppName("Project64 %s", VER_FILE_VERSION_STR);
|
||||||
|
IncreaseThreadPriority();
|
||||||
|
|
||||||
|
g_Settings = new CSettings;
|
||||||
|
g_Settings->Initialize(AppName.c_str());
|
||||||
|
|
||||||
|
if (g_Settings->LoadBool(Setting_CheckEmuRunning) &&
|
||||||
|
pjutil::TerminatedExistingExe())
|
||||||
|
{
|
||||||
|
delete g_Settings;
|
||||||
|
g_Settings = new CSettings;
|
||||||
|
g_Settings->Initialize(AppName.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
InitializeLog();
|
||||||
|
|
||||||
|
WriteTrace(TraceDebug, __FUNCTION__ ": Application Starting");
|
||||||
|
CMipsMemoryVM::ReserveMemory();
|
||||||
|
|
||||||
|
//Create the plugin container
|
||||||
|
WriteTrace(TraceDebug, __FUNCTION__ ": Create Plugins");
|
||||||
|
g_Plugins = new CPlugins(g_Settings->LoadStringVal(Directory_Plugin));
|
||||||
|
|
||||||
|
g_Lang = new CLanguage();
|
||||||
|
g_Lang->LoadCurrentStrings();
|
||||||
|
g_Notify->AppInitDone();
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
g_Notify->DisplayError(stdstr_f("Exception caught\nFile: %s\nLine: %d", __FILE__, __LINE__).ToUTF16().c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AppCleanup(void)
|
||||||
|
{
|
||||||
|
g_Settings->UnregisterChangeCB(Debugger_AppLogLevel, g_LogFile, (CSettings::SettingChangedFunc)LogLevelChanged);
|
||||||
|
g_Settings->UnregisterChangeCB(Debugger_AppLogFlush, g_LogFile, (CSettings::SettingChangedFunc)LogFlushChanged);
|
||||||
|
WriteTrace(TraceDebug, __FUNCTION__ ": cleaning up global objects");
|
||||||
|
|
||||||
|
if (g_Rom) { delete g_Rom; g_Rom = NULL; }
|
||||||
|
if (g_Plugins) { delete g_Plugins; g_Plugins = NULL; }
|
||||||
|
if (g_Settings) { delete g_Settings; g_Settings = NULL; }
|
||||||
|
if (g_Lang) { delete g_Lang; g_Lang = NULL; }
|
||||||
|
|
||||||
|
CMipsMemoryVM::FreeReservedMemory();
|
||||||
|
|
||||||
|
WriteTrace(TraceDebug, __FUNCTION__ ": Done");
|
||||||
|
CloseTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
void FixDirectories(void)
|
||||||
|
{
|
||||||
|
CPath Directory(CPath::MODULE_DIRECTORY);
|
||||||
|
Directory.AppendDirectory("Config");
|
||||||
|
if (!Directory.DirectoryExists()) Directory.DirectoryCreate();
|
||||||
|
|
||||||
|
Directory.UpDirectory();
|
||||||
|
Directory.AppendDirectory("Logs");
|
||||||
|
if (!Directory.DirectoryExists()) Directory.DirectoryCreate();
|
||||||
|
|
||||||
|
Directory.UpDirectory();
|
||||||
|
Directory.AppendDirectory("Save");
|
||||||
|
if (!Directory.DirectoryExists()) Directory.DirectoryCreate();
|
||||||
|
|
||||||
|
Directory.UpDirectory();
|
||||||
|
Directory.AppendDirectory("Screenshots");
|
||||||
|
if (!Directory.DirectoryExists()) Directory.DirectoryCreate();
|
||||||
|
|
||||||
|
Directory.UpDirectory();
|
||||||
|
Directory.AppendDirectory("textures");
|
||||||
|
if (!Directory.DirectoryExists()) Directory.DirectoryCreate();
|
||||||
|
}
|
||||||
|
|
||||||
|
#include <windows.h>
|
||||||
|
void FixLocale(void)
|
||||||
|
{
|
||||||
|
char *lbuffer = new char[10];
|
||||||
|
if (GetLocaleInfoA(LOCALE_SYSTEM_DEFAULT, LOCALE_SABBREVLANGNAME, lbuffer, 10))
|
||||||
|
{
|
||||||
|
setlocale(LC_ALL, lbuffer);
|
||||||
|
}
|
||||||
|
delete[] lbuffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
void IncreaseThreadPriority(void)
|
||||||
|
{
|
||||||
|
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_ABOVE_NORMAL);
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <Project64\User Interface\Notification Class.h>
|
||||||
|
|
||||||
|
void AppInit(CNotification * Notify);
|
||||||
|
void AppCleanup(void);
|
|
@ -10,20 +10,7 @@
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
class CDelaySlotFunctionMap
|
__interface CDebugger
|
||||||
{
|
{
|
||||||
typedef std::map<DWORD,CCompiledFunc *> FUNCTION_MAP;
|
virtual void TLBChanged(void) = 0;
|
||||||
|
|
||||||
FUNCTION_MAP FunctionMap;
|
|
||||||
|
|
||||||
public:
|
|
||||||
CDelaySlotFunctionMap();
|
|
||||||
~CDelaySlotFunctionMap();
|
|
||||||
|
|
||||||
CCompiledFunc* AddFunctionInfo(DWORD vAddr, DWORD pAddr);
|
|
||||||
CCompiledFunc* FindFunction(DWORD vAddr, int Length);
|
|
||||||
CCompiledFunc* FindFunction(DWORD vAddr) const;
|
|
||||||
|
|
||||||
void Remove(CCompiledFunc* info);
|
|
||||||
void Reset();
|
|
||||||
};
|
};
|
|
@ -0,0 +1,28 @@
|
||||||
|
/****************************************************************************
|
||||||
|
* *
|
||||||
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
|
* http://www.pj64-emu.com/ *
|
||||||
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
|
* *
|
||||||
|
* License: *
|
||||||
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
|
* *
|
||||||
|
****************************************************************************/
|
||||||
|
#pragma once
|
||||||
|
#include <Project64\Settings\Logging Settings.h>
|
||||||
|
#include <Common\File Class.h>
|
||||||
|
|
||||||
|
class CLogging :
|
||||||
|
public CLogSettings
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static void StartLog(void);
|
||||||
|
static void StopLog(void);
|
||||||
|
|
||||||
|
static void Log_LW(uint32_t PC, uint32_t VAddr);
|
||||||
|
static void Log_SW(uint32_t PC, uint32_t VAddr, uint32_t Value);
|
||||||
|
static void LogMessage(const char * Message, ...);
|
||||||
|
|
||||||
|
private:
|
||||||
|
static CFile * m_hLogFile;
|
||||||
|
};
|
|
@ -117,6 +117,7 @@ enum LanguageStringID{
|
||||||
MENU_SLOT_8 = 198,
|
MENU_SLOT_8 = 198,
|
||||||
MENU_SLOT_9 = 199,
|
MENU_SLOT_9 = 199,
|
||||||
MENU_SLOT_10 = 200,
|
MENU_SLOT_10 = 200,
|
||||||
|
MENU_SLOT_SAVE = 201,
|
||||||
|
|
||||||
//Pop up Menu
|
//Pop up Menu
|
||||||
POPUP_PLAY = 210,
|
POPUP_PLAY = 210,
|
||||||
|
|
|
@ -124,6 +124,7 @@ void CLanguage::LoadDefaultStrings (void)
|
||||||
DEF_STR(MENU_SLOT_8, L"Slot 8");
|
DEF_STR(MENU_SLOT_8, L"Slot 8");
|
||||||
DEF_STR(MENU_SLOT_9, L"Slot 9");
|
DEF_STR(MENU_SLOT_9, L"Slot 9");
|
||||||
DEF_STR(MENU_SLOT_10, L"Slot 10");
|
DEF_STR(MENU_SLOT_10, L"Slot 10");
|
||||||
|
DEF_STR(MENU_SLOT_SAVE, L"Save slot (%ws) selected");
|
||||||
|
|
||||||
//Pop up Menu
|
//Pop up Menu
|
||||||
DEF_STR(POPUP_PLAY, L"Play Game");
|
DEF_STR(POPUP_PLAY, L"Play Game");
|
||||||
|
@ -315,7 +316,7 @@ void CLanguage::LoadDefaultStrings (void)
|
||||||
DEF_STR(SAVE_FIRST_USED, L"Use first-used save type");
|
DEF_STR(SAVE_FIRST_USED, L"Use first-used save type");
|
||||||
DEF_STR(SAVE_4K_EEPROM, L"4-kbit EEPROM");
|
DEF_STR(SAVE_4K_EEPROM, L"4-kbit EEPROM");
|
||||||
DEF_STR(SAVE_16K_EEPROM, L"16-kbit EEPROM");
|
DEF_STR(SAVE_16K_EEPROM, L"16-kbit EEPROM");
|
||||||
DEF_STR(SAVE_SRAM, L"32-kbyte SRAM");
|
DEF_STR(SAVE_SRAM, L"SRAM");
|
||||||
DEF_STR(SAVE_FLASHRAM, L"Flash RAM");
|
DEF_STR(SAVE_FLASHRAM, L"Flash RAM");
|
||||||
|
|
||||||
//Shell Integration Tab
|
//Shell Integration Tab
|
||||||
|
@ -641,7 +642,7 @@ std::wstring CLanguage::GetLangString ( const char * FileName, LanguageStringID
|
||||||
LANG_STR CLanguage::GetNextLangString(void * OpenFile)
|
LANG_STR CLanguage::GetNextLangString(void * OpenFile)
|
||||||
{
|
{
|
||||||
enum { MAX_STRING_LEN = 400 };
|
enum { MAX_STRING_LEN = 400 };
|
||||||
int StringID;
|
int32_t StringID;
|
||||||
char szString[MAX_STRING_LEN]; //temp store the string from the file
|
char szString[MAX_STRING_LEN]; //temp store the string from the file
|
||||||
|
|
||||||
FILE * file = (FILE *)OpenFile;
|
FILE * file = (FILE *)OpenFile;
|
||||||
|
@ -686,7 +687,7 @@ LANG_STR CLanguage::GetNextLangString (void * OpenFile)
|
||||||
StringID = EMPTY_STRING; return LANG_STR(0, L"");
|
StringID = EMPTY_STRING; return LANG_STR(0, L"");
|
||||||
}
|
}
|
||||||
|
|
||||||
int pos = 0;
|
int32_t pos = 0;
|
||||||
fread(&token, 1, 1, file);
|
fread(&token, 1, 1, file);
|
||||||
while (token != '"' && !feof(file))
|
while (token != '"' && !feof(file))
|
||||||
{
|
{
|
||||||
|
|
|
@ -14,8 +14,9 @@
|
||||||
#include <string> //stl string
|
#include <string> //stl string
|
||||||
#include <map> //stl map
|
#include <map> //stl map
|
||||||
#include <list> //stl list
|
#include <list> //stl list
|
||||||
|
#include <common/stdtypes.h>
|
||||||
|
|
||||||
typedef std::map<int, std::wstring, std::less<int> > LANG_STRINGS;
|
typedef std::map<int32_t, std::wstring, std::less<int32_t> > LANG_STRINGS;
|
||||||
typedef LANG_STRINGS::value_type LANG_STR;
|
typedef LANG_STRINGS::value_type LANG_STR;
|
||||||
|
|
||||||
struct LanguageFile
|
struct LanguageFile
|
||||||
|
|
|
@ -20,130 +20,15 @@ void CLanguageSelector::Select ( void )
|
||||||
DialogBoxParam(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_Lang_Select), NULL, (DLGPROC)LangSelectProc, (LPARAM)this);
|
DialogBoxParam(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_Lang_Select), NULL, (DLGPROC)LangSelectProc, (LPARAM)this);
|
||||||
}
|
}
|
||||||
|
|
||||||
static WNDPROC pfnWndLangSelectOkProc = NULL;
|
|
||||||
static HBITMAP hOkButton = NULL;
|
|
||||||
|
|
||||||
DWORD CALLBACK LangSelectOkProc (HWND hWnd, DWORD uMsg, DWORD wParam, DWORD lParam)
|
|
||||||
{
|
|
||||||
static bool m_fPressed = false;
|
|
||||||
static HBITMAP hOkButtonDown = NULL;
|
|
||||||
|
|
||||||
switch (uMsg)
|
|
||||||
{
|
|
||||||
case WM_PAINT:
|
|
||||||
{
|
|
||||||
PAINTSTRUCT ps;
|
|
||||||
|
|
||||||
if (BeginPaint(hWnd,&ps))
|
|
||||||
{
|
|
||||||
if (m_fPressed)
|
|
||||||
{
|
|
||||||
if (hOkButtonDown == NULL)
|
|
||||||
{
|
|
||||||
hOkButtonDown = LoadBitmap(GetModuleHandle(NULL),MAKEINTRESOURCE(IDB_LANG_OK_DOWN));
|
|
||||||
}
|
|
||||||
if (hOkButtonDown)
|
|
||||||
{
|
|
||||||
RECT rcClient;
|
|
||||||
GetClientRect(hWnd, &rcClient);
|
|
||||||
|
|
||||||
BITMAP bmTL1;
|
|
||||||
GetObject(hOkButtonDown, sizeof(BITMAP), &bmTL1);
|
|
||||||
HDC memdc = CreateCompatibleDC(ps.hdc);
|
|
||||||
HGDIOBJ save = SelectObject(memdc, hOkButtonDown);
|
|
||||||
BitBlt(ps.hdc, 0, 0, bmTL1.bmWidth, bmTL1.bmHeight, memdc, 0, 0, SRCCOPY);
|
|
||||||
SelectObject(memdc, save);
|
|
||||||
DeleteDC(memdc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (hOkButton)
|
|
||||||
{
|
|
||||||
RECT rcClient;
|
|
||||||
GetClientRect(hWnd, &rcClient);
|
|
||||||
|
|
||||||
BITMAP bmTL1;
|
|
||||||
GetObject(hOkButton, sizeof(BITMAP), &bmTL1);
|
|
||||||
HDC memdc = CreateCompatibleDC(ps.hdc);
|
|
||||||
HGDIOBJ save = SelectObject(memdc, hOkButton);
|
|
||||||
BitBlt(ps.hdc, 0, 0, bmTL1.bmWidth, bmTL1.bmHeight, memdc, 0, 0, SRCCOPY);
|
|
||||||
SelectObject(memdc, save);
|
|
||||||
DeleteDC(memdc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
EndPaint(hWnd,&ps);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case WM_MOUSEMOVE:
|
|
||||||
if (::GetCapture() == hWnd)
|
|
||||||
{
|
|
||||||
POINT ptCursor = { ((int)(short)LOWORD(lParam)), ((int)(short)HIWORD(lParam)) };
|
|
||||||
ClientToScreen(hWnd, &ptCursor);
|
|
||||||
RECT rect;
|
|
||||||
GetWindowRect(hWnd, &rect);
|
|
||||||
bool uPressed = ::PtInRect(&rect, ptCursor)==TRUE;
|
|
||||||
if ( m_fPressed != uPressed )
|
|
||||||
{
|
|
||||||
m_fPressed = uPressed;
|
|
||||||
::InvalidateRect(hWnd, NULL, TRUE);
|
|
||||||
UpdateWindow(hWnd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case WM_LBUTTONDOWN:
|
|
||||||
{
|
|
||||||
LRESULT lRet = 0;
|
|
||||||
lRet = DefWindowProc(hWnd, uMsg, wParam, lParam);
|
|
||||||
SetCapture(hWnd);
|
|
||||||
if ( ::GetCapture()==hWnd )
|
|
||||||
{
|
|
||||||
m_fPressed = true;
|
|
||||||
|
|
||||||
if (m_fPressed)
|
|
||||||
{
|
|
||||||
::InvalidateRect(hWnd, NULL, TRUE);
|
|
||||||
UpdateWindow(hWnd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return lRet;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case WM_LBUTTONUP:
|
|
||||||
{
|
|
||||||
LRESULT lRet = 0;
|
|
||||||
lRet = DefWindowProc(hWnd, uMsg, wParam, lParam);
|
|
||||||
if ( ::GetCapture() == hWnd )
|
|
||||||
{
|
|
||||||
::ReleaseCapture();
|
|
||||||
if ( m_fPressed )
|
|
||||||
{
|
|
||||||
::SendMessage(GetParent(hWnd), WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(hWnd), BN_CLICKED), (LPARAM)hWnd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
m_fPressed = false;
|
|
||||||
|
|
||||||
return lRet;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return CallWindowProc(pfnWndLangSelectOkProc, hWnd, uMsg, wParam, lParam);
|
|
||||||
}
|
|
||||||
|
|
||||||
LRESULT CALLBACK CLanguageSelector::LangSelectProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
LRESULT CALLBACK CLanguageSelector::LangSelectProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
static HBITMAP hbmpBackgroundTop = NULL;
|
static HBITMAP hbmpBackgroundTop = NULL;
|
||||||
static HBITMAP hbmpBackgroundBottom = NULL;
|
|
||||||
static HBITMAP hbmpBackgroundMiddle = NULL;
|
|
||||||
static HFONT hTextFont = NULL;
|
static HFONT hTextFont = NULL;
|
||||||
static CLanguageSelector * lngClass;
|
static CLanguageSelector * lngClass;
|
||||||
|
|
||||||
switch (uMsg)
|
switch (uMsg)
|
||||||
{
|
{
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
SetWindowPos(hDlg,HWND_TOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOREPOSITION|SWP_NOSIZE);
|
|
||||||
{
|
{
|
||||||
lngClass = (CLanguageSelector *)lParam;
|
lngClass = (CLanguageSelector *)lParam;
|
||||||
|
|
||||||
|
@ -167,47 +52,11 @@ LRESULT CALLBACK CLanguageSelector::LangSelectProc (HWND hDlg, UINT uMsg, WPARAM
|
||||||
SendMessage(GetDlgItem(hDlg, IDC_LANG_SEL), CB_SETCURSEL, 0, 0);
|
SendMessage(GetDlgItem(hDlg, IDC_LANG_SEL), CB_SETCURSEL, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
enum { ROUND_EDGE = 15 };
|
|
||||||
|
|
||||||
DWORD dwStyle = GetWindowLong(hDlg, GWL_STYLE);
|
|
||||||
dwStyle &= ~(WS_CAPTION|WS_SIZEBOX);
|
|
||||||
SetWindowLong(hDlg, GWL_STYLE, dwStyle);
|
|
||||||
|
|
||||||
// Use the size of the image
|
// Use the size of the image
|
||||||
hbmpBackgroundTop = LoadBitmap(GetModuleHandle(NULL),MAKEINTRESOURCE(IDB_ABOUT_TOP));
|
hbmpBackgroundTop = LoadBitmap(GetModuleHandle(NULL), MAKEINTRESOURCE(IDB_ABOUT_LOGO));
|
||||||
hbmpBackgroundBottom = LoadBitmap(GetModuleHandle(NULL),MAKEINTRESOURCE(IDB_ABOUT_BOTTOM));
|
|
||||||
hbmpBackgroundMiddle = LoadBitmap(GetModuleHandle(NULL),MAKEINTRESOURCE(IDB_ABOUT_MIDDLE));
|
|
||||||
BITMAP bmTL;
|
BITMAP bmTL;
|
||||||
GetObject(hbmpBackgroundTop, sizeof(BITMAP), &bmTL);
|
GetObject(hbmpBackgroundTop, sizeof(BITMAP), &bmTL);
|
||||||
|
|
||||||
if (hbmpBackgroundTop)
|
|
||||||
{
|
|
||||||
// int iHeight = bmTL.bmHeight;
|
|
||||||
int iWidth = bmTL.bmWidth;
|
|
||||||
|
|
||||||
RECT rect;
|
|
||||||
GetWindowRect(hDlg, &rect);
|
|
||||||
rect.left -= rect.left;
|
|
||||||
rect.bottom -= rect.top;
|
|
||||||
rect.top -= rect.top;
|
|
||||||
|
|
||||||
// Tweaked
|
|
||||||
HRGN hWindowRegion= CreateRoundRectRgn
|
|
||||||
(
|
|
||||||
rect.left,
|
|
||||||
rect.top,
|
|
||||||
rect.left+iWidth+GetSystemMetrics(SM_CXEDGE)-1,
|
|
||||||
rect.bottom+GetSystemMetrics(SM_CYEDGE)-1,
|
|
||||||
ROUND_EDGE,
|
|
||||||
ROUND_EDGE
|
|
||||||
);
|
|
||||||
|
|
||||||
if (hWindowRegion)
|
|
||||||
{
|
|
||||||
SetWindowRgn(hDlg, hWindowRegion, TRUE);
|
|
||||||
DeleteObject(hWindowRegion);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
hTextFont = ::CreateFont
|
hTextFont = ::CreateFont
|
||||||
(
|
(
|
||||||
18,
|
18,
|
||||||
|
@ -227,35 +76,6 @@ LRESULT CALLBACK CLanguageSelector::LangSelectProc (HWND hDlg, UINT uMsg, WPARAM
|
||||||
);
|
);
|
||||||
SendDlgItemMessage(hDlg, IDC_SELECT_LANG, WM_SETFONT, (WPARAM)hTextFont, TRUE);
|
SendDlgItemMessage(hDlg, IDC_SELECT_LANG, WM_SETFONT, (WPARAM)hTextFont, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
hOkButton = LoadBitmap(GetModuleHandle(NULL),MAKEINTRESOURCE(IDB_LANG_OK));
|
|
||||||
pfnWndLangSelectOkProc = (WNDPROC)::GetWindowLongPtr(GetDlgItem(hDlg,IDOK), GWLP_WNDPROC);
|
|
||||||
::SetWindowLongPtr(GetDlgItem(hDlg,IDOK), GWLP_WNDPROC,(LONG_PTR)LangSelectOkProc);
|
|
||||||
break;
|
|
||||||
case WM_NCHITTEST:
|
|
||||||
{
|
|
||||||
int xPos = LOWORD(lParam);
|
|
||||||
int yPos = HIWORD(lParam);
|
|
||||||
RECT client, a;
|
|
||||||
GetClientRect(hDlg,&a);
|
|
||||||
GetClientRect(hDlg,&client);
|
|
||||||
ClientToScreen(hDlg,(LPPOINT)&client);
|
|
||||||
client.right += client.left;
|
|
||||||
client.bottom += client.top;
|
|
||||||
|
|
||||||
int nCaption = GetSystemMetrics(SM_CYCAPTION)*4;
|
|
||||||
|
|
||||||
LRESULT lResult = HTCLIENT;
|
|
||||||
|
|
||||||
//check caption
|
|
||||||
if (xPos <= client.right && xPos >= client.left &&
|
|
||||||
(yPos >= client.top+ 0)&& (yPos <= client.top + 0+nCaption))
|
|
||||||
{
|
|
||||||
lResult = HTCAPTION;
|
|
||||||
}
|
|
||||||
SetWindowLong(hDlg, DWLP_MSGRESULT, lResult);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case WM_CTLCOLORSTATIC:
|
case WM_CTLCOLORSTATIC:
|
||||||
{
|
{
|
||||||
|
@ -265,6 +85,22 @@ LRESULT CALLBACK CLanguageSelector::LangSelectProc (HWND hDlg, UINT uMsg, WPARAM
|
||||||
return (LONG)(LRESULT)((HBRUSH)GetStockObject(NULL_BRUSH));
|
return (LONG)(LRESULT)((HBRUSH)GetStockObject(NULL_BRUSH));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case WM_ERASEBKGND:
|
||||||
|
{
|
||||||
|
HPEN outline;
|
||||||
|
HBRUSH fill;
|
||||||
|
RECT rect;
|
||||||
|
|
||||||
|
outline = CreatePen(PS_SOLID, 1, 0x00FFFFFF);
|
||||||
|
fill = CreateSolidBrush(0x00FFFFFF);
|
||||||
|
SelectObject((HDC)wParam, outline);
|
||||||
|
SelectObject((HDC)wParam, fill);
|
||||||
|
|
||||||
|
GetClientRect(hDlg, &rect);
|
||||||
|
|
||||||
|
Rectangle((HDC)wParam, rect.left, rect.top, rect.right, rect.bottom);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case WM_PAINT:
|
case WM_PAINT:
|
||||||
{
|
{
|
||||||
PAINTSTRUCT ps;
|
PAINTSTRUCT ps;
|
||||||
|
@ -274,10 +110,8 @@ LRESULT CALLBACK CLanguageSelector::LangSelectProc (HWND hDlg, UINT uMsg, WPARAM
|
||||||
RECT rcClient;
|
RECT rcClient;
|
||||||
GetClientRect(hDlg, &rcClient);
|
GetClientRect(hDlg, &rcClient);
|
||||||
|
|
||||||
BITMAP bmTL_top, bmTL_bottom, bmTL_Middle;
|
BITMAP bmTL_top;
|
||||||
GetObject(hbmpBackgroundTop, sizeof(BITMAP), &bmTL_top);
|
GetObject(hbmpBackgroundTop, sizeof(BITMAP), &bmTL_top);
|
||||||
GetObject(hbmpBackgroundBottom, sizeof(BITMAP), &bmTL_bottom);
|
|
||||||
GetObject(hbmpBackgroundMiddle, sizeof(BITMAP), &bmTL_Middle);
|
|
||||||
|
|
||||||
HDC memdc = CreateCompatibleDC(ps.hdc);
|
HDC memdc = CreateCompatibleDC(ps.hdc);
|
||||||
HGDIOBJ save = SelectObject(memdc, hbmpBackgroundTop);
|
HGDIOBJ save = SelectObject(memdc, hbmpBackgroundTop);
|
||||||
|
@ -285,25 +119,6 @@ LRESULT CALLBACK CLanguageSelector::LangSelectProc (HWND hDlg, UINT uMsg, WPARAM
|
||||||
SelectObject(memdc, save);
|
SelectObject(memdc, save);
|
||||||
DeleteDC(memdc);
|
DeleteDC(memdc);
|
||||||
|
|
||||||
memdc = CreateCompatibleDC(ps.hdc);
|
|
||||||
save = SelectObject(memdc, hbmpBackgroundMiddle);
|
|
||||||
for (int x = bmTL_top.bmHeight; x < rcClient.bottom; x += bmTL_Middle.bmHeight)
|
|
||||||
{
|
|
||||||
//BitBlt(ps.hdc, 0, bmTL_top.bmHeight, bmTL_Middle.bmWidth, rcClient.bottom - (bmTL_bottom.bmHeight + bmTL_top.bmHeight), memdc, 0, 0, SRCCOPY);
|
|
||||||
BitBlt(ps.hdc, 0, x, bmTL_Middle.bmWidth, bmTL_Middle.bmHeight, memdc, 0, 0, SRCCOPY);
|
|
||||||
}
|
|
||||||
SelectObject(memdc, save);
|
|
||||||
DeleteDC(memdc);
|
|
||||||
|
|
||||||
BITMAP ;
|
|
||||||
memdc = CreateCompatibleDC(ps.hdc);
|
|
||||||
save = SelectObject(memdc, hbmpBackgroundBottom);
|
|
||||||
BitBlt(ps.hdc, 0, rcClient.bottom - bmTL_bottom.bmHeight, bmTL_bottom.bmWidth, bmTL_bottom.bmHeight, memdc, 0, 0, SRCCOPY);
|
|
||||||
SelectObject(memdc, save);
|
|
||||||
DeleteDC(memdc);
|
|
||||||
|
|
||||||
BITMAP ;
|
|
||||||
|
|
||||||
EndPaint(hDlg, &ps);
|
EndPaint(hDlg, &ps);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -316,14 +131,6 @@ LRESULT CALLBACK CLanguageSelector::LangSelectProc (HWND hDlg, UINT uMsg, WPARAM
|
||||||
{
|
{
|
||||||
DeleteObject(hbmpBackgroundTop);
|
DeleteObject(hbmpBackgroundTop);
|
||||||
}
|
}
|
||||||
if (hbmpBackgroundBottom)
|
|
||||||
{
|
|
||||||
DeleteObject(hbmpBackgroundBottom);
|
|
||||||
}
|
|
||||||
if (hbmpBackgroundMiddle)
|
|
||||||
{
|
|
||||||
DeleteObject(hbmpBackgroundMiddle);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hTextFont)
|
if (hTextFont)
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include "User Interface.h"
|
#include "User Interface.h"
|
||||||
#include "N64 System/Types.h"
|
|
||||||
|
|
||||||
class CNotification;
|
class CNotification;
|
||||||
#include "N64 System/Profiling Class.h"
|
#include "N64 System/Profiling Class.h"
|
||||||
|
@ -45,7 +44,6 @@ class CNotification;
|
||||||
|
|
||||||
//C Core - to be upgrdaded and removed
|
//C Core - to be upgrdaded and removed
|
||||||
#include "N64 System/C Core/r4300i Commands.h"
|
#include "N64 System/C Core/r4300i Commands.h"
|
||||||
#include "N64 System/C Core/Logging.h"
|
|
||||||
|
|
||||||
//Interpter
|
//Interpter
|
||||||
#include "N64 System/Interpreter/Interpreter Ops.h"
|
#include "N64 System/Interpreter/Interpreter Ops.h"
|
||||||
|
@ -65,7 +63,6 @@ class CNotification;
|
||||||
#include "N64 System/Recompiler/Section Info.h"
|
#include "N64 System/Recompiler/Section Info.h"
|
||||||
#include "N64 System/Recompiler/Function Info.h"
|
#include "N64 System/Recompiler/Function Info.h"
|
||||||
#include "N64 System/Recompiler/Function Map Class.h"
|
#include "N64 System/Recompiler/Function Map Class.h"
|
||||||
#include "N64 System/Recompiler/Delay Slot Map Class.h"
|
|
||||||
#include "N64 System/Recompiler/Recompiler Class.h"
|
#include "N64 System/Recompiler/Recompiler Class.h"
|
||||||
#include "N64 System/Recompiler/x86CodeLog.h"
|
#include "N64 System/Recompiler/x86CodeLog.h"
|
||||||
|
|
||||||
|
@ -78,4 +75,3 @@ class CNotification;
|
||||||
//Main Files
|
//Main Files
|
||||||
#include "N64 System/N64 Class.h"
|
#include "N64 System/N64 Class.h"
|
||||||
#include "N64 System/System Globals.h"
|
#include "N64 System/System Globals.h"
|
||||||
|
|
||||||
|
|
|
@ -1,920 +0,0 @@
|
||||||
/****************************************************************************
|
|
||||||
* *
|
|
||||||
* Project 64 - A Nintendo 64 emulator. *
|
|
||||||
* http://www.pj64-emu.com/ *
|
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
|
||||||
* *
|
|
||||||
* License: *
|
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
|
||||||
* *
|
|
||||||
****************************************************************************/
|
|
||||||
#include "stdafx.h"
|
|
||||||
|
|
||||||
#include <prsht.h>
|
|
||||||
|
|
||||||
void LoadLogSetting (HKEY hKey,char * String, BOOL * Value);
|
|
||||||
void SaveLogOptions (void);
|
|
||||||
|
|
||||||
LRESULT CALLBACK LogGeneralProc ( HWND, UINT, WPARAM, LPARAM );
|
|
||||||
LRESULT CALLBACK LogPifProc ( HWND, UINT, WPARAM, LPARAM );
|
|
||||||
LRESULT CALLBACK LogRegProc ( HWND, UINT, WPARAM, LPARAM );
|
|
||||||
|
|
||||||
LOG_OPTIONS LogOptions,TempOptions;
|
|
||||||
HANDLE hLogFile = NULL;
|
|
||||||
|
|
||||||
void EnterLogOptions(HWND hwndOwner)
|
|
||||||
{
|
|
||||||
PROPSHEETPAGE psp[3];
|
|
||||||
PROPSHEETHEADER psh;
|
|
||||||
|
|
||||||
psp[0].dwSize = sizeof(PROPSHEETPAGE);
|
|
||||||
psp[0].dwFlags = PSP_USETITLE;
|
|
||||||
psp[0].hInstance = GetModuleHandle(NULL);
|
|
||||||
psp[0].pszTemplate = MAKEINTRESOURCE(IDD_Logging_Registers);
|
|
||||||
psp[0].pfnDlgProc = (DLGPROC)LogRegProc;
|
|
||||||
psp[0].pszTitle = "Registers";
|
|
||||||
psp[0].lParam = 0;
|
|
||||||
psp[0].pfnCallback = NULL;
|
|
||||||
|
|
||||||
psp[1].dwSize = sizeof(PROPSHEETPAGE);
|
|
||||||
psp[1].dwFlags = PSP_USETITLE;
|
|
||||||
psp[1].hInstance = GetModuleHandle(NULL);
|
|
||||||
psp[1].pszTemplate = MAKEINTRESOURCE(IDD_Logging_PifRam);
|
|
||||||
psp[1].pfnDlgProc = (DLGPROC)LogPifProc;
|
|
||||||
psp[1].pszTitle = "Pif Ram";
|
|
||||||
psp[1].lParam = 0;
|
|
||||||
psp[1].pfnCallback = NULL;
|
|
||||||
|
|
||||||
psp[2].dwSize = sizeof(PROPSHEETPAGE);
|
|
||||||
psp[2].dwFlags = PSP_USETITLE;
|
|
||||||
psp[2].hInstance = GetModuleHandle(NULL);
|
|
||||||
psp[2].pszTemplate = MAKEINTRESOURCE(IDD_Logging_General);
|
|
||||||
psp[2].pfnDlgProc = (DLGPROC)LogGeneralProc;
|
|
||||||
psp[2].pszTitle = "General";
|
|
||||||
psp[2].lParam = 0;
|
|
||||||
psp[2].pfnCallback = NULL;
|
|
||||||
|
|
||||||
psh.dwSize = sizeof(PROPSHEETHEADER);
|
|
||||||
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW;
|
|
||||||
psh.hwndParent = hwndOwner;
|
|
||||||
psh.hInstance = GetModuleHandle(NULL);
|
|
||||||
psh.pszCaption = (LPSTR) "Log Options";
|
|
||||||
psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE);
|
|
||||||
psh.nStartPage = 0;
|
|
||||||
psh.ppsp = (LPCPROPSHEETPAGE) &psp;
|
|
||||||
psh.pfnCallback = NULL;
|
|
||||||
|
|
||||||
LoadLogOptions(&TempOptions,TRUE);
|
|
||||||
#if defined(WINDOWS_UI)
|
|
||||||
PropertySheet(&psh);
|
|
||||||
#else
|
|
||||||
g_Notify -> BreakPoint(__FILEW__, __LINE__);
|
|
||||||
#endif
|
|
||||||
SaveLogOptions();
|
|
||||||
LoadLogOptions(&LogOptions, FALSE);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
void LoadLogOptions (LOG_OPTIONS * LogOptions, BOOL AlwaysFill)
|
|
||||||
{
|
|
||||||
long lResult;
|
|
||||||
HKEY hKeyResults = 0;
|
|
||||||
char String[200];
|
|
||||||
|
|
||||||
sprintf(String,"Software\\N64 Emulation\\%s\\Logging",g_Settings->LoadStringVal(Setting_ApplicationName).c_str());
|
|
||||||
lResult = RegOpenKeyEx( HKEY_CURRENT_USER,String,0,KEY_ALL_ACCESS,
|
|
||||||
&hKeyResults);
|
|
||||||
|
|
||||||
if (lResult == ERROR_SUCCESS)
|
|
||||||
{
|
|
||||||
//LoadLogSetting(hKeyResults,"Generate Log File",&LogOptions->GenerateLog);
|
|
||||||
if (LogOptions->GenerateLog || AlwaysFill)
|
|
||||||
{
|
|
||||||
LoadLogSetting(hKeyResults,"Log RDRAM",&LogOptions->LogRDRamRegisters);
|
|
||||||
LoadLogSetting(hKeyResults,"Log SP",&LogOptions->LogSPRegisters);
|
|
||||||
LoadLogSetting(hKeyResults,"Log DP Command",&LogOptions->LogDPCRegisters);
|
|
||||||
LoadLogSetting(hKeyResults,"Log DP Span",&LogOptions->LogDPSRegisters);
|
|
||||||
LoadLogSetting(hKeyResults,"Log MIPS Interface (MI)",&LogOptions->LogMIPSInterface);
|
|
||||||
LoadLogSetting(hKeyResults,"Log Video Interface (VI)",&LogOptions->LogVideoInterface);
|
|
||||||
LoadLogSetting(hKeyResults,"Log Audio Interface (AI)",&LogOptions->LogAudioInterface);
|
|
||||||
LoadLogSetting(hKeyResults,"Log Peripheral Interface (PI)",&LogOptions->LogPerInterface);
|
|
||||||
LoadLogSetting(hKeyResults,"Log RDRAM Interface (RI)",&LogOptions->LogRDRAMInterface);
|
|
||||||
LoadLogSetting(hKeyResults,"Log Serial Interface (SI)",&LogOptions->LogSerialInterface);
|
|
||||||
LoadLogSetting(hKeyResults,"Log PifRam DMA Operations",&LogOptions->LogPRDMAOperations);
|
|
||||||
LoadLogSetting(hKeyResults,"Log PifRam Direct Memory Loads",&LogOptions->LogPRDirectMemLoads);
|
|
||||||
LoadLogSetting(hKeyResults,"Log PifRam DMA Memory Loads",&LogOptions->LogPRDMAMemLoads);
|
|
||||||
LoadLogSetting(hKeyResults,"Log PifRam Direct Memory Stores",&LogOptions->LogPRDirectMemStores);
|
|
||||||
LoadLogSetting(hKeyResults,"Log PifRam DMA Memory Stores",&LogOptions->LogPRDMAMemStores);
|
|
||||||
LoadLogSetting(hKeyResults,"Log Controller Pak",&LogOptions->LogControllerPak);
|
|
||||||
LoadLogSetting(hKeyResults,"Log CP0 changes",&LogOptions->LogCP0changes);
|
|
||||||
LoadLogSetting(hKeyResults,"Log CP0 reads",&LogOptions->LogCP0reads);
|
|
||||||
LoadLogSetting(hKeyResults,"Log Exceptions",&LogOptions->LogExceptions);
|
|
||||||
LoadLogSetting(hKeyResults,"No Interrupts",&LogOptions->NoInterrupts);
|
|
||||||
LoadLogSetting(hKeyResults,"Log TLB",&LogOptions->LogTLB);
|
|
||||||
LoadLogSetting(hKeyResults,"Log Cache Operations",&LogOptions->LogCache);
|
|
||||||
LoadLogSetting(hKeyResults,"Log Rom Header",&LogOptions->LogRomHeader);
|
|
||||||
LoadLogSetting(hKeyResults,"Log Unknown access",&LogOptions->LogUnknown);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
LogOptions->GenerateLog = FALSE;
|
|
||||||
LogOptions->LogRDRamRegisters = FALSE;
|
|
||||||
LogOptions->LogSPRegisters = FALSE;
|
|
||||||
LogOptions->LogDPCRegisters = FALSE;
|
|
||||||
LogOptions->LogDPSRegisters = FALSE;
|
|
||||||
LogOptions->LogMIPSInterface = FALSE;
|
|
||||||
LogOptions->LogVideoInterface = FALSE;
|
|
||||||
LogOptions->LogAudioInterface = FALSE;
|
|
||||||
LogOptions->LogPerInterface = FALSE;
|
|
||||||
LogOptions->LogRDRAMInterface = FALSE;
|
|
||||||
LogOptions->LogSerialInterface = FALSE;
|
|
||||||
|
|
||||||
LogOptions->LogPRDMAOperations = FALSE;
|
|
||||||
LogOptions->LogPRDirectMemLoads = FALSE;
|
|
||||||
LogOptions->LogPRDMAMemLoads = FALSE;
|
|
||||||
LogOptions->LogPRDirectMemStores = FALSE;
|
|
||||||
LogOptions->LogPRDMAMemStores = FALSE;
|
|
||||||
LogOptions->LogControllerPak = FALSE;
|
|
||||||
|
|
||||||
LogOptions->LogCP0changes = FALSE;
|
|
||||||
LogOptions->LogCP0reads = FALSE;
|
|
||||||
LogOptions->LogCache = FALSE;
|
|
||||||
LogOptions->LogExceptions = FALSE;
|
|
||||||
LogOptions->NoInterrupts = FALSE;
|
|
||||||
LogOptions->LogTLB = FALSE;
|
|
||||||
LogOptions->LogRomHeader = FALSE;
|
|
||||||
LogOptions->LogUnknown = FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void LoadLogSetting (HKEY hKey,char * String, BOOL * Value)
|
|
||||||
{
|
|
||||||
DWORD Type, dwResult, Bytes = 4;
|
|
||||||
long lResult;
|
|
||||||
|
|
||||||
lResult = RegQueryValueEx(hKey,String,0,&Type,(LPBYTE)(&dwResult),&Bytes);
|
|
||||||
if (Type == REG_DWORD && lResult == ERROR_SUCCESS)
|
|
||||||
{
|
|
||||||
*Value = (BOOL)dwResult;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
*Value = FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
LRESULT CALLBACK LogGeneralProc (HWND hDlg, UINT uMsg, WPARAM /*wParam*/, LPARAM lParam)
|
|
||||||
{
|
|
||||||
switch (uMsg)
|
|
||||||
{
|
|
||||||
case WM_INITDIALOG:
|
|
||||||
if (TempOptions.LogCP0changes) { CheckDlgButton(hDlg,IDC_CP0_WRITE,BST_CHECKED); }
|
|
||||||
if (TempOptions.LogCP0reads) { CheckDlgButton(hDlg,IDC_CP0_READ,BST_CHECKED); }
|
|
||||||
if (TempOptions.LogCache) { CheckDlgButton(hDlg,IDC_CACHE,BST_CHECKED); }
|
|
||||||
if (TempOptions.LogExceptions) { CheckDlgButton(hDlg,IDC_EXCEPTIONS,BST_CHECKED); }
|
|
||||||
if (TempOptions.NoInterrupts) { CheckDlgButton(hDlg,IDC_INTERRUPTS,BST_CHECKED); }
|
|
||||||
if (TempOptions.LogTLB) { CheckDlgButton(hDlg,IDC_TLB,BST_CHECKED); }
|
|
||||||
if (TempOptions.LogRomHeader) { CheckDlgButton(hDlg,IDC_ROM_HEADER,BST_CHECKED); }
|
|
||||||
if (TempOptions.LogUnknown) { CheckDlgButton(hDlg,IDC_UNKOWN,BST_CHECKED); }
|
|
||||||
break;
|
|
||||||
case WM_NOTIFY:
|
|
||||||
if (((NMHDR FAR *) lParam)->code != PSN_APPLY) { break; }
|
|
||||||
TempOptions.LogCP0changes = IsDlgButtonChecked(hDlg,IDC_CP0_WRITE) == BST_CHECKED?TRUE:FALSE;
|
|
||||||
TempOptions.LogCP0reads = IsDlgButtonChecked(hDlg,IDC_CP0_READ) == BST_CHECKED?TRUE:FALSE;
|
|
||||||
TempOptions.LogCache = IsDlgButtonChecked(hDlg,IDC_CACHE) == BST_CHECKED?TRUE:FALSE;
|
|
||||||
TempOptions.LogExceptions = IsDlgButtonChecked(hDlg,IDC_EXCEPTIONS) == BST_CHECKED?TRUE:FALSE;
|
|
||||||
TempOptions.NoInterrupts = IsDlgButtonChecked(hDlg,IDC_INTERRUPTS) == BST_CHECKED?TRUE:FALSE;
|
|
||||||
TempOptions.LogTLB = IsDlgButtonChecked(hDlg,IDC_TLB) == BST_CHECKED?TRUE:FALSE;
|
|
||||||
TempOptions.LogRomHeader = IsDlgButtonChecked(hDlg,IDC_ROM_HEADER) == BST_CHECKED?TRUE:FALSE;
|
|
||||||
TempOptions.LogUnknown = IsDlgButtonChecked(hDlg,IDC_UNKOWN) == BST_CHECKED?TRUE:FALSE;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Log_LW (DWORD PC, DWORD VAddr)
|
|
||||||
{
|
|
||||||
if (!LogOptions.GenerateLog)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( VAddr < 0xA0000000 || VAddr >= 0xC0000000 )
|
|
||||||
{
|
|
||||||
DWORD PAddr;
|
|
||||||
if (!g_TransVaddr->TranslateVaddr(VAddr,PAddr))
|
|
||||||
{
|
|
||||||
if (LogOptions.LogUnknown)
|
|
||||||
{
|
|
||||||
LogMessage("%08X: read from unknown ??? (%08X)",PC,VAddr);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
VAddr = PAddr + 0xA0000000;
|
|
||||||
}
|
|
||||||
|
|
||||||
DWORD Value;
|
|
||||||
if ( VAddr >= 0xA0000000 && VAddr < (0xA0000000 + g_MMU->RdramSize()))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if ( VAddr >= 0xA3F00000 && VAddr <= 0xA3F00024)
|
|
||||||
{
|
|
||||||
if (!LogOptions.LogRDRamRegisters)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
g_MMU->LW_VAddr(VAddr,Value);
|
|
||||||
|
|
||||||
switch (VAddr)
|
|
||||||
{
|
|
||||||
case 0xA3F00000: LogMessage("%08X: read from RDRAM_CONFIG_REG/RDRAM_DEVICE_TYPE_REG (%08X)",PC, Value); return;
|
|
||||||
case 0xA3F00004: LogMessage("%08X: read from RDRAM_DEVICE_ID_REG (%08X)",PC, Value); return;
|
|
||||||
case 0xA3F00008: LogMessage("%08X: read from RDRAM_DELAY_REG (%08X)",PC, Value); return;
|
|
||||||
case 0xA3F0000C: LogMessage("%08X: read from RDRAM_MODE_REG (%08X)",PC, Value); return;
|
|
||||||
case 0xA3F00010: LogMessage("%08X: read from RDRAM_REF_INTERVAL_REG (%08X)",PC, Value); return;
|
|
||||||
case 0xA3F00014: LogMessage("%08X: read from RDRAM_REF_ROW_REG (%08X)",PC, Value); return;
|
|
||||||
case 0xA3F00018: LogMessage("%08X: read from RDRAM_RAS_INTERVAL_REG (%08X)",PC, Value); return;
|
|
||||||
case 0xA3F0001C: LogMessage("%08X: read from RDRAM_MIN_INTERVAL_REG (%08X)",PC, Value); return;
|
|
||||||
case 0xA3F00020: LogMessage("%08X: read from RDRAM_ADDR_SELECT_REG (%08X)",PC, Value); return;
|
|
||||||
case 0xA3F00024: LogMessage("%08X: read from RDRAM_DEVICE_MANUF_REG (%08X)",PC, Value); return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( VAddr >= 0xA4000000 && VAddr <= 0xA4001FFC )
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if ( VAddr >= 0xA4040000 && VAddr <= 0xA404001C )
|
|
||||||
{
|
|
||||||
if (!LogOptions.LogSPRegisters)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
g_MMU->LW_VAddr(VAddr,Value);
|
|
||||||
|
|
||||||
switch (VAddr)
|
|
||||||
{
|
|
||||||
case 0xA4040000: LogMessage("%08X: read from SP_MEM_ADDR_REG (%08X)",PC, Value); break;
|
|
||||||
case 0xA4040004: LogMessage("%08X: read from SP_DRAM_ADDR_REG (%08X)",PC, Value); break;
|
|
||||||
case 0xA4040008: LogMessage("%08X: read from SP_RD_LEN_REG (%08X)",PC, Value); break;
|
|
||||||
case 0xA404000C: LogMessage("%08X: read from SP_WR_LEN_REG (%08X)",PC, Value); break;
|
|
||||||
case 0xA4040010: LogMessage("%08X: read from SP_STATUS_REG (%08X)",PC, Value); break;
|
|
||||||
case 0xA4040014: LogMessage("%08X: read from SP_DMA_FULL_REG (%08X)",PC, Value); break;
|
|
||||||
case 0xA4040018: LogMessage("%08X: read from SP_DMA_BUSY_REG (%08X)",PC, Value); break;
|
|
||||||
case 0xA404001C: LogMessage("%08X: read from SP_SEMAPHORE_REG (%08X)",PC, Value); break;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if ( VAddr == 0xA4080000)
|
|
||||||
{
|
|
||||||
if (!LogOptions.LogSPRegisters)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
g_MMU->LW_VAddr(VAddr,Value);
|
|
||||||
LogMessage("%08X: read from SP_PC (%08X)",PC, Value);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (VAddr >= 0xA4100000 && VAddr <= 0xA410001C)
|
|
||||||
{
|
|
||||||
if (!LogOptions.LogDPCRegisters)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
g_MMU->LW_VAddr(VAddr,Value);
|
|
||||||
|
|
||||||
switch (VAddr)
|
|
||||||
{
|
|
||||||
case 0xA4100000: LogMessage("%08X: read from DPC_START_REG (%08X)",PC, Value); return;
|
|
||||||
case 0xA4100004: LogMessage("%08X: read from DPC_END_REG (%08X)",PC, Value); return;
|
|
||||||
case 0xA4100008: LogMessage("%08X: read from DPC_CURRENT_REG (%08X)",PC, Value); return;
|
|
||||||
case 0xA410000C: LogMessage("%08X: read from DPC_STATUS_REG (%08X)",PC, Value); return;
|
|
||||||
case 0xA4100010: LogMessage("%08X: read from DPC_CLOCK_REG (%08X)",PC, Value); return;
|
|
||||||
case 0xA4100014: LogMessage("%08X: read from DPC_BUFBUSY_REG (%08X)",PC, Value); return;
|
|
||||||
case 0xA4100018: LogMessage("%08X: read from DPC_PIPEBUSY_REG (%08X)",PC, Value); return;
|
|
||||||
case 0xA410001C: LogMessage("%08X: read from DPC_TMEM_REG (%08X)",PC, Value); return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (VAddr >= 0xA4300000 && VAddr <= 0xA430000C)
|
|
||||||
{
|
|
||||||
if (!LogOptions.LogMIPSInterface)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
g_MMU->LW_VAddr(VAddr,Value);
|
|
||||||
|
|
||||||
switch (VAddr)
|
|
||||||
{
|
|
||||||
case 0xA4300000: LogMessage("%08X: read from MI_INIT_MODE_REG/MI_MODE_REG (%08X)",PC, Value); return;
|
|
||||||
case 0xA4300004: LogMessage("%08X: read from MI_VERSION_REG/MI_NOOP_REG (%08X)",PC, Value); return;
|
|
||||||
case 0xA4300008: LogMessage("%08X: read from MI_INTR_REG (%08X)",PC, Value); return;
|
|
||||||
case 0xA430000C: LogMessage("%08X: read from MI_INTR_MASK_REG (%08X)",PC, Value); return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (VAddr >= 0xA4400000 && VAddr <= 0xA4400034)
|
|
||||||
{
|
|
||||||
if (!LogOptions.LogVideoInterface)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
g_MMU->LW_VAddr(VAddr,Value);
|
|
||||||
|
|
||||||
switch (VAddr)
|
|
||||||
{
|
|
||||||
case 0xA4400000: LogMessage("%08X: read from VI_STATUS_REG/VI_CONTROL_REG (%08X)",PC, Value); return;
|
|
||||||
case 0xA4400004: LogMessage("%08X: read from VI_ORIGIN_REG/VI_DRAM_ADDR_REG (%08X)",PC, Value); return;
|
|
||||||
case 0xA4400008: LogMessage("%08X: read from VI_WIDTH_REG/VI_H_WIDTH_REG (%08X)",PC, Value); return;
|
|
||||||
case 0xA440000C: LogMessage("%08X: read from VI_INTR_REG/VI_V_INTR_REG (%08X)",PC, Value); return;
|
|
||||||
case 0xA4400010: LogMessage("%08X: read from VI_CURRENT_REG/VI_V_CURRENT_LINE_REG (%08X)",PC, Value); return;
|
|
||||||
case 0xA4400014: LogMessage("%08X: read from VI_BURST_REG/VI_TIMING_REG (%08X)",PC, Value); return;
|
|
||||||
case 0xA4400018: LogMessage("%08X: read from VI_V_SYNC_REG (%08X)",PC, Value); return;
|
|
||||||
case 0xA440001C: LogMessage("%08X: read from VI_H_SYNC_REG (%08X)",PC, Value); return;
|
|
||||||
case 0xA4400020: LogMessage("%08X: read from VI_LEAP_REG/VI_H_SYNC_LEAP_REG (%08X)",PC, Value); return;
|
|
||||||
case 0xA4400024: LogMessage("%08X: read from VI_H_START_REG/VI_H_VIDEO_REG (%08X)",PC, Value); return;
|
|
||||||
case 0xA4400028: LogMessage("%08X: read from VI_V_START_REG/VI_V_VIDEO_REG (%08X)",PC, Value); return;
|
|
||||||
case 0xA440002C: LogMessage("%08X: read from VI_V_BURST_REG (%08X)",PC, Value); return;
|
|
||||||
case 0xA4400030: LogMessage("%08X: read from VI_X_SCALE_REG (%08X)",PC, Value); return;
|
|
||||||
case 0xA4400034: LogMessage("%08X: read from VI_Y_SCALE_REG (%08X)",PC, Value); return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (VAddr >= 0xA4500000 && VAddr <= 0xA4500014)
|
|
||||||
{
|
|
||||||
if (!LogOptions.LogAudioInterface)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
g_MMU->LW_VAddr(VAddr,Value);
|
|
||||||
|
|
||||||
switch (VAddr)
|
|
||||||
{
|
|
||||||
case 0xA4500000: LogMessage("%08X: read from AI_DRAM_ADDR_REG (%08X)",PC, Value); return;
|
|
||||||
case 0xA4500004: LogMessage("%08X: read from AI_LEN_REG (%08X)",PC, Value); return;
|
|
||||||
case 0xA4500008: LogMessage("%08X: read from AI_CONTROL_REG (%08X)",PC, Value); return;
|
|
||||||
case 0xA450000C: LogMessage("%08X: read from AI_STATUS_REG (%08X)",PC, Value); return;
|
|
||||||
case 0xA4500010: LogMessage("%08X: read from AI_DACRATE_REG (%08X)",PC, Value); return;
|
|
||||||
case 0xA4500014: LogMessage("%08X: read from AI_BITRATE_REG (%08X)",PC, Value); return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (VAddr >= 0xA4600000 && VAddr <= 0xA4600030)
|
|
||||||
{
|
|
||||||
if (!LogOptions.LogPerInterface)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
g_MMU->LW_VAddr(VAddr,Value);
|
|
||||||
|
|
||||||
switch (VAddr)
|
|
||||||
{
|
|
||||||
case 0xA4600000: LogMessage("%08X: read from PI_DRAM_ADDR_REG (%08X)",PC, Value); return;
|
|
||||||
case 0xA4600004: LogMessage("%08X: read from PI_CART_ADDR_REG (%08X)",PC, Value); return;
|
|
||||||
case 0xA4600008: LogMessage("%08X: read from PI_RD_LEN_REG (%08X)",PC, Value); return;
|
|
||||||
case 0xA460000C: LogMessage("%08X: read from PI_WR_LEN_REG (%08X)",PC, Value); return;
|
|
||||||
case 0xA4600010: LogMessage("%08X: read from PI_STATUS_REG (%08X)",PC, Value); return;
|
|
||||||
case 0xA4600014: LogMessage("%08X: read from PI_BSD_DOM1_LAT_REG/PI_DOMAIN1_REG (%08X)",PC, Value); return;
|
|
||||||
case 0xA4600018: LogMessage("%08X: read from PI_BSD_DOM1_PWD_REG (%08X)",PC, Value); return;
|
|
||||||
case 0xA460001C: LogMessage("%08X: read from PI_BSD_DOM1_PGS_REG (%08X)",PC, Value); return;
|
|
||||||
case 0xA4600020: LogMessage("%08X: read from PI_BSD_DOM1_RLS_REG (%08X)",PC, Value); return;
|
|
||||||
case 0xA4600024: LogMessage("%08X: read from PI_BSD_DOM2_LAT_REG/PI_DOMAIN2_REG (%08X)",PC, Value); return;
|
|
||||||
case 0xA4600028: LogMessage("%08X: read from PI_BSD_DOM2_PWD_REG (%08X)",PC, Value); return;
|
|
||||||
case 0xA460002C: LogMessage("%08X: read from PI_BSD_DOM2_PGS_REG (%08X)",PC, Value); return;
|
|
||||||
case 0xA4600030: LogMessage("%08X: read from PI_BSD_DOM2_RLS_REG (%08X)",PC, Value); return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (VAddr >= 0xA4700000 && VAddr <= 0xA470001C)
|
|
||||||
{
|
|
||||||
if (!LogOptions.LogRDRAMInterface)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
g_MMU->LW_VAddr(VAddr,Value);
|
|
||||||
|
|
||||||
switch (VAddr)
|
|
||||||
{
|
|
||||||
case 0xA4700000: LogMessage("%08X: read from RI_MODE_REG (%08X)",PC, Value); return;
|
|
||||||
case 0xA4700004: LogMessage("%08X: read from RI_CONFIG_REG (%08X)",PC, Value); return;
|
|
||||||
case 0xA4700008: LogMessage("%08X: read from RI_CURRENT_LOAD_REG (%08X)",PC, Value); return;
|
|
||||||
case 0xA470000C: LogMessage("%08X: read from RI_SELECT_REG (%08X)",PC, Value); return;
|
|
||||||
case 0xA4700010: LogMessage("%08X: read from RI_REFRESH_REG/RI_COUNT_REG (%08X)",PC, Value); return;
|
|
||||||
case 0xA4700014: LogMessage("%08X: read from RI_LATENCY_REG (%08X)",PC, Value); return;
|
|
||||||
case 0xA4700018: LogMessage("%08X: read from RI_RERROR_REG (%08X)",PC, Value); return;
|
|
||||||
case 0xA470001C: LogMessage("%08X: read from RI_WERROR_REG (%08X)",PC, Value); return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ( VAddr == 0xA4800000)
|
|
||||||
{
|
|
||||||
if (!LogOptions.LogSerialInterface)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
g_MMU->LW_VAddr(VAddr,Value);
|
|
||||||
LogMessage("%08X: read from SI_DRAM_ADDR_REG (%08X)",PC, Value);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if ( VAddr == 0xA4800004)
|
|
||||||
{
|
|
||||||
if (!LogOptions.LogSerialInterface)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
g_MMU->LW_VAddr(VAddr,Value);
|
|
||||||
LogMessage("%08X: read from SI_PIF_ADDR_RD64B_REG (%08X)",PC, Value);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if ( VAddr == 0xA4800010)
|
|
||||||
{
|
|
||||||
if (!LogOptions.LogSerialInterface)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
g_MMU->LW_VAddr(VAddr,Value);
|
|
||||||
LogMessage("%08X: read from SI_PIF_ADDR_WR64B_REG (%08X)",PC, Value);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if ( VAddr == 0xA4800018)
|
|
||||||
{
|
|
||||||
if (!LogOptions.LogSerialInterface)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
g_MMU->LW_VAddr(VAddr,Value);
|
|
||||||
LogMessage("%08X: read from SI_STATUS_REG (%08X)",PC, Value);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if ( VAddr >= 0xBFC00000 && VAddr <= 0xBFC007C0 )
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if ( VAddr >= 0xBFC007C0 && VAddr <= 0xBFC007FC )
|
|
||||||
{
|
|
||||||
if (!LogOptions.LogPRDirectMemLoads)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
g_MMU->LW_VAddr(VAddr,Value);
|
|
||||||
LogMessage("%08X: read word from Pif Ram at 0x%X (%08X)",PC,VAddr - 0xBFC007C0, Value);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if ( VAddr >= 0xB0000040 && ((VAddr - 0xB0000000) < g_Rom->GetRomSize()))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if ( VAddr >= 0xB0000000 && VAddr < 0xB0000040)
|
|
||||||
{
|
|
||||||
if (!LogOptions.LogRomHeader)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_MMU->LW_VAddr(VAddr,Value);
|
|
||||||
switch (VAddr)
|
|
||||||
{
|
|
||||||
case 0xB0000004: LogMessage("%08X: read from Rom Clock Rate (%08X)",PC, Value); break;
|
|
||||||
case 0xB0000008: LogMessage("%08X: read from Rom Boot address offset (%08X)",PC, Value); break;
|
|
||||||
case 0xB000000C: LogMessage("%08X: read from Rom Release offset (%08X)",PC, Value); break;
|
|
||||||
case 0xB0000010: LogMessage("%08X: read from Rom CRC1 (%08X)",PC, Value); break;
|
|
||||||
case 0xB0000014: LogMessage("%08X: read from Rom CRC2 (%08X)",PC, Value); break;
|
|
||||||
default: LogMessage("%08X: read from Rom header 0x%X (%08X)",PC, VAddr & 0xFF,Value); break;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!LogOptions.LogUnknown)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
LogMessage("%08X: read from unknown ??? (%08X)",PC,VAddr);
|
|
||||||
}
|
|
||||||
|
|
||||||
void __cdecl LogMessage (char * Message, ...)
|
|
||||||
{
|
|
||||||
DWORD dwWritten;
|
|
||||||
char Msg[400];
|
|
||||||
va_list ap;
|
|
||||||
|
|
||||||
if (!g_Settings->LoadBool(Debugger_Enabled))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (hLogFile == NULL)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
va_start( ap, Message );
|
|
||||||
vsprintf( Msg, Message, ap );
|
|
||||||
va_end( ap );
|
|
||||||
|
|
||||||
strcat(Msg,"\r\n");
|
|
||||||
|
|
||||||
WriteFile( hLogFile,Msg,strlen(Msg),&dwWritten,NULL );
|
|
||||||
}
|
|
||||||
|
|
||||||
void Log_SW (DWORD PC, DWORD VAddr, DWORD Value)
|
|
||||||
{
|
|
||||||
if (!LogOptions.GenerateLog)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( VAddr < 0xA0000000 || VAddr >= 0xC0000000 )
|
|
||||||
{
|
|
||||||
DWORD PAddr;
|
|
||||||
if (!g_TransVaddr->TranslateVaddr(VAddr,PAddr))
|
|
||||||
{
|
|
||||||
if (LogOptions.LogUnknown)
|
|
||||||
{
|
|
||||||
LogMessage("%08X: Writing 0x%08X to %08X",PC, Value, VAddr );
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
VAddr = PAddr + 0xA0000000;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( VAddr >= 0xA0000000 && VAddr < (0xA0000000 + g_MMU->RdramSize()))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if ( VAddr >= 0xA3F00000 && VAddr <= 0xA3F00024)
|
|
||||||
{
|
|
||||||
if (!LogOptions.LogRDRamRegisters)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
switch (VAddr)
|
|
||||||
{
|
|
||||||
case 0xA3F00000: LogMessage("%08X: Writing 0x%08X to RDRAM_CONFIG_REG/RDRAM_DEVICE_TYPE_REG",PC, Value ); return;
|
|
||||||
case 0xA3F00004: LogMessage("%08X: Writing 0x%08X to RDRAM_DEVICE_ID_REG",PC, Value ); return;
|
|
||||||
case 0xA3F00008: LogMessage("%08X: Writing 0x%08X to RDRAM_DELAY_REG",PC, Value ); return;
|
|
||||||
case 0xA3F0000C: LogMessage("%08X: Writing 0x%08X to RDRAM_MODE_REG",PC, Value ); return;
|
|
||||||
case 0xA3F00010: LogMessage("%08X: Writing 0x%08X to RDRAM_REF_INTERVAL_REG",PC, Value ); return;
|
|
||||||
case 0xA3F00014: LogMessage("%08X: Writing 0x%08X to RDRAM_REF_ROW_REG",PC, Value ); return;
|
|
||||||
case 0xA3F00018: LogMessage("%08X: Writing 0x%08X to RDRAM_RAS_INTERVAL_REG",PC, Value ); return;
|
|
||||||
case 0xA3F0001C: LogMessage("%08X: Writing 0x%08X to RDRAM_MIN_INTERVAL_REG",PC, Value ); return;
|
|
||||||
case 0xA3F00020: LogMessage("%08X: Writing 0x%08X to RDRAM_ADDR_SELECT_REG",PC, Value ); return;
|
|
||||||
case 0xA3F00024: LogMessage("%08X: Writing 0x%08X to RDRAM_DEVICE_MANUF_REG",PC, Value ); return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ( VAddr >= 0xA4000000 && VAddr <= 0xA4001FFC )
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( VAddr >= 0xA4040000 && VAddr <= 0xA404001C)
|
|
||||||
{
|
|
||||||
if (!LogOptions.LogSPRegisters)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
switch (VAddr)
|
|
||||||
{
|
|
||||||
case 0xA4040000: LogMessage("%08X: Writing 0x%08X to SP_MEM_ADDR_REG",PC, Value ); return;
|
|
||||||
case 0xA4040004: LogMessage("%08X: Writing 0x%08X to SP_DRAM_ADDR_REG",PC, Value ); return;
|
|
||||||
case 0xA4040008: LogMessage("%08X: Writing 0x%08X to SP_RD_LEN_REG",PC, Value ); return;
|
|
||||||
case 0xA404000C: LogMessage("%08X: Writing 0x%08X to SP_WR_LEN_REG",PC, Value ); return;
|
|
||||||
case 0xA4040010: LogMessage("%08X: Writing 0x%08X to SP_STATUS_REG",PC, Value ); return;
|
|
||||||
case 0xA4040014: LogMessage("%08X: Writing 0x%08X to SP_DMA_FULL_REG",PC, Value ); return;
|
|
||||||
case 0xA4040018: LogMessage("%08X: Writing 0x%08X to SP_DMA_BUSY_REG",PC, Value ); return;
|
|
||||||
case 0xA404001C: LogMessage("%08X: Writing 0x%08X to SP_SEMAPHORE_REG",PC, Value ); return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ( VAddr == 0xA4080000)
|
|
||||||
{
|
|
||||||
if (!LogOptions.LogSPRegisters)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
LogMessage("%08X: Writing 0x%08X to SP_PC",PC, Value ); return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( VAddr >= 0xA4100000 && VAddr <= 0xA410001C)
|
|
||||||
{
|
|
||||||
if (!LogOptions.LogDPCRegisters)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
switch (VAddr)
|
|
||||||
{
|
|
||||||
case 0xA4100000: LogMessage("%08X: Writing 0x%08X to DPC_START_REG",PC, Value ); return;
|
|
||||||
case 0xA4100004: LogMessage("%08X: Writing 0x%08X to DPC_END_REG",PC, Value ); return;
|
|
||||||
case 0xA4100008: LogMessage("%08X: Writing 0x%08X to DPC_CURRENT_REG",PC, Value ); return;
|
|
||||||
case 0xA410000C: LogMessage("%08X: Writing 0x%08X to DPC_STATUS_REG",PC, Value ); return;
|
|
||||||
case 0xA4100010: LogMessage("%08X: Writing 0x%08X to DPC_CLOCK_REG",PC, Value ); return;
|
|
||||||
case 0xA4100014: LogMessage("%08X: Writing 0x%08X to DPC_BUFBUSY_REG",PC, Value ); return;
|
|
||||||
case 0xA4100018: LogMessage("%08X: Writing 0x%08X to DPC_PIPEBUSY_REG",PC, Value ); return;
|
|
||||||
case 0xA410001C: LogMessage("%08X: Writing 0x%08X to DPC_TMEM_REG",PC, Value ); return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( VAddr >= 0xA4200000 && VAddr <= 0xA420000C)
|
|
||||||
{
|
|
||||||
if (!LogOptions.LogDPSRegisters)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
switch (VAddr)
|
|
||||||
{
|
|
||||||
case 0xA4200000: LogMessage("%08X: Writing 0x%08X to DPS_TBIST_REG",PC, Value ); return;
|
|
||||||
case 0xA4200004: LogMessage("%08X: Writing 0x%08X to DPS_TEST_MODE_REG",PC, Value ); return;
|
|
||||||
case 0xA4200008: LogMessage("%08X: Writing 0x%08X to DPS_BUFTEST_ADDR_REG",PC, Value ); return;
|
|
||||||
case 0xA420000C: LogMessage("%08X: Writing 0x%08X to DPS_BUFTEST_DATA_REG",PC, Value ); return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( VAddr >= 0xA4300000 && VAddr <= 0xA430000C)
|
|
||||||
{
|
|
||||||
if (!LogOptions.LogMIPSInterface)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
switch (VAddr)
|
|
||||||
{
|
|
||||||
case 0xA4300000: LogMessage("%08X: Writing 0x%08X to MI_INIT_MODE_REG/MI_MODE_REG",PC, Value ); return;
|
|
||||||
case 0xA4300004: LogMessage("%08X: Writing 0x%08X to MI_VERSION_REG/MI_NOOP_REG",PC, Value ); return;
|
|
||||||
case 0xA4300008: LogMessage("%08X: Writing 0x%08X to MI_INTR_REG",PC, Value ); return;
|
|
||||||
case 0xA430000C: LogMessage("%08X: Writing 0x%08X to MI_INTR_MASK_REG",PC, Value ); return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ( VAddr >= 0xA4400000 && VAddr <= 0xA4400034)
|
|
||||||
{
|
|
||||||
if (!LogOptions.LogVideoInterface)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
switch (VAddr)
|
|
||||||
{
|
|
||||||
case 0xA4400000: LogMessage("%08X: Writing 0x%08X to VI_STATUS_REG/VI_CONTROL_REG",PC, Value ); return;
|
|
||||||
case 0xA4400004: LogMessage("%08X: Writing 0x%08X to VI_ORIGIN_REG/VI_DRAM_ADDR_REG",PC, Value ); return;
|
|
||||||
case 0xA4400008: LogMessage("%08X: Writing 0x%08X to VI_WIDTH_REG/VI_H_WIDTH_REG",PC, Value ); return;
|
|
||||||
case 0xA440000C: LogMessage("%08X: Writing 0x%08X to VI_INTR_REG/VI_V_INTR_REG",PC, Value ); return;
|
|
||||||
case 0xA4400010: LogMessage("%08X: Writing 0x%08X to VI_CURRENT_REG/VI_V_CURRENT_LINE_REG",PC, Value ); return;
|
|
||||||
case 0xA4400014: LogMessage("%08X: Writing 0x%08X to VI_BURST_REG/VI_TIMING_REG",PC, Value ); return;
|
|
||||||
case 0xA4400018: LogMessage("%08X: Writing 0x%08X to VI_V_SYNC_REG",PC, Value ); return;
|
|
||||||
case 0xA440001C: LogMessage("%08X: Writing 0x%08X to VI_H_SYNC_REG",PC, Value ); return;
|
|
||||||
case 0xA4400020: LogMessage("%08X: Writing 0x%08X to VI_LEAP_REG/VI_H_SYNC_LEAP_REG",PC, Value ); return;
|
|
||||||
case 0xA4400024: LogMessage("%08X: Writing 0x%08X to VI_H_START_REG/VI_H_VIDEO_REG",PC, Value ); return;
|
|
||||||
case 0xA4400028: LogMessage("%08X: Writing 0x%08X to VI_V_START_REG/VI_V_VIDEO_REG",PC, Value ); return;
|
|
||||||
case 0xA440002C: LogMessage("%08X: Writing 0x%08X to VI_V_BURST_REG",PC, Value ); return;
|
|
||||||
case 0xA4400030: LogMessage("%08X: Writing 0x%08X to VI_X_SCALE_REG",PC, Value ); return;
|
|
||||||
case 0xA4400034: LogMessage("%08X: Writing 0x%08X to VI_Y_SCALE_REG",PC, Value ); return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( VAddr >= 0xA4500000 && VAddr <= 0xA4500014)
|
|
||||||
{
|
|
||||||
if (!LogOptions.LogAudioInterface)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
switch (VAddr)
|
|
||||||
{
|
|
||||||
case 0xA4500000: LogMessage("%08X: Writing 0x%08X to AI_DRAM_ADDR_REG",PC, Value ); return;
|
|
||||||
case 0xA4500004: LogMessage("%08X: Writing 0x%08X to AI_LEN_REG",PC, Value ); return;
|
|
||||||
case 0xA4500008: LogMessage("%08X: Writing 0x%08X to AI_CONTROL_REG",PC, Value ); return;
|
|
||||||
case 0xA450000C: LogMessage("%08X: Writing 0x%08X to AI_STATUS_REG",PC, Value ); return;
|
|
||||||
case 0xA4500010: LogMessage("%08X: Writing 0x%08X to AI_DACRATE_REG",PC, Value ); return;
|
|
||||||
case 0xA4500014: LogMessage("%08X: Writing 0x%08X to AI_BITRATE_REG",PC, Value ); return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( VAddr >= 0xA4600000 && VAddr <= 0xA4600030)
|
|
||||||
{
|
|
||||||
if (!LogOptions.LogPerInterface)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
switch (VAddr)
|
|
||||||
{
|
|
||||||
case 0xA4600000: LogMessage("%08X: Writing 0x%08X to PI_DRAM_ADDR_REG",PC, Value ); return;
|
|
||||||
case 0xA4600004: LogMessage("%08X: Writing 0x%08X to PI_CART_ADDR_REG",PC, Value ); return;
|
|
||||||
case 0xA4600008: LogMessage("%08X: Writing 0x%08X to PI_RD_LEN_REG",PC, Value ); return;
|
|
||||||
case 0xA460000C: LogMessage("%08X: Writing 0x%08X to PI_WR_LEN_REG",PC, Value ); return;
|
|
||||||
case 0xA4600010: LogMessage("%08X: Writing 0x%08X to PI_STATUS_REG",PC, Value ); return;
|
|
||||||
case 0xA4600014: LogMessage("%08X: Writing 0x%08X to PI_BSD_DOM1_LAT_REG/PI_DOMAIN1_REG",PC, Value ); return;
|
|
||||||
case 0xA4600018: LogMessage("%08X: Writing 0x%08X to PI_BSD_DOM1_PWD_REG",PC, Value ); return;
|
|
||||||
case 0xA460001C: LogMessage("%08X: Writing 0x%08X to PI_BSD_DOM1_PGS_REG",PC, Value ); return;
|
|
||||||
case 0xA4600020: LogMessage("%08X: Writing 0x%08X to PI_BSD_DOM1_RLS_REG",PC, Value ); return;
|
|
||||||
case 0xA4600024: LogMessage("%08X: Writing 0x%08X to PI_BSD_DOM2_LAT_REG/PI_DOMAIN2_REG",PC, Value ); return;
|
|
||||||
case 0xA4600028: LogMessage("%08X: Writing 0x%08X to PI_BSD_DOM2_PWD_REG",PC, Value ); return;
|
|
||||||
case 0xA460002C: LogMessage("%08X: Writing 0x%08X to PI_BSD_DOM2_PGS_REG",PC, Value ); return;
|
|
||||||
case 0xA4600030: LogMessage("%08X: Writing 0x%08X to PI_BSD_DOM2_RLS_REG",PC, Value ); return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ( VAddr >= 0xA4700000 && VAddr <= 0xA470001C)
|
|
||||||
{
|
|
||||||
if (!LogOptions.LogRDRAMInterface)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
switch (VAddr)
|
|
||||||
{
|
|
||||||
case 0xA4700000: LogMessage("%08X: Writing 0x%08X to RI_MODE_REG",PC, Value ); return;
|
|
||||||
case 0xA4700004: LogMessage("%08X: Writing 0x%08X to RI_CONFIG_REG",PC, Value ); return;
|
|
||||||
case 0xA4700008: LogMessage("%08X: Writing 0x%08X to RI_CURRENT_LOAD_REG",PC, Value ); return;
|
|
||||||
case 0xA470000C: LogMessage("%08X: Writing 0x%08X to RI_SELECT_REG",PC, Value ); return;
|
|
||||||
case 0xA4700010: LogMessage("%08X: Writing 0x%08X to RI_REFRESH_REG/RI_COUNT_REG",PC, Value ); return;
|
|
||||||
case 0xA4700014: LogMessage("%08X: Writing 0x%08X to RI_LATENCY_REG",PC, Value ); return;
|
|
||||||
case 0xA4700018: LogMessage("%08X: Writing 0x%08X to RI_RERROR_REG",PC, Value ); return;
|
|
||||||
case 0xA470001C: LogMessage("%08X: Writing 0x%08X to RI_WERROR_REG",PC, Value ); return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ( VAddr == 0xA4800000)
|
|
||||||
{
|
|
||||||
if (!LogOptions.LogSerialInterface)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
LogMessage("%08X: Writing 0x%08X to SI_DRAM_ADDR_REG",PC, Value ); return;
|
|
||||||
}
|
|
||||||
if ( VAddr == 0xA4800004)
|
|
||||||
{
|
|
||||||
if (LogOptions.LogPRDMAOperations)
|
|
||||||
{
|
|
||||||
LogMessage("%08X: A DMA transfer from the PIF ram has occured",PC );
|
|
||||||
}
|
|
||||||
if (!LogOptions.LogSerialInterface)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
LogMessage("%08X: Writing 0x%08X to SI_PIF_ADDR_RD64B_REG",PC, Value ); return;
|
|
||||||
}
|
|
||||||
if ( VAddr == 0xA4800010)
|
|
||||||
{
|
|
||||||
if (LogOptions.LogPRDMAOperations)
|
|
||||||
{
|
|
||||||
LogMessage("%08X: A DMA transfer to the PIF ram has occured",PC );
|
|
||||||
}
|
|
||||||
if (!LogOptions.LogSerialInterface)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
LogMessage("%08X: Writing 0x%08X to SI_PIF_ADDR_WR64B_REG",PC, Value ); return;
|
|
||||||
}
|
|
||||||
if ( VAddr == 0xA4800018)
|
|
||||||
{
|
|
||||||
if (!LogOptions.LogSerialInterface)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
LogMessage("%08X: Writing 0x%08X to SI_STATUS_REG",PC, Value ); return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( VAddr >= 0xBFC007C0 && VAddr <= 0xBFC007FC )
|
|
||||||
{
|
|
||||||
if (!LogOptions.LogPRDirectMemStores)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
LogMessage("%08X: Writing 0x%08X to Pif Ram at 0x%X",PC,Value, VAddr - 0xBFC007C0);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!LogOptions.LogUnknown)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
LogMessage("%08X: Writing 0x%08X to %08X ????",PC, Value, VAddr );
|
|
||||||
}
|
|
||||||
|
|
||||||
LRESULT CALLBACK LogPifProc (HWND hDlg, UINT uMsg, WPARAM /*wParam*/, LPARAM lParam)
|
|
||||||
{
|
|
||||||
switch (uMsg)
|
|
||||||
{
|
|
||||||
case WM_INITDIALOG:
|
|
||||||
if (TempOptions.LogPRDMAOperations) { CheckDlgButton(hDlg,IDC_SI_DMA,BST_CHECKED); }
|
|
||||||
if (TempOptions.LogPRDirectMemLoads) { CheckDlgButton(hDlg,IDC_DIRECT_WRITE,BST_CHECKED); }
|
|
||||||
if (TempOptions.LogPRDMAMemLoads) { CheckDlgButton(hDlg,IDC_DMA_WRITE,BST_CHECKED); }
|
|
||||||
if (TempOptions.LogPRDirectMemStores) { CheckDlgButton(hDlg,IDC_DIRECT_READ,BST_CHECKED); }
|
|
||||||
if (TempOptions.LogPRDMAMemStores) { CheckDlgButton(hDlg,IDC_DMA_READ,BST_CHECKED); }
|
|
||||||
if (TempOptions.LogControllerPak) { CheckDlgButton(hDlg,IDC_CONT_PAK,BST_CHECKED); }
|
|
||||||
break;
|
|
||||||
case WM_NOTIFY:
|
|
||||||
if (((NMHDR FAR *) lParam)->code != PSN_APPLY)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
TempOptions.LogPRDMAOperations = IsDlgButtonChecked(hDlg,IDC_SI_DMA) == BST_CHECKED?TRUE:FALSE;
|
|
||||||
TempOptions.LogPRDirectMemLoads = IsDlgButtonChecked(hDlg,IDC_DIRECT_WRITE) == BST_CHECKED?TRUE:FALSE;
|
|
||||||
TempOptions.LogPRDMAMemLoads = IsDlgButtonChecked(hDlg,IDC_DMA_WRITE) == BST_CHECKED?TRUE:FALSE;
|
|
||||||
TempOptions.LogPRDirectMemStores = IsDlgButtonChecked(hDlg,IDC_DIRECT_READ) == BST_CHECKED?TRUE:FALSE;
|
|
||||||
TempOptions.LogPRDMAMemStores = IsDlgButtonChecked(hDlg,IDC_DMA_READ) == BST_CHECKED?TRUE:FALSE;
|
|
||||||
TempOptions.LogControllerPak = IsDlgButtonChecked(hDlg,IDC_CONT_PAK) == BST_CHECKED?TRUE:FALSE;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
LRESULT CALLBACK LogRegProc (HWND hDlg, UINT uMsg, WPARAM /*wParam*/, LPARAM lParam)
|
|
||||||
{
|
|
||||||
switch (uMsg)
|
|
||||||
{
|
|
||||||
case WM_INITDIALOG:
|
|
||||||
if (TempOptions.LogRDRamRegisters) { CheckDlgButton(hDlg,IDC_RDRAM,BST_CHECKED); }
|
|
||||||
if (TempOptions.LogSPRegisters) { CheckDlgButton(hDlg,IDC_SP_REG,BST_CHECKED); }
|
|
||||||
if (TempOptions.LogDPCRegisters) { CheckDlgButton(hDlg,IDC_DPC_REG,BST_CHECKED); }
|
|
||||||
if (TempOptions.LogDPSRegisters) { CheckDlgButton(hDlg,IDC_DPS_REG,BST_CHECKED); }
|
|
||||||
if (TempOptions.LogMIPSInterface) { CheckDlgButton(hDlg,IDC_MI_REG,BST_CHECKED); }
|
|
||||||
if (TempOptions.LogVideoInterface) { CheckDlgButton(hDlg,IDC_VI_REG,BST_CHECKED); }
|
|
||||||
if (TempOptions.LogAudioInterface) { CheckDlgButton(hDlg,IDC_AI_REG,BST_CHECKED); }
|
|
||||||
if (TempOptions.LogPerInterface) { CheckDlgButton(hDlg,IDC_PI_REG,BST_CHECKED); }
|
|
||||||
if (TempOptions.LogRDRAMInterface) { CheckDlgButton(hDlg,IDC_RI_REG,BST_CHECKED); }
|
|
||||||
if (TempOptions.LogSerialInterface) { CheckDlgButton(hDlg,IDC_SI_REG,BST_CHECKED); }
|
|
||||||
break;
|
|
||||||
case WM_NOTIFY:
|
|
||||||
if (((NMHDR FAR *) lParam)->code != PSN_APPLY)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
TempOptions.LogRDRamRegisters = IsDlgButtonChecked(hDlg,IDC_RDRAM) == BST_CHECKED?TRUE:FALSE;
|
|
||||||
TempOptions.LogSPRegisters = IsDlgButtonChecked(hDlg,IDC_SP_REG) == BST_CHECKED?TRUE:FALSE;
|
|
||||||
TempOptions.LogDPCRegisters = IsDlgButtonChecked(hDlg,IDC_DPC_REG) == BST_CHECKED?TRUE:FALSE;
|
|
||||||
TempOptions.LogDPSRegisters = IsDlgButtonChecked(hDlg,IDC_DPS_REG) == BST_CHECKED?TRUE:FALSE;
|
|
||||||
TempOptions.LogMIPSInterface = IsDlgButtonChecked(hDlg,IDC_MI_REG) == BST_CHECKED?TRUE:FALSE;
|
|
||||||
TempOptions.LogVideoInterface = IsDlgButtonChecked(hDlg,IDC_VI_REG) == BST_CHECKED?TRUE:FALSE;
|
|
||||||
TempOptions.LogAudioInterface = IsDlgButtonChecked(hDlg,IDC_AI_REG) == BST_CHECKED?TRUE:FALSE;
|
|
||||||
TempOptions.LogPerInterface = IsDlgButtonChecked(hDlg,IDC_PI_REG) == BST_CHECKED?TRUE:FALSE;
|
|
||||||
TempOptions.LogRDRAMInterface = IsDlgButtonChecked(hDlg,IDC_RI_REG) == BST_CHECKED?TRUE:FALSE;
|
|
||||||
TempOptions.LogSerialInterface = IsDlgButtonChecked(hDlg,IDC_SI_REG) == BST_CHECKED?TRUE:FALSE;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SaveLogSetting (HKEY hKey,char * String, BOOL Value)
|
|
||||||
{
|
|
||||||
DWORD StoreValue = Value;
|
|
||||||
RegSetValueEx(hKey,String,0,REG_DWORD,(CONST BYTE *)&StoreValue,sizeof(DWORD));
|
|
||||||
}
|
|
||||||
|
|
||||||
void SaveLogOptions (void)
|
|
||||||
{
|
|
||||||
long lResult;
|
|
||||||
HKEY hKeyResults = 0;
|
|
||||||
DWORD Disposition = 0;
|
|
||||||
char String[200];
|
|
||||||
|
|
||||||
sprintf(String,"Software\\N64 Emulation\\%s\\Logging",g_Settings->LoadStringVal(Setting_ApplicationName).c_str());
|
|
||||||
lResult = RegCreateKeyEx( HKEY_CURRENT_USER,String,0,"", REG_OPTION_NON_VOLATILE,
|
|
||||||
KEY_ALL_ACCESS,NULL,&hKeyResults,&Disposition);
|
|
||||||
|
|
||||||
SaveLogSetting(hKeyResults,"Log RDRAM",TempOptions.LogRDRamRegisters);
|
|
||||||
SaveLogSetting(hKeyResults,"Log SP",TempOptions.LogSPRegisters);
|
|
||||||
SaveLogSetting(hKeyResults,"Log DP Command",TempOptions.LogDPCRegisters);
|
|
||||||
SaveLogSetting(hKeyResults,"Log DP Span",TempOptions.LogDPSRegisters);
|
|
||||||
SaveLogSetting(hKeyResults,"Log MIPS Interface (MI)",TempOptions.LogMIPSInterface);
|
|
||||||
SaveLogSetting(hKeyResults,"Log Video Interface (VI)",TempOptions.LogVideoInterface);
|
|
||||||
SaveLogSetting(hKeyResults,"Log Audio Interface (AI)",TempOptions.LogAudioInterface);
|
|
||||||
SaveLogSetting(hKeyResults,"Log Peripheral Interface (PI)",TempOptions.LogPerInterface);
|
|
||||||
SaveLogSetting(hKeyResults,"Log RDRAM Interface (RI)",TempOptions.LogRDRAMInterface);
|
|
||||||
SaveLogSetting(hKeyResults,"Log Serial Interface (SI)",TempOptions.LogSerialInterface);
|
|
||||||
SaveLogSetting(hKeyResults,"Log PifRam DMA Operations",TempOptions.LogPRDMAOperations);
|
|
||||||
SaveLogSetting(hKeyResults,"Log PifRam Direct Memory Loads",TempOptions.LogPRDirectMemLoads);
|
|
||||||
SaveLogSetting(hKeyResults,"Log PifRam DMA Memory Loads",TempOptions.LogPRDMAMemLoads);
|
|
||||||
SaveLogSetting(hKeyResults,"Log PifRam Direct Memory Stores",TempOptions.LogPRDirectMemStores);
|
|
||||||
SaveLogSetting(hKeyResults,"Log PifRam DMA Memory Stores",TempOptions.LogPRDMAMemStores);
|
|
||||||
SaveLogSetting(hKeyResults,"Log Controller Pak",TempOptions.LogControllerPak);
|
|
||||||
SaveLogSetting(hKeyResults,"Log CP0 changes",TempOptions.LogCP0changes);
|
|
||||||
SaveLogSetting(hKeyResults,"Log CP0 reads",TempOptions.LogCP0reads);
|
|
||||||
SaveLogSetting(hKeyResults,"Log Exceptions",TempOptions.LogExceptions);
|
|
||||||
SaveLogSetting(hKeyResults,"No Interrupts",TempOptions.NoInterrupts);
|
|
||||||
SaveLogSetting(hKeyResults,"Log TLB",TempOptions.LogTLB);
|
|
||||||
SaveLogSetting(hKeyResults,"Log Cache Operations",TempOptions.LogCache);
|
|
||||||
SaveLogSetting(hKeyResults,"Log Rom Header",TempOptions.LogRomHeader);
|
|
||||||
SaveLogSetting(hKeyResults,"Log Unknown access",TempOptions.LogUnknown);
|
|
||||||
|
|
||||||
RegCloseKey(hKeyResults);
|
|
||||||
}
|
|
||||||
|
|
||||||
void StartLog (void)
|
|
||||||
{
|
|
||||||
if (!LogOptions.GenerateLog)
|
|
||||||
{
|
|
||||||
StopLog();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (hLogFile)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
CPath LogFile(CPath::MODULE_DIRECTORY);
|
|
||||||
LogFile.AppendDirectory("Logs");
|
|
||||||
LogFile.SetNameExtension("cpudebug.log");
|
|
||||||
|
|
||||||
hLogFile = CreateFile(LogFile,GENERIC_WRITE, FILE_SHARE_READ,NULL,CREATE_ALWAYS,
|
|
||||||
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
|
|
||||||
SetFilePointer(hLogFile,0,NULL,FILE_BEGIN);
|
|
||||||
}
|
|
||||||
|
|
||||||
void StopLog (void)
|
|
||||||
{
|
|
||||||
if (hLogFile)
|
|
||||||
{
|
|
||||||
CloseHandle(hLogFile);
|
|
||||||
}
|
|
||||||
hLogFile = NULL;
|
|
||||||
}
|
|
|
@ -1,63 +0,0 @@
|
||||||
/****************************************************************************
|
|
||||||
* *
|
|
||||||
* Project 64 - A Nintendo 64 emulator. *
|
|
||||||
* http://www.pj64-emu.com/ *
|
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
|
||||||
* *
|
|
||||||
* License: *
|
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
|
||||||
* *
|
|
||||||
****************************************************************************/
|
|
||||||
#pragma once
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
BOOL GenerateLog;
|
|
||||||
|
|
||||||
/* Registers Log */
|
|
||||||
BOOL LogRDRamRegisters;
|
|
||||||
BOOL LogSPRegisters;
|
|
||||||
BOOL LogDPCRegisters;
|
|
||||||
BOOL LogDPSRegisters;
|
|
||||||
BOOL LogMIPSInterface;
|
|
||||||
BOOL LogVideoInterface;
|
|
||||||
BOOL LogAudioInterface;
|
|
||||||
BOOL LogPerInterface;
|
|
||||||
BOOL LogRDRAMInterface;
|
|
||||||
BOOL LogSerialInterface;
|
|
||||||
|
|
||||||
/* Pif Ram Log */
|
|
||||||
BOOL LogPRDMAOperations;
|
|
||||||
BOOL LogPRDirectMemLoads;
|
|
||||||
BOOL LogPRDMAMemLoads;
|
|
||||||
BOOL LogPRDirectMemStores;
|
|
||||||
BOOL LogPRDMAMemStores;
|
|
||||||
BOOL LogControllerPak;
|
|
||||||
|
|
||||||
/* Special Log */
|
|
||||||
BOOL LogCP0changes;
|
|
||||||
BOOL LogCP0reads;
|
|
||||||
BOOL LogTLB;
|
|
||||||
BOOL LogExceptions;
|
|
||||||
BOOL NoInterrupts;
|
|
||||||
BOOL LogCache;
|
|
||||||
BOOL LogRomHeader;
|
|
||||||
BOOL LogUnknown;
|
|
||||||
} LOG_OPTIONS;
|
|
||||||
|
|
||||||
extern LOG_OPTIONS LogOptions;
|
|
||||||
|
|
||||||
void EnterLogOptions ( HWND hwndOwner );
|
|
||||||
void LoadLogOptions ( LOG_OPTIONS * LogOptions, BOOL AlwaysFill );
|
|
||||||
void Log_LW ( DWORD PC, DWORD VAddr );
|
|
||||||
void __cdecl LogMessage ( char * Message, ... );
|
|
||||||
void Log_SW ( DWORD PC, DWORD VAddr, DWORD Value );
|
|
||||||
void StartLog ( void );
|
|
||||||
void StopLog ( void );
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
File diff suppressed because it is too large
Load Diff
|
@ -13,79 +13,36 @@
|
||||||
class CCheats
|
class CCheats
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CCheats ( const CN64Rom * Rom = NULL );
|
CCheats();
|
||||||
~CCheats(void);
|
~CCheats(void);
|
||||||
|
|
||||||
bool IsCheatMessage ( MSG * msg );
|
enum
|
||||||
|
{
|
||||||
|
MaxCheats = 50000,
|
||||||
|
MaxGSEntries = 100,
|
||||||
|
};
|
||||||
|
|
||||||
void ApplyCheats(CMipsMemory * MMU);
|
void ApplyCheats(CMipsMemory * MMU);
|
||||||
void ApplyGSButton(CMipsMemory * MMU);
|
void ApplyGSButton(CMipsMemory * MMU);
|
||||||
void LoadCheats(bool DisableSelected, CPlugins * Plugins);
|
void LoadCheats(bool DisableSelected, CPlugins * Plugins);
|
||||||
void SelectCheats ( HWND hParent, bool BlockExecution );
|
|
||||||
inline bool CheatsSlectionChanged ( void ) const { return m_CheatSelectionChanged; }
|
static bool IsValid16BitCode(const char * CheatString);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct GAMESHARK_CODE {
|
struct GAMESHARK_CODE
|
||||||
DWORD Command;
|
{
|
||||||
WORD Value;
|
uint32_t Command;
|
||||||
|
uint16_t Value;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::vector<GAMESHARK_CODE> CODES;
|
typedef std::vector<GAMESHARK_CODE> CODES;
|
||||||
typedef std::vector<CODES> CODES_ARRAY;
|
typedef std::vector<CODES> CODES_ARRAY;
|
||||||
|
|
||||||
enum { MaxCheats = 50000 };
|
|
||||||
void LoadPermCheats(CPlugins * Plugins);
|
void LoadPermCheats(CPlugins * Plugins);
|
||||||
|
|
||||||
static int CALLBACK CheatAddProc ( HWND hDlg,DWORD uMsg,DWORD wParam, DWORD lParam );
|
|
||||||
static int CALLBACK CheatListProc ( HWND hDlg,DWORD uMsg,DWORD wParam, DWORD lParam );
|
|
||||||
static int CALLBACK ManageCheatsProc ( HWND hDlg,DWORD uMsg,DWORD wParam, DWORD lParam );
|
|
||||||
static int CALLBACK CheatsCodeExProc ( HWND hDlg, DWORD uMsg, DWORD wParam, DWORD lParam);
|
|
||||||
static int CALLBACK CheatsCodeQuantProc ( HWND hDlg, DWORD uMsg, DWORD wParam, DWORD lParam);
|
|
||||||
|
|
||||||
//information about the gui for selecting cheats
|
|
||||||
HWND m_Window, m_hSelectCheat, m_AddCheat, m_hCheatTree, m_hSelectedItem;
|
|
||||||
const CN64Rom * m_Rom;
|
const CN64Rom * m_Rom;
|
||||||
void * const m_rcList, * const m_rcAdd;
|
|
||||||
int m_MinSizeDlg, m_MaxSizeDlg;
|
|
||||||
int m_EditCheat;
|
|
||||||
bool m_DeleteingEntries;
|
|
||||||
CODES_ARRAY m_Codes;
|
CODES_ARRAY m_Codes;
|
||||||
bool m_CheatSelectionChanged;
|
|
||||||
|
|
||||||
//Information about the current cheat we are editing
|
bool LoadCode(int32_t CheatNo, const char * CheatString);
|
||||||
stdstr m_EditName;
|
int32_t ApplyCheatEntry(CMipsMemory * MMU, const CODES & CodeEntry, int32_t CurrentEntry, bool Execute);
|
||||||
stdstr m_EditCode;
|
|
||||||
stdstr m_EditOptions;
|
|
||||||
stdstr m_EditNotes;
|
|
||||||
|
|
||||||
enum Dialog_State { CONTRACTED, EXPANDED } m_DialogState;
|
|
||||||
enum TV_CHECK_STATE { TV_STATE_UNKNOWN, TV_STATE_CLEAR, TV_STATE_CHECKED, TV_STATE_INDETERMINATE };
|
|
||||||
enum { MaxGSEntries = 100, IDC_MYTREE = 0x500 };
|
|
||||||
|
|
||||||
bool LoadCode ( int CheatNo, LPCSTR CheatString );
|
|
||||||
void AddCodeLayers ( int CheatNumber, const stdstr &CheatName, HWND hParent, bool CheatActive );
|
|
||||||
//Reload the cheats from the ini file to the select gui
|
|
||||||
void RefreshCheatManager ();
|
|
||||||
void ChangeChildrenStatus ( HWND hParent, bool Checked );
|
|
||||||
void CheckParentStatus ( HWND hParent );
|
|
||||||
static stdstr ReadCodeString ( HWND hDlg, bool &validcodes, bool &validoption, bool &nooptions, int &codeformat );
|
|
||||||
static stdstr ReadOptionsString( HWND hDlg, bool &validcodes, bool &validoptions, bool &nooptions, int &codeformat );
|
|
||||||
int ApplyCheatEntry (CMipsMemory * MMU,const CODES & CodeEntry, int CurrentEntry, bool Execute );
|
|
||||||
void RecordCheatValues ( HWND hDlg );
|
|
||||||
bool CheatChanged ( HWND hDlg );
|
|
||||||
bool IsValid16BitCode ( LPCSTR CheatString ) const;
|
|
||||||
void DeleteCheat(int Index);
|
|
||||||
|
|
||||||
//Get Information about the Cheat
|
|
||||||
stdstr GetCheatName ( int CheatNo, bool AddExtension ) const;
|
|
||||||
static bool CheatUsesCodeExtensions ( const stdstr &LineEntry );
|
|
||||||
|
|
||||||
//Working with treeview
|
|
||||||
static bool TV_SetCheckState(HWND hwndTreeView, HWND hItem, TV_CHECK_STATE state);
|
|
||||||
static int TV_GetCheckState(HWND hwndTreeView, HWND hItem);
|
|
||||||
static DWORD AsciiToHex ( const char * HexValue );
|
|
||||||
static void MenuSetText ( HMENU hMenu, int MenuPos, const wchar_t * Title, const wchar_t * ShortCut );
|
|
||||||
|
|
||||||
|
|
||||||
//UI Functions
|
|
||||||
static stdstr GetDlgItemStr (HWND hDlg, int nIDDlgItem);
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,7 +3,7 @@ class CDebugDialog :
|
||||||
public CDialogImpl < T >
|
public CDialogImpl < T >
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
CDebugger * m_Debugger;
|
CDebuggerUI * m_Debugger;
|
||||||
HANDLE m_CreatedEvent;
|
HANDLE m_CreatedEvent;
|
||||||
HANDLE m_DialogThread;
|
HANDLE m_DialogThread;
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ protected:
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CDebugDialog (CDebugger * debugger) :
|
CDebugDialog(CDebuggerUI * debugger) :
|
||||||
m_Debugger(debugger),
|
m_Debugger(debugger),
|
||||||
m_CreatedEvent(CreateEvent(NULL, true, false, NULL)),
|
m_CreatedEvent(CreateEvent(NULL, true, false, NULL)),
|
||||||
m_DialogThread(NULL)
|
m_DialogThread(NULL)
|
||||||
|
|
|
@ -10,10 +10,9 @@
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
|
|
||||||
#ifdef WINDOWS_UI
|
|
||||||
#include "Debugger UI.h"
|
#include "Debugger UI.h"
|
||||||
|
|
||||||
CDumpMemory::CDumpMemory(CDebugger * debugger) :
|
CDumpMemory::CDumpMemory(CDebuggerUI * debugger) :
|
||||||
CDebugDialog<CDumpMemory>(debugger)
|
CDebugDialog<CDumpMemory>(debugger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -124,207 +123,6 @@ LRESULT CDumpMemory::OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
//#include "..\\..\\User Interface.h"
|
|
||||||
//#include "..\\..\\N64 System.h"
|
|
||||||
//#include <windows.h>
|
|
||||||
//
|
|
||||||
//DWORD CDumpMemory::m_StartAddress = 0x80000000;
|
|
||||||
//DWORD CDumpMemory::m_EndAddress = 0x803FFFF0;
|
|
||||||
//CDumpMemory::CDumpMemory(CMipsMemory * MMU) :
|
|
||||||
// m_Window(NULL), g_MMU(MMU)
|
|
||||||
//{
|
|
||||||
//}
|
|
||||||
//CDumpMemory::~CDumpMemory()
|
|
||||||
//{
|
|
||||||
//}
|
|
||||||
//void CDumpMemory::DisplayDump(HWND & hParent)
|
|
||||||
//{
|
|
||||||
// DialogBoxParam(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_Cheats_DumpMemory),
|
|
||||||
// (HWND)hParent, (DLGPROC)WinProc,(LPARAM)this);
|
|
||||||
//}
|
|
||||||
//DWORD CDumpMemory::AsciiToHex (const char * HexValue)
|
|
||||||
//{
|
|
||||||
// DWORD Count, Finish, Value = 0;
|
|
||||||
// Finish = strlen(HexValue);
|
|
||||||
// if (Finish > 8 )
|
|
||||||
// {
|
|
||||||
// Finish = 8;
|
|
||||||
// }
|
|
||||||
// for (Count = 0; Count < Finish; Count++
|
|
||||||
// {
|
|
||||||
// Value = (Value << 4);
|
|
||||||
// switch ( HexValue[Count] )
|
|
||||||
// {
|
|
||||||
// case '0': break;
|
|
||||||
// case '1': Value += 1; break;
|
|
||||||
// case '2': Value += 2; break;
|
|
||||||
// case '3': Value += 3; break;
|
|
||||||
// case '4': Value += 4; break;
|
|
||||||
// case '5': Value += 5; break;
|
|
||||||
// case '6': Value += 6; break;
|
|
||||||
// case '7': Value += 7; break;
|
|
||||||
// case '8': Value += 8; break;
|
|
||||||
// case '9': Value += 9; break;
|
|
||||||
// case 'A': Value += 10; break;
|
|
||||||
// case 'a': Value += 10; break;
|
|
||||||
// case 'B': Value += 11; break;
|
|
||||||
// case 'b': Value += 11; break;
|
|
||||||
// case 'C': Value += 12; break;
|
|
||||||
// case 'c': Value += 12; break;
|
|
||||||
// case 'D': Value += 13; break;
|
|
||||||
// case 'd': Value += 13; break;
|
|
||||||
// case 'E': Value += 14; break;
|
|
||||||
// case 'e': Value += 14; break;
|
|
||||||
// case 'F': Value += 15; break;
|
|
||||||
// case 'f': Value += 15; break;
|
|
||||||
// default:
|
|
||||||
// Value = (Value >> 4);
|
|
||||||
// Count = Finish;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// return Value;
|
|
||||||
//}
|
|
||||||
//int CALLBACK CDumpMemory::WinProc (HWND hDlg,DWORD uMsg,DWORD wParam, DWORD lParam)
|
|
||||||
//{
|
|
||||||
// switch (uMsg)
|
|
||||||
// {
|
|
||||||
// case WM_INITDIALOG:
|
|
||||||
// {
|
|
||||||
// CDumpMemory * _this = (CDumpMemory *)lParam;
|
|
||||||
// SetProp(hDlg,"Class",_this);
|
|
||||||
// _this->m_Window = hDlg;
|
|
||||||
// SetDlgItemText(hDlg,IDC_E_START_ADDR,stdstr("0x%X",m_StartAddress).c_str());
|
|
||||||
// SetDlgItemText(hDlg,IDC_E_END_ADDR,stdstr("0x%X",m_EndAddress).c_str());
|
|
||||||
// SetDlgItemText(hDlg,IDC_E_ALT_PC,"0x80000000");
|
|
||||||
// HWND hFormatList = GetDlgItem(hDlg,IDC_FORMAT);
|
|
||||||
// int pos = SendMessage(hFormatList,CB_ADDSTRING,(WPARAM)0,(LPARAM)"TEXT - Disassembly + PC");
|
|
||||||
// SendMessage(hFormatList,CB_SETITEMDATA,(WPARAM)pos,(LPARAM)DisassemblyWithPC);
|
|
||||||
// SendMessage(hFormatList,CB_SETCURSEL,(WPARAM)0,(LPARAM)0);
|
|
||||||
// }
|
|
||||||
// break;
|
|
||||||
// case WM_COMMAND:
|
|
||||||
// switch (LOWORD(wParam))
|
|
||||||
// {
|
|
||||||
// case IDC_E_START_ADDR:
|
|
||||||
// case IDC_E_END_ADDR:
|
|
||||||
// case IDC_E_ALT_PC:
|
|
||||||
// if (HIWORD(wParam) == EN_UPDATE)
|
|
||||||
// {
|
|
||||||
// CDumpMemory * _this = (CDumpMemory *)GetProp(hDlg,"Class");
|
|
||||||
// TCHAR szTmp[20], szTmp2[20];
|
|
||||||
// DWORD Value;
|
|
||||||
// GetDlgItemText(hDlg,LOWORD(wParam),szTmp,sizeof(szTmp));
|
|
||||||
// Value = szTmp[1] =='x'?AsciiToHex(&szTmp[2]):AsciiToHex(szTmp);
|
|
||||||
// //if (Value > Stop)
|
|
||||||
// //{
|
|
||||||
// // Value = Stop;
|
|
||||||
// //}
|
|
||||||
// //if (Value < Start)
|
|
||||||
// //{
|
|
||||||
// // Value = Start;
|
|
||||||
// //}
|
|
||||||
// sprintf(szTmp2,"0x%X",Value);
|
|
||||||
// if (strcmp(szTmp,szTmp2) != 0)
|
|
||||||
// {
|
|
||||||
// SetDlgItemText(hDlg,LOWORD(wParam),szTmp2);
|
|
||||||
// if (_this->SelStop == 0)
|
|
||||||
// {
|
|
||||||
// _this->SelStop = strlen(szTmp2); _this->SelStart = _this->SelStop;
|
|
||||||
// }
|
|
||||||
// SendDlgItemMessage(hDlg,LOWORD(wParam),EM_SETSEL,(WPARAM)_this->SelStart,(LPARAM)_this->SelStop);
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// WORD NewSelStart, NewSelStop;
|
|
||||||
// SendDlgItemMessage(hDlg,LOWORD(wParam),EM_GETSEL,(WPARAM)&NewSelStart,(LPARAM)&NewSelStop);
|
|
||||||
// if (NewSelStart != 0)
|
|
||||||
// {
|
|
||||||
// _this->SelStart = NewSelStart; _this->SelStop = NewSelStop;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// break;
|
|
||||||
// case IDC_BTN_CHOOSE_FILE:
|
|
||||||
// {
|
|
||||||
// CDumpMemory * _this = (CDumpMemory *)GetProp(hDlg,"Class");
|
|
||||||
// OPENFILENAME openfilename;
|
|
||||||
// char FileName[_MAX_PATH],Directory[_MAX_PATH];
|
|
||||||
// memset(&FileName, 0, sizeof(FileName));
|
|
||||||
// memset(&openfilename, 0, sizeof(openfilename));
|
|
||||||
// strcpy(Directory,g_Settings->LoadStringVal(ApplicationDir).c_str());
|
|
||||||
// openfilename.lStructSize = sizeof( openfilename );
|
|
||||||
// openfilename.hwndOwner = hDlg;
|
|
||||||
// openfilename.lpstrFilter = "Text file (*.txt)\0*.txt;\0All files (*.*)\0*.*\0";
|
|
||||||
// openfilename.lpstrFile = FileName;
|
|
||||||
// openfilename.lpstrInitialDir = Directory;
|
|
||||||
// openfilename.nMaxFile = MAX_PATH;
|
|
||||||
// openfilename.Flags = OFN_HIDEREADONLY;
|
|
||||||
// if (GetOpenFileName (&openfilename))
|
|
||||||
// {
|
|
||||||
// char drive[_MAX_DRIVE], dir[_MAX_DIR], fname[_MAX_FNAME], ext[_MAX_EXT];
|
|
||||||
// _splitpath( FileName, drive, dir, fname, ext );
|
|
||||||
// if (strlen(ext) == 0)
|
|
||||||
// {
|
|
||||||
// strcat(FileName,".txt");
|
|
||||||
// }
|
|
||||||
// SetDlgItemText(hDlg,IDC_FILENAME,FileName);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// break;
|
|
||||||
// case IDCANCEL:
|
|
||||||
// RemoveProp(hDlg,"Class");
|
|
||||||
// EndDialog(hDlg,0);
|
|
||||||
// break;
|
|
||||||
// case IDOK:
|
|
||||||
// {
|
|
||||||
// CDumpMemory * _this = (CDumpMemory *)GetProp(hDlg,"Class");
|
|
||||||
// TCHAR szTmp[20], FileName[MAX_PATH];
|
|
||||||
// int CurrentFormatSel = SendDlgItemMessage(hDlg,IDC_FORMAT,CB_GETCURSEL,0,0);
|
|
||||||
// DumpFormat Format = (DumpFormat)SendDlgItemMessage(hDlg,IDC_FORMAT,CB_GETITEMDATA,CurrentFormatSel,0);
|
|
||||||
// GetDlgItemText(hDlg,IDC_E_START_ADDR,szTmp,sizeof(szTmp));
|
|
||||||
// DWORD StartPC = szTmp[1] =='x'?AsciiToHex(&szTmp[2]):AsciiToHex(szTmp);
|
|
||||||
// GetDlgItemText(hDlg,IDC_E_END_ADDR,szTmp,sizeof(szTmp));
|
|
||||||
// DWORD EndPC = szTmp[1] =='x'?AsciiToHex(&szTmp[2]):AsciiToHex(szTmp);
|
|
||||||
// GetDlgItemText(hDlg,IDC_E_ALT_PC,szTmp,sizeof(szTmp));
|
|
||||||
// DWORD DumpPC = szTmp[1] =='x'?AsciiToHex(&szTmp[2]):AsciiToHex(szTmp);
|
|
||||||
// GetDlgItemText(hDlg,IDC_FILENAME,FileName,sizeof(FileName));
|
|
||||||
// if (strlen(FileName) == 0)
|
|
||||||
// {
|
|
||||||
// g_Notify->DisplayError(L"Please Choose target file");
|
|
||||||
// SetFocus(GetDlgItem(hDlg,IDC_FILENAME));
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
// if (SendDlgItemMessage(hDlg,IDC_USE_ALT_PC,BM_GETSTATE, 0,0) != BST_CHECKED)
|
|
||||||
// {
|
|
||||||
// DumpPC = _this->g_MMU->SystemRegisters()->PROGRAM_COUNTER;
|
|
||||||
// }
|
|
||||||
// //disable buttons
|
|
||||||
// EnableWindow(GetDlgItem(hDlg,IDC_E_START_ADDR),FALSE);
|
|
||||||
// EnableWindow(GetDlgItem(hDlg,IDC_E_END_ADDR),FALSE);
|
|
||||||
// EnableWindow(GetDlgItem(hDlg,IDC_E_ALT_PC),FALSE);
|
|
||||||
// EnableWindow(GetDlgItem(hDlg,IDC_USE_ALT_PC),FALSE);
|
|
||||||
// EnableWindow(GetDlgItem(hDlg,IDC_FILENAME),FALSE);
|
|
||||||
// EnableWindow(GetDlgItem(hDlg,IDC_BTN_CHOOSE_FILE),FALSE);
|
|
||||||
// EnableWindow(GetDlgItem(hDlg,IDC_FORMAT),FALSE);
|
|
||||||
// EnableWindow(GetDlgItem(hDlg,IDOK),FALSE);
|
|
||||||
// EnableWindow(GetDlgItem(hDlg,IDCANCEL),FALSE);
|
|
||||||
// if (!_this->DumpMemory(FileName,Format,StartPC,EndPC,DumpPC))
|
|
||||||
// {
|
|
||||||
// //enable buttons
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// RemoveProp(hDlg,"Class");
|
|
||||||
// EndDialog(hDlg,0);
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// break;
|
|
||||||
// default:
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
// return true;
|
|
||||||
//}
|
|
||||||
|
|
||||||
bool CDumpMemory::DumpMemory(LPCSTR FileName, DumpFormat Format, DWORD StartPC, DWORD EndPC, DWORD /*DumpPC*/)
|
bool CDumpMemory::DumpMemory(LPCSTR FileName, DumpFormat Format, DWORD StartPC, DWORD EndPC, DWORD /*DumpPC*/)
|
||||||
{
|
{
|
||||||
switch (Format)
|
switch (Format)
|
||||||
|
@ -357,242 +155,3 @@ bool CDumpMemory::DumpMemory ( LPCSTR FileName,DumpFormat Format, DWORD StartPC,
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
//
|
|
||||||
//CDumpMemory::CDumpMemory(CMipsMemory * MMU) :
|
|
||||||
// m_Window(NULL), g_MMU(MMU)
|
|
||||||
//{
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//CDumpMemory::~CDumpMemory()
|
|
||||||
//{
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//void CDumpMemory::DisplayDump(HWND & hParent)
|
|
||||||
//{
|
|
||||||
// DialogBoxParam(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_Cheats_DumpMemory),
|
|
||||||
// (HWND)hParent, (DLGPROC)WinProc,(LPARAM)this);
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//DWORD CDumpMemory::AsciiToHex (const char * HexValue)
|
|
||||||
//{
|
|
||||||
// DWORD Count, Finish, Value = 0;
|
|
||||||
//
|
|
||||||
// Finish = strlen(HexValue);
|
|
||||||
// if (Finish > 8 )
|
|
||||||
// {
|
|
||||||
// Finish = 8;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// for (Count = 0; Count < Finish; Count++)
|
|
||||||
// {
|
|
||||||
// Value = (Value << 4);
|
|
||||||
// switch ( HexValue[Count] )
|
|
||||||
// {
|
|
||||||
// case '0': break;
|
|
||||||
// case '1': Value += 1; break;
|
|
||||||
// case '2': Value += 2; break;
|
|
||||||
// case '3': Value += 3; break;
|
|
||||||
// case '4': Value += 4; break;
|
|
||||||
// case '5': Value += 5; break;
|
|
||||||
// case '6': Value += 6; break;
|
|
||||||
// case '7': Value += 7; break;
|
|
||||||
// case '8': Value += 8; break;
|
|
||||||
// case '9': Value += 9; break;
|
|
||||||
// case 'A': Value += 10; break;
|
|
||||||
// case 'a': Value += 10; break;
|
|
||||||
// case 'B': Value += 11; break;
|
|
||||||
// case 'b': Value += 11; break;
|
|
||||||
// case 'C': Value += 12; break;
|
|
||||||
// case 'c': Value += 12; break;
|
|
||||||
// case 'D': Value += 13; break;
|
|
||||||
// case 'd': Value += 13; break;
|
|
||||||
// case 'E': Value += 14; break;
|
|
||||||
// case 'e': Value += 14; break;
|
|
||||||
// case 'F': Value += 15; break;
|
|
||||||
// case 'f': Value += 15; break;
|
|
||||||
// default:
|
|
||||||
// Value = (Value >> 4);
|
|
||||||
// Count = Finish;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// return Value;
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//int CALLBACK CDumpMemory::WinProc (HWND hDlg,DWORD uMsg,DWORD wParam, DWORD lParam)
|
|
||||||
//{
|
|
||||||
// switch (uMsg)
|
|
||||||
// {
|
|
||||||
// case WM_INITDIALOG:
|
|
||||||
// {
|
|
||||||
// CDumpMemory * _this = (CDumpMemory *)lParam;
|
|
||||||
// SetProp(hDlg,"Class",_this);
|
|
||||||
// _this->m_Window = hDlg;
|
|
||||||
// SetDlgItemText(hDlg,IDC_E_START_ADDR,stdstr("0x%X",m_StartAddress).c_str());
|
|
||||||
// SetDlgItemText(hDlg,IDC_E_END_ADDR,stdstr("0x%X",m_EndAddress).c_str());
|
|
||||||
// SetDlgItemText(hDlg,IDC_E_ALT_PC,"0x80000000");
|
|
||||||
//
|
|
||||||
// HWND hFormatList = GetDlgItem(hDlg,IDC_FORMAT);
|
|
||||||
// int pos = SendMessage(hFormatList,CB_ADDSTRING,(WPARAM)0,(LPARAM)"TEXT - Disassembly + PC");
|
|
||||||
// SendMessage(hFormatList,CB_SETITEMDATA,(WPARAM)pos,(LPARAM)DisassemblyWithPC);
|
|
||||||
// SendMessage(hFormatList,CB_SETCURSEL,(WPARAM)0,(LPARAM)0);
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// break;
|
|
||||||
// case WM_COMMAND:
|
|
||||||
// switch (LOWORD(wParam))
|
|
||||||
// {
|
|
||||||
// case IDC_E_START_ADDR:
|
|
||||||
// case IDC_E_END_ADDR:
|
|
||||||
// case IDC_E_ALT_PC:
|
|
||||||
// if (HIWORD(wParam) == EN_UPDATE)
|
|
||||||
// {
|
|
||||||
// CDumpMemory * _this = (CDumpMemory *)GetProp(hDlg,"Class");
|
|
||||||
//
|
|
||||||
// TCHAR szTmp[20], szTmp2[20];
|
|
||||||
// DWORD Value;
|
|
||||||
//
|
|
||||||
// GetDlgItemText(hDlg,LOWORD(wParam),szTmp,sizeof(szTmp));
|
|
||||||
// Value = szTmp[1] =='x'?AsciiToHex(&szTmp[2]):AsciiToHex(szTmp);
|
|
||||||
// //if (Value > Stop)
|
|
||||||
// //{
|
|
||||||
// // Value = Stop;
|
|
||||||
// //}
|
|
||||||
// //if (Value < Start)
|
|
||||||
// //{
|
|
||||||
// // Value = Start;
|
|
||||||
// //}
|
|
||||||
// sprintf(szTmp2,"0x%X",Value);
|
|
||||||
// if (strcmp(szTmp,szTmp2) != 0)
|
|
||||||
// {
|
|
||||||
// SetDlgItemText(hDlg,LOWORD(wParam),szTmp2);
|
|
||||||
// if (_this->SelStop == 0) { _this->SelStop = strlen(szTmp2); _this->SelStart = _this->SelStop; }
|
|
||||||
// SendDlgItemMessage(hDlg,LOWORD(wParam),EM_SETSEL,(WPARAM)_this->SelStart,(LPARAM)_this->SelStop);
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// WORD NewSelStart, NewSelStop;
|
|
||||||
// SendDlgItemMessage(hDlg,LOWORD(wParam),EM_GETSEL,(WPARAM)&NewSelStart,(LPARAM)&NewSelStop);
|
|
||||||
// if (NewSelStart != 0)
|
|
||||||
// {
|
|
||||||
// _this->SelStart = NewSelStart; _this->SelStop = NewSelStop;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// break;
|
|
||||||
// case IDC_BTN_CHOOSE_FILE:
|
|
||||||
// {
|
|
||||||
// CDumpMemory * _this = (CDumpMemory *)GetProp(hDlg,"Class");
|
|
||||||
//
|
|
||||||
// OPENFILENAME openfilename;
|
|
||||||
// char FileName[_MAX_PATH],Directory[_MAX_PATH];
|
|
||||||
//
|
|
||||||
// memset(&FileName, 0, sizeof(FileName));
|
|
||||||
// memset(&openfilename, 0, sizeof(openfilename));
|
|
||||||
//
|
|
||||||
// strcpy(Directory,g_Settings->LoadStringVal(ApplicationDir).c_str());
|
|
||||||
//
|
|
||||||
// openfilename.lStructSize = sizeof( openfilename );
|
|
||||||
// openfilename.hwndOwner = hDlg;
|
|
||||||
// openfilename.lpstrFilter = "Text file (*.txt)\0*.txt;\0All files (*.*)\0*.*\0";
|
|
||||||
// openfilename.lpstrFile = FileName;
|
|
||||||
// openfilename.lpstrInitialDir = Directory;
|
|
||||||
// openfilename.nMaxFile = MAX_PATH;
|
|
||||||
// openfilename.Flags = OFN_HIDEREADONLY;
|
|
||||||
//
|
|
||||||
// if (GetOpenFileName (&openfilename))
|
|
||||||
// {
|
|
||||||
// char drive[_MAX_DRIVE], dir[_MAX_DIR], fname[_MAX_FNAME], ext[_MAX_EXT];
|
|
||||||
//
|
|
||||||
// _splitpath( FileName, drive, dir, fname, ext );
|
|
||||||
// if (strlen(ext) == 0)
|
|
||||||
// {
|
|
||||||
// strcat(FileName,".txt");
|
|
||||||
// }
|
|
||||||
// SetDlgItemText(hDlg,IDC_FILENAME,FileName);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// break;
|
|
||||||
// case IDCANCEL:
|
|
||||||
// RemoveProp(hDlg,"Class");
|
|
||||||
// EndDialog(hDlg,0);
|
|
||||||
// break;
|
|
||||||
// case IDOK:
|
|
||||||
// {
|
|
||||||
// CDumpMemory * _this = (CDumpMemory *)GetProp(hDlg,"Class");
|
|
||||||
// TCHAR szTmp[20], FileName[MAX_PATH];
|
|
||||||
//
|
|
||||||
// int CurrentFormatSel = SendDlgItemMessage(hDlg,IDC_FORMAT,CB_GETCURSEL,0,0);
|
|
||||||
// DumpFormat Format = (DumpFormat)SendDlgItemMessage(hDlg,IDC_FORMAT,CB_GETITEMDATA,CurrentFormatSel,0);
|
|
||||||
//
|
|
||||||
// GetDlgItemText(hDlg,IDC_E_START_ADDR,szTmp,sizeof(szTmp));
|
|
||||||
// DWORD StartPC = szTmp[1] =='x'?AsciiToHex(&szTmp[2]):AsciiToHex(szTmp);
|
|
||||||
// GetDlgItemText(hDlg,IDC_E_END_ADDR,szTmp,sizeof(szTmp));
|
|
||||||
// DWORD EndPC = szTmp[1] =='x'?AsciiToHex(&szTmp[2]):AsciiToHex(szTmp);
|
|
||||||
// GetDlgItemText(hDlg,IDC_E_ALT_PC,szTmp,sizeof(szTmp));
|
|
||||||
// DWORD DumpPC = szTmp[1] =='x'?AsciiToHex(&szTmp[2]):AsciiToHex(szTmp);
|
|
||||||
// GetDlgItemText(hDlg,IDC_FILENAME,FileName,sizeof(FileName));
|
|
||||||
//
|
|
||||||
// if (strlen(FileName) == 0)
|
|
||||||
// {
|
|
||||||
// g_Notify->DisplayError(L"Please Choose target file");
|
|
||||||
// SetFocus(GetDlgItem(hDlg,IDC_FILENAME));
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (SendDlgItemMessage(hDlg,IDC_USE_ALT_PC,BM_GETSTATE, 0,0) != BST_CHECKED)
|
|
||||||
// {
|
|
||||||
// DumpPC = _this->g_MMU->SystemRegisters()->PROGRAM_COUNTER;
|
|
||||||
// }
|
|
||||||
// //disable buttons
|
|
||||||
// EnableWindow(GetDlgItem(hDlg,IDC_E_START_ADDR),FALSE);
|
|
||||||
// EnableWindow(GetDlgItem(hDlg,IDC_E_END_ADDR),FALSE);
|
|
||||||
// EnableWindow(GetDlgItem(hDlg,IDC_E_ALT_PC),FALSE);
|
|
||||||
// EnableWindow(GetDlgItem(hDlg,IDC_USE_ALT_PC),FALSE);
|
|
||||||
// EnableWindow(GetDlgItem(hDlg,IDC_FILENAME),FALSE);
|
|
||||||
// EnableWindow(GetDlgItem(hDlg,IDC_BTN_CHOOSE_FILE),FALSE);
|
|
||||||
// EnableWindow(GetDlgItem(hDlg,IDC_FORMAT),FALSE);
|
|
||||||
// EnableWindow(GetDlgItem(hDlg,IDOK),FALSE);
|
|
||||||
// EnableWindow(GetDlgItem(hDlg,IDCANCEL),FALSE);
|
|
||||||
// if (!_this->DumpMemory(FileName,Format,StartPC,EndPC,DumpPC))
|
|
||||||
// {
|
|
||||||
// //enable buttons
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// RemoveProp(hDlg,"Class");
|
|
||||||
// EndDialog(hDlg,0);
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// break;
|
|
||||||
// default:
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
// return true;
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//bool CDumpMemory::DumpMemory ( LPCSTR FileName,DumpFormat Format, DWORD StartPC, DWORD EndPC, DWORD DumpPC )
|
|
||||||
//{
|
|
||||||
// switch (Format)
|
|
||||||
// {
|
|
||||||
// case DisassemblyWithPC:
|
|
||||||
// {
|
|
||||||
// CLog LogFile(FileName);
|
|
||||||
// if (!LogFile.IsOpen())
|
|
||||||
// {
|
|
||||||
// g_Notify->DisplayError(L"Failed to open\n%s",FileName);
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// for (COpcode OpCode(g_MMU,StartPC); OpCode.PC() < EndPC; OpCode.Next())
|
|
||||||
// {
|
|
||||||
// LogFile.Log("%X: %s",OpCode.PC(),OpCode.Name().c_str());
|
|
||||||
// }
|
|
||||||
// m_StartAddress = StartPC;
|
|
||||||
// m_EndAddress = EndPC;
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// return false;
|
|
||||||
//}
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ class CDumpMemory :
|
||||||
public:
|
public:
|
||||||
enum { IDD = IDD_Cheats_DumpMemory };
|
enum { IDD = IDD_Cheats_DumpMemory };
|
||||||
|
|
||||||
CDumpMemory(CDebugger * debugger);
|
CDumpMemory(CDebuggerUI * debugger);
|
||||||
virtual ~CDumpMemory(void);
|
virtual ~CDumpMemory(void);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -10,10 +10,9 @@
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
|
|
||||||
#ifdef WINDOWS_UI
|
|
||||||
#include "Debugger UI.h"
|
#include "Debugger UI.h"
|
||||||
|
|
||||||
CDebugMemorySearch::CDebugMemorySearch(CDebugger * debugger) :
|
CDebugMemorySearch::CDebugMemorySearch(CDebuggerUI * debugger) :
|
||||||
CDebugDialog<CDebugMemorySearch>(debugger),
|
CDebugDialog<CDebugMemorySearch>(debugger),
|
||||||
m_MemoryState(NULL),
|
m_MemoryState(NULL),
|
||||||
m_MemoryStateSize(0)
|
m_MemoryStateSize(0)
|
||||||
|
@ -307,7 +306,7 @@ void CDebugMemorySearch::SearchForValue( void )
|
||||||
int ItemId = m_SearchResults.GetItemData(i);
|
int ItemId = m_SearchResults.GetItemData(i);
|
||||||
SearchResultItem & Result = m_SearchResult[ItemId];
|
SearchResultItem & Result = m_SearchResult[ItemId];
|
||||||
|
|
||||||
DWORD NewValue = 0;
|
uint32_t NewValue = 0;
|
||||||
bool valid = false;
|
bool valid = false;
|
||||||
|
|
||||||
switch (Size)
|
switch (Size)
|
||||||
|
@ -442,7 +441,7 @@ void CDebugMemorySearch::SearchForUnknown()
|
||||||
SearchResultItem & Result = m_SearchResult[ItemId];
|
SearchResultItem & Result = m_SearchResult[ItemId];
|
||||||
|
|
||||||
bool UpdateResult = false;
|
bool UpdateResult = false;
|
||||||
DWORD NewValue = 0;
|
uint32_t NewValue = 0;
|
||||||
bool valid = false;
|
bool valid = false;
|
||||||
|
|
||||||
switch (Size)
|
switch (Size)
|
||||||
|
@ -598,7 +597,7 @@ bool CDebugMemorySearch::SearchForChanges(SearchMemChangeState SearchType, Memor
|
||||||
|
|
||||||
if (SearchType == SearchChangeState_Reset)
|
if (SearchType == SearchChangeState_Reset)
|
||||||
{
|
{
|
||||||
Notify().BreakPoint(__FILEW__,__LINE__);
|
g_Notify->BreakPoint(__FILEW__, __LINE__);
|
||||||
}
|
}
|
||||||
if (Size == _32Bit) { StartAddress = ((StartAddress + 3) & ~3); }
|
if (Size == _32Bit) { StartAddress = ((StartAddress + 3) & ~3); }
|
||||||
if (Size == _16Bit) { StartAddress = ((StartAddress + 1) & ~1); }
|
if (Size == _16Bit) { StartAddress = ((StartAddress + 1) & ~1); }
|
||||||
|
@ -789,4 +788,3 @@ bool CDebugMemorySearch::SearchForValue (DWORD Value, MemorySize Size, DWORD &St
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ class CDebugMemorySearch :
|
||||||
public:
|
public:
|
||||||
enum { IDD = IDD_Debugger_Search };
|
enum { IDD = IDD_Debugger_Search };
|
||||||
|
|
||||||
CDebugMemorySearch(CDebugger * debugger);
|
CDebugMemorySearch(CDebuggerUI * debugger);
|
||||||
virtual ~CDebugMemorySearch(void);
|
virtual ~CDebugMemorySearch(void);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -10,10 +10,9 @@
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
|
|
||||||
#ifdef WINDOWS_UI
|
|
||||||
#include "Debugger UI.h"
|
#include "Debugger UI.h"
|
||||||
|
|
||||||
CDebugTlb::CDebugTlb(CDebugger * debugger) :
|
CDebugTlb::CDebugTlb(CDebuggerUI * debugger) :
|
||||||
CDebugDialog<CDebugTlb>(debugger)
|
CDebugDialog<CDebugTlb>(debugger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -287,4 +286,3 @@ void CDebugTlb::RefreshTLBWindow (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
class CDebugTlb :
|
class CDebugTlb :
|
||||||
public CDebugDialog < CDebugTlb >
|
public CDebugDialog < CDebugTlb >
|
||||||
{
|
{
|
||||||
|
|
||||||
BEGIN_MSG_MAP_EX(CDebugTlb)
|
BEGIN_MSG_MAP_EX(CDebugTlb)
|
||||||
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
|
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
|
||||||
COMMAND_CODE_HANDLER(BN_CLICKED, OnClicked)
|
COMMAND_CODE_HANDLER(BN_CLICKED, OnClicked)
|
||||||
|
@ -25,7 +24,7 @@ class CDebugTlb :
|
||||||
public:
|
public:
|
||||||
enum { IDD = IDD_Debugger_TLB };
|
enum { IDD = IDD_Debugger_TLB };
|
||||||
|
|
||||||
CDebugTlb(CDebugger * debugger);
|
CDebugTlb(CDebuggerUI * debugger);
|
||||||
virtual ~CDebugTlb(void);
|
virtual ~CDebugTlb(void);
|
||||||
|
|
||||||
void RefreshTLBWindow(void);
|
void RefreshTLBWindow(void);
|
||||||
|
|
|
@ -10,10 +10,9 @@
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
|
|
||||||
#ifdef WINDOWS_UI
|
|
||||||
#include "Debugger UI.h"
|
#include "Debugger UI.h"
|
||||||
|
|
||||||
CDebugMemoryView::CDebugMemoryView(CDebugger * debugger) :
|
CDebugMemoryView::CDebugMemoryView(CDebuggerUI * debugger) :
|
||||||
CDebugDialog<CDebugMemoryView>(debugger),
|
CDebugDialog<CDebugMemoryView>(debugger),
|
||||||
m_MemoryList(NULL)
|
m_MemoryList(NULL)
|
||||||
{
|
{
|
||||||
|
@ -430,7 +429,6 @@ void CDebugMemoryView::RefreshMemory ( bool ResetCompare )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
WritePos = 4 - Offset;
|
WritePos = 4 - Offset;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (DWORD Pos = ((m_DataStartLoc + 3) & ~3); Pos < (m_DataStartLoc + MemoryToDisplay); WritePos += 4, Pos += 4)
|
for (DWORD Pos = ((m_DataStartLoc + 3) & ~3); Pos < (m_DataStartLoc + MemoryToDisplay); WritePos += 4, Pos += 4)
|
||||||
|
@ -472,4 +470,3 @@ void CDebugMemoryView::RefreshMemory ( bool ResetCompare )
|
||||||
Insert_MemoryLineDump(count);
|
Insert_MemoryLineDump(count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
|
@ -13,7 +13,15 @@
|
||||||
class CDebugMemoryView :
|
class CDebugMemoryView :
|
||||||
public CDebugDialog < CDebugMemoryView >
|
public CDebugDialog < CDebugMemoryView >
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
enum { IDD = IDD_Debugger_Memory };
|
||||||
|
|
||||||
|
CDebugMemoryView(CDebuggerUI * debugger);
|
||||||
|
virtual ~CDebugMemoryView(void);
|
||||||
|
|
||||||
|
void ShowAddress(DWORD Address, bool VAddr);
|
||||||
|
|
||||||
|
private:
|
||||||
BEGIN_MSG_MAP_EX(CDebugMemoryView)
|
BEGIN_MSG_MAP_EX(CDebugMemoryView)
|
||||||
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
|
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
|
||||||
COMMAND_CODE_HANDLER(BN_CLICKED, OnClicked)
|
COMMAND_CODE_HANDLER(BN_CLICKED, OnClicked)
|
||||||
|
@ -47,12 +55,4 @@ class CDebugMemoryView :
|
||||||
bool m_CompareVAddrr;
|
bool m_CompareVAddrr;
|
||||||
BYTE m_CompareData[MemoryToDisplay];
|
BYTE m_CompareData[MemoryToDisplay];
|
||||||
bool m_CompareValid[MemoryToDisplay];
|
bool m_CompareValid[MemoryToDisplay];
|
||||||
|
|
||||||
public:
|
|
||||||
enum { IDD = IDD_Debugger_Memory };
|
|
||||||
|
|
||||||
CDebugMemoryView(CDebugger * debugger);
|
|
||||||
virtual ~CDebugMemoryView(void);
|
|
||||||
|
|
||||||
void ShowAddress (DWORD Address, bool VAddr);
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,41 +1,4 @@
|
||||||
////#define _WIN32_WINNT 0x0500
|
#pragma once
|
||||||
|
|
||||||
//#include <atlbase.h>
|
|
||||||
//#include <wtl/atlapp.h>
|
|
||||||
|
|
||||||
////#include <atlbase.h>
|
|
||||||
////#include <atlapp.h>
|
|
||||||
|
|
||||||
//class CPj64Module :
|
|
||||||
// public CAppModule
|
|
||||||
//{
|
|
||||||
//public:
|
|
||||||
// CPj64Module(void)
|
|
||||||
// {
|
|
||||||
// Init(NULL, GetModuleHandle(NULL));
|
|
||||||
// }
|
|
||||||
// virtual ~CPj64Module(void)
|
|
||||||
// {
|
|
||||||
// Term();
|
|
||||||
// }
|
|
||||||
//};
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//extern CPj64Module _Module;
|
|
||||||
//
|
|
||||||
//#define _WTL_NO_CSTRING
|
|
||||||
//
|
|
||||||
//#include <atlwin.h>
|
|
||||||
//#include <wtl/atlmisc.h>
|
|
||||||
//#include <wtl/atlcrack.h>
|
|
||||||
//
|
|
||||||
//#include <wtl/atlframe.h>
|
|
||||||
//#include <wtl/atlctrls.h>
|
|
||||||
//#include <wtl/atldlgs.h>
|
|
||||||
//
|
|
||||||
//#include "../../Support.h"
|
|
||||||
//#include "Control/numberctrl.h"
|
|
||||||
//#include "Control/ClistCtrl/ListCtrl.h"
|
|
||||||
|
|
||||||
#include "../../WTL App.h"
|
#include "../../WTL App.h"
|
||||||
#include "../../N64 System.h"
|
#include "../../N64 System.h"
|
||||||
|
|
|
@ -9,26 +9,36 @@
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
|
|
||||||
#ifdef WINDOWS_UI
|
|
||||||
#include "Debugger UI.h"
|
#include "Debugger UI.h"
|
||||||
|
|
||||||
CPj64Module _Module;
|
CPj64Module _Module;
|
||||||
|
|
||||||
CDebugger::CDebugger () :
|
CDebuggerUI::CDebuggerUI () :
|
||||||
m_MemoryDump(NULL),
|
m_MemoryDump(NULL),
|
||||||
m_MemoryView(NULL),
|
m_MemoryView(NULL),
|
||||||
m_MemorySearch(NULL),
|
m_MemorySearch(NULL),
|
||||||
m_DebugTLB(NULL)
|
m_DebugTLB(NULL)
|
||||||
{
|
{
|
||||||
|
g_Settings->RegisterChangeCB(GameRunning_InReset,this,(CSettings::SettingChangedFunc)GameReset);
|
||||||
|
g_Debugger = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
CDebugger::~CDebugger (void)
|
CDebuggerUI::~CDebuggerUI (void)
|
||||||
{
|
{
|
||||||
|
g_Settings->UnregisterChangeCB(GameRunning_InReset,this,(CSettings::SettingChangedFunc)GameReset);
|
||||||
Debug_Reset();
|
Debug_Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDebugger::Debug_Reset ( void )
|
void CDebuggerUI::GameReset ( CDebuggerUI * _this )
|
||||||
|
{
|
||||||
|
if (!g_Settings->LoadBool(GameRunning_InReset))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_this->Debug_Reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDebuggerUI::Debug_Reset ( void )
|
||||||
{
|
{
|
||||||
if (m_MemoryDump)
|
if (m_MemoryDump)
|
||||||
{
|
{
|
||||||
|
@ -56,7 +66,7 @@ void CDebugger::Debug_Reset ( void )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDebugger::Debug_ShowMemoryDump()
|
void CDebuggerUI::Debug_ShowMemoryDump()
|
||||||
{
|
{
|
||||||
if (g_MMU == NULL)
|
if (g_MMU == NULL)
|
||||||
{
|
{
|
||||||
|
@ -72,7 +82,7 @@ void CDebugger::Debug_ShowMemoryDump()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDebugger::Debug_ShowMemoryWindow ( void )
|
void CDebuggerUI::Debug_ShowMemoryWindow ( void )
|
||||||
{
|
{
|
||||||
if (g_MMU == NULL)
|
if (g_MMU == NULL)
|
||||||
{
|
{
|
||||||
|
@ -88,7 +98,7 @@ void CDebugger::Debug_ShowMemoryWindow ( void )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDebugger::Debug_ShowMemoryLocation ( DWORD Address, bool VAddr )
|
void CDebuggerUI::Debug_ShowMemoryLocation ( uint32_t Address, bool VAddr )
|
||||||
{
|
{
|
||||||
Debug_ShowMemoryWindow();
|
Debug_ShowMemoryWindow();
|
||||||
if (m_MemoryView)
|
if (m_MemoryView)
|
||||||
|
@ -97,7 +107,7 @@ void CDebugger::Debug_ShowMemoryLocation ( DWORD Address, bool VAddr )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDebugger::Debug_ShowTLBWindow (void)
|
void CDebuggerUI::Debug_ShowTLBWindow (void)
|
||||||
{
|
{
|
||||||
if (g_MMU == NULL)
|
if (g_MMU == NULL)
|
||||||
{
|
{
|
||||||
|
@ -113,7 +123,7 @@ void CDebugger::Debug_ShowTLBWindow (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDebugger::Debug_RefreshTLBWindow(void)
|
void CDebuggerUI::Debug_RefreshTLBWindow(void)
|
||||||
{
|
{
|
||||||
if (m_DebugTLB)
|
if (m_DebugTLB)
|
||||||
{
|
{
|
||||||
|
@ -121,7 +131,7 @@ void CDebugger::Debug_RefreshTLBWindow(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDebugger::Debug_ShowMemorySearch()
|
void CDebuggerUI::Debug_ShowMemorySearch()
|
||||||
{
|
{
|
||||||
if (m_MemorySearch == NULL)
|
if (m_MemorySearch == NULL)
|
||||||
{
|
{
|
||||||
|
@ -132,4 +142,8 @@ void CDebugger::Debug_ShowMemorySearch()
|
||||||
m_MemorySearch->ShowWindow();
|
m_MemorySearch->ShowWindow();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
void CDebuggerUI::TLBChanged()
|
||||||
|
{
|
||||||
|
Debug_RefreshTLBWindow();
|
||||||
|
}
|
|
@ -13,8 +13,15 @@
|
||||||
class CDumpMemory;
|
class CDumpMemory;
|
||||||
class CDebugMemoryView;
|
class CDebugMemoryView;
|
||||||
class CDebugMemorySearch;
|
class CDebugMemorySearch;
|
||||||
|
class CDebugTlb;
|
||||||
|
|
||||||
class CDebugger
|
__interface CDebugger
|
||||||
|
{
|
||||||
|
virtual void TLBChanged ( void ) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
class CDebuggerUI :
|
||||||
|
public CDebugger
|
||||||
{
|
{
|
||||||
CDumpMemory * m_MemoryDump;
|
CDumpMemory * m_MemoryDump;
|
||||||
CDebugMemoryView * m_MemoryView;
|
CDebugMemoryView * m_MemoryView;
|
||||||
|
@ -22,16 +29,19 @@ class CDebugger
|
||||||
CDebugTlb * m_DebugTLB;
|
CDebugTlb * m_DebugTLB;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
CDebugger();
|
CDebuggerUI();
|
||||||
virtual ~CDebugger();
|
virtual ~CDebuggerUI();
|
||||||
|
|
||||||
|
void TLBChanged ( void );
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
void Debug_Reset ( void );
|
void Debug_Reset ( void );
|
||||||
void Debug_ShowMemoryDump ( void );
|
void Debug_ShowMemoryDump ( void );
|
||||||
void Debug_ShowMemoryWindow ( void );
|
void Debug_ShowMemoryWindow ( void );
|
||||||
void Debug_ShowMemoryLocation ( DWORD Address, bool VAddr );
|
void Debug_ShowMemoryLocation ( uint32_t Address, bool VAddr );
|
||||||
void Debug_ShowMemorySearch ( void );
|
void Debug_ShowMemorySearch ( void );
|
||||||
void Debug_ShowTLBWindow ( void );
|
void Debug_ShowTLBWindow ( void );
|
||||||
void Debug_RefreshTLBWindow ( void );
|
void Debug_RefreshTLBWindow ( void );
|
||||||
|
|
||||||
|
static void GameReset ( CDebuggerUI * _this );
|
||||||
};
|
};
|
||||||
|
|
|
@ -0,0 +1,96 @@
|
||||||
|
/****************************************************************************
|
||||||
|
* *
|
||||||
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
|
* http://www.pj64-emu.com/ *
|
||||||
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
|
* *
|
||||||
|
* License: *
|
||||||
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
|
* *
|
||||||
|
****************************************************************************/
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include <Project64\N64 System\N64 Class.h>
|
||||||
|
#include <common/Util.h>
|
||||||
|
#include <Windows.h>
|
||||||
|
#include <Objbase.h>
|
||||||
|
|
||||||
|
void CN64System::StartEmulationThead()
|
||||||
|
{
|
||||||
|
ThreadInfo * Info = new ThreadInfo;
|
||||||
|
HANDLE * hThread = new HANDLE;
|
||||||
|
*hThread = NULL;
|
||||||
|
|
||||||
|
//create the needed info into a structure to pass as one parameter
|
||||||
|
//for creating a thread
|
||||||
|
Info->ThreadHandle = hThread;
|
||||||
|
|
||||||
|
*hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)StartEmulationThread, Info, 0, (LPDWORD)&Info->ThreadID);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CN64System::StartEmulationThread(ThreadInfo * Info)
|
||||||
|
{
|
||||||
|
if (g_Settings->LoadBool(Setting_CN64TimeCritical))
|
||||||
|
{
|
||||||
|
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
CoInitialize(NULL);
|
||||||
|
|
||||||
|
EmulationStarting(Info->ThreadHandle, Info->ThreadID);
|
||||||
|
delete ((HANDLE *)Info->ThreadHandle);
|
||||||
|
delete Info;
|
||||||
|
|
||||||
|
CoUninitialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CN64System::CloseCpu()
|
||||||
|
{
|
||||||
|
if (m_CPU_Handle == NULL)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_EndEmulation = true;
|
||||||
|
if (g_Settings->LoadBool(GameRunning_CPU_Paused))
|
||||||
|
{
|
||||||
|
m_hPauseEvent.Trigger();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GetCurrentThreadId() == m_CPU_ThreadID)
|
||||||
|
{
|
||||||
|
ExternalEvent(SysEvent_CloseCPU);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
HANDLE hThread = m_CPU_Handle;
|
||||||
|
m_CPU_Handle = NULL;
|
||||||
|
for (int count = 0; count < 200; count++)
|
||||||
|
{
|
||||||
|
pjutil::Sleep(100);
|
||||||
|
if (g_Notify->ProcessGuiMessages())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD ExitCode;
|
||||||
|
if (GetExitCodeThread(hThread, &ExitCode))
|
||||||
|
{
|
||||||
|
if (ExitCode != STILL_ACTIVE)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hThread)
|
||||||
|
{
|
||||||
|
DWORD ExitCode;
|
||||||
|
GetExitCodeThread(hThread, &ExitCode);
|
||||||
|
if (ExitCode == STILL_ACTIVE)
|
||||||
|
{
|
||||||
|
TerminateThread(hThread, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CloseHandle(hThread);
|
||||||
|
CpuStopped();
|
||||||
|
}
|
|
@ -12,12 +12,12 @@
|
||||||
|
|
||||||
R4300iOp::Func * CInterpreterCPU::m_R4300i_Opcode = NULL;
|
R4300iOp::Func * CInterpreterCPU::m_R4300i_Opcode = NULL;
|
||||||
|
|
||||||
void ExecuteInterpreterOps (DWORD /*Cycles*/)
|
void ExecuteInterpreterOps(uint32_t /*Cycles*/)
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILEW__, __LINE__);
|
g_Notify->BreakPoint(__FILEW__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DelaySlotEffectsCompare (DWORD PC, DWORD Reg1, DWORD Reg2)
|
bool DelaySlotEffectsCompare(uint32_t PC, uint32_t Reg1, uint32_t Reg2)
|
||||||
{
|
{
|
||||||
OPCODE Command;
|
OPCODE Command;
|
||||||
|
|
||||||
|
@ -264,13 +264,13 @@ void CInterpreterCPU::InPermLoop()
|
||||||
void CInterpreterCPU::ExecuteCPU()
|
void CInterpreterCPU::ExecuteCPU()
|
||||||
{
|
{
|
||||||
bool & Done = g_System->m_EndEmulation;
|
bool & Done = g_System->m_EndEmulation;
|
||||||
DWORD & PROGRAM_COUNTER = *_PROGRAM_COUNTER;
|
uint32_t & PROGRAM_COUNTER = *_PROGRAM_COUNTER;
|
||||||
OPCODE & Opcode = R4300iOp::m_Opcode;
|
OPCODE & Opcode = R4300iOp::m_Opcode;
|
||||||
DWORD & JumpToLocation = R4300iOp::m_JumpToLocation;
|
uint32_t & JumpToLocation = R4300iOp::m_JumpToLocation;
|
||||||
bool & TestTimer = R4300iOp::m_TestTimer;
|
bool & TestTimer = R4300iOp::m_TestTimer;
|
||||||
const BOOL & bDoSomething= g_SystemEvents->DoSomething();
|
const int32_t & bDoSomething = g_SystemEvents->DoSomething();
|
||||||
DWORD CountPerOp = g_System->CountPerOp();
|
uint32_t CountPerOp = g_System->CountPerOp();
|
||||||
int & NextTimer = *g_NextTimer;
|
int32_t & NextTimer = *g_NextTimer;
|
||||||
|
|
||||||
__try
|
__try
|
||||||
{
|
{
|
||||||
|
@ -302,7 +302,7 @@ void CInterpreterCPU::ExecuteCPU()
|
||||||
break;
|
break;
|
||||||
case JUMP:
|
case JUMP:
|
||||||
{
|
{
|
||||||
BOOL CheckTimer = (JumpToLocation < PROGRAM_COUNTER || TestTimer);
|
bool CheckTimer = (JumpToLocation < PROGRAM_COUNTER || TestTimer);
|
||||||
PROGRAM_COUNTER = JumpToLocation;
|
PROGRAM_COUNTER = JumpToLocation;
|
||||||
R4300iOp::m_NextInstruction = NORMAL;
|
R4300iOp::m_NextInstruction = NORMAL;
|
||||||
if (CheckTimer)
|
if (CheckTimer)
|
||||||
|
@ -339,23 +339,22 @@ void CInterpreterCPU::ExecuteCPU()
|
||||||
R4300iOp::m_NextInstruction = NORMAL;
|
R4300iOp::m_NextInstruction = NORMAL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} __except( g_MMU->MemoryFilter( GetExceptionCode(), GetExceptionInformation()) )
|
}
|
||||||
|
__except (g_MMU->MemoryFilter(GetExceptionCode(), GetExceptionInformation()))
|
||||||
{
|
{
|
||||||
g_Notify->DisplayError(GS(MSG_UNKNOWN_MEM_ACTION));
|
g_Notify->FatalError(GS(MSG_UNKNOWN_MEM_ACTION));
|
||||||
ExitThread(0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CInterpreterCPU::ExecuteOps(int32_t Cycles)
|
||||||
void CInterpreterCPU::ExecuteOps(int Cycles)
|
|
||||||
{
|
{
|
||||||
bool & Done = g_System->m_EndEmulation;
|
bool & Done = g_System->m_EndEmulation;
|
||||||
DWORD & PROGRAM_COUNTER = *_PROGRAM_COUNTER;
|
uint32_t & PROGRAM_COUNTER = *_PROGRAM_COUNTER;
|
||||||
OPCODE & Opcode = R4300iOp::m_Opcode;
|
OPCODE & Opcode = R4300iOp::m_Opcode;
|
||||||
DWORD & JumpToLocation = R4300iOp::m_JumpToLocation;
|
uint32_t & JumpToLocation = R4300iOp::m_JumpToLocation;
|
||||||
bool & TestTimer = R4300iOp::m_TestTimer;
|
bool & TestTimer = R4300iOp::m_TestTimer;
|
||||||
const BOOL & DoSomething = g_SystemEvents->DoSomething();
|
const int32_t & DoSomething = g_SystemEvents->DoSomething();
|
||||||
DWORD CountPerOp = g_System->CountPerOp();
|
uint32_t CountPerOp = g_System->CountPerOp();
|
||||||
|
|
||||||
__try
|
__try
|
||||||
{
|
{
|
||||||
|
@ -387,7 +386,7 @@ void CInterpreterCPU::ExecuteOps(int Cycles)
|
||||||
Cycles -= CountPerOp;
|
Cycles -= CountPerOp;
|
||||||
*g_NextTimer -= CountPerOp;
|
*g_NextTimer -= CountPerOp;
|
||||||
|
|
||||||
/*static DWORD TestAddress = 0x80077B0C, TestValue = 0, CurrentValue = 0;
|
/*static uint32_t TestAddress = 0x80077B0C, TestValue = 0, CurrentValue = 0;
|
||||||
if (g_MMU->LW_VAddr(TestAddress, TestValue))
|
if (g_MMU->LW_VAddr(TestAddress, TestValue))
|
||||||
{
|
{
|
||||||
if (TestValue != CurrentValue)
|
if (TestValue != CurrentValue)
|
||||||
|
@ -412,7 +411,7 @@ void CInterpreterCPU::ExecuteOps(int Cycles)
|
||||||
break;
|
break;
|
||||||
case JUMP:
|
case JUMP:
|
||||||
{
|
{
|
||||||
BOOL CheckTimer = (JumpToLocation < PROGRAM_COUNTER || TestTimer);
|
bool CheckTimer = (JumpToLocation < PROGRAM_COUNTER || TestTimer);
|
||||||
PROGRAM_COUNTER = JumpToLocation;
|
PROGRAM_COUNTER = JumpToLocation;
|
||||||
R4300iOp::m_NextInstruction = NORMAL;
|
R4300iOp::m_NextInstruction = NORMAL;
|
||||||
if (CheckTimer)
|
if (CheckTimer)
|
||||||
|
@ -449,9 +448,9 @@ void CInterpreterCPU::ExecuteOps(int Cycles)
|
||||||
R4300iOp::m_NextInstruction = NORMAL;
|
R4300iOp::m_NextInstruction = NORMAL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} __except( g_MMU->MemoryFilter( GetExceptionCode(), GetExceptionInformation()) )
|
}
|
||||||
|
__except (g_MMU->MemoryFilter(GetExceptionCode(), GetExceptionInformation()))
|
||||||
{
|
{
|
||||||
g_Notify->DisplayError(GS(MSG_UNKNOWN_MEM_ACTION));
|
g_Notify->FatalError(GS(MSG_UNKNOWN_MEM_ACTION));
|
||||||
ExitThread(0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -10,13 +10,15 @@
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <Project64\N64 System\Interpreter\Interpreter Ops.h>
|
||||||
|
|
||||||
class CInterpreterCPU :
|
class CInterpreterCPU :
|
||||||
private R4300iOp
|
private R4300iOp
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void BuildCPU();
|
static void BuildCPU();
|
||||||
static void ExecuteCPU();
|
static void ExecuteCPU();
|
||||||
static void ExecuteOps(int Cycles);
|
static void ExecuteOps(int32_t Cycles);
|
||||||
static void InPermLoop();
|
static void InPermLoop();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -9,9 +9,9 @@
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
//#include "../C Core/Logging.h"
|
#include <Project64\Logging.h>
|
||||||
|
|
||||||
bool DelaySlotEffectsCompare ( DWORD PC, DWORD Reg1, DWORD Reg2 );
|
bool DelaySlotEffectsCompare(uint32_t PC, uint32_t Reg1, uint32_t Reg2);
|
||||||
|
|
||||||
#define ADDRESS_ERROR_EXCEPTION(Address,FromRead) \
|
#define ADDRESS_ERROR_EXCEPTION(Address,FromRead) \
|
||||||
g_Reg->DoAddressError(m_NextInstruction == JUMP,Address,FromRead);\
|
g_Reg->DoAddressError(m_NextInstruction == JUMP,Address,FromRead);\
|
||||||
|
@ -626,7 +626,6 @@ R4300iOp32::Func * R4300iOp32::BuildInterpreter()
|
||||||
return Jump_Opcode;
|
return Jump_Opcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************* Opcode functions *************************/
|
/************************* Opcode functions *************************/
|
||||||
void R4300iOp32::JAL()
|
void R4300iOp32::JAL()
|
||||||
{
|
{
|
||||||
|
@ -645,7 +644,7 @@ void R4300iOp32::BEQ()
|
||||||
m_NextInstruction = DELAY_SLOT;
|
m_NextInstruction = DELAY_SLOT;
|
||||||
if (_GPR[m_Opcode.rs].W[0] == _GPR[m_Opcode.rt].W[0])
|
if (_GPR[m_Opcode.rs].W[0] == _GPR[m_Opcode.rt].W[0])
|
||||||
{
|
{
|
||||||
m_JumpToLocation = (*_PROGRAM_COUNTER) + ((short)m_Opcode.offset << 2) + 4;
|
m_JumpToLocation = (*_PROGRAM_COUNTER) + ((int16_t)m_Opcode.offset << 2) + 4;
|
||||||
if ((*_PROGRAM_COUNTER) == m_JumpToLocation)
|
if ((*_PROGRAM_COUNTER) == m_JumpToLocation)
|
||||||
{
|
{
|
||||||
if (!DelaySlotEffectsCompare(*_PROGRAM_COUNTER, m_Opcode.rs, m_Opcode.rt))
|
if (!DelaySlotEffectsCompare(*_PROGRAM_COUNTER, m_Opcode.rs, m_Opcode.rt))
|
||||||
|
@ -665,7 +664,7 @@ void R4300iOp32::BNE()
|
||||||
m_NextInstruction = DELAY_SLOT;
|
m_NextInstruction = DELAY_SLOT;
|
||||||
if (_GPR[m_Opcode.rs].W[0] != _GPR[m_Opcode.rt].W[0])
|
if (_GPR[m_Opcode.rs].W[0] != _GPR[m_Opcode.rt].W[0])
|
||||||
{
|
{
|
||||||
m_JumpToLocation = (*_PROGRAM_COUNTER) + ((short)m_Opcode.offset << 2) + 4;
|
m_JumpToLocation = (*_PROGRAM_COUNTER) + ((int16_t)m_Opcode.offset << 2) + 4;
|
||||||
if ((*_PROGRAM_COUNTER) == m_JumpToLocation)
|
if ((*_PROGRAM_COUNTER) == m_JumpToLocation)
|
||||||
{
|
{
|
||||||
if (!DelaySlotEffectsCompare(*_PROGRAM_COUNTER, m_Opcode.rs, m_Opcode.rt))
|
if (!DelaySlotEffectsCompare(*_PROGRAM_COUNTER, m_Opcode.rs, m_Opcode.rt))
|
||||||
|
@ -684,7 +683,7 @@ void R4300iOp32::BLEZ() {
|
||||||
m_NextInstruction = DELAY_SLOT;
|
m_NextInstruction = DELAY_SLOT;
|
||||||
if (_GPR[m_Opcode.rs].W[0] <= 0)
|
if (_GPR[m_Opcode.rs].W[0] <= 0)
|
||||||
{
|
{
|
||||||
m_JumpToLocation = (*_PROGRAM_COUNTER) + ((short)m_Opcode.offset << 2) + 4;
|
m_JumpToLocation = (*_PROGRAM_COUNTER) + ((int16_t)m_Opcode.offset << 2) + 4;
|
||||||
if ((*_PROGRAM_COUNTER) == m_JumpToLocation)
|
if ((*_PROGRAM_COUNTER) == m_JumpToLocation)
|
||||||
{
|
{
|
||||||
if (!DelaySlotEffectsCompare(*_PROGRAM_COUNTER, m_Opcode.rs, 0))
|
if (!DelaySlotEffectsCompare(*_PROGRAM_COUNTER, m_Opcode.rs, 0))
|
||||||
|
@ -704,7 +703,7 @@ void R4300iOp32::BGTZ()
|
||||||
m_NextInstruction = DELAY_SLOT;
|
m_NextInstruction = DELAY_SLOT;
|
||||||
if (_GPR[m_Opcode.rs].W[0] > 0)
|
if (_GPR[m_Opcode.rs].W[0] > 0)
|
||||||
{
|
{
|
||||||
m_JumpToLocation = (*_PROGRAM_COUNTER) + ((short)m_Opcode.offset << 2) + 4;
|
m_JumpToLocation = (*_PROGRAM_COUNTER) + ((int16_t)m_Opcode.offset << 2) + 4;
|
||||||
if ((*_PROGRAM_COUNTER) == m_JumpToLocation)
|
if ((*_PROGRAM_COUNTER) == m_JumpToLocation)
|
||||||
{
|
{
|
||||||
if (!DelaySlotEffectsCompare(*_PROGRAM_COUNTER, m_Opcode.rs, 0))
|
if (!DelaySlotEffectsCompare(*_PROGRAM_COUNTER, m_Opcode.rs, 0))
|
||||||
|
@ -724,10 +723,10 @@ void R4300iOp32::ADDI()
|
||||||
#ifdef Interpreter_StackTest
|
#ifdef Interpreter_StackTest
|
||||||
if (m_Opcode.rs == 29 && m_Opcode.rt == 29)
|
if (m_Opcode.rs == 29 && m_Opcode.rt == 29)
|
||||||
{
|
{
|
||||||
StackValue += (short)m_Opcode.immediate;
|
StackValue += (int16_t)m_Opcode.immediate;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
_GPR[m_Opcode.rt].W[0] = (_GPR[m_Opcode.rs].W[0] + ((short)m_Opcode.immediate));
|
_GPR[m_Opcode.rt].W[0] = (_GPR[m_Opcode.rs].W[0] + ((int16_t)m_Opcode.immediate));
|
||||||
#ifdef Interpreter_StackTest
|
#ifdef Interpreter_StackTest
|
||||||
if (m_Opcode.rt == 29 && m_Opcode.rs != 29)
|
if (m_Opcode.rt == 29 && m_Opcode.rs != 29)
|
||||||
{
|
{
|
||||||
|
@ -741,10 +740,10 @@ void R4300iOp32::ADDIU()
|
||||||
#ifdef Interpreter_StackTest
|
#ifdef Interpreter_StackTest
|
||||||
if (m_Opcode.rs == 29 && m_Opcode.rt == 29)
|
if (m_Opcode.rs == 29 && m_Opcode.rt == 29)
|
||||||
{
|
{
|
||||||
StackValue += (short)m_Opcode.immediate;
|
StackValue += (int16_t)m_Opcode.immediate;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
_GPR[m_Opcode.rt].W[0] = (_GPR[m_Opcode.rs].W[0] + ((short)m_Opcode.immediate));
|
_GPR[m_Opcode.rt].W[0] = (_GPR[m_Opcode.rs].W[0] + ((int16_t)m_Opcode.immediate));
|
||||||
#ifdef Interpreter_StackTest
|
#ifdef Interpreter_StackTest
|
||||||
if (m_Opcode.rt == 29 && m_Opcode.rs != 29)
|
if (m_Opcode.rt == 29 && m_Opcode.rs != 29)
|
||||||
{
|
{
|
||||||
|
@ -755,7 +754,7 @@ void R4300iOp32::ADDIU()
|
||||||
|
|
||||||
void R4300iOp32::SLTI()
|
void R4300iOp32::SLTI()
|
||||||
{
|
{
|
||||||
if (_GPR[m_Opcode.rs].W[0] < (__int64)((short)m_Opcode.immediate))
|
if (_GPR[m_Opcode.rs].W[0] < (int64_t)((int16_t)m_Opcode.immediate))
|
||||||
{
|
{
|
||||||
_GPR[m_Opcode.rt].W[0] = 1;
|
_GPR[m_Opcode.rt].W[0] = 1;
|
||||||
}
|
}
|
||||||
|
@ -767,11 +766,11 @@ void R4300iOp32::SLTI()
|
||||||
|
|
||||||
void R4300iOp32::SLTIU()
|
void R4300iOp32::SLTIU()
|
||||||
{
|
{
|
||||||
int imm32 = (short)m_Opcode.immediate;
|
int32_t imm32 = (int16_t)m_Opcode.immediate;
|
||||||
__int64 imm64;
|
int64_t imm64;
|
||||||
|
|
||||||
imm64 = imm32;
|
imm64 = imm32;
|
||||||
_GPR[m_Opcode.rt].W[0] = _GPR[m_Opcode.rs].UW[0] < (unsigned __int64)imm64?1:0;
|
_GPR[m_Opcode.rt].W[0] = _GPR[m_Opcode.rs].UW[0] < (uint64_t)imm64 ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void R4300iOp32::ANDI()
|
void R4300iOp32::ANDI()
|
||||||
|
@ -791,7 +790,7 @@ void R4300iOp32::XORI()
|
||||||
|
|
||||||
void R4300iOp32::LUI()
|
void R4300iOp32::LUI()
|
||||||
{
|
{
|
||||||
_GPR[m_Opcode.rt].W[0] = (long)((short)m_Opcode.offset << 16);
|
_GPR[m_Opcode.rt].W[0] = (int32_t)((int16_t)m_Opcode.offset << 16);
|
||||||
#ifdef Interpreter_StackTest
|
#ifdef Interpreter_StackTest
|
||||||
if (m_Opcode.rt == 29)
|
if (m_Opcode.rt == 29)
|
||||||
{
|
{
|
||||||
|
@ -805,7 +804,7 @@ void R4300iOp32::BEQL()
|
||||||
if (_GPR[m_Opcode.rs].W[0] == _GPR[m_Opcode.rt].W[0])
|
if (_GPR[m_Opcode.rs].W[0] == _GPR[m_Opcode.rt].W[0])
|
||||||
{
|
{
|
||||||
m_NextInstruction = DELAY_SLOT;
|
m_NextInstruction = DELAY_SLOT;
|
||||||
m_JumpToLocation = (*_PROGRAM_COUNTER) + ((short)m_Opcode.offset << 2) + 4;
|
m_JumpToLocation = (*_PROGRAM_COUNTER) + ((int16_t)m_Opcode.offset << 2) + 4;
|
||||||
if ((*_PROGRAM_COUNTER) == m_JumpToLocation)
|
if ((*_PROGRAM_COUNTER) == m_JumpToLocation)
|
||||||
{
|
{
|
||||||
if (!DelaySlotEffectsCompare(*_PROGRAM_COUNTER, m_Opcode.rs, m_Opcode.rt))
|
if (!DelaySlotEffectsCompare(*_PROGRAM_COUNTER, m_Opcode.rs, m_Opcode.rt))
|
||||||
|
@ -826,7 +825,7 @@ void R4300iOp32::BNEL()
|
||||||
if (_GPR[m_Opcode.rs].W[0] != _GPR[m_Opcode.rt].W[0])
|
if (_GPR[m_Opcode.rs].W[0] != _GPR[m_Opcode.rt].W[0])
|
||||||
{
|
{
|
||||||
m_NextInstruction = DELAY_SLOT;
|
m_NextInstruction = DELAY_SLOT;
|
||||||
m_JumpToLocation = (*_PROGRAM_COUNTER) + ((short)m_Opcode.offset << 2) + 4;
|
m_JumpToLocation = (*_PROGRAM_COUNTER) + ((int16_t)m_Opcode.offset << 2) + 4;
|
||||||
if ((*_PROGRAM_COUNTER) == m_JumpToLocation)
|
if ((*_PROGRAM_COUNTER) == m_JumpToLocation)
|
||||||
{
|
{
|
||||||
if (!DelaySlotEffectsCompare(*_PROGRAM_COUNTER, m_Opcode.rs, m_Opcode.rt))
|
if (!DelaySlotEffectsCompare(*_PROGRAM_COUNTER, m_Opcode.rs, m_Opcode.rt))
|
||||||
|
@ -847,7 +846,7 @@ void R4300iOp32::BLEZL()
|
||||||
if (_GPR[m_Opcode.rs].W[0] <= 0)
|
if (_GPR[m_Opcode.rs].W[0] <= 0)
|
||||||
{
|
{
|
||||||
m_NextInstruction = DELAY_SLOT;
|
m_NextInstruction = DELAY_SLOT;
|
||||||
m_JumpToLocation = (*_PROGRAM_COUNTER) + ((short)m_Opcode.offset << 2) + 4;
|
m_JumpToLocation = (*_PROGRAM_COUNTER) + ((int16_t)m_Opcode.offset << 2) + 4;
|
||||||
if ((*_PROGRAM_COUNTER) == m_JumpToLocation)
|
if ((*_PROGRAM_COUNTER) == m_JumpToLocation)
|
||||||
{
|
{
|
||||||
if (!DelaySlotEffectsCompare(*_PROGRAM_COUNTER, m_Opcode.rs, 0))
|
if (!DelaySlotEffectsCompare(*_PROGRAM_COUNTER, m_Opcode.rs, 0))
|
||||||
|
@ -868,7 +867,7 @@ void R4300iOp32::BGTZL()
|
||||||
if (_GPR[m_Opcode.rs].W[0] > 0)
|
if (_GPR[m_Opcode.rs].W[0] > 0)
|
||||||
{
|
{
|
||||||
m_NextInstruction = DELAY_SLOT;
|
m_NextInstruction = DELAY_SLOT;
|
||||||
m_JumpToLocation = (*_PROGRAM_COUNTER) + ((short)m_Opcode.offset << 2) + 4;
|
m_JumpToLocation = (*_PROGRAM_COUNTER) + ((int16_t)m_Opcode.offset << 2) + 4;
|
||||||
if ((*_PROGRAM_COUNTER) == m_JumpToLocation)
|
if ((*_PROGRAM_COUNTER) == m_JumpToLocation)
|
||||||
{
|
{
|
||||||
if (!DelaySlotEffectsCompare(*_PROGRAM_COUNTER, m_Opcode.rs, 0))
|
if (!DelaySlotEffectsCompare(*_PROGRAM_COUNTER, m_Opcode.rs, 0))
|
||||||
|
@ -886,7 +885,7 @@ void R4300iOp32::BGTZL()
|
||||||
|
|
||||||
void R4300iOp32::LB()
|
void R4300iOp32::LB()
|
||||||
{
|
{
|
||||||
DWORD Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset;
|
uint32_t Address = _GPR[m_Opcode.base].UW[0] + (int16_t)m_Opcode.offset;
|
||||||
if (!g_MMU->LB_VAddr(Address, _GPR[m_Opcode.rt].UB[0]))
|
if (!g_MMU->LB_VAddr(Address, _GPR[m_Opcode.rt].UB[0]))
|
||||||
{
|
{
|
||||||
if (bShowTLBMisses())
|
if (bShowTLBMisses())
|
||||||
|
@ -903,7 +902,7 @@ void R4300iOp32::LB()
|
||||||
|
|
||||||
void R4300iOp32::LH()
|
void R4300iOp32::LH()
|
||||||
{
|
{
|
||||||
DWORD Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset;
|
uint32_t Address = _GPR[m_Opcode.base].UW[0] + (int16_t)m_Opcode.offset;
|
||||||
if ((Address & 1) != 0)
|
if ((Address & 1) != 0)
|
||||||
{
|
{
|
||||||
ADDRESS_ERROR_EXCEPTION(Address, true);
|
ADDRESS_ERROR_EXCEPTION(Address, true);
|
||||||
|
@ -924,9 +923,9 @@ void R4300iOp32::LH()
|
||||||
|
|
||||||
void R4300iOp32::LWL()
|
void R4300iOp32::LWL()
|
||||||
{
|
{
|
||||||
DWORD Offset, Address, Value;
|
uint32_t Offset, Address, Value;
|
||||||
|
|
||||||
Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset;
|
Address = _GPR[m_Opcode.base].UW[0] + (int16_t)m_Opcode.offset;
|
||||||
Offset = Address & 3;
|
Offset = Address & 3;
|
||||||
|
|
||||||
if (!g_MMU->LW_VAddr((Address & ~3), Value))
|
if (!g_MMU->LW_VAddr((Address & ~3), Value))
|
||||||
|
@ -939,19 +938,19 @@ void R4300iOp32::LWL()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_GPR[m_Opcode.rt].W[0] = (int)(_GPR[m_Opcode.rt].W[0] & LWL_MASK[Offset]);
|
_GPR[m_Opcode.rt].W[0] = (int32_t)(_GPR[m_Opcode.rt].W[0] & LWL_MASK[Offset]);
|
||||||
_GPR[m_Opcode.rt].W[0] += (int)(Value << LWL_SHIFT[Offset]);
|
_GPR[m_Opcode.rt].W[0] += (int32_t)(Value << LWL_SHIFT[Offset]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void R4300iOp32::LW()
|
void R4300iOp32::LW()
|
||||||
{
|
{
|
||||||
DWORD Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset;
|
uint32_t Address = _GPR[m_Opcode.base].UW[0] + (int16_t)m_Opcode.offset;
|
||||||
if ((Address & 3) != 0)
|
if ((Address & 3) != 0)
|
||||||
{
|
{
|
||||||
ADDRESS_ERROR_EXCEPTION(Address, true);
|
ADDRESS_ERROR_EXCEPTION(Address, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LogOptions.GenerateLog)
|
if (GenerateLog())
|
||||||
{
|
{
|
||||||
Log_LW((*_PROGRAM_COUNTER), Address);
|
Log_LW((*_PROGRAM_COUNTER), Address);
|
||||||
}
|
}
|
||||||
|
@ -972,7 +971,7 @@ void R4300iOp32::LW()
|
||||||
|
|
||||||
void R4300iOp32::LBU()
|
void R4300iOp32::LBU()
|
||||||
{
|
{
|
||||||
DWORD Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset;
|
uint32_t Address = _GPR[m_Opcode.base].UW[0] + (int16_t)m_Opcode.offset;
|
||||||
if (!g_MMU->LB_VAddr(Address, _GPR[m_Opcode.rt].UB[0]))
|
if (!g_MMU->LB_VAddr(Address, _GPR[m_Opcode.rt].UB[0]))
|
||||||
{
|
{
|
||||||
if (bShowTLBMisses())
|
if (bShowTLBMisses())
|
||||||
|
@ -989,7 +988,7 @@ void R4300iOp32::LBU()
|
||||||
|
|
||||||
void R4300iOp32::LHU()
|
void R4300iOp32::LHU()
|
||||||
{
|
{
|
||||||
DWORD Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset;
|
uint32_t Address = _GPR[m_Opcode.base].UW[0] + (int16_t)m_Opcode.offset;
|
||||||
if ((Address & 1) != 0)
|
if ((Address & 1) != 0)
|
||||||
{
|
{
|
||||||
ADDRESS_ERROR_EXCEPTION(Address, true);
|
ADDRESS_ERROR_EXCEPTION(Address, true);
|
||||||
|
@ -1010,9 +1009,9 @@ void R4300iOp32::LHU()
|
||||||
|
|
||||||
void R4300iOp32::LWR()
|
void R4300iOp32::LWR()
|
||||||
{
|
{
|
||||||
DWORD Offset, Address, Value;
|
uint32_t Offset, Address, Value;
|
||||||
|
|
||||||
Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset;
|
Address = _GPR[m_Opcode.base].UW[0] + (int16_t)m_Opcode.offset;
|
||||||
Offset = Address & 3;
|
Offset = Address & 3;
|
||||||
|
|
||||||
if (!g_MMU->LW_VAddr((Address & ~3), Value))
|
if (!g_MMU->LW_VAddr((Address & ~3), Value))
|
||||||
|
@ -1025,13 +1024,13 @@ void R4300iOp32::LWR()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_GPR[m_Opcode.rt].W[0] = (int)(_GPR[m_Opcode.rt].W[0] & LWR_MASK[Offset]);
|
_GPR[m_Opcode.rt].W[0] = (int32_t)(_GPR[m_Opcode.rt].W[0] & LWR_MASK[Offset]);
|
||||||
_GPR[m_Opcode.rt].W[0] += (int)(Value >> LWR_SHIFT[Offset]);
|
_GPR[m_Opcode.rt].W[0] += (int32_t)(Value >> LWR_SHIFT[Offset]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void R4300iOp32::LWU()
|
void R4300iOp32::LWU()
|
||||||
{
|
{
|
||||||
DWORD Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset;
|
uint32_t Address = _GPR[m_Opcode.base].UW[0] + (int16_t)m_Opcode.offset;
|
||||||
if ((Address & 3) != 0)
|
if ((Address & 3) != 0)
|
||||||
{
|
{
|
||||||
ADDRESS_ERROR_EXCEPTION(Address, true);
|
ADDRESS_ERROR_EXCEPTION(Address, true);
|
||||||
|
@ -1051,10 +1050,9 @@ void R4300iOp32::LWU()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void R4300iOp32::LL()
|
void R4300iOp32::LL()
|
||||||
{
|
{
|
||||||
DWORD Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset;
|
uint32_t Address = _GPR[m_Opcode.base].UW[0] + (int16_t)m_Opcode.offset;
|
||||||
if ((Address & 3) != 0)
|
if ((Address & 3) != 0)
|
||||||
{
|
{
|
||||||
ADDRESS_ERROR_EXCEPTION(Address, true);
|
ADDRESS_ERROR_EXCEPTION(Address, true);
|
||||||
|
@ -1083,7 +1081,7 @@ void R4300iOp32::SPECIAL_SLL()
|
||||||
|
|
||||||
void R4300iOp32::SPECIAL_SRL()
|
void R4300iOp32::SPECIAL_SRL()
|
||||||
{
|
{
|
||||||
_GPR[m_Opcode.rd].W[0] = (int)(_GPR[m_Opcode.rt].UW[0] >> m_Opcode.sa);
|
_GPR[m_Opcode.rd].W[0] = (int32_t)(_GPR[m_Opcode.rt].UW[0] >> m_Opcode.sa);
|
||||||
}
|
}
|
||||||
|
|
||||||
void R4300iOp32::SPECIAL_SRA()
|
void R4300iOp32::SPECIAL_SRA()
|
||||||
|
@ -1098,7 +1096,7 @@ void R4300iOp32::SPECIAL_SLLV()
|
||||||
|
|
||||||
void R4300iOp32::SPECIAL_SRLV()
|
void R4300iOp32::SPECIAL_SRLV()
|
||||||
{
|
{
|
||||||
_GPR[m_Opcode.rd].W[0] = (int)(_GPR[m_Opcode.rt].UW[0] >> (_GPR[m_Opcode.rs].UW[0] & 0x1F));
|
_GPR[m_Opcode.rd].W[0] = (int32_t)(_GPR[m_Opcode.rt].UW[0] >> (_GPR[m_Opcode.rs].UW[0] & 0x1F));
|
||||||
}
|
}
|
||||||
|
|
||||||
void R4300iOp32::SPECIAL_SRAV()
|
void R4300iOp32::SPECIAL_SRAV()
|
||||||
|
@ -1110,7 +1108,7 @@ void R4300iOp32::SPECIAL_JALR()
|
||||||
{
|
{
|
||||||
m_NextInstruction = DELAY_SLOT;
|
m_NextInstruction = DELAY_SLOT;
|
||||||
m_JumpToLocation = _GPR[m_Opcode.rs].UW[0];
|
m_JumpToLocation = _GPR[m_Opcode.rs].UW[0];
|
||||||
_GPR[m_Opcode.rd].W[0] = (long)((*_PROGRAM_COUNTER) + 8);
|
_GPR[m_Opcode.rd].W[0] = (int32_t)((*_PROGRAM_COUNTER) + 8);
|
||||||
m_TestTimer = true;
|
m_TestTimer = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1189,12 +1187,12 @@ void R4300iOp32::SPECIAL_TEQ()
|
||||||
|
|
||||||
void R4300iOp32::SPECIAL_DSRL32()
|
void R4300iOp32::SPECIAL_DSRL32()
|
||||||
{
|
{
|
||||||
_GPR[m_Opcode.rd].UW[0] = (DWORD)(_GPR[m_Opcode.rt].UDW >> (m_Opcode.sa + 32));
|
_GPR[m_Opcode.rd].UW[0] = (uint32_t)(_GPR[m_Opcode.rt].UDW >> (m_Opcode.sa + 32));
|
||||||
}
|
}
|
||||||
|
|
||||||
void R4300iOp32::SPECIAL_DSRA32()
|
void R4300iOp32::SPECIAL_DSRA32()
|
||||||
{
|
{
|
||||||
_GPR[m_Opcode.rd].W[0] = (long)(_GPR[m_Opcode.rt].DW >> (m_Opcode.sa + 32));
|
_GPR[m_Opcode.rd].W[0] = (int32_t)(_GPR[m_Opcode.rt].DW >> (m_Opcode.sa + 32));
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************** R4300i OpCodes: RegImm **********************/
|
/********************** R4300i OpCodes: RegImm **********************/
|
||||||
|
@ -1203,7 +1201,7 @@ void R4300iOp32::REGIMM_BLTZ()
|
||||||
m_NextInstruction = DELAY_SLOT;
|
m_NextInstruction = DELAY_SLOT;
|
||||||
if (_GPR[m_Opcode.rs].W[0] < 0)
|
if (_GPR[m_Opcode.rs].W[0] < 0)
|
||||||
{
|
{
|
||||||
m_JumpToLocation = (*_PROGRAM_COUNTER) + ((short)m_Opcode.offset << 2) + 4;
|
m_JumpToLocation = (*_PROGRAM_COUNTER) + ((int16_t)m_Opcode.offset << 2) + 4;
|
||||||
if ((*_PROGRAM_COUNTER) == m_JumpToLocation)
|
if ((*_PROGRAM_COUNTER) == m_JumpToLocation)
|
||||||
{
|
{
|
||||||
if (!DelaySlotEffectsCompare((*_PROGRAM_COUNTER), m_Opcode.rs, 0))
|
if (!DelaySlotEffectsCompare((*_PROGRAM_COUNTER), m_Opcode.rs, 0))
|
||||||
|
@ -1223,7 +1221,7 @@ void R4300iOp32::REGIMM_BGEZ()
|
||||||
m_NextInstruction = DELAY_SLOT;
|
m_NextInstruction = DELAY_SLOT;
|
||||||
if (_GPR[m_Opcode.rs].W[0] >= 0)
|
if (_GPR[m_Opcode.rs].W[0] >= 0)
|
||||||
{
|
{
|
||||||
m_JumpToLocation = (*_PROGRAM_COUNTER) + ((short)m_Opcode.offset << 2) + 4;
|
m_JumpToLocation = (*_PROGRAM_COUNTER) + ((int16_t)m_Opcode.offset << 2) + 4;
|
||||||
if ((*_PROGRAM_COUNTER) == m_JumpToLocation)
|
if ((*_PROGRAM_COUNTER) == m_JumpToLocation)
|
||||||
{
|
{
|
||||||
if (!DelaySlotEffectsCompare((*_PROGRAM_COUNTER), m_Opcode.rs, 0))
|
if (!DelaySlotEffectsCompare((*_PROGRAM_COUNTER), m_Opcode.rs, 0))
|
||||||
|
@ -1243,7 +1241,7 @@ void R4300iOp32::REGIMM_BLTZL()
|
||||||
if (_GPR[m_Opcode.rs].W[0] < 0)
|
if (_GPR[m_Opcode.rs].W[0] < 0)
|
||||||
{
|
{
|
||||||
m_NextInstruction = DELAY_SLOT;
|
m_NextInstruction = DELAY_SLOT;
|
||||||
m_JumpToLocation = (*_PROGRAM_COUNTER) + ((short)m_Opcode.offset << 2) + 4;
|
m_JumpToLocation = (*_PROGRAM_COUNTER) + ((int16_t)m_Opcode.offset << 2) + 4;
|
||||||
if ((*_PROGRAM_COUNTER) == m_JumpToLocation)
|
if ((*_PROGRAM_COUNTER) == m_JumpToLocation)
|
||||||
{
|
{
|
||||||
if (!DelaySlotEffectsCompare((*_PROGRAM_COUNTER), m_Opcode.rs, 0))
|
if (!DelaySlotEffectsCompare((*_PROGRAM_COUNTER), m_Opcode.rs, 0))
|
||||||
|
@ -1264,7 +1262,7 @@ void R4300iOp32::REGIMM_BGEZL()
|
||||||
if (_GPR[m_Opcode.rs].W[0] >= 0)
|
if (_GPR[m_Opcode.rs].W[0] >= 0)
|
||||||
{
|
{
|
||||||
m_NextInstruction = DELAY_SLOT;
|
m_NextInstruction = DELAY_SLOT;
|
||||||
m_JumpToLocation = (*_PROGRAM_COUNTER) + ((short)m_Opcode.offset << 2) + 4;
|
m_JumpToLocation = (*_PROGRAM_COUNTER) + ((int16_t)m_Opcode.offset << 2) + 4;
|
||||||
if ((*_PROGRAM_COUNTER) == m_JumpToLocation)
|
if ((*_PROGRAM_COUNTER) == m_JumpToLocation)
|
||||||
{
|
{
|
||||||
if (!DelaySlotEffectsCompare((*_PROGRAM_COUNTER), m_Opcode.rs, 0))
|
if (!DelaySlotEffectsCompare((*_PROGRAM_COUNTER), m_Opcode.rs, 0))
|
||||||
|
@ -1285,7 +1283,7 @@ void R4300iOp32::REGIMM_BLTZAL()
|
||||||
m_NextInstruction = DELAY_SLOT;
|
m_NextInstruction = DELAY_SLOT;
|
||||||
if (_GPR[m_Opcode.rs].W[0] < 0)
|
if (_GPR[m_Opcode.rs].W[0] < 0)
|
||||||
{
|
{
|
||||||
m_JumpToLocation = (*_PROGRAM_COUNTER) + ((short)m_Opcode.offset << 2) + 4;
|
m_JumpToLocation = (*_PROGRAM_COUNTER) + ((int16_t)m_Opcode.offset << 2) + 4;
|
||||||
if ((*_PROGRAM_COUNTER) == m_JumpToLocation)
|
if ((*_PROGRAM_COUNTER) == m_JumpToLocation)
|
||||||
{
|
{
|
||||||
if (!DelaySlotEffectsCompare((*_PROGRAM_COUNTER), m_Opcode.rs, 0))
|
if (!DelaySlotEffectsCompare((*_PROGRAM_COUNTER), m_Opcode.rs, 0))
|
||||||
|
@ -1298,7 +1296,7 @@ void R4300iOp32::REGIMM_BLTZAL()
|
||||||
{
|
{
|
||||||
m_JumpToLocation = (*_PROGRAM_COUNTER) + 8;
|
m_JumpToLocation = (*_PROGRAM_COUNTER) + 8;
|
||||||
}
|
}
|
||||||
_GPR[31].W[0]= (long)((*_PROGRAM_COUNTER) + 8);
|
_GPR[31].W[0] = (int32_t)((*_PROGRAM_COUNTER) + 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
void R4300iOp32::REGIMM_BGEZAL()
|
void R4300iOp32::REGIMM_BGEZAL()
|
||||||
|
@ -1306,7 +1304,7 @@ void R4300iOp32::REGIMM_BGEZAL()
|
||||||
m_NextInstruction = DELAY_SLOT;
|
m_NextInstruction = DELAY_SLOT;
|
||||||
if (_GPR[m_Opcode.rs].W[0] >= 0)
|
if (_GPR[m_Opcode.rs].W[0] >= 0)
|
||||||
{
|
{
|
||||||
m_JumpToLocation = (*_PROGRAM_COUNTER) + ((short)m_Opcode.offset << 2) + 4;
|
m_JumpToLocation = (*_PROGRAM_COUNTER) + ((int16_t)m_Opcode.offset << 2) + 4;
|
||||||
if ((*_PROGRAM_COUNTER) == m_JumpToLocation)
|
if ((*_PROGRAM_COUNTER) == m_JumpToLocation)
|
||||||
{
|
{
|
||||||
if (!DelaySlotEffectsCompare((*_PROGRAM_COUNTER), m_Opcode.rs, 0))
|
if (!DelaySlotEffectsCompare((*_PROGRAM_COUNTER), m_Opcode.rs, 0))
|
||||||
|
@ -1319,11 +1317,13 @@ void R4300iOp32::REGIMM_BGEZAL()
|
||||||
{
|
{
|
||||||
m_JumpToLocation = (*_PROGRAM_COUNTER) + 8;
|
m_JumpToLocation = (*_PROGRAM_COUNTER) + 8;
|
||||||
}
|
}
|
||||||
_GPR[31].W[0] = (long)((*_PROGRAM_COUNTER) + 8);
|
_GPR[31].W[0] = (int32_t)((*_PROGRAM_COUNTER) + 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************** COP0 functions **************************/
|
/************************** COP0 functions **************************/
|
||||||
void R4300iOp32::COP0_MF() {
|
void R4300iOp32::COP0_MF()
|
||||||
if (LogOptions.LogCP0reads)
|
{
|
||||||
|
if (LogCP0reads())
|
||||||
{
|
{
|
||||||
LogMessage("%08X: R4300i Read from %s (0x%08X)", (*_PROGRAM_COUNTER), CRegName::Cop0[m_Opcode.rd], _CP0[m_Opcode.rd]);
|
LogMessage("%08X: R4300i Read from %s (0x%08X)", (*_PROGRAM_COUNTER), CRegName::Cop0[m_Opcode.rd], _CP0[m_Opcode.rd]);
|
||||||
}
|
}
|
||||||
|
@ -1332,12 +1332,12 @@ void R4300iOp32::COP0_MF() {
|
||||||
{
|
{
|
||||||
g_SystemTimer->UpdateTimers();
|
g_SystemTimer->UpdateTimers();
|
||||||
}
|
}
|
||||||
_GPR[m_Opcode.rt].W[0] = (int)_CP0[m_Opcode.rd];
|
_GPR[m_Opcode.rt].W[0] = (int32_t)_CP0[m_Opcode.rd];
|
||||||
}
|
}
|
||||||
|
|
||||||
void R4300iOp32::COP0_MT()
|
void R4300iOp32::COP0_MT()
|
||||||
{
|
{
|
||||||
if (LogOptions.LogCP0changes)
|
if (LogCP0changes())
|
||||||
{
|
{
|
||||||
LogMessage("%08X: Writing 0x%X to %s register (Originally: 0x%08X)", (*_PROGRAM_COUNTER), _GPR[m_Opcode.rt].UW[0], CRegName::Cop0[m_Opcode.rd], _CP0[m_Opcode.rd]);
|
LogMessage("%08X: Writing 0x%X to %s register (Originally: 0x%08X)", (*_PROGRAM_COUNTER), _GPR[m_Opcode.rt].UW[0], CRegName::Cop0[m_Opcode.rd], _CP0[m_Opcode.rd]);
|
||||||
if (m_Opcode.rd == 11) //Compare
|
if (m_Opcode.rd == 11) //Compare
|
||||||
|
@ -1412,7 +1412,7 @@ void R4300iOp32::COP0_MT()
|
||||||
void R4300iOp32::COP1_MF()
|
void R4300iOp32::COP1_MF()
|
||||||
{
|
{
|
||||||
TEST_COP1_USABLE_EXCEPTION
|
TEST_COP1_USABLE_EXCEPTION
|
||||||
_GPR[m_Opcode.rt].W[0] = *(int *)_FPR_S[m_Opcode.fs];
|
_GPR[m_Opcode.rt].W[0] = *(int32_t *)_FPR_S[m_Opcode.fs];
|
||||||
}
|
}
|
||||||
|
|
||||||
void R4300iOp32::COP1_CF()
|
void R4300iOp32::COP1_CF()
|
||||||
|
@ -1423,11 +1423,11 @@ void R4300iOp32::COP1_CF()
|
||||||
if (g_Settings->LoadBool(Debugger_Enabled)) { g_Notify->DisplayError(L"CFC1 what register are you writing to ?"); }
|
if (g_Settings->LoadBool(Debugger_Enabled)) { g_Notify->DisplayError(L"CFC1 what register are you writing to ?"); }
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_GPR[m_Opcode.rt].W[0] = (int)_FPCR[m_Opcode.fs];
|
_GPR[m_Opcode.rt].W[0] = (int32_t)_FPCR[m_Opcode.fs];
|
||||||
}
|
}
|
||||||
|
|
||||||
void R4300iOp32::COP1_DMT()
|
void R4300iOp32::COP1_DMT()
|
||||||
{
|
{
|
||||||
TEST_COP1_USABLE_EXCEPTION
|
TEST_COP1_USABLE_EXCEPTION
|
||||||
*(__int64 *)_FPR_D[m_Opcode.fs] = _GPR[m_Opcode.rt].W[0];
|
*(int64_t *)_FPR_D[m_Opcode.fs] = _GPR[m_Opcode.rt].W[0];
|
||||||
}
|
}
|
|
@ -10,6 +10,8 @@
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "Interpreter Ops.h"
|
||||||
|
|
||||||
class R4300iOp32 :
|
class R4300iOp32 :
|
||||||
public R4300iOp
|
public R4300iOp
|
||||||
{
|
{
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -10,7 +10,12 @@
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <Project64\Settings\Debug Settings.h>
|
||||||
|
#include <Project64\N64 System\Mips\Register Class.h>
|
||||||
|
#include <Project64\N64 System\Mips\OpCode.h>
|
||||||
|
|
||||||
class R4300iOp :
|
class R4300iOp :
|
||||||
|
public CLogging,
|
||||||
protected CDebugSettings,
|
protected CDebugSettings,
|
||||||
protected CSystemRegisters
|
protected CSystemRegisters
|
||||||
{
|
{
|
||||||
|
@ -64,7 +69,6 @@ public:
|
||||||
static void SDC1();
|
static void SDC1();
|
||||||
static void SD();
|
static void SD();
|
||||||
|
|
||||||
|
|
||||||
/********************** R4300i OpCodes: Special **********************/
|
/********************** R4300i OpCodes: Special **********************/
|
||||||
static void SPECIAL_SLL();
|
static void SPECIAL_SLL();
|
||||||
static void SPECIAL_SRL();
|
static void SPECIAL_SRL();
|
||||||
|
@ -200,13 +204,12 @@ public:
|
||||||
/************************** Other functions **************************/
|
/************************** Other functions **************************/
|
||||||
static void UnknownOpcode();
|
static void UnknownOpcode();
|
||||||
|
|
||||||
|
|
||||||
static Func* BuildInterpreter();
|
static Func* BuildInterpreter();
|
||||||
|
|
||||||
static bool m_TestTimer;
|
static bool m_TestTimer;
|
||||||
static DWORD m_NextInstruction;
|
static uint32_t m_NextInstruction;
|
||||||
static OPCODE m_Opcode;
|
static OPCODE m_Opcode;
|
||||||
static DWORD m_JumpToLocation;
|
static uint32_t m_JumpToLocation;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static void SPECIAL();
|
static void SPECIAL();
|
||||||
|
@ -232,7 +235,6 @@ protected:
|
||||||
static Func Jump_CoP1_W[64];
|
static Func Jump_CoP1_W[64];
|
||||||
static Func Jump_CoP1_L[64];
|
static Func Jump_CoP1_L[64];
|
||||||
|
|
||||||
static const DWORD SWL_MASK[4], SWR_MASK[4], LWL_MASK[4], LWR_MASK[4];
|
static const uint32_t SWL_MASK[4], SWR_MASK[4], LWL_MASK[4], LWR_MASK[4];
|
||||||
static const int SWL_SHIFT[4], SWR_SHIFT[4], LWL_SHIFT[4], LWR_SHIFT[4];
|
static const int32_t SWL_SHIFT[4], SWR_SHIFT[4], LWL_SHIFT[4], LWR_SHIFT[4];
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -9,6 +9,9 @@
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
|
#include "Audio.h"
|
||||||
|
#include <Project64\N64 System\System Globals.h>
|
||||||
|
#include <Project64\N64 System\N64 Class.h>
|
||||||
|
|
||||||
CAudio::CAudio()
|
CAudio::CAudio()
|
||||||
{
|
{
|
||||||
|
@ -17,7 +20,6 @@ CAudio::CAudio()
|
||||||
|
|
||||||
CAudio::~CAudio()
|
CAudio::~CAudio()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAudio::Reset()
|
void CAudio::Reset()
|
||||||
|
@ -30,10 +32,10 @@ void CAudio::Reset()
|
||||||
m_FramesPerSecond = 60;
|
m_FramesPerSecond = 60;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD CAudio::GetLength()
|
uint32_t CAudio::GetLength()
|
||||||
{
|
{
|
||||||
WriteTraceF(TraceAudio, __FUNCTION__ ": Start (m_SecondBuff = %d)", m_SecondBuff);
|
WriteTraceF(TraceAudio, __FUNCTION__ ": Start (m_SecondBuff = %d)", m_SecondBuff);
|
||||||
DWORD TimeLeft = g_SystemTimer->GetTimer(CSystemTimer::AiTimerInterrupt), Res = 0;
|
uint32_t TimeLeft = g_SystemTimer->GetTimer(CSystemTimer::AiTimerInterrupt), Res = 0;
|
||||||
if (TimeLeft > 0)
|
if (TimeLeft > 0)
|
||||||
{
|
{
|
||||||
Res = (TimeLeft / m_CountsPerByte);
|
Res = (TimeLeft / m_CountsPerByte);
|
||||||
|
@ -42,7 +44,7 @@ DWORD CAudio::GetLength()
|
||||||
return (Res + 3)&~3;
|
return (Res + 3)&~3;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD CAudio::GetStatus()
|
uint32_t CAudio::GetStatus()
|
||||||
{
|
{
|
||||||
WriteTraceF(TraceAudio, __FUNCTION__ ": m_Status = %X", m_Status);
|
WriteTraceF(TraceAudio, __FUNCTION__ ": m_Status = %X", m_Status);
|
||||||
return m_Status;
|
return m_Status;
|
||||||
|
@ -56,9 +58,11 @@ void CAudio::LenChanged()
|
||||||
if (g_Reg->AI_LEN_REG >= 0x40000)
|
if (g_Reg->AI_LEN_REG >= 0x40000)
|
||||||
{
|
{
|
||||||
WriteTraceF(TraceAudio, __FUNCTION__ ": *** Ignoring Write, To Large (%X)", g_Reg->AI_LEN_REG);
|
WriteTraceF(TraceAudio, __FUNCTION__ ": *** Ignoring Write, To Large (%X)", g_Reg->AI_LEN_REG);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
m_Status |= ai_busy;
|
m_Status |= ai_busy;
|
||||||
DWORD AudioLeft = g_SystemTimer->GetTimer(CSystemTimer::AiTimerInterrupt);
|
uint32_t AudioLeft = g_SystemTimer->GetTimer(CSystemTimer::AiTimerInterrupt);
|
||||||
if (m_SecondBuff == 0)
|
if (m_SecondBuff == 0)
|
||||||
{
|
{
|
||||||
if (AudioLeft == 0)
|
if (AudioLeft == 0)
|
||||||
|
@ -124,20 +128,19 @@ void CAudio::BusyTimerDone()
|
||||||
m_Status &= ~ai_busy;
|
m_Status &= ~ai_busy;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAudio::SetViIntr ( DWORD VI_INTR_TIME )
|
void CAudio::SetViIntr(uint32_t VI_INTR_TIME)
|
||||||
{
|
{
|
||||||
double CountsPerSecond = (DWORD)((double)VI_INTR_TIME * m_FramesPerSecond);
|
double CountsPerSecond = (uint32_t)((double)VI_INTR_TIME * m_FramesPerSecond);
|
||||||
if (m_BytesPerSecond != 0 && (g_System->AiCountPerBytes() == 0))
|
if (m_BytesPerSecond != 0 && (g_System->AiCountPerBytes() == 0))
|
||||||
{
|
{
|
||||||
m_CountsPerByte = (int)((double)CountsPerSecond / (double)m_BytesPerSecond);
|
m_CountsPerByte = (int32_t)((double)CountsPerSecond / (double)m_BytesPerSecond);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CAudio::SetFrequency(uint32_t Dacrate, uint32_t System)
|
||||||
void CAudio::SetFrequency (DWORD Dacrate, DWORD System)
|
|
||||||
{
|
{
|
||||||
WriteTraceF(TraceAudio, __FUNCTION__ "(Dacrate: %X System: %d): AI_BITRATE_REG = %X", Dacrate, System, g_Reg->AI_BITRATE_REG);
|
WriteTraceF(TraceAudio, __FUNCTION__ "(Dacrate: %X System: %d): AI_BITRATE_REG = %X", Dacrate, System, g_Reg->AI_BITRATE_REG);
|
||||||
DWORD Frequency;
|
uint32_t Frequency;
|
||||||
|
|
||||||
switch (System)
|
switch (System)
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,19 +21,22 @@ public:
|
||||||
CAudio();
|
CAudio();
|
||||||
~CAudio();
|
~CAudio();
|
||||||
|
|
||||||
DWORD GetLength ();
|
uint32_t GetLength ();
|
||||||
DWORD GetStatus ();
|
uint32_t GetStatus ();
|
||||||
void LenChanged ();
|
void LenChanged ();
|
||||||
void InterruptTimerDone();
|
void InterruptTimerDone();
|
||||||
void BusyTimerDone ();
|
void BusyTimerDone ();
|
||||||
void Reset ();
|
void Reset ();
|
||||||
void SetViIntr ( DWORD VI_INTR_TIME );
|
void SetViIntr ( uint32_t VI_INTR_TIME );
|
||||||
void SetFrequency ( DWORD Dacrate, DWORD System );
|
void SetFrequency ( uint32_t Dacrate, uint32_t System );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DWORD m_SecondBuff;
|
CAudio(const CAudio&); // Disable copy constructor
|
||||||
DWORD m_Status;
|
CAudio& operator=(const CAudio&); // Disable assignment
|
||||||
DWORD m_BytesPerSecond;
|
|
||||||
int m_CountsPerByte;
|
uint32_t m_SecondBuff;
|
||||||
int m_FramesPerSecond;
|
uint32_t m_Status;
|
||||||
|
uint32_t m_BytesPerSecond;
|
||||||
|
int32_t m_CountsPerByte;
|
||||||
|
int32_t m_FramesPerSecond;
|
||||||
};
|
};
|
||||||
|
|
|
@ -14,28 +14,36 @@ CDMA::CDMA(CFlashram & FlashRam, CSram & Sram) :
|
||||||
m_FlashRam(FlashRam),
|
m_FlashRam(FlashRam),
|
||||||
m_Sram(Sram)
|
m_Sram(Sram)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDMA::OnFirstDMA()
|
void CDMA::OnFirstDMA()
|
||||||
{
|
{
|
||||||
|
int16_t offset;
|
||||||
|
const uint32_t base = 0x00000000;
|
||||||
|
const uint32_t rt = g_MMU->RdramSize();
|
||||||
|
|
||||||
switch (g_Rom->CicChipID())
|
switch (g_Rom->CicChipID())
|
||||||
{
|
{
|
||||||
case CIC_NUS_6101: *(DWORD *)&((g_MMU->Rdram())[0x318]) = g_MMU->RdramSize(); break;
|
case CIC_NUS_6101: offset = +0x0318; break;
|
||||||
case CIC_NUS_5167: *(DWORD *)&((g_MMU->Rdram())[0x318]) = g_MMU->RdramSize(); break;
|
case CIC_NUS_5167: offset = +0x0318; break;
|
||||||
case CIC_UNKNOWN:
|
case CIC_UNKNOWN:
|
||||||
case CIC_NUS_6102: *(DWORD *)&((g_MMU->Rdram())[0x318]) = g_MMU->RdramSize(); break;
|
case CIC_NUS_6102: offset = +0x0318; break;
|
||||||
case CIC_NUS_6103: *(DWORD *)&((g_MMU->Rdram())[0x318]) = g_MMU->RdramSize(); break;
|
case CIC_NUS_6103: offset = +0x0318; break;
|
||||||
case CIC_NUS_6105: *(DWORD *)&((g_MMU->Rdram())[0x3F0]) = g_MMU->RdramSize(); break;
|
case CIC_NUS_6105: offset = +0x03F0; break;
|
||||||
case CIC_NUS_6106: *(DWORD *)&((g_MMU->Rdram())[0x318]) = g_MMU->RdramSize(); break;
|
case CIC_NUS_6106: offset = +0x0318; break;
|
||||||
default: g_Notify->DisplayError(stdstr_f("Unhandled CicChip(%d) in first DMA",g_Rom->CicChipID()).ToUTF16().c_str());
|
default:
|
||||||
|
g_Notify->DisplayError(
|
||||||
|
stdstr_f("Unhandled CicChip(%d) in first DMA", g_Rom->CicChipID()).ToUTF16().c_str()
|
||||||
|
);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
g_MMU->SW_PAddr(base + offset, rt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDMA::PI_DMA_READ()
|
void CDMA::PI_DMA_READ()
|
||||||
{
|
{
|
||||||
// PI_STATUS_REG |= PI_STATUS_DMA_BUSY;
|
// PI_STATUS_REG |= PI_STATUS_DMA_BUSY;
|
||||||
DWORD PI_RD_LEN_REG = ((g_Reg->PI_RD_LEN_REG) & 0x00FFFFFFul) + 1;
|
uint32_t PI_RD_LEN_REG = ((g_Reg->PI_RD_LEN_REG) & 0x00FFFFFFul) + 1;
|
||||||
|
|
||||||
if ((PI_RD_LEN_REG & 1) != 0)
|
if ((PI_RD_LEN_REG & 1) != 0)
|
||||||
{
|
{
|
||||||
|
@ -57,9 +65,9 @@ void CDMA::PI_DMA_READ()
|
||||||
//Write ROM Area (for 64DD Convert)
|
//Write ROM Area (for 64DD Convert)
|
||||||
if (g_Reg->PI_CART_ADDR_REG >= 0x10000000 && g_Reg->PI_CART_ADDR_REG <= 0x1FBFFFFF && g_Settings->LoadBool(Game_AllowROMWrites))
|
if (g_Reg->PI_CART_ADDR_REG >= 0x10000000 && g_Reg->PI_CART_ADDR_REG <= 0x1FBFFFFF && g_Settings->LoadBool(Game_AllowROMWrites))
|
||||||
{
|
{
|
||||||
DWORD i;
|
uint32_t i;
|
||||||
BYTE * ROM = g_Rom->GetRomAddress();
|
uint8_t * ROM = g_Rom->GetRomAddress();
|
||||||
BYTE * RDRAM = g_MMU->Rdram();
|
uint8_t * RDRAM = g_MMU->Rdram();
|
||||||
|
|
||||||
DWORD OldProtect;
|
DWORD OldProtect;
|
||||||
VirtualProtect(ROM, g_Rom->GetRomSize(), PAGE_READWRITE, &OldProtect);
|
VirtualProtect(ROM, g_Rom->GetRomSize(), PAGE_READWRITE, &OldProtect);
|
||||||
|
@ -74,7 +82,7 @@ void CDMA::PI_DMA_READ()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DWORD Len;
|
uint32_t Len;
|
||||||
Len = g_Rom->GetRomSize() - g_Reg->PI_CART_ADDR_REG;
|
Len = g_Rom->GetRomSize() - g_Reg->PI_CART_ADDR_REG;
|
||||||
for (i = 0; i < Len; i++)
|
for (i = 0; i < Len; i++)
|
||||||
{
|
{
|
||||||
|
@ -142,7 +150,7 @@ void CDMA::PI_DMA_READ()
|
||||||
}
|
}
|
||||||
if (bHaveDebugger())
|
if (bHaveDebugger())
|
||||||
{
|
{
|
||||||
g_Notify->DisplayError(stdstr_f("PI_DMA_READ where are you dmaing to ? : %08X", g_Reg->PI_CART_ADDR_REG).ToUTF16().c_str());
|
g_Notify->DisplayError(stdstr_f("PI_DMA_READ where are you dmaing to ? : %08X", g_Reg->PI_CART_ADDR_REG).ToUTF16().c_str());
|
||||||
}
|
}
|
||||||
g_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
g_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
||||||
g_Reg->MI_INTR_REG |= MI_INTR_PI;
|
g_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||||
|
@ -152,7 +160,7 @@ void CDMA::PI_DMA_READ()
|
||||||
|
|
||||||
void CDMA::PI_DMA_WRITE()
|
void CDMA::PI_DMA_WRITE()
|
||||||
{
|
{
|
||||||
DWORD PI_WR_LEN_REG = ((g_Reg->PI_WR_LEN_REG) & 0x00FFFFFFul) + 1;
|
uint32_t PI_WR_LEN_REG = ((g_Reg->PI_WR_LEN_REG) & 0x00FFFFFFul) + 1;
|
||||||
|
|
||||||
if ((PI_WR_LEN_REG & 1) != 0)
|
if ((PI_WR_LEN_REG & 1) != 0)
|
||||||
{
|
{
|
||||||
|
@ -169,7 +177,7 @@ void CDMA::PI_DMA_WRITE()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( g_Reg->PI_CART_ADDR_REG >= 0x08000000 && g_Reg->PI_CART_ADDR_REG <= 0x08010000)
|
if (g_Reg->PI_CART_ADDR_REG >= 0x08000000 && g_Reg->PI_CART_ADDR_REG <= 0x08088000)
|
||||||
{
|
{
|
||||||
if (g_System->m_SaveUsing == SaveChip_Auto)
|
if (g_System->m_SaveUsing == SaveChip_Auto)
|
||||||
{
|
{
|
||||||
|
@ -203,20 +211,20 @@ void CDMA::PI_DMA_WRITE()
|
||||||
|
|
||||||
if (g_Reg->PI_CART_ADDR_REG >= 0x10000000 && g_Reg->PI_CART_ADDR_REG <= 0x1FFFFFFF)
|
if (g_Reg->PI_CART_ADDR_REG >= 0x10000000 && g_Reg->PI_CART_ADDR_REG <= 0x1FFFFFFF)
|
||||||
{
|
{
|
||||||
DWORD i;
|
uint32_t i;
|
||||||
|
|
||||||
#ifdef tofix
|
#ifdef tofix
|
||||||
#ifdef ROM_IN_MAPSPACE
|
#ifdef ROM_IN_MAPSPACE
|
||||||
if (WrittenToRom)
|
if (WrittenToRom)
|
||||||
{
|
{
|
||||||
DWORD OldProtect;
|
uint32_t OldProtect;
|
||||||
VirtualProtect(ROM,m_RomFileSize,PAGE_READONLY, &OldProtect);
|
VirtualProtect(ROM,m_RomFileSize,PAGE_READONLY, &OldProtect);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
BYTE * ROM = g_Rom->GetRomAddress();
|
uint8_t * ROM = g_Rom->GetRomAddress();
|
||||||
BYTE * RDRAM = g_MMU->Rdram();
|
uint8_t * RDRAM = g_MMU->Rdram();
|
||||||
g_Reg->PI_CART_ADDR_REG -= 0x10000000;
|
g_Reg->PI_CART_ADDR_REG -= 0x10000000;
|
||||||
if (g_Reg->PI_CART_ADDR_REG + PI_WR_LEN_REG < g_Rom->GetRomSize())
|
if (g_Reg->PI_CART_ADDR_REG + PI_WR_LEN_REG < g_Rom->GetRomSize())
|
||||||
{
|
{
|
||||||
|
@ -227,7 +235,7 @@ void CDMA::PI_DMA_WRITE()
|
||||||
}
|
}
|
||||||
else if (g_Reg->PI_CART_ADDR_REG >= g_Rom->GetRomSize())
|
else if (g_Reg->PI_CART_ADDR_REG >= g_Rom->GetRomSize())
|
||||||
{
|
{
|
||||||
DWORD cart = g_Reg->PI_CART_ADDR_REG - g_Rom->GetRomSize();
|
uint32_t cart = g_Reg->PI_CART_ADDR_REG - g_Rom->GetRomSize();
|
||||||
while (cart >= g_Rom->GetRomSize())
|
while (cart >= g_Rom->GetRomSize())
|
||||||
{
|
{
|
||||||
cart -= g_Rom->GetRomSize();
|
cart -= g_Rom->GetRomSize();
|
||||||
|
@ -239,7 +247,7 @@ void CDMA::PI_DMA_WRITE()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DWORD Len;
|
uint32_t Len;
|
||||||
Len = g_Rom->GetRomSize() - g_Reg->PI_CART_ADDR_REG;
|
Len = g_Rom->GetRomSize() - g_Reg->PI_CART_ADDR_REG;
|
||||||
for (i = 0; i < Len; i++)
|
for (i = 0; i < Len; i++)
|
||||||
{
|
{
|
||||||
|
@ -264,8 +272,8 @@ void CDMA::PI_DMA_WRITE()
|
||||||
g_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
g_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
||||||
g_Reg->MI_INTR_REG |= MI_INTR_PI;
|
g_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||||
g_Reg->CheckInterrupts();
|
g_Reg->CheckInterrupts();
|
||||||
//ChangeTimer(PiTimer,(int)(PI_WR_LEN_REG * 8.9) + 50);
|
//ChangeTimer(PiTimer,(int32_t)(PI_WR_LEN_REG * 8.9) + 50);
|
||||||
//ChangeTimer(PiTimer,(int)(PI_WR_LEN_REG * 8.9));
|
//ChangeTimer(PiTimer,(int32_t)(PI_WR_LEN_REG * 8.9));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -276,7 +284,6 @@ void CDMA::PI_DMA_WRITE()
|
||||||
g_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
g_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
||||||
g_Reg->MI_INTR_REG |= MI_INTR_PI;
|
g_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||||
g_Reg->CheckInterrupts();
|
g_Reg->CheckInterrupts();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDMA::SP_DMA_READ()
|
void CDMA::SP_DMA_READ()
|
||||||
|
|
|
@ -9,6 +9,9 @@
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
#include <Project64\Settings\Debug Settings.h>
|
||||||
|
#include <Project64\N64 System\Mips\FlashRam.h>
|
||||||
|
#include <Project64\N64 System\Mips\Sram.h>
|
||||||
|
|
||||||
class CDMA :
|
class CDMA :
|
||||||
private CDebugSettings
|
private CDebugSettings
|
||||||
|
@ -24,10 +27,10 @@ public:
|
||||||
protected:
|
protected:
|
||||||
CDMA(CFlashram & FlashRam, CSram & Sram);
|
CDMA(CFlashram & FlashRam, CSram & Sram);
|
||||||
|
|
||||||
//void SI_DMA_READ();
|
|
||||||
//void SI_DMA_WRITE();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
CDMA(const CDMA&); // Disable copy constructor
|
||||||
|
CDMA& operator=(const CDMA&); // Disable assignment
|
||||||
|
|
||||||
CFlashram & m_FlashRam;
|
CFlashram & m_FlashRam;
|
||||||
CSram & m_Sram;
|
CSram & m_Sram;
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,9 @@
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
|
#include "Eeprom.h"
|
||||||
|
#include <Project64\N64 System\System Globals.h>
|
||||||
|
#include <Project64\N64 System\N64 Class.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
CEeprom::CEeprom(bool ReadOnly) :
|
CEeprom::CEeprom(bool ReadOnly) :
|
||||||
|
@ -27,13 +30,13 @@ CEeprom::~CEeprom()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char byte2bcd(int n)
|
uint8_t byte2bcd(int32_t n)
|
||||||
{
|
{
|
||||||
n %= 100;
|
n %= 100;
|
||||||
return (unsigned char)(((n / 10) << 4) | (n % 10));
|
return (uint8_t)(((n / 10) << 4) | (n % 10));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CEeprom::EepromCommand ( BYTE * Command)
|
void CEeprom::EepromCommand(uint8_t * Command)
|
||||||
{
|
{
|
||||||
time_t curtime_time;
|
time_t curtime_time;
|
||||||
struct tm curtime;
|
struct tm curtime;
|
||||||
|
@ -164,9 +167,9 @@ void CEeprom::LoadEeprom()
|
||||||
ReadFile(m_hFile, m_EEPROM, sizeof(m_EEPROM), &dwRead, NULL);
|
ReadFile(m_hFile, m_EEPROM, sizeof(m_EEPROM), &dwRead, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CEeprom::ReadFrom(BYTE * Buffer, int line)
|
void CEeprom::ReadFrom(uint8_t * Buffer, int32_t line)
|
||||||
{
|
{
|
||||||
int i;
|
int32_t i;
|
||||||
|
|
||||||
if (m_hFile == NULL)
|
if (m_hFile == NULL)
|
||||||
{
|
{
|
||||||
|
@ -179,10 +182,10 @@ void CEeprom::ReadFrom(BYTE * Buffer, int line)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CEeprom::WriteTo(BYTE * Buffer, int line)
|
void CEeprom::WriteTo(uint8_t * Buffer, int32_t line)
|
||||||
{
|
{
|
||||||
DWORD dwWritten;
|
DWORD dwWritten;
|
||||||
int i;
|
int32_t i;
|
||||||
|
|
||||||
if (m_hFile == NULL)
|
if (m_hFile == NULL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -17,14 +17,18 @@ public:
|
||||||
CEeprom(bool ReadOnly);
|
CEeprom(bool ReadOnly);
|
||||||
~CEeprom();
|
~CEeprom();
|
||||||
|
|
||||||
void EepromCommand ( BYTE * Command );
|
void EepromCommand(uint8_t * Command);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void LoadEeprom ();
|
CEeprom(void); // Disable default constructor
|
||||||
void ReadFrom ( BYTE * Buffer, int line );
|
CEeprom(const CEeprom&); // Disable copy constructor
|
||||||
void WriteTo ( BYTE * Buffer, int line );
|
CEeprom& operator=(const CEeprom&); // Disable assignment
|
||||||
|
|
||||||
BYTE m_EEPROM[0x800];
|
void LoadEeprom();
|
||||||
|
void ReadFrom(uint8_t * Buffer, int32_t line);
|
||||||
|
void WriteTo(uint8_t * Buffer, int32_t line);
|
||||||
|
|
||||||
|
uint8_t m_EEPROM[0x800];
|
||||||
bool m_ReadOnly;
|
bool m_ReadOnly;
|
||||||
HANDLE m_hFile;
|
void * m_hFile;
|
||||||
};
|
};
|
||||||
|
|
|
@ -10,51 +10,48 @@
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <objbase.h>
|
__interface CMipsMemory_CallBack
|
||||||
|
|
||||||
interface CMipsMemory_CallBack
|
|
||||||
{
|
{
|
||||||
//Protected memory has been written to, returns true if that memory has been unprotected
|
//Protected memory has been written to, returns true if that memory has been unprotected
|
||||||
virtual bool WriteToProtectedMemory (DWORD Address, int length) = 0;
|
virtual bool WriteToProtectedMemory (uint32_t Address, int32_t length) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CMipsMemory
|
__interface CMipsMemory
|
||||||
{
|
{
|
||||||
public:
|
virtual uint8_t * Rdram () = 0;
|
||||||
virtual BYTE * Rdram () = 0;
|
virtual uint32_t RdramSize() = 0;
|
||||||
virtual DWORD RdramSize() = 0;
|
virtual uint8_t * Dmem () = 0;
|
||||||
virtual BYTE * Dmem () = 0;
|
virtual uint8_t * Imem () = 0;
|
||||||
virtual BYTE * Imem () = 0;
|
virtual uint8_t * PifRam () = 0;
|
||||||
virtual BYTE * PifRam () = 0;
|
|
||||||
|
|
||||||
virtual bool LB_VAddr ( DWORD VAddr, BYTE & Value ) = 0;
|
virtual bool LB_VAddr ( uint32_t VAddr, uint8_t & Value ) = 0;
|
||||||
virtual bool LH_VAddr ( DWORD VAddr, WORD & Value ) = 0;
|
virtual bool LH_VAddr ( uint32_t VAddr, uint16_t & Value ) = 0;
|
||||||
virtual bool LW_VAddr ( DWORD VAddr, DWORD & Value ) = 0;
|
virtual bool LW_VAddr ( uint32_t VAddr, uint32_t & Value ) = 0;
|
||||||
virtual bool LD_VAddr ( DWORD VAddr, QWORD & Value ) = 0;
|
virtual bool LD_VAddr ( uint32_t VAddr, uint64_t & Value ) = 0;
|
||||||
|
|
||||||
virtual bool LB_PAddr ( DWORD PAddr, BYTE & Value ) = 0;
|
virtual bool LB_PAddr ( uint32_t PAddr, uint8_t & Value ) = 0;
|
||||||
virtual bool LH_PAddr ( DWORD PAddr, WORD & Value ) = 0;
|
virtual bool LH_PAddr ( uint32_t PAddr, uint16_t & Value ) = 0;
|
||||||
virtual bool LW_PAddr ( DWORD PAddr, DWORD & Value ) = 0;
|
virtual bool LW_PAddr ( uint32_t PAddr, uint32_t & Value ) = 0;
|
||||||
virtual bool LD_PAddr ( DWORD PAddr, QWORD & Value ) = 0;
|
virtual bool LD_PAddr ( uint32_t PAddr, uint64_t & Value ) = 0;
|
||||||
|
|
||||||
virtual bool SB_VAddr ( DWORD VAddr, BYTE Value ) = 0;
|
virtual bool SB_VAddr ( uint32_t VAddr, uint8_t Value ) = 0;
|
||||||
virtual bool SH_VAddr ( DWORD VAddr, WORD Value ) = 0;
|
virtual bool SH_VAddr ( uint32_t VAddr, uint16_t Value ) = 0;
|
||||||
virtual bool SW_VAddr ( DWORD VAddr, DWORD Value ) = 0;
|
virtual bool SW_VAddr ( uint32_t VAddr, uint32_t Value ) = 0;
|
||||||
virtual bool SD_VAddr ( DWORD VAddr, QWORD Value ) = 0;
|
virtual bool SD_VAddr ( uint32_t VAddr, uint64_t Value ) = 0;
|
||||||
|
|
||||||
virtual bool SB_PAddr ( DWORD PAddr, BYTE Value ) = 0;
|
virtual bool SB_PAddr ( uint32_t PAddr, uint8_t Value ) = 0;
|
||||||
virtual bool SH_PAddr ( DWORD PAddr, WORD Value ) = 0;
|
virtual bool SH_PAddr ( uint32_t PAddr, uint16_t Value ) = 0;
|
||||||
virtual bool SW_PAddr ( DWORD PAddr, DWORD Value ) = 0;
|
virtual bool SW_PAddr ( uint32_t PAddr, uint32_t Value ) = 0;
|
||||||
virtual bool SD_PAddr ( DWORD PAddr, QWORD Value ) = 0;
|
virtual bool SD_PAddr ( uint32_t PAddr, uint64_t Value ) = 0;
|
||||||
|
|
||||||
virtual bool ValidVaddr ( DWORD VAddr ) const = 0;
|
virtual bool ValidVaddr ( uint32_t VAddr ) const = 0;
|
||||||
|
|
||||||
virtual int MemoryFilter ( DWORD dwExptCode, void * lpExceptionPointer ) = 0;
|
virtual int32_t MemoryFilter ( uint32_t dwExptCode, void * lpExceptionPointer ) = 0;
|
||||||
virtual void UpdateFieldSerration ( unsigned int interlaced ) = 0;
|
virtual void UpdateFieldSerration ( uint32_t interlaced ) = 0;
|
||||||
|
|
||||||
//Protect the Memory from being written to
|
//Protect the Memory from being written to
|
||||||
virtual void ProtectMemory ( DWORD StartVaddr, DWORD EndVaddr ) = 0;
|
virtual void ProtectMemory ( uint32_t StartVaddr, uint32_t EndVaddr ) = 0;
|
||||||
virtual void UnProtectMemory ( DWORD StartVaddr, DWORD EndVaddr ) = 0;
|
virtual void UnProtectMemory ( uint32_t StartVaddr, uint32_t EndVaddr ) = 0;
|
||||||
|
|
||||||
//Compilation Functions
|
//Compilation Functions
|
||||||
virtual void ResetMemoryStack () = 0;
|
virtual void ResetMemoryStack () = 0;
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -61,38 +61,38 @@ public:
|
||||||
bool Initialize ();
|
bool Initialize ();
|
||||||
void Reset ( bool EraseMemory );
|
void Reset ( bool EraseMemory );
|
||||||
|
|
||||||
BYTE * Rdram ();
|
uint8_t * Rdram ();
|
||||||
DWORD RdramSize ();
|
uint32_t RdramSize ();
|
||||||
BYTE * Dmem ();
|
uint8_t * Dmem ();
|
||||||
BYTE * Imem ();
|
uint8_t * Imem ();
|
||||||
BYTE * PifRam ();
|
uint8_t * PifRam ();
|
||||||
|
|
||||||
bool LB_VAddr ( DWORD VAddr, BYTE & Value );
|
bool LB_VAddr ( uint32_t VAddr, uint8_t & Value );
|
||||||
bool LH_VAddr ( DWORD VAddr, WORD & Value );
|
bool LH_VAddr ( uint32_t VAddr, uint16_t & Value );
|
||||||
bool LW_VAddr ( DWORD VAddr, DWORD & Value );
|
bool LW_VAddr ( uint32_t VAddr, uint32_t & Value );
|
||||||
bool LD_VAddr ( DWORD VAddr, QWORD & Value );
|
bool LD_VAddr ( uint32_t VAddr, uint64_t & Value );
|
||||||
|
|
||||||
bool LB_PAddr ( DWORD PAddr, BYTE & Value );
|
bool LB_PAddr ( uint32_t PAddr, uint8_t & Value );
|
||||||
bool LH_PAddr ( DWORD PAddr, WORD & Value );
|
bool LH_PAddr ( uint32_t PAddr, uint16_t & Value );
|
||||||
bool LW_PAddr ( DWORD PAddr, DWORD & Value );
|
bool LW_PAddr ( uint32_t PAddr, uint32_t & Value );
|
||||||
bool LD_PAddr ( DWORD PAddr, QWORD & Value );
|
bool LD_PAddr ( uint32_t PAddr, uint64_t & Value );
|
||||||
|
|
||||||
bool SB_VAddr ( DWORD VAddr, BYTE Value );
|
bool SB_VAddr ( uint32_t VAddr, uint8_t Value );
|
||||||
bool SH_VAddr ( DWORD VAddr, WORD Value );
|
bool SH_VAddr ( uint32_t VAddr, uint16_t Value );
|
||||||
bool SW_VAddr ( DWORD VAddr, DWORD Value );
|
bool SW_VAddr ( uint32_t VAddr, uint32_t Value );
|
||||||
bool SD_VAddr ( DWORD VAddr, QWORD Value );
|
bool SD_VAddr ( uint32_t VAddr, uint64_t Value );
|
||||||
|
|
||||||
bool SB_PAddr ( DWORD PAddr, BYTE Value );
|
bool SB_PAddr ( uint32_t PAddr, uint8_t Value );
|
||||||
bool SH_PAddr ( DWORD PAddr, WORD Value );
|
bool SH_PAddr ( uint32_t PAddr, uint16_t Value );
|
||||||
bool SW_PAddr ( DWORD PAddr, DWORD Value );
|
bool SW_PAddr ( uint32_t PAddr, uint32_t Value );
|
||||||
bool SD_PAddr ( DWORD PAddr, QWORD Value );
|
bool SD_PAddr ( uint32_t PAddr, uint64_t Value );
|
||||||
|
|
||||||
int MemoryFilter(DWORD dwExptCode, void * lpExceptionPointer);
|
int32_t MemoryFilter(uint32_t dwExptCode, void * lpExceptionPointer);
|
||||||
void UpdateFieldSerration(unsigned int interlaced);
|
void UpdateFieldSerration(uint32_t interlaced);
|
||||||
|
|
||||||
//Protect the Memory from being written to
|
//Protect the Memory from being written to
|
||||||
void ProtectMemory(DWORD StartVaddr, DWORD EndVaddr);
|
void ProtectMemory(uint32_t StartVaddr, uint32_t EndVaddr);
|
||||||
void UnProtectMemory(DWORD StartVaddr, DWORD EndVaddr);
|
void UnProtectMemory(uint32_t StartVaddr, uint32_t EndVaddr);
|
||||||
|
|
||||||
//Compilation Functions
|
//Compilation Functions
|
||||||
void ResetMemoryStack();
|
void ResetMemoryStack();
|
||||||
|
@ -124,28 +124,28 @@ public:
|
||||||
void Compile_SDC1();
|
void Compile_SDC1();
|
||||||
|
|
||||||
void ResetMemoryStack ( CRegInfo& RegInfo );
|
void ResetMemoryStack ( CRegInfo& RegInfo );
|
||||||
void Compile_LB ( CX86Ops::x86Reg Reg, DWORD Addr, bool SignExtend );
|
void Compile_LB ( CX86Ops::x86Reg Reg, uint32_t Addr, bool SignExtend );
|
||||||
void Compile_LH ( CX86Ops::x86Reg Reg, DWORD Addr, bool SignExtend );
|
void Compile_LH ( CX86Ops::x86Reg Reg, uint32_t Addr, bool SignExtend );
|
||||||
void Compile_LW ( CX86Ops::x86Reg Reg, DWORD Addr );
|
void Compile_LW ( CX86Ops::x86Reg Reg, uint32_t Addr );
|
||||||
void Compile_SB_Const ( BYTE Value, DWORD Addr );
|
void Compile_SB_Const ( uint8_t Value, uint32_t Addr );
|
||||||
void Compile_SB_Register ( CX86Ops::x86Reg Reg, DWORD Addr );
|
void Compile_SB_Register ( CX86Ops::x86Reg Reg, uint32_t Addr );
|
||||||
void Compile_SH_Const ( WORD Value, DWORD Addr );
|
void Compile_SH_Const ( uint16_t Value, uint32_t Addr );
|
||||||
void Compile_SH_Register ( CX86Ops::x86Reg Reg, DWORD Addr );
|
void Compile_SH_Register ( CX86Ops::x86Reg Reg, uint32_t Addr );
|
||||||
void Compile_SW_Const ( DWORD Value, DWORD Addr );
|
void Compile_SW_Const ( uint32_t Value, uint32_t Addr );
|
||||||
|
|
||||||
void Compile_SW_Register ( CX86Ops::x86Reg Reg, DWORD Addr );
|
void Compile_SW_Register ( CX86Ops::x86Reg Reg, uint32_t Addr );
|
||||||
|
|
||||||
//Functions for TLB notification
|
//Functions for TLB notification
|
||||||
void TLB_Mapped(DWORD VAddr, DWORD Len, DWORD PAddr, bool bReadOnly);
|
void TLB_Mapped(uint32_t VAddr, uint32_t Len, uint32_t PAddr, bool bReadOnly);
|
||||||
void TLB_Unmaped(DWORD Vaddr, DWORD Len);
|
void TLB_Unmaped(uint32_t Vaddr, uint32_t Len);
|
||||||
|
|
||||||
// CTransVaddr interface
|
// CTransVaddr interface
|
||||||
bool TranslateVaddr(DWORD VAddr, DWORD &PAddr) const;
|
bool TranslateVaddr(uint32_t VAddr, uint32_t &PAddr) const;
|
||||||
bool ValidVaddr(DWORD VAddr) const;
|
bool ValidVaddr(uint32_t VAddr) const;
|
||||||
bool VAddrToRealAddr(DWORD VAddr, void * &RealAddress) const;
|
bool VAddrToRealAddr(uint32_t VAddr, void * &RealAddress) const;
|
||||||
|
|
||||||
// Labels
|
// Labels
|
||||||
LPCTSTR LabelName(DWORD Address) const;
|
const char * LabelName(uint32_t Address) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CMipsMemoryVM(); // Disable default constructor
|
CMipsMemoryVM(); // Disable default constructor
|
||||||
|
@ -159,36 +159,36 @@ private:
|
||||||
static void ChangeSpStatus ();
|
static void ChangeSpStatus ();
|
||||||
static void ChangeMiIntrMask();
|
static void ChangeMiIntrMask();
|
||||||
|
|
||||||
bool LB_NonMemory ( DWORD PAddr, DWORD * Value, bool SignExtend );
|
bool LB_NonMemory ( uint32_t PAddr, uint32_t * Value, bool SignExtend );
|
||||||
bool LH_NonMemory ( DWORD PAddr, DWORD * Value, bool SignExtend );
|
bool LH_NonMemory ( uint32_t PAddr, uint32_t * Value, bool SignExtend );
|
||||||
bool LW_NonMemory ( DWORD PAddr, DWORD * Value );
|
bool LW_NonMemory ( uint32_t PAddr, uint32_t * Value );
|
||||||
|
|
||||||
bool SB_NonMemory ( DWORD PAddr, BYTE Value );
|
bool SB_NonMemory ( uint32_t PAddr, uint8_t Value );
|
||||||
bool SH_NonMemory ( DWORD PAddr, WORD Value );
|
bool SH_NonMemory ( uint32_t PAddr, uint16_t Value );
|
||||||
bool SW_NonMemory ( DWORD PAddr, DWORD Value );
|
bool SW_NonMemory ( uint32_t PAddr, uint32_t Value );
|
||||||
|
|
||||||
void Compile_StoreInstructClean (x86Reg AddressReg, int Length );
|
void Compile_StoreInstructClean (x86Reg AddressReg, int32_t Length );
|
||||||
|
|
||||||
CMipsMemory_CallBack * const m_CBClass;
|
CMipsMemory_CallBack * const m_CBClass;
|
||||||
|
|
||||||
//Memory Locations
|
//Memory Locations
|
||||||
static BYTE * m_Reserve1, * m_Reserve2;
|
static uint8_t * m_Reserve1, * m_Reserve2;
|
||||||
BYTE * m_RDRAM, * m_DMEM, * m_IMEM;
|
uint8_t * m_RDRAM, * m_DMEM, * m_IMEM;
|
||||||
DWORD m_AllocatedRdramSize;
|
uint32_t m_AllocatedRdramSize;
|
||||||
|
|
||||||
//Rom Information
|
//Rom Information
|
||||||
bool m_RomMapped;
|
bool m_RomMapped;
|
||||||
BYTE * m_Rom;
|
uint8_t * m_Rom;
|
||||||
DWORD m_RomSize;
|
uint32_t m_RomSize;
|
||||||
bool m_RomWrittenTo;
|
bool m_RomWrittenTo;
|
||||||
DWORD m_RomWroteValue;
|
uint32_t m_RomWroteValue;
|
||||||
|
|
||||||
//Current Half line
|
//Current Half line
|
||||||
void UpdateHalfLine();
|
void UpdateHalfLine();
|
||||||
DWORD m_HalfLine;
|
uint32_t m_HalfLine;
|
||||||
DWORD m_HalfLineCheck;
|
uint32_t m_HalfLineCheck;
|
||||||
DWORD m_FieldSerration;
|
uint32_t m_FieldSerration;
|
||||||
DWORD m_TempValue;
|
uint32_t m_TempValue;
|
||||||
|
|
||||||
//Initializing and resetting information about the memory system
|
//Initializing and resetting information about the memory system
|
||||||
void FreeMemory();
|
void FreeMemory();
|
||||||
|
|
|
@ -10,10 +10,13 @@
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#pragma warning(push)
|
||||||
|
#pragma warning(disable : 4201) // warning C4201: nonstandard extension used : nameless struct/union
|
||||||
|
|
||||||
union OPCODE
|
union OPCODE
|
||||||
{
|
{
|
||||||
unsigned long Hex;
|
uint32_t Hex;
|
||||||
unsigned char Ascii[4];
|
uint8_t Ascii[4];
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
|
@ -57,6 +60,7 @@ union OPCODE
|
||||||
unsigned : 6;
|
unsigned : 6;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
#pragma warning(pop)
|
||||||
|
|
||||||
enum R4300iOpCodes
|
enum R4300iOpCodes
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
|
#include <Project64\User Interface\LoggingUI.h>
|
||||||
|
|
||||||
int CPifRamSettings::m_RefCount = 0;
|
int CPifRamSettings::m_RefCount = 0;
|
||||||
bool CPifRamSettings::m_bShowPifRamErrors = false;
|
bool CPifRamSettings::m_bShowPifRamErrors = false;
|
||||||
|
@ -45,7 +46,6 @@ CPifRam::CPifRam( bool SavesReadOnly ) :
|
||||||
|
|
||||||
CPifRam::~CPifRam()
|
CPifRam::~CPifRam()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPifRam::Reset()
|
void CPifRam::Reset()
|
||||||
|
@ -86,7 +86,6 @@ void CPifRam::n64_cic_nus_6105(char challenge[], char respone[], int length)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CPifRam::PifRamRead()
|
void CPifRam::PifRamRead()
|
||||||
{
|
{
|
||||||
if (m_PifRam[0x3F] == 0x2)
|
if (m_PifRam[0x3F] == 0x2)
|
||||||
|
@ -274,23 +273,23 @@ void CPifRam::SI_DMA_READ()
|
||||||
BYTE * PifRamPos = m_PifRam;
|
BYTE * PifRamPos = m_PifRam;
|
||||||
BYTE * RDRAM = g_MMU->Rdram();
|
BYTE * RDRAM = g_MMU->Rdram();
|
||||||
|
|
||||||
DWORD & SI_DRAM_ADDR_REG = g_Reg->SI_DRAM_ADDR_REG;
|
uint32_t & SI_DRAM_ADDR_REG = (uint32_t &)g_Reg->SI_DRAM_ADDR_REG;
|
||||||
if ((int)SI_DRAM_ADDR_REG > (int)g_System->RdramSize())
|
if ((int32_t)SI_DRAM_ADDR_REG > (int32_t)g_System->RdramSize())
|
||||||
{
|
{
|
||||||
if (bShowPifRamErrors())
|
if (bShowPifRamErrors())
|
||||||
{
|
{
|
||||||
g_Notify->DisplayError(L"SI DMA\nSI_DRAM_ADDR_REG not in RDRam space");
|
g_Notify->DisplayError(__FUNCTIONW__ L"\nSI_DRAM_ADDR_REG not in RDRam space");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
PifRamRead();
|
PifRamRead();
|
||||||
SI_DRAM_ADDR_REG &= 0xFFFFFFF8;
|
SI_DRAM_ADDR_REG &= 0xFFFFFFF8;
|
||||||
if ((int)SI_DRAM_ADDR_REG < 0)
|
if ((int32_t)SI_DRAM_ADDR_REG < 0)
|
||||||
{
|
{
|
||||||
int count, RdramPos;
|
int32_t count, RdramPos;
|
||||||
|
|
||||||
RdramPos = (int)SI_DRAM_ADDR_REG;
|
RdramPos = (int32_t)SI_DRAM_ADDR_REG;
|
||||||
for (count = 0; count < 0x40; count++, RdramPos++)
|
for (count = 0; count < 0x40; count++, RdramPos++)
|
||||||
{
|
{
|
||||||
if (RdramPos < 0)
|
if (RdramPos < 0)
|
||||||
|
@ -308,9 +307,9 @@ void CPifRam::SI_DMA_READ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LogOptions.LogPRDMAMemStores)
|
if (LogPRDMAMemStores())
|
||||||
{
|
{
|
||||||
int count;
|
int32_t count;
|
||||||
char HexData[100], AsciiData[100], Addon[20];
|
char HexData[100], AsciiData[100], Addon[20];
|
||||||
LogMessage("\tData DMAed to RDRAM:");
|
LogMessage("\tData DMAed to RDRAM:");
|
||||||
LogMessage("\t--------------------");
|
LogMessage("\t--------------------");
|
||||||
|
@ -358,10 +357,10 @@ void CPifRam::SI_DMA_READ()
|
||||||
|
|
||||||
void CPifRam::SI_DMA_WRITE()
|
void CPifRam::SI_DMA_WRITE()
|
||||||
{
|
{
|
||||||
BYTE * PifRamPos = m_PifRam;
|
uint8_t * PifRamPos = m_PifRam;
|
||||||
|
|
||||||
DWORD & SI_DRAM_ADDR_REG = g_Reg->SI_DRAM_ADDR_REG;
|
uint32_t & SI_DRAM_ADDR_REG = (uint32_t &)g_Reg->SI_DRAM_ADDR_REG;
|
||||||
if ((int)SI_DRAM_ADDR_REG > (int)g_System->RdramSize())
|
if ((int32_t)SI_DRAM_ADDR_REG > (int32_t)g_System->RdramSize())
|
||||||
{
|
{
|
||||||
if (bShowPifRamErrors())
|
if (bShowPifRamErrors())
|
||||||
{
|
{
|
||||||
|
@ -371,13 +370,13 @@ void CPifRam::SI_DMA_WRITE()
|
||||||
}
|
}
|
||||||
|
|
||||||
SI_DRAM_ADDR_REG &= 0xFFFFFFF8;
|
SI_DRAM_ADDR_REG &= 0xFFFFFFF8;
|
||||||
BYTE * RDRAM = g_MMU->Rdram();
|
uint8_t * RDRAM = g_MMU->Rdram();
|
||||||
|
|
||||||
if ((int)SI_DRAM_ADDR_REG < 0)
|
if ((int32_t)SI_DRAM_ADDR_REG < 0)
|
||||||
{
|
{
|
||||||
int RdramPos = (int)SI_DRAM_ADDR_REG;
|
int32_t RdramPos = (int32_t)SI_DRAM_ADDR_REG;
|
||||||
|
|
||||||
for (int count = 0; count < 0x40; count++, RdramPos++)
|
for (int32_t count = 0; count < 0x40; count++, RdramPos++)
|
||||||
{
|
{
|
||||||
if (RdramPos < 0)
|
if (RdramPos < 0)
|
||||||
{
|
{
|
||||||
|
@ -394,9 +393,9 @@ void CPifRam::SI_DMA_WRITE()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LogOptions.LogPRDMAMemLoads)
|
if (LogPRDMAMemLoads())
|
||||||
{
|
{
|
||||||
int count;
|
int32_t count;
|
||||||
char HexData[100], AsciiData[100], Addon[20];
|
char HexData[100], AsciiData[100], Addon[20];
|
||||||
LogMessage("");
|
LogMessage("");
|
||||||
LogMessage("\tData DMAed to the Pif Ram:");
|
LogMessage("\tData DMAed to the Pif Ram:");
|
||||||
|
@ -505,7 +504,7 @@ void CPifRam::ProcessControllerCommand ( int Control, BYTE * Command)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 0x02: //read from controller pack
|
case 0x02: //read from controller pack
|
||||||
if (LogOptions.LogControllerPak)
|
if (LogControllerPak())
|
||||||
{
|
{
|
||||||
LogControllerPakData("Read: Before Gettting Results");
|
LogControllerPakData("Read: Before Gettting Results");
|
||||||
}
|
}
|
||||||
|
@ -541,13 +540,13 @@ void CPifRam::ProcessControllerCommand ( int Control, BYTE * Command)
|
||||||
{
|
{
|
||||||
Command[1] |= 0x80;
|
Command[1] |= 0x80;
|
||||||
}
|
}
|
||||||
if (LogOptions.LogControllerPak)
|
if (LogControllerPak())
|
||||||
{
|
{
|
||||||
LogControllerPakData("Read: After Gettting Results");
|
LogControllerPakData("Read: After Gettting Results");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 0x03: //write controller pak
|
case 0x03: //write controller pak
|
||||||
if (LogOptions.LogControllerPak)
|
if (LogControllerPak())
|
||||||
{
|
{
|
||||||
LogControllerPakData("Write: Before Processing");
|
LogControllerPakData("Write: Before Processing");
|
||||||
}
|
}
|
||||||
|
@ -581,7 +580,7 @@ void CPifRam::ProcessControllerCommand ( int Control, BYTE * Command)
|
||||||
{
|
{
|
||||||
Command[1] |= 0x80;
|
Command[1] |= 0x80;
|
||||||
}
|
}
|
||||||
if (LogOptions.LogControllerPak)
|
if (LogControllerPak())
|
||||||
{
|
{
|
||||||
LogControllerPakData("Write: After Processing");
|
LogControllerPakData("Write: After Processing");
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <Project64\Logging.h>
|
||||||
class CPifRamSettings
|
class CPifRamSettings
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
@ -31,6 +32,7 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
class CPifRam :
|
class CPifRam :
|
||||||
|
public CLogging,
|
||||||
private CPifRamSettings,
|
private CPifRamSettings,
|
||||||
private CEeprom
|
private CEeprom
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
|
#include <Project64\User Interface\LoggingUI.h>
|
||||||
|
|
||||||
const char * CRegName::GPR[32] = { "r0", "at", "v0", "v1", "a0", "a1", "a2", "a3",
|
const char * CRegName::GPR[32] = { "r0", "at", "v0", "v1", "a0", "a1", "a2", "a3",
|
||||||
"t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7",
|
"t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7",
|
||||||
|
@ -46,20 +47,19 @@ const char * CRegName::FPR_Ctrl[32] = {"Revision","Unknown","Unknown","Unknown",
|
||||||
"Unknown", "Unknown", "Unknown", "Unknown", "Unknown", "Unknown",
|
"Unknown", "Unknown", "Unknown", "Unknown", "Unknown", "Unknown",
|
||||||
"Unknown", "Unknown", "FCSR" };
|
"Unknown", "Unknown", "FCSR" };
|
||||||
|
|
||||||
DWORD * CSystemRegisters::_PROGRAM_COUNTER = NULL;
|
uint32_t * CSystemRegisters::_PROGRAM_COUNTER = NULL;
|
||||||
MIPS_DWORD * CSystemRegisters::_GPR = NULL;
|
MIPS_DWORD * CSystemRegisters::_GPR = NULL;
|
||||||
MIPS_DWORD * CSystemRegisters::_FPR = NULL;
|
MIPS_DWORD * CSystemRegisters::_FPR = NULL;
|
||||||
DWORD * CSystemRegisters::_CP0 = NULL;
|
uint32_t * CSystemRegisters::_CP0 = NULL;
|
||||||
MIPS_DWORD * CSystemRegisters::_RegHI = NULL;
|
MIPS_DWORD * CSystemRegisters::_RegHI = NULL;
|
||||||
MIPS_DWORD * CSystemRegisters::_RegLO = NULL;
|
MIPS_DWORD * CSystemRegisters::_RegLO = NULL;
|
||||||
float ** CSystemRegisters::_FPR_S;
|
float ** CSystemRegisters::_FPR_S;
|
||||||
double ** CSystemRegisters::_FPR_D;
|
double ** CSystemRegisters::_FPR_D;
|
||||||
DWORD * CSystemRegisters::_FPCR = NULL;
|
uint32_t * CSystemRegisters::_FPCR = NULL;
|
||||||
DWORD * CSystemRegisters::_LLBit = NULL;
|
uint32_t * CSystemRegisters::_LLBit = NULL;
|
||||||
ROUNDING_MODE * CSystemRegisters::_RoundingModel = NULL;
|
ROUNDING_MODE * CSystemRegisters::_RoundingModel = NULL;
|
||||||
|
|
||||||
|
CP0registers::CP0registers(uint32_t * _CP0) :
|
||||||
CP0registers::CP0registers(DWORD * _CP0) :
|
|
||||||
INDEX_REGISTER(_CP0[0]),
|
INDEX_REGISTER(_CP0[0]),
|
||||||
RANDOM_REGISTER(_CP0[1]),
|
RANDOM_REGISTER(_CP0[1]),
|
||||||
ENTRYLO0_REGISTER(_CP0[2]),
|
ENTRYLO0_REGISTER(_CP0[2]),
|
||||||
|
@ -80,10 +80,9 @@ CP0registers::CP0registers(DWORD * _CP0) :
|
||||||
ERROREPC_REGISTER(_CP0[30]),
|
ERROREPC_REGISTER(_CP0[30]),
|
||||||
FAKE_CAUSE_REGISTER(_CP0[32])
|
FAKE_CAUSE_REGISTER(_CP0[32])
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Rdram_InterfaceReg::Rdram_InterfaceReg(DWORD * _RdramInterface) :
|
Rdram_InterfaceReg::Rdram_InterfaceReg(uint32_t * _RdramInterface) :
|
||||||
RDRAM_CONFIG_REG(_RdramInterface[0]),
|
RDRAM_CONFIG_REG(_RdramInterface[0]),
|
||||||
RDRAM_DEVICE_TYPE_REG(_RdramInterface[0]),
|
RDRAM_DEVICE_TYPE_REG(_RdramInterface[0]),
|
||||||
RDRAM_DEVICE_ID_REG(_RdramInterface[1]),
|
RDRAM_DEVICE_ID_REG(_RdramInterface[1]),
|
||||||
|
@ -96,10 +95,9 @@ Rdram_InterfaceReg::Rdram_InterfaceReg(DWORD * _RdramInterface) :
|
||||||
RDRAM_ADDR_SELECT_REG(_RdramInterface[8]),
|
RDRAM_ADDR_SELECT_REG(_RdramInterface[8]),
|
||||||
RDRAM_DEVICE_MANUF_REG(_RdramInterface[9])
|
RDRAM_DEVICE_MANUF_REG(_RdramInterface[9])
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Mips_InterfaceReg::Mips_InterfaceReg(DWORD * _MipsInterface) :
|
Mips_InterfaceReg::Mips_InterfaceReg(uint32_t * _MipsInterface) :
|
||||||
MI_INIT_MODE_REG(_MipsInterface[0]),
|
MI_INIT_MODE_REG(_MipsInterface[0]),
|
||||||
MI_MODE_REG(_MipsInterface[0]),
|
MI_MODE_REG(_MipsInterface[0]),
|
||||||
MI_VERSION_REG(_MipsInterface[1]),
|
MI_VERSION_REG(_MipsInterface[1]),
|
||||||
|
@ -107,10 +105,9 @@ Mips_InterfaceReg::Mips_InterfaceReg(DWORD * _MipsInterface) :
|
||||||
MI_INTR_REG(_MipsInterface[2]),
|
MI_INTR_REG(_MipsInterface[2]),
|
||||||
MI_INTR_MASK_REG(_MipsInterface[3])
|
MI_INTR_MASK_REG(_MipsInterface[3])
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Video_InterfaceReg::Video_InterfaceReg(DWORD * _VideoInterface) :
|
Video_InterfaceReg::Video_InterfaceReg(uint32_t * _VideoInterface) :
|
||||||
VI_STATUS_REG(_VideoInterface[0]),
|
VI_STATUS_REG(_VideoInterface[0]),
|
||||||
VI_CONTROL_REG(_VideoInterface[0]),
|
VI_CONTROL_REG(_VideoInterface[0]),
|
||||||
VI_ORIGIN_REG(_VideoInterface[1]),
|
VI_ORIGIN_REG(_VideoInterface[1]),
|
||||||
|
@ -135,10 +132,9 @@ Video_InterfaceReg::Video_InterfaceReg(DWORD * _VideoInterface) :
|
||||||
VI_X_SCALE_REG(_VideoInterface[12]),
|
VI_X_SCALE_REG(_VideoInterface[12]),
|
||||||
VI_Y_SCALE_REG(_VideoInterface[13])
|
VI_Y_SCALE_REG(_VideoInterface[13])
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioInterfaceReg::AudioInterfaceReg(DWORD * _AudioInterface) :
|
AudioInterfaceReg::AudioInterfaceReg(uint32_t * _AudioInterface) :
|
||||||
AI_DRAM_ADDR_REG(_AudioInterface[0]),
|
AI_DRAM_ADDR_REG(_AudioInterface[0]),
|
||||||
AI_LEN_REG(_AudioInterface[1]),
|
AI_LEN_REG(_AudioInterface[1]),
|
||||||
AI_CONTROL_REG(_AudioInterface[2]),
|
AI_CONTROL_REG(_AudioInterface[2]),
|
||||||
|
@ -146,10 +142,9 @@ AudioInterfaceReg::AudioInterfaceReg(DWORD * _AudioInterface) :
|
||||||
AI_DACRATE_REG(_AudioInterface[4]),
|
AI_DACRATE_REG(_AudioInterface[4]),
|
||||||
AI_BITRATE_REG(_AudioInterface[5])
|
AI_BITRATE_REG(_AudioInterface[5])
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PeripheralInterfaceReg::PeripheralInterfaceReg(DWORD * PeripheralInterface) :
|
PeripheralInterfaceReg::PeripheralInterfaceReg(uint32_t * PeripheralInterface) :
|
||||||
PI_DRAM_ADDR_REG(PeripheralInterface[0]),
|
PI_DRAM_ADDR_REG(PeripheralInterface[0]),
|
||||||
PI_CART_ADDR_REG(PeripheralInterface[1]),
|
PI_CART_ADDR_REG(PeripheralInterface[1]),
|
||||||
PI_RD_LEN_REG(PeripheralInterface[2]),
|
PI_RD_LEN_REG(PeripheralInterface[2]),
|
||||||
|
@ -166,10 +161,9 @@ PeripheralInterfaceReg::PeripheralInterfaceReg(DWORD * PeripheralInterface) :
|
||||||
PI_BSD_DOM2_PGS_REG(PeripheralInterface[11]),
|
PI_BSD_DOM2_PGS_REG(PeripheralInterface[11]),
|
||||||
PI_BSD_DOM2_RLS_REG(PeripheralInterface[12])
|
PI_BSD_DOM2_RLS_REG(PeripheralInterface[12])
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RDRAMInt_InterfaceReg::RDRAMInt_InterfaceReg(DWORD * RdramInterface) :
|
RDRAMInt_InterfaceReg::RDRAMInt_InterfaceReg(uint32_t * RdramInterface) :
|
||||||
RI_MODE_REG(RdramInterface[0]),
|
RI_MODE_REG(RdramInterface[0]),
|
||||||
RI_CONFIG_REG(RdramInterface[1]),
|
RI_CONFIG_REG(RdramInterface[1]),
|
||||||
RI_CURRENT_LOAD_REG(RdramInterface[2]),
|
RI_CURRENT_LOAD_REG(RdramInterface[2]),
|
||||||
|
@ -180,10 +174,9 @@ RDRAMInt_InterfaceReg::RDRAMInt_InterfaceReg(DWORD * RdramInterface) :
|
||||||
RI_RERROR_REG(RdramInterface[6]),
|
RI_RERROR_REG(RdramInterface[6]),
|
||||||
RI_WERROR_REG(RdramInterface[7])
|
RI_WERROR_REG(RdramInterface[7])
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DisplayControlReg::DisplayControlReg(DWORD * _DisplayProcessor) :
|
DisplayControlReg::DisplayControlReg(uint32_t * _DisplayProcessor) :
|
||||||
DPC_START_REG(_DisplayProcessor[0]),
|
DPC_START_REG(_DisplayProcessor[0]),
|
||||||
DPC_END_REG(_DisplayProcessor[1]),
|
DPC_END_REG(_DisplayProcessor[1]),
|
||||||
DPC_CURRENT_REG(_DisplayProcessor[2]),
|
DPC_CURRENT_REG(_DisplayProcessor[2]),
|
||||||
|
@ -193,10 +186,9 @@ DisplayControlReg::DisplayControlReg(DWORD * _DisplayProcessor) :
|
||||||
DPC_PIPEBUSY_REG(_DisplayProcessor[6]),
|
DPC_PIPEBUSY_REG(_DisplayProcessor[6]),
|
||||||
DPC_TMEM_REG(_DisplayProcessor[7])
|
DPC_TMEM_REG(_DisplayProcessor[7])
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SigProcessor_InterfaceReg::SigProcessor_InterfaceReg(DWORD * _SignalProcessorInterface) :
|
SigProcessor_InterfaceReg::SigProcessor_InterfaceReg(uint32_t * _SignalProcessorInterface) :
|
||||||
SP_MEM_ADDR_REG(_SignalProcessorInterface[0]),
|
SP_MEM_ADDR_REG(_SignalProcessorInterface[0]),
|
||||||
SP_DRAM_ADDR_REG(_SignalProcessorInterface[1]),
|
SP_DRAM_ADDR_REG(_SignalProcessorInterface[1]),
|
||||||
SP_RD_LEN_REG(_SignalProcessorInterface[2]),
|
SP_RD_LEN_REG(_SignalProcessorInterface[2]),
|
||||||
|
@ -208,16 +200,14 @@ SigProcessor_InterfaceReg::SigProcessor_InterfaceReg(DWORD * _SignalProcessorInt
|
||||||
SP_PC_REG(_SignalProcessorInterface[8]),
|
SP_PC_REG(_SignalProcessorInterface[8]),
|
||||||
SP_IBIST_REG(_SignalProcessorInterface[9])
|
SP_IBIST_REG(_SignalProcessorInterface[9])
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Serial_InterfaceReg::Serial_InterfaceReg(DWORD * SerialInterface) :
|
Serial_InterfaceReg::Serial_InterfaceReg(uint32_t * SerialInterface) :
|
||||||
SI_DRAM_ADDR_REG(SerialInterface[0]),
|
SI_DRAM_ADDR_REG(SerialInterface[0]),
|
||||||
SI_PIF_ADDR_RD64B_REG(SerialInterface[1]),
|
SI_PIF_ADDR_RD64B_REG(SerialInterface[1]),
|
||||||
SI_PIF_ADDR_WR64B_REG(SerialInterface[2]),
|
SI_PIF_ADDR_WR64B_REG(SerialInterface[2]),
|
||||||
SI_STATUS_REG(SerialInterface[3])
|
SI_STATUS_REG(SerialInterface[3])
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CRegisters::CRegisters(CN64System * System, CSystemEvents * SystemEvents) :
|
CRegisters::CRegisters(CN64System * System, CSystemEvents * SystemEvents) :
|
||||||
|
@ -329,7 +319,7 @@ void CRegisters::CheckInterrupts()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CRegisters::DoAddressError(bool DelaySlot, DWORD BadVaddr, bool FromRead)
|
void CRegisters::DoAddressError(bool DelaySlot, uint32_t BadVaddr, bool FromRead)
|
||||||
{
|
{
|
||||||
if (bHaveDebugger())
|
if (bHaveDebugger())
|
||||||
{
|
{
|
||||||
|
@ -445,7 +435,6 @@ void CRegisters::DoCopUnusableException(bool DelaySlot, int Coprocessor)
|
||||||
m_PROGRAM_COUNTER = 0x80000180;
|
m_PROGRAM_COUNTER = 0x80000180;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool CRegisters::DoIntrException(bool DelaySlot)
|
bool CRegisters::DoIntrException(bool DelaySlot)
|
||||||
{
|
{
|
||||||
if ((STATUS_REGISTER & STATUS_IE) == 0)
|
if ((STATUS_REGISTER & STATUS_IE) == 0)
|
||||||
|
@ -463,7 +452,7 @@ bool CRegisters::DoIntrException(bool DelaySlot)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LogOptions.GenerateLog && LogOptions.LogExceptions && !LogOptions.NoInterrupts)
|
if (GenerateLog() && LogExceptions() && !LogNoInterrupts())
|
||||||
{
|
{
|
||||||
LogMessage("%08X: Interrupt Generated", m_PROGRAM_COUNTER);
|
LogMessage("%08X: Interrupt Generated", m_PROGRAM_COUNTER);
|
||||||
}
|
}
|
||||||
|
@ -486,7 +475,7 @@ bool CRegisters::DoIntrException(bool DelaySlot)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CRegisters::DoTLBReadMiss(bool DelaySlot, DWORD BadVaddr)
|
void CRegisters::DoTLBReadMiss(bool DelaySlot, uint32_t BadVaddr)
|
||||||
{
|
{
|
||||||
CAUSE_REGISTER = EXC_RMISS;
|
CAUSE_REGISTER = EXC_RMISS;
|
||||||
BAD_VADDR_REGISTER = BadVaddr;
|
BAD_VADDR_REGISTER = BadVaddr;
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue