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;
|
||||||
|
};
|
|
@ -12,20 +12,20 @@ public:
|
||||||
CTraceLog()
|
CTraceLog()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
~CTraceLog() { CloseTrace (); }
|
~CTraceLog() { CloseTrace(); }
|
||||||
|
|
||||||
CTraceModule * AddTraceModule ( CTraceModule * TraceModule );
|
CTraceModule * AddTraceModule(CTraceModule * TraceModule);
|
||||||
CTraceModule * RemoveTraceModule ( CTraceModule * TraceModule );
|
CTraceModule * RemoveTraceModule(CTraceModule * TraceModule);
|
||||||
void CloseTrace ( void );
|
void CloseTrace(void);
|
||||||
void WriteTrace ( TraceType Type, LPCTSTR Message );
|
void WriteTrace(TraceType Type, LPCTSTR Message);
|
||||||
void WriteTraceF ( TraceType Type, LPCTSTR strFormat, va_list args);
|
void WriteTraceF(TraceType Type, LPCTSTR strFormat, va_list args);
|
||||||
};
|
};
|
||||||
|
|
||||||
CTraceModule * CTraceLog::AddTraceModule ( CTraceModule * TraceModule )
|
CTraceModule * CTraceLog::AddTraceModule(CTraceModule * TraceModule)
|
||||||
{
|
{
|
||||||
CGuard Guard(m_CS);
|
CGuard Guard(m_CS);
|
||||||
|
|
||||||
for (int i = 0; i < (int)m_Modules.size(); i++ )
|
for (int i = 0; i < (int)m_Modules.size(); i++)
|
||||||
{
|
{
|
||||||
if (m_Modules[i] == TraceModule)
|
if (m_Modules[i] == TraceModule)
|
||||||
{
|
{
|
||||||
|
@ -36,7 +36,7 @@ CTraceModule * CTraceLog::AddTraceModule ( CTraceModule * TraceModule )
|
||||||
return TraceModule;
|
return TraceModule;
|
||||||
}
|
}
|
||||||
|
|
||||||
CTraceModule * CTraceLog::RemoveTraceModule ( CTraceModule * TraceModule )
|
CTraceModule * CTraceLog::RemoveTraceModule(CTraceModule * TraceModule)
|
||||||
{
|
{
|
||||||
CGuard Guard(m_CS);
|
CGuard Guard(m_CS);
|
||||||
|
|
||||||
|
@ -51,36 +51,36 @@ CTraceModule * CTraceLog::RemoveTraceModule ( CTraceModule * TraceModule )
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTraceLog::CloseTrace ( void)
|
void CTraceLog::CloseTrace(void)
|
||||||
{
|
{
|
||||||
CGuard Guard(m_CS);
|
CGuard Guard(m_CS);
|
||||||
|
|
||||||
for (int i = 0; i < (int)m_Modules.size(); i++ )
|
for (int i = 0; i < (int)m_Modules.size(); i++)
|
||||||
{
|
{
|
||||||
if(m_Modules[i])
|
if (m_Modules[i])
|
||||||
delete m_Modules[i];
|
delete m_Modules[i];
|
||||||
}
|
}
|
||||||
m_Modules.clear();
|
m_Modules.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTraceLog::WriteTraceF ( TraceType Type, LPCTSTR strFormat, va_list args)
|
void CTraceLog::WriteTraceF(TraceType Type, LPCTSTR strFormat, va_list args)
|
||||||
{
|
{
|
||||||
const int nMaxSize = 32*1024;
|
const int nMaxSize = 32 * 1024;
|
||||||
TCHAR pBuffer[nMaxSize];
|
TCHAR pBuffer[nMaxSize];
|
||||||
|
|
||||||
_vsntprintf(pBuffer,nMaxSize,strFormat,args);
|
_vsntprintf(pBuffer, nMaxSize, strFormat, args);
|
||||||
pBuffer[nMaxSize - 1] = 0;
|
pBuffer[nMaxSize - 1] = 0;
|
||||||
WriteTrace(Type,pBuffer);
|
WriteTrace(Type, pBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTraceLog::WriteTrace ( TraceType Type, LPCTSTR Message)
|
void CTraceLog::WriteTrace(TraceType Type, LPCTSTR Message)
|
||||||
{
|
{
|
||||||
CGuard Guard(m_CS);
|
CGuard Guard(m_CS);
|
||||||
|
|
||||||
if (Type != TraceNone)
|
if (Type != TraceNone)
|
||||||
{
|
{
|
||||||
bool WriteToLog = false;
|
bool WriteToLog = false;
|
||||||
for (int i = 0; i < (int)m_Modules.size(); i++ )
|
for (int i = 0; i < (int)m_Modules.size(); i++)
|
||||||
{
|
{
|
||||||
if ((m_Modules[i]->GetTraceLevel() & Type) != 0)
|
if ((m_Modules[i]->GetTraceLevel() & Type) != 0)
|
||||||
{
|
{
|
||||||
|
@ -99,25 +99,25 @@ void CTraceLog::WriteTrace ( TraceType Type, LPCTSTR Message)
|
||||||
SYSTEMTIME sysTime;
|
SYSTEMTIME sysTime;
|
||||||
::GetLocalTime(&sysTime);
|
::GetLocalTime(&sysTime);
|
||||||
|
|
||||||
nPos = _stprintf( pBuffer, _T("%04d/%02d/%02d %02d:%02d:%02d.%03d %05d: "), sysTime.wYear,
|
nPos = _stprintf(pBuffer, _T("%04d/%02d/%02d %02d:%02d:%02d.%03d %05d: "), sysTime.wYear,
|
||||||
sysTime.wMonth,sysTime.wDay,sysTime.wHour,sysTime.wMinute,sysTime.wSecond,sysTime.wMilliseconds,
|
sysTime.wMonth, sysTime.wDay, sysTime.wHour, sysTime.wMinute, sysTime.wSecond, sysTime.wMilliseconds,
|
||||||
::GetCurrentThreadId()
|
::GetCurrentThreadId()
|
||||||
);
|
);
|
||||||
|
|
||||||
// show the debug level
|
// show the debug level
|
||||||
if (Type == TraceNone) { nPos += _stprintf(pBuffer+nPos,_T("%s"),_T("None : ")); }
|
if (Type == TraceNone) { nPos += _stprintf(pBuffer + nPos, _T("%s"), _T("None : ")); }
|
||||||
else if ((Type & TraceError) != 0) { nPos += _stprintf(pBuffer+nPos,_T("%s"),_T("Error : ")); }
|
else if ((Type & TraceError) != 0) { nPos += _stprintf(pBuffer + nPos, _T("%s"), _T("Error : ")); }
|
||||||
else if ((Type & TraceSettings) != 0) { nPos += _stprintf(pBuffer+nPos,_T("%s"),_T("Setting: ")); }
|
else if ((Type & TraceSettings) != 0) { nPos += _stprintf(pBuffer + nPos, _T("%s"), _T("Setting: ")); }
|
||||||
else if ((Type & TraceGfxPlugin) != 0) { nPos += _stprintf(pBuffer+nPos,_T("%s"),_T("Gfx : ")); }
|
else if ((Type & TraceGfxPlugin) != 0) { nPos += _stprintf(pBuffer + nPos, _T("%s"), _T("Gfx : ")); }
|
||||||
else if ((Type & TraceDebug) != 0) { nPos += _stprintf(pBuffer+nPos,_T("%s"),_T("Debug : ")); }
|
else if ((Type & TraceDebug) != 0) { nPos += _stprintf(pBuffer + nPos, _T("%s"), _T("Debug : ")); }
|
||||||
else if ((Type & TraceRecompiler)!= 0) { nPos += _stprintf(pBuffer+nPos,_T("%s"),_T("Recomp : ")); }
|
else if ((Type & TraceRecompiler) != 0) { nPos += _stprintf(pBuffer + nPos, _T("%s"), _T("Recomp : ")); }
|
||||||
else if ((Type & TraceRSP )!= 0) { nPos += _stprintf(pBuffer+nPos,_T("%s"),_T("RSP : ")); }
|
else if ((Type & TraceRSP) != 0) { nPos += _stprintf(pBuffer + nPos, _T("%s"), _T("RSP : ")); }
|
||||||
else if ((Type & TraceTLB )!= 0) { nPos += _stprintf(pBuffer+nPos,_T("%s"),_T("TLB : ")); }
|
else if ((Type & TraceTLB) != 0) { nPos += _stprintf(pBuffer + nPos, _T("%s"), _T("TLB : ")); }
|
||||||
else if ((Type & TraceValidate )!= 0) { nPos += _stprintf(pBuffer+nPos,_T("%s"),_T("Valid : ")); }
|
else if ((Type & TraceValidate) != 0) { nPos += _stprintf(pBuffer + nPos, _T("%s"), _T("Valid : ")); }
|
||||||
else if ((Type & TraceAudio )!= 0) { nPos += _stprintf(pBuffer+nPos,_T("%s"),_T("Audio : ")); }
|
else if ((Type & TraceAudio) != 0) { nPos += _stprintf(pBuffer + nPos, _T("%s"), _T("Audio : ")); }
|
||||||
else { nPos += _stprintf(pBuffer+nPos,_T("%s"),_T("Unknown: ")); }
|
else { nPos += _stprintf(pBuffer + nPos, _T("%s"), _T("Unknown: ")); }
|
||||||
|
|
||||||
for (int i = 0; i < (int)m_Modules.size(); i++ )
|
for (int i = 0; i < (int)m_Modules.size(); i++)
|
||||||
{
|
{
|
||||||
if ((m_Modules[i]->GetTraceLevel() & Type) != 0)
|
if ((m_Modules[i]->GetTraceLevel() & Type) != 0)
|
||||||
{
|
{
|
||||||
|
@ -125,7 +125,7 @@ void CTraceLog::WriteTrace ( TraceType Type, LPCTSTR Message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int i = 0; i < (int)m_Modules.size(); i++ )
|
for (int i = 0; i < (int)m_Modules.size(); i++)
|
||||||
{
|
{
|
||||||
if ((m_Modules[i]->GetTraceLevel() & Type) != 0)
|
if ((m_Modules[i]->GetTraceLevel() & Type) != 0)
|
||||||
{
|
{
|
||||||
|
@ -134,23 +134,22 @@ void CTraceLog::WriteTrace ( TraceType Type, LPCTSTR Message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CTraceLog & GetTraceObjet(void)
|
||||||
CTraceLog & GetTraceObjet ( void )
|
|
||||||
{
|
{
|
||||||
static CTraceLog TraceLog;
|
static CTraceLog TraceLog;
|
||||||
return TraceLog;
|
return TraceLog;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WriteTrace (TraceType Type, LPCTSTR Message )
|
void WriteTrace(TraceType Type, LPCTSTR Message)
|
||||||
{
|
{
|
||||||
if (TraceClosed)
|
if (TraceClosed)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
GetTraceObjet().WriteTrace(Type,Message);
|
GetTraceObjet().WriteTrace(Type, Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WriteTraceF ( TraceType Type, LPCTSTR strFormat, ... )
|
void WriteTraceF(TraceType Type, LPCTSTR strFormat, ...)
|
||||||
{
|
{
|
||||||
if (TraceClosed)
|
if (TraceClosed)
|
||||||
{
|
{
|
||||||
|
@ -158,11 +157,11 @@ void WriteTraceF ( TraceType Type, LPCTSTR strFormat, ... )
|
||||||
}
|
}
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, strFormat);
|
va_start(args, strFormat);
|
||||||
GetTraceObjet().WriteTraceF(Type,strFormat,args);
|
GetTraceObjet().WriteTraceF(Type, strFormat, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
CTraceModule * AddTraceModule ( CTraceModule * TraceModule )
|
CTraceModule * AddTraceModule(CTraceModule * TraceModule)
|
||||||
{
|
{
|
||||||
if (TraceClosed)
|
if (TraceClosed)
|
||||||
{
|
{
|
||||||
|
@ -172,49 +171,49 @@ CTraceModule * AddTraceModule ( CTraceModule * TraceModule )
|
||||||
return TraceModule;
|
return TraceModule;
|
||||||
}
|
}
|
||||||
|
|
||||||
CTraceModule * RemoveTraceModule ( CTraceModule * TraceModule )
|
CTraceModule * RemoveTraceModule(CTraceModule * TraceModule)
|
||||||
{
|
{
|
||||||
return GetTraceObjet().RemoveTraceModule(TraceModule);
|
return GetTraceObjet().RemoveTraceModule(TraceModule);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CloseTrace ( void )
|
void CloseTrace(void)
|
||||||
{
|
{
|
||||||
TraceClosed = true;
|
TraceClosed = true;
|
||||||
GetTraceObjet().CloseTrace();
|
GetTraceObjet().CloseTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
CTraceFileLog::CTraceFileLog(LPCTSTR FileName, bool FlushFile ) :
|
CTraceFileLog::CTraceFileLog(LPCTSTR FileName, bool FlushFile) :
|
||||||
m_FlushFile(FlushFile)
|
m_FlushFile(FlushFile)
|
||||||
{
|
{
|
||||||
m_hLogFile.SetFlush(false);
|
m_hLogFile.SetFlush(false);
|
||||||
m_hLogFile.SetTruncateFile(true);
|
m_hLogFile.SetTruncateFile(true);
|
||||||
m_hLogFile.SetMaxFileSize(5 * MB);
|
m_hLogFile.SetMaxFileSize(5 * MB);
|
||||||
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 };
|
||||||
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTraceFileLog::Write(LPCTSTR Message, bool EndOfLine )
|
void CTraceFileLog::Write(LPCTSTR Message, bool EndOfLine)
|
||||||
{
|
{
|
||||||
if (!m_hLogFile.IsOpen()) { return; }
|
if (!m_hLogFile.IsOpen()) { return; }
|
||||||
|
|
||||||
|
@ -230,7 +229,16 @@ void CTraceFileLog::Write(LPCTSTR Message, bool EndOfLine )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTraceFileLog::SetFlushFile( bool bFlushFile )
|
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
|
||||||
|
};
|
|
@ -13,10 +13,10 @@
|
||||||
|
|
||||||
/* based on:
|
/* based on:
|
||||||
|
|
||||||
MD5.H - header file for MD5C.C
|
MD5.H - header file for MD5C.C
|
||||||
MDDRIVER.C - test driver for MD2, MD4 and MD5
|
MDDRIVER.C - test driver for MD2, MD4 and MD5
|
||||||
|
|
||||||
Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
|
Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
|
||||||
rights reserved.
|
rights reserved.
|
||||||
|
|
||||||
License to copy and use this software is granted provided that it
|
License to copy and use this software is granted provided that it
|
||||||
|
@ -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,36 +86,35 @@ 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
|
||||||
~MD5 ();
|
~MD5 ();
|
||||||
void update (const unsigned char *input, unsigned int input_length);
|
void update (const unsigned char *input, unsigned int input_length);
|
||||||
void update (FILE *file);
|
void update (FILE *file);
|
||||||
void finalize ();
|
void finalize ();
|
||||||
|
|
||||||
// constructors for special circumstances. All these constructors finalize
|
// constructors for special circumstances. All these constructors finalize
|
||||||
// the MD5 context.
|
// the MD5 context.
|
||||||
MD5 (CPath File); // digest File, finalize
|
MD5 (CPath File); // digest File, finalize
|
||||||
MD5 (const unsigned char *string); // digest string, finalize
|
MD5 (const unsigned char *string); // digest string, finalize
|
||||||
MD5 (FILE *file); // digest file, close, finalize
|
MD5 (FILE *file); // digest file, close, finalize
|
||||||
MD5 (const unsigned char *input, unsigned int input_length);
|
MD5 (const unsigned char *input, unsigned int input_length);
|
||||||
MD5 (const stdstr & string);
|
MD5 (const stdstr & string);
|
||||||
|
|
||||||
// methods to acquire finalized result
|
// methods to acquire finalized result
|
||||||
void get_digest(MD5Digest& extdigest); //Digest into a digest structure
|
void get_digest(MD5Digest& extdigest); //Digest into a digest structure
|
||||||
const unsigned char *raw_digest (); // digest as a 16-byte binary array
|
const unsigned char *raw_digest (); // digest as a 16-byte binary array
|
||||||
const char * hex_digest (); // digest as a 33-byte ascii-hex string
|
const char * hex_digest (); // digest as a 33-byte ascii-hex string
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// first, some types:
|
// first, some types:
|
||||||
typedef unsigned int uint4; // assumes integer is 4 words long
|
typedef unsigned int uint4; // assumes integer is 4 words long
|
||||||
typedef unsigned short int uint2; // assumes short integer is 2 words long
|
typedef unsigned short int uint2; // assumes short integer is 2 words long
|
||||||
typedef unsigned char uint1; // assumes char is 1 word long
|
typedef unsigned char uint1; // assumes char is 1 word long
|
||||||
|
|
||||||
// next, the private data:
|
// next, the private data:
|
||||||
uint4 state[4];
|
uint4 state[4];
|
||||||
uint4 count[2]; // number of *bits*, mod 2^64
|
uint4 count[2]; // number of *bits*, mod 2^64
|
||||||
uint1 buffer[64]; // input buffer
|
uint1 buffer[64]; // input buffer
|
||||||
|
@ -125,7 +122,7 @@ private:
|
||||||
uint1 finalized;
|
uint1 finalized;
|
||||||
stdstr m_hex_digest;
|
stdstr m_hex_digest;
|
||||||
|
|
||||||
// last, the private methods, mostly static:
|
// last, the private methods, mostly static:
|
||||||
void init (); // called by all constructors
|
void init (); // called by all constructors
|
||||||
void transform (uint1 *buffer); // does the real update work. Note
|
void transform (uint1 *buffer); // does the real update work. Note
|
||||||
// that length is implied to be 64.
|
// that length is implied to be 64.
|
||||||
|
@ -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
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
[Setup]
|
[Setup]
|
||||||
AppId={{BEB5FB69-4080-466F-96C4-F15DF271718B}
|
AppId={{BEB5FB69-4080-466F-96C4-F15DF271718B}
|
||||||
AppName=Project 64
|
AppName=Project64
|
||||||
AppVersion={#AppVersion}
|
AppVersion={#AppVersion}
|
||||||
DefaultDirName={pf}\Project64 2.2
|
DefaultDirName={pf}\Project64 2.2
|
||||||
VersionInfoVersion={#AppVersion}
|
VersionInfoVersion={#AppVersion}
|
||||||
|
@ -19,7 +19,7 @@ UninstallDisplayIcon={uninstallexe}
|
||||||
SetupIconFile={#BaseDir}\Source\Project64\User Interface\Icons\pj64.ico
|
SetupIconFile={#BaseDir}\Source\Project64\User Interface\Icons\pj64.ico
|
||||||
|
|
||||||
[Run]
|
[Run]
|
||||||
Filename: "{app}\Project64.exe"; Description: "{cm:LaunchProgram,{#StringChange('Project 64', '&', '&&')}}"; Flags: nowait postinstall skipifsilent
|
Filename: "{app}\Project64.exe"; Description: "{cm:LaunchProgram,{#StringChange('Project64', '&', '&&')}}"; Flags: nowait postinstall skipifsilent
|
||||||
|
|
||||||
[Files]
|
[Files]
|
||||||
Source: "{#BaseDir}\Bin\{#Configuration}\Project64.exe"; DestDir: "{app}"; Flags: ignoreversion
|
Source: "{#BaseDir}\Bin\{#Configuration}\Project64.exe"; DestDir: "{app}"; Flags: ignoreversion
|
||||||
|
@ -42,9 +42,9 @@ Name: "{app}\Screenshots"; Permissions: users-modify
|
||||||
Name: "{app}\Textures"; Permissions: users-modify
|
Name: "{app}\Textures"; Permissions: users-modify
|
||||||
|
|
||||||
[Icons]
|
[Icons]
|
||||||
Name: "{commonprograms}\Project 64 2.2\Project 64"; Filename: "{app}\Project64.exe"
|
Name: "{commonprograms}\Project64 2.2\Project64"; Filename: "{app}\Project64.exe"
|
||||||
Name: "{commonprograms}\Project 64 2.2\Uninstall Project64 2.2"; Filename: "{uninstallexe}"; Parameters: "/LOG"
|
Name: "{commonprograms}\Project64 2.2\Uninstall Project64 2.2"; Filename: "{uninstallexe}"; Parameters: "/LOG"
|
||||||
Name: "{commonprograms}\Project 64 2.2\Support"; Filename: "http://forum.pj64-emu.com"
|
Name: "{commonprograms}\Project64 2.2\Support"; Filename: "http://forum.pj64-emu.com"
|
||||||
|
|
||||||
[Code]
|
[Code]
|
||||||
function HaveCommandlineParam (inParam: String): Boolean;
|
function HaveCommandlineParam (inParam: String): Boolean;
|
||||||
|
|
|
@ -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;
|
||||||
|
};
|
|
@ -1,6 +1,6 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project 64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
|
@ -13,32 +13,32 @@
|
||||||
enum LanguageStringID{
|
enum LanguageStringID{
|
||||||
EMPTY_STRING = 0,
|
EMPTY_STRING = 0,
|
||||||
|
|
||||||
/*********************************************************************************
|
/*********************************************************************************
|
||||||
* Meta Information *
|
* Meta Information *
|
||||||
*********************************************************************************/
|
*********************************************************************************/
|
||||||
//About DLL
|
//About DLL
|
||||||
LANGUAGE_NAME = 1,
|
LANGUAGE_NAME = 1,
|
||||||
LANGUAGE_AUTHOR =2,
|
LANGUAGE_AUTHOR = 2,
|
||||||
LANGUAGE_VERSION =3,
|
LANGUAGE_VERSION = 3,
|
||||||
LANGUAGE_DATE =4,
|
LANGUAGE_DATE = 4,
|
||||||
|
|
||||||
//About DLL Dialog
|
//About DLL Dialog
|
||||||
INI_CURRENT_LANG =5,
|
INI_CURRENT_LANG = 5,
|
||||||
INI_AUTHOR =6,
|
INI_AUTHOR = 6,
|
||||||
INI_VERSION =7,
|
INI_VERSION = 7,
|
||||||
INI_DATE =8,
|
INI_DATE = 8,
|
||||||
INI_HOMEPAGE =9,
|
INI_HOMEPAGE = 9,
|
||||||
INI_CURRENT_RDB =10,
|
INI_CURRENT_RDB = 10,
|
||||||
INI_CURRENT_CHT =11,
|
INI_CURRENT_CHT = 11,
|
||||||
INI_CURRENT_RDX =12,
|
INI_CURRENT_RDX = 12,
|
||||||
|
|
||||||
//About INI title
|
//About INI title
|
||||||
INI_TITLE =20,
|
INI_TITLE = 20,
|
||||||
|
|
||||||
/*********************************************************************************
|
/*********************************************************************************
|
||||||
* Numbers *
|
* Numbers *
|
||||||
*********************************************************************************/
|
*********************************************************************************/
|
||||||
NUMBER_0 =50,
|
NUMBER_0 = 50,
|
||||||
NUMBER_1 = 51,
|
NUMBER_1 = 51,
|
||||||
NUMBER_2 = 52,
|
NUMBER_2 = 52,
|
||||||
NUMBER_3 = 53,
|
NUMBER_3 = 53,
|
||||||
|
@ -49,63 +49,63 @@ enum LanguageStringID{
|
||||||
NUMBER_8 = 58,
|
NUMBER_8 = 58,
|
||||||
NUMBER_9 = 59,
|
NUMBER_9 = 59,
|
||||||
|
|
||||||
/*********************************************************************************
|
/*********************************************************************************
|
||||||
* Menu *
|
* Menu *
|
||||||
*********************************************************************************/
|
*********************************************************************************/
|
||||||
//File Menu
|
//File Menu
|
||||||
MENU_FILE =100,
|
MENU_FILE = 100,
|
||||||
MENU_OPEN =101,
|
MENU_OPEN = 101,
|
||||||
MENU_ROM_INFO =102,
|
MENU_ROM_INFO = 102,
|
||||||
MENU_START =103,
|
MENU_START = 103,
|
||||||
MENU_END =104,
|
MENU_END = 104,
|
||||||
MENU_CHOOSE_ROM =105,
|
MENU_CHOOSE_ROM = 105,
|
||||||
MENU_REFRESH =106,
|
MENU_REFRESH = 106,
|
||||||
MENU_RECENT_ROM =107,
|
MENU_RECENT_ROM = 107,
|
||||||
MENU_RECENT_DIR =108,
|
MENU_RECENT_DIR = 108,
|
||||||
MENU_EXIT =109,
|
MENU_EXIT = 109,
|
||||||
|
|
||||||
//System Menu
|
//System Menu
|
||||||
MENU_SYSTEM =120,
|
MENU_SYSTEM = 120,
|
||||||
MENU_RESET =121,
|
MENU_RESET = 121,
|
||||||
MENU_PAUSE =122,
|
MENU_PAUSE = 122,
|
||||||
MENU_BITMAP =123,
|
MENU_BITMAP = 123,
|
||||||
MENU_LIMIT_FPS =124,
|
MENU_LIMIT_FPS = 124,
|
||||||
MENU_SAVE =125,
|
MENU_SAVE = 125,
|
||||||
MENU_SAVE_AS =126,
|
MENU_SAVE_AS = 126,
|
||||||
MENU_RESTORE =127,
|
MENU_RESTORE = 127,
|
||||||
MENU_LOAD =128,
|
MENU_LOAD = 128,
|
||||||
MENU_CURRENT_SAVE =129,
|
MENU_CURRENT_SAVE = 129,
|
||||||
MENU_CHEAT =130,
|
MENU_CHEAT = 130,
|
||||||
MENU_GS_BUTTON =131,
|
MENU_GS_BUTTON = 131,
|
||||||
MENU_RESUME =132,
|
MENU_RESUME = 132,
|
||||||
MENU_RESET_SOFT =133, //added in build 1.7.50
|
MENU_RESET_SOFT = 133, //added in build 1.7.50
|
||||||
MENU_RESET_HARD =134, //added in build 1.7.50
|
MENU_RESET_HARD = 134, //added in build 1.7.50
|
||||||
|
|
||||||
//Options Menu
|
//Options Menu
|
||||||
MENU_OPTIONS = 140,
|
MENU_OPTIONS = 140,
|
||||||
MENU_FULL_SCREEN= 141,
|
MENU_FULL_SCREEN = 141,
|
||||||
MENU_ON_TOP = 142,
|
MENU_ON_TOP = 142,
|
||||||
MENU_CONFG_GFX = 143,
|
MENU_CONFG_GFX = 143,
|
||||||
MENU_CONFG_AUDIO= 144,
|
MENU_CONFG_AUDIO = 144,
|
||||||
MENU_CONFG_CTRL = 145,
|
MENU_CONFG_CTRL = 145,
|
||||||
MENU_CONFG_RSP = 146,
|
MENU_CONFG_RSP = 146,
|
||||||
MENU_SHOW_CPU = 147,
|
MENU_SHOW_CPU = 147,
|
||||||
MENU_SETTINGS = 148,
|
MENU_SETTINGS = 148,
|
||||||
|
|
||||||
//Debugger Menu
|
//Debugger Menu
|
||||||
MENU_DEBUGGER = 160,
|
MENU_DEBUGGER = 160,
|
||||||
|
|
||||||
//Language Menu
|
//Language Menu
|
||||||
MENU_LANGUAGE = 175,
|
MENU_LANGUAGE = 175,
|
||||||
|
|
||||||
//Help Menu
|
//Help Menu
|
||||||
MENU_HELP = 180,
|
MENU_HELP = 180,
|
||||||
MENU_ABOUT_INI = 181,
|
MENU_ABOUT_INI = 181,
|
||||||
MENU_ABOUT_PJ64 = 182,
|
MENU_ABOUT_PJ64 = 182,
|
||||||
MENU_FORUM = 183,
|
MENU_FORUM = 183,
|
||||||
MENU_HOMEPAGE = 184,
|
MENU_HOMEPAGE = 184,
|
||||||
|
|
||||||
//Current Save Slot menu
|
//Current Save Slot menu
|
||||||
MENU_SLOT_DEFAULT = 190,
|
MENU_SLOT_DEFAULT = 190,
|
||||||
MENU_SLOT_1 = 191,
|
MENU_SLOT_1 = 191,
|
||||||
MENU_SLOT_2 = 192,
|
MENU_SLOT_2 = 192,
|
||||||
|
@ -117,15 +117,16 @@ 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,
|
||||||
POPUP_INFO = 211,
|
POPUP_INFO = 211,
|
||||||
POPUP_SETTINGS = 212,
|
POPUP_SETTINGS = 212,
|
||||||
POPUP_CHEATS = 213,
|
POPUP_CHEATS = 213,
|
||||||
POPUP_GFX_PLUGIN = 214,
|
POPUP_GFX_PLUGIN = 214,
|
||||||
|
|
||||||
//selecting save slot
|
//selecting save slot
|
||||||
SAVE_SLOT_DEFAULT = 220,
|
SAVE_SLOT_DEFAULT = 220,
|
||||||
SAVE_SLOT_1 = 221,
|
SAVE_SLOT_1 = 221,
|
||||||
SAVE_SLOT_2 = 222,
|
SAVE_SLOT_2 = 222,
|
||||||
|
@ -138,7 +139,7 @@ enum LanguageStringID{
|
||||||
SAVE_SLOT_9 = 229,
|
SAVE_SLOT_9 = 229,
|
||||||
SAVE_SLOT_10 = 230,
|
SAVE_SLOT_10 = 230,
|
||||||
|
|
||||||
// Menu Descriptions (TODO: unused ? implement or remove)
|
// Menu Descriptions (TODO: unused ? implement or remove)
|
||||||
MENUDES_OPEN = 250,
|
MENUDES_OPEN = 250,
|
||||||
MENUDES_ROM_INFO = 251,
|
MENUDES_ROM_INFO = 251,
|
||||||
MENUDES_START = 252,
|
MENUDES_START = 252,
|
||||||
|
@ -174,13 +175,13 @@ enum LanguageStringID{
|
||||||
MENUDES_GAME_SLOT = 282,
|
MENUDES_GAME_SLOT = 282,
|
||||||
MENUDES_PLAY_GAME = 283,
|
MENUDES_PLAY_GAME = 283,
|
||||||
MENUDES_GAME_INFO = 284,
|
MENUDES_GAME_INFO = 284,
|
||||||
MENUDES_GAME_SETTINGS= 285,
|
MENUDES_GAME_SETTINGS = 285,
|
||||||
MENUDES_GAME_CHEATS = 286,
|
MENUDES_GAME_CHEATS = 286,
|
||||||
|
|
||||||
/*********************************************************************************
|
/*********************************************************************************
|
||||||
* Rom Browser *
|
* Rom Browser *
|
||||||
*********************************************************************************/
|
*********************************************************************************/
|
||||||
//Rom Browser Fields
|
//Rom Browser Fields
|
||||||
RB_FILENAME = 300,
|
RB_FILENAME = 300,
|
||||||
RB_INTERNALNAME = 301,
|
RB_INTERNALNAME = 301,
|
||||||
RB_GOODNAME = 302,
|
RB_GOODNAME = 302,
|
||||||
|
@ -202,32 +203,32 @@ enum LanguageStringID{
|
||||||
RB_FORCE_FEEDBACK = 318,
|
RB_FORCE_FEEDBACK = 318,
|
||||||
RB_FILE_FORMAT = 319,
|
RB_FILE_FORMAT = 319,
|
||||||
|
|
||||||
//Select Rom
|
//Select Rom
|
||||||
SELECT_ROM_DIR = 320,
|
SELECT_ROM_DIR = 320,
|
||||||
|
|
||||||
//Messages
|
//Messages
|
||||||
RB_NOT_GOOD_FILE = 340,
|
RB_NOT_GOOD_FILE = 340,
|
||||||
|
|
||||||
/*********************************************************************************
|
/*********************************************************************************
|
||||||
* Options *
|
* Options *
|
||||||
*********************************************************************************/
|
*********************************************************************************/
|
||||||
//Options Title
|
//Options Title
|
||||||
OPTIONS_TITLE = 400,
|
OPTIONS_TITLE = 400,
|
||||||
|
|
||||||
//Tabs
|
//Tabs
|
||||||
TAB_PLUGIN = 401,
|
TAB_PLUGIN = 401,
|
||||||
TAB_DIRECTORY = 402,
|
TAB_DIRECTORY = 402,
|
||||||
TAB_OPTIONS = 403,
|
TAB_OPTIONS = 403,
|
||||||
TAB_ROMSELECTION = 404,
|
TAB_ROMSELECTION = 404,
|
||||||
TAB_ADVANCED = 405,
|
TAB_ADVANCED = 405,
|
||||||
TAB_ROMSETTINGS = 406,
|
TAB_ROMSETTINGS = 406,
|
||||||
TAB_SHELLINTERGATION= 407,
|
TAB_SHELLINTERGATION = 407,
|
||||||
TAB_ROMNOTES = 408,
|
TAB_ROMNOTES = 408,
|
||||||
TAB_SHORTCUTS = 409,
|
TAB_SHORTCUTS = 409,
|
||||||
TAB_ROMSTATUS = 410,
|
TAB_ROMSTATUS = 410,
|
||||||
TAB_RECOMPILER = 411, //Added in 1.7.0.50
|
TAB_RECOMPILER = 411, //Added in 1.7.0.50
|
||||||
|
|
||||||
//Plugin Dialog
|
//Plugin Dialog
|
||||||
PLUG_ABOUT = 420,
|
PLUG_ABOUT = 420,
|
||||||
PLUG_RSP = 421,
|
PLUG_RSP = 421,
|
||||||
PLUG_GFX = 422,
|
PLUG_GFX = 422,
|
||||||
|
@ -237,7 +238,7 @@ enum LanguageStringID{
|
||||||
PLUG_HLE_AUDIO = 426,
|
PLUG_HLE_AUDIO = 426,
|
||||||
PLUG_DEFAULT = 427,
|
PLUG_DEFAULT = 427,
|
||||||
|
|
||||||
//Directory Dialog
|
//Directory Dialog
|
||||||
DIR_PLUGIN = 440,
|
DIR_PLUGIN = 440,
|
||||||
DIR_ROM = 441,
|
DIR_ROM = 441,
|
||||||
DIR_AUTO_SAVE = 442,
|
DIR_AUTO_SAVE = 442,
|
||||||
|
@ -252,17 +253,17 @@ enum LanguageStringID{
|
||||||
DIR_TEXTURE = 451,
|
DIR_TEXTURE = 451,
|
||||||
DIR_SELECT_TEXTURE = 452,
|
DIR_SELECT_TEXTURE = 452,
|
||||||
|
|
||||||
//Options (general) Tab
|
//Options (general) Tab
|
||||||
OPTION_AUTO_SLEEP =460,
|
OPTION_AUTO_SLEEP = 460,
|
||||||
OPTION_AUTO_FULLSCREEN =461,
|
OPTION_AUTO_FULLSCREEN = 461,
|
||||||
OPTION_BASIC_MODE =462,
|
OPTION_BASIC_MODE = 462,
|
||||||
OPTION_REMEMBER_CHEAT =463,
|
OPTION_REMEMBER_CHEAT = 463,
|
||||||
OPTION_DISABLE_SS =464,
|
OPTION_DISABLE_SS = 464,
|
||||||
OPTION_DISPLAY_FR =465,
|
OPTION_DISPLAY_FR = 465,
|
||||||
OPTION_CHANGE_FR =466,
|
OPTION_CHANGE_FR = 466,
|
||||||
OPTION_CHECK_RUNNING =467,
|
OPTION_CHECK_RUNNING = 467,
|
||||||
|
|
||||||
//Rom Browser Tab
|
//Rom Browser Tab
|
||||||
RB_MAX_ROMS = 480,
|
RB_MAX_ROMS = 480,
|
||||||
RB_ROMS = 481,
|
RB_ROMS = 481,
|
||||||
RB_MAX_DIRS = 482,
|
RB_MAX_DIRS = 482,
|
||||||
|
@ -277,7 +278,7 @@ enum LanguageStringID{
|
||||||
RB_DOWN = 491,
|
RB_DOWN = 491,
|
||||||
RB_REFRESH = 492,
|
RB_REFRESH = 492,
|
||||||
|
|
||||||
//Advanced Options
|
//Advanced Options
|
||||||
ADVANCE_INFO = 500,
|
ADVANCE_INFO = 500,
|
||||||
ADVANCE_DEFAULTS = 501,
|
ADVANCE_DEFAULTS = 501,
|
||||||
ADVANCE_CPU_STYLE = 502,
|
ADVANCE_CPU_STYLE = 502,
|
||||||
|
@ -290,11 +291,11 @@ enum LanguageStringID{
|
||||||
ADVANCE_DEBUGGER = 509,
|
ADVANCE_DEBUGGER = 509,
|
||||||
ADVANCE_SMM_CACHE = 510,
|
ADVANCE_SMM_CACHE = 510,
|
||||||
ADVANCE_SMM_PIDMA = 511,
|
ADVANCE_SMM_PIDMA = 511,
|
||||||
ADVANCE_SMM_VALIDATE= 512,
|
ADVANCE_SMM_VALIDATE = 512,
|
||||||
ADVANCE_SMM_PROTECT = 513,
|
ADVANCE_SMM_PROTECT = 513,
|
||||||
ADVANCE_SMM_TLB = 514,
|
ADVANCE_SMM_TLB = 514,
|
||||||
|
|
||||||
//Rom Options
|
//Rom Options
|
||||||
ROM_CPU_STYLE = 520,
|
ROM_CPU_STYLE = 520,
|
||||||
ROM_VIREFRESH = 521,
|
ROM_VIREFRESH = 521,
|
||||||
ROM_MEM_SIZE = 522,
|
ROM_MEM_SIZE = 522,
|
||||||
|
@ -316,12 +317,12 @@ enum LanguageStringID{
|
||||||
ROM_32BIT = 538,
|
ROM_32BIT = 538,
|
||||||
ROM_DELAY_DP = 539,
|
ROM_DELAY_DP = 539,
|
||||||
|
|
||||||
//Core Styles
|
//Core Styles
|
||||||
CORE_INTERPTER = 540,
|
CORE_INTERPTER = 540,
|
||||||
CORE_RECOMPILER = 541,
|
CORE_RECOMPILER = 541,
|
||||||
CORE_SYNC = 542,
|
CORE_SYNC = 542,
|
||||||
|
|
||||||
//Self Mod Methods
|
//Self Mod Methods
|
||||||
SMCM_NONE = 560,
|
SMCM_NONE = 560,
|
||||||
SMCM_CACHE = 561,
|
SMCM_CACHE = 561,
|
||||||
SMCM_PROECTED = 562,
|
SMCM_PROECTED = 562,
|
||||||
|
@ -330,35 +331,35 @@ enum LanguageStringID{
|
||||||
SMCM_CHECK_ADV = 565,
|
SMCM_CHECK_ADV = 565,
|
||||||
SMCM_CACHE2 = 566,
|
SMCM_CACHE2 = 566,
|
||||||
|
|
||||||
//Function Lookup memthod
|
//Function Lookup memthod
|
||||||
FLM_PLOOKUP = 570,
|
FLM_PLOOKUP = 570,
|
||||||
FLM_VLOOKUP = 571,
|
FLM_VLOOKUP = 571,
|
||||||
FLM_CHANGEMEM = 572,
|
FLM_CHANGEMEM = 572,
|
||||||
|
|
||||||
//RDRAM Size
|
//RDRAM Size
|
||||||
RDRAM_4MB = 580,
|
RDRAM_4MB = 580,
|
||||||
RDRAM_8MB = 581,
|
RDRAM_8MB = 581,
|
||||||
|
|
||||||
//Advanced Block Linking
|
//Advanced Block Linking
|
||||||
ABL_ON = 600,
|
ABL_ON = 600,
|
||||||
ABL_OFF = 601,
|
ABL_OFF = 601,
|
||||||
|
|
||||||
//Save Type
|
//Save Type
|
||||||
SAVE_FIRST_USED = 620,
|
SAVE_FIRST_USED = 620,
|
||||||
SAVE_4K_EEPROM = 621,
|
SAVE_4K_EEPROM = 621,
|
||||||
SAVE_16K_EEPROM = 622,
|
SAVE_16K_EEPROM = 622,
|
||||||
SAVE_SRAM = 623,
|
SAVE_SRAM = 623,
|
||||||
SAVE_FLASHRAM = 624,
|
SAVE_FLASHRAM = 624,
|
||||||
|
|
||||||
//Shell Integration Tab
|
//Shell Integration Tab
|
||||||
SHELL_TEXT = 640,
|
SHELL_TEXT = 640,
|
||||||
|
|
||||||
//Rom Notes
|
//Rom Notes
|
||||||
NOTE_STATUS = 660,
|
NOTE_STATUS = 660,
|
||||||
NOTE_CORE = 661,
|
NOTE_CORE = 661,
|
||||||
NOTE_PLUGIN = 662,
|
NOTE_PLUGIN = 662,
|
||||||
|
|
||||||
// Accelerator Selector
|
// Accelerator Selector
|
||||||
ACCEL_CPUSTATE_TITLE = 680,
|
ACCEL_CPUSTATE_TITLE = 680,
|
||||||
ACCEL_MENUITEM_TITLE = 681,
|
ACCEL_MENUITEM_TITLE = 681,
|
||||||
ACCEL_CURRENTKEYS_TITLE = 682,
|
ACCEL_CURRENTKEYS_TITLE = 682,
|
||||||
|
@ -373,90 +374,90 @@ enum LanguageStringID{
|
||||||
ACCEL_CPUSTATE_4 = 691,
|
ACCEL_CPUSTATE_4 = 691,
|
||||||
ACCEL_DETECTKEY = 692,
|
ACCEL_DETECTKEY = 692,
|
||||||
|
|
||||||
// Frame Rate Option
|
// Frame Rate Option
|
||||||
STR_FR_VIS = 700,
|
STR_FR_VIS = 700,
|
||||||
STR_FR_DLS = 701,
|
STR_FR_DLS = 701,
|
||||||
STR_FR_PERCENT = 702,
|
STR_FR_PERCENT = 702,
|
||||||
|
|
||||||
// Increase speed
|
// Increase speed
|
||||||
STR_INSREASE_SPEED = 710,
|
STR_INSREASE_SPEED = 710,
|
||||||
STR_DECREASE_SPEED = 711,
|
STR_DECREASE_SPEED = 711,
|
||||||
|
|
||||||
//Bottom page buttons
|
//Bottom page buttons
|
||||||
BOTTOM_RESET_PAGE = 720,
|
BOTTOM_RESET_PAGE = 720,
|
||||||
BOTTOM_RESET_ALL = 721,
|
BOTTOM_RESET_ALL = 721,
|
||||||
BOTTOM_APPLY = 722,
|
BOTTOM_APPLY = 722,
|
||||||
BOTTOM_CLOSE = 723,
|
BOTTOM_CLOSE = 723,
|
||||||
|
|
||||||
/*********************************************************************************
|
/*********************************************************************************
|
||||||
* ROM Information *
|
* ROM Information *
|
||||||
*********************************************************************************/
|
*********************************************************************************/
|
||||||
//Rom Info Title Title
|
//Rom Info Title Title
|
||||||
INFO_TITLE = 800,
|
INFO_TITLE = 800,
|
||||||
|
|
||||||
//Rom Info Text
|
//Rom Info Text
|
||||||
INFO_ROM_NAME_TEXT = 801,
|
INFO_ROM_NAME_TEXT = 801,
|
||||||
INFO_FILE_NAME_TEXT = 802,
|
INFO_FILE_NAME_TEXT = 802,
|
||||||
INFO_LOCATION_TEXT = 803,
|
INFO_LOCATION_TEXT = 803,
|
||||||
INFO_SIZE_TEXT = 804,
|
INFO_SIZE_TEXT = 804,
|
||||||
INFO_CART_ID_TEXT = 805,
|
INFO_CART_ID_TEXT = 805,
|
||||||
INFO_MANUFACTURER_TEXT= 806,
|
INFO_MANUFACTURER_TEXT = 806,
|
||||||
INFO_COUNTRY_TEXT = 807,
|
INFO_COUNTRY_TEXT = 807,
|
||||||
INFO_CRC1_TEXT = 808,
|
INFO_CRC1_TEXT = 808,
|
||||||
INFO_CRC2_TEXT = 809,
|
INFO_CRC2_TEXT = 809,
|
||||||
INFO_CIC_CHIP_TEXT = 810,
|
INFO_CIC_CHIP_TEXT = 810,
|
||||||
INFO_MD5_TEXT = 811,
|
INFO_MD5_TEXT = 811,
|
||||||
|
|
||||||
/*********************************************************************************
|
/*********************************************************************************
|
||||||
* Cheats *
|
* Cheats *
|
||||||
*********************************************************************************/
|
*********************************************************************************/
|
||||||
//Cheat List
|
//Cheat List
|
||||||
CHEAT_TITLE = 1000,
|
CHEAT_TITLE = 1000,
|
||||||
CHEAT_LIST_FRAME = 1001,
|
CHEAT_LIST_FRAME = 1001,
|
||||||
CHEAT_NOTES_FRAME = 1002,
|
CHEAT_NOTES_FRAME = 1002,
|
||||||
CHEAT_MARK_ALL = 1003,
|
CHEAT_MARK_ALL = 1003,
|
||||||
CHEAT_MARK_NONE = 1004,
|
CHEAT_MARK_NONE = 1004,
|
||||||
|
|
||||||
//Add Cheat
|
//Add Cheat
|
||||||
CHEAT_ADDCHEAT_FRAME =1005,
|
CHEAT_ADDCHEAT_FRAME = 1005,
|
||||||
CHEAT_ADDCHEAT_NAME =1006,
|
CHEAT_ADDCHEAT_NAME = 1006,
|
||||||
CHEAT_ADDCHEAT_CODE = 1007,
|
CHEAT_ADDCHEAT_CODE = 1007,
|
||||||
CHEAT_ADDCHEAT_INSERT= 1008,
|
CHEAT_ADDCHEAT_INSERT = 1008,
|
||||||
CHEAT_ADDCHEAT_CLEAR= 1009,
|
CHEAT_ADDCHEAT_CLEAR = 1009,
|
||||||
CHEAT_ADDCHEAT_NOTES= 1010,
|
CHEAT_ADDCHEAT_NOTES = 1010,
|
||||||
CHEAT_ADD_TO_DB = 1011,
|
CHEAT_ADD_TO_DB = 1011,
|
||||||
|
|
||||||
//Code extension
|
//Code extension
|
||||||
CHEAT_CODE_EXT_TITLE =1012,
|
CHEAT_CODE_EXT_TITLE = 1012,
|
||||||
CHEAT_CODE_EXT_TXT =1013,
|
CHEAT_CODE_EXT_TXT = 1013,
|
||||||
CHEAT_OK =1014,
|
CHEAT_OK = 1014,
|
||||||
CHEAT_CANCEL =1015,
|
CHEAT_CANCEL = 1015,
|
||||||
|
|
||||||
//Digital Value
|
//Digital Value
|
||||||
CHEAT_QUANTITY_TITLE =1016,
|
CHEAT_QUANTITY_TITLE = 1016,
|
||||||
CHEAT_CHOOSE_VALUE =1017,
|
CHEAT_CHOOSE_VALUE = 1017,
|
||||||
CHEAT_VALUE =1018,
|
CHEAT_VALUE = 1018,
|
||||||
CHEAT_FROM =1019,
|
CHEAT_FROM = 1019,
|
||||||
CHEAT_TO =1020,
|
CHEAT_TO = 1020,
|
||||||
CHEAT_NOTES =1021,
|
CHEAT_NOTES = 1021,
|
||||||
CHEAT_ADDCHEAT_ADD = 1022,
|
CHEAT_ADDCHEAT_ADD = 1022,
|
||||||
CHEAT_ADDCHEAT_NEW = 1023,
|
CHEAT_ADDCHEAT_NEW = 1023,
|
||||||
CHEAT_ADDCHEAT_CODEDES =1024,
|
CHEAT_ADDCHEAT_CODEDES = 1024,
|
||||||
CHEAT_ADDCHEAT_OPT =1025,
|
CHEAT_ADDCHEAT_OPT = 1025,
|
||||||
CHEAT_ADDCHEAT_OPTDES =1026,
|
CHEAT_ADDCHEAT_OPTDES = 1026,
|
||||||
|
|
||||||
//Edit Cheat
|
//Edit Cheat
|
||||||
CHEAT_EDITCHEAT_WINDOW =1027,
|
CHEAT_EDITCHEAT_WINDOW = 1027,
|
||||||
CHEAT_EDITCHEAT_UPDATE =1028,
|
CHEAT_EDITCHEAT_UPDATE = 1028,
|
||||||
CHEAT_CHANGED_MSG =1029,
|
CHEAT_CHANGED_MSG = 1029,
|
||||||
CHEAT_CHANGED_TITLE =1030,
|
CHEAT_CHANGED_TITLE = 1030,
|
||||||
|
|
||||||
//Cheat Popup Menu
|
//Cheat Popup Menu
|
||||||
CHEAT_ADDNEW =1040,
|
CHEAT_ADDNEW = 1040,
|
||||||
CHEAT_EDIT = 1041,
|
CHEAT_EDIT = 1041,
|
||||||
CHEAT_DELETE = 1042,
|
CHEAT_DELETE = 1042,
|
||||||
|
|
||||||
// short cut editor
|
// short cut editor
|
||||||
STR_SHORTCUT_RESET_TITLE = 1100,
|
STR_SHORTCUT_RESET_TITLE = 1100,
|
||||||
STR_SHORTCUT_RESET_TEXT = 1101,
|
STR_SHORTCUT_RESET_TEXT = 1101,
|
||||||
STR_SHORTCUT_FILEMENU = 1102,
|
STR_SHORTCUT_FILEMENU = 1102,
|
||||||
|
@ -464,9 +465,9 @@ enum LanguageStringID{
|
||||||
STR_SHORTCUT_OPTIONS = 1104,
|
STR_SHORTCUT_OPTIONS = 1104,
|
||||||
STR_SHORTCUT_SAVESLOT = 1105,
|
STR_SHORTCUT_SAVESLOT = 1105,
|
||||||
|
|
||||||
/*********************************************************************************
|
/*********************************************************************************
|
||||||
* Messages *
|
* Messages *
|
||||||
*********************************************************************************/
|
*********************************************************************************/
|
||||||
MSG_CPU_PAUSED = 2000,
|
MSG_CPU_PAUSED = 2000,
|
||||||
MSG_CPU_RESUMED = 2001,
|
MSG_CPU_RESUMED = 2001,
|
||||||
MSG_PERM_LOOP = 2002,
|
MSG_PERM_LOOP = 2002,
|
||||||
|
@ -487,23 +488,23 @@ enum LanguageStringID{
|
||||||
MSG_FAIL_IMAGE = 2017,
|
MSG_FAIL_IMAGE = 2017,
|
||||||
MSG_UNKNOWN_COUNTRY = 2018,
|
MSG_UNKNOWN_COUNTRY = 2018,
|
||||||
MSG_UNKNOWN_CIC_CHIP = 2019,
|
MSG_UNKNOWN_CIC_CHIP = 2019,
|
||||||
MSG_UNKNOWN_FILE_FORMAT= 2020,
|
MSG_UNKNOWN_FILE_FORMAT = 2020,
|
||||||
MSG_UNKNOWN_MEM_ACTION = 2021,
|
MSG_UNKNOWN_MEM_ACTION = 2021,
|
||||||
MSG_UNHANDLED_OP = 2022,
|
MSG_UNHANDLED_OP = 2022,
|
||||||
MSG_NONMAPPED_SPACE = 2023,
|
MSG_NONMAPPED_SPACE = 2023,
|
||||||
MSG_SAVE_STATE_HEADER = 2024,
|
MSG_SAVE_STATE_HEADER = 2024,
|
||||||
MSG_MSGBOX_TITLE =2025,
|
MSG_MSGBOX_TITLE = 2025,
|
||||||
MSG_PIF2_ERROR = 2026,
|
MSG_PIF2_ERROR = 2026,
|
||||||
MSG_PIF2_TITLE = 2027,
|
MSG_PIF2_TITLE = 2027,
|
||||||
MSG_PLUGIN_CHANGE = 2028,
|
MSG_PLUGIN_CHANGE = 2028,
|
||||||
MSG_PLUGIN_CHANGE_TITLE= 2029,
|
MSG_PLUGIN_CHANGE_TITLE = 2029,
|
||||||
MSG_EMULATION_ENDED = 2030,
|
MSG_EMULATION_ENDED = 2030,
|
||||||
MSG_EMULATION_STARTED = 2031,
|
MSG_EMULATION_STARTED = 2031,
|
||||||
MSG_UNABLED_LOAD_STATE = 2032,
|
MSG_UNABLED_LOAD_STATE = 2032,
|
||||||
MSG_LOADED_STATE = 2033,
|
MSG_LOADED_STATE = 2033,
|
||||||
MSG_SAVED_STATE = 2034,
|
MSG_SAVED_STATE = 2034,
|
||||||
MSG_SAVE_SLOT = 2035,
|
MSG_SAVE_SLOT = 2035,
|
||||||
MSG_BYTESWAP =2036,
|
MSG_BYTESWAP = 2036,
|
||||||
MSG_CHOOSE_IMAGE = 2037,
|
MSG_CHOOSE_IMAGE = 2037,
|
||||||
MSG_LOADED = 2038,
|
MSG_LOADED = 2038,
|
||||||
MSG_LOADING = 2039,
|
MSG_LOADING = 2039,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project 64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
|
@ -14,182 +14,183 @@
|
||||||
|
|
||||||
CLanguage * g_Lang = NULL;
|
CLanguage * g_Lang = NULL;
|
||||||
|
|
||||||
void CLanguage::LoadDefaultStrings (void)
|
void CLanguage::LoadDefaultStrings(void)
|
||||||
{
|
{
|
||||||
#define DEF_STR(ID,str) m_DefaultStrings.insert(LANG_STRINGS::value_type(ID,str))
|
#define DEF_STR(ID,str) m_DefaultStrings.insert(LANG_STRINGS::value_type(ID,str))
|
||||||
|
|
||||||
DEF_STR(EMPTY_STRING, L"" );
|
DEF_STR(EMPTY_STRING, L"");
|
||||||
|
|
||||||
/*********************************************************************************
|
/*********************************************************************************
|
||||||
* Meta Information *
|
* Meta Information *
|
||||||
*********************************************************************************/
|
*********************************************************************************/
|
||||||
//About DLL
|
//About DLL
|
||||||
DEF_STR(LANGUAGE_NAME, L"" );
|
DEF_STR(LANGUAGE_NAME, L"");
|
||||||
DEF_STR(LANGUAGE_AUTHOR, L"" );
|
DEF_STR(LANGUAGE_AUTHOR, L"");
|
||||||
DEF_STR(LANGUAGE_VERSION, L"" );
|
DEF_STR(LANGUAGE_VERSION, L"");
|
||||||
DEF_STR(LANGUAGE_DATE, L"" );
|
DEF_STR(LANGUAGE_DATE, L"");
|
||||||
|
|
||||||
//About DLL Dialog
|
//About DLL Dialog
|
||||||
DEF_STR(INI_CURRENT_LANG, L"Current Language" );
|
DEF_STR(INI_CURRENT_LANG, L"Current Language");
|
||||||
DEF_STR(INI_AUTHOR, L"Author" );
|
DEF_STR(INI_AUTHOR, L"Author");
|
||||||
DEF_STR(INI_VERSION, L"Version" );
|
DEF_STR(INI_VERSION, L"Version");
|
||||||
DEF_STR(INI_DATE, L"Date" );
|
DEF_STR(INI_DATE, L"Date");
|
||||||
DEF_STR(INI_HOMEPAGE, L"Visit Home Page" );
|
DEF_STR(INI_HOMEPAGE, L"Visit Home Page");
|
||||||
DEF_STR(INI_CURRENT_RDB, L"ROM Database (.RDB)" );
|
DEF_STR(INI_CURRENT_RDB, L"ROM Database (.RDB)");
|
||||||
DEF_STR(INI_CURRENT_CHT, L"Cheat Code File (.CHT)" );
|
DEF_STR(INI_CURRENT_CHT, L"Cheat Code File (.CHT)");
|
||||||
DEF_STR(INI_CURRENT_RDX, L"Extended ROM Info (.RDX)");
|
DEF_STR(INI_CURRENT_RDX, L"Extended ROM Info (.RDX)");
|
||||||
|
|
||||||
//About INI title
|
//About INI title
|
||||||
DEF_STR(INI_TITLE, L"About Config Files" );
|
DEF_STR(INI_TITLE, L"About Config Files");
|
||||||
|
|
||||||
/*********************************************************************************
|
/*********************************************************************************
|
||||||
* Numbers *
|
* Numbers *
|
||||||
*********************************************************************************/
|
*********************************************************************************/
|
||||||
DEF_STR(NUMBER_0, L"0" );
|
DEF_STR(NUMBER_0, L"0");
|
||||||
DEF_STR(NUMBER_1, L"1" );
|
DEF_STR(NUMBER_1, L"1");
|
||||||
DEF_STR(NUMBER_2, L"2" );
|
DEF_STR(NUMBER_2, L"2");
|
||||||
DEF_STR(NUMBER_3, L"3" );
|
DEF_STR(NUMBER_3, L"3");
|
||||||
DEF_STR(NUMBER_4, L"4" ),
|
DEF_STR(NUMBER_4, L"4"),
|
||||||
DEF_STR(NUMBER_5, L"5" );
|
DEF_STR(NUMBER_5, L"5");
|
||||||
DEF_STR(NUMBER_6, L"6" );
|
DEF_STR(NUMBER_6, L"6");
|
||||||
DEF_STR(NUMBER_7, L"7" );
|
DEF_STR(NUMBER_7, L"7");
|
||||||
DEF_STR(NUMBER_8, L"8" );
|
DEF_STR(NUMBER_8, L"8");
|
||||||
DEF_STR(NUMBER_9, L"9" );
|
DEF_STR(NUMBER_9, L"9");
|
||||||
|
|
||||||
/*********************************************************************************
|
/*********************************************************************************
|
||||||
* Menu *
|
* Menu *
|
||||||
*********************************************************************************/
|
*********************************************************************************/
|
||||||
//File Menu
|
//File Menu
|
||||||
DEF_STR(MENU_FILE, L"&File" );
|
DEF_STR(MENU_FILE, L"&File");
|
||||||
DEF_STR(MENU_OPEN, L"&Open ROM" );
|
DEF_STR(MENU_OPEN, L"&Open ROM");
|
||||||
DEF_STR(MENU_ROM_INFO, L"ROM &Info...." );
|
DEF_STR(MENU_ROM_INFO, L"ROM &Info....");
|
||||||
DEF_STR(MENU_START, L"Start Emulation" );
|
DEF_STR(MENU_START, L"Start Emulation");
|
||||||
DEF_STR(MENU_END, L"&End Emulation" );
|
DEF_STR(MENU_END, L"&End Emulation");
|
||||||
DEF_STR(MENU_CHOOSE_ROM, L"Choose ROM Directory..." );
|
DEF_STR(MENU_CHOOSE_ROM, L"Choose ROM Directory...");
|
||||||
DEF_STR(MENU_REFRESH, L"Refresh ROM List" );
|
DEF_STR(MENU_REFRESH, L"Refresh ROM List");
|
||||||
DEF_STR(MENU_RECENT_ROM, L"Recent ROM" );
|
DEF_STR(MENU_RECENT_ROM, L"Recent ROM");
|
||||||
DEF_STR(MENU_RECENT_DIR, L"Recent ROM Directories" );
|
DEF_STR(MENU_RECENT_DIR, L"Recent ROM Directories");
|
||||||
DEF_STR(MENU_EXIT, L"E&xit" );
|
DEF_STR(MENU_EXIT, L"E&xit");
|
||||||
|
|
||||||
//System Menu
|
//System Menu
|
||||||
DEF_STR(MENU_SYSTEM, L"&System" );
|
DEF_STR(MENU_SYSTEM, L"&System");
|
||||||
DEF_STR(MENU_RESET, L"&Reset" );
|
DEF_STR(MENU_RESET, L"&Reset");
|
||||||
DEF_STR(MENU_PAUSE, L"&Pause" );
|
DEF_STR(MENU_PAUSE, L"&Pause");
|
||||||
DEF_STR(MENU_BITMAP, L"Generate Bitmap" );
|
DEF_STR(MENU_BITMAP, L"Generate Bitmap");
|
||||||
DEF_STR(MENU_LIMIT_FPS, L"Limit FPS" );
|
DEF_STR(MENU_LIMIT_FPS, L"Limit FPS");
|
||||||
DEF_STR(MENU_SAVE, L"&Save State" );
|
DEF_STR(MENU_SAVE, L"&Save State");
|
||||||
DEF_STR(MENU_SAVE_AS, L"Save As..." );
|
DEF_STR(MENU_SAVE_AS, L"Save As...");
|
||||||
DEF_STR(MENU_RESTORE, L"&Load State" );
|
DEF_STR(MENU_RESTORE, L"&Load State");
|
||||||
DEF_STR(MENU_LOAD, L"Load..." );
|
DEF_STR(MENU_LOAD, L"Load...");
|
||||||
DEF_STR(MENU_CURRENT_SAVE,L"Current Save S&tate" );
|
DEF_STR(MENU_CURRENT_SAVE, L"Current Save S&tate");
|
||||||
DEF_STR(MENU_CHEAT, L"Cheats..." );
|
DEF_STR(MENU_CHEAT, L"Cheats...");
|
||||||
DEF_STR(MENU_GS_BUTTON, L"GS Button" );
|
DEF_STR(MENU_GS_BUTTON, L"GS Button");
|
||||||
DEF_STR(MENU_RESUME, L"R&esume" );
|
DEF_STR(MENU_RESUME, L"R&esume");
|
||||||
DEF_STR(MENU_RESET_SOFT, L"&Soft Reset" );
|
DEF_STR(MENU_RESET_SOFT, L"&Soft Reset");
|
||||||
DEF_STR(MENU_RESET_HARD, L"&Hard Reset" );
|
DEF_STR(MENU_RESET_HARD, L"&Hard Reset");
|
||||||
|
|
||||||
//Options Menu
|
//Options Menu
|
||||||
DEF_STR(MENU_OPTIONS, L"&Options" );
|
DEF_STR(MENU_OPTIONS, L"&Options");
|
||||||
DEF_STR(MENU_FULL_SCREEN, L"&Full Screen" );
|
DEF_STR(MENU_FULL_SCREEN, L"&Full Screen");
|
||||||
DEF_STR(MENU_ON_TOP, L"&Always on &Top" );
|
DEF_STR(MENU_ON_TOP, L"&Always on &Top");
|
||||||
DEF_STR(MENU_CONFG_GFX, L"Configure Graphics Plugin..." );
|
DEF_STR(MENU_CONFG_GFX, L"Configure Graphics Plugin...");
|
||||||
DEF_STR(MENU_CONFG_AUDIO, L"Configure Audio Plugin..." );
|
DEF_STR(MENU_CONFG_AUDIO, L"Configure Audio Plugin...");
|
||||||
DEF_STR(MENU_CONFG_CTRL, L"Configure Controller Plugin..." );
|
DEF_STR(MENU_CONFG_CTRL, L"Configure Controller Plugin...");
|
||||||
DEF_STR(MENU_CONFG_RSP, L"Configure RSP Plugin..." );
|
DEF_STR(MENU_CONFG_RSP, L"Configure RSP Plugin...");
|
||||||
DEF_STR(MENU_SHOW_CPU, L"Show CPU Usage" );
|
DEF_STR(MENU_SHOW_CPU, L"Show CPU Usage");
|
||||||
DEF_STR(MENU_SETTINGS, L"&Settings..." );
|
DEF_STR(MENU_SETTINGS, L"&Settings...");
|
||||||
|
|
||||||
//Debugger Menu
|
//Debugger Menu
|
||||||
DEF_STR(MENU_DEBUGGER, L"&Debugger" );
|
DEF_STR(MENU_DEBUGGER, L"&Debugger");
|
||||||
|
|
||||||
//Language Menu
|
//Language Menu
|
||||||
DEF_STR(MENU_LANGUAGE, L"&Language" );
|
DEF_STR(MENU_LANGUAGE, L"&Language");
|
||||||
|
|
||||||
//Help Menu
|
//Help Menu
|
||||||
DEF_STR(MENU_HELP, L"&Help" );
|
DEF_STR(MENU_HELP, L"&Help");
|
||||||
DEF_STR(MENU_ABOUT_INI, L"About Conf&ig Files" );
|
DEF_STR(MENU_ABOUT_INI, L"About Conf&ig Files");
|
||||||
DEF_STR(MENU_ABOUT_PJ64, L"&About Project64" );
|
DEF_STR(MENU_ABOUT_PJ64, L"&About Project64");
|
||||||
DEF_STR(MENU_FORUM, L"Support &Forum" );
|
DEF_STR(MENU_FORUM, L"Support &Forum");
|
||||||
DEF_STR(MENU_HOMEPAGE, L"&Homepage" );
|
DEF_STR(MENU_HOMEPAGE, L"&Homepage");
|
||||||
|
|
||||||
//Current Save Slot menu
|
//Current Save Slot menu
|
||||||
DEF_STR(MENU_SLOT_DEFAULT,L"Default" );
|
DEF_STR(MENU_SLOT_DEFAULT, L"Default");
|
||||||
DEF_STR(MENU_SLOT_1, L"Slot 1" );
|
DEF_STR(MENU_SLOT_1, L"Slot 1");
|
||||||
DEF_STR(MENU_SLOT_2, L"Slot 2" );
|
DEF_STR(MENU_SLOT_2, L"Slot 2");
|
||||||
DEF_STR(MENU_SLOT_3, L"Slot 3" );
|
DEF_STR(MENU_SLOT_3, L"Slot 3");
|
||||||
DEF_STR(MENU_SLOT_4, L"Slot 4" );
|
DEF_STR(MENU_SLOT_4, L"Slot 4");
|
||||||
DEF_STR(MENU_SLOT_5, L"Slot 5" );
|
DEF_STR(MENU_SLOT_5, L"Slot 5");
|
||||||
DEF_STR(MENU_SLOT_6, L"Slot 6" );
|
DEF_STR(MENU_SLOT_6, L"Slot 6");
|
||||||
DEF_STR(MENU_SLOT_7, L"Slot 7" );
|
DEF_STR(MENU_SLOT_7, L"Slot 7");
|
||||||
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");
|
||||||
DEF_STR(POPUP_INFO, L"ROM Information" );
|
DEF_STR(POPUP_INFO, L"ROM Information");
|
||||||
DEF_STR(POPUP_SETTINGS, L"Edit Game Settings" );
|
DEF_STR(POPUP_SETTINGS, L"Edit Game Settings");
|
||||||
DEF_STR(POPUP_CHEATS, L"Edit Cheats" );
|
DEF_STR(POPUP_CHEATS, L"Edit Cheats");
|
||||||
DEF_STR(POPUP_GFX_PLUGIN,L"Graphics Plugin" );
|
DEF_STR(POPUP_GFX_PLUGIN, L"Graphics Plugin");
|
||||||
|
|
||||||
//Alternate Name to save Slot
|
//Alternate Name to save Slot
|
||||||
DEF_STR(SAVE_SLOT_DEFAULT,L"Save Slot - Default" );
|
DEF_STR(SAVE_SLOT_DEFAULT, L"Save Slot - Default");
|
||||||
DEF_STR(SAVE_SLOT_1, L"Save Slot - 1" );
|
DEF_STR(SAVE_SLOT_1, L"Save Slot - 1");
|
||||||
DEF_STR(SAVE_SLOT_2, L"Save Slot - 2" );
|
DEF_STR(SAVE_SLOT_2, L"Save Slot - 2");
|
||||||
DEF_STR(SAVE_SLOT_3, L"Save Slot - 3" );
|
DEF_STR(SAVE_SLOT_3, L"Save Slot - 3");
|
||||||
DEF_STR(SAVE_SLOT_4, L"Save Slot - 4" );
|
DEF_STR(SAVE_SLOT_4, L"Save Slot - 4");
|
||||||
DEF_STR(SAVE_SLOT_5, L"Save Slot - 5" );
|
DEF_STR(SAVE_SLOT_5, L"Save Slot - 5");
|
||||||
DEF_STR(SAVE_SLOT_6, L"Save Slot - 6" );
|
DEF_STR(SAVE_SLOT_6, L"Save Slot - 6");
|
||||||
DEF_STR(SAVE_SLOT_7, L"Save Slot - 7" );
|
DEF_STR(SAVE_SLOT_7, L"Save Slot - 7");
|
||||||
DEF_STR(SAVE_SLOT_8, L"Save Slot - 8" );
|
DEF_STR(SAVE_SLOT_8, L"Save Slot - 8");
|
||||||
DEF_STR(SAVE_SLOT_9, L"Save Slot - 9" );
|
DEF_STR(SAVE_SLOT_9, L"Save Slot - 9");
|
||||||
DEF_STR(SAVE_SLOT_10, L"Save Slot - 10" );
|
DEF_STR(SAVE_SLOT_10, L"Save Slot - 10");
|
||||||
|
|
||||||
/*********************************************************************************
|
/*********************************************************************************
|
||||||
* ROM Browser *
|
* ROM Browser *
|
||||||
*********************************************************************************/
|
*********************************************************************************/
|
||||||
//ROM Browser Fields
|
//ROM Browser Fields
|
||||||
DEF_STR(RB_FILENAME, L"File Name" );
|
DEF_STR(RB_FILENAME, L"File Name");
|
||||||
DEF_STR(RB_INTERNALNAME, L"Internal Name" );
|
DEF_STR(RB_INTERNALNAME, L"Internal Name");
|
||||||
DEF_STR(RB_GOODNAME, L"Good Name" );
|
DEF_STR(RB_GOODNAME, L"Good Name");
|
||||||
DEF_STR(RB_STATUS, L"Status" );
|
DEF_STR(RB_STATUS, L"Status");
|
||||||
DEF_STR(RB_ROMSIZE, L"ROM Size" );
|
DEF_STR(RB_ROMSIZE, L"ROM Size");
|
||||||
DEF_STR(RB_NOTES_CORE, L"Notes (core)" );
|
DEF_STR(RB_NOTES_CORE, L"Notes (core)");
|
||||||
DEF_STR(RB_NOTES_PLUGIN, L"Notes (default plugins)" );
|
DEF_STR(RB_NOTES_PLUGIN, L"Notes (default plugins)");
|
||||||
DEF_STR(RB_NOTES_USER, L"Notes (user)" );
|
DEF_STR(RB_NOTES_USER, L"Notes (user)");
|
||||||
DEF_STR(RB_CART_ID, L"Cartridge ID" );
|
DEF_STR(RB_CART_ID, L"Cartridge ID");
|
||||||
DEF_STR(RB_MANUFACTUER, L"Manufacturer" );
|
DEF_STR(RB_MANUFACTUER, L"Manufacturer");
|
||||||
DEF_STR(RB_COUNTRY, L"Country" );
|
DEF_STR(RB_COUNTRY, L"Country");
|
||||||
DEF_STR(RB_DEVELOPER, L"Developer" );
|
DEF_STR(RB_DEVELOPER, L"Developer");
|
||||||
DEF_STR(RB_CRC1, L"CRC1" );
|
DEF_STR(RB_CRC1, L"CRC1");
|
||||||
DEF_STR(RB_CRC2, L"CRC2" );
|
DEF_STR(RB_CRC2, L"CRC2");
|
||||||
DEF_STR(RB_CICCHIP, L"CIC Chip" );
|
DEF_STR(RB_CICCHIP, L"CIC Chip");
|
||||||
DEF_STR(RB_RELEASE_DATE, L"Release Date" );
|
DEF_STR(RB_RELEASE_DATE, L"Release Date");
|
||||||
DEF_STR(RB_GENRE, L"Genre" );
|
DEF_STR(RB_GENRE, L"Genre");
|
||||||
DEF_STR(RB_PLAYERS, L"Players" );
|
DEF_STR(RB_PLAYERS, L"Players");
|
||||||
DEF_STR(RB_FORCE_FEEDBACK,L"Force Feedback" );
|
DEF_STR(RB_FORCE_FEEDBACK, L"Force Feedback");
|
||||||
DEF_STR(RB_FILE_FORMAT, L"File Format" );
|
DEF_STR(RB_FILE_FORMAT, L"File Format");
|
||||||
|
|
||||||
//Select ROM
|
//Select ROM
|
||||||
DEF_STR(SELECT_ROM_DIR, L"Select current ROM directory" );
|
DEF_STR(SELECT_ROM_DIR, L"Select current ROM directory");
|
||||||
|
|
||||||
//Messages
|
//Messages
|
||||||
DEF_STR(RB_NOT_GOOD_FILE,L"Bad ROM? Use GoodN64 & check for updated RDB." );
|
DEF_STR(RB_NOT_GOOD_FILE, L"Bad ROM? Use GoodN64 & check for updated RDB.");
|
||||||
|
|
||||||
/*********************************************************************************
|
/*********************************************************************************
|
||||||
* Options *
|
* Options *
|
||||||
*********************************************************************************/
|
*********************************************************************************/
|
||||||
//Options Title
|
//Options Title
|
||||||
DEF_STR(OPTIONS_TITLE,L"Settings");
|
DEF_STR(OPTIONS_TITLE, L"Settings");
|
||||||
|
|
||||||
//Tabs
|
//Tabs
|
||||||
DEF_STR(TAB_PLUGIN, L"Plugins");
|
DEF_STR(TAB_PLUGIN, L"Plugins");
|
||||||
DEF_STR(TAB_DIRECTORY, L"Directories");
|
DEF_STR(TAB_DIRECTORY, L"Directories");
|
||||||
DEF_STR(TAB_OPTIONS, L"Options");
|
DEF_STR(TAB_OPTIONS, L"Options");
|
||||||
DEF_STR(TAB_ROMSELECTION,L"ROM Selection");
|
DEF_STR(TAB_ROMSELECTION, L"ROM Selection");
|
||||||
DEF_STR(TAB_ADVANCED, L"Advanced");
|
DEF_STR(TAB_ADVANCED, L"Advanced");
|
||||||
DEF_STR(TAB_ROMSETTINGS, L"General Settings");
|
DEF_STR(TAB_ROMSETTINGS, L"General Settings");
|
||||||
DEF_STR(TAB_SHELLINTERGATION,L"Shell Integration");
|
DEF_STR(TAB_SHELLINTERGATION, L"Shell Integration");
|
||||||
DEF_STR(TAB_ROMNOTES, L"Notes");
|
DEF_STR(TAB_ROMNOTES, L"Notes");
|
||||||
DEF_STR(TAB_SHORTCUTS, L"Keyboard Shortcuts");
|
DEF_STR(TAB_SHORTCUTS, L"Keyboard Shortcuts");
|
||||||
DEF_STR(TAB_ROMSTATUS, L"Status");
|
DEF_STR(TAB_ROMSTATUS, L"Status");
|
||||||
|
@ -202,7 +203,7 @@ void CLanguage::LoadDefaultStrings (void)
|
||||||
DEF_STR(PLUG_AUDIO, L" Audio (sound) plugin: ");
|
DEF_STR(PLUG_AUDIO, L" Audio (sound) plugin: ");
|
||||||
DEF_STR(PLUG_CTRL, L" Input (controller) plugin: ");
|
DEF_STR(PLUG_CTRL, L" Input (controller) plugin: ");
|
||||||
DEF_STR(PLUG_HLE_GFX, L"Graphics HLE");
|
DEF_STR(PLUG_HLE_GFX, L"Graphics HLE");
|
||||||
DEF_STR(PLUG_HLE_AUDIO,L"Audio HLE");
|
DEF_STR(PLUG_HLE_AUDIO, L"Audio HLE");
|
||||||
DEF_STR(PLUG_DEFAULT, L"** Use System Plugin **");
|
DEF_STR(PLUG_DEFAULT, L"** Use System Plugin **");
|
||||||
|
|
||||||
//Directory Dialog
|
//Directory Dialog
|
||||||
|
@ -215,7 +216,7 @@ void CLanguage::LoadDefaultStrings (void)
|
||||||
DEF_STR(DIR_SELECT_PLUGIN, L"Select plugin directory");
|
DEF_STR(DIR_SELECT_PLUGIN, L"Select plugin directory");
|
||||||
DEF_STR(DIR_SELECT_ROM, L"Select ROM directory");
|
DEF_STR(DIR_SELECT_ROM, L"Select ROM directory");
|
||||||
DEF_STR(DIR_SELECT_AUTO, L"Select N64 native saves directory");
|
DEF_STR(DIR_SELECT_AUTO, L"Select N64 native saves directory");
|
||||||
DEF_STR(DIR_SELECT_INSTANT,L"Select saved states directory");
|
DEF_STR(DIR_SELECT_INSTANT, L"Select saved states directory");
|
||||||
DEF_STR(DIR_SELECT_SCREEN, L"Select screenshot directory");
|
DEF_STR(DIR_SELECT_SCREEN, L"Select screenshot directory");
|
||||||
DEF_STR(DIR_TEXTURE, L" Texture pack directory: ");
|
DEF_STR(DIR_TEXTURE, L" Texture pack directory: ");
|
||||||
DEF_STR(DIR_SELECT_TEXTURE, L"Select texture pack directory");
|
DEF_STR(DIR_SELECT_TEXTURE, L"Select texture pack directory");
|
||||||
|
@ -258,7 +259,7 @@ void CLanguage::LoadDefaultStrings (void)
|
||||||
DEF_STR(ADVANCE_DEBUGGER, L"Enable debugger");
|
DEF_STR(ADVANCE_DEBUGGER, L"Enable debugger");
|
||||||
DEF_STR(ADVANCE_SMM_CACHE, L"Cache");
|
DEF_STR(ADVANCE_SMM_CACHE, L"Cache");
|
||||||
DEF_STR(ADVANCE_SMM_PIDMA, L"PI DMA");
|
DEF_STR(ADVANCE_SMM_PIDMA, L"PI DMA");
|
||||||
DEF_STR(ADVANCE_SMM_VALIDATE,L"Start changed");
|
DEF_STR(ADVANCE_SMM_VALIDATE, L"Start changed");
|
||||||
DEF_STR(ADVANCE_SMM_PROTECT, L"Protect memory");
|
DEF_STR(ADVANCE_SMM_PROTECT, L"Protect memory");
|
||||||
DEF_STR(ADVANCE_SMM_TLB, L"TLB unmapping");
|
DEF_STR(ADVANCE_SMM_TLB, L"TLB unmapping");
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
@ -409,13 +410,13 @@ void CLanguage::LoadDefaultStrings (void)
|
||||||
DEF_STR(CHEAT_NOTES, L"&Notes:");
|
DEF_STR(CHEAT_NOTES, L"&Notes:");
|
||||||
DEF_STR(CHEAT_ADDCHEAT_ADD, L"Add Cheat");
|
DEF_STR(CHEAT_ADDCHEAT_ADD, L"Add Cheat");
|
||||||
DEF_STR(CHEAT_ADDCHEAT_NEW, L"New Cheat");
|
DEF_STR(CHEAT_ADDCHEAT_NEW, L"New Cheat");
|
||||||
DEF_STR(CHEAT_ADDCHEAT_CODEDES,L"<address> <value>");
|
DEF_STR(CHEAT_ADDCHEAT_CODEDES, L"<address> <value>");
|
||||||
DEF_STR(CHEAT_ADDCHEAT_OPT, L"Options:");
|
DEF_STR(CHEAT_ADDCHEAT_OPT, L"Options:");
|
||||||
DEF_STR(CHEAT_ADDCHEAT_OPTDES, L"<value> <label>");
|
DEF_STR(CHEAT_ADDCHEAT_OPTDES, L"<value> <label>");
|
||||||
|
|
||||||
//Edit Cheat
|
//Edit Cheat
|
||||||
DEF_STR(CHEAT_EDITCHEAT_WINDOW,L"Edit Cheat");
|
DEF_STR(CHEAT_EDITCHEAT_WINDOW, L"Edit Cheat");
|
||||||
DEF_STR(CHEAT_EDITCHEAT_UPDATE,L"Update Cheat");
|
DEF_STR(CHEAT_EDITCHEAT_UPDATE, L"Update Cheat");
|
||||||
DEF_STR(CHEAT_CHANGED_MSG, L"Cheat has been changed.\n\nDo you want to update?");
|
DEF_STR(CHEAT_CHANGED_MSG, L"Cheat has been changed.\n\nDo you want to update?");
|
||||||
DEF_STR(CHEAT_CHANGED_TITLE, L"Cheat updated");
|
DEF_STR(CHEAT_CHANGED_TITLE, L"Cheat updated");
|
||||||
|
|
||||||
|
@ -455,7 +456,7 @@ void CLanguage::LoadDefaultStrings (void)
|
||||||
DEF_STR(MSG_FAIL_IMAGE, L"File loaded does not appear to be a valid N64 ROM.\n\nVerify your ROMs with GoodN64.");
|
DEF_STR(MSG_FAIL_IMAGE, L"File loaded does not appear to be a valid N64 ROM.\n\nVerify your ROMs with GoodN64.");
|
||||||
DEF_STR(MSG_UNKNOWN_COUNTRY, L"Unknown country");
|
DEF_STR(MSG_UNKNOWN_COUNTRY, L"Unknown country");
|
||||||
DEF_STR(MSG_UNKNOWN_CIC_CHIP, L"Unknown CIC chip");
|
DEF_STR(MSG_UNKNOWN_CIC_CHIP, L"Unknown CIC chip");
|
||||||
DEF_STR(MSG_UNKNOWN_FILE_FORMAT,L"Unknown file format");
|
DEF_STR(MSG_UNKNOWN_FILE_FORMAT, L"Unknown file format");
|
||||||
DEF_STR(MSG_UNKNOWN_MEM_ACTION, L"Unknown memory action\n\nEmulation stopped");
|
DEF_STR(MSG_UNKNOWN_MEM_ACTION, L"Unknown memory action\n\nEmulation stopped");
|
||||||
DEF_STR(MSG_UNHANDLED_OP, L"Unhandled R4300i opcode at");
|
DEF_STR(MSG_UNHANDLED_OP, L"Unhandled R4300i opcode at");
|
||||||
DEF_STR(MSG_NONMAPPED_SPACE, L"Executing from non-mapped space.\n\nVerify ROM and its settings.");
|
DEF_STR(MSG_NONMAPPED_SPACE, L"Executing from non-mapped space.\n\nVerify ROM and its settings.");
|
||||||
|
@ -464,7 +465,7 @@ void CLanguage::LoadDefaultStrings (void)
|
||||||
DEF_STR(MSG_PIF2_ERROR, L"Copyright sequence not found in LUT. Game will no longer function.");
|
DEF_STR(MSG_PIF2_ERROR, L"Copyright sequence not found in LUT. Game will no longer function.");
|
||||||
DEF_STR(MSG_PIF2_TITLE, L"Copy Protection Failure");
|
DEF_STR(MSG_PIF2_TITLE, L"Copy Protection Failure");
|
||||||
DEF_STR(MSG_PLUGIN_CHANGE, L"Changing a plugin requires Project64 to reset a running ROM.\nIf you don't want to lose your place, answer No and save the current state first.\n\nChange plugins and reset ROM now?");
|
DEF_STR(MSG_PLUGIN_CHANGE, L"Changing a plugin requires Project64 to reset a running ROM.\nIf you don't want to lose your place, answer No and save the current state first.\n\nChange plugins and reset ROM now?");
|
||||||
DEF_STR(MSG_PLUGIN_CHANGE_TITLE,L"Change Plugins");
|
DEF_STR(MSG_PLUGIN_CHANGE_TITLE, L"Change Plugins");
|
||||||
DEF_STR(MSG_EMULATION_ENDED, L"Emulation ended");
|
DEF_STR(MSG_EMULATION_ENDED, L"Emulation ended");
|
||||||
DEF_STR(MSG_EMULATION_STARTED, L"Emulation started");
|
DEF_STR(MSG_EMULATION_STARTED, L"Emulation started");
|
||||||
DEF_STR(MSG_UNABLED_LOAD_STATE, L"Unable to load state");
|
DEF_STR(MSG_UNABLED_LOAD_STATE, L"Unable to load state");
|
||||||
|
@ -496,8 +497,8 @@ void CLanguage::LoadDefaultStrings (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
CLanguage::CLanguage() :
|
CLanguage::CLanguage() :
|
||||||
m_emptyString(L""),
|
m_emptyString(L""),
|
||||||
m_LanguageLoaded(false)
|
m_LanguageLoaded(false)
|
||||||
{
|
{
|
||||||
LoadDefaultStrings();
|
LoadDefaultStrings();
|
||||||
if (g_Settings)
|
if (g_Settings)
|
||||||
|
@ -506,7 +507,7 @@ CLanguage::CLanguage() :
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CLanguage::LoadCurrentStrings ( void )
|
bool CLanguage::LoadCurrentStrings(void)
|
||||||
{
|
{
|
||||||
LanguageList LangList = GetLangList();
|
LanguageList LangList = GetLangList();
|
||||||
stdstr Filename;
|
stdstr Filename;
|
||||||
|
@ -538,7 +539,7 @@ bool CLanguage::LoadCurrentStrings ( void )
|
||||||
|
|
||||||
//Search for utf8 file marker
|
//Search for utf8 file marker
|
||||||
uint8_t utf_bom[3];
|
uint8_t utf_bom[3];
|
||||||
if (fread(&utf_bom, sizeof(utf_bom),1,file) != 1 ||
|
if (fread(&utf_bom, sizeof(utf_bom), 1, file) != 1 ||
|
||||||
utf_bom[0] != 0xEF ||
|
utf_bom[0] != 0xEF ||
|
||||||
utf_bom[1] != 0xBB ||
|
utf_bom[1] != 0xBB ||
|
||||||
utf_bom[2] != 0xBF)
|
utf_bom[2] != 0xBF)
|
||||||
|
@ -557,14 +558,14 @@ bool CLanguage::LoadCurrentStrings ( void )
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
LanguageList & CLanguage::GetLangList (void)
|
LanguageList & CLanguage::GetLangList(void)
|
||||||
{
|
{
|
||||||
if (m_LanguageList.size() > 0)
|
if (m_LanguageList.size() > 0)
|
||||||
{
|
{
|
||||||
return m_LanguageList;
|
return m_LanguageList;
|
||||||
}
|
}
|
||||||
|
|
||||||
CPath LanguageFiles(g_Settings->LoadStringVal(Setting_LanguageDir),"*.pj.Lang");
|
CPath LanguageFiles(g_Settings->LoadStringVal(Setting_LanguageDir), "*.pj.Lang");
|
||||||
if (LanguageFiles.FindFirst())
|
if (LanguageFiles.FindFirst())
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
|
@ -572,7 +573,7 @@ LanguageList & CLanguage::GetLangList (void)
|
||||||
LanguageFile File; //We temporally store the values in here to added to the list
|
LanguageFile File; //We temporally store the values in here to added to the list
|
||||||
|
|
||||||
File.Filename = (std::string &)LanguageFiles;
|
File.Filename = (std::string &)LanguageFiles;
|
||||||
File.LanguageName = GetLangString(LanguageFiles,LANGUAGE_NAME);
|
File.LanguageName = GetLangString(LanguageFiles, LANGUAGE_NAME);
|
||||||
|
|
||||||
if (File.LanguageName.length() == 0)
|
if (File.LanguageName.length() == 0)
|
||||||
{
|
{
|
||||||
|
@ -586,7 +587,7 @@ LanguageList & CLanguage::GetLangList (void)
|
||||||
return m_LanguageList;
|
return m_LanguageList;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::wstring & CLanguage::GetString (LanguageStringID StringID)
|
const std::wstring & CLanguage::GetString(LanguageStringID StringID)
|
||||||
{
|
{
|
||||||
LANG_STRINGS::iterator CurrentString = m_CurrentStrings.find(StringID);
|
LANG_STRINGS::iterator CurrentString = m_CurrentStrings.find(StringID);
|
||||||
if (CurrentString != m_CurrentStrings.end())
|
if (CurrentString != m_CurrentStrings.end())
|
||||||
|
@ -600,12 +601,12 @@ const std::wstring & CLanguage::GetString (LanguageStringID StringID)
|
||||||
return DefString->second;
|
return DefString->second;
|
||||||
}
|
}
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
g_Notify->BreakPoint(__FILEW__,__LINE__);
|
g_Notify->BreakPoint(__FILEW__, __LINE__);
|
||||||
#endif
|
#endif
|
||||||
return m_emptyString;
|
return m_emptyString;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::wstring CLanguage::GetLangString ( const char * FileName, LanguageStringID ID )
|
std::wstring CLanguage::GetLangString(const char * FileName, LanguageStringID ID)
|
||||||
{
|
{
|
||||||
FILE *file = fopen(FileName, "rb");
|
FILE *file = fopen(FileName, "rb");
|
||||||
if (file == NULL)
|
if (file == NULL)
|
||||||
|
@ -615,7 +616,7 @@ std::wstring CLanguage::GetLangString ( const char * FileName, LanguageStringID
|
||||||
|
|
||||||
//Search for utf8 file marker
|
//Search for utf8 file marker
|
||||||
uint8_t utf_bom[3];
|
uint8_t utf_bom[3];
|
||||||
if (fread(&utf_bom, sizeof(utf_bom),1,file) != 1 ||
|
if (fread(&utf_bom, sizeof(utf_bom), 1, file) != 1 ||
|
||||||
utf_bom[0] != 0xEF ||
|
utf_bom[0] != 0xEF ||
|
||||||
utf_bom[1] != 0xBB ||
|
utf_bom[1] != 0xBB ||
|
||||||
utf_bom[2] != 0xBF)
|
utf_bom[2] != 0xBF)
|
||||||
|
@ -638,10 +639,10 @@ std::wstring CLanguage::GetLangString ( const char * FileName, LanguageStringID
|
||||||
return L"";
|
return L"";
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
||||||
|
@ -649,46 +650,46 @@ LANG_STR CLanguage::GetNextLangString (void * OpenFile)
|
||||||
//while(token!='#' && !feof(file)) { fread(&token, 1, 1, file); }
|
//while(token!='#' && !feof(file)) { fread(&token, 1, 1, file); }
|
||||||
if (feof(file))
|
if (feof(file))
|
||||||
{
|
{
|
||||||
return LANG_STR(0,L"");
|
return LANG_STR(0, L"");
|
||||||
}
|
}
|
||||||
|
|
||||||
//Search for token #
|
//Search for token #
|
||||||
char token=0;
|
char token = 0;
|
||||||
while (token!='#' && !feof(file))
|
while (token != '#' && !feof(file))
|
||||||
{
|
{
|
||||||
fread(&token, 1, 1, file);
|
fread(&token, 1, 1, file);
|
||||||
}
|
}
|
||||||
if (feof(file))
|
if (feof(file))
|
||||||
{
|
{
|
||||||
return LANG_STR(0,L"");
|
return LANG_STR(0, L"");
|
||||||
}
|
}
|
||||||
|
|
||||||
//get StringID after token
|
//get StringID after token
|
||||||
fscanf(file, "%d", &StringID);
|
fscanf(file, "%d", &StringID);
|
||||||
|
|
||||||
//Search for token #
|
//Search for token #
|
||||||
while(token!='#' && !feof(file))
|
while (token != '#' && !feof(file))
|
||||||
{
|
{
|
||||||
fread(&token, 1, 1, file);
|
fread(&token, 1, 1, file);
|
||||||
}
|
}
|
||||||
if (feof(file))
|
if (feof(file))
|
||||||
{
|
{
|
||||||
StringID = EMPTY_STRING; return LANG_STR(0,L"");
|
StringID = EMPTY_STRING; return LANG_STR(0, L"");
|
||||||
}
|
}
|
||||||
|
|
||||||
//Search for start of string '"'
|
//Search for start of string '"'
|
||||||
while (token!='"' && !feof(file))
|
while (token != '"' && !feof(file))
|
||||||
{
|
{
|
||||||
fread(&token, 1, 1, file);
|
fread(&token, 1, 1, file);
|
||||||
}
|
}
|
||||||
if (feof(file))
|
if (feof(file))
|
||||||
{
|
{
|
||||||
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))
|
||||||
{
|
{
|
||||||
szString[pos++] = token;
|
szString[pos++] = token;
|
||||||
fread(&token, 1, 1, file);
|
fread(&token, 1, 1, file);
|
||||||
|
@ -699,22 +700,22 @@ LANG_STR CLanguage::GetNextLangString (void * OpenFile)
|
||||||
}
|
}
|
||||||
szString[pos++] = 0;
|
szString[pos++] = 0;
|
||||||
stdstr text(szString);
|
stdstr text(szString);
|
||||||
text.Replace("\\n","\n");
|
text.Replace("\\n", "\n");
|
||||||
return LANG_STR(StringID,text.ToUTF16());
|
return LANG_STR(StringID, text.ToUTF16());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLanguage::SetLanguage ( const wchar_t * LanguageName )
|
void CLanguage::SetLanguage(const wchar_t * LanguageName)
|
||||||
{
|
{
|
||||||
m_SelectedLanguage = LanguageName;
|
m_SelectedLanguage = LanguageName;
|
||||||
if (LoadCurrentStrings())
|
if (LoadCurrentStrings())
|
||||||
{
|
{
|
||||||
stdstr Language;
|
stdstr Language;
|
||||||
Language.FromUTF16(LanguageName);
|
Language.FromUTF16(LanguageName);
|
||||||
g_Settings->SaveString(Setting_CurrentLanguage,Language);
|
g_Settings->SaveString(Setting_CurrentLanguage, Language);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CLanguage::IsCurrentLang( LanguageFile & File )
|
bool CLanguage::IsCurrentLang(LanguageFile & File)
|
||||||
{
|
{
|
||||||
if (m_SelectedLanguage == File.LanguageName)
|
if (m_SelectedLanguage == File.LanguageName)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project 64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
|
@ -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
|
||||||
|
@ -29,14 +30,14 @@ typedef std::list<LanguageFile> LanguageList;
|
||||||
class CLanguage
|
class CLanguage
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CLanguage ();
|
CLanguage();
|
||||||
|
|
||||||
const std::wstring & GetString ( LanguageStringID StringID );
|
const std::wstring & GetString(LanguageStringID StringID);
|
||||||
LanguageList & GetLangList ( void );
|
LanguageList & GetLangList(void);
|
||||||
void SetLanguage ( const wchar_t * LanguageName );
|
void SetLanguage(const wchar_t * LanguageName);
|
||||||
bool LoadCurrentStrings ( void );
|
bool LoadCurrentStrings(void);
|
||||||
bool IsCurrentLang ( LanguageFile & File );
|
bool IsCurrentLang(LanguageFile & File);
|
||||||
bool IsLanguageLoaded ( void ) const { return m_LanguageLoaded; }
|
bool IsLanguageLoaded(void) const { return m_LanguageLoaded; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CLanguage(const CLanguage&); // Disable copy constructor
|
CLanguage(const CLanguage&); // Disable copy constructor
|
||||||
|
@ -48,16 +49,16 @@ private:
|
||||||
LANG_STRINGS m_CurrentStrings, m_DefaultStrings;
|
LANG_STRINGS m_CurrentStrings, m_DefaultStrings;
|
||||||
LanguageList m_LanguageList;
|
LanguageList m_LanguageList;
|
||||||
|
|
||||||
std::wstring GetLangString ( const char * FileName, LanguageStringID ID );
|
std::wstring GetLangString(const char * FileName, LanguageStringID ID);
|
||||||
LANG_STR GetNextLangString ( void * OpenFile );
|
LANG_STR GetNextLangString(void * OpenFile);
|
||||||
void LoadDefaultStrings ( void );
|
void LoadDefaultStrings(void);
|
||||||
|
|
||||||
bool m_LanguageLoaded;
|
bool m_LanguageLoaded;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern CLanguage * g_Lang;
|
extern CLanguage * g_Lang;
|
||||||
|
|
||||||
inline const wchar_t * GS (LanguageStringID StringID)
|
inline const wchar_t * GS(LanguageStringID StringID)
|
||||||
{
|
{
|
||||||
return g_Lang->GetString(StringID).c_str();
|
return g_Lang->GetString(StringID).c_str();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project 64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
|
@ -15,199 +15,48 @@ CLanguageSelector::CLanguageSelector()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLanguageSelector::Select ( void )
|
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;
|
LRESULT CALLBACK CLanguageSelector::LangSelectProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
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)
|
|
||||||
{
|
{
|
||||||
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;
|
||||||
|
|
||||||
LanguageList LangList = g_Lang->GetLangList();
|
LanguageList LangList = g_Lang->GetLangList();
|
||||||
if (LangList.size() == 0)
|
if (LangList.size() == 0)
|
||||||
{
|
{
|
||||||
EndDialog(hDlg,0);
|
EndDialog(hDlg, 0);
|
||||||
}
|
}
|
||||||
for (LanguageList::iterator Language = LangList.begin(); Language != LangList.end(); Language++)
|
for (LanguageList::iterator Language = LangList.begin(); Language != LangList.end(); Language++)
|
||||||
{
|
{
|
||||||
int index = SendMessageW(GetDlgItem(hDlg,IDC_LANG_SEL),CB_ADDSTRING,0,(WPARAM)Language->LanguageName.c_str());
|
int index = SendMessageW(GetDlgItem(hDlg, IDC_LANG_SEL), CB_ADDSTRING, 0, (WPARAM)Language->LanguageName.c_str());
|
||||||
if (_wcsicmp(Language->LanguageName.c_str(),L"English") == 0)
|
if (_wcsicmp(Language->LanguageName.c_str(), L"English") == 0)
|
||||||
{
|
{
|
||||||
SendMessage(GetDlgItem(hDlg,IDC_LANG_SEL),CB_SETCURSEL,index,0);
|
SendMessage(GetDlgItem(hDlg, IDC_LANG_SEL), CB_SETCURSEL, index, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int Index = SendMessage(GetDlgItem(hDlg,IDC_LANG_SEL),CB_GETCURSEL,0,0);
|
int Index = SendMessage(GetDlgItem(hDlg, IDC_LANG_SEL), CB_GETCURSEL, 0, 0);
|
||||||
if (Index < 0)
|
if (Index < 0)
|
||||||
{
|
{
|
||||||
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,
|
||||||
|
@ -222,39 +71,10 @@ LRESULT CALLBACK CLanguageSelector::LangSelectProc (HWND hDlg, UINT uMsg, WPARAM
|
||||||
OUT_DEFAULT_PRECIS,
|
OUT_DEFAULT_PRECIS,
|
||||||
CLIP_DEFAULT_PRECIS,
|
CLIP_DEFAULT_PRECIS,
|
||||||
PROOF_QUALITY,
|
PROOF_QUALITY,
|
||||||
DEFAULT_PITCH|FF_DONTCARE,
|
DEFAULT_PITCH | FF_DONTCARE,
|
||||||
"Arial"
|
"Arial"
|
||||||
);
|
);
|
||||||
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,19 +85,33 @@ 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;
|
||||||
|
|
||||||
if (BeginPaint(hDlg,&ps))
|
if (BeginPaint(hDlg, &ps))
|
||||||
{
|
{
|
||||||
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,26 +119,7 @@ LRESULT CALLBACK CLanguageSelector::LangSelectProc (HWND hDlg, UINT uMsg, WPARAM
|
||||||
SelectObject(memdc, save);
|
SelectObject(memdc, save);
|
||||||
DeleteDC(memdc);
|
DeleteDC(memdc);
|
||||||
|
|
||||||
memdc = CreateCompatibleDC(ps.hdc);
|
EndPaint(hDlg, &ps);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -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)
|
||||||
{
|
{
|
||||||
|
@ -331,17 +138,17 @@ LRESULT CALLBACK CLanguageSelector::LangSelectProc (HWND hDlg, UINT uMsg, WPARAM
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
int Index = SendMessage(GetDlgItem(hDlg,IDC_LANG_SEL),CB_GETCURSEL,0,0);
|
int Index = SendMessage(GetDlgItem(hDlg, IDC_LANG_SEL), CB_GETCURSEL, 0, 0);
|
||||||
|
|
||||||
if (Index >= 0)
|
if (Index >= 0)
|
||||||
{
|
{
|
||||||
wchar_t String[255];
|
wchar_t String[255];
|
||||||
SendMessageW(GetDlgItem(hDlg,IDC_LANG_SEL),CB_GETLBTEXT,Index,(LPARAM)String);
|
SendMessageW(GetDlgItem(hDlg, IDC_LANG_SEL), CB_GETLBTEXT, Index, (LPARAM)String);
|
||||||
g_Lang->SetLanguage(String);
|
g_Lang->SetLanguage(String);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EndDialog(hDlg,0);
|
EndDialog(hDlg, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project 64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
|
@ -13,13 +13,13 @@
|
||||||
class CLanguageSelector
|
class CLanguageSelector
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CLanguageSelector ();
|
CLanguageSelector();
|
||||||
|
|
||||||
void Select ( void );
|
void Select(void);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CLanguageSelector(const CLanguageSelector&); // Disable copy constructor
|
CLanguageSelector(const CLanguageSelector&); // Disable copy constructor
|
||||||
CLanguageSelector& operator=(const CLanguageSelector&); // Disable assignment
|
CLanguageSelector& operator=(const CLanguageSelector&); // Disable assignment
|
||||||
|
|
||||||
static LRESULT CALLBACK LangSelectProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
static LRESULT CALLBACK LangSelectProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||||
};
|
};
|
|
@ -1,6 +1,6 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project 64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
|
@ -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
|
|
|
@ -1,6 +1,6 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project 64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project 64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,6 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project 64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
|
@ -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
|
||||||
void ApplyCheats ( CMipsMemory * MMU );
|
{
|
||||||
void ApplyGSButton ( CMipsMemory * MMU );
|
MaxCheats = 50000,
|
||||||
void LoadCheats ( bool DisableSelected, CPlugins * Plugins );
|
MaxGSEntries = 100,
|
||||||
void SelectCheats ( HWND hParent, bool BlockExecution );
|
};
|
||||||
inline bool CheatsSlectionChanged ( void ) const { return m_CheatSelectionChanged; }
|
|
||||||
|
void ApplyCheats(CMipsMemory * MMU);
|
||||||
|
void ApplyGSButton(CMipsMemory * MMU);
|
||||||
|
void LoadCheats(bool DisableSelected, CPlugins * Plugins);
|
||||||
|
|
||||||
|
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);
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,32 +1,32 @@
|
||||||
template <class T>
|
template <class T>
|
||||||
class CDebugDialog :
|
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;
|
||||||
|
|
||||||
static DWORD CreateDebuggerWindow (CDebugDialog<T> * pThis)
|
static DWORD CreateDebuggerWindow(CDebugDialog<T> * pThis)
|
||||||
{
|
{
|
||||||
pThis->DoModal(NULL);
|
pThis->DoModal(NULL);
|
||||||
pThis->WindowCreated();
|
pThis->WindowCreated();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowCreated ( void )
|
void WindowCreated(void)
|
||||||
{
|
{
|
||||||
SetEvent(m_CreatedEvent);
|
SetEvent(m_CreatedEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
virtual ~CDebugDialog (void)
|
virtual ~CDebugDialog(void)
|
||||||
{
|
{
|
||||||
HideWindow();
|
HideWindow();
|
||||||
CloseHandle(m_CreatedEvent);
|
CloseHandle(m_CreatedEvent);
|
||||||
|
@ -37,7 +37,7 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void HideWindow ( void )
|
void HideWindow(void)
|
||||||
{
|
{
|
||||||
if (m_hWnd && ::IsWindow(m_hWnd))
|
if (m_hWnd && ::IsWindow(m_hWnd))
|
||||||
{
|
{
|
||||||
|
@ -47,7 +47,7 @@ public:
|
||||||
{
|
{
|
||||||
if (WaitForSingleObject(m_DialogThread, 5000) == WAIT_TIMEOUT)
|
if (WaitForSingleObject(m_DialogThread, 5000) == WAIT_TIMEOUT)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceError,"CDebugDialog - time out on close");
|
WriteTrace(TraceError, "CDebugDialog - time out on close");
|
||||||
|
|
||||||
TerminateThread(m_DialogThread, 1);
|
TerminateThread(m_DialogThread, 1);
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShowWindow ( void )
|
void ShowWindow(void)
|
||||||
{
|
{
|
||||||
if (m_hWnd)
|
if (m_hWnd)
|
||||||
{
|
{
|
||||||
|
@ -66,10 +66,10 @@ public:
|
||||||
{
|
{
|
||||||
DWORD ThreadID;
|
DWORD ThreadID;
|
||||||
ResetEvent(m_CreatedEvent);
|
ResetEvent(m_CreatedEvent);
|
||||||
m_DialogThread = CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)CreateDebuggerWindow,(LPVOID)this,0, &ThreadID);
|
m_DialogThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)CreateDebuggerWindow, (LPVOID)this, 0, &ThreadID);
|
||||||
if (WaitForSingleObject(m_CreatedEvent,20000) == WAIT_TIMEOUT)
|
if (WaitForSingleObject(m_CreatedEvent, 20000) == WAIT_TIMEOUT)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceError,"Failed to get window create notification");
|
WriteTrace(TraceError, "Failed to get window create notification");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project 64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
|
@ -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)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -32,13 +31,13 @@ LRESULT CDumpMemory::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lPa
|
||||||
m_EndAddress.SetDisplayType(CEditNumber::DisplayHex);
|
m_EndAddress.SetDisplayType(CEditNumber::DisplayHex);
|
||||||
m_PC.SetDisplayType(CEditNumber::DisplayHex);
|
m_PC.SetDisplayType(CEditNumber::DisplayHex);
|
||||||
|
|
||||||
m_StartAddress.SetValue(0x80000000,true,true);
|
m_StartAddress.SetValue(0x80000000, true, true);
|
||||||
m_EndAddress.SetValue(0x803FFFF0,true,true);
|
m_EndAddress.SetValue(0x803FFFF0, true, true);
|
||||||
m_PC.SetValue(0x80000000);
|
m_PC.SetValue(0x80000000);
|
||||||
HWND hFormatList = GetDlgItem(IDC_FORMAT);
|
HWND hFormatList = GetDlgItem(IDC_FORMAT);
|
||||||
int pos = ::SendMessage(hFormatList,CB_ADDSTRING,(WPARAM)0,(LPARAM)"TEXT - Disassembly + PC");
|
int pos = ::SendMessage(hFormatList, CB_ADDSTRING, (WPARAM)0, (LPARAM)"TEXT - Disassembly + PC");
|
||||||
::SendMessage(hFormatList,CB_SETITEMDATA,(WPARAM)pos,(LPARAM)DisassemblyWithPC);
|
::SendMessage(hFormatList, CB_SETITEMDATA, (WPARAM)pos, (LPARAM)DisassemblyWithPC);
|
||||||
::SendMessage(hFormatList,CB_SETCURSEL,(WPARAM)0,(LPARAM)0);
|
::SendMessage(hFormatList, CB_SETCURSEL, (WPARAM)0, (LPARAM)0);
|
||||||
|
|
||||||
WindowCreated();
|
WindowCreated();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -46,20 +45,20 @@ LRESULT CDumpMemory::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lPa
|
||||||
|
|
||||||
LRESULT CDumpMemory::OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
|
LRESULT CDumpMemory::OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
|
||||||
{
|
{
|
||||||
switch(wID)
|
switch (wID)
|
||||||
{
|
{
|
||||||
case IDCANCEL:
|
case IDCANCEL:
|
||||||
EndDialog(0);
|
EndDialog(0);
|
||||||
break;
|
break;
|
||||||
case IDC_BTN_CHOOSE_FILE:
|
case IDC_BTN_CHOOSE_FILE:
|
||||||
{
|
{
|
||||||
char FileName[_MAX_PATH],Directory[_MAX_PATH];
|
char FileName[_MAX_PATH], Directory[_MAX_PATH];
|
||||||
OPENFILENAME openfilename;
|
OPENFILENAME openfilename;
|
||||||
|
|
||||||
memset(&FileName, 0, sizeof(FileName));
|
memset(&FileName, 0, sizeof(FileName));
|
||||||
memset(&openfilename, 0, sizeof(openfilename));
|
memset(&openfilename, 0, sizeof(openfilename));
|
||||||
strcpy(Directory,CPath(CPath::MODULE_DIRECTORY));
|
strcpy(Directory, CPath(CPath::MODULE_DIRECTORY));
|
||||||
openfilename.lStructSize = sizeof( openfilename );
|
openfilename.lStructSize = sizeof(openfilename);
|
||||||
openfilename.hwndOwner = m_hWnd;
|
openfilename.hwndOwner = m_hWnd;
|
||||||
openfilename.lpstrFilter = "Text file (*.txt)\0*.txt;\0All files (*.*)\0*.*\0";
|
openfilename.lpstrFilter = "Text file (*.txt)\0*.txt;\0All files (*.*)\0*.*\0";
|
||||||
openfilename.lpstrFile = FileName;
|
openfilename.lpstrFile = FileName;
|
||||||
|
@ -67,15 +66,15 @@ LRESULT CDumpMemory::OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/,
|
||||||
openfilename.nMaxFile = MAX_PATH;
|
openfilename.nMaxFile = MAX_PATH;
|
||||||
openfilename.Flags = OFN_HIDEREADONLY;
|
openfilename.Flags = OFN_HIDEREADONLY;
|
||||||
g_BaseSystem->ExternalEvent(SysEvent_PauseCPU_DumpMemory);
|
g_BaseSystem->ExternalEvent(SysEvent_PauseCPU_DumpMemory);
|
||||||
if (GetOpenFileName (&openfilename))
|
if (GetOpenFileName(&openfilename))
|
||||||
{
|
{
|
||||||
char drive[_MAX_DRIVE], dir[_MAX_DIR], fname[_MAX_FNAME], ext[_MAX_EXT];
|
char drive[_MAX_DRIVE], dir[_MAX_DIR], fname[_MAX_FNAME], ext[_MAX_EXT];
|
||||||
_splitpath( FileName, drive, dir, fname, ext );
|
_splitpath(FileName, drive, dir, fname, ext);
|
||||||
if (strlen(ext) == 0)
|
if (strlen(ext) == 0)
|
||||||
{
|
{
|
||||||
strcat(FileName,".txt");
|
strcat(FileName, ".txt");
|
||||||
}
|
}
|
||||||
SetDlgItemText(IDC_FILENAME,FileName);
|
SetDlgItemText(IDC_FILENAME, FileName);
|
||||||
}
|
}
|
||||||
g_BaseSystem->ExternalEvent(SysEvent_ResumeCPU_DumpMemory);
|
g_BaseSystem->ExternalEvent(SysEvent_ResumeCPU_DumpMemory);
|
||||||
}
|
}
|
||||||
|
@ -83,34 +82,34 @@ LRESULT CDumpMemory::OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/,
|
||||||
case IDOK:
|
case IDOK:
|
||||||
{
|
{
|
||||||
TCHAR FileName[MAX_PATH];
|
TCHAR FileName[MAX_PATH];
|
||||||
int CurrentFormatSel = SendDlgItemMessage(IDC_FORMAT,CB_GETCURSEL,0,0);
|
int CurrentFormatSel = SendDlgItemMessage(IDC_FORMAT, CB_GETCURSEL, 0, 0);
|
||||||
DumpFormat Format = (DumpFormat)SendDlgItemMessage(IDC_FORMAT,CB_GETITEMDATA,CurrentFormatSel,0);
|
DumpFormat Format = (DumpFormat)SendDlgItemMessage(IDC_FORMAT, CB_GETITEMDATA, CurrentFormatSel, 0);
|
||||||
DWORD StartPC =m_StartAddress.GetValue();
|
DWORD StartPC = m_StartAddress.GetValue();
|
||||||
DWORD EndPC = m_EndAddress.GetValue();
|
DWORD EndPC = m_EndAddress.GetValue();
|
||||||
DWORD DumpPC = m_PC.GetValue();
|
DWORD DumpPC = m_PC.GetValue();
|
||||||
GetDlgItemText(IDC_FILENAME,FileName,sizeof(FileName));
|
GetDlgItemText(IDC_FILENAME, FileName, sizeof(FileName));
|
||||||
if (strlen(FileName) == 0)
|
if (strlen(FileName) == 0)
|
||||||
{
|
{
|
||||||
g_Notify->DisplayError(L"Please Choose target file");
|
g_Notify->DisplayError(L"Please Choose target file");
|
||||||
::SetFocus(GetDlgItem(IDC_FILENAME));
|
::SetFocus(GetDlgItem(IDC_FILENAME));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (SendDlgItemMessage(IDC_USE_ALT_PC,BM_GETSTATE, 0,0) != BST_CHECKED)
|
if (SendDlgItemMessage(IDC_USE_ALT_PC, BM_GETSTATE, 0, 0) != BST_CHECKED)
|
||||||
{
|
{
|
||||||
DumpPC = g_Reg->m_PROGRAM_COUNTER;
|
DumpPC = g_Reg->m_PROGRAM_COUNTER;
|
||||||
}
|
}
|
||||||
//disable buttons
|
//disable buttons
|
||||||
::EnableWindow(GetDlgItem(IDC_E_START_ADDR),FALSE);
|
::EnableWindow(GetDlgItem(IDC_E_START_ADDR), FALSE);
|
||||||
::EnableWindow(GetDlgItem(IDC_E_END_ADDR),FALSE);
|
::EnableWindow(GetDlgItem(IDC_E_END_ADDR), FALSE);
|
||||||
::EnableWindow(GetDlgItem(IDC_E_ALT_PC),FALSE);
|
::EnableWindow(GetDlgItem(IDC_E_ALT_PC), FALSE);
|
||||||
::EnableWindow(GetDlgItem(IDC_USE_ALT_PC),FALSE);
|
::EnableWindow(GetDlgItem(IDC_USE_ALT_PC), FALSE);
|
||||||
::EnableWindow(GetDlgItem(IDC_FILENAME),FALSE);
|
::EnableWindow(GetDlgItem(IDC_FILENAME), FALSE);
|
||||||
::EnableWindow(GetDlgItem(IDC_BTN_CHOOSE_FILE),FALSE);
|
::EnableWindow(GetDlgItem(IDC_BTN_CHOOSE_FILE), FALSE);
|
||||||
::EnableWindow(GetDlgItem(IDC_FORMAT),FALSE);
|
::EnableWindow(GetDlgItem(IDC_FORMAT), FALSE);
|
||||||
::EnableWindow(GetDlgItem(IDOK),FALSE);
|
::EnableWindow(GetDlgItem(IDOK), FALSE);
|
||||||
::EnableWindow(GetDlgItem(IDCANCEL),FALSE);
|
::EnableWindow(GetDlgItem(IDCANCEL), FALSE);
|
||||||
g_BaseSystem->ExternalEvent(SysEvent_PauseCPU_DumpMemory);
|
g_BaseSystem->ExternalEvent(SysEvent_PauseCPU_DumpMemory);
|
||||||
if (!DumpMemory(FileName,Format,StartPC,EndPC,DumpPC))
|
if (!DumpMemory(FileName, Format, StartPC, EndPC, DumpPC))
|
||||||
{
|
{
|
||||||
//enable buttons
|
//enable buttons
|
||||||
g_BaseSystem->ExternalEvent(SysEvent_ResumeCPU_DumpMemory);
|
g_BaseSystem->ExternalEvent(SysEvent_ResumeCPU_DumpMemory);
|
||||||
|
@ -124,208 +123,7 @@ LRESULT CDumpMemory::OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
//#include "..\\..\\User Interface.h"
|
bool CDumpMemory::DumpMemory(LPCSTR FileName, DumpFormat Format, DWORD StartPC, DWORD EndPC, DWORD /*DumpPC*/)
|
||||||
//#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*/ )
|
|
||||||
{
|
{
|
||||||
switch (Format)
|
switch (Format)
|
||||||
{
|
{
|
||||||
|
@ -334,12 +132,12 @@ bool CDumpMemory::DumpMemory ( LPCSTR FileName,DumpFormat Format, DWORD StartPC,
|
||||||
CLog LogFile;
|
CLog LogFile;
|
||||||
if (!LogFile.Open(FileName))
|
if (!LogFile.Open(FileName))
|
||||||
{
|
{
|
||||||
g_Notify->DisplayError(stdstr_f("Failed to open\n%s",FileName).ToUTF16().c_str());
|
g_Notify->DisplayError(stdstr_f("Failed to open\n%s", FileName).ToUTF16().c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
LogFile.SetFlush(false);
|
LogFile.SetFlush(false);
|
||||||
LogFile.SetTruncateFile(false);
|
LogFile.SetTruncateFile(false);
|
||||||
g_Notify->BreakPoint(__FILEW__,__LINE__);
|
g_Notify->BreakPoint(__FILEW__, __LINE__);
|
||||||
#ifdef tofix
|
#ifdef tofix
|
||||||
char Command[200];
|
char Command[200];
|
||||||
for (COpcode OpCode(StartPC); OpCode.PC() < EndPC; OpCode.Next())
|
for (COpcode OpCode(StartPC); OpCode.PC() < EndPC; OpCode.Next())
|
||||||
|
@ -349,250 +147,11 @@ bool CDumpMemory::DumpMemory ( LPCSTR FileName,DumpFormat Format, DWORD StartPC,
|
||||||
LogFile.LogF("%X: %-15s%s\r\n",OpCode.PC(),szOpName,Command);
|
LogFile.LogF("%X: %-15s%s\r\n",OpCode.PC(),szOpName,Command);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
m_StartAddress.SetValue(StartPC,true,true);
|
m_StartAddress.SetValue(StartPC, true, true);
|
||||||
m_EndAddress.SetValue(EndPC,true,true);
|
m_EndAddress.SetValue(EndPC, true, true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
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
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project 64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
|
@ -11,12 +11,12 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
class CDumpMemory :
|
class CDumpMemory :
|
||||||
public CDebugDialog<CDumpMemory>
|
public CDebugDialog < 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:
|
||||||
|
@ -31,13 +31,13 @@ private:
|
||||||
|
|
||||||
BEGIN_MSG_MAP_EX(CDumpMemory)
|
BEGIN_MSG_MAP_EX(CDumpMemory)
|
||||||
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
|
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
|
||||||
COMMAND_CODE_HANDLER(BN_CLICKED,OnClicked)
|
COMMAND_CODE_HANDLER(BN_CLICKED, OnClicked)
|
||||||
END_MSG_MAP()
|
END_MSG_MAP()
|
||||||
|
|
||||||
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
|
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
|
||||||
LRESULT OnClicked(WORD wNotifyCode, WORD wID, HWND /*hWndCtl*/, BOOL& bHandled);
|
LRESULT OnClicked(WORD wNotifyCode, WORD wID, HWND /*hWndCtl*/, BOOL& bHandled);
|
||||||
|
|
||||||
bool DumpMemory ( LPCSTR FileName,DumpFormat Format, DWORD StartPC, DWORD EndPC, DWORD DumpPC );
|
bool DumpMemory(LPCSTR FileName, DumpFormat Format, DWORD StartPC, DWORD EndPC, DWORD DumpPC);
|
||||||
|
|
||||||
CEditNumber m_StartAddress, m_EndAddress, m_PC;
|
CEditNumber m_StartAddress, m_EndAddress, m_PC;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project 64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
|
@ -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)
|
||||||
|
@ -28,15 +27,15 @@ CDebugMemorySearch::~CDebugMemorySearch()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDebugMemorySearch::AddAlignmentOptions (CComboBox & ctrl)
|
void CDebugMemorySearch::AddAlignmentOptions(CComboBox & ctrl)
|
||||||
{
|
{
|
||||||
int Index = ctrl.AddString("32 bits (aligned)");
|
int Index = ctrl.AddString("32 bits (aligned)");
|
||||||
ctrl.SetItemData(Index,_32Bit);
|
ctrl.SetItemData(Index, _32Bit);
|
||||||
Index = ctrl.AddString("16bits (aligned)");
|
Index = ctrl.AddString("16bits (aligned)");
|
||||||
ctrl.SetItemData(Index,_16Bit);
|
ctrl.SetItemData(Index, _16Bit);
|
||||||
Index = ctrl.AddString("8bits");
|
Index = ctrl.AddString("8bits");
|
||||||
ctrl.SetCurSel(Index);
|
ctrl.SetCurSel(Index);
|
||||||
ctrl.SetItemData(Index,_8Bit);
|
ctrl.SetItemData(Index, _8Bit);
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT CDebugMemorySearch::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
LRESULT CDebugMemorySearch::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
||||||
|
@ -56,49 +55,49 @@ LRESULT CDebugMemorySearch::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARA
|
||||||
m_ValueSize.Attach(GetDlgItem(IDC_VALUE_ALIGN));
|
m_ValueSize.Attach(GetDlgItem(IDC_VALUE_ALIGN));
|
||||||
AddAlignmentOptions(m_ValueSize);
|
AddAlignmentOptions(m_ValueSize);
|
||||||
m_SearchResults.Attach(GetDlgItem(IDC_LST_RESULTS));
|
m_SearchResults.Attach(GetDlgItem(IDC_LST_RESULTS));
|
||||||
m_SearchResults.AddColumn("ID",0);
|
m_SearchResults.AddColumn("ID", 0);
|
||||||
m_SearchResults.AddColumn("PAddr",1);
|
m_SearchResults.AddColumn("PAddr", 1);
|
||||||
m_SearchResults.AddColumn("Value",2);
|
m_SearchResults.AddColumn("Value", 2);
|
||||||
m_SearchResults.SetColumnWidth(0,50);
|
m_SearchResults.SetColumnWidth(0, 50);
|
||||||
m_SearchResults.SetColumnWidth(1,75);
|
m_SearchResults.SetColumnWidth(1, 75);
|
||||||
m_SearchResults.SetColumnWidth(2,75);
|
m_SearchResults.SetColumnWidth(2, 75);
|
||||||
m_SearchResults.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT);
|
m_SearchResults.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT);
|
||||||
m_UnknownOptions.Attach(GetDlgItem(IDC_CMB_UNKNOWN));
|
m_UnknownOptions.Attach(GetDlgItem(IDC_CMB_UNKNOWN));
|
||||||
m_HaveResults = false;
|
m_HaveResults = false;
|
||||||
FixUnknownOptions(true);
|
FixUnknownOptions(true);
|
||||||
|
|
||||||
SendMessage(GetDlgItem(IDC_RADIO_VALUE),BM_SETCHECK, BST_CHECKED,0);
|
SendMessage(GetDlgItem(IDC_RADIO_VALUE), BM_SETCHECK, BST_CHECKED, 0);
|
||||||
|
|
||||||
BOOL bHandled;
|
BOOL bHandled;
|
||||||
OnClicked(0,IDC_BTN_RDRAM,NULL,bHandled);
|
OnClicked(0, IDC_BTN_RDRAM, NULL, bHandled);
|
||||||
OnClicked(0,IDC_RADIO_VALUE,NULL,bHandled);
|
OnClicked(0, IDC_RADIO_VALUE, NULL, bHandled);
|
||||||
WindowCreated();
|
WindowCreated();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT CDebugMemorySearch::OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND hWndCtl, BOOL& /*bHandled*/)
|
LRESULT CDebugMemorySearch::OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND hWndCtl, BOOL& /*bHandled*/)
|
||||||
{
|
{
|
||||||
switch(wID)
|
switch (wID)
|
||||||
{
|
{
|
||||||
case IDCANCEL:
|
case IDCANCEL:
|
||||||
EndDialog(0);
|
EndDialog(0);
|
||||||
break;
|
break;
|
||||||
case IDC_BTN_RDRAM:
|
case IDC_BTN_RDRAM:
|
||||||
m_PAddrStart.SetValue(0,true,true);
|
m_PAddrStart.SetValue(0, true, true);
|
||||||
m_SearchLen.SetValue(g_MMU->RdramSize(),true,true);
|
m_SearchLen.SetValue(g_MMU->RdramSize(), true, true);
|
||||||
break;
|
break;
|
||||||
case IDC_BTN_ROM:
|
case IDC_BTN_ROM:
|
||||||
m_PAddrStart.SetValue(0x10000000,true,true);
|
m_PAddrStart.SetValue(0x10000000, true, true);
|
||||||
m_SearchLen.SetValue(g_Rom->GetRomSize(),true,true);
|
m_SearchLen.SetValue(g_Rom->GetRomSize(), true, true);
|
||||||
break;
|
break;
|
||||||
case IDC_BTN_SPMEM:
|
case IDC_BTN_SPMEM:
|
||||||
m_PAddrStart.SetValue(0x04000000,true,true);
|
m_PAddrStart.SetValue(0x04000000, true, true);
|
||||||
m_SearchLen.SetValue(0x2000,true,true);
|
m_SearchLen.SetValue(0x2000, true, true);
|
||||||
break;
|
break;
|
||||||
case IDC_SEARCH_HEX:
|
case IDC_SEARCH_HEX:
|
||||||
{
|
{
|
||||||
bool bChecked = (SendMessage(hWndCtl, BM_GETSTATE, 0,0) & BST_CHECKED) != 0;
|
bool bChecked = (SendMessage(hWndCtl, BM_GETSTATE, 0, 0) & BST_CHECKED) != 0;
|
||||||
m_SearchValue.SetDisplayType( bChecked ? CEditNumber::DisplayHex : CEditNumber::DisplayDec);
|
m_SearchValue.SetDisplayType(bChecked ? CEditNumber::DisplayHex : CEditNumber::DisplayDec);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ID_POPUP_SHOWINMEMORYVIEWER:
|
case ID_POPUP_SHOWINMEMORYVIEWER:
|
||||||
|
@ -139,21 +138,21 @@ LRESULT CDebugMemorySearch::OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND hWndC
|
||||||
EnableJalOptions(true);
|
EnableJalOptions(true);
|
||||||
break;
|
break;
|
||||||
case IDC_BTN_SEARCH:
|
case IDC_BTN_SEARCH:
|
||||||
if (SendMessage(GetDlgItem(IDC_RADIO_UNKNOWN),BM_GETSTATE, 0,0) == BST_CHECKED)
|
if (SendMessage(GetDlgItem(IDC_RADIO_UNKNOWN), BM_GETSTATE, 0, 0) == BST_CHECKED)
|
||||||
{
|
{
|
||||||
g_BaseSystem->ExternalEvent(SysEvent_PauseCPU_SearchMemory);
|
g_BaseSystem->ExternalEvent(SysEvent_PauseCPU_SearchMemory);
|
||||||
SearchForUnknown();
|
SearchForUnknown();
|
||||||
g_BaseSystem->ExternalEvent(SysEvent_ResumeCPU_SearchMemory);
|
g_BaseSystem->ExternalEvent(SysEvent_ResumeCPU_SearchMemory);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (SendMessage(GetDlgItem(IDC_RADIO_VALUE),BM_GETSTATE, 0,0) == BST_CHECKED)
|
if (SendMessage(GetDlgItem(IDC_RADIO_VALUE), BM_GETSTATE, 0, 0) == BST_CHECKED)
|
||||||
{
|
{
|
||||||
g_BaseSystem->ExternalEvent(SysEvent_PauseCPU_SearchMemory);
|
g_BaseSystem->ExternalEvent(SysEvent_PauseCPU_SearchMemory);
|
||||||
SearchForValue();
|
SearchForValue();
|
||||||
g_BaseSystem->ExternalEvent(SysEvent_ResumeCPU_SearchMemory);
|
g_BaseSystem->ExternalEvent(SysEvent_ResumeCPU_SearchMemory);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (SendMessage(GetDlgItem(IDC_RADIO_TEXT),BM_GETSTATE, 0,0) == BST_CHECKED)
|
if (SendMessage(GetDlgItem(IDC_RADIO_TEXT), BM_GETSTATE, 0, 0) == BST_CHECKED)
|
||||||
{
|
{
|
||||||
g_BaseSystem->ExternalEvent(SysEvent_PauseCPU_SearchMemory);
|
g_BaseSystem->ExternalEvent(SysEvent_PauseCPU_SearchMemory);
|
||||||
SearchForText();
|
SearchForText();
|
||||||
|
@ -167,7 +166,7 @@ LRESULT CDebugMemorySearch::OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND hWndC
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT CDebugMemorySearch::OnResultRClick ( LPNMHDR /*lpnmh*/ )
|
LRESULT CDebugMemorySearch::OnResultRClick(LPNMHDR /*lpnmh*/)
|
||||||
{
|
{
|
||||||
LONG iItem = m_SearchResults.GetNextItem(-1, LVNI_SELECTED);
|
LONG iItem = m_SearchResults.GetNextItem(-1, LVNI_SELECTED);
|
||||||
if (iItem == -1)
|
if (iItem == -1)
|
||||||
|
@ -176,54 +175,54 @@ LRESULT CDebugMemorySearch::OnResultRClick ( LPNMHDR /*lpnmh*/ )
|
||||||
}
|
}
|
||||||
|
|
||||||
//Load the menu
|
//Load the menu
|
||||||
HMENU hMenu = LoadMenu(GetModuleHandle(NULL),MAKEINTRESOURCE(IDR_MEM_SEARCH));
|
HMENU hMenu = LoadMenu(GetModuleHandle(NULL), MAKEINTRESOURCE(IDR_MEM_SEARCH));
|
||||||
HMENU hPopupMenu = GetSubMenu(hMenu,0);
|
HMENU hPopupMenu = GetSubMenu(hMenu, 0);
|
||||||
|
|
||||||
//Get the current Mouse location
|
//Get the current Mouse location
|
||||||
POINT Mouse;
|
POINT Mouse;
|
||||||
GetCursorPos(&Mouse);
|
GetCursorPos(&Mouse);
|
||||||
|
|
||||||
//Show the menu
|
//Show the menu
|
||||||
TrackPopupMenu(hPopupMenu, 0, Mouse.x, Mouse.y, 0,m_hWnd, NULL);
|
TrackPopupMenu(hPopupMenu, 0, Mouse.x, Mouse.y, 0, m_hWnd, NULL);
|
||||||
DestroyMenu(hMenu);
|
DestroyMenu(hMenu);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDebugMemorySearch::EnableValueOptions( bool Enable )
|
void CDebugMemorySearch::EnableValueOptions(bool Enable)
|
||||||
{
|
{
|
||||||
if (Enable)
|
if (Enable)
|
||||||
{
|
{
|
||||||
::SetWindowText(GetDlgItem(IDC_BTN_SEARCH),m_HaveResults ? "Search Results" : "Search");
|
::SetWindowText(GetDlgItem(IDC_BTN_SEARCH), m_HaveResults ? "Search Results" : "Search");
|
||||||
}
|
}
|
||||||
::EnableWindow(GetDlgItem(IDC_SEARCH_VALUE),Enable);
|
::EnableWindow(GetDlgItem(IDC_SEARCH_VALUE), Enable);
|
||||||
::EnableWindow(GetDlgItem(IDC_SEARCH_HEX),Enable);
|
::EnableWindow(GetDlgItem(IDC_SEARCH_HEX), Enable);
|
||||||
::EnableWindow(GetDlgItem(IDC_VALUE_ALIGN),m_HaveResults ? false : Enable );
|
::EnableWindow(GetDlgItem(IDC_VALUE_ALIGN), m_HaveResults ? false : Enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDebugMemorySearch::EnableTextOptions( bool Enable )
|
void CDebugMemorySearch::EnableTextOptions(bool Enable)
|
||||||
{
|
{
|
||||||
if (Enable)
|
if (Enable)
|
||||||
{
|
{
|
||||||
::SetWindowText(GetDlgItem(IDC_BTN_SEARCH),m_HaveResults ? "Search Results" : "Search");
|
::SetWindowText(GetDlgItem(IDC_BTN_SEARCH), m_HaveResults ? "Search Results" : "Search");
|
||||||
}
|
}
|
||||||
::EnableWindow(GetDlgItem(IDC_SEARCH_TEXT),Enable);
|
::EnableWindow(GetDlgItem(IDC_SEARCH_TEXT), Enable);
|
||||||
::EnableWindow(GetDlgItem(IDC_CASE_SENSITIVE),Enable);
|
::EnableWindow(GetDlgItem(IDC_CASE_SENSITIVE), Enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDebugMemorySearch::EnableJalOptions( bool Enable )
|
void CDebugMemorySearch::EnableJalOptions(bool Enable)
|
||||||
{
|
{
|
||||||
if (Enable)
|
if (Enable)
|
||||||
{
|
{
|
||||||
::SetWindowText(GetDlgItem(IDC_BTN_SEARCH),m_HaveResults ? "Search Results" : "Search");
|
::SetWindowText(GetDlgItem(IDC_BTN_SEARCH), m_HaveResults ? "Search Results" : "Search");
|
||||||
}
|
}
|
||||||
::EnableWindow(GetDlgItem(IDC_JAL_ADDR),Enable);
|
::EnableWindow(GetDlgItem(IDC_JAL_ADDR), Enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDebugMemorySearch::EnableUnknownOptions( bool Enable )
|
void CDebugMemorySearch::EnableUnknownOptions(bool Enable)
|
||||||
{
|
{
|
||||||
if (m_UnknownOptions.GetCount() > 1)
|
if (m_UnknownOptions.GetCount() > 1)
|
||||||
{
|
{
|
||||||
::EnableWindow(GetDlgItem(IDC_UNKNOWN_ALIGN),m_HaveResults ? false : Enable );
|
::EnableWindow(GetDlgItem(IDC_UNKNOWN_ALIGN), m_HaveResults ? false : Enable);
|
||||||
if (Enable)
|
if (Enable)
|
||||||
{
|
{
|
||||||
::SetWindowText(GetDlgItem(IDC_BTN_SEARCH), m_HaveResults ? "Search Results" : "Search");
|
::SetWindowText(GetDlgItem(IDC_BTN_SEARCH), m_HaveResults ? "Search Results" : "Search");
|
||||||
|
@ -231,16 +230,16 @@ void CDebugMemorySearch::EnableUnknownOptions( bool Enable )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
::EnableWindow(GetDlgItem(IDC_UNKNOWN_ALIGN), false );
|
::EnableWindow(GetDlgItem(IDC_UNKNOWN_ALIGN), false);
|
||||||
if (Enable)
|
if (Enable)
|
||||||
{
|
{
|
||||||
::SetWindowText(GetDlgItem(IDC_BTN_SEARCH), "Create");
|
::SetWindowText(GetDlgItem(IDC_BTN_SEARCH), "Create");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
::EnableWindow(GetDlgItem(IDC_CMB_UNKNOWN),Enable);
|
::EnableWindow(GetDlgItem(IDC_CMB_UNKNOWN), Enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDebugMemorySearch::SearchForValue( void )
|
void CDebugMemorySearch::SearchForValue(void)
|
||||||
{
|
{
|
||||||
MemorySize Size = (MemorySize)m_ValueSize.GetItemData(m_ValueSize.GetCurSel());
|
MemorySize Size = (MemorySize)m_ValueSize.GetItemData(m_ValueSize.GetCurSel());
|
||||||
DWORD Value = m_SearchValue.GetValue();
|
DWORD Value = m_SearchValue.GetValue();
|
||||||
|
@ -270,23 +269,23 @@ void CDebugMemorySearch::SearchForValue( void )
|
||||||
m_SearchResults.DeleteAllItems();
|
m_SearchResults.DeleteAllItems();
|
||||||
DWORD ItemsAdded = 0;
|
DWORD ItemsAdded = 0;
|
||||||
|
|
||||||
while (SearchForValue(Value,Size,StartAddress,Len))
|
while (SearchForValue(Value, Size, StartAddress, Len))
|
||||||
{
|
{
|
||||||
SearchResultItem Result;
|
SearchResultItem Result;
|
||||||
Result.PAddr = StartAddress;
|
Result.PAddr = StartAddress;
|
||||||
Result.Value = Value;
|
Result.Value = Value;
|
||||||
|
|
||||||
char LocationStr[20];
|
char LocationStr[20];
|
||||||
sprintf(LocationStr,"%d",ItemsAdded + 1);
|
sprintf(LocationStr, "%d", ItemsAdded + 1);
|
||||||
int Index = m_SearchResults.AddItem(ItemsAdded,0,LocationStr);
|
int Index = m_SearchResults.AddItem(ItemsAdded, 0, LocationStr);
|
||||||
m_SearchResults.SetItemData(Index,m_SearchResult.size());
|
m_SearchResults.SetItemData(Index, m_SearchResult.size());
|
||||||
m_SearchResult.push_back(Result);
|
m_SearchResult.push_back(Result);
|
||||||
sprintf(LocationStr,"0x%08X",StartAddress);
|
sprintf(LocationStr, "0x%08X", StartAddress);
|
||||||
m_SearchResults.SetItemText(Index,1,LocationStr);
|
m_SearchResults.SetItemText(Index, 1, LocationStr);
|
||||||
sprintf(LocationStr,DisplayStr,Value);
|
sprintf(LocationStr, DisplayStr, Value);
|
||||||
m_SearchResults.SetItemText(Index,2,LocationStr);
|
m_SearchResults.SetItemText(Index, 2, LocationStr);
|
||||||
sprintf(LocationStr,DisplayStr,Value);
|
sprintf(LocationStr, DisplayStr, Value);
|
||||||
m_SearchResults.SetItemText(Index,3,LocationStr);
|
m_SearchResults.SetItemText(Index, 3, LocationStr);
|
||||||
StartAddress += MoveSize;
|
StartAddress += MoveSize;
|
||||||
Len -= MoveSize;
|
Len -= MoveSize;
|
||||||
ItemsAdded += 1;
|
ItemsAdded += 1;
|
||||||
|
@ -295,9 +294,9 @@ void CDebugMemorySearch::SearchForValue( void )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
::SetWindowText(GetDlgItem(IDC_BTN_SEARCH),"Search Results");
|
::SetWindowText(GetDlgItem(IDC_BTN_SEARCH), "Search Results");
|
||||||
::ShowWindow(GetDlgItem(IDC_RESET_BUTTON),SW_SHOW);
|
::ShowWindow(GetDlgItem(IDC_RESET_BUTTON), SW_SHOW);
|
||||||
::EnableWindow(GetDlgItem(IDC_VALUE_ALIGN),false);
|
::EnableWindow(GetDlgItem(IDC_VALUE_ALIGN), false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -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)
|
||||||
|
@ -330,16 +329,16 @@ void CDebugMemorySearch::SearchForValue( void )
|
||||||
valid = g_MMU->LW_PAddr(Result.PAddr, NewValue);
|
valid = g_MMU->LW_PAddr(Result.PAddr, NewValue);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_Notify->BreakPoint(__FILEW__,__LINE__);
|
g_Notify->BreakPoint(__FILEW__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Value == NewValue)
|
if (Value == NewValue)
|
||||||
{
|
{
|
||||||
char LocationStr[20];
|
char LocationStr[20];
|
||||||
sprintf(LocationStr,DisplayStr,NewValue);
|
sprintf(LocationStr, DisplayStr, NewValue);
|
||||||
m_SearchResults.SetItemText(i,2,LocationStr);
|
m_SearchResults.SetItemText(i, 2, LocationStr);
|
||||||
sprintf(LocationStr,DisplayStr,Result.Value);
|
sprintf(LocationStr, DisplayStr, Result.Value);
|
||||||
m_SearchResults.SetItemText(i,3,LocationStr);
|
m_SearchResults.SetItemText(i, 3, LocationStr);
|
||||||
Result.Value = NewValue;
|
Result.Value = NewValue;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -348,7 +347,7 @@ void CDebugMemorySearch::SearchForValue( void )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
::SetWindowText(GetDlgItem(IDC_BORDER_RESULTS),stdstr_f("Results (%d)",m_SearchResults.GetItemCount()).c_str());
|
::SetWindowText(GetDlgItem(IDC_BORDER_RESULTS), stdstr_f("Results (%d)", m_SearchResults.GetItemCount()).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDebugMemorySearch::SearchForUnknown()
|
void CDebugMemorySearch::SearchForUnknown()
|
||||||
|
@ -359,8 +358,8 @@ void CDebugMemorySearch::SearchForUnknown()
|
||||||
m_SearchResults.DeleteAllItems();
|
m_SearchResults.DeleteAllItems();
|
||||||
SearchSetBaseForChanges();
|
SearchSetBaseForChanges();
|
||||||
FixUnknownOptions(false);
|
FixUnknownOptions(false);
|
||||||
::ShowWindow(GetDlgItem(IDC_RESET_BUTTON),SW_SHOW);
|
::ShowWindow(GetDlgItem(IDC_RESET_BUTTON), SW_SHOW);
|
||||||
::EnableWindow(GetDlgItem(IDC_UNKNOWN_ALIGN),true );
|
::EnableWindow(GetDlgItem(IDC_UNKNOWN_ALIGN), true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MemorySize Size = (MemorySize)m_UnknownSize.GetItemData(m_UnknownSize.GetCurSel());
|
MemorySize Size = (MemorySize)m_UnknownSize.GetItemData(m_UnknownSize.GetCurSel());
|
||||||
|
@ -378,7 +377,7 @@ void CDebugMemorySearch::SearchForUnknown()
|
||||||
{
|
{
|
||||||
m_HaveResults = true;
|
m_HaveResults = true;
|
||||||
|
|
||||||
::EnableWindow(GetDlgItem(IDC_UNKNOWN_ALIGN),false );
|
::EnableWindow(GetDlgItem(IDC_UNKNOWN_ALIGN), false);
|
||||||
DWORD StartAddress = m_PAddrStart.GetValue();
|
DWORD StartAddress = m_PAddrStart.GetValue();
|
||||||
DWORD Len = m_SearchLen.GetValue();
|
DWORD Len = m_SearchLen.GetValue();
|
||||||
DWORD MaxSearch = m_MaxSearch.GetValue();
|
DWORD MaxSearch = m_MaxSearch.GetValue();
|
||||||
|
@ -392,17 +391,17 @@ void CDebugMemorySearch::SearchForUnknown()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_SearchResults.AddColumn("New Value",2);
|
m_SearchResults.AddColumn("New Value", 2);
|
||||||
m_SearchResults.AddColumn("Old Value",3);
|
m_SearchResults.AddColumn("Old Value", 3);
|
||||||
m_SearchResults.SetColumnWidth(0,50);
|
m_SearchResults.SetColumnWidth(0, 50);
|
||||||
m_SearchResults.SetColumnWidth(1,75);
|
m_SearchResults.SetColumnWidth(1, 75);
|
||||||
m_SearchResults.SetColumnWidth(2,75);
|
m_SearchResults.SetColumnWidth(2, 75);
|
||||||
m_SearchResults.SetColumnWidth(3,75);
|
m_SearchResults.SetColumnWidth(3, 75);
|
||||||
|
|
||||||
m_SearchResults.DeleteAllItems();
|
m_SearchResults.DeleteAllItems();
|
||||||
DWORD ItemsAdded = 0, OldValue, NewValue;
|
DWORD ItemsAdded = 0, OldValue, NewValue;
|
||||||
|
|
||||||
while (SearchForChanges(Option,Size,StartAddress,Len,OldValue,NewValue))
|
while (SearchForChanges(Option, Size, StartAddress, Len, OldValue, NewValue))
|
||||||
{
|
{
|
||||||
SearchResultItem Result;
|
SearchResultItem Result;
|
||||||
Result.PAddr = StartAddress;
|
Result.PAddr = StartAddress;
|
||||||
|
@ -410,16 +409,16 @@ void CDebugMemorySearch::SearchForUnknown()
|
||||||
|
|
||||||
//if list size > max, then break
|
//if list size > max, then break
|
||||||
char LocationStr[20];
|
char LocationStr[20];
|
||||||
sprintf(LocationStr,"%d",ItemsAdded + 1);
|
sprintf(LocationStr, "%d", ItemsAdded + 1);
|
||||||
int Index = m_SearchResults.AddItem(ItemsAdded,0,LocationStr);
|
int Index = m_SearchResults.AddItem(ItemsAdded, 0, LocationStr);
|
||||||
m_SearchResults.SetItemData(Index,m_SearchResult.size());
|
m_SearchResults.SetItemData(Index, m_SearchResult.size());
|
||||||
m_SearchResult.push_back(Result);
|
m_SearchResult.push_back(Result);
|
||||||
sprintf(LocationStr,"0x%08X",StartAddress);
|
sprintf(LocationStr, "0x%08X", StartAddress);
|
||||||
m_SearchResults.SetItemText(Index,1,LocationStr);
|
m_SearchResults.SetItemText(Index, 1, LocationStr);
|
||||||
sprintf(LocationStr,DisplayStr,NewValue);
|
sprintf(LocationStr, DisplayStr, NewValue);
|
||||||
m_SearchResults.SetItemText(Index,2,LocationStr);
|
m_SearchResults.SetItemText(Index, 2, LocationStr);
|
||||||
sprintf(LocationStr,DisplayStr,OldValue);
|
sprintf(LocationStr, DisplayStr, OldValue);
|
||||||
m_SearchResults.SetItemText(Index,3,LocationStr);
|
m_SearchResults.SetItemText(Index, 3, LocationStr);
|
||||||
StartAddress += MoveSize;
|
StartAddress += MoveSize;
|
||||||
Len -= MoveSize;
|
Len -= MoveSize;
|
||||||
ItemsAdded += 1;
|
ItemsAdded += 1;
|
||||||
|
@ -428,10 +427,10 @@ void CDebugMemorySearch::SearchForUnknown()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
::SetWindowText(GetDlgItem(IDC_BTN_SEARCH),"Search Results");
|
::SetWindowText(GetDlgItem(IDC_BTN_SEARCH), "Search Results");
|
||||||
::ShowWindow(GetDlgItem(IDC_RESET_BUTTON),SW_SHOW);
|
::ShowWindow(GetDlgItem(IDC_RESET_BUTTON), SW_SHOW);
|
||||||
::EnableWindow(GetDlgItem(IDC_RADIO_TEXT),false);
|
::EnableWindow(GetDlgItem(IDC_RADIO_TEXT), false);
|
||||||
::EnableWindow(GetDlgItem(IDC_RADIO_JAL),false);
|
::EnableWindow(GetDlgItem(IDC_RADIO_JAL), false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -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)
|
||||||
|
@ -465,7 +464,7 @@ void CDebugMemorySearch::SearchForUnknown()
|
||||||
valid = g_MMU->LW_PAddr(Result.PAddr, NewValue);
|
valid = g_MMU->LW_PAddr(Result.PAddr, NewValue);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_Notify->BreakPoint(__FILEW__,__LINE__);
|
g_Notify->BreakPoint(__FILEW__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (Option)
|
switch (Option)
|
||||||
|
@ -495,16 +494,16 @@ void CDebugMemorySearch::SearchForUnknown()
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_Notify->BreakPoint(__FILEW__,__LINE__);
|
g_Notify->BreakPoint(__FILEW__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (UpdateResult)
|
if (UpdateResult)
|
||||||
{
|
{
|
||||||
char LocationStr[20];
|
char LocationStr[20];
|
||||||
sprintf(LocationStr,DisplayStr,NewValue);
|
sprintf(LocationStr, DisplayStr, NewValue);
|
||||||
m_SearchResults.SetItemText(i,2,LocationStr);
|
m_SearchResults.SetItemText(i, 2, LocationStr);
|
||||||
sprintf(LocationStr,DisplayStr,Result.Value);
|
sprintf(LocationStr, DisplayStr, Result.Value);
|
||||||
m_SearchResults.SetItemText(i,3,LocationStr);
|
m_SearchResults.SetItemText(i, 3, LocationStr);
|
||||||
Result.Value = NewValue;
|
Result.Value = NewValue;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -513,29 +512,29 @@ void CDebugMemorySearch::SearchForUnknown()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
::SetWindowText(GetDlgItem(IDC_BORDER_RESULTS),stdstr_f("Results (%d)",m_SearchResults.GetItemCount()).c_str());
|
::SetWindowText(GetDlgItem(IDC_BORDER_RESULTS), stdstr_f("Results (%d)", m_SearchResults.GetItemCount()).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDebugMemorySearch::SearchForText()
|
void CDebugMemorySearch::SearchForText()
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILEW__,__LINE__);
|
g_Notify->BreakPoint(__FILEW__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDebugMemorySearch::Reset ( void )
|
void CDebugMemorySearch::Reset(void)
|
||||||
{
|
{
|
||||||
m_HaveResults = false;
|
m_HaveResults = false;
|
||||||
SendMessage(GetDlgItem(IDC_RADIO_VALUE),BM_SETCHECK, BST_CHECKED,0);
|
SendMessage(GetDlgItem(IDC_RADIO_VALUE), BM_SETCHECK, BST_CHECKED, 0);
|
||||||
EnableUnknownOptions(false);
|
EnableUnknownOptions(false);
|
||||||
EnableValueOptions(true);
|
EnableValueOptions(true);
|
||||||
EnableTextOptions(false);
|
EnableTextOptions(false);
|
||||||
EnableJalOptions(false);
|
EnableJalOptions(false);
|
||||||
::SetWindowText(GetDlgItem(IDC_BTN_SEARCH),"Search");
|
::SetWindowText(GetDlgItem(IDC_BTN_SEARCH), "Search");
|
||||||
::SetWindowText(GetDlgItem(IDC_BORDER_RESULTS),"Results");
|
::SetWindowText(GetDlgItem(IDC_BORDER_RESULTS), "Results");
|
||||||
::ShowWindow(GetDlgItem(IDC_RESET_BUTTON),SW_HIDE);
|
::ShowWindow(GetDlgItem(IDC_RESET_BUTTON), SW_HIDE);
|
||||||
::EnableWindow(GetDlgItem(IDC_RADIO_UNKNOWN),true);
|
::EnableWindow(GetDlgItem(IDC_RADIO_UNKNOWN), true);
|
||||||
::EnableWindow(GetDlgItem(IDC_RADIO_VALUE),true);
|
::EnableWindow(GetDlgItem(IDC_RADIO_VALUE), true);
|
||||||
::EnableWindow(GetDlgItem(IDC_RADIO_TEXT),false);
|
::EnableWindow(GetDlgItem(IDC_RADIO_TEXT), false);
|
||||||
::EnableWindow(GetDlgItem(IDC_RADIO_JAL),false);
|
::EnableWindow(GetDlgItem(IDC_RADIO_JAL), false);
|
||||||
for (int i = 1; i < 10; i++)
|
for (int i = 1; i < 10; i++)
|
||||||
{
|
{
|
||||||
if (!m_SearchResults.DeleteColumn(i))
|
if (!m_SearchResults.DeleteColumn(i))
|
||||||
|
@ -543,18 +542,18 @@ void CDebugMemorySearch::Reset ( void )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_SearchResults.AddColumn("Value",2);
|
m_SearchResults.AddColumn("Value", 2);
|
||||||
m_SearchResults.DeleteAllItems();
|
m_SearchResults.DeleteAllItems();
|
||||||
m_SearchResults.SetColumnWidth(0,50);
|
m_SearchResults.SetColumnWidth(0, 50);
|
||||||
m_SearchResults.SetColumnWidth(1,75);
|
m_SearchResults.SetColumnWidth(1, 75);
|
||||||
m_SearchResults.SetColumnWidth(2,75);
|
m_SearchResults.SetColumnWidth(2, 75);
|
||||||
m_SearchResults.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT);
|
m_SearchResults.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT);
|
||||||
FixUnknownOptions(true);
|
FixUnknownOptions(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDebugMemorySearch::FixUnknownOptions ( bool Reset )
|
void CDebugMemorySearch::FixUnknownOptions(bool Reset)
|
||||||
{
|
{
|
||||||
CComboBox & cb = m_UnknownOptions ;
|
CComboBox & cb = m_UnknownOptions;
|
||||||
|
|
||||||
if (!Reset && cb.GetCount() > 1)
|
if (!Reset && cb.GetCount() > 1)
|
||||||
{
|
{
|
||||||
|
@ -563,27 +562,27 @@ void CDebugMemorySearch::FixUnknownOptions ( bool Reset )
|
||||||
cb.ResetContent();
|
cb.ResetContent();
|
||||||
if (Reset)
|
if (Reset)
|
||||||
{
|
{
|
||||||
cb.SetItemData(cb.AddString("Create compare base"),SearchChangeState_Reset);
|
cb.SetItemData(cb.AddString("Create compare base"), SearchChangeState_Reset);
|
||||||
cb.SetCurSel(0);
|
cb.SetCurSel(0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
cb.SetItemData(cb.AddString("memory changed"),SearchChangeState_Changed);
|
cb.SetItemData(cb.AddString("memory changed"), SearchChangeState_Changed);
|
||||||
cb.SetItemData(cb.AddString("memory unchanged"),SearchChangeState_Unchanged);
|
cb.SetItemData(cb.AddString("memory unchanged"), SearchChangeState_Unchanged);
|
||||||
cb.SetItemData(cb.AddString("Value has increased"),SearchChangeState_Greater);
|
cb.SetItemData(cb.AddString("Value has increased"), SearchChangeState_Greater);
|
||||||
cb.SetItemData(cb.AddString("Value has descreased"),SearchChangeState_Lessthan);
|
cb.SetItemData(cb.AddString("Value has descreased"), SearchChangeState_Lessthan);
|
||||||
cb.SetCurSel(1);
|
cb.SetCurSel(1);
|
||||||
::SetWindowText(GetDlgItem(IDC_BTN_SEARCH),"Search");
|
::SetWindowText(GetDlgItem(IDC_BTN_SEARCH), "Search");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CDebugMemorySearch::SearchSetBaseForChanges ( void )
|
bool CDebugMemorySearch::SearchSetBaseForChanges(void)
|
||||||
{
|
{
|
||||||
if (m_MemoryState != NULL)
|
if (m_MemoryState != NULL)
|
||||||
{
|
{
|
||||||
delete [] m_MemoryState;
|
delete[] m_MemoryState;
|
||||||
}
|
}
|
||||||
m_MemoryStateSize = g_MMU->RdramSize();
|
m_MemoryStateSize = g_MMU->RdramSize();
|
||||||
m_MemoryState = new BYTE[m_MemoryStateSize];
|
m_MemoryState = new BYTE[m_MemoryStateSize];
|
||||||
memcpy(m_MemoryState,g_MMU->Rdram(),m_MemoryStateSize);
|
memcpy(m_MemoryState, g_MMU->Rdram(), m_MemoryStateSize);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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); }
|
||||||
|
@ -649,7 +648,7 @@ bool CDebugMemorySearch::SearchForChanges(SearchMemChangeState SearchType, Memor
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case _8Bit:
|
case _8Bit:
|
||||||
for (pos = StartAddress; pos < EndMemSearchAddr; pos ++)
|
for (pos = StartAddress; pos < EndMemSearchAddr; pos++)
|
||||||
{
|
{
|
||||||
OldValue = *(BYTE *)(m_MemoryState + (pos ^ 3));
|
OldValue = *(BYTE *)(m_MemoryState + (pos ^ 3));
|
||||||
NewValue = *(BYTE *)(g_MMU->Rdram() + (pos ^ 3));
|
NewValue = *(BYTE *)(g_MMU->Rdram() + (pos ^ 3));
|
||||||
|
@ -665,13 +664,13 @@ bool CDebugMemorySearch::SearchForChanges(SearchMemChangeState SearchType, Memor
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_Notify->BreakPoint(__FILEW__,__LINE__);
|
g_Notify->BreakPoint(__FILEW__, __LINE__);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CDebugMemorySearch::SearchForValue (DWORD Value, MemorySize Size, DWORD &StartAddress, DWORD &Len )
|
bool CDebugMemorySearch::SearchForValue(DWORD Value, MemorySize Size, DWORD &StartAddress, DWORD &Len)
|
||||||
{
|
{
|
||||||
if (g_MMU == NULL || g_Rom == NULL)
|
if (g_MMU == NULL || g_Rom == NULL)
|
||||||
{
|
{
|
||||||
|
@ -723,7 +722,7 @@ bool CDebugMemorySearch::SearchForValue (DWORD Value, MemorySize Size, DWORD &St
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case _8Bit:
|
case _8Bit:
|
||||||
for (pos = StartAddress; pos < EndMemSearchAddr; pos ++)
|
for (pos = StartAddress; pos < EndMemSearchAddr; pos++)
|
||||||
{
|
{
|
||||||
if (*(BYTE *)(RDRAM + (pos ^ 3)) == (BYTE)Value)
|
if (*(BYTE *)(RDRAM + (pos ^ 3)) == (BYTE)Value)
|
||||||
{
|
{
|
||||||
|
@ -734,7 +733,7 @@ bool CDebugMemorySearch::SearchForValue (DWORD Value, MemorySize Size, DWORD &St
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_Notify->BreakPoint(__FILEW__,__LINE__);
|
g_Notify->BreakPoint(__FILEW__, __LINE__);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (StartAddress >= 0x10000000)
|
if (StartAddress >= 0x10000000)
|
||||||
|
@ -773,7 +772,7 @@ bool CDebugMemorySearch::SearchForValue (DWORD Value, MemorySize Size, DWORD &St
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case _8Bit:
|
case _8Bit:
|
||||||
for (pos = StartAddress; pos < EndMemSearchAddr; pos ++)
|
for (pos = StartAddress; pos < EndMemSearchAddr; pos++)
|
||||||
{
|
{
|
||||||
if (*(BYTE *)(ROM + (pos ^ 3)) == (BYTE)Value)
|
if (*(BYTE *)(ROM + (pos ^ 3)) == (BYTE)Value)
|
||||||
{
|
{
|
||||||
|
@ -784,9 +783,8 @@ bool CDebugMemorySearch::SearchForValue (DWORD Value, MemorySize Size, DWORD &St
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_Notify->BreakPoint(__FILEW__,__LINE__);
|
g_Notify->BreakPoint(__FILEW__, __LINE__);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project 64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
|
@ -11,12 +11,12 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
class CDebugMemorySearch :
|
class CDebugMemorySearch :
|
||||||
public CDebugDialog<CDebugMemorySearch>
|
public CDebugDialog < 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:
|
||||||
|
@ -51,19 +51,19 @@ private:
|
||||||
|
|
||||||
BEGIN_MSG_MAP_EX(CDebugMemorySearch)
|
BEGIN_MSG_MAP_EX(CDebugMemorySearch)
|
||||||
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
|
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
|
||||||
COMMAND_CODE_HANDLER(BN_CLICKED,OnClicked)
|
COMMAND_CODE_HANDLER(BN_CLICKED, OnClicked)
|
||||||
NOTIFY_HANDLER_EX(IDC_LST_RESULTS,NM_RCLICK,OnResultRClick)
|
NOTIFY_HANDLER_EX(IDC_LST_RESULTS, NM_RCLICK, OnResultRClick)
|
||||||
END_MSG_MAP()
|
END_MSG_MAP()
|
||||||
|
|
||||||
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
|
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
|
||||||
LRESULT OnClicked(WORD wNotifyCode, WORD wID, HWND /*hWndCtl*/, BOOL& bHandled);
|
LRESULT OnClicked(WORD wNotifyCode, WORD wID, HWND /*hWndCtl*/, BOOL& bHandled);
|
||||||
LRESULT OnResultRClick ( LPNMHDR lpnmh );
|
LRESULT OnResultRClick(LPNMHDR lpnmh);
|
||||||
|
|
||||||
void EnableUnknownOptions ( bool Enable );
|
void EnableUnknownOptions(bool Enable);
|
||||||
void EnableValueOptions ( bool Enable );
|
void EnableValueOptions(bool Enable);
|
||||||
void EnableTextOptions ( bool Enable );
|
void EnableTextOptions(bool Enable);
|
||||||
void EnableJalOptions ( bool Enable );
|
void EnableJalOptions(bool Enable);
|
||||||
void AddAlignmentOptions ( CComboBox & ctrl );
|
void AddAlignmentOptions(CComboBox & ctrl);
|
||||||
|
|
||||||
CEditNumber m_PAddrStart, m_SearchLen, m_SearchValue, m_MaxSearch;
|
CEditNumber m_PAddrStart, m_SearchLen, m_SearchValue, m_MaxSearch;
|
||||||
CComboBox m_UnknownOptions, m_ValueSize, m_UnknownSize;
|
CComboBox m_UnknownOptions, m_ValueSize, m_UnknownSize;
|
||||||
|
@ -75,12 +75,12 @@ private:
|
||||||
BYTE * m_MemoryState;
|
BYTE * m_MemoryState;
|
||||||
DWORD m_MemoryStateSize;
|
DWORD m_MemoryStateSize;
|
||||||
|
|
||||||
void FixUnknownOptions ( bool Reset );
|
void FixUnknownOptions(bool Reset);
|
||||||
void SearchForUnknown ( void );
|
void SearchForUnknown(void);
|
||||||
void SearchForValue ( void );
|
void SearchForValue(void);
|
||||||
void SearchForText ( void );
|
void SearchForText(void);
|
||||||
void Reset ( void );
|
void Reset(void);
|
||||||
bool SearchSetBaseForChanges ( void );
|
bool SearchSetBaseForChanges(void);
|
||||||
bool SearchForChanges ( SearchMemChangeState SearchType, MemorySize Size, DWORD &StartAddress, DWORD &Len, DWORD &OldValue, DWORD &NewValue );
|
bool SearchForChanges(SearchMemChangeState SearchType, MemorySize Size, DWORD &StartAddress, DWORD &Len, DWORD &OldValue, DWORD &NewValue);
|
||||||
bool SearchForValue ( DWORD Value, MemorySize Size, DWORD &StartAddress, DWORD &Len );
|
bool SearchForValue(DWORD Value, MemorySize Size, DWORD &StartAddress, DWORD &Len);
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project 64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
|
@ -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)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -32,79 +31,79 @@ LRESULT CDebugTlb::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lPara
|
||||||
col.pszText = "Index";
|
col.pszText = "Index";
|
||||||
col.cx = 40;
|
col.cx = 40;
|
||||||
col.iSubItem = 0;
|
col.iSubItem = 0;
|
||||||
ListView_InsertColumn ( GetDlgItem(IDC_LIST), 0, &col);
|
ListView_InsertColumn(GetDlgItem(IDC_LIST), 0, &col);
|
||||||
|
|
||||||
col.pszText = "Page Mask";
|
col.pszText = "Page Mask";
|
||||||
col.cx = 90;
|
col.cx = 90;
|
||||||
col.iSubItem = 1;
|
col.iSubItem = 1;
|
||||||
ListView_InsertColumn ( GetDlgItem(IDC_LIST), 1, &col);
|
ListView_InsertColumn(GetDlgItem(IDC_LIST), 1, &col);
|
||||||
|
|
||||||
col.pszText = "Entry Hi";
|
col.pszText = "Entry Hi";
|
||||||
col.cx = 90;
|
col.cx = 90;
|
||||||
col.iSubItem = 2;
|
col.iSubItem = 2;
|
||||||
ListView_InsertColumn ( GetDlgItem(IDC_LIST), 2, &col);
|
ListView_InsertColumn(GetDlgItem(IDC_LIST), 2, &col);
|
||||||
|
|
||||||
col.pszText = "Entry Lo0";
|
col.pszText = "Entry Lo0";
|
||||||
col.cx = 90;
|
col.cx = 90;
|
||||||
col.iSubItem = 3;
|
col.iSubItem = 3;
|
||||||
ListView_InsertColumn ( GetDlgItem(IDC_LIST), 3, &col);
|
ListView_InsertColumn(GetDlgItem(IDC_LIST), 3, &col);
|
||||||
|
|
||||||
col.pszText = "Entry Lo1";
|
col.pszText = "Entry Lo1";
|
||||||
col.cx = 90;
|
col.cx = 90;
|
||||||
col.iSubItem = 4;
|
col.iSubItem = 4;
|
||||||
ListView_InsertColumn ( GetDlgItem(IDC_LIST), 4, &col);
|
ListView_InsertColumn(GetDlgItem(IDC_LIST), 4, &col);
|
||||||
|
|
||||||
col.pszText = "Index";
|
col.pszText = "Index";
|
||||||
col.cx = 40;
|
col.cx = 40;
|
||||||
col.iSubItem = 0;
|
col.iSubItem = 0;
|
||||||
ListView_InsertColumn ( GetDlgItem(IDC_LIST2), 0, &col);
|
ListView_InsertColumn(GetDlgItem(IDC_LIST2), 0, &col);
|
||||||
|
|
||||||
col.pszText = "Valid";
|
col.pszText = "Valid";
|
||||||
col.cx = 40;
|
col.cx = 40;
|
||||||
col.iSubItem = 1;
|
col.iSubItem = 1;
|
||||||
ListView_InsertColumn ( GetDlgItem(IDC_LIST2), 1, &col);
|
ListView_InsertColumn(GetDlgItem(IDC_LIST2), 1, &col);
|
||||||
|
|
||||||
col.pszText = "Dirty";
|
col.pszText = "Dirty";
|
||||||
col.cx = 40;
|
col.cx = 40;
|
||||||
col.iSubItem = 2;
|
col.iSubItem = 2;
|
||||||
ListView_InsertColumn ( GetDlgItem(IDC_LIST2), 2, &col);
|
ListView_InsertColumn(GetDlgItem(IDC_LIST2), 2, &col);
|
||||||
|
|
||||||
col.pszText = "Rule";
|
col.pszText = "Rule";
|
||||||
col.cx = 270;
|
col.cx = 270;
|
||||||
col.iSubItem = 3;
|
col.iSubItem = 3;
|
||||||
ListView_InsertColumn ( GetDlgItem(IDC_LIST2), 3, &col);
|
ListView_InsertColumn(GetDlgItem(IDC_LIST2), 3, &col);
|
||||||
|
|
||||||
RefreshTLBWindow();
|
RefreshTLBWindow();
|
||||||
SendMessage(GetDlgItem(IDC_TLB_ENTRIES),BM_SETCHECK, BST_CHECKED,0);
|
SendMessage(GetDlgItem(IDC_TLB_ENTRIES), BM_SETCHECK, BST_CHECKED, 0);
|
||||||
|
|
||||||
// if (Settings().Load(TLBWindowLeft) <= 0)
|
// if (Settings().Load(TLBWindowLeft) <= 0)
|
||||||
// {
|
// {
|
||||||
// SetWindowPos(NULL,Settings().Load(TLBWindowLeft),Settings().Load(TLBWindowTop),0,0, SWP_NOZORDER | SWP_NOSIZE | SWP_SHOWWINDOW);
|
// SetWindowPos(NULL,Settings().Load(TLBWindowLeft),Settings().Load(TLBWindowTop),0,0, SWP_NOZORDER | SWP_NOSIZE | SWP_SHOWWINDOW);
|
||||||
// }
|
// }
|
||||||
WindowCreated();
|
WindowCreated();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT CDebugTlb::OnClicked (WORD /*wNotifyCode*/, WORD wID, HWND , BOOL& /*bHandled*/)
|
LRESULT CDebugTlb::OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND, BOOL& /*bHandled*/)
|
||||||
{
|
{
|
||||||
switch(wID)
|
switch (wID)
|
||||||
{
|
{
|
||||||
case IDCANCEL:
|
case IDCANCEL:
|
||||||
EndDialog(0);
|
EndDialog(0);
|
||||||
break;
|
break;
|
||||||
case IDC_TLB_ENTRIES:
|
case IDC_TLB_ENTRIES:
|
||||||
::ShowWindow(GetDlgItem(IDC_LIST),SW_SHOW);
|
::ShowWindow(GetDlgItem(IDC_LIST), SW_SHOW);
|
||||||
::ShowWindow(GetDlgItem(IDC_LIST2),SW_HIDE);
|
::ShowWindow(GetDlgItem(IDC_LIST2), SW_HIDE);
|
||||||
break;
|
break;
|
||||||
case IDC_TLB_RULES:
|
case IDC_TLB_RULES:
|
||||||
::ShowWindow(GetDlgItem(IDC_LIST),SW_HIDE);
|
::ShowWindow(GetDlgItem(IDC_LIST), SW_HIDE);
|
||||||
::ShowWindow(GetDlgItem(IDC_LIST2),SW_SHOW);
|
::ShowWindow(GetDlgItem(IDC_LIST2), SW_SHOW);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDebugTlb::RefreshTLBWindow (void)
|
void CDebugTlb::RefreshTLBWindow(void)
|
||||||
{
|
{
|
||||||
if (m_hWnd == NULL)
|
if (m_hWnd == NULL)
|
||||||
{
|
{
|
||||||
|
@ -117,9 +116,9 @@ void CDebugTlb::RefreshTLBWindow (void)
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
CTLB::TLB_ENTRY * tlb = g_TLB->m_tlb;
|
CTLB::TLB_ENTRY * tlb = g_TLB->m_tlb;
|
||||||
for (count = 0; count < 32; count ++)
|
for (count = 0; count < 32; count++)
|
||||||
{
|
{
|
||||||
sprintf(Output,"0x%02X",count);
|
sprintf(Output, "0x%02X", count);
|
||||||
item.mask = LVIF_TEXT;
|
item.mask = LVIF_TEXT;
|
||||||
item.iItem = count;
|
item.iItem = count;
|
||||||
item.pszText = Output;
|
item.pszText = Output;
|
||||||
|
@ -128,91 +127,91 @@ void CDebugTlb::RefreshTLBWindow (void)
|
||||||
OldItem.mask = LVIF_TEXT;
|
OldItem.mask = LVIF_TEXT;
|
||||||
OldItem.iItem = count;
|
OldItem.iItem = count;
|
||||||
OldItem.pszText = OldText;
|
OldItem.pszText = OldText;
|
||||||
OldItem.cchTextMax = sizeof( OldText )-1;
|
OldItem.cchTextMax = sizeof(OldText) - 1;
|
||||||
OldItem.iSubItem = 0;
|
OldItem.iSubItem = 0;
|
||||||
|
|
||||||
if (ListView_GetItemCount(hList) <= count)
|
if (ListView_GetItemCount(hList) <= count)
|
||||||
{
|
{
|
||||||
ListView_InsertItem(hList,&item);
|
ListView_InsertItem(hList, &item);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ListView_GetItem(hList,&OldItem);
|
ListView_GetItem(hList, &OldItem);
|
||||||
if ( strcmp( item.pszText, OldItem.pszText ) != 0 )
|
if (strcmp(item.pszText, OldItem.pszText) != 0)
|
||||||
{
|
{
|
||||||
ListView_SetItem(hList,&item);
|
ListView_SetItem(hList, &item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (tlb[count].EntryDefined)
|
if (tlb[count].EntryDefined)
|
||||||
{
|
{
|
||||||
sprintf(Output,"0x%08X",tlb[count].PageMask.Value);
|
sprintf(Output, "0x%08X", tlb[count].PageMask.Value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strcpy(Output,"................");
|
strcpy(Output, "................");
|
||||||
}
|
}
|
||||||
item.iSubItem = 1;
|
item.iSubItem = 1;
|
||||||
OldItem.iSubItem = 1;
|
OldItem.iSubItem = 1;
|
||||||
ListView_GetItem(hList,&OldItem);
|
ListView_GetItem(hList, &OldItem);
|
||||||
if ( strcmp( item.pszText, OldItem.pszText ) != 0 )
|
if (strcmp(item.pszText, OldItem.pszText) != 0)
|
||||||
{
|
{
|
||||||
ListView_SetItem(hList,&item);
|
ListView_SetItem(hList, &item);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tlb[count].EntryDefined)
|
if (tlb[count].EntryDefined)
|
||||||
{
|
{
|
||||||
sprintf(Output,"0x%08X",tlb[count].EntryHi.Value);
|
sprintf(Output, "0x%08X", tlb[count].EntryHi.Value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strcpy(Output,"................");
|
strcpy(Output, "................");
|
||||||
}
|
}
|
||||||
item.iSubItem = 2;
|
item.iSubItem = 2;
|
||||||
OldItem.iSubItem = 2;
|
OldItem.iSubItem = 2;
|
||||||
ListView_GetItem(hList,&OldItem);
|
ListView_GetItem(hList, &OldItem);
|
||||||
if ( strcmp( item.pszText, OldItem.pszText ) != 0 )
|
if (strcmp(item.pszText, OldItem.pszText) != 0)
|
||||||
{
|
{
|
||||||
ListView_SetItem(hList,&item);
|
ListView_SetItem(hList, &item);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tlb[count].EntryDefined)
|
if (tlb[count].EntryDefined)
|
||||||
{
|
{
|
||||||
sprintf(Output,"0x%08X",tlb[count].EntryLo0.Value);
|
sprintf(Output, "0x%08X", tlb[count].EntryLo0.Value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strcpy(Output,"................");
|
strcpy(Output, "................");
|
||||||
}
|
}
|
||||||
item.iSubItem = 3;
|
item.iSubItem = 3;
|
||||||
OldItem.iSubItem = 3;
|
OldItem.iSubItem = 3;
|
||||||
ListView_GetItem(hList,&OldItem);
|
ListView_GetItem(hList, &OldItem);
|
||||||
if ( strcmp( item.pszText, OldItem.pszText ) != 0 )
|
if (strcmp(item.pszText, OldItem.pszText) != 0)
|
||||||
{
|
{
|
||||||
ListView_SetItem(hList,&item);
|
ListView_SetItem(hList, &item);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tlb[count].EntryDefined)
|
if (tlb[count].EntryDefined)
|
||||||
{
|
{
|
||||||
sprintf(Output,"0x%08X",tlb[count].EntryLo1.Value);
|
sprintf(Output, "0x%08X", tlb[count].EntryLo1.Value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strcpy(Output,"................");
|
strcpy(Output, "................");
|
||||||
}
|
}
|
||||||
item.iSubItem = 4;
|
item.iSubItem = 4;
|
||||||
OldItem.iSubItem = 4;
|
OldItem.iSubItem = 4;
|
||||||
ListView_GetItem(hList,&OldItem);
|
ListView_GetItem(hList, &OldItem);
|
||||||
if ( strcmp( item.pszText, OldItem.pszText ) != 0 )
|
if (strcmp(item.pszText, OldItem.pszText) != 0)
|
||||||
{
|
{
|
||||||
ListView_SetItem(hList,&item);
|
ListView_SetItem(hList, &item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CTLB::FASTTLB * FastTlb = g_TLB->m_FastTlb;
|
CTLB::FASTTLB * FastTlb = g_TLB->m_FastTlb;
|
||||||
hList = GetDlgItem(IDC_LIST2);
|
hList = GetDlgItem(IDC_LIST2);
|
||||||
for (count = 0; count < 64; count ++)
|
for (count = 0; count < 64; count++)
|
||||||
{
|
{
|
||||||
sprintf(Output,"0x%02X",count);
|
sprintf(Output, "0x%02X", count);
|
||||||
item.mask = LVIF_TEXT;
|
item.mask = LVIF_TEXT;
|
||||||
item.iItem = count;
|
item.iItem = count;
|
||||||
item.pszText = Output;
|
item.pszText = Output;
|
||||||
|
@ -221,70 +220,69 @@ void CDebugTlb::RefreshTLBWindow (void)
|
||||||
OldItem.mask = LVIF_TEXT;
|
OldItem.mask = LVIF_TEXT;
|
||||||
OldItem.iItem = count;
|
OldItem.iItem = count;
|
||||||
OldItem.pszText = OldText;
|
OldItem.pszText = OldText;
|
||||||
OldItem.cchTextMax = sizeof( OldText )-1;
|
OldItem.cchTextMax = sizeof(OldText) - 1;
|
||||||
OldItem.iSubItem = 0;
|
OldItem.iSubItem = 0;
|
||||||
|
|
||||||
if (ListView_GetItemCount(hList) <= count)
|
if (ListView_GetItemCount(hList) <= count)
|
||||||
{
|
{
|
||||||
item.iItem = ListView_InsertItem(hList,&item);
|
item.iItem = ListView_InsertItem(hList, &item);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ListView_GetItem(hList,&OldItem);
|
ListView_GetItem(hList, &OldItem);
|
||||||
if ( strcmp( item.pszText, OldItem.pszText ) != 0 )
|
if (strcmp(item.pszText, OldItem.pszText) != 0)
|
||||||
{
|
{
|
||||||
ListView_SetItem(hList,&item);
|
ListView_SetItem(hList, &item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FastTlb[count].ValidEntry)
|
if (FastTlb[count].ValidEntry)
|
||||||
{
|
{
|
||||||
sprintf(Output,"%s",FastTlb[count].VALID?"Yes":"No");
|
sprintf(Output, "%s", FastTlb[count].VALID ? "Yes" : "No");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strcpy(Output,"................");
|
strcpy(Output, "................");
|
||||||
}
|
}
|
||||||
item.iSubItem = 1;
|
item.iSubItem = 1;
|
||||||
OldItem.iSubItem = 1;
|
OldItem.iSubItem = 1;
|
||||||
ListView_GetItem(hList,&OldItem);
|
ListView_GetItem(hList, &OldItem);
|
||||||
if ( strcmp( item.pszText, OldItem.pszText ) != 0 )
|
if (strcmp(item.pszText, OldItem.pszText) != 0)
|
||||||
{
|
{
|
||||||
ListView_SetItem(hList,&item);
|
ListView_SetItem(hList, &item);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FastTlb[count].ValidEntry && FastTlb[count].VALID)
|
if (FastTlb[count].ValidEntry && FastTlb[count].VALID)
|
||||||
{
|
{
|
||||||
sprintf(Output,"%s",FastTlb[count].DIRTY?"Yes":"No");
|
sprintf(Output, "%s", FastTlb[count].DIRTY ? "Yes" : "No");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strcpy(Output,"................");
|
strcpy(Output, "................");
|
||||||
}
|
}
|
||||||
item.iSubItem = 2;
|
item.iSubItem = 2;
|
||||||
OldItem.iSubItem = 2;
|
OldItem.iSubItem = 2;
|
||||||
ListView_GetItem(hList,&OldItem);
|
ListView_GetItem(hList, &OldItem);
|
||||||
if ( strcmp( item.pszText, OldItem.pszText ) != 0 )
|
if (strcmp(item.pszText, OldItem.pszText) != 0)
|
||||||
{
|
{
|
||||||
ListView_SetItem(hList,&item);
|
ListView_SetItem(hList, &item);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FastTlb[count].ValidEntry && FastTlb[count].VALID)
|
if (FastTlb[count].ValidEntry && FastTlb[count].VALID)
|
||||||
{
|
{
|
||||||
sprintf(Output,"%08X:%08X -> %08X:%08X",FastTlb[count].VSTART,FastTlb[count].VEND,
|
sprintf(Output, "%08X:%08X -> %08X:%08X", FastTlb[count].VSTART, FastTlb[count].VEND,
|
||||||
FastTlb[count].PHYSSTART,FastTlb[count].PHYSEND);
|
FastTlb[count].PHYSSTART, FastTlb[count].PHYSEND);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strcpy(Output,"................");
|
strcpy(Output, "................");
|
||||||
}
|
}
|
||||||
item.iSubItem = 3;
|
item.iSubItem = 3;
|
||||||
OldItem.iSubItem = 3;
|
OldItem.iSubItem = 3;
|
||||||
ListView_GetItem(hList,&OldItem);
|
ListView_GetItem(hList, &OldItem);
|
||||||
if ( strcmp( item.pszText, OldItem.pszText ) != 0 )
|
if (strcmp(item.pszText, OldItem.pszText) != 0)
|
||||||
{
|
{
|
||||||
ListView_SetItem(hList,&item);
|
ListView_SetItem(hList, &item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project 64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
|
@ -11,12 +11,11 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
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)
|
||||||
END_MSG_MAP()
|
END_MSG_MAP()
|
||||||
|
|
||||||
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
|
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
|
||||||
|
@ -25,8 +24,8 @@ 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);
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project 64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
|
@ -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)
|
||||||
{
|
{
|
||||||
|
@ -32,8 +31,8 @@ LRESULT CDebugMemoryView::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM
|
||||||
{
|
{
|
||||||
m_DataStartLoc = (DWORD)-1;
|
m_DataStartLoc = (DWORD)-1;
|
||||||
m_CompareStartLoc = (DWORD)-1;
|
m_CompareStartLoc = (DWORD)-1;
|
||||||
memset(m_CompareData,0,sizeof(m_CompareData));
|
memset(m_CompareData, 0, sizeof(m_CompareData));
|
||||||
memset(m_CompareValid,0,sizeof(m_CompareValid));
|
memset(m_CompareValid, 0, sizeof(m_CompareValid));
|
||||||
|
|
||||||
HWND hScrlBar = GetDlgItem(IDC_SCRL_BAR);
|
HWND hScrlBar = GetDlgItem(IDC_SCRL_BAR);
|
||||||
if (hScrlBar)
|
if (hScrlBar)
|
||||||
|
@ -46,72 +45,72 @@ LRESULT CDebugMemoryView::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM
|
||||||
si.nMax = 0xFFFF;
|
si.nMax = 0xFFFF;
|
||||||
si.nPos = 0x8000;
|
si.nPos = 0x8000;
|
||||||
si.nPage = 100;
|
si.nPage = 100;
|
||||||
::SetScrollInfo(hScrlBar,SB_CTL,&si,TRUE);
|
::SetScrollInfo(hScrlBar, SB_CTL, &si, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_MemAddr.Attach(GetDlgItem(IDC_ADDR_EDIT));
|
m_MemAddr.Attach(GetDlgItem(IDC_ADDR_EDIT));
|
||||||
m_MemAddr.SetDisplayType(CEditNumber::DisplayHex);
|
m_MemAddr.SetDisplayType(CEditNumber::DisplayHex);
|
||||||
m_MemAddr.SetValue(0x80000000,true,true);
|
m_MemAddr.SetValue(0x80000000, true, true);
|
||||||
|
|
||||||
SendDlgItemMessage( IDC_CHK_VADDR, BM_SETCHECK, BST_CHECKED,0);
|
SendDlgItemMessage(IDC_CHK_VADDR, BM_SETCHECK, BST_CHECKED, 0);
|
||||||
|
|
||||||
if (m_MemoryList== NULL)
|
if (m_MemoryList == NULL)
|
||||||
{
|
{
|
||||||
m_MemoryList = new CListCtrl;
|
m_MemoryList = new CListCtrl;
|
||||||
m_MemoryList->RegisterClass();
|
m_MemoryList->RegisterClass();
|
||||||
}
|
}
|
||||||
m_MemoryList->SubclassWindow( GetDlgItem( IDC_MEM_DETAILS ) );
|
m_MemoryList->SubclassWindow(GetDlgItem(IDC_MEM_DETAILS));
|
||||||
m_MemoryList->ShowHeader(false);
|
m_MemoryList->ShowHeader(false);
|
||||||
m_MemoryList->SetSortEnabled(FALSE);
|
m_MemoryList->SetSortEnabled(FALSE);
|
||||||
m_MemoryList->AddColumn( _T( "Address" ), 90 );
|
m_MemoryList->AddColumn(_T("Address"), 90);
|
||||||
m_MemoryList->AddColumn( _T( "1" ), 20 );
|
m_MemoryList->AddColumn(_T("1"), 20);
|
||||||
m_MemoryList->AddColumn( _T( "2" ), 20 );
|
m_MemoryList->AddColumn(_T("2"), 20);
|
||||||
m_MemoryList->AddColumn( _T( "3" ), 20 );
|
m_MemoryList->AddColumn(_T("3"), 20);
|
||||||
m_MemoryList->AddColumn( _T( "4" ), 20 );
|
m_MemoryList->AddColumn(_T("4"), 20);
|
||||||
m_MemoryList->AddColumn( _T( "-" ), 10 );
|
m_MemoryList->AddColumn(_T("-"), 10);
|
||||||
m_MemoryList->AddColumn( _T( "5" ), 20 );
|
m_MemoryList->AddColumn(_T("5"), 20);
|
||||||
m_MemoryList->AddColumn( _T( "6" ), 20 );
|
m_MemoryList->AddColumn(_T("6"), 20);
|
||||||
m_MemoryList->AddColumn( _T( "7" ), 20 );
|
m_MemoryList->AddColumn(_T("7"), 20);
|
||||||
m_MemoryList->AddColumn( _T( "8" ), 20 );
|
m_MemoryList->AddColumn(_T("8"), 20);
|
||||||
m_MemoryList->AddColumn( _T( "-" ), 10 );
|
m_MemoryList->AddColumn(_T("-"), 10);
|
||||||
m_MemoryList->AddColumn( _T( "9" ), 20 );
|
m_MemoryList->AddColumn(_T("9"), 20);
|
||||||
m_MemoryList->AddColumn( _T( "10" ), 20 );
|
m_MemoryList->AddColumn(_T("10"), 20);
|
||||||
m_MemoryList->AddColumn( _T( "11" ), 20 );
|
m_MemoryList->AddColumn(_T("11"), 20);
|
||||||
m_MemoryList->AddColumn( _T( "12" ), 20 );
|
m_MemoryList->AddColumn(_T("12"), 20);
|
||||||
m_MemoryList->AddColumn( _T( "-" ), 10 );
|
m_MemoryList->AddColumn(_T("-"), 10);
|
||||||
m_MemoryList->AddColumn( _T( "13" ), 20 );
|
m_MemoryList->AddColumn(_T("13"), 20);
|
||||||
m_MemoryList->AddColumn( _T( "14" ), 20 );
|
m_MemoryList->AddColumn(_T("14"), 20);
|
||||||
m_MemoryList->AddColumn( _T( "15" ), 20 );
|
m_MemoryList->AddColumn(_T("15"), 20);
|
||||||
m_MemoryList->AddColumn( _T( "16" ), 35 );
|
m_MemoryList->AddColumn(_T("16"), 35);
|
||||||
m_MemoryList->AddColumn( _T( "Memory Ascii" ), 140 );
|
m_MemoryList->AddColumn(_T("Memory Ascii"), 140);
|
||||||
::SetWindowLongPtr(m_MemoryList->m_hWnd, GWL_EXSTYLE, WS_EX_CLIENTEDGE);
|
::SetWindowLongPtr(m_MemoryList->m_hWnd, GWL_EXSTYLE, WS_EX_CLIENTEDGE);
|
||||||
RefreshMemory(false);
|
RefreshMemory(false);
|
||||||
int height = m_MemoryList->GetTotalHeight();
|
int height = m_MemoryList->GetTotalHeight();
|
||||||
|
|
||||||
RECT MemoryListRect = {0};
|
RECT MemoryListRect = { 0 };
|
||||||
::GetClientRect(GetDlgItem( IDC_MEM_DETAILS ), &MemoryListRect);
|
::GetClientRect(GetDlgItem(IDC_MEM_DETAILS), &MemoryListRect);
|
||||||
|
|
||||||
if (height > MemoryListRect.bottom)
|
if (height > MemoryListRect.bottom)
|
||||||
{
|
{
|
||||||
RECT MemoryListWindow = {0};
|
RECT MemoryListWindow = { 0 };
|
||||||
GetWindowRect(&MemoryListWindow);
|
GetWindowRect(&MemoryListWindow);
|
||||||
SetWindowPos(NULL,0,0,MemoryListWindow.right - MemoryListWindow.left,(MemoryListWindow.bottom - MemoryListWindow.top) + (height - MemoryListRect.bottom), SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOZORDER);
|
SetWindowPos(NULL, 0, 0, MemoryListWindow.right - MemoryListWindow.left, (MemoryListWindow.bottom - MemoryListWindow.top) + (height - MemoryListRect.bottom), SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOZORDER);
|
||||||
|
|
||||||
RECT DlgItemRect = {0};
|
RECT DlgItemRect = { 0 };
|
||||||
::GetWindowRect(GetDlgItem( IDC_BORDER ), &DlgItemRect);
|
::GetWindowRect(GetDlgItem(IDC_BORDER), &DlgItemRect);
|
||||||
::SetWindowPos(GetDlgItem( IDC_BORDER ), NULL,0,0,DlgItemRect.right - DlgItemRect.left,(DlgItemRect.bottom - DlgItemRect.top) + (height - MemoryListRect.bottom), SWP_NOMOVE);
|
::SetWindowPos(GetDlgItem(IDC_BORDER), NULL, 0, 0, DlgItemRect.right - DlgItemRect.left, (DlgItemRect.bottom - DlgItemRect.top) + (height - MemoryListRect.bottom), SWP_NOMOVE);
|
||||||
|
|
||||||
::GetWindowRect(GetDlgItem( IDC_MEM_DETAILS ), &DlgItemRect);
|
::GetWindowRect(GetDlgItem(IDC_MEM_DETAILS), &DlgItemRect);
|
||||||
::SetWindowPos(GetDlgItem( IDC_MEM_DETAILS ), NULL,0,0,DlgItemRect.right - DlgItemRect.left,(DlgItemRect.bottom - DlgItemRect.top) + (height - MemoryListRect.bottom), SWP_NOMOVE);
|
::SetWindowPos(GetDlgItem(IDC_MEM_DETAILS), NULL, 0, 0, DlgItemRect.right - DlgItemRect.left, (DlgItemRect.bottom - DlgItemRect.top) + (height - MemoryListRect.bottom), SWP_NOMOVE);
|
||||||
|
|
||||||
::GetWindowRect(GetDlgItem( IDC_SCRL_BAR ), &DlgItemRect);
|
::GetWindowRect(GetDlgItem(IDC_SCRL_BAR), &DlgItemRect);
|
||||||
::SetWindowPos(GetDlgItem( IDC_SCRL_BAR ), NULL,0,0,DlgItemRect.right - DlgItemRect.left,(DlgItemRect.bottom - DlgItemRect.top) + (height - MemoryListRect.bottom), SWP_NOMOVE);
|
::SetWindowPos(GetDlgItem(IDC_SCRL_BAR), NULL, 0, 0, DlgItemRect.right - DlgItemRect.left, (DlgItemRect.bottom - DlgItemRect.top) + (height - MemoryListRect.bottom), SWP_NOMOVE);
|
||||||
}
|
}
|
||||||
WindowCreated();
|
WindowCreated();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT CDebugMemoryView::OnDestroy ( void )
|
LRESULT CDebugMemoryView::OnDestroy(void)
|
||||||
{
|
{
|
||||||
if (m_MemoryList)
|
if (m_MemoryList)
|
||||||
{
|
{
|
||||||
|
@ -122,7 +121,7 @@ LRESULT CDebugMemoryView::OnDestroy ( void )
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT CDebugMemoryView::OnClicked (WORD /*wNotifyCode*/, WORD wID, HWND , BOOL& /*bHandled*/)
|
LRESULT CDebugMemoryView::OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND, BOOL& /*bHandled*/)
|
||||||
{
|
{
|
||||||
switch (wID)
|
switch (wID)
|
||||||
{
|
{
|
||||||
|
@ -145,9 +144,9 @@ LRESULT CDebugMemoryView::OnClicked (WORD /*wNotifyCode*/, WORD wID, HWND , BOOL
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT CDebugMemoryView::OnMemoryModified ( LPNMHDR lpNMHDR )
|
LRESULT CDebugMemoryView::OnMemoryModified(LPNMHDR lpNMHDR)
|
||||||
{
|
{
|
||||||
CListNotify *pListNotify = reinterpret_cast<CListNotify *>( lpNMHDR );
|
CListNotify *pListNotify = reinterpret_cast<CListNotify *>(lpNMHDR);
|
||||||
int LineNumber = pListNotify->m_nItem;
|
int LineNumber = pListNotify->m_nItem;
|
||||||
int Pos = ((LineNumber << 4) + (pListNotify->m_nSubItem - 1));
|
int Pos = ((LineNumber << 4) + (pListNotify->m_nSubItem - 1));
|
||||||
if (pListNotify->m_nSubItem >= 6 && pListNotify->m_nSubItem < 10)
|
if (pListNotify->m_nSubItem >= 6 && pListNotify->m_nSubItem < 10)
|
||||||
|
@ -163,7 +162,7 @@ LRESULT CDebugMemoryView::OnMemoryModified ( LPNMHDR lpNMHDR )
|
||||||
Pos = ((LineNumber << 4) + (pListNotify->m_nSubItem - 4));
|
Pos = ((LineNumber << 4) + (pListNotify->m_nSubItem - 4));
|
||||||
}
|
}
|
||||||
|
|
||||||
LPCSTR strValue = m_MemoryList->GetItemText(pListNotify->m_nItem,pListNotify->m_nSubItem);
|
LPCSTR strValue = m_MemoryList->GetItemText(pListNotify->m_nItem, pListNotify->m_nSubItem);
|
||||||
int Finish = strlen(strValue);
|
int Finish = strlen(strValue);
|
||||||
if (Finish > 8)
|
if (Finish > 8)
|
||||||
{
|
{
|
||||||
|
@ -198,26 +197,26 @@ LRESULT CDebugMemoryView::OnMemoryModified ( LPNMHDR lpNMHDR )
|
||||||
// copy current data for change comparison
|
// copy current data for change comparison
|
||||||
m_CompareStartLoc = m_DataStartLoc;
|
m_CompareStartLoc = m_DataStartLoc;
|
||||||
m_CompareVAddrr = m_DataVAddrr;
|
m_CompareVAddrr = m_DataVAddrr;
|
||||||
memcpy(m_CompareData,m_CurrentData,sizeof(m_CurrentData));
|
memcpy(m_CompareData, m_CurrentData, sizeof(m_CurrentData));
|
||||||
memcpy(m_CompareValid,m_DataValid,sizeof(m_CompareValid));
|
memcpy(m_CompareValid, m_DataValid, sizeof(m_CompareValid));
|
||||||
}
|
}
|
||||||
|
|
||||||
m_CompareData[Pos] = m_CurrentData[Pos];
|
m_CompareData[Pos] = m_CurrentData[Pos];
|
||||||
m_CurrentData[Pos] = (BYTE)Value;
|
m_CurrentData[Pos] = (BYTE)Value;
|
||||||
|
|
||||||
//sb
|
//sb
|
||||||
if ( m_DataVAddrr )
|
if (m_DataVAddrr)
|
||||||
{
|
{
|
||||||
if (!g_MMU->SB_VAddr(m_DataStartLoc + Pos,(BYTE)Value))
|
if (!g_MMU->SB_VAddr(m_DataStartLoc + Pos, (BYTE)Value))
|
||||||
{
|
{
|
||||||
WriteTraceF(TraceError,__FUNCTION__ ": failed to store at %X",m_DataStartLoc + Pos);
|
WriteTraceF(TraceError, __FUNCTION__ ": failed to store at %X", m_DataStartLoc + Pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!g_MMU->SB_PAddr(m_DataStartLoc + Pos,(BYTE)Value))
|
if (!g_MMU->SB_PAddr(m_DataStartLoc + Pos, (BYTE)Value))
|
||||||
{
|
{
|
||||||
WriteTraceF(TraceError,__FUNCTION__ ": failed to store at %X",m_DataStartLoc + Pos);
|
WriteTraceF(TraceError, __FUNCTION__ ": failed to store at %X", m_DataStartLoc + Pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Insert_MemoryLineDump(LineNumber);
|
Insert_MemoryLineDump(LineNumber);
|
||||||
|
@ -232,37 +231,37 @@ void CDebugMemoryView::ShowAddress(DWORD Address, bool VAddr)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SendDlgItemMessage( IDC_CHK_VADDR, BM_SETCHECK, VAddr ? BST_CHECKED : BST_UNCHECKED,0);
|
SendDlgItemMessage(IDC_CHK_VADDR, BM_SETCHECK, VAddr ? BST_CHECKED : BST_UNCHECKED, 0);
|
||||||
m_MemAddr.SetValue(Address,true,true);
|
m_MemAddr.SetValue(Address, true, true);
|
||||||
RefreshMemory (true);
|
RefreshMemory(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDebugMemoryView::Insert_MemoryLineDump ( int LineNumber )
|
void CDebugMemoryView::Insert_MemoryLineDump(int LineNumber)
|
||||||
{
|
{
|
||||||
if (m_MemoryList == NULL || m_MemoryList->GetColumnCount() == 0)
|
if (m_MemoryList == NULL || m_MemoryList->GetColumnCount() == 0)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
char Output[20], Hex[60], Ascii[20], AsciiAddOn[15];
|
char Output[20], Hex[60], Ascii[20], AsciiAddOn[15];
|
||||||
sprintf(Output,"0x%08X",m_DataStartLoc + (LineNumber << 4));
|
sprintf(Output, "0x%08X", m_DataStartLoc + (LineNumber << 4));
|
||||||
if (m_MemoryList->GetItemCount() <= LineNumber)
|
if (m_MemoryList->GetItemCount() <= LineNumber)
|
||||||
{
|
{
|
||||||
HFONT hFont = (HFONT)GetStockObject(ANSI_FIXED_FONT);
|
HFONT hFont = (HFONT)GetStockObject(ANSI_FIXED_FONT);
|
||||||
m_MemoryList->AddItemAt( LineNumber, Output);
|
m_MemoryList->AddItemAt(LineNumber, Output);
|
||||||
for (int i = 0; i < m_MemoryList->GetColumnCount(); i++)
|
for (int i = 0; i < m_MemoryList->GetColumnCount(); i++)
|
||||||
{
|
{
|
||||||
m_MemoryList->SetItemFont( LineNumber, i, hFont );
|
m_MemoryList->SetItemFont(LineNumber, i, hFont);
|
||||||
if (i == 5 || i == 10 || i == 15)
|
if (i == 5 || i == 10 || i == 15)
|
||||||
{
|
{
|
||||||
m_MemoryList->SetItemText(LineNumber,i,"-");
|
m_MemoryList->SetItemText(LineNumber, i, "-");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( strcmp( Output, m_MemoryList->GetItemText(LineNumber, 0) ) != 0 )
|
if (strcmp(Output, m_MemoryList->GetItemText(LineNumber, 0)) != 0)
|
||||||
{
|
{
|
||||||
m_MemoryList->SetItemText(LineNumber,0,Output);
|
m_MemoryList->SetItemText(LineNumber, 0, Output);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -270,7 +269,7 @@ void CDebugMemoryView::Insert_MemoryLineDump ( int LineNumber )
|
||||||
Ascii[0] = 0;
|
Ascii[0] = 0;
|
||||||
int CompareStartPos = m_DataStartLoc - m_CompareStartLoc;
|
int CompareStartPos = m_DataStartLoc - m_CompareStartLoc;
|
||||||
|
|
||||||
for (int i = 0, col = 1; i < 0x10; i ++, col ++)
|
for (int i = 0, col = 1; i < 0x10; i++, col++)
|
||||||
{
|
{
|
||||||
int Pos = ((LineNumber << 4) + i);
|
int Pos = ((LineNumber << 4) + i);
|
||||||
if (m_DataValid[Pos])
|
if (m_DataValid[Pos])
|
||||||
|
@ -285,30 +284,30 @@ void CDebugMemoryView::Insert_MemoryLineDump ( int LineNumber )
|
||||||
{
|
{
|
||||||
Changed = true;
|
Changed = true;
|
||||||
}
|
}
|
||||||
sprintf(Hex,"%02X",m_CurrentData[Pos]);
|
sprintf(Hex, "%02X", m_CurrentData[Pos]);
|
||||||
m_MemoryList->SetItemText(LineNumber,col,Hex);
|
m_MemoryList->SetItemText(LineNumber, col, Hex);
|
||||||
m_MemoryList->SetItemFormat( LineNumber,col, ITEM_FORMAT_EDIT, ITEM_FLAGS_EDIT_HEX );
|
m_MemoryList->SetItemFormat(LineNumber, col, ITEM_FORMAT_EDIT, ITEM_FLAGS_EDIT_HEX);
|
||||||
m_MemoryList->SetItemMaxEditLen( LineNumber,col , 2);
|
m_MemoryList->SetItemMaxEditLen(LineNumber, col, 2);
|
||||||
m_MemoryList->SetItemColours( LineNumber, col, GetSysColor( COLOR_WINDOW ),
|
m_MemoryList->SetItemColours(LineNumber, col, GetSysColor(COLOR_WINDOW),
|
||||||
Changed ? RGB( 255, 0, 0 ) : GetSysColor( COLOR_WINDOWTEXT ) );
|
Changed ? RGB(255, 0, 0) : GetSysColor(COLOR_WINDOWTEXT));
|
||||||
m_MemoryList->SetItemHighlightColours( LineNumber, col,
|
m_MemoryList->SetItemHighlightColours(LineNumber, col,
|
||||||
Changed ? RGB( 255, 0, 0 ) : GetSysColor( COLOR_HIGHLIGHTTEXT ) );
|
Changed ? RGB(255, 0, 0) : GetSysColor(COLOR_HIGHLIGHTTEXT));
|
||||||
if (m_CurrentData[Pos] < 30)
|
if (m_CurrentData[Pos] < 30)
|
||||||
{
|
{
|
||||||
strcat(Ascii,".");
|
strcat(Ascii, ".");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sprintf(AsciiAddOn,"%c",m_CurrentData[Pos]);
|
sprintf(AsciiAddOn, "%c", m_CurrentData[Pos]);
|
||||||
strcat(Ascii,AsciiAddOn);
|
strcat(Ascii, AsciiAddOn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_MemoryList->SetItemText(LineNumber,col,"**");
|
m_MemoryList->SetItemText(LineNumber, col, "**");
|
||||||
m_MemoryList->SetItemFormat( LineNumber,col, ITEM_FORMAT_NONE, ITEM_FLAGS_NONE );
|
m_MemoryList->SetItemFormat(LineNumber, col, ITEM_FORMAT_NONE, ITEM_FLAGS_NONE);
|
||||||
m_MemoryList->SetItemColours( LineNumber, col, GetSysColor( COLOR_WINDOW ), GetSysColor( COLOR_WINDOWTEXT ) );
|
m_MemoryList->SetItemColours(LineNumber, col, GetSysColor(COLOR_WINDOW), GetSysColor(COLOR_WINDOWTEXT));
|
||||||
strcat(Ascii,"*");
|
strcat(Ascii, "*");
|
||||||
}
|
}
|
||||||
if (i != 0xF)
|
if (i != 0xF)
|
||||||
{
|
{
|
||||||
|
@ -319,18 +318,18 @@ void CDebugMemoryView::Insert_MemoryLineDump ( int LineNumber )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( strcmp( Ascii, m_MemoryList->GetItemText(LineNumber, 20) ) != 0 )
|
if (strcmp(Ascii, m_MemoryList->GetItemText(LineNumber, 20)) != 0)
|
||||||
{
|
{
|
||||||
m_MemoryList->SetItemText(LineNumber,20,Ascii);
|
m_MemoryList->SetItemText(LineNumber, 20, Ascii);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDebugMemoryView::OnAddrChanged( UINT /*Code*/, int /*id*/, HWND /*ctl*/ )
|
void CDebugMemoryView::OnAddrChanged(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
|
||||||
{
|
{
|
||||||
RefreshMemory(false);
|
RefreshMemory(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDebugMemoryView::OnVScroll(int request, short Pos, HWND ctrl )
|
void CDebugMemoryView::OnVScroll(int request, short Pos, HWND ctrl)
|
||||||
{
|
{
|
||||||
if (ctrl != GetDlgItem(IDC_SCRL_BAR))
|
if (ctrl != GetDlgItem(IDC_SCRL_BAR))
|
||||||
{
|
{
|
||||||
|
@ -340,26 +339,26 @@ void CDebugMemoryView::OnVScroll(int request, short Pos, HWND ctrl )
|
||||||
switch (request)
|
switch (request)
|
||||||
{
|
{
|
||||||
case SB_LINEDOWN:
|
case SB_LINEDOWN:
|
||||||
m_MemAddr.SetValue(Location < 0xFFFFFFEF ? Location + 0x10 : 0xFFFFFFFF,true,true);
|
m_MemAddr.SetValue(Location < 0xFFFFFFEF ? Location + 0x10 : 0xFFFFFFFF, true, true);
|
||||||
break;
|
break;
|
||||||
case SB_LINEUP:
|
case SB_LINEUP:
|
||||||
m_MemAddr.SetValue(Location > 0x10 ? Location - 0x10 : 0,true,true);
|
m_MemAddr.SetValue(Location > 0x10 ? Location - 0x10 : 0, true, true);
|
||||||
break;
|
break;
|
||||||
case SB_PAGEDOWN:
|
case SB_PAGEDOWN:
|
||||||
m_MemAddr.SetValue(Location < 0xFFFFFEFF ? Location + 0x100 : 0xFFFFFFFF,true,true);
|
m_MemAddr.SetValue(Location < 0xFFFFFEFF ? Location + 0x100 : 0xFFFFFFFF, true, true);
|
||||||
break;
|
break;
|
||||||
case SB_PAGEUP:
|
case SB_PAGEUP:
|
||||||
m_MemAddr.SetValue(Location > 0x100 ? Location - 0x100 : 0,true,true);
|
m_MemAddr.SetValue(Location > 0x100 ? Location - 0x100 : 0, true, true);
|
||||||
break;
|
break;
|
||||||
case SB_THUMBPOSITION:
|
case SB_THUMBPOSITION:
|
||||||
m_MemAddr.SetValue((DWORD)Pos << 0x10,true,true);
|
m_MemAddr.SetValue((DWORD)Pos << 0x10, true, true);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDebugMemoryView::RefreshMemory ( bool ResetCompare )
|
void CDebugMemoryView::RefreshMemory(bool ResetCompare)
|
||||||
{
|
{
|
||||||
if (m_MemoryList && m_MemoryList->GetHasEditItem())
|
if (m_MemoryList && m_MemoryList->GetHasEditItem())
|
||||||
{
|
{
|
||||||
|
@ -377,7 +376,7 @@ void CDebugMemoryView::RefreshMemory ( bool ResetCompare )
|
||||||
si.cbSize = sizeof(si);
|
si.cbSize = sizeof(si);
|
||||||
si.fMask = SIF_POS;
|
si.fMask = SIF_POS;
|
||||||
si.nPos = NewAddress >> 0x10;
|
si.nPos = NewAddress >> 0x10;
|
||||||
::SetScrollInfo(hScrlBar,SB_CTL,&si,TRUE);
|
::SetScrollInfo(hScrlBar, SB_CTL, &si, TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -386,22 +385,22 @@ void CDebugMemoryView::RefreshMemory ( bool ResetCompare )
|
||||||
// copy current data for change comparison
|
// copy current data for change comparison
|
||||||
m_CompareStartLoc = m_DataStartLoc;
|
m_CompareStartLoc = m_DataStartLoc;
|
||||||
m_CompareVAddrr = m_DataVAddrr;
|
m_CompareVAddrr = m_DataVAddrr;
|
||||||
memcpy(m_CompareData,m_CurrentData,sizeof(m_CurrentData));
|
memcpy(m_CompareData, m_CurrentData, sizeof(m_CurrentData));
|
||||||
memcpy(m_CompareValid,m_DataValid,sizeof(m_CompareValid));
|
memcpy(m_CompareValid, m_DataValid, sizeof(m_CompareValid));
|
||||||
}
|
}
|
||||||
|
|
||||||
m_DataStartLoc = m_MemAddr.GetValue();
|
m_DataStartLoc = m_MemAddr.GetValue();
|
||||||
if (m_DataStartLoc > 0xFFFFFF00) { m_DataStartLoc = 0xFFFFFF00; }
|
if (m_DataStartLoc > 0xFFFFFF00) { m_DataStartLoc = 0xFFFFFF00; }
|
||||||
int WritePos = 0;
|
int WritePos = 0;
|
||||||
|
|
||||||
m_DataVAddrr = (SendDlgItemMessage( IDC_CHK_VADDR, BM_GETCHECK, 0,0) & BST_CHECKED) != 0;
|
m_DataVAddrr = (SendDlgItemMessage(IDC_CHK_VADDR, BM_GETCHECK, 0, 0) & BST_CHECKED) != 0;
|
||||||
|
|
||||||
if ((m_DataStartLoc & 3) != 0)
|
if ((m_DataStartLoc & 3) != 0)
|
||||||
{
|
{
|
||||||
MIPS_WORD word;
|
MIPS_WORD word;
|
||||||
bool ValidData = true;
|
bool ValidData = true;
|
||||||
|
|
||||||
if ( m_DataVAddrr )
|
if (m_DataVAddrr)
|
||||||
{
|
{
|
||||||
if (!g_MMU->LW_VAddr(m_DataStartLoc & ~3, word.UW))
|
if (!g_MMU->LW_VAddr(m_DataStartLoc & ~3, word.UW))
|
||||||
{
|
{
|
||||||
|
@ -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)
|
||||||
|
@ -438,7 +436,7 @@ void CDebugMemoryView::RefreshMemory ( bool ResetCompare )
|
||||||
MIPS_WORD word;
|
MIPS_WORD word;
|
||||||
bool ValidData = true;
|
bool ValidData = true;
|
||||||
|
|
||||||
if ( m_DataVAddrr )
|
if (m_DataVAddrr)
|
||||||
{
|
{
|
||||||
if (!g_MMU->LW_VAddr(Pos, word.UW))
|
if (!g_MMU->LW_VAddr(Pos, word.UW))
|
||||||
{
|
{
|
||||||
|
@ -455,7 +453,7 @@ void CDebugMemoryView::RefreshMemory ( bool ResetCompare )
|
||||||
|
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
if ((WritePos + i)>= MemoryToDisplay)
|
if ((WritePos + i) >= MemoryToDisplay)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -467,9 +465,8 @@ void CDebugMemoryView::RefreshMemory ( bool ResetCompare )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int count = 0 ; count < 16;count ++)
|
for (int count = 0; count < 16; count++)
|
||||||
{
|
{
|
||||||
Insert_MemoryLineDump ( count );
|
Insert_MemoryLineDump(count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project 64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
|
@ -11,13 +11,21 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
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)
|
||||||
COMMAND_HANDLER_EX(IDC_ADDR_EDIT,EN_CHANGE,OnAddrChanged)
|
COMMAND_HANDLER_EX(IDC_ADDR_EDIT, EN_CHANGE, OnAddrChanged)
|
||||||
NOTIFY_HANDLER_EX(IDC_MEM_DETAILS, LCN_MODIFIED, OnMemoryModified)
|
NOTIFY_HANDLER_EX(IDC_MEM_DETAILS, LCN_MODIFIED, OnMemoryModified)
|
||||||
MSG_WM_DESTROY(OnDestroy)
|
MSG_WM_DESTROY(OnDestroy)
|
||||||
MSG_WM_VSCROLL(OnVScroll)
|
MSG_WM_VSCROLL(OnVScroll)
|
||||||
|
@ -25,15 +33,15 @@ class CDebugMemoryView :
|
||||||
|
|
||||||
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
|
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
|
||||||
LRESULT OnClicked(WORD wNotifyCode, WORD wID, HWND /*hWndCtl*/, BOOL& bHandled);
|
LRESULT OnClicked(WORD wNotifyCode, WORD wID, HWND /*hWndCtl*/, BOOL& bHandled);
|
||||||
void OnAddrChanged( UINT Code, int id, HWND ctl );
|
void OnAddrChanged(UINT Code, int id, HWND ctl);
|
||||||
void OnVScroll(int request, short Pos, HWND ctrl );
|
void OnVScroll(int request, short Pos, HWND ctrl);
|
||||||
LRESULT OnMemoryModified ( LPNMHDR lpNMHDR );
|
LRESULT OnMemoryModified(LPNMHDR lpNMHDR);
|
||||||
LRESULT OnDestroy ( void );
|
LRESULT OnDestroy(void);
|
||||||
|
|
||||||
void Insert_MemoryLineDump ( int LineNumber );
|
void Insert_MemoryLineDump(int LineNumber);
|
||||||
void RefreshMemory ( bool ResetCompare );
|
void RefreshMemory(bool ResetCompare);
|
||||||
|
|
||||||
enum { MemoryToDisplay = 0x100};
|
enum { MemoryToDisplay = 0x100 };
|
||||||
|
|
||||||
CEditNumber m_MemAddr;
|
CEditNumber m_MemAddr;
|
||||||
CListCtrl * m_MemoryList;
|
CListCtrl * m_MemoryList;
|
||||||
|
@ -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"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project 64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
|
@ -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();
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project 64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
|
@ -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();
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project 64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ bool DelaySlotEffectsCompare (DWORD PC, DWORD Reg1, DWORD Reg2)
|
||||||
default:
|
default:
|
||||||
if (g_Settings->LoadBool(Debugger_Enabled))
|
if (g_Settings->LoadBool(Debugger_Enabled))
|
||||||
{
|
{
|
||||||
g_Notify->DisplayError(stdstr_f("Does %s effect Delay slot at %X?",R4300iOpcodeName(Command.Hex,PC+4), PC).ToUTF16().c_str());
|
g_Notify->DisplayError(stdstr_f("Does %s effect Delay slot at %X?", R4300iOpcodeName(Command.Hex, PC + 4), PC).ToUTF16().c_str());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,7 @@ bool DelaySlotEffectsCompare (DWORD PC, DWORD Reg1, DWORD Reg2)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if ( (Command.rs & 0x10 ) != 0 )
|
if ((Command.rs & 0x10) != 0)
|
||||||
{
|
{
|
||||||
switch (Command.funct)
|
switch (Command.funct)
|
||||||
{
|
{
|
||||||
|
@ -118,7 +118,7 @@ bool DelaySlotEffectsCompare (DWORD PC, DWORD Reg1, DWORD Reg2)
|
||||||
default:
|
default:
|
||||||
if (g_Settings->LoadBool(Debugger_Enabled))
|
if (g_Settings->LoadBool(Debugger_Enabled))
|
||||||
{
|
{
|
||||||
g_Notify->DisplayError(stdstr_f("Does %s effect Delay slot at %X?\n6",R4300iOpcodeName(Command.Hex,PC+4), PC).ToUTF16().c_str());
|
g_Notify->DisplayError(stdstr_f("Does %s effect Delay slot at %X?\n6", R4300iOpcodeName(Command.Hex, PC + 4), PC).ToUTF16().c_str());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -127,7 +127,7 @@ bool DelaySlotEffectsCompare (DWORD PC, DWORD Reg1, DWORD Reg2)
|
||||||
{
|
{
|
||||||
if (g_Settings->LoadBool(Debugger_Enabled))
|
if (g_Settings->LoadBool(Debugger_Enabled))
|
||||||
{
|
{
|
||||||
g_Notify->DisplayError(stdstr_f("Does %s effect Delay slot at %X?\n7",R4300iOpcodeName(Command.Hex,PC+4), PC).ToUTF16().c_str());
|
g_Notify->DisplayError(stdstr_f("Does %s effect Delay slot at %X?\n7", R4300iOpcodeName(Command.Hex, PC + 4), PC).ToUTF16().c_str());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -156,7 +156,7 @@ bool DelaySlotEffectsCompare (DWORD PC, DWORD Reg1, DWORD Reg2)
|
||||||
default:
|
default:
|
||||||
if (g_Settings->LoadBool(Debugger_Enabled))
|
if (g_Settings->LoadBool(Debugger_Enabled))
|
||||||
{
|
{
|
||||||
g_Notify->DisplayError(stdstr_f("Does %s effect Delay slot at %X?",R4300iOpcodeName(Command.Hex,PC+4), PC).ToUTF16().c_str());
|
g_Notify->DisplayError(stdstr_f("Does %s effect Delay slot at %X?", R4300iOpcodeName(Command.Hex, PC + 4), PC).ToUTF16().c_str());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -204,7 +204,7 @@ bool DelaySlotEffectsCompare (DWORD PC, DWORD Reg1, DWORD Reg2)
|
||||||
default:
|
default:
|
||||||
if (g_Settings->LoadBool(Debugger_Enabled))
|
if (g_Settings->LoadBool(Debugger_Enabled))
|
||||||
{
|
{
|
||||||
g_Notify->DisplayError(stdstr_f("Does %s effect Delay slot at %X?",R4300iOpcodeName(Command.Hex,PC+4), PC).ToUTF16().c_str());
|
g_Notify->DisplayError(stdstr_f("Does %s effect Delay slot at %X?", R4300iOpcodeName(Command.Hex, PC + 4), PC).ToUTF16().c_str());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -236,10 +236,10 @@ void CInterpreterCPU::InPermLoop()
|
||||||
//}
|
//}
|
||||||
|
|
||||||
/* Interrupts enabled */
|
/* Interrupts enabled */
|
||||||
if (( g_Reg->STATUS_REGISTER & STATUS_IE ) == 0 ||
|
if ((g_Reg->STATUS_REGISTER & STATUS_IE) == 0 ||
|
||||||
( g_Reg->STATUS_REGISTER & STATUS_EXL ) != 0 ||
|
(g_Reg->STATUS_REGISTER & STATUS_EXL) != 0 ||
|
||||||
( g_Reg->STATUS_REGISTER & STATUS_ERL ) != 0 ||
|
(g_Reg->STATUS_REGISTER & STATUS_ERL) != 0 ||
|
||||||
( g_Reg->STATUS_REGISTER & 0xFF00) == 0)
|
(g_Reg->STATUS_REGISTER & 0xFF00) == 0)
|
||||||
{
|
{
|
||||||
if (g_Plugins->Gfx()->UpdateScreen != NULL)
|
if (g_Plugins->Gfx()->UpdateScreen != NULL)
|
||||||
{
|
{
|
||||||
|
@ -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
|
||||||
{
|
{
|
||||||
|
@ -284,7 +284,7 @@ void CInterpreterCPU::ExecuteCPU()
|
||||||
//WriteTraceF((TraceType)(TraceError | TraceNoHeader),"%X: %s t9: %08X v1: %08X",*_PROGRAM_COUNTER,R4300iOpcodeName(Opcode.Hex,*_PROGRAM_COUNTER),_GPR[0x19].UW[0],_GPR[0x03].UW[0]);
|
//WriteTraceF((TraceType)(TraceError | TraceNoHeader),"%X: %s t9: %08X v1: %08X",*_PROGRAM_COUNTER,R4300iOpcodeName(Opcode.Hex,*_PROGRAM_COUNTER),_GPR[0x19].UW[0],_GPR[0x03].UW[0]);
|
||||||
//WriteTraceF((TraceType)(TraceError | TraceNoHeader),"%X: %d %d",*_PROGRAM_COUNTER,*g_NextTimer,g_SystemTimer->CurrentType());
|
//WriteTraceF((TraceType)(TraceError | TraceNoHeader),"%X: %d %d",*_PROGRAM_COUNTER,*g_NextTimer,g_SystemTimer->CurrentType());
|
||||||
}*/
|
}*/
|
||||||
m_R4300i_Opcode[ Opcode.op ]();
|
m_R4300i_Opcode[Opcode.op]();
|
||||||
NextTimer -= CountPerOp;
|
NextTimer -= CountPerOp;
|
||||||
|
|
||||||
switch (R4300iOp::m_NextInstruction)
|
switch (R4300iOp::m_NextInstruction)
|
||||||
|
@ -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)
|
||||||
|
@ -330,32 +330,31 @@ void CInterpreterCPU::ExecuteCPU()
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_Notify->BreakPoint(__FILEW__,__LINE__);
|
g_Notify->BreakPoint(__FILEW__, __LINE__);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_Reg->DoTLBReadMiss(R4300iOp::m_NextInstruction == JUMP,PROGRAM_COUNTER);
|
g_Reg->DoTLBReadMiss(R4300iOp::m_NextInstruction == JUMP, PROGRAM_COUNTER);
|
||||||
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
|
||||||
{
|
{
|
||||||
|
@ -381,13 +380,13 @@ void CInterpreterCPU::ExecuteOps(int Cycles)
|
||||||
//WriteTraceF((TraceType)(TraceError | TraceNoHeader),"%X: %s t9: %08X v1: %08X",*_PROGRAM_COUNTER,R4300iOpcodeName(Opcode.Hex,*_PROGRAM_COUNTER),_GPR[0x19].UW[0],_GPR[0x03].UW[0]);
|
//WriteTraceF((TraceType)(TraceError | TraceNoHeader),"%X: %s t9: %08X v1: %08X",*_PROGRAM_COUNTER,R4300iOpcodeName(Opcode.Hex,*_PROGRAM_COUNTER),_GPR[0x19].UW[0],_GPR[0x03].UW[0]);
|
||||||
//WriteTraceF((TraceType)(TraceError | TraceNoHeader),"%X: %d %d",*_PROGRAM_COUNTER,*g_NextTimer,g_SystemTimer->CurrentType());
|
//WriteTraceF((TraceType)(TraceError | TraceNoHeader),"%X: %d %d",*_PROGRAM_COUNTER,*g_NextTimer,g_SystemTimer->CurrentType());
|
||||||
}*/
|
}*/
|
||||||
m_R4300i_Opcode[ Opcode.op ]();
|
m_R4300i_Opcode[Opcode.op]();
|
||||||
_GPR[0].DW = 0; /* MIPS $zero hard-wired to 0 */
|
_GPR[0].DW = 0; /* MIPS $zero hard-wired to 0 */
|
||||||
|
|
||||||
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)
|
||||||
|
@ -440,18 +439,18 @@ void CInterpreterCPU::ExecuteOps(int Cycles)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_Notify->BreakPoint(__FILEW__,__LINE__);
|
g_Notify->BreakPoint(__FILEW__, __LINE__);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_Reg->DoTLBReadMiss(R4300iOp::m_NextInstruction == JUMP,PROGRAM_COUNTER);
|
g_Reg->DoTLBReadMiss(R4300iOp::m_NextInstruction == JUMP, PROGRAM_COUNTER);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project 64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
|
@ -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:
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project 64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
|
@ -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);\
|
||||||
|
@ -36,16 +36,16 @@ bool DelaySlotEffectsCompare ( DWORD PC, DWORD Reg1, DWORD Reg2 );
|
||||||
|
|
||||||
R4300iOp32::Func * R4300iOp32::BuildInterpreter()
|
R4300iOp32::Func * R4300iOp32::BuildInterpreter()
|
||||||
{
|
{
|
||||||
Jump_Opcode[ 0] = SPECIAL;
|
Jump_Opcode[0] = SPECIAL;
|
||||||
Jump_Opcode[ 1] = REGIMM;
|
Jump_Opcode[1] = REGIMM;
|
||||||
Jump_Opcode[ 2] = R4300iOp::J;
|
Jump_Opcode[2] = R4300iOp::J;
|
||||||
Jump_Opcode[ 3] = JAL;
|
Jump_Opcode[3] = JAL;
|
||||||
Jump_Opcode[ 4] = BEQ;
|
Jump_Opcode[4] = BEQ;
|
||||||
Jump_Opcode[ 5] = BNE;
|
Jump_Opcode[5] = BNE;
|
||||||
Jump_Opcode[ 6] = BLEZ;
|
Jump_Opcode[6] = BLEZ;
|
||||||
Jump_Opcode[ 7] = BGTZ;
|
Jump_Opcode[7] = BGTZ;
|
||||||
Jump_Opcode[ 8] = ADDI;
|
Jump_Opcode[8] = ADDI;
|
||||||
Jump_Opcode[ 9] = ADDIU;
|
Jump_Opcode[9] = ADDIU;
|
||||||
Jump_Opcode[10] = SLTI;
|
Jump_Opcode[10] = SLTI;
|
||||||
Jump_Opcode[11] = SLTIU;
|
Jump_Opcode[11] = SLTIU;
|
||||||
Jump_Opcode[12] = ANDI;
|
Jump_Opcode[12] = ANDI;
|
||||||
|
@ -101,16 +101,16 @@ R4300iOp32::Func * R4300iOp32::BuildInterpreter()
|
||||||
Jump_Opcode[62] = R4300iOp::UnknownOpcode;
|
Jump_Opcode[62] = R4300iOp::UnknownOpcode;
|
||||||
Jump_Opcode[63] = R4300iOp::SD;
|
Jump_Opcode[63] = R4300iOp::SD;
|
||||||
|
|
||||||
Jump_Special[ 0] = SPECIAL_SLL;
|
Jump_Special[0] = SPECIAL_SLL;
|
||||||
Jump_Special[ 1] = R4300iOp::UnknownOpcode;
|
Jump_Special[1] = R4300iOp::UnknownOpcode;
|
||||||
Jump_Special[ 2] = SPECIAL_SRL;
|
Jump_Special[2] = SPECIAL_SRL;
|
||||||
Jump_Special[ 3] = SPECIAL_SRA;
|
Jump_Special[3] = SPECIAL_SRA;
|
||||||
Jump_Special[ 4] = SPECIAL_SLLV;
|
Jump_Special[4] = SPECIAL_SLLV;
|
||||||
Jump_Special[ 5] = R4300iOp::UnknownOpcode;
|
Jump_Special[5] = R4300iOp::UnknownOpcode;
|
||||||
Jump_Special[ 6] = SPECIAL_SRLV;
|
Jump_Special[6] = SPECIAL_SRLV;
|
||||||
Jump_Special[ 7] = SPECIAL_SRAV;
|
Jump_Special[7] = SPECIAL_SRAV;
|
||||||
Jump_Special[ 8] = SPECIAL_JR;
|
Jump_Special[8] = SPECIAL_JR;
|
||||||
Jump_Special[ 9] = SPECIAL_JALR;
|
Jump_Special[9] = SPECIAL_JALR;
|
||||||
Jump_Special[10] = R4300iOp::UnknownOpcode;
|
Jump_Special[10] = R4300iOp::UnknownOpcode;
|
||||||
Jump_Special[11] = R4300iOp::UnknownOpcode;
|
Jump_Special[11] = R4300iOp::UnknownOpcode;
|
||||||
Jump_Special[12] = R4300iOp::SPECIAL_SYSCALL;
|
Jump_Special[12] = R4300iOp::SPECIAL_SYSCALL;
|
||||||
|
@ -166,16 +166,16 @@ R4300iOp32::Func * R4300iOp32::BuildInterpreter()
|
||||||
Jump_Special[62] = R4300iOp::SPECIAL_DSRL32;
|
Jump_Special[62] = R4300iOp::SPECIAL_DSRL32;
|
||||||
Jump_Special[63] = R4300iOp::SPECIAL_DSRA32;
|
Jump_Special[63] = R4300iOp::SPECIAL_DSRA32;
|
||||||
|
|
||||||
Jump_Regimm[ 0] = REGIMM_BLTZ;
|
Jump_Regimm[0] = REGIMM_BLTZ;
|
||||||
Jump_Regimm[ 1] = REGIMM_BGEZ;
|
Jump_Regimm[1] = REGIMM_BGEZ;
|
||||||
Jump_Regimm[ 2] = REGIMM_BLTZL;
|
Jump_Regimm[2] = REGIMM_BLTZL;
|
||||||
Jump_Regimm[ 3] = REGIMM_BGEZL;
|
Jump_Regimm[3] = REGIMM_BGEZL;
|
||||||
Jump_Regimm[ 4] = R4300iOp::UnknownOpcode;
|
Jump_Regimm[4] = R4300iOp::UnknownOpcode;
|
||||||
Jump_Regimm[ 5] = R4300iOp::UnknownOpcode;
|
Jump_Regimm[5] = R4300iOp::UnknownOpcode;
|
||||||
Jump_Regimm[ 6] = R4300iOp::UnknownOpcode;
|
Jump_Regimm[6] = R4300iOp::UnknownOpcode;
|
||||||
Jump_Regimm[ 7] = R4300iOp::UnknownOpcode;
|
Jump_Regimm[7] = R4300iOp::UnknownOpcode;
|
||||||
Jump_Regimm[ 8] = R4300iOp::UnknownOpcode;
|
Jump_Regimm[8] = R4300iOp::UnknownOpcode;
|
||||||
Jump_Regimm[ 9] = R4300iOp::UnknownOpcode;
|
Jump_Regimm[9] = R4300iOp::UnknownOpcode;
|
||||||
Jump_Regimm[10] = R4300iOp::UnknownOpcode;
|
Jump_Regimm[10] = R4300iOp::UnknownOpcode;
|
||||||
Jump_Regimm[11] = R4300iOp::UnknownOpcode;
|
Jump_Regimm[11] = R4300iOp::UnknownOpcode;
|
||||||
Jump_Regimm[12] = R4300iOp::UnknownOpcode;
|
Jump_Regimm[12] = R4300iOp::UnknownOpcode;
|
||||||
|
@ -199,16 +199,16 @@ R4300iOp32::Func * R4300iOp32::BuildInterpreter()
|
||||||
Jump_Regimm[30] = R4300iOp::UnknownOpcode;
|
Jump_Regimm[30] = R4300iOp::UnknownOpcode;
|
||||||
Jump_Regimm[31] = R4300iOp::UnknownOpcode;
|
Jump_Regimm[31] = R4300iOp::UnknownOpcode;
|
||||||
|
|
||||||
Jump_CoP0[ 0] = COP0_MF;
|
Jump_CoP0[0] = COP0_MF;
|
||||||
Jump_CoP0[ 1] = R4300iOp::UnknownOpcode;
|
Jump_CoP0[1] = R4300iOp::UnknownOpcode;
|
||||||
Jump_CoP0[ 2] = R4300iOp::UnknownOpcode;
|
Jump_CoP0[2] = R4300iOp::UnknownOpcode;
|
||||||
Jump_CoP0[ 3] = R4300iOp::UnknownOpcode;
|
Jump_CoP0[3] = R4300iOp::UnknownOpcode;
|
||||||
Jump_CoP0[ 4] = COP0_MT;
|
Jump_CoP0[4] = COP0_MT;
|
||||||
Jump_CoP0[ 5] = R4300iOp::UnknownOpcode;
|
Jump_CoP0[5] = R4300iOp::UnknownOpcode;
|
||||||
Jump_CoP0[ 6] = R4300iOp::UnknownOpcode;
|
Jump_CoP0[6] = R4300iOp::UnknownOpcode;
|
||||||
Jump_CoP0[ 7] = R4300iOp::UnknownOpcode;
|
Jump_CoP0[7] = R4300iOp::UnknownOpcode;
|
||||||
Jump_CoP0[ 8] = R4300iOp::UnknownOpcode;
|
Jump_CoP0[8] = R4300iOp::UnknownOpcode;
|
||||||
Jump_CoP0[ 9] = R4300iOp::UnknownOpcode;
|
Jump_CoP0[9] = R4300iOp::UnknownOpcode;
|
||||||
Jump_CoP0[10] = R4300iOp::UnknownOpcode;
|
Jump_CoP0[10] = R4300iOp::UnknownOpcode;
|
||||||
Jump_CoP0[11] = R4300iOp::UnknownOpcode;
|
Jump_CoP0[11] = R4300iOp::UnknownOpcode;
|
||||||
Jump_CoP0[12] = R4300iOp::UnknownOpcode;
|
Jump_CoP0[12] = R4300iOp::UnknownOpcode;
|
||||||
|
@ -232,16 +232,16 @@ R4300iOp32::Func * R4300iOp32::BuildInterpreter()
|
||||||
Jump_CoP0[30] = R4300iOp::COP0_CO;
|
Jump_CoP0[30] = R4300iOp::COP0_CO;
|
||||||
Jump_CoP0[31] = R4300iOp::COP0_CO;
|
Jump_CoP0[31] = R4300iOp::COP0_CO;
|
||||||
|
|
||||||
Jump_CoP0_Function[ 0] = R4300iOp::UnknownOpcode;
|
Jump_CoP0_Function[0] = R4300iOp::UnknownOpcode;
|
||||||
Jump_CoP0_Function[ 1] = R4300iOp::COP0_CO_TLBR;
|
Jump_CoP0_Function[1] = R4300iOp::COP0_CO_TLBR;
|
||||||
Jump_CoP0_Function[ 2] = R4300iOp::COP0_CO_TLBWI;
|
Jump_CoP0_Function[2] = R4300iOp::COP0_CO_TLBWI;
|
||||||
Jump_CoP0_Function[ 3] = R4300iOp::UnknownOpcode;
|
Jump_CoP0_Function[3] = R4300iOp::UnknownOpcode;
|
||||||
Jump_CoP0_Function[ 4] = R4300iOp::UnknownOpcode;
|
Jump_CoP0_Function[4] = R4300iOp::UnknownOpcode;
|
||||||
Jump_CoP0_Function[ 5] = R4300iOp::UnknownOpcode;
|
Jump_CoP0_Function[5] = R4300iOp::UnknownOpcode;
|
||||||
Jump_CoP0_Function[ 6] = R4300iOp::COP0_CO_TLBWR;
|
Jump_CoP0_Function[6] = R4300iOp::COP0_CO_TLBWR;
|
||||||
Jump_CoP0_Function[ 7] = R4300iOp::UnknownOpcode;
|
Jump_CoP0_Function[7] = R4300iOp::UnknownOpcode;
|
||||||
Jump_CoP0_Function[ 8] = R4300iOp::COP0_CO_TLBP;
|
Jump_CoP0_Function[8] = R4300iOp::COP0_CO_TLBP;
|
||||||
Jump_CoP0_Function[ 9] = R4300iOp::UnknownOpcode;
|
Jump_CoP0_Function[9] = R4300iOp::UnknownOpcode;
|
||||||
Jump_CoP0_Function[10] = R4300iOp::UnknownOpcode;
|
Jump_CoP0_Function[10] = R4300iOp::UnknownOpcode;
|
||||||
Jump_CoP0_Function[11] = R4300iOp::UnknownOpcode;
|
Jump_CoP0_Function[11] = R4300iOp::UnknownOpcode;
|
||||||
Jump_CoP0_Function[12] = R4300iOp::UnknownOpcode;
|
Jump_CoP0_Function[12] = R4300iOp::UnknownOpcode;
|
||||||
|
@ -297,16 +297,16 @@ R4300iOp32::Func * R4300iOp32::BuildInterpreter()
|
||||||
Jump_CoP0_Function[62] = R4300iOp::UnknownOpcode;
|
Jump_CoP0_Function[62] = R4300iOp::UnknownOpcode;
|
||||||
Jump_CoP0_Function[63] = R4300iOp::UnknownOpcode;
|
Jump_CoP0_Function[63] = R4300iOp::UnknownOpcode;
|
||||||
|
|
||||||
Jump_CoP1[ 0] = COP1_MF;
|
Jump_CoP1[0] = COP1_MF;
|
||||||
Jump_CoP1[ 1] = R4300iOp::COP1_DMF;
|
Jump_CoP1[1] = R4300iOp::COP1_DMF;
|
||||||
Jump_CoP1[ 2] = COP1_CF;
|
Jump_CoP1[2] = COP1_CF;
|
||||||
Jump_CoP1[ 3] = R4300iOp::UnknownOpcode;
|
Jump_CoP1[3] = R4300iOp::UnknownOpcode;
|
||||||
Jump_CoP1[ 4] = R4300iOp::COP1_MT;
|
Jump_CoP1[4] = R4300iOp::COP1_MT;
|
||||||
Jump_CoP1[ 5] = COP1_DMT;
|
Jump_CoP1[5] = COP1_DMT;
|
||||||
Jump_CoP1[ 6] = R4300iOp::COP1_CT;
|
Jump_CoP1[6] = R4300iOp::COP1_CT;
|
||||||
Jump_CoP1[ 7] = R4300iOp::UnknownOpcode;
|
Jump_CoP1[7] = R4300iOp::UnknownOpcode;
|
||||||
Jump_CoP1[ 8] = R4300iOp::COP1_BC;
|
Jump_CoP1[8] = R4300iOp::COP1_BC;
|
||||||
Jump_CoP1[ 9] = R4300iOp::UnknownOpcode;
|
Jump_CoP1[9] = R4300iOp::UnknownOpcode;
|
||||||
Jump_CoP1[10] = R4300iOp::UnknownOpcode;
|
Jump_CoP1[10] = R4300iOp::UnknownOpcode;
|
||||||
Jump_CoP1[11] = R4300iOp::UnknownOpcode;
|
Jump_CoP1[11] = R4300iOp::UnknownOpcode;
|
||||||
Jump_CoP1[12] = R4300iOp::UnknownOpcode;
|
Jump_CoP1[12] = R4300iOp::UnknownOpcode;
|
||||||
|
@ -330,16 +330,16 @@ R4300iOp32::Func * R4300iOp32::BuildInterpreter()
|
||||||
Jump_CoP1[30] = R4300iOp::UnknownOpcode;
|
Jump_CoP1[30] = R4300iOp::UnknownOpcode;
|
||||||
Jump_CoP1[31] = R4300iOp::UnknownOpcode;
|
Jump_CoP1[31] = R4300iOp::UnknownOpcode;
|
||||||
|
|
||||||
Jump_CoP1_BC[ 0] = R4300iOp::COP1_BCF;
|
Jump_CoP1_BC[0] = R4300iOp::COP1_BCF;
|
||||||
Jump_CoP1_BC[ 1] = R4300iOp::COP1_BCT;
|
Jump_CoP1_BC[1] = R4300iOp::COP1_BCT;
|
||||||
Jump_CoP1_BC[ 2] = R4300iOp::COP1_BCFL;
|
Jump_CoP1_BC[2] = R4300iOp::COP1_BCFL;
|
||||||
Jump_CoP1_BC[ 3] = R4300iOp::COP1_BCTL;
|
Jump_CoP1_BC[3] = R4300iOp::COP1_BCTL;
|
||||||
Jump_CoP1_BC[ 4] = R4300iOp::UnknownOpcode;
|
Jump_CoP1_BC[4] = R4300iOp::UnknownOpcode;
|
||||||
Jump_CoP1_BC[ 5] = R4300iOp::UnknownOpcode;
|
Jump_CoP1_BC[5] = R4300iOp::UnknownOpcode;
|
||||||
Jump_CoP1_BC[ 6] = R4300iOp::UnknownOpcode;
|
Jump_CoP1_BC[6] = R4300iOp::UnknownOpcode;
|
||||||
Jump_CoP1_BC[ 7] = R4300iOp::UnknownOpcode;
|
Jump_CoP1_BC[7] = R4300iOp::UnknownOpcode;
|
||||||
Jump_CoP1_BC[ 8] = R4300iOp::UnknownOpcode;
|
Jump_CoP1_BC[8] = R4300iOp::UnknownOpcode;
|
||||||
Jump_CoP1_BC[ 9] = R4300iOp::UnknownOpcode;
|
Jump_CoP1_BC[9] = R4300iOp::UnknownOpcode;
|
||||||
Jump_CoP1_BC[10] = R4300iOp::UnknownOpcode;
|
Jump_CoP1_BC[10] = R4300iOp::UnknownOpcode;
|
||||||
Jump_CoP1_BC[11] = R4300iOp::UnknownOpcode;
|
Jump_CoP1_BC[11] = R4300iOp::UnknownOpcode;
|
||||||
Jump_CoP1_BC[12] = R4300iOp::UnknownOpcode;
|
Jump_CoP1_BC[12] = R4300iOp::UnknownOpcode;
|
||||||
|
@ -363,16 +363,16 @@ R4300iOp32::Func * R4300iOp32::BuildInterpreter()
|
||||||
Jump_CoP1_BC[30] = R4300iOp::UnknownOpcode;
|
Jump_CoP1_BC[30] = R4300iOp::UnknownOpcode;
|
||||||
Jump_CoP1_BC[31] = R4300iOp::UnknownOpcode;
|
Jump_CoP1_BC[31] = R4300iOp::UnknownOpcode;
|
||||||
|
|
||||||
Jump_CoP1_S[ 0] = R4300iOp::COP1_S_ADD;
|
Jump_CoP1_S[0] = R4300iOp::COP1_S_ADD;
|
||||||
Jump_CoP1_S[ 1] = R4300iOp::COP1_S_SUB;
|
Jump_CoP1_S[1] = R4300iOp::COP1_S_SUB;
|
||||||
Jump_CoP1_S[ 2] = R4300iOp::COP1_S_MUL;
|
Jump_CoP1_S[2] = R4300iOp::COP1_S_MUL;
|
||||||
Jump_CoP1_S[ 3] = R4300iOp::COP1_S_DIV;
|
Jump_CoP1_S[3] = R4300iOp::COP1_S_DIV;
|
||||||
Jump_CoP1_S[ 4] = R4300iOp::COP1_S_SQRT;
|
Jump_CoP1_S[4] = R4300iOp::COP1_S_SQRT;
|
||||||
Jump_CoP1_S[ 5] = R4300iOp::COP1_S_ABS;
|
Jump_CoP1_S[5] = R4300iOp::COP1_S_ABS;
|
||||||
Jump_CoP1_S[ 6] = R4300iOp::COP1_S_MOV;
|
Jump_CoP1_S[6] = R4300iOp::COP1_S_MOV;
|
||||||
Jump_CoP1_S[ 7] = R4300iOp::COP1_S_NEG;
|
Jump_CoP1_S[7] = R4300iOp::COP1_S_NEG;
|
||||||
Jump_CoP1_S[ 8] = R4300iOp::UnknownOpcode;
|
Jump_CoP1_S[8] = R4300iOp::UnknownOpcode;
|
||||||
Jump_CoP1_S[ 9] = R4300iOp::COP1_S_TRUNC_L;
|
Jump_CoP1_S[9] = R4300iOp::COP1_S_TRUNC_L;
|
||||||
Jump_CoP1_S[10] = R4300iOp::COP1_S_CEIL_L; //added by Witten
|
Jump_CoP1_S[10] = R4300iOp::COP1_S_CEIL_L; //added by Witten
|
||||||
Jump_CoP1_S[11] = R4300iOp::COP1_S_FLOOR_L; //added by Witten
|
Jump_CoP1_S[11] = R4300iOp::COP1_S_FLOOR_L; //added by Witten
|
||||||
Jump_CoP1_S[12] = R4300iOp::COP1_S_ROUND_W;
|
Jump_CoP1_S[12] = R4300iOp::COP1_S_ROUND_W;
|
||||||
|
@ -428,16 +428,16 @@ R4300iOp32::Func * R4300iOp32::BuildInterpreter()
|
||||||
Jump_CoP1_S[62] = R4300iOp::COP1_S_CMP;
|
Jump_CoP1_S[62] = R4300iOp::COP1_S_CMP;
|
||||||
Jump_CoP1_S[63] = R4300iOp::COP1_S_CMP;
|
Jump_CoP1_S[63] = R4300iOp::COP1_S_CMP;
|
||||||
|
|
||||||
Jump_CoP1_D[ 0] = R4300iOp::COP1_D_ADD;
|
Jump_CoP1_D[0] = R4300iOp::COP1_D_ADD;
|
||||||
Jump_CoP1_D[ 1] = R4300iOp::COP1_D_SUB;
|
Jump_CoP1_D[1] = R4300iOp::COP1_D_SUB;
|
||||||
Jump_CoP1_D[ 2] = R4300iOp::COP1_D_MUL;
|
Jump_CoP1_D[2] = R4300iOp::COP1_D_MUL;
|
||||||
Jump_CoP1_D[ 3] = R4300iOp::COP1_D_DIV;
|
Jump_CoP1_D[3] = R4300iOp::COP1_D_DIV;
|
||||||
Jump_CoP1_D[ 4] = R4300iOp::COP1_D_SQRT;
|
Jump_CoP1_D[4] = R4300iOp::COP1_D_SQRT;
|
||||||
Jump_CoP1_D[ 5] = R4300iOp::COP1_D_ABS;
|
Jump_CoP1_D[5] = R4300iOp::COP1_D_ABS;
|
||||||
Jump_CoP1_D[ 6] = R4300iOp::COP1_D_MOV;
|
Jump_CoP1_D[6] = R4300iOp::COP1_D_MOV;
|
||||||
Jump_CoP1_D[ 7] = R4300iOp::COP1_D_NEG;
|
Jump_CoP1_D[7] = R4300iOp::COP1_D_NEG;
|
||||||
Jump_CoP1_D[ 8] = R4300iOp::UnknownOpcode;
|
Jump_CoP1_D[8] = R4300iOp::UnknownOpcode;
|
||||||
Jump_CoP1_D[ 9] = R4300iOp::COP1_D_TRUNC_L; //added by Witten
|
Jump_CoP1_D[9] = R4300iOp::COP1_D_TRUNC_L; //added by Witten
|
||||||
Jump_CoP1_D[10] = R4300iOp::COP1_D_CEIL_L; //added by Witten
|
Jump_CoP1_D[10] = R4300iOp::COP1_D_CEIL_L; //added by Witten
|
||||||
Jump_CoP1_D[11] = R4300iOp::COP1_D_FLOOR_L; //added by Witten
|
Jump_CoP1_D[11] = R4300iOp::COP1_D_FLOOR_L; //added by Witten
|
||||||
Jump_CoP1_D[12] = R4300iOp::COP1_D_ROUND_W;
|
Jump_CoP1_D[12] = R4300iOp::COP1_D_ROUND_W;
|
||||||
|
@ -493,16 +493,16 @@ R4300iOp32::Func * R4300iOp32::BuildInterpreter()
|
||||||
Jump_CoP1_D[62] = R4300iOp::COP1_D_CMP;
|
Jump_CoP1_D[62] = R4300iOp::COP1_D_CMP;
|
||||||
Jump_CoP1_D[63] = R4300iOp::COP1_D_CMP;
|
Jump_CoP1_D[63] = R4300iOp::COP1_D_CMP;
|
||||||
|
|
||||||
Jump_CoP1_W[ 0] = R4300iOp::UnknownOpcode;
|
Jump_CoP1_W[0] = R4300iOp::UnknownOpcode;
|
||||||
Jump_CoP1_W[ 1] = R4300iOp::UnknownOpcode;
|
Jump_CoP1_W[1] = R4300iOp::UnknownOpcode;
|
||||||
Jump_CoP1_W[ 2] = R4300iOp::UnknownOpcode;
|
Jump_CoP1_W[2] = R4300iOp::UnknownOpcode;
|
||||||
Jump_CoP1_W[ 3] = R4300iOp::UnknownOpcode;
|
Jump_CoP1_W[3] = R4300iOp::UnknownOpcode;
|
||||||
Jump_CoP1_W[ 4] = R4300iOp::UnknownOpcode;
|
Jump_CoP1_W[4] = R4300iOp::UnknownOpcode;
|
||||||
Jump_CoP1_W[ 5] = R4300iOp::UnknownOpcode;
|
Jump_CoP1_W[5] = R4300iOp::UnknownOpcode;
|
||||||
Jump_CoP1_W[ 6] = R4300iOp::UnknownOpcode;
|
Jump_CoP1_W[6] = R4300iOp::UnknownOpcode;
|
||||||
Jump_CoP1_W[ 7] = R4300iOp::UnknownOpcode;
|
Jump_CoP1_W[7] = R4300iOp::UnknownOpcode;
|
||||||
Jump_CoP1_W[ 8] = R4300iOp::UnknownOpcode;
|
Jump_CoP1_W[8] = R4300iOp::UnknownOpcode;
|
||||||
Jump_CoP1_W[ 9] = R4300iOp::UnknownOpcode;
|
Jump_CoP1_W[9] = R4300iOp::UnknownOpcode;
|
||||||
Jump_CoP1_W[10] = R4300iOp::UnknownOpcode;
|
Jump_CoP1_W[10] = R4300iOp::UnknownOpcode;
|
||||||
Jump_CoP1_W[11] = R4300iOp::UnknownOpcode;
|
Jump_CoP1_W[11] = R4300iOp::UnknownOpcode;
|
||||||
Jump_CoP1_W[12] = R4300iOp::UnknownOpcode;
|
Jump_CoP1_W[12] = R4300iOp::UnknownOpcode;
|
||||||
|
@ -558,16 +558,16 @@ R4300iOp32::Func * R4300iOp32::BuildInterpreter()
|
||||||
Jump_CoP1_W[62] = R4300iOp::UnknownOpcode;
|
Jump_CoP1_W[62] = R4300iOp::UnknownOpcode;
|
||||||
Jump_CoP1_W[63] = R4300iOp::UnknownOpcode;
|
Jump_CoP1_W[63] = R4300iOp::UnknownOpcode;
|
||||||
|
|
||||||
Jump_CoP1_L[ 0] = R4300iOp::UnknownOpcode;
|
Jump_CoP1_L[0] = R4300iOp::UnknownOpcode;
|
||||||
Jump_CoP1_L[ 1] = R4300iOp::UnknownOpcode;
|
Jump_CoP1_L[1] = R4300iOp::UnknownOpcode;
|
||||||
Jump_CoP1_L[ 2] = R4300iOp::UnknownOpcode;
|
Jump_CoP1_L[2] = R4300iOp::UnknownOpcode;
|
||||||
Jump_CoP1_L[ 3] = R4300iOp::UnknownOpcode;
|
Jump_CoP1_L[3] = R4300iOp::UnknownOpcode;
|
||||||
Jump_CoP1_L[ 4] = R4300iOp::UnknownOpcode;
|
Jump_CoP1_L[4] = R4300iOp::UnknownOpcode;
|
||||||
Jump_CoP1_L[ 5] = R4300iOp::UnknownOpcode;
|
Jump_CoP1_L[5] = R4300iOp::UnknownOpcode;
|
||||||
Jump_CoP1_L[ 6] = R4300iOp::UnknownOpcode;
|
Jump_CoP1_L[6] = R4300iOp::UnknownOpcode;
|
||||||
Jump_CoP1_L[ 7] = R4300iOp::UnknownOpcode;
|
Jump_CoP1_L[7] = R4300iOp::UnknownOpcode;
|
||||||
Jump_CoP1_L[ 8] = R4300iOp::UnknownOpcode;
|
Jump_CoP1_L[8] = R4300iOp::UnknownOpcode;
|
||||||
Jump_CoP1_L[ 9] = R4300iOp::UnknownOpcode;
|
Jump_CoP1_L[9] = R4300iOp::UnknownOpcode;
|
||||||
Jump_CoP1_L[10] = R4300iOp::UnknownOpcode;
|
Jump_CoP1_L[10] = R4300iOp::UnknownOpcode;
|
||||||
Jump_CoP1_L[11] = R4300iOp::UnknownOpcode;
|
Jump_CoP1_L[11] = R4300iOp::UnknownOpcode;
|
||||||
Jump_CoP1_L[12] = R4300iOp::UnknownOpcode;
|
Jump_CoP1_L[12] = R4300iOp::UnknownOpcode;
|
||||||
|
@ -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,10 +644,10 @@ 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))
|
||||||
{
|
{
|
||||||
m_NextInstruction = PERMLOOP_DO_DELAY;
|
m_NextInstruction = PERMLOOP_DO_DELAY;
|
||||||
}
|
}
|
||||||
|
@ -665,10 +664,10 @@ 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))
|
||||||
{
|
{
|
||||||
m_NextInstruction = PERMLOOP_DO_DELAY;
|
m_NextInstruction = PERMLOOP_DO_DELAY;
|
||||||
}
|
}
|
||||||
|
@ -684,10 +683,10 @@ 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))
|
||||||
{
|
{
|
||||||
m_NextInstruction = PERMLOOP_DO_DELAY;
|
m_NextInstruction = PERMLOOP_DO_DELAY;
|
||||||
}
|
}
|
||||||
|
@ -704,10 +703,10 @@ 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))
|
||||||
{
|
{
|
||||||
m_NextInstruction = PERMLOOP_DO_DELAY;
|
m_NextInstruction = PERMLOOP_DO_DELAY;
|
||||||
}
|
}
|
||||||
|
@ -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,10 +804,10 @@ 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))
|
||||||
{
|
{
|
||||||
m_NextInstruction = PERMLOOP_DO_DELAY;
|
m_NextInstruction = PERMLOOP_DO_DELAY;
|
||||||
}
|
}
|
||||||
|
@ -826,10 +825,10 @@ 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))
|
||||||
{
|
{
|
||||||
m_NextInstruction = PERMLOOP_DO_DELAY;
|
m_NextInstruction = PERMLOOP_DO_DELAY;
|
||||||
}
|
}
|
||||||
|
@ -847,10 +846,10 @@ 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))
|
||||||
{
|
{
|
||||||
m_NextInstruction = PERMLOOP_DO_DELAY;
|
m_NextInstruction = PERMLOOP_DO_DELAY;
|
||||||
}
|
}
|
||||||
|
@ -868,10 +867,10 @@ 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))
|
||||||
{
|
{
|
||||||
m_NextInstruction = PERMLOOP_DO_DELAY;
|
m_NextInstruction = PERMLOOP_DO_DELAY;
|
||||||
}
|
}
|
||||||
|
@ -886,8 +885,8 @@ 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,12 +902,12 @@ 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);
|
||||||
}
|
}
|
||||||
if (!g_MMU->LH_VAddr(Address,_GPR[m_Opcode.rt].UHW[0]))
|
if (!g_MMU->LH_VAddr(Address, _GPR[m_Opcode.rt].UHW[0]))
|
||||||
{
|
{
|
||||||
if (bShowTLBMisses())
|
if (bShowTLBMisses())
|
||||||
{
|
{
|
||||||
|
@ -924,12 +923,12 @@ 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))
|
||||||
{
|
{
|
||||||
if (bShowTLBMisses())
|
if (bShowTLBMisses())
|
||||||
{
|
{
|
||||||
|
@ -939,24 +938,24 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!g_MMU->LW_VAddr(Address,_GPR[m_Opcode.rt].UW[0]))
|
if (!g_MMU->LW_VAddr(Address, _GPR[m_Opcode.rt].UW[0]))
|
||||||
{
|
{
|
||||||
if (bShowTLBMisses())
|
if (bShowTLBMisses())
|
||||||
{
|
{
|
||||||
|
@ -972,8 +971,8 @@ 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,12 +988,12 @@ 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);
|
||||||
}
|
}
|
||||||
if (!g_MMU->LH_VAddr(Address,_GPR[m_Opcode.rt].UHW[0]))
|
if (!g_MMU->LH_VAddr(Address, _GPR[m_Opcode.rt].UHW[0]))
|
||||||
{
|
{
|
||||||
if (bShowTLBMisses())
|
if (bShowTLBMisses())
|
||||||
{
|
{
|
||||||
|
@ -1010,14 +1009,14 @@ 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))
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILEW__,__LINE__);
|
g_Notify->BreakPoint(__FILEW__, __LINE__);
|
||||||
if (bShowTLBMisses())
|
if (bShowTLBMisses())
|
||||||
{
|
{
|
||||||
g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str());
|
g_Notify->DisplayError(stdstr_f(__FUNCTION__ " TLB: %X", Address).ToUTF16().c_str());
|
||||||
|
@ -1025,19 +1024,19 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!g_MMU->LW_VAddr(Address,_GPR[m_Opcode.rt].UW[0]))
|
if (!g_MMU->LW_VAddr(Address, _GPR[m_Opcode.rt].UW[0]))
|
||||||
{
|
{
|
||||||
if (bShowTLBMisses())
|
if (bShowTLBMisses())
|
||||||
{
|
{
|
||||||
|
@ -1051,16 +1050,15 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!g_MMU->LW_VAddr(Address,_GPR[m_Opcode.rt].UW[0]))
|
if (!g_MMU->LW_VAddr(Address, _GPR[m_Opcode.rt].UW[0]))
|
||||||
{
|
{
|
||||||
if (bShowTLBMisses())
|
if (bShowTLBMisses())
|
||||||
{
|
{
|
||||||
|
@ -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,10 +1201,10 @@ 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))
|
||||||
{
|
{
|
||||||
CInterpreterCPU::InPermLoop();
|
CInterpreterCPU::InPermLoop();
|
||||||
}
|
}
|
||||||
|
@ -1223,10 +1221,10 @@ 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))
|
||||||
{
|
{
|
||||||
CInterpreterCPU::InPermLoop();
|
CInterpreterCPU::InPermLoop();
|
||||||
}
|
}
|
||||||
|
@ -1243,10 +1241,10 @@ 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))
|
||||||
{
|
{
|
||||||
CInterpreterCPU::InPermLoop();
|
CInterpreterCPU::InPermLoop();
|
||||||
}
|
}
|
||||||
|
@ -1264,10 +1262,10 @@ 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))
|
||||||
{
|
{
|
||||||
CInterpreterCPU::InPermLoop();
|
CInterpreterCPU::InPermLoop();
|
||||||
}
|
}
|
||||||
|
@ -1285,10 +1283,10 @@ 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))
|
||||||
{
|
{
|
||||||
CInterpreterCPU::InPermLoop();
|
CInterpreterCPU::InPermLoop();
|
||||||
}
|
}
|
||||||
|
@ -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,10 +1304,10 @@ 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))
|
||||||
{
|
{
|
||||||
CInterpreterCPU::InPermLoop();
|
CInterpreterCPU::InPermLoop();
|
||||||
}
|
}
|
||||||
|
@ -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,17 +1332,17 @@ 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
|
||||||
{
|
{
|
||||||
LogMessage("%08X: Cause register changed from %08X to %08X",(*_PROGRAM_COUNTER), g_Reg->CAUSE_REGISTER, (g_Reg->CAUSE_REGISTER & ~CAUSE_IP7));
|
LogMessage("%08X: Cause register changed from %08X to %08X", (*_PROGRAM_COUNTER), g_Reg->CAUSE_REGISTER, (g_Reg->CAUSE_REGISTER & ~CAUSE_IP7));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1398,7 +1398,7 @@ void R4300iOp32::COP0_MT()
|
||||||
break;
|
break;
|
||||||
case 13: //cause
|
case 13: //cause
|
||||||
_CP0[m_Opcode.rd] &= 0xFFFFCFF;
|
_CP0[m_Opcode.rd] &= 0xFFFFCFF;
|
||||||
if ((_GPR[m_Opcode.rt].UW[0] & 0x300) != 0 && g_Settings->LoadBool(Debugger_Enabled) )
|
if ((_GPR[m_Opcode.rt].UW[0] & 0x300) != 0 && g_Settings->LoadBool(Debugger_Enabled))
|
||||||
{
|
{
|
||||||
g_Notify->DisplayError(L"Set IP0 or IP1");
|
g_Notify->DisplayError(L"Set IP0 or IP1");
|
||||||
}
|
}
|
||||||
|
@ -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];
|
||||||
}
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project 64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
|
@ -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
|
@ -1,6 +1,6 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project 64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
|
@ -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];
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project 64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
|
@ -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,35 +32,37 @@ 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);
|
||||||
}
|
}
|
||||||
WriteTraceF(TraceAudio,__FUNCTION__ ": Done (res = %d, TimeLeft = %d)",Res, TimeLeft);
|
WriteTraceF(TraceAudio, __FUNCTION__ ": Done (res = %d, TimeLeft = %d)", Res, TimeLeft);
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAudio::LenChanged()
|
void CAudio::LenChanged()
|
||||||
{
|
{
|
||||||
WriteTraceF(TraceAudio,__FUNCTION__ ": Start (g_Reg->AI_LEN_REG = %d)",g_Reg->AI_LEN_REG);
|
WriteTraceF(TraceAudio, __FUNCTION__ ": Start (g_Reg->AI_LEN_REG = %d)", g_Reg->AI_LEN_REG);
|
||||||
if (g_Reg->AI_LEN_REG != 0)
|
if (g_Reg->AI_LEN_REG != 0)
|
||||||
{
|
{
|
||||||
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)
|
||||||
|
@ -81,7 +85,7 @@ void CAudio::LenChanged()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
WriteTraceF(TraceAudio,__FUNCTION__ ": *** Reset Timer to 0");
|
WriteTraceF(TraceAudio, __FUNCTION__ ": *** Reset Timer to 0");
|
||||||
g_SystemTimer->StopTimer(CSystemTimer::AiTimerBusy);
|
g_SystemTimer->StopTimer(CSystemTimer::AiTimerBusy);
|
||||||
g_SystemTimer->StopTimer(CSystemTimer::AiTimerInterrupt);
|
g_SystemTimer->StopTimer(CSystemTimer::AiTimerInterrupt);
|
||||||
m_SecondBuff = 0;
|
m_SecondBuff = 0;
|
||||||
|
@ -92,18 +96,18 @@ void CAudio::LenChanged()
|
||||||
{
|
{
|
||||||
g_Plugins->Audio()->AiLenChanged();
|
g_Plugins->Audio()->AiLenChanged();
|
||||||
}
|
}
|
||||||
WriteTraceF(TraceAudio,__FUNCTION__ ": Done");
|
WriteTraceF(TraceAudio, __FUNCTION__ ": Done");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAudio::InterruptTimerDone()
|
void CAudio::InterruptTimerDone()
|
||||||
{
|
{
|
||||||
WriteTraceF(TraceAudio,__FUNCTION__ ": Start (m_SecondBuff = %d)",m_SecondBuff);
|
WriteTraceF(TraceAudio, __FUNCTION__ ": Start (m_SecondBuff = %d)", m_SecondBuff);
|
||||||
m_Status &= ~ai_full;
|
m_Status &= ~ai_full;
|
||||||
g_Reg->MI_INTR_REG |= MI_INTR_AI;
|
g_Reg->MI_INTR_REG |= MI_INTR_AI;
|
||||||
g_Reg->CheckInterrupts();
|
g_Reg->CheckInterrupts();
|
||||||
if (m_SecondBuff != 0)
|
if (m_SecondBuff != 0)
|
||||||
{
|
{
|
||||||
g_SystemTimer->SetTimer(CSystemTimer::AiTimerInterrupt,m_SecondBuff * m_CountsPerByte,false);
|
g_SystemTimer->SetTimer(CSystemTimer::AiTimerInterrupt, m_SecondBuff * m_CountsPerByte, false);
|
||||||
m_SecondBuff = 0;
|
m_SecondBuff = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -114,30 +118,29 @@ void CAudio::InterruptTimerDone()
|
||||||
{
|
{
|
||||||
g_System->SyncToAudio();
|
g_System->SyncToAudio();
|
||||||
}
|
}
|
||||||
WriteTrace(TraceAudio,__FUNCTION__ ": Done");
|
WriteTrace(TraceAudio, __FUNCTION__ ": Done");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAudio::BusyTimerDone()
|
void CAudio::BusyTimerDone()
|
||||||
{
|
{
|
||||||
WriteTraceF(TraceAudio,__FUNCTION__ ": Start (m_SecondBuff = %d)",m_SecondBuff);
|
WriteTraceF(TraceAudio, __FUNCTION__ ": Start (m_SecondBuff = %d)", m_SecondBuff);
|
||||||
g_Notify->BreakPoint(__FILEW__,__LINE__);
|
g_Notify->BreakPoint(__FILEW__, __LINE__);
|
||||||
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)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project 64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
|
@ -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;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project 64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
|
@ -11,38 +11,46 @@
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
|
|
||||||
CDMA::CDMA(CFlashram & FlashRam, CSram & Sram) :
|
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)
|
||||||
{
|
{
|
||||||
PI_RD_LEN_REG += 1;
|
PI_RD_LEN_REG += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( g_Reg->PI_DRAM_ADDR_REG + PI_RD_LEN_REG > g_MMU->RdramSize())
|
if (g_Reg->PI_DRAM_ADDR_REG + PI_RD_LEN_REG > g_MMU->RdramSize())
|
||||||
{
|
{
|
||||||
if (bHaveDebugger())
|
if (bHaveDebugger())
|
||||||
{
|
{
|
||||||
|
@ -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++)
|
||||||
{
|
{
|
||||||
|
@ -101,7 +109,7 @@ void CDMA::PI_DMA_READ()
|
||||||
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 <= 0x08010000)
|
||||||
{
|
{
|
||||||
if (g_System->m_SaveUsing == SaveChip_Auto)
|
if (g_System->m_SaveUsing == SaveChip_Auto)
|
||||||
{
|
{
|
||||||
|
@ -122,7 +130,7 @@ void CDMA::PI_DMA_READ()
|
||||||
if (g_System->m_SaveUsing == SaveChip_FlashRam)
|
if (g_System->m_SaveUsing == SaveChip_FlashRam)
|
||||||
{
|
{
|
||||||
m_FlashRam.DmaToFlashram(
|
m_FlashRam.DmaToFlashram(
|
||||||
g_MMU->Rdram()+g_Reg->PI_DRAM_ADDR_REG,
|
g_MMU->Rdram() + g_Reg->PI_DRAM_ADDR_REG,
|
||||||
g_Reg->PI_CART_ADDR_REG - 0x08000000,
|
g_Reg->PI_CART_ADDR_REG - 0x08000000,
|
||||||
PI_RD_LEN_REG
|
PI_RD_LEN_REG
|
||||||
);
|
);
|
||||||
|
@ -134,7 +142,7 @@ void CDMA::PI_DMA_READ()
|
||||||
}
|
}
|
||||||
if (g_System->m_SaveUsing == SaveChip_FlashRam)
|
if (g_System->m_SaveUsing == SaveChip_FlashRam)
|
||||||
{
|
{
|
||||||
g_Notify->DisplayError(stdstr_f("**** FLashRam DMA Read address %08X *****",g_Reg->PI_CART_ADDR_REG).ToUTF16().c_str());
|
g_Notify->DisplayError(stdstr_f("**** FLashRam DMA Read address %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;
|
||||||
g_Reg->CheckInterrupts();
|
g_Reg->CheckInterrupts();
|
||||||
|
@ -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)
|
||||||
{
|
{
|
||||||
|
@ -160,7 +168,7 @@ void CDMA::PI_DMA_WRITE()
|
||||||
}
|
}
|
||||||
|
|
||||||
g_Reg->PI_STATUS_REG |= PI_STATUS_DMA_BUSY;
|
g_Reg->PI_STATUS_REG |= PI_STATUS_DMA_BUSY;
|
||||||
if ( g_Reg->PI_DRAM_ADDR_REG + PI_WR_LEN_REG > g_MMU->RdramSize())
|
if (g_Reg->PI_DRAM_ADDR_REG + PI_WR_LEN_REG > g_MMU->RdramSize())
|
||||||
{
|
{
|
||||||
if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory)) { g_Notify->DisplayError(stdstr_f("PI_DMA_WRITE not in Memory: %08X", g_Reg->PI_DRAM_ADDR_REG + PI_WR_LEN_REG).ToUTF16().c_str()); }
|
if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory)) { g_Notify->DisplayError(stdstr_f("PI_DMA_WRITE not in Memory: %08X", g_Reg->PI_DRAM_ADDR_REG + PI_WR_LEN_REG).ToUTF16().c_str()); }
|
||||||
g_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
g_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
||||||
|
@ -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)
|
||||||
{
|
{
|
||||||
|
@ -178,7 +186,7 @@ void CDMA::PI_DMA_WRITE()
|
||||||
if (g_System->m_SaveUsing == SaveChip_Sram)
|
if (g_System->m_SaveUsing == SaveChip_Sram)
|
||||||
{
|
{
|
||||||
m_Sram.DmaFromSram(
|
m_Sram.DmaFromSram(
|
||||||
g_MMU->Rdram()+g_Reg->PI_DRAM_ADDR_REG,
|
g_MMU->Rdram() + g_Reg->PI_DRAM_ADDR_REG,
|
||||||
g_Reg->PI_CART_ADDR_REG - 0x08000000,
|
g_Reg->PI_CART_ADDR_REG - 0x08000000,
|
||||||
PI_WR_LEN_REG
|
PI_WR_LEN_REG
|
||||||
);
|
);
|
||||||
|
@ -190,7 +198,7 @@ void CDMA::PI_DMA_WRITE()
|
||||||
if (g_System->m_SaveUsing == SaveChip_FlashRam)
|
if (g_System->m_SaveUsing == SaveChip_FlashRam)
|
||||||
{
|
{
|
||||||
m_FlashRam.DmaFromFlashram(
|
m_FlashRam.DmaFromFlashram(
|
||||||
g_MMU->Rdram()+g_Reg->PI_DRAM_ADDR_REG,
|
g_MMU->Rdram() + g_Reg->PI_DRAM_ADDR_REG,
|
||||||
g_Reg->PI_CART_ADDR_REG - 0x08000000,
|
g_Reg->PI_CART_ADDR_REG - 0x08000000,
|
||||||
PI_WR_LEN_REG
|
PI_WR_LEN_REG
|
||||||
);
|
);
|
||||||
|
@ -201,33 +209,33 @@ void CDMA::PI_DMA_WRITE()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
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())
|
||||||
{
|
{
|
||||||
for (i = 0; i < PI_WR_LEN_REG; i ++)
|
for (i = 0; i < PI_WR_LEN_REG; i++)
|
||||||
{
|
{
|
||||||
*(RDRAM+((g_Reg->PI_DRAM_ADDR_REG + i) ^ 3)) = *(ROM+((g_Reg->PI_CART_ADDR_REG + i) ^ 3));
|
*(RDRAM + ((g_Reg->PI_DRAM_ADDR_REG + i) ^ 3)) = *(ROM + ((g_Reg->PI_CART_ADDR_REG + i) ^ 3));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
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,15 +247,15 @@ 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++)
|
||||||
{
|
{
|
||||||
*(RDRAM+((g_Reg->PI_DRAM_ADDR_REG + i) ^ 3)) = *(ROM+((g_Reg->PI_CART_ADDR_REG + i) ^ 3));
|
*(RDRAM + ((g_Reg->PI_DRAM_ADDR_REG + i) ^ 3)) = *(ROM + ((g_Reg->PI_CART_ADDR_REG + i) ^ 3));
|
||||||
}
|
}
|
||||||
for (i = Len; i < PI_WR_LEN_REG - Len; i ++)
|
for (i = Len; i < PI_WR_LEN_REG - Len; i++)
|
||||||
{
|
{
|
||||||
*(RDRAM+((g_Reg->PI_DRAM_ADDR_REG + i) ^ 3)) = 0;
|
*(RDRAM + ((g_Reg->PI_DRAM_ADDR_REG + i) ^ 3)) = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
g_Reg->PI_CART_ADDR_REG += 0x10000000;
|
g_Reg->PI_CART_ADDR_REG += 0x10000000;
|
||||||
|
@ -259,13 +267,13 @@ void CDMA::PI_DMA_WRITE()
|
||||||
}
|
}
|
||||||
if (g_Recompiler && g_System->bSMM_PIDMA())
|
if (g_Recompiler && g_System->bSMM_PIDMA())
|
||||||
{
|
{
|
||||||
g_Recompiler->ClearRecompCode_Phys(g_Reg->PI_DRAM_ADDR_REG, g_Reg->PI_WR_LEN_REG,CRecompiler::Remove_DMA);
|
g_Recompiler->ClearRecompCode_Phys(g_Reg->PI_DRAM_ADDR_REG, g_Reg->PI_WR_LEN_REG, CRecompiler::Remove_DMA);
|
||||||
}
|
}
|
||||||
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()
|
||||||
|
@ -305,19 +312,19 @@ void CDMA::SP_DMA_READ()
|
||||||
|
|
||||||
if ((g_Reg->SP_MEM_ADDR_REG & 3) != 0)
|
if ((g_Reg->SP_MEM_ADDR_REG & 3) != 0)
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILEW__,__LINE__);
|
g_Notify->BreakPoint(__FILEW__, __LINE__);
|
||||||
}
|
}
|
||||||
if ((g_Reg->SP_DRAM_ADDR_REG & 3) != 0)
|
if ((g_Reg->SP_DRAM_ADDR_REG & 3) != 0)
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILEW__,__LINE__);
|
g_Notify->BreakPoint(__FILEW__, __LINE__);
|
||||||
}
|
}
|
||||||
if (((g_Reg->SP_RD_LEN_REG + 1) & 3) != 0)
|
if (((g_Reg->SP_RD_LEN_REG + 1) & 3) != 0)
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILEW__,__LINE__);
|
g_Notify->BreakPoint(__FILEW__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy( g_MMU->Dmem() + (g_Reg->SP_MEM_ADDR_REG & 0x1FFF), g_MMU->Rdram() + g_Reg->SP_DRAM_ADDR_REG,
|
memcpy(g_MMU->Dmem() + (g_Reg->SP_MEM_ADDR_REG & 0x1FFF), g_MMU->Rdram() + g_Reg->SP_DRAM_ADDR_REG,
|
||||||
g_Reg->SP_RD_LEN_REG + 1 );
|
g_Reg->SP_RD_LEN_REG + 1);
|
||||||
|
|
||||||
g_Reg->SP_DMA_BUSY_REG = 0;
|
g_Reg->SP_DMA_BUSY_REG = 0;
|
||||||
g_Reg->SP_STATUS_REG &= ~SP_STATUS_DMA_BUSY;
|
g_Reg->SP_STATUS_REG &= ~SP_STATUS_DMA_BUSY;
|
||||||
|
@ -345,19 +352,19 @@ void CDMA::SP_DMA_WRITE()
|
||||||
|
|
||||||
if ((g_Reg->SP_MEM_ADDR_REG & 3) != 0)
|
if ((g_Reg->SP_MEM_ADDR_REG & 3) != 0)
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILEW__,__LINE__);
|
g_Notify->BreakPoint(__FILEW__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((g_Reg->SP_DRAM_ADDR_REG & 3) != 0)
|
if ((g_Reg->SP_DRAM_ADDR_REG & 3) != 0)
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILEW__,__LINE__);
|
g_Notify->BreakPoint(__FILEW__, __LINE__);
|
||||||
}
|
}
|
||||||
if (((g_Reg->SP_WR_LEN_REG + 1) & 3) != 0)
|
if (((g_Reg->SP_WR_LEN_REG + 1) & 3) != 0)
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILEW__,__LINE__);
|
g_Notify->BreakPoint(__FILEW__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy( g_MMU->Rdram() + g_Reg->SP_DRAM_ADDR_REG, g_MMU->Dmem() + (g_Reg->SP_MEM_ADDR_REG & 0x1FFF),
|
memcpy(g_MMU->Rdram() + g_Reg->SP_DRAM_ADDR_REG, g_MMU->Dmem() + (g_Reg->SP_MEM_ADDR_REG & 0x1FFF),
|
||||||
g_Reg->SP_WR_LEN_REG + 1);
|
g_Reg->SP_WR_LEN_REG + 1);
|
||||||
|
|
||||||
g_Reg->SP_DMA_BUSY_REG = 0;
|
g_Reg->SP_DMA_BUSY_REG = 0;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project 64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
|
@ -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
|
||||||
|
@ -22,12 +25,12 @@ public:
|
||||||
void PI_DMA_WRITE();
|
void PI_DMA_WRITE();
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project 64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
|
@ -9,13 +9,16 @@
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#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) :
|
||||||
m_ReadOnly(ReadOnly),
|
m_ReadOnly(ReadOnly),
|
||||||
m_hFile(NULL)
|
m_hFile(NULL)
|
||||||
{
|
{
|
||||||
memset(m_EEPROM,0xFF,sizeof(m_EEPROM));
|
memset(m_EEPROM, 0xFF, sizeof(m_EEPROM));
|
||||||
}
|
}
|
||||||
|
|
||||||
CEeprom::~CEeprom()
|
CEeprom::~CEeprom()
|
||||||
|
@ -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;
|
||||||
|
@ -64,7 +67,7 @@ void CEeprom::EepromCommand ( BYTE * Command)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Command[3] = 0x00;
|
Command[3] = 0x00;
|
||||||
Command[4] = g_System->m_SaveUsing == SaveChip_Eeprom_4K?0x80:0xC0;
|
Command[4] = g_System->m_SaveUsing == SaveChip_Eeprom_4K ? 0x80 : 0xC0;
|
||||||
Command[5] = 0x00;
|
Command[5] = 0x00;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -77,7 +80,7 @@ void CEeprom::EepromCommand ( BYTE * Command)
|
||||||
{
|
{
|
||||||
g_Notify->DisplayError(L"What am I meant to do with this Eeprom Command");
|
g_Notify->DisplayError(L"What am I meant to do with this Eeprom Command");
|
||||||
}
|
}
|
||||||
ReadFrom(&Command[4],Command[3]);
|
ReadFrom(&Command[4], Command[3]);
|
||||||
break;
|
break;
|
||||||
case 5: //Write to Eeprom
|
case 5: //Write to Eeprom
|
||||||
if (Command[0] != 10 && bHaveDebugger())
|
if (Command[0] != 10 && bHaveDebugger())
|
||||||
|
@ -88,7 +91,7 @@ void CEeprom::EepromCommand ( BYTE * Command)
|
||||||
{
|
{
|
||||||
g_Notify->DisplayError(L"What am I meant to do with this Eeprom Command");
|
g_Notify->DisplayError(L"What am I meant to do with this Eeprom Command");
|
||||||
}
|
}
|
||||||
WriteTo(&Command[4],Command[3]);
|
WriteTo(&Command[4], Command[3]);
|
||||||
break;
|
break;
|
||||||
case 6: //RTC Status query
|
case 6: //RTC Status query
|
||||||
Command[3] = 0x00;
|
Command[3] = 0x00;
|
||||||
|
@ -131,7 +134,7 @@ void CEeprom::EepromCommand ( BYTE * Command)
|
||||||
default:
|
default:
|
||||||
if (g_Settings->LoadDword(Debugger_ShowPifErrors))
|
if (g_Settings->LoadDword(Debugger_ShowPifErrors))
|
||||||
{
|
{
|
||||||
g_Notify->DisplayError(stdstr_f("Unknown EepromCommand %d",Command[2]).ToUTF16().c_str());
|
g_Notify->DisplayError(stdstr_f("Unknown EepromCommand %d", Command[2]).ToUTF16().c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -141,9 +144,9 @@ void CEeprom::LoadEeprom()
|
||||||
CPath FileName;
|
CPath FileName;
|
||||||
DWORD dwRead;
|
DWORD dwRead;
|
||||||
|
|
||||||
memset(m_EEPROM,0xFF,sizeof(m_EEPROM));
|
memset(m_EEPROM, 0xFF, sizeof(m_EEPROM));
|
||||||
|
|
||||||
FileName.SetDriveDirectory( g_Settings->LoadStringVal(Directory_NativeSave).c_str());
|
FileName.SetDriveDirectory(g_Settings->LoadStringVal(Directory_NativeSave).c_str());
|
||||||
FileName.SetName(g_Settings->LoadStringVal(Game_GameName).c_str());
|
FileName.SetName(g_Settings->LoadStringVal(Game_GameName).c_str());
|
||||||
FileName.SetExtension("eep");
|
FileName.SetExtension("eep");
|
||||||
|
|
||||||
|
@ -152,47 +155,47 @@ void CEeprom::LoadEeprom()
|
||||||
FileName.DirectoryCreate();
|
FileName.DirectoryCreate();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_hFile = CreateFile(FileName,m_ReadOnly ? GENERIC_READ : GENERIC_WRITE | GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,NULL,OPEN_ALWAYS,
|
m_hFile = CreateFile(FileName, m_ReadOnly ? GENERIC_READ : GENERIC_WRITE | GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_ALWAYS,
|
||||||
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS, NULL);
|
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS, NULL);
|
||||||
if (m_hFile == INVALID_HANDLE_VALUE)
|
if (m_hFile == INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
WriteTraceF(TraceError,__FUNCTION__ ": Failed to open (%s), ReadOnly = %d, LastError = %X",(LPCTSTR)FileName, m_ReadOnly, GetLastError());
|
WriteTraceF(TraceError, __FUNCTION__ ": Failed to open (%s), ReadOnly = %d, LastError = %X", (LPCTSTR)FileName, m_ReadOnly, GetLastError());
|
||||||
g_Notify->DisplayError(GS(MSG_FAIL_OPEN_EEPROM));
|
g_Notify->DisplayError(GS(MSG_FAIL_OPEN_EEPROM));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
SetFilePointer(m_hFile,0,NULL,FILE_BEGIN);
|
SetFilePointer(m_hFile, 0, NULL, FILE_BEGIN);
|
||||||
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)
|
||||||
{
|
{
|
||||||
LoadEeprom();
|
LoadEeprom();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i=0; i < 8; i++)
|
for (i = 0; i < 8; i++)
|
||||||
{
|
{
|
||||||
Buffer[i] = m_EEPROM[line*8+i];
|
Buffer[i] = m_EEPROM[line * 8 + i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
||||||
{
|
{
|
||||||
LoadEeprom();
|
LoadEeprom();
|
||||||
}
|
}
|
||||||
for (i=0;i<8;i++)
|
for (i = 0; i < 8; i++)
|
||||||
{
|
{
|
||||||
m_EEPROM[line*8+i]=Buffer[i];
|
m_EEPROM[line * 8 + i] = Buffer[i];
|
||||||
}
|
}
|
||||||
SetFilePointer(m_hFile,line*8,NULL,FILE_BEGIN);
|
SetFilePointer(m_hFile, line * 8, NULL, FILE_BEGIN);
|
||||||
WriteFile( m_hFile,Buffer,8,&dwWritten,NULL );
|
WriteFile(m_hFile, Buffer, 8, &dwWritten, NULL);
|
||||||
FlushFileBuffers(m_hFile);
|
FlushFileBuffers(m_hFile);
|
||||||
}
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project 64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
|
@ -14,17 +14,21 @@ class CEeprom :
|
||||||
private CDebugSettings
|
private CDebugSettings
|
||||||
{
|
{
|
||||||
public:
|
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;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project 64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project 64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project 64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
|
@ -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;
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue