git-svn-id: https://localhost/svn/Project64/trunk@32 111125ac-702d-7242-af9c-5ba8ae61c1ef
This commit is contained in:
parent
8624a415b9
commit
b00856cd86
Binary file not shown.
Binary file not shown.
15092
Bin/Debug/Project64.cht
15092
Bin/Debug/Project64.cht
File diff suppressed because it is too large
Load Diff
|
@ -1,181 +0,0 @@
|
|||
2009/12/29 09:11:07.625 01076: Debug : WinMain - Application Starting
|
||||
2009/12/29 09:11:07.625 01076: Debug : WinMain - Create Plugins
|
||||
2009/12/29 09:11:07.625 01076: Gfx : Loading (D:\My Programs\Emulation\Project64\Bin\Debug\Plugin\GFX\Jabo_Direct3D8.dll): Starting
|
||||
2009/12/29 09:11:07.656 01076: Gfx : Loading Done
|
||||
2009/12/29 09:11:07.656 01076: Gfx : Current Ver: Jabo's Direct3D8 1.7.0.53 Feb 9 2007
|
||||
2009/12/29 09:11:07.656 01076: Debug : Loading (D:\My Programs\Emulation\Project64\Bin\Debug\Plugin\Audio\Jabo_Dsound.dll): Starting
|
||||
2009/12/29 09:11:07.687 01076: Debug : Loading Done
|
||||
2009/12/29 09:11:07.703 01076: RSP : Loading (D:\My Programs\Emulation\Project64\Bin\Debug\Plugin\RSP\RSP 1.7.dll): Starting
|
||||
2009/12/29 09:11:07.765 01076: RSP : Loading Done
|
||||
2009/12/29 09:11:07.765 01076: RSP : Current Ver: RSP Plugin 1. 7. 0. 3
|
||||
2009/12/29 09:11:07.765 01076: RSP : EnableDebugging: starting
|
||||
2009/12/29 09:11:07.765 01076: RSP : EnableDebugging: done
|
||||
2009/12/29 09:11:07.765 01076: Debug : Loading (D:\My Programs\Emulation\Project64\Bin\Debug\Plugin\Input\Jabo_DInput.dll): Starting
|
||||
2009/12/29 09:11:07.796 01076: Debug : Loading Done
|
||||
2009/12/29 09:11:07.796 01076: Debug : WinMain - Create N64 system
|
||||
2009/12/29 09:11:07.828 01076: Debug : WinMain - Create Main Window
|
||||
2009/12/29 09:11:07.859 01076: Debug : CMainMenu::ResetMenu - Start
|
||||
2009/12/29 09:11:07.875 01076: Debug : CMainMenu::ResetMenu - Create Menu
|
||||
2009/12/29 09:11:07.906 01076: Debug : CMainMenu::ResetMenu - Create Menu Done
|
||||
2009/12/29 09:11:07.906 01076: Debug : CMainMenu::ResetMenu - Attach Menu
|
||||
2009/12/29 09:11:07.906 01076: Debug : CMainMenu::ResetMenu - Remove plugin menu
|
||||
2009/12/29 09:11:07.906 01076: Debug : CMainMenu::ResetMenu - Destroy Old Menu
|
||||
2009/12/29 09:11:07.906 01076: Debug : CMainMenu::ResetMenu Done
|
||||
2009/12/29 09:11:07.906 01076: Debug : WinMain - Show Rom Browser
|
||||
2009/12/29 09:11:07.937 01076: Debug : CRomBrowser::WatchThreadStart 1
|
||||
2009/12/29 09:11:07.937 01076: Debug : CRomBrowser::WatchThreadStart 2
|
||||
2009/12/29 09:11:07.937 01076: Debug : CRomBrowser::WatchThreadStart 3
|
||||
2009/12/29 09:11:07.937 01076: Debug : CRomBrowser::WatchThreadStart 4
|
||||
2009/12/29 09:11:07.984 05396: Debug : CRomBrowser::WatchRomDirChanged 1
|
||||
2009/12/29 09:11:07.984 05396: Debug : CRomBrowser::WatchRomDirChanged 2
|
||||
2009/12/29 09:11:08.000 05396: Debug : RomListHash: 2F2C98F88949D7CDA29896AFF39ED8D4 - f-zero xzip;firedemozip;jet force geminizip;mario kart 64 (u)zip;perfect dark (u) (v1.0) [!]zip;super mario 64 (u) [!]zip;
|
||||
2009/12/29 09:11:08.000 01076: Debug : WinMain - Entering Message Loop
|
||||
2009/12/29 09:11:08.000 05396: Debug : CRomBrowser::WatchRomDirChanged 3
|
||||
2009/12/29 09:11:08.000 01076: Debug : CMainMenu::RebuildAccelerators - Start
|
||||
2009/12/29 09:11:08.000 05396: Debug : CRomBrowser::WatchRomDirChanged 4
|
||||
2009/12/29 09:11:08.000 05396: Debug : CRomBrowser::WatchRomDirChanged 5
|
||||
2009/12/29 09:11:08.000 01076: Debug : CMainMenu::RebuildAccelerators - CreateAcceleratorTable
|
||||
2009/12/29 09:11:08.000 01076: Debug : CMainMenu::RebuildAccelerators - Delete accel list
|
||||
2009/12/29 09:11:08.000 01076: Debug : CMainMenu::RebuildAccelerators - Done
|
||||
2009/12/29 09:11:13.296 01076: Debug : CPluginList::LoadList - Start
|
||||
2009/12/29 09:11:13.296 01076: Debug : CPluginList::LoadList - loading D:\My Programs\Emulation\Project64\Bin\Debug\Plugin\Audio\Jabo_Dsound.dll
|
||||
2009/12/29 09:11:13.296 01076: Debug : CPluginList::LoadList - loading D:\My Programs\Emulation\Project64\Bin\Debug\Plugin\GFX\Jabo_Direct3D8.dll
|
||||
2009/12/29 09:11:13.296 01076: Debug : CPluginList::LoadList - loading D:\My Programs\Emulation\Project64\Bin\Debug\Plugin\Input\Jabo_DInput.dll
|
||||
2009/12/29 09:11:13.296 01076: Debug : CPluginList::LoadList - loading D:\My Programs\Emulation\Project64\Bin\Debug\Plugin\RSP\RSP 1.7.dll
|
||||
2009/12/29 09:11:13.296 01076: Debug : CPluginList::LoadList - loading D:\My Programs\Emulation\Project64\Bin\Debug\Plugin\Adaptoid_v1_0.dll
|
||||
2009/12/29 09:11:13.312 01076: Debug : CPluginList::LoadList - loading D:\My Programs\Emulation\Project64\Bin\Debug\Plugin\Jabo_Direct3D6.dll
|
||||
2009/12/29 09:11:13.328 01076: Debug : CPluginList::LoadList - loading D:\My Programs\Emulation\Project64\Bin\Debug\Plugin\No Sound.dll
|
||||
2009/12/29 09:11:13.328 01076: Debug : CPluginList::LoadList - loading D:\My Programs\Emulation\Project64\Bin\Debug\Plugin\NRage_DInput8_V2.dll
|
||||
2009/12/29 09:11:13.343 01076: Debug : CPluginList::LoadList - loading D:\My Programs\Emulation\Project64\Bin\Debug\Plugin\Zilmar_Audio.dll
|
||||
2009/12/29 09:11:13.343 01076: Debug : CPluginList::LoadList - Done
|
||||
2009/12/29 09:11:40.484 01076: Debug : CMainMenu::ResetMenu - Start
|
||||
2009/12/29 09:11:40.500 01076: Debug : CMainMenu::ResetMenu - Create Menu
|
||||
2009/12/29 09:11:40.531 01076: Debug : CMainMenu::ResetMenu - Create Menu Done
|
||||
2009/12/29 09:11:40.531 01076: Debug : CMainMenu::ResetMenu - Attach Menu
|
||||
2009/12/29 09:11:40.531 01076: Debug : CMainMenu::ResetMenu - Remove plugin menu
|
||||
2009/12/29 09:11:40.531 01076: Debug : CMainMenu::ResetMenu - Destroy Old Menu
|
||||
2009/12/29 09:11:40.531 01076: Debug : CMainMenu::ResetMenu Done
|
||||
2009/12/29 09:11:54.843 01076: Debug : CMainMenu::ResetMenu - Start
|
||||
2009/12/29 09:11:54.859 01076: Debug : CMainMenu::ResetMenu - Create Menu
|
||||
2009/12/29 09:11:54.890 01076: Debug : CMainMenu::ResetMenu - Create Menu Done
|
||||
2009/12/29 09:11:54.890 01076: Debug : CMainMenu::ResetMenu - Attach Menu
|
||||
2009/12/29 09:11:54.890 01076: Debug : CMainMenu::ResetMenu - Remove plugin menu
|
||||
2009/12/29 09:11:54.890 01076: Debug : CMainMenu::ResetMenu - Destroy Old Menu
|
||||
2009/12/29 09:11:54.890 01076: Debug : CMainMenu::ResetMenu Done
|
||||
2009/12/29 09:11:56.468 01076: Debug : CMainMenu::ResetMenu - Start
|
||||
2009/12/29 09:11:56.484 01076: Debug : CMainMenu::ResetMenu - Create Menu
|
||||
2009/12/29 09:11:56.515 01076: Debug : CMainMenu::ResetMenu - Create Menu Done
|
||||
2009/12/29 09:11:56.515 01076: Debug : CMainMenu::ResetMenu - Attach Menu
|
||||
2009/12/29 09:11:56.515 01076: Debug : CMainMenu::ResetMenu - Remove plugin menu
|
||||
2009/12/29 09:11:56.515 01076: Debug : CMainMenu::ResetMenu - Destroy Old Menu
|
||||
2009/12/29 09:11:56.515 01076: Debug : CMainMenu::ResetMenu Done
|
||||
2009/12/29 09:11:56.531 01076: Debug : CMainMenu::RebuildAccelerators - Start
|
||||
2009/12/29 09:11:56.531 01076: Debug : CMainMenu::RebuildAccelerators - CreateAcceleratorTable
|
||||
2009/12/29 09:11:56.531 01076: Debug : CMainMenu::RebuildAccelerators - Delete accel list
|
||||
2009/12/29 09:11:56.531 01076: Debug : CMainMenu::RebuildAccelerators - Done
|
||||
2009/12/29 09:12:01.296 01076: Debug : CPluginList::LoadList - Start
|
||||
2009/12/29 09:12:01.312 01076: Debug : CPluginList::LoadList - loading D:\My Programs\Emulation\Project64\Bin\Debug\Plugin\Audio\Jabo_Dsound.dll
|
||||
2009/12/29 09:12:01.312 01076: Debug : CPluginList::LoadList - loading D:\My Programs\Emulation\Project64\Bin\Debug\Plugin\GFX\Jabo_Direct3D8.dll
|
||||
2009/12/29 09:12:01.312 01076: Debug : CPluginList::LoadList - loading D:\My Programs\Emulation\Project64\Bin\Debug\Plugin\Input\Jabo_DInput.dll
|
||||
2009/12/29 09:12:01.312 01076: Debug : CPluginList::LoadList - loading D:\My Programs\Emulation\Project64\Bin\Debug\Plugin\RSP\RSP 1.7.dll
|
||||
2009/12/29 09:12:01.312 01076: Debug : CPluginList::LoadList - loading D:\My Programs\Emulation\Project64\Bin\Debug\Plugin\Adaptoid_v1_0.dll
|
||||
2009/12/29 09:12:01.312 01076: Debug : CPluginList::LoadList - loading D:\My Programs\Emulation\Project64\Bin\Debug\Plugin\Jabo_Direct3D6.dll
|
||||
2009/12/29 09:12:01.343 01076: Debug : CPluginList::LoadList - loading D:\My Programs\Emulation\Project64\Bin\Debug\Plugin\No Sound.dll
|
||||
2009/12/29 09:12:01.343 01076: Debug : CPluginList::LoadList - loading D:\My Programs\Emulation\Project64\Bin\Debug\Plugin\NRage_DInput8_V2.dll
|
||||
2009/12/29 09:12:01.343 01076: Debug : CPluginList::LoadList - loading D:\My Programs\Emulation\Project64\Bin\Debug\Plugin\Zilmar_Audio.dll
|
||||
2009/12/29 09:12:01.359 01076: Debug : CPluginList::LoadList - Done
|
||||
2009/12/29 09:12:16.031 01076: Debug : CMainMenu::ResetMenu - Start
|
||||
2009/12/29 09:12:16.046 01076: Debug : CMainMenu::ResetMenu - Create Menu
|
||||
2009/12/29 09:12:16.078 01076: Debug : CMainMenu::ResetMenu - Create Menu Done
|
||||
2009/12/29 09:12:16.078 01076: Debug : CMainMenu::ResetMenu - Attach Menu
|
||||
2009/12/29 09:12:16.078 01076: Debug : CMainMenu::ResetMenu - Remove plugin menu
|
||||
2009/12/29 09:12:16.078 01076: Debug : CMainMenu::ResetMenu - Destroy Old Menu
|
||||
2009/12/29 09:12:16.078 01076: Debug : CMainMenu::ResetMenu Done
|
||||
2009/12/29 09:12:16.078 01076: Debug : CMainMenu::RebuildAccelerators - Start
|
||||
2009/12/29 09:12:16.078 01076: Debug : CMainMenu::RebuildAccelerators - CreateAcceleratorTable
|
||||
2009/12/29 09:12:16.078 01076: Debug : CMainMenu::RebuildAccelerators - Delete accel list
|
||||
2009/12/29 09:12:16.078 01076: Debug : CMainMenu::RebuildAccelerators - Done
|
||||
2009/12/29 09:12:18.468 01076: Debug : CPluginList::LoadList - Start
|
||||
2009/12/29 09:12:18.468 01076: Debug : CPluginList::LoadList - loading D:\My Programs\Emulation\Project64\Bin\Debug\Plugin\Audio\Jabo_Dsound.dll
|
||||
2009/12/29 09:12:18.468 01076: Debug : CPluginList::LoadList - loading D:\My Programs\Emulation\Project64\Bin\Debug\Plugin\GFX\Jabo_Direct3D8.dll
|
||||
2009/12/29 09:12:18.468 01076: Debug : CPluginList::LoadList - loading D:\My Programs\Emulation\Project64\Bin\Debug\Plugin\Input\Jabo_DInput.dll
|
||||
2009/12/29 09:12:18.468 01076: Debug : CPluginList::LoadList - loading D:\My Programs\Emulation\Project64\Bin\Debug\Plugin\RSP\RSP 1.7.dll
|
||||
2009/12/29 09:12:18.468 01076: Debug : CPluginList::LoadList - loading D:\My Programs\Emulation\Project64\Bin\Debug\Plugin\Adaptoid_v1_0.dll
|
||||
2009/12/29 09:12:18.468 01076: Debug : CPluginList::LoadList - loading D:\My Programs\Emulation\Project64\Bin\Debug\Plugin\Jabo_Direct3D6.dll
|
||||
2009/12/29 09:12:18.484 01076: Debug : CPluginList::LoadList - loading D:\My Programs\Emulation\Project64\Bin\Debug\Plugin\No Sound.dll
|
||||
2009/12/29 09:12:18.500 01076: Debug : CPluginList::LoadList - loading D:\My Programs\Emulation\Project64\Bin\Debug\Plugin\NRage_DInput8_V2.dll
|
||||
2009/12/29 09:12:18.500 01076: Debug : CPluginList::LoadList - loading D:\My Programs\Emulation\Project64\Bin\Debug\Plugin\Zilmar_Audio.dll
|
||||
2009/12/29 09:12:18.515 01076: Debug : CPluginList::LoadList - Done
|
||||
2009/12/29 09:12:24.500 01076: Debug : CMainMenu::ResetMenu - Start
|
||||
2009/12/29 09:12:24.515 01076: Debug : CMainMenu::ResetMenu - Create Menu
|
||||
2009/12/29 09:12:24.546 01076: Debug : CMainMenu::ResetMenu - Create Menu Done
|
||||
2009/12/29 09:12:24.546 01076: Debug : CMainMenu::ResetMenu - Attach Menu
|
||||
2009/12/29 09:12:24.546 01076: Debug : CMainMenu::ResetMenu - Remove plugin menu
|
||||
2009/12/29 09:12:24.546 01076: Debug : CMainMenu::ResetMenu - Destroy Old Menu
|
||||
2009/12/29 09:12:24.546 01076: Debug : CMainMenu::ResetMenu Done
|
||||
2009/12/29 09:12:25.859 01076: Debug : CMainMenu::ResetMenu - Start
|
||||
2009/12/29 09:12:25.875 01076: Debug : CMainMenu::ResetMenu - Create Menu
|
||||
2009/12/29 09:12:25.906 01076: Debug : CMainMenu::ResetMenu - Create Menu Done
|
||||
2009/12/29 09:12:25.906 01076: Debug : CMainMenu::ResetMenu - Attach Menu
|
||||
2009/12/29 09:12:25.906 01076: Debug : CMainMenu::ResetMenu - Remove plugin menu
|
||||
2009/12/29 09:12:25.906 01076: Debug : CMainMenu::ResetMenu - Destroy Old Menu
|
||||
2009/12/29 09:12:25.906 01076: Debug : CMainMenu::ResetMenu Done
|
||||
2009/12/29 09:12:25.921 01076: Debug : CMainMenu::RebuildAccelerators - Start
|
||||
2009/12/29 09:12:25.921 01076: Debug : CMainMenu::RebuildAccelerators - CreateAcceleratorTable
|
||||
2009/12/29 09:12:25.921 01076: Debug : CMainMenu::RebuildAccelerators - Delete accel list
|
||||
2009/12/29 09:12:25.921 01076: Debug : CMainMenu::RebuildAccelerators - Done
|
||||
2009/12/29 09:12:28.718 01076: Debug : CPluginList::LoadList - Start
|
||||
2009/12/29 09:12:28.718 01076: Debug : CPluginList::LoadList - loading D:\My Programs\Emulation\Project64\Bin\Debug\Plugin\Audio\Jabo_Dsound.dll
|
||||
2009/12/29 09:12:28.718 01076: Debug : CPluginList::LoadList - loading D:\My Programs\Emulation\Project64\Bin\Debug\Plugin\GFX\Jabo_Direct3D8.dll
|
||||
2009/12/29 09:12:28.718 01076: Debug : CPluginList::LoadList - loading D:\My Programs\Emulation\Project64\Bin\Debug\Plugin\Input\Jabo_DInput.dll
|
||||
2009/12/29 09:12:28.718 01076: Debug : CPluginList::LoadList - loading D:\My Programs\Emulation\Project64\Bin\Debug\Plugin\RSP\RSP 1.7.dll
|
||||
2009/12/29 09:12:28.718 01076: Debug : CPluginList::LoadList - loading D:\My Programs\Emulation\Project64\Bin\Debug\Plugin\Adaptoid_v1_0.dll
|
||||
2009/12/29 09:12:28.718 01076: Debug : CPluginList::LoadList - loading D:\My Programs\Emulation\Project64\Bin\Debug\Plugin\Jabo_Direct3D6.dll
|
||||
2009/12/29 09:12:28.750 01076: Debug : CPluginList::LoadList - loading D:\My Programs\Emulation\Project64\Bin\Debug\Plugin\No Sound.dll
|
||||
2009/12/29 09:12:28.750 01076: Debug : CPluginList::LoadList - loading D:\My Programs\Emulation\Project64\Bin\Debug\Plugin\NRage_DInput8_V2.dll
|
||||
2009/12/29 09:12:28.765 01076: Debug : CPluginList::LoadList - loading D:\My Programs\Emulation\Project64\Bin\Debug\Plugin\Zilmar_Audio.dll
|
||||
2009/12/29 09:12:28.765 01076: Debug : CPluginList::LoadList - Done
|
||||
2009/12/29 09:12:37.562 01076: Debug : WM_DESTROY - start
|
||||
2009/12/29 09:12:37.562 01076: Debug : WM_DESTROY - 1
|
||||
2009/12/29 09:12:37.562 01076: Debug : SaveRomListColoumnInfo - Start
|
||||
2009/12/29 09:12:37.562 01076: Debug : SaveRomListColoumnInfo - Done
|
||||
2009/12/29 09:12:37.562 01076: Debug : WM_DESTROY - 2
|
||||
2009/12/29 09:12:37.562 01076: Debug : WM_DESTROY - 3
|
||||
2009/12/29 09:12:37.562 01076: Debug : WM_DESTROY - 4
|
||||
2009/12/29 09:12:37.562 01076: Debug : WM_DESTROY - end
|
||||
2009/12/29 09:12:37.562 01076: Debug : WinMain - Message Loop Finished
|
||||
2009/12/29 09:12:37.562 01076: Debug : WinMain - System Closed
|
||||
2009/12/29 09:12:37.578 01076: Debug : CMainGui::~CMainGui - start
|
||||
2009/12/29 09:12:37.578 01076: Debug : WM_DESTROY - start
|
||||
2009/12/29 09:12:37.578 01076: Debug : WM_DESTROY - 1
|
||||
2009/12/29 09:12:37.578 01076: Debug : WM_DESTROY - 3
|
||||
2009/12/29 09:12:37.578 01076: Debug : WM_DESTROY - 4
|
||||
2009/12/29 09:12:37.578 01076: Debug : WM_DESTROY - end
|
||||
2009/12/29 09:12:37.578 01076: Debug : CMainGui::~CMainGui - Done
|
||||
2009/12/29 09:12:37.578 01076: Debug : CMainGui::~CMainGui - start
|
||||
2009/12/29 09:12:37.578 01076: Debug : CMainGui::~CMainGui - Done
|
||||
2009/12/29 09:12:37.578 01076: Debug : CRomBrowser::WatchThreadStop 1
|
||||
2009/12/29 09:12:37.578 05396: Debug : CRomBrowser::WatchRomDirChanged 5a
|
||||
2009/12/29 09:12:37.578 01076: Debug : CRomBrowser::WatchThreadStop 2
|
||||
2009/12/29 09:12:38.031 01076: Debug : CRomBrowser::WatchThreadStop 2
|
||||
2009/12/29 09:12:38.031 01076: Debug : CRomBrowser::WatchThreadStop 3
|
||||
2009/12/29 09:12:38.031 01076: Debug : CRomBrowser::WatchThreadStop 4
|
||||
2009/12/29 09:12:38.031 01076: Debug : CRomBrowser::WatchThreadStop 5
|
||||
2009/12/29 09:12:38.031 01076: Gfx : Close: Starting
|
||||
2009/12/29 09:12:38.031 01076: Gfx : Close: Done
|
||||
2009/12/29 09:12:38.031 01076: Gfx : deconstructor: Starting
|
||||
2009/12/29 09:12:38.031 01076: Gfx : deconstructor: Done
|
||||
2009/12/29 09:12:38.031 01076: Debug : CPlugins::ShutDownPlugins 5
|
||||
2009/12/29 09:12:38.031 01076: Debug : CPlugins::ShutDownPlugins 6
|
||||
2009/12/29 09:12:38.031 01076: Debug : CPlugins::ShutDownPlugins 7
|
||||
2009/12/29 09:12:38.031 01076: Debug : CPlugins::ShutDownPlugins 8
|
||||
2009/12/29 09:12:38.031 01076: Debug : CPlugins::ShutDownPlugins 9
|
||||
2009/12/29 09:12:38.031 01076: Debug : CPlugins::ShutDownPlugins 10
|
||||
2009/12/29 09:12:38.031 01076: Debug : CPlugins::ShutDownPlugins 11
|
||||
2009/12/29 09:12:38.031 01076: Debug : CPlugins::ShutDownPlugins 12
|
||||
2009/12/29 09:12:38.031 01076: Debug : CPlugins::ShutDownPlugins 12
|
||||
2009/12/29 09:12:38.031 01076: Debug : CPlugins::ShutDownPlugins 13
|
||||
2009/12/29 09:12:38.031 01076: Debug : CPlugins::ShutDownPlugins 14
|
||||
2009/12/29 09:12:38.031 01076: Debug : CPlugins::ShutDownPlugins 15
|
||||
2009/12/29 09:12:38.031 01076: Debug : WinMain - cleaning up global objects
|
||||
2009/12/29 09:12:38.234 01076: Debug : WinMain - Done
|
21660
Bin/Debug/Project64.rdb
21660
Bin/Debug/Project64.rdb
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,38 +0,0 @@
|
|||
4000,79,1,0,0,6
|
||||
4000,79,1,0,0,1
|
||||
4002,122,0,0,0,1
|
||||
4003,123,0,0,0,6
|
||||
4005,116,0,0,0,1
|
||||
4006,115,0,1,0,1
|
||||
4006,115,0,1,0,6
|
||||
4150,112,0,0,0,6
|
||||
4151,112,0,0,1,6
|
||||
4152,113,0,0,0,6
|
||||
4152,19,0,0,0,6
|
||||
4153,114,0,0,0,6
|
||||
4154,115,0,0,0,6
|
||||
4155,118,0,0,0,6
|
||||
4156,76,1,0,0,2
|
||||
4157,116,0,0,0,6
|
||||
4158,83,1,0,0,2
|
||||
4159,67,1,0,0,2
|
||||
4160,120,0,0,0,6
|
||||
4161,49,0,0,0,6
|
||||
4162,50,0,0,0,6
|
||||
4163,51,0,0,0,6
|
||||
4164,52,0,0,0,6
|
||||
4165,53,0,0,0,6
|
||||
4166,54,0,0,0,6
|
||||
4167,55,0,0,0,6
|
||||
4168,56,0,0,0,6
|
||||
4169,57,0,0,0,6
|
||||
4170,48,0,0,0,6
|
||||
4171,192,0,0,0,6
|
||||
4172,13,0,1,0,6
|
||||
4172,27,0,0,0,6
|
||||
4174,65,1,0,0,1
|
||||
4174,65,1,0,0,2
|
||||
4180,84,1,0,0,1
|
||||
4180,84,1,0,0,2
|
||||
4183,187,0,0,0,6
|
||||
4184,189,0,0,0,6
|
|
@ -1,66 +0,0 @@
|
|||
|
||||
[1080 snowboarding-11001877]
|
||||
1080 Snowboarding (E) (M4) [!].z64=803712400000000F801004000000144958FD3F25D92EAA8D00000000000000003130383020534E4F57424F415244494E47202020000000000000004E54455000
|
||||
1080 Snowboarding (E) (M4) [!].z64-Cic=3
|
||||
1080 Snowboarding (E) (M4) [b1].z64=803712400000000F80100400000014496BB116452C6F637E00000000000000003130383020534E4F57424F415244494E47202020000000000000004E54455000
|
||||
1080 Snowboarding (E) (M4) [b1].z64-Cic=3
|
||||
1080 Snowboarding (E) (M4) [b1][f2] (NTSC).z64=803712400000000F801004000000144958FD3F25D92EAA8D00000000000000003130383020534E4F57424F415244494E47202020000000000000004E54455000
|
||||
1080 Snowboarding (E) (M4) [b1][f2] (NTSC).z64-Cic=3
|
||||
1080 Snowboarding (E) (M4) [f1].z64=803712400000000F8000040000001449AF61F38629F1112C00000000000000003130383020534E4F57424F415244494E47202020000000000000004E54455000
|
||||
1080 Snowboarding (E) (M4) [f1].z64-Cic=2
|
||||
1080 Snowboarding (E) (M4) [f2] (NTSC).z64=803712400000000F801004000000144993C5ED78F67E852800000000000000003130383020534E4F57424F415244494E47202020000000000000004E54455000
|
||||
1080 Snowboarding (E) (M4) [f2] (NTSC).z64-Cic=3
|
||||
1080 Snowboarding (JU) [!].z64=803712400000000F80100400000014491FBAF1612C1C54F100000000000000003130383020534E4F57424F415244494E47202020000000000000004E54454100
|
||||
1080 Snowboarding (JU) [!].z64-Cic=3
|
||||
1080 Snowboarding (JU) [b1].z64=803712400000000F800004000000144992072A84275952F800000000000000003130383020534E4F57424F415244494E47202020000000000000004E54454100
|
||||
1080 Snowboarding (JU) [b1].z64-Cic=2
|
||||
1080 Snowboarding (JU) [b2].z64=803712400000000F80100400000014491FBAF1612C1C54F100000000000000003130383020534E4F57424F415244494E47202020000000000000004E54454100
|
||||
1080 Snowboarding (JU) [b2].z64-Cic=3
|
||||
1080 Snowboarding (JU) [b3].z64=803712400000000F800004000000144992072A84275952F800000000000000003130383020534E4F57424F415244494E47202020000000000000004E54454100
|
||||
1080 Snowboarding (JU) [b3].z64-Cic=2
|
||||
1080 Snowboarding (JU) [b4].z64=803712400000000F800004000000144992072A84275952F800000000000000003130383020534E4F57424F415244494E47202020000000000000004E54454100
|
||||
1080 Snowboarding (JU) [b4].z64-Cic=2
|
||||
1080 Snowboarding (JU) [b5].z64=803712400000000F800004000000144992072A84275952F800000000000000003130383020536E6F77626F617264696E67202020000000000000004E54454100
|
||||
1080 Snowboarding (JU) [b5].z64-Cic=2
|
||||
1080 Snowboarding (JU) [b6].z64=803712400000000F800004000000144992072A84275952F800000000000000003130383020534E4F57424F415244494E47202020000000000000004E54454100
|
||||
1080 Snowboarding (JU) [b6].z64-Cic=2
|
||||
1080 Snowboarding (JU) [b7].z64=803712400000000F800004000000144992072A84275952F800000000000000003130383020534E57424F4152442D4B7553546F4D000000000000004E54454100
|
||||
1080 Snowboarding (JU) [b7].z64-Cic=2
|
||||
1080 Snowboarding (JU) [b8].z64=803712400000000F800004000000144992072A84275952F800000000000000003130383020534E4F57424F415244494E47202020000000000000004E54454100
|
||||
1080 Snowboarding (JU) [b8].z64-Cic=2
|
||||
1080 Snowboarding (JU) [b9].z64=803712400000000F80100400000014491FBAF1612C1C54F100000000000000003130383020534E4F57424F415244494E47202020000000000000004E54454100
|
||||
1080 Snowboarding (JU) [b9].z64-Cic=3
|
||||
1080 Snowboarding (JU) [ba].z64=803712400000000F801004000000144935F533830C8D0AE400000000000000003130383020534E4F57424F415244494E47202020000000000000004E54454100
|
||||
1080 Snowboarding (JU) [ba].z64-Cic=3
|
||||
1080 Snowboarding (JU) [f1] (DS-1).z64=803712400000000F800004000000144992072A84275952F800000000000000003130383020534E4F57424F415244494E47202020000000000000004E54454100
|
||||
1080 Snowboarding (JU) [f1] (DS-1).z64-Cic=2
|
||||
1080 Snowboarding (JU) [f2] (PAL).z64=803712400000000F80100400000014491FBAF1612C1C54F100000000000000003130383020534E4F57424F415244494E47202020000000000000004E54454100
|
||||
1080 Snowboarding (JU) [f2] (PAL).z64-Cic=3
|
||||
1080 Snowboarding (JU) [f3] (PAL).z64=803712400000000F80100400000014499207357AE85D400100000000000000003130383020534E4F57424F415244494E47202020000000000000004E54454100
|
||||
1080 Snowboarding (JU) [f3] (PAL).z64-Cic=3
|
||||
1080 Snowboarding (JU) [f4] (PAL-Z64).z64=803712400000000F800004000000144992072A84275952F800000000000000003130383020536E6F77626F617264696E67202020000000000000004E54454100
|
||||
1080 Snowboarding (JU) [f4] (PAL-Z64).z64-Cic=2
|
||||
1080 Snowboarding (JU) [f5] (SRAM).z64=803712400000000F800004000000144992072A84275952F800000000000000003130383020534E4F57424F415244494E47202020000000000000004E54454100
|
||||
1080 Snowboarding (JU) [f5] (SRAM).z64-Cic=2
|
||||
1080 Snowboarding (JU) [f5][t1].z64=803712400000000F800004000000144992072A84275952F800000000000000003130383020534E4F57424F415244494E47202020000000000000004E54454100
|
||||
1080 Snowboarding (JU) [f5][t1].z64-Cic=2
|
||||
1080 Snowboarding (JU) [f6] (Boot-PAL).z64=803712400000000F800004000000144992072A84275952F800000000000000003130383020534E4F57424F415244494E47202020000000000000004E54454100
|
||||
1080 Snowboarding (JU) [f6] (Boot-PAL).z64-Cic=2
|
||||
1080 Snowboarding (JU) [h1C].z64=803712400000000F801004000000144935F533830C8D0AE400000000000000003130383020536E6F77626F617264696E67202020000000000000004E54454100
|
||||
1080 Snowboarding (JU) [h1C].z64-Cic=3
|
||||
1080 Snowboarding (JU) [h2C].z64=803712400000000F800004000000144992072A84275952F800000000000000003130383020536E6F77426F617264696E67202020000000000000004E54454100
|
||||
1080 Snowboarding (JU) [h2C].z64-Cic=2
|
||||
|
||||
[pokemon puzzle league-32920117]
|
||||
Pokemon Puzzle League (E) [!].z64=803712400000000F800004000000144A4A1CD153D830AEF8000000000000000050555A5A4C45204C4541475545204E3634202020000000000000004E504E5000
|
||||
Pokemon Puzzle League (E) [!].z64-Cic=2
|
||||
Pokemon Puzzle League (F) [!].z64=803712400000000F800004000000144A3EB2E6F3062F9EFE000000000000000050555A5A4C45204C4541475545204E3634202020000000000000004E504E4600
|
||||
Pokemon Puzzle League (F) [!].z64-Cic=2
|
||||
Pokemon Puzzle League (G) [!].z64=803712400000000F800004000000144A7A4747AC44EEEC23000000000000000050555A5A4C45204C4541475545204E3634202020000000000000004E504E4400
|
||||
Pokemon Puzzle League (G) [!].z64-Cic=2
|
||||
Pokemon Puzzle League (U) [!].z64=803712400000000F800004000000144A19C553A7A70F4B52000000000000000050555A5A4C45204C4541475545204E3634202020000000000000004E504E4500
|
||||
Pokemon Puzzle League (U) [!].z64-Cic=2
|
||||
Pokemon Puzzle League (U) [t1].z64=803712400000000F800004000000144AE1AAA92527C9C94B000000000000000050555A5A4C45204C4541475545204E3634202020000000000000004E504E4500
|
||||
Pokemon Puzzle League (U) [t1].z64-Cic=2
|
||||
Pokemon Puzzle League (U) [t2].z64=803712400000000F800004000000144AAAE125A9C9274BC9000000000000000050555A5A4C45204C4541475545204E3634202020000000000000004E504E4500
|
||||
Pokemon Puzzle League (U) [t2].z64-Cic=2
|
|
@ -1,6 +1,5 @@
|
|||
#ifndef __N64_SYSTEM__H__
|
||||
#define __N64_SYSTEM__H__
|
||||
#pragma warning(disable:4786)
|
||||
|
||||
#include "Support.h"
|
||||
#include <string> //needed for stl string (std::string)
|
||||
|
@ -28,10 +27,14 @@ class CNotification;
|
|||
#include "N64 System/Mips/OpCode Class.h"
|
||||
#include "N64 System/Mips/Audio.h"
|
||||
#include "N64 System/Mips/System Timing.h"
|
||||
#include "N64 System/Mips/System Events.h"
|
||||
|
||||
//C Core - to be upgrdaded and removed
|
||||
#include "N64 System/C Core/CPU Log.h"
|
||||
#include "N64 System/C Core/r4300i Commands.h"
|
||||
#include "N64 System/C Core/Dma.h"
|
||||
#include "N64 System/C Core/Win32Timer.h"
|
||||
#include "N64 System/C Core/Logging.h"
|
||||
|
||||
//Interpter
|
||||
#include "N64 System/Interpreter/Interpreter Ops.h"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "stdafx.h"
|
||||
#include "C Core.h"
|
||||
#include "eeprom.h"
|
||||
#include "mempak.h"
|
||||
extern "C" {
|
||||
#include "Plugin.h"
|
||||
#include "Logging.h"
|
||||
#include "Interpreter CPU.h"
|
||||
|
@ -10,32 +10,6 @@ extern "C" {
|
|||
#include "sram.h"
|
||||
#include "flashram.h"
|
||||
|
||||
enum STEP_TYPE NextInstruction, Main_NextInstruction, Sync_NextInstruction;
|
||||
|
||||
}
|
||||
|
||||
#ifdef toremove
|
||||
CN64System * _N64System = NULL;
|
||||
CN64System * _SyncSystem = NULL;
|
||||
CRecompiler * _Recompiler = NULL;
|
||||
CMipsMemoryVM * _MMU = NULL; //Memory of the n64
|
||||
CTLB * _TLB = NULL; //TLB Unit
|
||||
CRegisters * _Reg = NULL; //Current Register Set attacted to the _MMU
|
||||
CNotification * _Notify = NULL;
|
||||
CSettings * _Settings = NULL;
|
||||
CPlugins * _Plugins = NULL;
|
||||
CN64Rom * _Rom = NULL; //The current rom that this system is executing.. it can only execute one file at the time
|
||||
|
||||
//registers
|
||||
MIPS_DWORD * _GPR = NULL, * _FPR = NULL, * g_HI = NULL, * g_LO = NULL;
|
||||
DWORD * _PROGRAM_COUNTER = NULL, * _CP0 = NULL, * _RegMI = NULL, * _LLBit = NULL,
|
||||
* _LLAddr = NULL, * _FPCR = NULL, * _RegSI = NULL, * _RegRI = NULL, * _RegPI = NULL,
|
||||
* _RegAI = NULL, * _RegVI = NULL, * _RegDPC = NULL, * _RegSP = NULL, * _RegRDRAM = NULL;
|
||||
double ** _FPRDoubleLocation;
|
||||
float ** _FPRFloatLocation;
|
||||
int * _Timer = NULL;
|
||||
#endif
|
||||
|
||||
//settings
|
||||
BOOL g_ShowUnhandledMemory = false, g_ShowCPUPer = false, g_ShowTLBMisses = false, g_UseTlb = true,
|
||||
g_HaveDebugger = false, g_AudioSignal = false, g_ShowDListAListCount = false,
|
||||
|
@ -51,9 +25,9 @@ char g_RomName [300];
|
|||
|
||||
//Plugins
|
||||
DWORD * _AudioIntrReg = NULL;
|
||||
CONTROL * g_Controllers;
|
||||
enum SystemType g_SystemType;
|
||||
|
||||
#ifdef toremove
|
||||
/******** All DLLs have this function **************/
|
||||
void (__cdecl *GetDllInfo) ( PLUGIN_INFO * PluginInfo );
|
||||
|
||||
|
@ -117,52 +91,17 @@ void (__cdecl *ReadController) ( int Control, BYTE * Command );
|
|||
//void (__cdecl *WM_KeyDown) ( WPARAM wParam, LPARAM lParam );
|
||||
//void (__cdecl *WM_KeyUp) ( WPARAM wParam, LPARAM lParam );
|
||||
void (__cdecl *RumbleCommand) ( int Control, BOOL bRumble );
|
||||
#endif
|
||||
|
||||
//Memory
|
||||
DWORD * g_TLB_ReadMap, * g_TLB_WriteMap, g_RdramSize;
|
||||
DWORD g_RdramSize;
|
||||
|
||||
BOOL g_IndvidualBlock, g_Profiling;
|
||||
DWORD g_CurrentFrame;
|
||||
QWORD g_Frequency, g_Frames[NoOfFrames], g_LastFrame;
|
||||
|
||||
|
||||
CPU_ACTION * g_CPU_Action = NULL;
|
||||
CPU_ACTION * g_Main_CPU_Action = NULL;
|
||||
CPU_ACTION * g_Sync_CPU_Action = NULL;
|
||||
|
||||
void CC_Core::SetN64System (CN64System * N64System)
|
||||
{
|
||||
if (g_Main_CPU_Action)
|
||||
{
|
||||
delete g_Main_CPU_Action;
|
||||
g_Main_CPU_Action = NULL;
|
||||
}
|
||||
Main_NextInstruction = NORMAL;
|
||||
g_Main_CPU_Action = new CPU_ACTION;
|
||||
memset(g_Main_CPU_Action,0,sizeof(CPU_ACTION));
|
||||
|
||||
if (N64System)
|
||||
{
|
||||
g_RomFileSize = _Rom->GetRomSize();
|
||||
g_CicChip = _Rom->CicChipID();
|
||||
}
|
||||
g_CurrentFrame = 0;
|
||||
SetCurrentSystem(N64System);
|
||||
}
|
||||
|
||||
void CC_Core::SetSyncCpu ( CN64System * System )
|
||||
{
|
||||
if (g_Sync_CPU_Action)
|
||||
{
|
||||
delete g_Sync_CPU_Action;
|
||||
g_Sync_CPU_Action = NULL;
|
||||
}
|
||||
Sync_NextInstruction = NORMAL;
|
||||
if (System)
|
||||
{
|
||||
g_Sync_CPU_Action = new CPU_ACTION;
|
||||
memset(g_Sync_CPU_Action,0,sizeof(CPU_ACTION));
|
||||
}
|
||||
_SyncSystem = System;
|
||||
}
|
||||
|
||||
|
@ -203,6 +142,8 @@ void CC_Core::SetSettings ( )
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef toremove
|
||||
void CC_Core::SetCurrentSystem (CN64System * System )
|
||||
{
|
||||
_MMU = NULL;
|
||||
|
@ -213,16 +154,6 @@ void CC_Core::SetCurrentSystem (CN64System * System )
|
|||
|
||||
_N64System = System;
|
||||
|
||||
if (_SyncSystem == System)
|
||||
{
|
||||
Main_NextInstruction = NextInstruction;
|
||||
g_CPU_Action = g_Sync_CPU_Action;
|
||||
NextInstruction = Sync_NextInstruction;
|
||||
} else {
|
||||
Sync_NextInstruction = NextInstruction;
|
||||
g_CPU_Action = g_Main_CPU_Action;
|
||||
NextInstruction = Main_NextInstruction;
|
||||
}
|
||||
if (_N64System)
|
||||
{
|
||||
_Recompiler = System->m_Recomp;
|
||||
|
@ -322,13 +253,10 @@ void CC_Core::SetCurrentSystem (CN64System * System )
|
|||
// AiRomClosed = _Plugins->Audio()->AiRomClosed;
|
||||
// AiUpdate = _Plugins->Audio()->Update;
|
||||
// InitiateAudio = _Plugins->Audio()->InitiateAudio;
|
||||
#endif
|
||||
g_TLB_ReadMap = NULL; //System->m_TLB.TLB_ReadMap;
|
||||
g_TLB_WriteMap = NULL; //System->m_TLB.TLB_WriteMap;
|
||||
#ifdef tofix
|
||||
g_MemorStack = &_MMU->m_MemoryStack;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
void CC_Core::PauseExecution ( void )
|
||||
{
|
||||
|
@ -450,36 +378,13 @@ BOOL Close_C_CPU ( void )
|
|||
{
|
||||
return true;
|
||||
}
|
||||
SetEndEmulation(true);
|
||||
g_Main_CPU_Action->DoSomething = true;
|
||||
g_Main_CPU_Action->CloseCPU = true;
|
||||
_N64System->m_EndEmulation = true;
|
||||
_Notify->BreakPoint(__FILE__,__LINE__);
|
||||
// g_Main_CPU_Action->DoSomething = true;
|
||||
// g_Main_CPU_Action->CloseCPU = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
void StopEmulation ( void )
|
||||
{
|
||||
_N64System->CloseCpu();
|
||||
}
|
||||
|
||||
void CleanCMemory ( void )
|
||||
{
|
||||
if ( g_Main_CPU_Action )
|
||||
{
|
||||
delete g_Main_CPU_Action;
|
||||
g_Main_CPU_Action = NULL;
|
||||
}
|
||||
if (g_Sync_CPU_Action)
|
||||
{
|
||||
delete g_Sync_CPU_Action;
|
||||
g_Sync_CPU_Action = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void __stdcall UpdateSyncCPU ( DWORD const Cycles )
|
||||
{
|
||||
_N64System->UpdateSyncCPU(_SyncSystem,Cycles);
|
||||
}
|
||||
|
||||
void RunRsp( void )
|
||||
{
|
||||
CC_Core::RunRsp();
|
||||
|
@ -529,9 +434,9 @@ void ChangePluginFunc ( void )
|
|||
if (!_Plugins->Initiate())
|
||||
{
|
||||
_Notify->DisplayMessage(5,MSG_PLUGIN_NOT_INIT);
|
||||
SetEndEmulation(true);
|
||||
_N64System->m_EndEmulation = true;
|
||||
} else {
|
||||
CC_Core::SetCurrentSystem(_N64System);
|
||||
//CC_Core::SetCurrentSystem(_N64System);
|
||||
}
|
||||
_Recompiler->ResetRecompCode();
|
||||
}
|
||||
|
@ -544,7 +449,7 @@ void ChangeFullScreenFunc ( void )
|
|||
BOOL Machine_LoadState ( void )
|
||||
{
|
||||
bool Result = CC_Core::LoadState(_N64System);
|
||||
CC_Core::SetCurrentSystem(_N64System);
|
||||
//CC_Core::SetCurrentSystem(_N64System);
|
||||
return Result;
|
||||
}
|
||||
|
||||
|
@ -622,16 +527,6 @@ void ResetX86Logs ( void )
|
|||
}
|
||||
}
|
||||
|
||||
BOOL EndEmulation ( void )
|
||||
{
|
||||
return _N64System->m_EndEmulation;
|
||||
}
|
||||
|
||||
void SetEndEmulation ( BOOL End )
|
||||
{
|
||||
_N64System->m_EndEmulation = End != 0;
|
||||
}
|
||||
|
||||
void CloseSaveChips ( void )
|
||||
{
|
||||
CloseEeprom();
|
||||
|
@ -640,25 +535,6 @@ void CloseSaveChips ( void )
|
|||
CloseFlashRam();
|
||||
}
|
||||
|
||||
void TLB_ReadEntry ( void )
|
||||
{
|
||||
_TLB->ReadEntry();
|
||||
}
|
||||
|
||||
void TLB_WriteEntry( int index, BOOL Random )
|
||||
{
|
||||
if (index > 31)
|
||||
{
|
||||
BreakPoint(__FILE__,__LINE__);
|
||||
}
|
||||
_TLB->WriteEntry(index,Random != 0);
|
||||
}
|
||||
|
||||
void TLB_Probe()
|
||||
{
|
||||
_TLB->Probe();
|
||||
}
|
||||
|
||||
void SyncToPC (void) {
|
||||
//FixRandomReg();
|
||||
SyncSystem ();
|
||||
|
@ -675,15 +551,3 @@ BOOL ClearRecompCodeProtectMem ( DWORD Address, int length )
|
|||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
BOOL ClearRecompCodeInitialCode ( void )
|
||||
{
|
||||
if (_Recompiler)
|
||||
{
|
||||
_Notify->BreakPoint(__FILE__,__LINE__);
|
||||
#ifdef tofix
|
||||
return _Recompiler->ClearRecompCode_Virt(0x80000000,0x200,CRecompiler::Remove_InitialCode);
|
||||
#endif
|
||||
}
|
||||
return false;
|
||||
}
|
|
@ -6,27 +6,11 @@
|
|||
#include "..\\..\\Multilanguage.h"
|
||||
#include "..\\..\\Plugin.h"
|
||||
|
||||
#ifdef toremove
|
||||
extern CN64System * g_N64System;
|
||||
extern CN64System * g_SyncSystem;
|
||||
extern CRecompiler * g_Recompiler;
|
||||
extern CMipsMemoryVM * g_MMU; //Memory of the n64
|
||||
extern CTLB * g_TLB; //TLB Unit
|
||||
extern CRegisters * g_Reg; //Current Register Set attacted to the _MMU
|
||||
extern CNotification * g_Notify;
|
||||
extern CSettings * g_Settings;
|
||||
extern CPlugins * g_Plugins;
|
||||
extern CN64Rom * g_Rom; //The current rom that this system is executing.. it can only execute one file at the time
|
||||
extern CAudio * g_Audio;
|
||||
#endif
|
||||
|
||||
class CC_Core
|
||||
{
|
||||
public:
|
||||
static void SetSettings ( );
|
||||
static void SetN64System ( CN64System * System );
|
||||
static void SetSyncCpu ( CN64System * System );
|
||||
static void SetCurrentSystem (CN64System * System );
|
||||
static void RunRsp (void );
|
||||
static void RefreshScreen (void );
|
||||
static void ApplyCheats (CN64System * System );
|
||||
|
@ -64,51 +48,26 @@ void ChangePluginFunc ( void );
|
|||
void ApplyGSButtonCheats ( void );
|
||||
void ChangeFullScreenFunc ( void );
|
||||
BOOL Close_C_CPU ( void );
|
||||
void StopEmulation ( void );
|
||||
void __stdcall UpdateSyncCPU ( DWORD const Cycles );
|
||||
void StartInterpreterCPU ( void );
|
||||
void SyncSystem ( void );
|
||||
BOOL Machine_LoadState ( void );
|
||||
BOOL Machine_SaveState ( void );
|
||||
void BreakPoint ( LPCSTR FileName, int LineNumber );
|
||||
void CleanCMemory ( void );
|
||||
void ApplyCheats ( void );
|
||||
void RunRsp ( void );
|
||||
void RefreshScreen ( void );
|
||||
void ResetX86Logs ( void );
|
||||
void SyncToPC ( void );
|
||||
BOOL EndEmulation ( void );
|
||||
void SetEndEmulation ( BOOL End );
|
||||
void CloseSaveChips ( void );
|
||||
|
||||
|
||||
//TLB Functions
|
||||
BOOL TranslateVaddr ( DWORD VAddr, DWORD * PAddr);
|
||||
void TLB_ReadEntry ( void );
|
||||
void TLB_WriteEntry ( int index, BOOL Random );
|
||||
|
||||
BOOL ClearRecompCodeInitialCode ( void );
|
||||
BOOL ClearRecompCodeProtectMem ( DWORD PhysicalAddress, int length );
|
||||
|
||||
|
||||
//Timer functions
|
||||
void ResetTimer ( void );
|
||||
void GenerateProfileLog ( void );
|
||||
DWORD StartTimer ( DWORD Address );
|
||||
DWORD StopTimer ( void );
|
||||
|
||||
|
||||
//registers
|
||||
#ifdef toremove
|
||||
extern MIPS_DWORD * g_GPR, * g_FPR, * g_HI, * g_LO;
|
||||
extern DWORD * g_PROGRAM_COUNTER, * g_CP0, * g_RegMI, * g_LLBit,
|
||||
* g_LLAddr, * g_FPCR, * g_RegSI, * g_RegRI, * g_RegPI, * g_RegAI,
|
||||
* g_RegVI, * g_RegDPC, * g_RegSP, * g_RegRDRAM;
|
||||
extern double ** g_FPRDoubleLocation;
|
||||
extern float ** g_FPRFloatLocation;
|
||||
extern int * g_Timer;
|
||||
#endif
|
||||
|
||||
//settings
|
||||
extern BOOL g_ShowUnhandledMemory, g_ShowCPUPer, g_ShowTLBMisses, g_UseTlb,
|
||||
g_HaveDebugger, g_AudioSignal, g_ShowDListAListCount, g_ShowPifRamErrors,
|
||||
|
@ -123,14 +82,8 @@ extern char g_RomName [300];
|
|||
|
||||
//Plugins
|
||||
extern DWORD * g_AudioIntrReg;
|
||||
extern CONTROL * g_Controllers;
|
||||
extern enum SystemType g_SystemType;
|
||||
|
||||
//Memory
|
||||
#ifdef toremove
|
||||
extern DWORD * g_TLB_ReadMap, * g_TLB_WriteMap, g_SystemRdramSize;
|
||||
#endif
|
||||
|
||||
extern DWORD g_RdramSize;
|
||||
|
||||
//Misc
|
||||
|
@ -138,35 +91,6 @@ enum { NoOfFrames = 7 };
|
|||
extern DWORD g_CurrentFrame;
|
||||
extern QWORD g_Frequency, g_Frames[NoOfFrames], g_LastFrame;
|
||||
|
||||
typedef struct {
|
||||
HANDLE hStepping;
|
||||
|
||||
int InterruptFlag;
|
||||
BOOL SoftReset;
|
||||
BOOL GenerateInterrupt;
|
||||
BOOL DoSomething;
|
||||
BOOL CloseCPU;
|
||||
BOOL ChangeWindow;
|
||||
BOOL GSButton;
|
||||
BOOL CheckInterrupts;
|
||||
BOOL Pause;
|
||||
BOOL SaveState;
|
||||
BOOL RestoreState;
|
||||
BOOL DoInterrupt;
|
||||
BOOL InterruptExecuted;
|
||||
BOOL Stepping;
|
||||
BOOL ChangePlugin;
|
||||
BOOL ProfileStartStop;
|
||||
BOOL ProfileResetStats;
|
||||
BOOL ProfileGenerateLogs;
|
||||
BOOL GameSpeed_Increase;
|
||||
BOOL GameSpeed_Decrease;
|
||||
BOOL DMAUsed;
|
||||
} CPU_ACTION;
|
||||
|
||||
extern CPU_ACTION * g_CPU_Action;
|
||||
extern CPU_ACTION * g_Main_CPU_Action;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
|
@ -1,27 +0,0 @@
|
|||
#ifndef __C_CORE__H__
|
||||
#define __C_CORE__H__
|
||||
|
||||
#include "C Core Interface.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "..\N64 Types.h"
|
||||
#include "..\Mips\OpCode.h"
|
||||
#include "Core Settings.h"
|
||||
#include "C Memory.h"
|
||||
#include "CPU Log.h"
|
||||
|
||||
void InitializeCPUCore ( void );
|
||||
|
||||
//from exception.h
|
||||
void _fastcall DoTLBMiss ( BOOL DelaySlot, DWORD BadVaddr );
|
||||
|
||||
//extern enum STEP_TYPE NextInstruction;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -1,60 +0,0 @@
|
|||
#define CPU_Type g_CPU_Type
|
||||
#define CPU_Action (*g_CPU_Action)
|
||||
#define IndvidualBlock g_IndvidualBlock
|
||||
#define Profiling g_Profiling
|
||||
|
||||
// Registers
|
||||
/*#define GPR g_GPR
|
||||
#define CP0 g_CP0
|
||||
#define FPR g_FPR
|
||||
#define FPCR g_FPCR
|
||||
#define RegMI g_RegMI
|
||||
#define RegSI g_RegSI
|
||||
#define RegRI g_RegRI
|
||||
#define RegPI g_RegPI
|
||||
#define RegAI g_RegAI
|
||||
#define RegVI g_RegVI
|
||||
#define RegDPC g_RegDPC
|
||||
#define RegSP g_RegSP
|
||||
#define RegRDRAM g_RegRDRAM
|
||||
#define PROGRAM_COUNTER (*g_PROGRAM_COUNTER)
|
||||
#define LLBit (*g_LLBit)
|
||||
#define HI (*g_HI)
|
||||
#define LO (*g_LO)
|
||||
#define FPRDoubleLocation g_FPRDoubleLocation
|
||||
#define FPRFloatLocation g_FPRFloatLocation*/
|
||||
|
||||
//Settings
|
||||
#define ShowUnhandledMemory g_ShowUnhandledMemory
|
||||
#define ShowCPUPer g_ShowCPUPer
|
||||
#define ShowTLBMisses g_ShowTLBMisses
|
||||
#define UseTlb g_UseTlb
|
||||
#define HaveDebugger g_HaveDebugger
|
||||
#define RomFileSize g_RomFileSize
|
||||
#define SaveUsing g_SaveUsing
|
||||
#define RomName g_RomName
|
||||
#define AudioSignal g_AudioSignal
|
||||
#define CicChip g_CicChip
|
||||
#define ShowDListAListCount g_ShowDListAListCount
|
||||
#define ShowPifRamErrors g_ShowPifRamErrors
|
||||
#define CountPerOp g_CountPerOp
|
||||
#define DelaySI g_DelaySI
|
||||
#define DisableRegCaching g_DisableRegCaching
|
||||
#define ShowCompMem g_ShowCompMem
|
||||
#define UseLinking g_UseLinking
|
||||
#define LookUpMode g_LookUpMode
|
||||
|
||||
//Plugins
|
||||
//#define AudioIntrReg (*g_AudioIntrReg)
|
||||
#define Controllers g_Controllers
|
||||
|
||||
//Misc
|
||||
#define AppName GetAppName()
|
||||
#define TLB_WriteMap g_TLB_WriteMap
|
||||
#define TLB_ReadMap g_TLB_ReadMap
|
||||
#define RdramSize g_RdramSize
|
||||
#define CurrentFrame g_CurrentFrame
|
||||
#define Frequency g_Frequency
|
||||
#define LastFrame g_LastFrame
|
||||
#define Frames g_Frames
|
||||
|
|
@ -1,404 +0,0 @@
|
|||
/*
|
||||
* Project 64 - A Nintendo 64 emulator.
|
||||
*
|
||||
* (c) Copyright 2001 zilmar (zilmar@emulation64.com) and
|
||||
* Jabo (jabo@emulation64.com).
|
||||
*
|
||||
* pj64 homepage: www.pj64.net
|
||||
*
|
||||
* Permission to use, copy, modify and distribute Project64 in both binary and
|
||||
* source form, for non-commercial purposes, is hereby granted without fee,
|
||||
* providing that this license information and copyright notice appear with
|
||||
* all copies and any derived work.
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event shall the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Project64 is freeware for PERSONAL USE only. Commercial users should
|
||||
* seek permission of the copyright holders first. Commercial use includes
|
||||
* charging money for Project64 or software derived from Project64.
|
||||
*
|
||||
* The copyright holders request that bug fixes and improvements to the code
|
||||
* should be forwarded to them so if they want them.
|
||||
*
|
||||
*/
|
||||
#ifdef toremove
|
||||
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include "main.h"
|
||||
#include "cpu.h"
|
||||
#include "x86.h"
|
||||
#include "plugin.h"
|
||||
#include "debugger.h"
|
||||
|
||||
void ** JumpTable, ** DelaySlotTable;
|
||||
BYTE *RecompPos;
|
||||
|
||||
BOOL WrittenToRom;
|
||||
DWORD WroteToRom;
|
||||
DWORD TempValue;
|
||||
|
||||
|
||||
int r4300i_Command_MemoryFilter( DWORD dwExptCode, LPEXCEPTION_POINTERS lpEP) {
|
||||
DWORD MemAddress = (char *)lpEP->ExceptionRecord->ExceptionInformation[1] - (char *)N64MEM;
|
||||
EXCEPTION_RECORD exRec;
|
||||
|
||||
if (dwExptCode != EXCEPTION_ACCESS_VIOLATION) {
|
||||
return EXCEPTION_CONTINUE_SEARCH;
|
||||
}
|
||||
exRec = *lpEP->ExceptionRecord;
|
||||
|
||||
if ((int)((BYTE *)lpEP->ExceptionRecord->ExceptionInformation[1] - N64MEM) < 0) {
|
||||
return EXCEPTION_CONTINUE_SEARCH;
|
||||
}
|
||||
if ((int)((BYTE *)lpEP->ExceptionRecord->ExceptionInformation[1] - N64MEM) > 0x1FFFFFFF) {
|
||||
return EXCEPTION_CONTINUE_SEARCH;
|
||||
}
|
||||
|
||||
switch(*(unsigned char *)lpEP->ContextRecord->Eip) {
|
||||
case 0x8B:
|
||||
switch(*(unsigned char *)(lpEP->ContextRecord->Eip + 1)) {
|
||||
case 0x04:
|
||||
lpEP->ContextRecord->Eip += 3;
|
||||
r4300i_LW_NonMemory((char *)exRec.ExceptionInformation[1] - (char *)N64MEM,
|
||||
&lpEP->ContextRecord->Eax);
|
||||
return EXCEPTION_CONTINUE_EXECUTION;
|
||||
break;
|
||||
case 0x0C:
|
||||
lpEP->ContextRecord->Eip += 3;
|
||||
r4300i_LW_NonMemory((char *)exRec.ExceptionInformation[1] - (char *)N64MEM,
|
||||
&lpEP->ContextRecord->Ecx);
|
||||
return EXCEPTION_CONTINUE_EXECUTION;
|
||||
break;
|
||||
default:
|
||||
DisplayError("Unknown x86 opcode %X\nlocation %X\nN64mem loc: %X",
|
||||
*(unsigned char *)lpEP->ContextRecord->Eip, lpEP->ContextRecord->Eip, (char *)N64MEM);
|
||||
//return EXCEPTION_EXECUTE_HANDLER;
|
||||
return EXCEPTION_CONTINUE_SEARCH;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
DisplayError("Unknown x86 opcode %X\nlocation %X\nloc: %X\n2",
|
||||
*(unsigned char *)lpEP->ContextRecord->Eip, lpEP->ContextRecord->Eip, (char *)exRec.ExceptionInformation[1] - (char *)N64MEM);
|
||||
//return EXCEPTION_EXECUTE_HANDLER;
|
||||
return EXCEPTION_CONTINUE_SEARCH;
|
||||
}
|
||||
DisplayError("Unknown x86 opcode %X\nlocation %X\nN64mem loc: %X\nAddress: %X",
|
||||
*(unsigned char *)lpEP->ContextRecord->Eip, lpEP->ContextRecord->Eip, (char *)N64MEM,
|
||||
(char *)exRec.ExceptionInformation[1] - (char *)N64MEM);
|
||||
DisplayError("r4300i: CPU Memory Filter\n\nWTF");
|
||||
return EXCEPTION_CONTINUE_SEARCH;
|
||||
}
|
||||
|
||||
int r4300i_CPU_MemoryFilter( DWORD dwExptCode, LPEXCEPTION_POINTERS lpEP) {
|
||||
DWORD MemAddress = (char *)lpEP->ExceptionRecord->ExceptionInformation[1] - (char *)N64MEM;
|
||||
EXCEPTION_RECORD exRec;
|
||||
BYTE * ReadPos, *TypePos;
|
||||
DWORD * Reg;
|
||||
|
||||
if (dwExptCode != EXCEPTION_ACCESS_VIOLATION) {
|
||||
return EXCEPTION_CONTINUE_SEARCH;
|
||||
}
|
||||
|
||||
TypePos = (unsigned char *)lpEP->ContextRecord->Eip;
|
||||
exRec = *lpEP->ExceptionRecord;
|
||||
|
||||
if ((int)(MemAddress) < 0 || MemAddress > 0x1FFFFFFF) { return EXCEPTION_CONTINUE_SEARCH; }
|
||||
|
||||
if (*TypePos == 0xF3 && *(TypePos + 1) == 0xA5) {
|
||||
DWORD Start, End, count, OldProtect;
|
||||
Start = (lpEP->ContextRecord->Edi - (DWORD)N64MEM);
|
||||
End = (Start + (lpEP->ContextRecord->Ecx << 2) - 1);
|
||||
if ((int)Start < 0) {
|
||||
#ifndef EXTERNAL_RELEASE
|
||||
DisplayError("hmmm.... where does this dma start ?");
|
||||
#endif
|
||||
return EXCEPTION_CONTINUE_SEARCH;
|
||||
}
|
||||
#ifdef CFB_READ
|
||||
if (Start >= CFBStart && End < CFBEnd) {
|
||||
for ( count = Start; count < End; count += 0x1000 ) {
|
||||
VirtualProtect(N64MEM+count,4,PAGE_READONLY, &OldProtect);
|
||||
if (FrameBufferRead) { FrameBufferRead(count & ~0xFFF); }
|
||||
}
|
||||
return EXCEPTION_CONTINUE_EXECUTION;
|
||||
}
|
||||
#endif
|
||||
if ((int)End < RdramSize) {
|
||||
for ( count = Start; count < End; count += 0x1000 ) {
|
||||
BreakPoint(__FILE__,__LINE__);
|
||||
if (N64_Blocks.NoOfRDRamBlocks[(count >> 12)] > 0) {
|
||||
N64_Blocks.NoOfRDRamBlocks[(count >> 12)] = 0;
|
||||
memset(JumpTable + ((count & 0x00FFFFF0) >> 2),0,0x1000);
|
||||
*(DelaySlotTable + count) = NULL;
|
||||
if (VirtualProtect(N64MEM + count, 4, PAGE_READWRITE, &OldProtect) == 0) {
|
||||
#ifndef EXTERNAL_RELEASE
|
||||
DisplayError("Failed to unprotect %X\n1", count);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
return EXCEPTION_CONTINUE_EXECUTION;
|
||||
}
|
||||
if (Start >= 0x04000000 && End < 0x04001000) {
|
||||
BreakPoint(__FILE__,__LINE__);
|
||||
N64_Blocks.NoOfDMEMBlocks = 0;
|
||||
memset(JumpTable + (0x04000000 >> 2),0,0x1000);
|
||||
*(DelaySlotTable + (0x04000000 >> 12)) = NULL;
|
||||
if (VirtualProtect(N64MEM + 0x04000000, 4, PAGE_READWRITE, &OldProtect) == 0) {
|
||||
#ifndef EXTERNAL_RELEASE
|
||||
DisplayError("Failed to unprotect %X\n7", 0x04000000);
|
||||
#endif
|
||||
}
|
||||
return EXCEPTION_CONTINUE_EXECUTION;
|
||||
}
|
||||
if (Start >= 0x04001000 && End < 0x04002000) {
|
||||
BreakPoint(__FILE__,__LINE__);
|
||||
N64_Blocks.NoOfIMEMBlocks = 0;
|
||||
memset(JumpTable + (0x04001000 >> 2),0,0x1000);
|
||||
*(DelaySlotTable + (0x04001000 >> 12)) = NULL;
|
||||
if (VirtualProtect(N64MEM + 0x04001000, 4, PAGE_READWRITE, &OldProtect) == 0) {
|
||||
#ifndef EXTERNAL_RELEASE
|
||||
DisplayError("Failed to unprotect %X\n6", 0x04001000);
|
||||
#endif
|
||||
}
|
||||
return EXCEPTION_CONTINUE_EXECUTION;
|
||||
}
|
||||
#ifndef EXTERNAL_RELEASE
|
||||
DisplayError("hmmm.... where does this dma End ?\nstart: %X\nend:%X\nlocation %X",
|
||||
Start,End,lpEP->ContextRecord->Eip);
|
||||
#endif
|
||||
return EXCEPTION_CONTINUE_SEARCH;
|
||||
}
|
||||
|
||||
if (*TypePos == 0x0F && *(TypePos + 1) == 0xB6) {
|
||||
ReadPos = TypePos + 2;
|
||||
} else if (*TypePos == 0x0F && *(TypePos + 1) == 0xB7) {
|
||||
ReadPos = TypePos + 2;
|
||||
} else if (*TypePos == 0x0F && *(TypePos + 1) == 0xBE) {
|
||||
ReadPos = TypePos + 2;
|
||||
} else if (*TypePos == 0x0F && *(TypePos + 1) == 0xBF) {
|
||||
ReadPos = TypePos + 2;
|
||||
} else if (*TypePos == 0x66) {
|
||||
ReadPos = TypePos + 2;
|
||||
} else {
|
||||
ReadPos = TypePos + 1;
|
||||
}
|
||||
|
||||
switch ((*ReadPos & 0x38)) {
|
||||
case 0x00: Reg = &lpEP->ContextRecord->Eax; break;
|
||||
case 0x08: Reg = &lpEP->ContextRecord->Ecx; break;
|
||||
case 0x10: Reg = &lpEP->ContextRecord->Edx; break;
|
||||
case 0x18: Reg = &lpEP->ContextRecord->Ebx; break;
|
||||
case 0x20: Reg = &lpEP->ContextRecord->Esp; break;
|
||||
case 0x28: Reg = &lpEP->ContextRecord->Ebp; break;
|
||||
case 0x30: Reg = &lpEP->ContextRecord->Esi; break;
|
||||
case 0x38: Reg = &lpEP->ContextRecord->Edi; break;
|
||||
}
|
||||
|
||||
switch ((*ReadPos & 0xC7)) {
|
||||
case 0: ReadPos += 1; break;
|
||||
case 1: ReadPos += 1; break;
|
||||
case 2: ReadPos += 1; break;
|
||||
case 3: ReadPos += 1; break;
|
||||
case 4:
|
||||
ReadPos += 1;
|
||||
switch ((*ReadPos & 0xC7)) {
|
||||
case 0: ReadPos += 1; break;
|
||||
case 1: ReadPos += 1; break;
|
||||
case 2: ReadPos += 1; break;
|
||||
case 3: ReadPos += 1; break;
|
||||
case 6: ReadPos += 1; break;
|
||||
case 7: ReadPos += 1; break;
|
||||
default:
|
||||
BreakPoint(__FILE__,__LINE__);
|
||||
}
|
||||
break;
|
||||
case 5: ReadPos += 5; break;
|
||||
case 6: ReadPos += 1; break;
|
||||
case 7: ReadPos += 1; break;
|
||||
case 0x40: ReadPos += 2; break;
|
||||
case 0x41: ReadPos += 2; break;
|
||||
case 0x42: ReadPos += 2; break;
|
||||
case 0x43: ReadPos += 2; break;
|
||||
case 0x46: ReadPos += 2; break;
|
||||
case 0x47: ReadPos += 2; break;
|
||||
case 0x80: ReadPos += 5; break;
|
||||
case 0x81: ReadPos += 5; break;
|
||||
case 0x82: ReadPos += 5; break;
|
||||
case 0x83: ReadPos += 5; break;
|
||||
case 0x86: ReadPos += 5; break;
|
||||
case 0x87: ReadPos += 5; break;
|
||||
default:
|
||||
DisplayError("Unknown x86 opcode %X\nlocation %X\nloc: %X\nfgh2",
|
||||
*(unsigned char *)lpEP->ContextRecord->Eip, lpEP->ContextRecord->Eip, (char *)exRec.ExceptionInformation[1] - (char *)N64MEM);
|
||||
return EXCEPTION_CONTINUE_SEARCH;
|
||||
}
|
||||
|
||||
switch(*TypePos) {
|
||||
case 0x0F:
|
||||
switch(*(TypePos + 1)) {
|
||||
case 0xB6:
|
||||
if (!r4300i_LB_NonMemory(MemAddress,(DWORD *)Reg,FALSE)) {
|
||||
if (ShowUnhandledMemory) {
|
||||
DisplayError("Failed to load byte\n\nMIPS Address: %X\nX86 Address",
|
||||
(char *)exRec.ExceptionInformation[1] - (char *)N64MEM,
|
||||
*(unsigned char *)lpEP->ContextRecord->Eip);
|
||||
}
|
||||
}
|
||||
lpEP->ContextRecord->Eip = (DWORD)ReadPos;
|
||||
return EXCEPTION_CONTINUE_EXECUTION;
|
||||
case 0xB7:
|
||||
if (!r4300i_LH_NonMemory(MemAddress,(DWORD *)Reg,FALSE)) {
|
||||
if (ShowUnhandledMemory) {
|
||||
DisplayError("Failed to load half word\n\nMIPS Address: %X\nX86 Address",
|
||||
(char *)exRec.ExceptionInformation[1] - (char *)N64MEM,
|
||||
*(unsigned char *)lpEP->ContextRecord->Eip);
|
||||
}
|
||||
}
|
||||
lpEP->ContextRecord->Eip = (DWORD)ReadPos;
|
||||
return EXCEPTION_CONTINUE_EXECUTION;
|
||||
case 0xBE:
|
||||
if (!r4300i_LB_NonMemory(MemAddress,Reg,TRUE)) {
|
||||
if (ShowUnhandledMemory) {
|
||||
DisplayError("Failed to load byte\n\nMIPS Address: %X\nX86 Address",
|
||||
(char *)exRec.ExceptionInformation[1] - (char *)N64MEM,
|
||||
*(unsigned char *)lpEP->ContextRecord->Eip);
|
||||
}
|
||||
}
|
||||
lpEP->ContextRecord->Eip = (DWORD)ReadPos;
|
||||
return EXCEPTION_CONTINUE_EXECUTION;
|
||||
case 0xBF:
|
||||
if (!r4300i_LH_NonMemory(MemAddress,Reg,TRUE)) {
|
||||
if (ShowUnhandledMemory) {
|
||||
DisplayError("Failed to load half word\n\nMIPS Address: %X\nX86 Address",
|
||||
(char *)exRec.ExceptionInformation[1] - (char *)N64MEM,
|
||||
*(unsigned char *)lpEP->ContextRecord->Eip);
|
||||
}
|
||||
}
|
||||
lpEP->ContextRecord->Eip = (DWORD)ReadPos;
|
||||
return EXCEPTION_CONTINUE_EXECUTION;
|
||||
default:
|
||||
DisplayError("Unkown x86 opcode %X\nlocation %X\nloc: %X\nfhfgh2",
|
||||
*(unsigned char *)lpEP->ContextRecord->Eip, lpEP->ContextRecord->Eip, (char *)exRec.ExceptionInformation[1] - (char *)N64MEM);
|
||||
return EXCEPTION_CONTINUE_SEARCH;
|
||||
}
|
||||
break;
|
||||
case 0x66:
|
||||
switch(*(TypePos + 1)) {
|
||||
case 0x8B:
|
||||
if (!r4300i_LH_NonMemory(MemAddress,Reg,FALSE)) {
|
||||
if (ShowUnhandledMemory) {
|
||||
DisplayError("Failed to half word\n\nMIPS Address: %X\nX86 Address",
|
||||
(char *)exRec.ExceptionInformation[1] - (char *)N64MEM,
|
||||
*(unsigned char *)lpEP->ContextRecord->Eip);
|
||||
}
|
||||
}
|
||||
lpEP->ContextRecord->Eip = (DWORD)ReadPos;
|
||||
return EXCEPTION_CONTINUE_EXECUTION;
|
||||
case 0x89:
|
||||
if (!r4300i_SH_NonMemory(MemAddress,*(WORD *)Reg)) {
|
||||
if (ShowUnhandledMemory) {
|
||||
DisplayError("Failed to store half word\n\nMIPS Address: %X\nX86 Address",MemAddress,
|
||||
*(unsigned char *)lpEP->ContextRecord->Eip);
|
||||
}
|
||||
}
|
||||
lpEP->ContextRecord->Eip = (DWORD)ReadPos;
|
||||
return EXCEPTION_CONTINUE_EXECUTION;
|
||||
case 0xC7:
|
||||
if (Reg != &lpEP->ContextRecord->Eax) { return EXCEPTION_CONTINUE_SEARCH; }
|
||||
if (!r4300i_SH_NonMemory(MemAddress,*(WORD *)ReadPos)) {
|
||||
if (ShowUnhandledMemory) {
|
||||
DisplayError("Failed to store half word\n\nMIPS Address: %X\nX86 Address",MemAddress,
|
||||
*(unsigned char *)lpEP->ContextRecord->Eip);
|
||||
}
|
||||
}
|
||||
lpEP->ContextRecord->Eip = (DWORD)(ReadPos + 2);
|
||||
return EXCEPTION_CONTINUE_EXECUTION;
|
||||
default:
|
||||
DisplayError("Unkown x86 opcode %X\nlocation %X\nloc: %X\nfhfgh2",
|
||||
*(unsigned char *)lpEP->ContextRecord->Eip, lpEP->ContextRecord->Eip, (char *)exRec.ExceptionInformation[1] - (char *)N64MEM);
|
||||
return EXCEPTION_CONTINUE_SEARCH;
|
||||
}
|
||||
break;
|
||||
case 0x88:
|
||||
if (!r4300i_SB_NonMemory(MemAddress,*(BYTE *)Reg)) {
|
||||
if (ShowUnhandledMemory) {
|
||||
DisplayError("Failed to store byte\n\nMIPS Address: %X\nX86 Address",
|
||||
(char *)exRec.ExceptionInformation[1] - (char *)N64MEM,
|
||||
*(unsigned char *)lpEP->ContextRecord->Eip);
|
||||
}
|
||||
}
|
||||
lpEP->ContextRecord->Eip = (DWORD)ReadPos;
|
||||
return EXCEPTION_CONTINUE_EXECUTION;
|
||||
case 0x8A:
|
||||
if (!r4300i_LB_NonMemory(MemAddress,Reg,FALSE)) {
|
||||
if (ShowUnhandledMemory) {
|
||||
DisplayError("Failed to load byte\n\nMIPS Address: %X\nX86 Address",
|
||||
(char *)exRec.ExceptionInformation[1] - (char *)N64MEM,
|
||||
*(unsigned char *)lpEP->ContextRecord->Eip);
|
||||
}
|
||||
}
|
||||
lpEP->ContextRecord->Eip = (DWORD)ReadPos;
|
||||
return EXCEPTION_CONTINUE_EXECUTION;
|
||||
case 0x8B:
|
||||
if (!r4300i_LW_NonMemory(MemAddress,Reg)) {
|
||||
if (ShowUnhandledMemory) {
|
||||
DisplayError("Failed to load word\n\nMIPS Address: %X\nX86 Address",
|
||||
(char *)exRec.ExceptionInformation[1] - (char *)N64MEM,
|
||||
*(unsigned char *)lpEP->ContextRecord->Eip);
|
||||
}
|
||||
}
|
||||
lpEP->ContextRecord->Eip = (DWORD)ReadPos;
|
||||
return EXCEPTION_CONTINUE_EXECUTION;
|
||||
case 0x89:
|
||||
if (!r4300i_SW_NonMemory(MemAddress,*(DWORD *)Reg)) {
|
||||
if (ShowUnhandledMemory) {
|
||||
DisplayError("Failed to store word\n\nMIPS Address: %X\nX86 Address",MemAddress,
|
||||
*(unsigned char *)lpEP->ContextRecord->Eip);
|
||||
}
|
||||
}
|
||||
lpEP->ContextRecord->Eip = (DWORD)ReadPos;
|
||||
return EXCEPTION_CONTINUE_EXECUTION;
|
||||
case 0xC6:
|
||||
if (Reg != &lpEP->ContextRecord->Eax) { return EXCEPTION_CONTINUE_SEARCH; }
|
||||
if (!r4300i_SB_NonMemory(MemAddress,*(BYTE *)ReadPos)) {
|
||||
if (ShowUnhandledMemory) {
|
||||
DisplayError("Failed to store byte\n\nMIPS Address: %X\nX86 Address",MemAddress,
|
||||
*(unsigned char *)lpEP->ContextRecord->Eip);
|
||||
}
|
||||
}
|
||||
lpEP->ContextRecord->Eip = (DWORD)(ReadPos + 1);
|
||||
return EXCEPTION_CONTINUE_EXECUTION;
|
||||
case 0xC7:
|
||||
if (Reg != &lpEP->ContextRecord->Eax) { return EXCEPTION_CONTINUE_SEARCH; }
|
||||
if (!r4300i_SW_NonMemory(MemAddress,*(DWORD *)ReadPos)) {
|
||||
if (ShowUnhandledMemory) {
|
||||
DisplayError("Failed to store word\n\nMIPS Address: %X\nX86 Address",MemAddress,
|
||||
*(unsigned char *)lpEP->ContextRecord->Eip);
|
||||
}
|
||||
}
|
||||
lpEP->ContextRecord->Eip = (DWORD)(ReadPos + 4);
|
||||
return EXCEPTION_CONTINUE_EXECUTION;
|
||||
default:
|
||||
DisplayError("Unkown x86 opcode %X\nlocation %X\nloc: %X\nfhfgh2",
|
||||
*(unsigned char *)lpEP->ContextRecord->Eip, lpEP->ContextRecord->Eip, (char *)exRec.ExceptionInformation[1] - (char *)N64MEM);
|
||||
return EXCEPTION_CONTINUE_SEARCH;
|
||||
}
|
||||
}
|
||||
|
||||
void r4300i_LW_PAddr ( DWORD PAddr, DWORD * Value ) {
|
||||
*Value = *(DWORD *)(N64MEM+PAddr);
|
||||
|
||||
if (LookUpMode == FuncFind_ChangeMemory)
|
||||
{
|
||||
BreakPoint(__FILE__,__LINE__);
|
||||
// if ( (Command.Hex >> 16) == 0x7C7C) {
|
||||
// Command.Hex = OrigMem[(Command.Hex & 0xFFFF)].OriginalValue;
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,79 +0,0 @@
|
|||
/*
|
||||
* Project 64 - A Nintendo 64 emulator.
|
||||
*
|
||||
* (c) Copyright 2001 zilmar (zilmar@emulation64.com) and
|
||||
* Jabo (jabo@emulation64.com).
|
||||
*
|
||||
* pj64 homepage: www.pj64.net
|
||||
*
|
||||
* Permission to use, copy, modify and distribute Project64 in both binary and
|
||||
* source form, for non-commercial purposes, is hereby granted without fee,
|
||||
* providing that this license information and copyright notice appear with
|
||||
* all copies and any derived work.
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event shall the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Project64 is freeware for PERSONAL USE only. Commercial users should
|
||||
* seek permission of the copyright holders first. Commercial use includes
|
||||
* charging money for Project64 or software derived from Project64.
|
||||
*
|
||||
* The copyright holders request that bug fixes and improvements to the code
|
||||
* should be forwarded to them so if they want them.
|
||||
*
|
||||
*/
|
||||
#ifdef toremove
|
||||
extern void ** JumpTable;
|
||||
extern BYTE *RecompPos;
|
||||
|
||||
#include <Windows.h>
|
||||
|
||||
#define ROM_IN_MAPSPACE
|
||||
|
||||
extern void ** JumpTable;
|
||||
extern BYTE *RecompPos;
|
||||
extern BOOL WrittenToRom;
|
||||
|
||||
/* Memory Control */
|
||||
int Allocate_ROM ( void );
|
||||
int Allocate_Memory ( void );
|
||||
void Release_Memory ( void );
|
||||
|
||||
/* CPU memory functions */
|
||||
int r4300i_Command_MemoryFilter ( DWORD dwExptCode, LPEXCEPTION_POINTERS lpEP );
|
||||
int r4300i_CPU_MemoryFilter ( DWORD dwExptCode, LPEXCEPTION_POINTERS lpEP );
|
||||
int r4300i_LB_NonMemory ( DWORD PAddr, DWORD * Value, BOOL SignExtend );
|
||||
BOOL r4300i_LB_VAddr ( DWORD VAddr, BYTE * Value );
|
||||
BOOL r4300i_LD_VAddr ( DWORD VAddr, unsigned _int64 * Value );
|
||||
int r4300i_LH_NonMemory ( DWORD PAddr, DWORD * Value, int SignExtend );
|
||||
BOOL r4300i_LH_VAddr ( DWORD VAddr, WORD * Value );
|
||||
int r4300i_LW_NonMemory ( DWORD PAddr, DWORD * Value );
|
||||
void r4300i_LW_PAddr ( DWORD PAddr, DWORD * Value );
|
||||
BOOL r4300i_LW_VAddr ( DWORD VAddr, DWORD * Value );
|
||||
int r4300i_SB_NonMemory ( DWORD PAddr, BYTE Value );
|
||||
BOOL r4300i_SB_VAddr ( DWORD VAddr, BYTE Value );
|
||||
BOOL r4300i_SD_VAddr ( DWORD VAddr, unsigned _int64 Value );
|
||||
int r4300i_SH_NonMemory ( DWORD PAddr, WORD Value );
|
||||
BOOL r4300i_SH_VAddr ( DWORD VAddr, WORD Value );
|
||||
int r4300i_SW_NonMemory ( DWORD PAddr, DWORD Value );
|
||||
BOOL r4300i_SW_VAddr ( DWORD VAddr, DWORD Value );
|
||||
|
||||
/* Recompiler Memory Functions */
|
||||
void Compile_LB ( int Reg, DWORD Addr, BOOL SignExtend );
|
||||
void Compile_LH ( int Reg, DWORD Addr, BOOL SignExtend );
|
||||
void Compile_SB_Const ( BYTE Value, DWORD Addr );
|
||||
void Compile_SB_Register ( int x86Reg, DWORD Addr );
|
||||
void Compile_SH_Const ( WORD Value, DWORD Addr );
|
||||
void Compile_SH_Register ( int x86Reg, DWORD Addr );
|
||||
void Compile_SW_Const ( DWORD Value, DWORD Addr );
|
||||
//void ResetRecompCode ( void );
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
void Compile_LW ( CCodeSection * Section, int Reg, DWORD Addr );
|
||||
void Compile_SW_Register ( CCodeSection * Section, int x86Reg, DWORD Addr );
|
||||
void ResetMemoryStack ( CCodeSection * Section );
|
||||
|
||||
#endif
|
||||
#endif
|
|
@ -1,14 +1,11 @@
|
|||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include "main.h"
|
||||
#include "cpu.h"
|
||||
#include "stdafx.h"
|
||||
|
||||
int GetStoredWinPos( char * WinName, DWORD * X, DWORD * Y ) {
|
||||
long lResult;
|
||||
HKEY hKeyResults = 0;
|
||||
char String[200];
|
||||
|
||||
sprintf(String,"Software\\N64 Emulation\\%s\\Page Setup",AppName);
|
||||
sprintf(String,"Software\\N64 Emulation\\%s\\Page Setup",GetAppName());
|
||||
lResult = RegOpenKeyEx( HKEY_CURRENT_USER,String,0, KEY_ALL_ACCESS,&hKeyResults);
|
||||
|
||||
if (lResult == ERROR_SUCCESS) {
|
||||
|
@ -45,7 +42,7 @@ void StoreCurrentWinPos ( char * WinName, HWND hWnd ) {
|
|||
char String[200];
|
||||
|
||||
GetWindowRect(hWnd, &WinRect );
|
||||
sprintf(String,"Software\\N64 Emulation\\%s\\Page Setup",AppName);
|
||||
sprintf(String,"Software\\N64 Emulation\\%s\\Page Setup",GetAppName());
|
||||
lResult = RegCreateKeyEx( HKEY_CURRENT_USER, String,0,"", REG_OPTION_NON_VOLATILE,
|
||||
KEY_ALL_ACCESS,NULL, &hKeyResults,&Disposition);
|
||||
if (lResult == ERROR_SUCCESS) {
|
||||
|
|
|
@ -1,287 +0,0 @@
|
|||
#include "main.h"
|
||||
#include "CPU.h"
|
||||
#include "debugger.h"
|
||||
|
||||
//int NextInstruction, ManualPaused;
|
||||
//int DlistCount, AlistCount;
|
||||
//SYSTEM_TIMERS Timers;
|
||||
//DWORD MemoryStack;
|
||||
DWORD JumpToLocation;
|
||||
|
||||
//R4300iOp_FUNC * R4300i_Opcode;
|
||||
|
||||
void InitializeCPUCore ( void )
|
||||
{
|
||||
LARGE_INTEGER PerformanceFrequency;
|
||||
|
||||
//R4300i_Opcode = R4300iOp::BuildInterpreter();
|
||||
//R4300i_Opcode = R4300iOp32::BuildInterpreter();
|
||||
CurrentFrame = 0;
|
||||
|
||||
QueryPerformanceFrequency(&PerformanceFrequency);
|
||||
Frequency = PerformanceFrequency.QuadPart;
|
||||
|
||||
{
|
||||
switch (_Rom->GetCountry())
|
||||
{
|
||||
case Germany: case french: case Italian:
|
||||
case Europe: case Spanish: case Australia:
|
||||
case X_PAL: case Y_PAL:
|
||||
Timer_Initialize(50);
|
||||
g_SystemType = SYSTEM_PAL;
|
||||
break;
|
||||
default:
|
||||
Timer_Initialize(60);
|
||||
g_SystemType = SYSTEM_NTSC;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#ifndef EXTERNAL_RELEASE
|
||||
LogOptions.GenerateLog = g_GenerateLog;
|
||||
LoadLogOptions(&LogOptions, FALSE);
|
||||
StartLog();
|
||||
#endif
|
||||
|
||||
// switch (CPU_Type) {
|
||||
// case CPU_Interpreter: StartInterpreterCPU(); break;
|
||||
// case CPU_Recompiler: StartRecompilerCPU(); break;
|
||||
// case CPU_SyncCores: StartRecompilerCPU(); break;
|
||||
// default:
|
||||
// DisplayError("Unhandled CPU %d",CPU_Type);
|
||||
// }
|
||||
// if (TargetInfo)
|
||||
// {
|
||||
// VirtualFree(TargetInfo,0,MEM_RELEASE);
|
||||
// TargetInfo = NULL;
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
#ifdef toremove
|
||||
void ChangeCompareTimer(void) {
|
||||
DWORD NextCompare = _Reg->COMPARE_REGISTER - _Reg->COUNT_REGISTER;
|
||||
if ((NextCompare & 0x80000000) != 0) { NextCompare = 0x7FFFFFFF; }
|
||||
if (NextCompare == 0) { NextCompare = 0x1; }
|
||||
_SystemTimer->SetTimer(CSystemTimer::CompareTimer,NextCompare,false);
|
||||
}
|
||||
#endif
|
||||
|
||||
void CheckTimer (void) {
|
||||
BreakPoint(__FILE__,__LINE__);
|
||||
/* int count;
|
||||
|
||||
for (count = 0; count < MaxTimers; count++) {
|
||||
if (!Timers.Active[count]) { continue; }
|
||||
if (!(count == CompareTimer && Timers.NextTimer[count] == 0x7FFFFFFF)) {
|
||||
Timers.NextTimer[count] += Timers.Timer;
|
||||
}
|
||||
}
|
||||
Timers.CurrentTimerType = -1;
|
||||
Timers.Timer = 0x7FFFFFFF;
|
||||
for (count = 0; count < MaxTimers; count++) {
|
||||
if (!Timers.Active[count]) { continue; }
|
||||
if (Timers.NextTimer[count] >= Timers.Timer) { continue; }
|
||||
Timers.Timer = Timers.NextTimer[count];
|
||||
Timers.CurrentTimerType = count;
|
||||
}
|
||||
if (Timers.CurrentTimerType == -1) {
|
||||
DisplayError("No active timers ???\nEmulation Stoped");
|
||||
ExitThread(0);
|
||||
}
|
||||
for (count = 0; count < MaxTimers; count++) {
|
||||
if (!Timers.Active[count]) { continue; }
|
||||
if (!(count == CompareTimer && Timers.NextTimer[count] == 0x7FFFFFFF)) {
|
||||
Timers.NextTimer[count] -= Timers.Timer;
|
||||
}
|
||||
}
|
||||
|
||||
if (Timers.NextTimer[CompareTimer] == 0x7FFFFFFF) {
|
||||
DWORD NextCompare = COMPARE_REGISTER - COUNT_REGISTER;
|
||||
if ((NextCompare & 0x80000000) == 0 && NextCompare != 0x7FFFFFFF) {
|
||||
ChangeCompareTimer();
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
/*void RefreshScreen (void ){
|
||||
static DWORD OLD_VI_V_SYNC_REG = 0, VI_INTR_TIME = 500000;
|
||||
LARGE_INTEGER Time;
|
||||
char Label[100];
|
||||
|
||||
if (Profiling || ShowCPUPer) { memcpy(Label,ProfilingLabel,sizeof(Label)); }
|
||||
if (Profiling) { StartTimer("RefreshScreen"); }
|
||||
|
||||
if (OLD_VI_V_SYNC_REG != VI_V_SYNC_REG) {
|
||||
if (VI_V_SYNC_REG == 0) {
|
||||
VI_INTR_TIME = 500000;
|
||||
} else {
|
||||
VI_INTR_TIME = (VI_V_SYNC_REG + 1) * 1500;
|
||||
if ((VI_V_SYNC_REG % 1) != 0) {
|
||||
VI_INTR_TIME -= 38;
|
||||
}
|
||||
}
|
||||
}
|
||||
ChangeTimerRelative(ViTimer,VI_INTR_TIME);
|
||||
if (g_FixedAudio)
|
||||
{
|
||||
UpdateAudioTimer (VI_INTR_TIME);
|
||||
}
|
||||
|
||||
if ((VI_STATUS_REG & 0x10) != 0) {
|
||||
if (ViFieldNumber == 0) {
|
||||
ViFieldNumber = 1;
|
||||
} else {
|
||||
ViFieldNumber = 0;
|
||||
}
|
||||
} else {
|
||||
ViFieldNumber = 0;
|
||||
}
|
||||
|
||||
if (ShowCPUPer || Profiling) { StartTimer("CPU Idel"); }
|
||||
if (Limit_FPS()) { Timer_Process(NULL); }
|
||||
if (ShowCPUPer || Profiling) { StopTimer(); }
|
||||
if (Profiling) { StartTimer("RefreshScreen: Update FPS"); }
|
||||
if ((CurrentFrame & 7) == 0) {
|
||||
//Disables Screen saver
|
||||
//mouse_event(MOUSEEVENTF_MOVE,1,1,0,GetMessageExtraInfo());
|
||||
//mouse_event(MOUSEEVENTF_MOVE,-1,-1,0,GetMessageExtraInfo());
|
||||
|
||||
QueryPerformanceCounter(&Time);
|
||||
Frames[(CurrentFrame >> 3) % NoOfFrames] = Time.QuadPart - LastFrame;
|
||||
LastFrame = Time.QuadPart;
|
||||
DisplayFPS();
|
||||
}
|
||||
if (Profiling) { StopTimer(); }
|
||||
if (ShowCPUPer) { DisplayCPUPer(); }
|
||||
CurrentFrame += 1;
|
||||
|
||||
if (Profiling) { StartTimer("RefreshScreen: Update Screen"); }
|
||||
__try {
|
||||
if (UpdateScreen != NULL)
|
||||
{
|
||||
UpdateScreen();
|
||||
}
|
||||
} __except( r4300i_CPU_MemoryFilter( GetExceptionCode(), GetExceptionInformation()) ) {
|
||||
DisplayError("Unknown memory action in trying to update the screen\n\nEmulation stop");
|
||||
ExitThread(0);
|
||||
}
|
||||
if (Profiling) { StartTimer("RefreshScreen: Cheats"); }
|
||||
if ((STATUS_REGISTER & STATUS_IE) != 0 ) { ApplyCheats(); }
|
||||
if (Profiling || ShowCPUPer) { StartTimer(Label); }
|
||||
}
|
||||
|
||||
void RunRsp (void) {
|
||||
if ( ( SP_STATUS_REG & SP_STATUS_HALT ) == 0) {
|
||||
if ( ( SP_STATUS_REG & SP_STATUS_BROKE ) == 0 ) {
|
||||
DWORD Task = *( DWORD *)(DMEM + 0xFC0);
|
||||
|
||||
if (Task == 1 && (DPC_STATUS_REG & DPC_STATUS_FREEZE) != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch (Task) {
|
||||
case 1:
|
||||
DlistCount += 1;
|
||||
/*if ((DlistCount % 2) == 0) {
|
||||
SP_STATUS_REG |= (0x0203 );
|
||||
MI_INTR_REG |= MI_INTR_SP | MI_INTR_DP;
|
||||
CheckInterrupts();
|
||||
return;
|
||||
}*/
|
||||
/* break;
|
||||
case 2:
|
||||
AlistCount += 1;
|
||||
break;
|
||||
}
|
||||
|
||||
if (ShowDListAListCount) {
|
||||
DisplayMessage("Dlist: %d Alist: %d",DlistCount,AlistCount);
|
||||
}
|
||||
if (Profiling || DisplayCPUPer) {
|
||||
char Label[100];
|
||||
|
||||
strncpy(Label,ProfilingLabel,sizeof(Label));
|
||||
|
||||
if (IndvidualBlock && !DisplayCPUPer) {
|
||||
StartTimer("RSP");
|
||||
} else {
|
||||
switch (*( DWORD *)(DMEM + 0xFC0)) {
|
||||
case 1: StartTimer("RSP: Dlist"); break;
|
||||
case 2: StartTimer("RSP: Alist"); break;
|
||||
default: StartTimer("RSP: Unknown"); break;
|
||||
}
|
||||
}
|
||||
DoRspCycles(100);
|
||||
StartTimer(Label);
|
||||
} else {
|
||||
DoRspCycles(100);
|
||||
}
|
||||
#ifdef CFB_READ
|
||||
if (VI_ORIGIN_REG > 0x280) {
|
||||
SetFrameBuffer(VI_ORIGIN_REG, (DWORD)(VI_WIDTH_REG * (VI_WIDTH_REG *.75)));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
void DisplayFPS (void) {
|
||||
if (CurrentFrame > (NoOfFrames << 3)) {
|
||||
__int64 Total = 0;
|
||||
int count;
|
||||
|
||||
for (count = 0; count < NoOfFrames; count ++) {
|
||||
Total += Frames[count];
|
||||
}
|
||||
DisplayMessage2("FPS: %.2f", (__int64)Frequency/ ((double)Total / (NoOfFrames << 3)));
|
||||
} else {
|
||||
DisplayMessage2("FPS: -.--" );
|
||||
}
|
||||
}
|
||||
|
||||
void CloseCpu (void) {
|
||||
// DWORD ExitCode, count, OldProtect;
|
||||
//
|
||||
// if (!CPURunning) { return; }
|
||||
// ManualPaused = FALSE;
|
||||
// if (CPU_Paused) { PauseCpu (); Sleep(1000); }
|
||||
//
|
||||
// {
|
||||
// BOOL Temp = AlwaysOnTop;
|
||||
// AlwaysOnTop = FALSE;
|
||||
// AlwaysOnTopWindow(hMainWindow);
|
||||
// AlwaysOnTop = Temp;
|
||||
// }
|
||||
//
|
||||
// for (count = 0; count < 20; count ++ ) {
|
||||
// CPU_Action.CloseCPU = TRUE;
|
||||
// CPU_Action.Stepping = FALSE;
|
||||
// CPU_Action.DoSomething = TRUE;
|
||||
// PulseEvent( CPU_Action.hStepping );
|
||||
// Sleep(100);
|
||||
// GetExitCodeThread(hCPU,&ExitCode);
|
||||
// if (ExitCode != STILL_ACTIVE) {
|
||||
// hCPU = NULL;
|
||||
// count = 100;
|
||||
// }
|
||||
// }
|
||||
// if (hCPU != NULL) { TerminateThread(hCPU,0); hCPU = NULL; }
|
||||
// CPURunning = FALSE;
|
||||
// VirtualProtect(N64MEM,RdramSize,PAGE_READWRITE,&OldProtect);
|
||||
// VirtualProtect(N64MEM + 0x04000000,0x2000,PAGE_READWRITE,&OldProtect);
|
||||
// Timer_Stop();
|
||||
// SetCurrentSaveState(hMainWindow,ID_CURRENTSAVE_DEFAULT);
|
||||
// CloseEeprom();
|
||||
// CloseMempak();
|
||||
// CloseSram();
|
||||
// FreeSyncMemory();
|
||||
// if (GfxRomClosed != NULL) { GfxRomClosed(); }
|
||||
// if (AiRomClosed != NULL) { AiRomClosed(); }
|
||||
// if (ContRomClosed != NULL) { ContRomClosed(); }
|
||||
// if (RSPRomClosed) { RSPRomClosed(); }
|
||||
// if (Profiling) { GenerateTimerResults(); }
|
||||
// CloseHandle(CPU_Action.hStepping);
|
||||
// SendMessage( hStatusWnd, SB_SETTEXT, 0, (LPARAM)GS(MSG_EMULATION_ENDED) );
|
||||
}
|
||||
|
|
@ -50,9 +50,9 @@ extern SYSTEM_TIMERS Timers;*/
|
|||
void ChangeCompareTimer ( void );
|
||||
void CheckTimer ( void );
|
||||
void TimerDone ( void );
|
||||
void DoSomething ( void );
|
||||
*/
|
||||
|
||||
void DoSomething ( void );
|
||||
int DelaySlotEffectsCompare ( DWORD PC, DWORD Reg1, DWORD Reg2 );
|
||||
int DelaySlotEffectsJump (DWORD JumpPC);
|
||||
void InPermLoop ( void );
|
||||
|
|
|
@ -1,61 +1,34 @@
|
|||
/*
|
||||
* Project 64 - A Nintendo 64 emulator.
|
||||
*
|
||||
* (c) Copyright 2001 zilmar (zilmar@emulation64.com) and
|
||||
* Jabo (jabo@emulation64.com).
|
||||
*
|
||||
* pj64 homepage: www.pj64.net
|
||||
*
|
||||
* Permission to use, copy, modify and distribute Project64 in both binary and
|
||||
* source form, for non-commercial purposes, is hereby granted without fee,
|
||||
* providing that this license information and copyright notice appear with
|
||||
* all copies and any derived work.
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event shall the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Project64 is freeware for PERSONAL USE only. Commercial users should
|
||||
* seek permission of the copyright holders first. Commercial use includes
|
||||
* charging money for Project64 or software derived from Project64.
|
||||
*
|
||||
* The copyright holders request that bug fixes and improvements to the code
|
||||
* should be forwarded to them so if they want them.
|
||||
*
|
||||
*/
|
||||
#include <Windows.h>
|
||||
#include <stdio.h>
|
||||
#include "main.h"
|
||||
#include "debugger.h"
|
||||
#include "CPU.h"
|
||||
#include "stdafx.h"
|
||||
#include "Sram.h"
|
||||
#include "Flashram.h"
|
||||
|
||||
void OnFirstDMA (void) {
|
||||
switch (CicChip) {
|
||||
switch (g_CicChip) {
|
||||
case 1: *(DWORD *)&((_MMU->Rdram())[0x318]) = g_RdramSize; break;
|
||||
case 2: *(DWORD *)&((_MMU->Rdram())[0x318]) = g_RdramSize; break;
|
||||
case 3: *(DWORD *)&((_MMU->Rdram())[0x318]) = g_RdramSize; break;
|
||||
case 5: *(DWORD *)&((_MMU->Rdram())[0x3F0]) = g_RdramSize; break;
|
||||
case 6: *(DWORD *)&((_MMU->Rdram())[0x318]) = g_RdramSize; break;
|
||||
default: DisplayError("Unhandled CicChip(%d) in first DMA",CicChip);
|
||||
default: DisplayError("Unhandled g_CicChip(%d) in first DMA",g_CicChip);
|
||||
}
|
||||
}
|
||||
|
||||
void PI_DMA_READ (void) {
|
||||
// PI_STATUS_REG |= PI_STATUS_DMA_BUSY;
|
||||
|
||||
if ( _Reg->PI_DRAM_ADDR_REG + _Reg->PI_RD_LEN_REG + 1 > RdramSize) {
|
||||
if ( _Reg->PI_DRAM_ADDR_REG + _Reg->PI_RD_LEN_REG + 1 > g_RdramSize) {
|
||||
#ifndef EXTERNAL_RELEASE
|
||||
DisplayError("PI_DMA_READ not in Memory");
|
||||
#endif
|
||||
_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
||||
_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||
CheckInterrupts();
|
||||
_Reg->CheckInterrupts();
|
||||
return;
|
||||
}
|
||||
|
||||
if ( _Reg->PI_CART_ADDR_REG >= 0x08000000 && _Reg->PI_CART_ADDR_REG <= 0x08010000) {
|
||||
if (SaveUsing == SaveChip_Auto) { SaveUsing = SaveChip_Sram; }
|
||||
if (SaveUsing == SaveChip_Sram) {
|
||||
if (g_SaveUsing == SaveChip_Auto) { g_SaveUsing = SaveChip_Sram; }
|
||||
if (g_SaveUsing == SaveChip_Sram) {
|
||||
DmaToSram(
|
||||
_MMU->Rdram() + _Reg->PI_DRAM_ADDR_REG,
|
||||
_Reg->PI_CART_ADDR_REG - 0x08000000,
|
||||
|
@ -63,10 +36,10 @@ void PI_DMA_READ (void) {
|
|||
);
|
||||
_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
||||
_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||
CheckInterrupts();
|
||||
_Reg->CheckInterrupts();
|
||||
return;
|
||||
}
|
||||
if (SaveUsing == SaveChip_FlashRam) {
|
||||
if (g_SaveUsing == SaveChip_FlashRam) {
|
||||
DmaToFlashram(
|
||||
_MMU->Rdram()+_Reg->PI_DRAM_ADDR_REG,
|
||||
_Reg->PI_CART_ADDR_REG - 0x08000000,
|
||||
|
@ -74,17 +47,17 @@ void PI_DMA_READ (void) {
|
|||
);
|
||||
_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
||||
_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||
CheckInterrupts();
|
||||
_Reg->CheckInterrupts();
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (SaveUsing == SaveChip_FlashRam) {
|
||||
if (g_SaveUsing == SaveChip_FlashRam) {
|
||||
#ifndef EXTERNAL_RELEASE
|
||||
DisplayError("**** FLashRam DMA Read address %X *****",_Reg->PI_CART_ADDR_REG);
|
||||
#endif
|
||||
_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
||||
_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||
CheckInterrupts();
|
||||
_Reg->CheckInterrupts();
|
||||
return;
|
||||
}
|
||||
#ifndef EXTERNAL_RELEASE
|
||||
|
@ -92,25 +65,25 @@ void PI_DMA_READ (void) {
|
|||
#endif
|
||||
_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
||||
_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||
CheckInterrupts();
|
||||
_Reg->CheckInterrupts();
|
||||
return;
|
||||
}
|
||||
|
||||
void PI_DMA_WRITE (void) {
|
||||
|
||||
_Reg->PI_STATUS_REG |= PI_STATUS_DMA_BUSY;
|
||||
if ( _Reg->PI_DRAM_ADDR_REG + _Reg->PI_WR_LEN_REG + 1 > RdramSize)
|
||||
if ( _Reg->PI_DRAM_ADDR_REG + _Reg->PI_WR_LEN_REG + 1 > g_RdramSize)
|
||||
{
|
||||
if (ShowUnhandledMemory) { DisplayError("PI_DMA_WRITE not in Memory"); }
|
||||
if (g_ShowUnhandledMemory) { DisplayError("PI_DMA_WRITE not in Memory"); }
|
||||
_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
||||
_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||
CheckInterrupts();
|
||||
_Reg->CheckInterrupts();
|
||||
return;
|
||||
}
|
||||
|
||||
if ( _Reg->PI_CART_ADDR_REG >= 0x08000000 && _Reg->PI_CART_ADDR_REG <= 0x08010000) {
|
||||
if (SaveUsing == SaveChip_Auto) { SaveUsing = SaveChip_Sram; }
|
||||
if (SaveUsing == SaveChip_Sram) {
|
||||
if (g_SaveUsing == SaveChip_Auto) { g_SaveUsing = SaveChip_Sram; }
|
||||
if (g_SaveUsing == SaveChip_Sram) {
|
||||
DmaFromSram(
|
||||
_MMU->Rdram()+_Reg->PI_DRAM_ADDR_REG,
|
||||
_Reg->PI_CART_ADDR_REG - 0x08000000,
|
||||
|
@ -118,10 +91,10 @@ void PI_DMA_WRITE (void) {
|
|||
);
|
||||
_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
||||
_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||
CheckInterrupts();
|
||||
_Reg->CheckInterrupts();
|
||||
return;
|
||||
}
|
||||
if (SaveUsing == SaveChip_FlashRam) {
|
||||
if (g_SaveUsing == SaveChip_FlashRam) {
|
||||
DmaFromFlashram(
|
||||
_MMU->Rdram()+_Reg->PI_DRAM_ADDR_REG,
|
||||
_Reg->PI_CART_ADDR_REG - 0x08000000,
|
||||
|
@ -129,7 +102,7 @@ void PI_DMA_WRITE (void) {
|
|||
);
|
||||
_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
||||
_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||
CheckInterrupts();
|
||||
_Reg->CheckInterrupts();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -140,20 +113,20 @@ void PI_DMA_WRITE (void) {
|
|||
#ifdef ROM_IN_MAPSPACE
|
||||
if (WrittenToRom) {
|
||||
DWORD OldProtect;
|
||||
VirtualProtect(ROM,RomFileSize,PAGE_READONLY, &OldProtect);
|
||||
VirtualProtect(ROM,g_RomFileSize,PAGE_READONLY, &OldProtect);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
BYTE * ROM = _Rom->GetRomAddress();
|
||||
BYTE * RDRAM = _MMU->Rdram();
|
||||
_Reg->PI_CART_ADDR_REG -= 0x10000000;
|
||||
if (_Reg->PI_CART_ADDR_REG + _Reg->PI_WR_LEN_REG + 1 < RomFileSize) {
|
||||
if (_Reg->PI_CART_ADDR_REG + _Reg->PI_WR_LEN_REG + 1 < g_RomFileSize) {
|
||||
for (i = 0; i < _Reg->PI_WR_LEN_REG + 1; i ++) {
|
||||
*(RDRAM+((_Reg->PI_DRAM_ADDR_REG + i) ^ 3)) = *(ROM+((_Reg->PI_CART_ADDR_REG + i) ^ 3));
|
||||
}
|
||||
} else {
|
||||
DWORD Len;
|
||||
Len = RomFileSize - _Reg->PI_CART_ADDR_REG;
|
||||
Len = g_RomFileSize - _Reg->PI_CART_ADDR_REG;
|
||||
for (i = 0; i < Len; i ++) {
|
||||
*(RDRAM+((_Reg->PI_DRAM_ADDR_REG + i) ^ 3)) = *(ROM+((_Reg->PI_CART_ADDR_REG + i) ^ 3));
|
||||
}
|
||||
|
@ -163,29 +136,27 @@ void PI_DMA_WRITE (void) {
|
|||
}
|
||||
_Reg->PI_CART_ADDR_REG += 0x10000000;
|
||||
|
||||
if (!CPU_Action.DMAUsed) {
|
||||
CPU_Action.DMAUsed = TRUE;
|
||||
if (!_N64System->DmaUsed())
|
||||
{
|
||||
_N64System->SetDmaUsed(true);
|
||||
OnFirstDMA();
|
||||
}
|
||||
if (_Recompiler && _Recompiler->bSMM_PIDMA())
|
||||
{
|
||||
_Notify->BreakPoint(__FILE__,__LINE__);
|
||||
#ifdef tofix
|
||||
_Recompiler->ClearRecompCode_Phys(_Reg->PI_DRAM_ADDR_REG, _Reg->PI_WR_LEN_REG,CRecompiler::Remove_DMA);
|
||||
#endif
|
||||
}
|
||||
_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
||||
_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||
CheckInterrupts();
|
||||
_Reg->CheckInterrupts();
|
||||
//ChangeTimer(PiTimer,(int)(PI_WR_LEN_REG * 8.9) + 50);
|
||||
//ChangeTimer(PiTimer,(int)(PI_WR_LEN_REG * 8.9));
|
||||
return;
|
||||
}
|
||||
|
||||
if (ShowUnhandledMemory) { DisplayError("PI_DMA_WRITE not in ROM"); }
|
||||
if (g_ShowUnhandledMemory) { DisplayError("PI_DMA_WRITE not in ROM"); }
|
||||
_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
||||
_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||
CheckInterrupts();
|
||||
_Reg->CheckInterrupts();
|
||||
|
||||
}
|
||||
|
||||
|
@ -194,7 +165,8 @@ void SI_DMA_READ (void) {
|
|||
BYTE * PifRamPos = _MMU->PifRam();
|
||||
BYTE * RDRAM = _MMU->Rdram();
|
||||
|
||||
if ((int)_Reg->SI_DRAM_ADDR_REG > (int)RdramSize) {
|
||||
DWORD & SI_DRAM_ADDR_REG = _Reg->SI_DRAM_ADDR_REG;
|
||||
if ((int)SI_DRAM_ADDR_REG > (int)g_RdramSize) {
|
||||
#ifndef EXTERNAL_RELEASE
|
||||
DisplayError("SI DMA\nSI_DRAM_ADDR_REG not in RDRam space");
|
||||
#endif
|
||||
|
@ -202,18 +174,18 @@ void SI_DMA_READ (void) {
|
|||
}
|
||||
|
||||
PifRamRead();
|
||||
_Reg->SI_DRAM_ADDR_REG &= 0xFFFFFFF8;
|
||||
if ((int)_Reg->SI_DRAM_ADDR_REG < 0) {
|
||||
SI_DRAM_ADDR_REG &= 0xFFFFFFF8;
|
||||
if ((int)SI_DRAM_ADDR_REG < 0) {
|
||||
int count, RdramPos;
|
||||
|
||||
RdramPos = (int)_Reg->SI_DRAM_ADDR_REG;
|
||||
RdramPos = (int)SI_DRAM_ADDR_REG;
|
||||
for (count = 0; count < 0x40; count++, RdramPos++) {
|
||||
if (RdramPos < 0) { continue; }
|
||||
RDRAM[RdramPos ^3] = PIF_Ram[count];
|
||||
}
|
||||
} else {
|
||||
_asm {
|
||||
mov edi, dword ptr [_RegSI]
|
||||
mov edi, dword ptr [SI_DRAM_ADDR_REG]
|
||||
mov edi, dword ptr [edi]
|
||||
add edi, RDRAM
|
||||
mov ecx, PifRamPos
|
||||
|
@ -270,12 +242,12 @@ void SI_DMA_READ (void) {
|
|||
}
|
||||
#endif
|
||||
|
||||
if (DelaySI) {
|
||||
if (g_DelaySI) {
|
||||
_SystemTimer->SetTimer(CSystemTimer::SiTimer,0x900,false);
|
||||
} else {
|
||||
_Reg->MI_INTR_REG |= MI_INTR_SI;
|
||||
_Reg->SI_STATUS_REG |= SI_STATUS_INTERRUPT;
|
||||
CheckInterrupts();
|
||||
_Reg->CheckInterrupts();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -283,27 +255,28 @@ void SI_DMA_WRITE (void) {
|
|||
BYTE * PIF_Ram = _MMU->PifRam();
|
||||
BYTE * PifRamPos = PIF_Ram;
|
||||
|
||||
if ((int)_Reg->SI_DRAM_ADDR_REG > (int)RdramSize) {
|
||||
DWORD & SI_DRAM_ADDR_REG = _Reg->SI_DRAM_ADDR_REG;
|
||||
if ((int)SI_DRAM_ADDR_REG > (int)g_RdramSize) {
|
||||
#ifndef EXTERNAL_RELEASE
|
||||
DisplayError("SI DMA\nSI_DRAM_ADDR_REG not in RDRam space");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
_Reg->SI_DRAM_ADDR_REG &= 0xFFFFFFF8;
|
||||
SI_DRAM_ADDR_REG &= 0xFFFFFFF8;
|
||||
BYTE * RDRAM = _MMU->Rdram();
|
||||
|
||||
if ((int)_Reg->SI_DRAM_ADDR_REG < 0) {
|
||||
if ((int)SI_DRAM_ADDR_REG < 0) {
|
||||
int count, RdramPos;
|
||||
|
||||
RdramPos = (int)_Reg->SI_DRAM_ADDR_REG;
|
||||
RdramPos = (int)SI_DRAM_ADDR_REG;
|
||||
for (count = 0; count < 0x40; count++, RdramPos++) {
|
||||
if (RdramPos < 0) { PIF_Ram[count] = 0; continue; }
|
||||
PIF_Ram[count] = RDRAM[RdramPos ^3];
|
||||
}
|
||||
} else {
|
||||
_asm {
|
||||
mov ecx, dword ptr [_RegSI]
|
||||
mov ecx, dword ptr [SI_DRAM_ADDR_REG]
|
||||
mov ecx, dword ptr [ecx]
|
||||
add ecx, RDRAM
|
||||
mov edi, PifRamPos
|
||||
|
@ -363,19 +336,19 @@ void SI_DMA_WRITE (void) {
|
|||
|
||||
PifRamWrite();
|
||||
|
||||
if (DelaySI) {
|
||||
if (g_DelaySI) {
|
||||
_SystemTimer->SetTimer(CSystemTimer::SiTimer,0x900,false);
|
||||
} else {
|
||||
_Reg->MI_INTR_REG |= MI_INTR_SI;
|
||||
_Reg->SI_STATUS_REG |= SI_STATUS_INTERRUPT;
|
||||
CheckInterrupts();
|
||||
_Reg->CheckInterrupts();
|
||||
}
|
||||
}
|
||||
|
||||
void SP_DMA_READ (void) {
|
||||
_Reg->SP_DRAM_ADDR_REG &= 0x1FFFFFFF;
|
||||
|
||||
if (_Reg->SP_DRAM_ADDR_REG > RdramSize) {
|
||||
if (_Reg->SP_DRAM_ADDR_REG > g_RdramSize) {
|
||||
#ifndef EXTERNAL_RELEASE
|
||||
DisplayError("SP DMA\nSP_DRAM_ADDR_REG not in RDRam space");
|
||||
#endif
|
||||
|
@ -403,7 +376,7 @@ void SP_DMA_READ (void) {
|
|||
}
|
||||
|
||||
void SP_DMA_WRITE (void) {
|
||||
if (_Reg->SP_DRAM_ADDR_REG > RdramSize) {
|
||||
if (_Reg->SP_DRAM_ADDR_REG > g_RdramSize) {
|
||||
#ifndef EXTERNAL_RELEASE
|
||||
DisplayError("SP DMA WRITE\nSP_DRAM_ADDR_REG not in RDRam space");
|
||||
#endif
|
||||
|
@ -427,3 +400,4 @@ void SP_DMA_WRITE (void) {
|
|||
_Reg->SP_DMA_BUSY_REG = 0;
|
||||
_Reg->SP_STATUS_REG &= ~SP_STATUS_DMA_BUSY;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,10 +23,6 @@
|
|||
* should be forwarded to them so if they want them.
|
||||
*
|
||||
*/
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void PI_DMA_READ ( void );
|
||||
void PI_DMA_WRITE ( void );
|
||||
void SI_DMA_READ ( void );
|
||||
|
@ -34,8 +30,4 @@ void SI_DMA_WRITE ( void );
|
|||
void SP_DMA_READ ( void );
|
||||
void SP_DMA_WRITE ( void );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -1,33 +1,5 @@
|
|||
/*
|
||||
* Project 64 - A Nintendo 64 emulator.
|
||||
*
|
||||
* (c) Copyright 2001 zilmar (zilmar@emulation64.com) and
|
||||
* Jabo (jabo@emulation64.com).
|
||||
*
|
||||
* pj64 homepage: www.pj64.net
|
||||
*
|
||||
* Permission to use, copy, modify and distribute Project64 in both binary and
|
||||
* source form, for non-commercial purposes, is hereby granted without fee,
|
||||
* providing that this license information and copyright notice appear with
|
||||
* all copies and any derived work.
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event shall the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Project64 is freeware for PERSONAL USE only. Commercial users should
|
||||
* seek permission of the copyright holders first. Commercial use includes
|
||||
* charging money for Project64 or software derived from Project64.
|
||||
*
|
||||
* The copyright holders request that bug fixes and improvements to the code
|
||||
* should be forwarded to them so if they want them.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include "main.h"
|
||||
#include "CPU.h"
|
||||
#include "stdafx.h"
|
||||
#include "Eeprom.h"
|
||||
|
||||
static HANDLE hEepromFile = NULL;
|
||||
BYTE EEPROM[0x800];
|
||||
|
@ -40,18 +12,18 @@ void CloseEeprom (void) {
|
|||
}
|
||||
|
||||
void EepromCommand ( BYTE * Command) {
|
||||
if (SaveUsing == SaveChip_Auto) { SaveUsing = SaveChip_Eeprom_4K; }
|
||||
if (g_SaveUsing == SaveChip_Auto) { g_SaveUsing = SaveChip_Eeprom_4K; }
|
||||
|
||||
switch (Command[2]) {
|
||||
case 0: // check
|
||||
if (SaveUsing != SaveChip_Eeprom_4K && SaveUsing != SaveChip_Eeprom_16K) {
|
||||
if (g_SaveUsing != SaveChip_Eeprom_4K && g_SaveUsing != SaveChip_Eeprom_16K) {
|
||||
Command[1] |= 0x80;
|
||||
break;
|
||||
}
|
||||
if (Command[1] != 3) {
|
||||
Command[1] |= 0x40;
|
||||
if ((Command[1] & 3) > 0) { Command[3] = 0x00; }
|
||||
if (SaveUsing == SaveChip_Eeprom_4K) {
|
||||
if (g_SaveUsing == SaveChip_Eeprom_4K) {
|
||||
if ((Command[1] & 3) > 1) { Command[4] = 0x80; }
|
||||
} else {
|
||||
if ((Command[1] & 3) > 1) { Command[4] = 0xC0; }
|
||||
|
@ -59,7 +31,7 @@ void EepromCommand ( BYTE * Command) {
|
|||
if ((Command[1] & 3) > 2) { Command[5] = 0x00; }
|
||||
} else {
|
||||
Command[3] = 0x00;
|
||||
Command[4] = SaveUsing == SaveChip_Eeprom_4K?0x80:0xC0;
|
||||
Command[4] = g_SaveUsing == SaveChip_Eeprom_4K?0x80:0xC0;
|
||||
Command[5] = 0x00;
|
||||
}
|
||||
break;
|
||||
|
@ -78,7 +50,7 @@ void EepromCommand ( BYTE * Command) {
|
|||
WriteToEeprom(&Command[4],Command[3]);
|
||||
break;
|
||||
default:
|
||||
if (ShowPifRamErrors) { DisplayError("Unkown EepromCommand %d",Command[2]); }
|
||||
if (g_ShowPifRamErrors) { DisplayError("Unkown EepromCommand %d",Command[2]); }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -88,7 +60,7 @@ void LoadEeprom (void) {
|
|||
DWORD dwRead;
|
||||
|
||||
GetAutoSaveDir(Directory);
|
||||
sprintf(File,"%s%s.eep",Directory,RomName);
|
||||
sprintf(File,"%s%s.eep",Directory,g_RomName);
|
||||
|
||||
hEepromFile = CreateFile(File,GENERIC_WRITE | GENERIC_READ, FILE_SHARE_READ,NULL,OPEN_ALWAYS,
|
||||
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS, NULL);
|
||||
|
|
|
@ -27,176 +27,4 @@
|
|||
#include "main.h"
|
||||
#include "cpu.h"
|
||||
#include "plugin.h"
|
||||
#include "debugger.h"
|
||||
|
||||
void __cdecl AiCheckInterrupts ( void ) {
|
||||
CPU_Action.CheckInterrupts = TRUE;
|
||||
CPU_Action.DoSomething = TRUE;
|
||||
}
|
||||
|
||||
void __cdecl CheckInterrupts ( void )
|
||||
{
|
||||
if (!g_FixedAudio && CPU_Type != CPU_SyncCores) {
|
||||
_Reg->MI_INTR_REG &= ~MI_INTR_AI;
|
||||
_Reg->MI_INTR_REG |= (_Reg->m_AudioIntrReg & MI_INTR_AI);
|
||||
}
|
||||
if ((_Reg->MI_INTR_MASK_REG & _Reg->MI_INTR_REG) != 0) {
|
||||
_Reg->FAKE_CAUSE_REGISTER |= CAUSE_IP2;
|
||||
} else {
|
||||
_Reg->FAKE_CAUSE_REGISTER &= ~CAUSE_IP2;
|
||||
}
|
||||
|
||||
if (( _Reg->STATUS_REGISTER & STATUS_IE ) == 0 ) { return; }
|
||||
if (( _Reg->STATUS_REGISTER & STATUS_EXL ) != 0 ) { return; }
|
||||
if (( _Reg->STATUS_REGISTER & STATUS_ERL ) != 0 ) { return; }
|
||||
|
||||
if (( _Reg->STATUS_REGISTER & _Reg->FAKE_CAUSE_REGISTER & 0xFF00) != 0) {
|
||||
if (!CPU_Action.DoInterrupt) {
|
||||
CPU_Action.DoSomething = TRUE;
|
||||
CPU_Action.DoInterrupt = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DoAddressError ( BOOL DelaySlot, DWORD BadVaddr, BOOL FromRead) {
|
||||
#ifndef EXTERNAL_RELEASE
|
||||
DisplayError("AddressError");
|
||||
if (( _Reg->STATUS_REGISTER & STATUS_EXL ) != 0 ) {
|
||||
DisplayError("EXL set in AddressError Exception");
|
||||
}
|
||||
if (( _Reg->STATUS_REGISTER & STATUS_ERL ) != 0 ) {
|
||||
DisplayError("ERL set in AddressError Exception");
|
||||
}
|
||||
#endif
|
||||
if (FromRead) {
|
||||
_Reg->CAUSE_REGISTER = EXC_RADE;
|
||||
} else {
|
||||
_Reg->CAUSE_REGISTER = EXC_WADE;
|
||||
}
|
||||
_Reg->BAD_VADDR_REGISTER = BadVaddr;
|
||||
if (DelaySlot) {
|
||||
_Reg->CAUSE_REGISTER |= CAUSE_BD;
|
||||
_Reg->EPC_REGISTER = (*_PROGRAM_COUNTER) - 4;
|
||||
} else {
|
||||
_Reg->EPC_REGISTER = (*_PROGRAM_COUNTER);
|
||||
}
|
||||
_Reg->STATUS_REGISTER |= STATUS_EXL;
|
||||
(*_PROGRAM_COUNTER) = 0x80000180;
|
||||
}
|
||||
|
||||
void DoBreakException ( BOOL DelaySlot) {
|
||||
#ifndef EXTERNAL_RELEASE
|
||||
if (( _Reg->STATUS_REGISTER & STATUS_EXL ) != 0 ) {
|
||||
DisplayError("EXL set in Break Exception");
|
||||
}
|
||||
if (( _Reg->STATUS_REGISTER & STATUS_ERL ) != 0 ) {
|
||||
DisplayError("ERL set in Break Exception");
|
||||
}
|
||||
#endif
|
||||
|
||||
_Reg->CAUSE_REGISTER = EXC_BREAK;
|
||||
if (DelaySlot) {
|
||||
_Reg->CAUSE_REGISTER |= CAUSE_BD;
|
||||
_Reg->EPC_REGISTER = (*_PROGRAM_COUNTER) - 4;
|
||||
} else {
|
||||
_Reg->EPC_REGISTER = (*_PROGRAM_COUNTER);
|
||||
}
|
||||
_Reg->STATUS_REGISTER |= STATUS_EXL;
|
||||
(*_PROGRAM_COUNTER) = 0x80000180;
|
||||
}
|
||||
|
||||
void _fastcall DoCopUnusableException ( BOOL DelaySlot, int Coprocessor ) {
|
||||
#ifndef EXTERNAL_RELEASE
|
||||
if (( _Reg->STATUS_REGISTER & STATUS_EXL ) != 0 ) {
|
||||
DisplayError("EXL set in Break Exception");
|
||||
}
|
||||
if (( _Reg->STATUS_REGISTER & STATUS_ERL ) != 0 ) {
|
||||
DisplayError("ERL set in Break Exception");
|
||||
}
|
||||
#endif
|
||||
|
||||
_Reg->CAUSE_REGISTER = EXC_CPU;
|
||||
if (Coprocessor == 1) { _Reg->CAUSE_REGISTER |= 0x10000000; }
|
||||
if (DelaySlot) {
|
||||
_Reg->CAUSE_REGISTER |= CAUSE_BD;
|
||||
_Reg->EPC_REGISTER = (*_PROGRAM_COUNTER) - 4;
|
||||
} else {
|
||||
_Reg->EPC_REGISTER = (*_PROGRAM_COUNTER);
|
||||
}
|
||||
_Reg->STATUS_REGISTER |= STATUS_EXL;
|
||||
(*_PROGRAM_COUNTER) = 0x80000180;
|
||||
}
|
||||
|
||||
BOOL DoIntrException ( BOOL DelaySlot ) {
|
||||
if (( _Reg->STATUS_REGISTER & STATUS_IE ) == 0 ) { return FALSE; }
|
||||
if (( _Reg->STATUS_REGISTER & STATUS_EXL ) != 0 ) { return FALSE; }
|
||||
if (( _Reg->STATUS_REGISTER & STATUS_ERL ) != 0 ) { return FALSE; }
|
||||
#if (!defined(EXTERNAL_RELEASE))
|
||||
if (LogOptions.GenerateLog && LogOptions.LogExceptions && !LogOptions.NoInterrupts) {
|
||||
LogMessage("%08X: Interupt Generated", (*_PROGRAM_COUNTER) );
|
||||
}
|
||||
#endif
|
||||
_Reg->CAUSE_REGISTER = _Reg->FAKE_CAUSE_REGISTER;
|
||||
_Reg->CAUSE_REGISTER |= EXC_INT;
|
||||
if (DelaySlot) {
|
||||
_Reg->CAUSE_REGISTER |= CAUSE_BD;
|
||||
_Reg->EPC_REGISTER = (*_PROGRAM_COUNTER) - 4;
|
||||
} else {
|
||||
_Reg->EPC_REGISTER = (*_PROGRAM_COUNTER);
|
||||
}
|
||||
_Reg->STATUS_REGISTER |= STATUS_EXL;
|
||||
(*_PROGRAM_COUNTER) = 0x80000180;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void _fastcall DoTLBMiss ( BOOL DelaySlot, DWORD BadVaddr ) {
|
||||
_Reg->CAUSE_REGISTER = EXC_RMISS;
|
||||
_Reg->BAD_VADDR_REGISTER = BadVaddr;
|
||||
_Reg->CONTEXT_REGISTER &= 0xFF80000F;
|
||||
_Reg->CONTEXT_REGISTER |= (BadVaddr >> 9) & 0x007FFFF0;
|
||||
_Reg->ENTRYHI_REGISTER = (BadVaddr & 0xFFFFE000);
|
||||
if ((_Reg->STATUS_REGISTER & STATUS_EXL) == 0) {
|
||||
if (DelaySlot) {
|
||||
_Reg->CAUSE_REGISTER |= CAUSE_BD;
|
||||
_Reg->EPC_REGISTER = (*_PROGRAM_COUNTER) - 4;
|
||||
} else {
|
||||
_Reg->EPC_REGISTER = (*_PROGRAM_COUNTER);
|
||||
}
|
||||
if (_TLB->AddressDefined(BadVaddr))
|
||||
{
|
||||
(*_PROGRAM_COUNTER) = 0x80000180;
|
||||
} else {
|
||||
(*_PROGRAM_COUNTER) = 0x80000000;
|
||||
}
|
||||
_Reg->STATUS_REGISTER |= STATUS_EXL;
|
||||
} else {
|
||||
_Notify->BreakPoint(__FILE__,__LINE__);
|
||||
#ifdef tofix
|
||||
#ifndef EXTERNAL_RELEASE
|
||||
DisplayError("TLBMiss - EXL Set\nBadVaddr = %X\nAddress Defined: %s",BadVaddr,_TLB->TLB_AddressDefined(BadVaddr)?"TRUE":"FALSE");
|
||||
#endif
|
||||
#endif
|
||||
(*_PROGRAM_COUNTER) = 0x80000180;
|
||||
}
|
||||
}
|
||||
|
||||
void _fastcall DoSysCallException ( BOOL DelaySlot) {
|
||||
#ifndef EXTERNAL_RELEASE
|
||||
if (( _Reg->STATUS_REGISTER & STATUS_EXL ) != 0 ) {
|
||||
DisplayError("EXL set in SysCall Exception");
|
||||
}
|
||||
if (( _Reg->STATUS_REGISTER & STATUS_ERL ) != 0 ) {
|
||||
DisplayError("ERL set in SysCall Exception");
|
||||
}
|
||||
#endif
|
||||
|
||||
_Reg->CAUSE_REGISTER = EXC_SYSCALL;
|
||||
if (DelaySlot) {
|
||||
_Reg->CAUSE_REGISTER |= CAUSE_BD;
|
||||
_Reg->EPC_REGISTER = (*_PROGRAM_COUNTER) - 4;
|
||||
} else {
|
||||
_Reg->EPC_REGISTER = (*_PROGRAM_COUNTER);
|
||||
}
|
||||
_Reg->STATUS_REGISTER |= STATUS_EXL;
|
||||
(*_PROGRAM_COUNTER) = 0x80000180;
|
||||
}
|
||||
#include "stdafx.h"
|
|
@ -1,3 +1,4 @@
|
|||
#ifdef toremove
|
||||
/*
|
||||
* Project 64 - A Nintendo 64 emulator.
|
||||
*
|
||||
|
@ -68,16 +69,9 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
void __cdecl AiCheckInterrupts ( void );
|
||||
void __cdecl CheckInterrupts ( void );
|
||||
void DoAddressError ( BOOL DelaySlot, DWORD BadVaddr, BOOL FromRead );
|
||||
void DoBreakException ( BOOL DelaySlot );
|
||||
void _fastcall DoCopUnusableException ( BOOL DelaySlot, int Coprocessor );
|
||||
BOOL DoIntrException ( BOOL DelaySlot );
|
||||
void _fastcall DoTLBMiss ( BOOL DelaySlot, DWORD BadVaddr );
|
||||
void _fastcall DoSysCallException ( BOOL DelaySlot);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -1,33 +1,4 @@
|
|||
/*
|
||||
* Project 64 - A Nintendo 64 emulator.
|
||||
*
|
||||
* (c) Copyright 2001 zilmar (zilmar@emulation64.com) and
|
||||
* Jabo (jabo@emulation64.com).
|
||||
*
|
||||
* pj64 homepage: www.pj64.net
|
||||
*
|
||||
* Permission to use, copy, modify and distribute Project64 in both binary and
|
||||
* source form, for non-commercial purposes, is hereby granted without fee,
|
||||
* providing that this license information and copyright notice appear with
|
||||
* all copies and any derived work.
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event shall the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Project64 is freeware for PERSONAL USE only. Commercial users should
|
||||
* seek permission of the copyright holders first. Commercial use includes
|
||||
* charging money for Project64 or software derived from Project64.
|
||||
*
|
||||
* The copyright holders request that bug fixes and improvements to the code
|
||||
* should be forwarded to them so if they want them.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include "main.h"
|
||||
#include "CPU.h"
|
||||
#include "stdafx.h"
|
||||
|
||||
typedef enum TFlashRam_Modes {
|
||||
FLASHRAM_MODE_NOPES = 0,
|
||||
|
@ -139,7 +110,7 @@ BOOL LoadFlashram (void) {
|
|||
char File[255], Directory[255];
|
||||
|
||||
GetAutoSaveDir(Directory);
|
||||
sprintf(File,"%s%s.fla",Directory,RomName);
|
||||
sprintf(File,"%s%s.fla",Directory,g_RomName);
|
||||
|
||||
hFlashRamFile = CreateFile(File,GENERIC_WRITE | GENERIC_READ, FILE_SHARE_READ,NULL,OPEN_ALWAYS,
|
||||
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS, NULL);
|
||||
|
|
|
@ -23,19 +23,10 @@
|
|||
* should be forwarded to them so if they want them.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void DmaFromFlashram ( BYTE * dest, int StartOffset, int len );
|
||||
void DmaToFlashram ( BYTE * Source, int StartOffset, int len );
|
||||
DWORD ReadFromFlashStatus ( DWORD PAddr );
|
||||
void WriteToFlashCommand ( DWORD Value );
|
||||
void CloseFlashRam ( void );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -1,179 +0,0 @@
|
|||
/*
|
||||
* Project 64 - A Nintendo 64 emulator.
|
||||
*
|
||||
* (c) Copyright 2001 zilmar (zilmar@emulation64.com) and
|
||||
* Jabo (jabo@emulation64.com).
|
||||
*
|
||||
* pj64 homepage: www.pj64.net
|
||||
*
|
||||
* Permission to use, copy, modify and distribute Project64 in both binary and
|
||||
* source form, for non-commercial purposes, is hereby granted without fee,
|
||||
* providing that this license information and copyright notice appear with
|
||||
* all copies and any derived work.
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event shall the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Project64 is freeware for PERSONAL USE only. Commercial users should
|
||||
* seek permission of the copyright holders first. Commercial use includes
|
||||
* charging money for Project64 or software derived from Project64.
|
||||
*
|
||||
* The copyright holders request that bug fixes and improvements to the code
|
||||
* should be forwarded to them so if they want them.
|
||||
*
|
||||
*/
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <float.h>
|
||||
#include "main.h"
|
||||
#include "cpu.h"
|
||||
#include "debugger.h"
|
||||
#include "plugin.h"
|
||||
|
||||
BOOL TestTimer = FALSE;
|
||||
|
||||
R4300iOp_FUNC * R4300i_Opcode;
|
||||
|
||||
BOOL ExecuteInterpreterOpCode (void)
|
||||
{
|
||||
if (!_MMU->LW_VAddr((*_PROGRAM_COUNTER), Opcode.Hex)) {
|
||||
DoTLBMiss(NextInstruction == JUMP,(*_PROGRAM_COUNTER));
|
||||
NextInstruction = NORMAL;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*if (*_PROGRAM_COUNTER > 0x80310000 && *_PROGRAM_COUNTER < 0x80380000)
|
||||
{
|
||||
WriteTraceF((TraceType)(TraceError | TraceNoHeader),"%X: %s",*_PROGRAM_COUNTER,R4300iOpcodeName(Opcode.Hex,*_PROGRAM_COUNTER));
|
||||
WriteTraceF((TraceType)(TraceError | TraceNoHeader),"%X: %d %d",*_PROGRAM_COUNTER,*_NextTimer,_SystemTimer->CurrentType());
|
||||
}*/
|
||||
|
||||
*_NextTimer -= CountPerOp;
|
||||
#ifdef toremove
|
||||
_Reg->COUNT_REGISTER += CountPerOp;
|
||||
|
||||
_Reg->RANDOM_REGISTER -= 1;
|
||||
if ((int)_Reg->RANDOM_REGISTER < (int)_Reg->WIRED_REGISTER) {
|
||||
_Reg->RANDOM_REGISTER = 31;
|
||||
}
|
||||
#endif
|
||||
|
||||
((void (_fastcall *)()) R4300i_Opcode[ Opcode.op ])();
|
||||
|
||||
if (_GPR[0].DW != 0) {
|
||||
#if (!defined(EXTERNAL_RELEASE))
|
||||
DisplayError("_GPR[0].DW has been written to");
|
||||
#endif
|
||||
_GPR[0].DW = 0;
|
||||
}
|
||||
#ifdef Interpreter_StackTest
|
||||
if (StackValue != _GPR[29].UW[0]) {
|
||||
DisplayError("Stack has Been changed");
|
||||
}
|
||||
#endif
|
||||
|
||||
switch (NextInstruction) {
|
||||
case NORMAL:
|
||||
(*_PROGRAM_COUNTER) += 4;
|
||||
break;
|
||||
case DELAY_SLOT:
|
||||
NextInstruction = JUMP;
|
||||
(*_PROGRAM_COUNTER) += 4;
|
||||
break;
|
||||
case JUMP:
|
||||
{
|
||||
BOOL CheckTimer = (JumpToLocation < (*_PROGRAM_COUNTER) || TestTimer);
|
||||
(*_PROGRAM_COUNTER) = JumpToLocation;
|
||||
NextInstruction = NORMAL;
|
||||
if (CheckTimer)
|
||||
{
|
||||
TestTimer = FALSE;
|
||||
if (*_NextTimer < 0)
|
||||
{
|
||||
_SystemTimer->TimerDone();
|
||||
}
|
||||
if (CPU_Action.DoSomething) { DoSomething(); }
|
||||
}
|
||||
}
|
||||
if (CPU_Type != CPU_SyncCores) {
|
||||
if (Profiling) {
|
||||
if (IndvidualBlock) {
|
||||
StartTimer((*_PROGRAM_COUNTER));
|
||||
} else {
|
||||
StartTimer(Timer_R4300);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void ExecuteInterpreterOps (DWORD Cycles)
|
||||
{
|
||||
DWORD CyclesLeft = Cycles;
|
||||
__try {
|
||||
while(!EndEmulation()) {
|
||||
#if (!defined(EXTERNAL_RELEASE))
|
||||
if (NoOfBpoints != 0) {
|
||||
if (CheckForR4300iBPoint((*_PROGRAM_COUNTER))) {
|
||||
UpdateCurrentR4300iRegisterPanel();
|
||||
Refresh_Memory();
|
||||
if (InR4300iCommandsWindow) {
|
||||
Enter_R4300i_Commands_Window();
|
||||
SetR4300iCommandViewto( (*_PROGRAM_COUNTER) );
|
||||
if (CPU_Action.Stepping) {
|
||||
DisplayError ( "Encounted a R4300i Breakpoint" );
|
||||
} else {
|
||||
DisplayError ( "Encounted a R4300i Breakpoint\n\nNow Stepping" );
|
||||
SetR4300iCommandToStepping();
|
||||
}
|
||||
} else {
|
||||
DisplayError ( "Encounted a R4300i Breakpoint\n\nEntering Command Window" );
|
||||
Enter_R4300i_Commands_Window();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//r4300i_LW_VAddr(Addr,&Value);
|
||||
//if (Value2 != Value) {
|
||||
// DisplayError("%X changed",Addr);
|
||||
//}
|
||||
//Value2 = Value;
|
||||
if (CPU_Action.Stepping) {
|
||||
do {
|
||||
SetR4300iCommandViewto ((*_PROGRAM_COUNTER));
|
||||
UpdateCurrentR4300iRegisterPanel();
|
||||
Refresh_Memory();
|
||||
WaitForSingleObject( CPU_Action.hStepping, INFINITE );
|
||||
if (CPU_Action.Stepping) { ExecuteInterpreterOpCode(); }
|
||||
} while (CPU_Action.Stepping);
|
||||
}
|
||||
#endif
|
||||
//if ((Profiling || ShowCPUPer) && ProfilingLabel[0] == 0) { StartTimer(Timer_R4300); };
|
||||
if (Cycles != -1) {
|
||||
if (CyclesLeft <= 0) {
|
||||
return;
|
||||
}
|
||||
if (ExecuteInterpreterOpCode())
|
||||
{
|
||||
CyclesLeft -= CountPerOp;
|
||||
}
|
||||
} else {
|
||||
ExecuteInterpreterOpCode();
|
||||
}
|
||||
}
|
||||
} __except( _MMU->MemoryFilter( GetExceptionCode(), GetExceptionInformation()) ) {
|
||||
DisplayError(GS(MSG_UNKNOWN_MEM_ACTION));
|
||||
ExitThread(0);
|
||||
}
|
||||
}
|
||||
|
||||
void TestInterpreterJump (DWORD PC, DWORD TargetPC, int Reg1, int Reg2) {
|
||||
if (PC != TargetPC) { return; }
|
||||
if (DelaySlotEffectsCompare(PC,Reg1,Reg2)) { return; }
|
||||
InPermLoop();
|
||||
NextInstruction = DELAY_SLOT;
|
||||
TestTimer = TRUE;
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
#ifdef toremove
|
||||
|
||||
/*
|
||||
* Project 64 - A Nintendo 64 emulator.
|
||||
*
|
||||
* (c) Copyright 2001 zilmar (zilmar@emulation64.com) and
|
||||
* Jabo (jabo@emulation64.com).
|
||||
*
|
||||
* pj64 homepage: www.pj64.net
|
||||
*
|
||||
* Permission to use, copy, modify and distribute Project64 in both binary and
|
||||
* source form, for non-commercial purposes, is hereby granted without fee,
|
||||
* providing that this license information and copyright notice appear with
|
||||
* all copies and any derived work.
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event shall the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Project64 is freeware for PERSONAL USE only. Commercial users should
|
||||
* seek permission of the copyright holders first. Commercial use includes
|
||||
* charging money for Project64 or software derived from Project64.
|
||||
*
|
||||
* The copyright holders request that bug fixes and improvements to the code
|
||||
* should be forwarded to them so if they want them.
|
||||
*
|
||||
*/
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
BOOL ExecuteInterpreterOpCode ( void );
|
||||
void StartInterpreterCPU ( void );
|
||||
void TestInterpreterJump ( DWORD PC, DWORD TargetPC, int Reg1, int Reg2 );
|
||||
void ExecuteInterpreterCPU ( void );
|
||||
void ExecuteInterpreterOps ( DWORD Cycles );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -44,8 +44,6 @@ R4300iOp_FUNC R4300iOp::Jump_CoP1_D[64];
|
|||
R4300iOp_FUNC R4300iOp::Jump_CoP1_W[64];
|
||||
R4300iOp_FUNC R4300iOp::Jump_CoP1_L[64];
|
||||
|
||||
int RoundingModel = _RC_NEAR;
|
||||
|
||||
#define ADDRESS_ERROR_EXCEPTION(Address,FromRead) \
|
||||
DoAddressError(NextInstruction == JUMP,Address,FromRead);\
|
||||
NextInstruction = JUMP;\
|
||||
|
|
|
@ -236,16 +236,3 @@ private:
|
|||
static R4300iOp_FUNC Jump_CoP1_W[64];
|
||||
static R4300iOp_FUNC Jump_CoP1_L[64];
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern DWORD SWL_MASK[4], SWR_MASK[4], LWL_MASK[4], LWR_MASK[4];
|
||||
extern int SWL_SHIFT[4], SWR_SHIFT[4], LWL_SHIFT[4], LWR_SHIFT[4];
|
||||
extern int RoundingModel;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1,37 +1,6 @@
|
|||
/*
|
||||
* Project 64 - A Nintendo 64 emulator.
|
||||
*
|
||||
* (c) Copyright 2001 zilmar (zilmar@emulation64.com) and
|
||||
* Jabo (jabo@emulation64.com).
|
||||
*
|
||||
* pj64 homepage: www.pj64.net
|
||||
*
|
||||
* Permission to use, copy, modify and distribute Project64 in both binary and
|
||||
* source form, for non-commercial purposes, is hereby granted without fee,
|
||||
* providing that this license information and copyright notice appear with
|
||||
* all copies and any derived work.
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event shall the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Project64 is freeware for PERSONAL USE only. Commercial users should
|
||||
* seek permission of the copyright holders first. Commercial use includes
|
||||
* charging money for Project64 or software derived from Project64.
|
||||
*
|
||||
* The copyright holders request that bug fixes and improvements to the code
|
||||
* should be forwarded to them so if they want them.
|
||||
*
|
||||
*/
|
||||
#include "stdafx.h"
|
||||
|
||||
#if (!defined(EXTERNAL_RELEASE))
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
#include <stdio.h>
|
||||
#include "main.h"
|
||||
#include "cpu.h"
|
||||
#include "debugger.h"
|
||||
#include "..\..\User Interface\resource.h"
|
||||
|
||||
void LoadLogSetting (HKEY hKey,char * String, BOOL * Value);
|
||||
void SaveLogOptions (void);
|
||||
|
@ -97,7 +66,7 @@ void LoadLogOptions (LOG_OPTIONS * LogOptions, BOOL AlwaysFill) {
|
|||
DWORD Disposition = 0;
|
||||
char String[200];
|
||||
|
||||
sprintf(String,"Software\\N64 Emulation\\%s\\Logging",AppName);
|
||||
sprintf(String,"Software\\N64 Emulation\\%s\\Logging",GetAppName());
|
||||
lResult = RegOpenKeyEx( HKEY_CURRENT_USER,String,0,KEY_ALL_ACCESS,
|
||||
&hKeyResults);
|
||||
|
||||
|
@ -220,7 +189,7 @@ void Log_LW (DWORD PC, DWORD VAddr) {
|
|||
}
|
||||
|
||||
DWORD Value;
|
||||
if ( VAddr >= 0xA0000000 && VAddr < (0xA0000000 + RdramSize)) { return; }
|
||||
if ( VAddr >= 0xA0000000 && VAddr < (0xA0000000 + g_RdramSize)) { return; }
|
||||
if ( VAddr >= 0xA3F00000 && VAddr <= 0xA3F00024) {
|
||||
if (!LogOptions.LogRDRamRegisters) { return; }
|
||||
_MMU->LW_VAddr(VAddr,Value);
|
||||
|
@ -388,7 +357,7 @@ void Log_LW (DWORD PC, DWORD VAddr) {
|
|||
LogMessage("%08X: read word from Pif Ram at 0x%X (%08X)",PC,VAddr - 0xBFC007C0, Value);
|
||||
return;
|
||||
}
|
||||
if ( VAddr >= 0xB0000040 && ((VAddr - 0xB0000000) < RomFileSize)) { return; }
|
||||
if ( VAddr >= 0xB0000040 && ((VAddr - 0xB0000000) < g_RomFileSize)) { return; }
|
||||
if ( VAddr >= 0xB0000000 && VAddr < 0xB0000040) {
|
||||
if (!LogOptions.LogRomHeader) { return; }
|
||||
|
||||
|
@ -412,7 +381,7 @@ void __cdecl LogMessage (char * Message, ...) {
|
|||
char Msg[400];
|
||||
va_list ap;
|
||||
|
||||
if(!HaveDebugger) { return; }
|
||||
if(!g_HaveDebugger) { return; }
|
||||
if(hLogFile == NULL) { return; }
|
||||
|
||||
va_start( ap, Message );
|
||||
|
@ -441,7 +410,7 @@ void Log_SW (DWORD PC, DWORD VAddr, DWORD Value) {
|
|||
VAddr = PAddr + 0xA0000000;
|
||||
}
|
||||
|
||||
if ( VAddr >= 0xA0000000 && VAddr < (0xA0000000 + RdramSize)) { return; }
|
||||
if ( VAddr >= 0xA0000000 && VAddr < (0xA0000000 + g_RdramSize)) { return; }
|
||||
if ( VAddr >= 0xA3F00000 && VAddr <= 0xA3F00024) {
|
||||
if (!LogOptions.LogRDRamRegisters) { return; }
|
||||
switch (VAddr) {
|
||||
|
@ -674,7 +643,7 @@ void SaveLogOptions (void) {
|
|||
DWORD Disposition = 0;
|
||||
char String[200];
|
||||
|
||||
sprintf(String,"Software\\N64 Emulation\\%s\\Logging",AppName);
|
||||
sprintf(String,"Software\\N64 Emulation\\%s\\Logging",GetAppName());
|
||||
lResult = RegCreateKeyEx( HKEY_CURRENT_USER,String,0,"", REG_OPTION_NON_VOLATILE,
|
||||
KEY_ALL_ACCESS,NULL,&hKeyResults,&Disposition);
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#pragma once
|
||||
/*
|
||||
* Project 64 - A Nintendo 64 emulator.
|
||||
*
|
||||
|
|
|
@ -1,32 +1,4 @@
|
|||
/*
|
||||
* Project 64 - A Nintendo 64 emulator.
|
||||
*
|
||||
* (c) Copyright 2001 zilmar (zilmar@emulation64.com) and
|
||||
* Jabo (jabo@emulation64.com).
|
||||
*
|
||||
* pj64 homepage: www.pj64.net
|
||||
*
|
||||
* Permission to use, copy, modify and distribute Project64 in both binary and
|
||||
* source form, for non-commercial purposes, is hereby granted without fee,
|
||||
* providing that this license information and copyright notice appear with
|
||||
* all copies and any derived work.
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event shall the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Project64 is freeware for PERSONAL USE only. Commercial users should
|
||||
* seek permission of the copyright holders first. Commercial use includes
|
||||
* charging money for Project64 or software derived from Project64.
|
||||
*
|
||||
* The copyright holders request that bug fixes and improvements to the code
|
||||
* should be forwarded to them so if they want them.
|
||||
*
|
||||
*/
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include "main.h"
|
||||
#include "CPU.h"
|
||||
#include "stdafx.h"
|
||||
|
||||
static BYTE Mempak[4][0x8000];
|
||||
static HANDLE hMempakFile = NULL;
|
||||
|
@ -70,7 +42,7 @@ void LoadMempak (void) {
|
|||
}
|
||||
|
||||
GetAutoSaveDir(Directory);
|
||||
sprintf(File,"%s%s.mpk",Directory,RomName);
|
||||
sprintf(File,"%s%s.mpk",Directory,g_RomName);
|
||||
|
||||
hMempakFile = CreateFile(File,GENERIC_WRITE | GENERIC_READ, FILE_SHARE_READ,NULL,OPEN_ALWAYS,
|
||||
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS, NULL);
|
||||
|
|
|
@ -1,35 +1,6 @@
|
|||
/*
|
||||
* Project 64 - A Nintendo 64 emulator.
|
||||
*
|
||||
* (c) Copyright 2001 zilmar (zilmar@emulation64.com) and
|
||||
* Jabo (jabo@emulation64.com).
|
||||
*
|
||||
* pj64 homepage: www.pj64.net
|
||||
*
|
||||
* Permission to use, copy, modify and distribute Project64 in both binary and
|
||||
* source form, for non-commercial purposes, is hereby granted without fee,
|
||||
* providing that this license information and copyright notice appear with
|
||||
* all copies and any derived work.
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event shall the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Project64 is freeware for PERSONAL USE only. Commercial users should
|
||||
* seek permission of the copyright holders first. Commercial use includes
|
||||
* charging money for Project64 or software derived from Project64.
|
||||
*
|
||||
* The copyright holders request that bug fixes and improvements to the code
|
||||
* should be forwarded to them so if they want them.
|
||||
*
|
||||
*/
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include "main.h"
|
||||
#include "cpu.h"
|
||||
#include "plugin.h"
|
||||
#include "Debugger.h"
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "Eeprom.h"
|
||||
#include "mempak.h"
|
||||
|
||||
void ProcessControllerCommand ( int Control, BYTE * Command);
|
||||
void ReadControllerCommand (int Control, BYTE * Command);
|
||||
|
@ -161,6 +132,7 @@ void LoadPIF2 () {
|
|||
}
|
||||
|
||||
void PifRamRead (void) {
|
||||
CONTROL * Controllers = _Plugins->Control()->PluginControllers();
|
||||
BYTE * PIF_Ram = _MMU->PifRam();
|
||||
int Channel, CurPos;
|
||||
|
||||
|
@ -225,7 +197,7 @@ void PifRamRead (void) {
|
|||
if ((PIF_Ram[CurPos] & 0xC0) == 0) {
|
||||
if (Channel < 4) {
|
||||
if (Controllers[Channel].Present && Controllers[Channel].RawData) {
|
||||
if (ReadController) { ReadController(Channel,&PIF_Ram[CurPos]); }
|
||||
if (_Plugins->Control()->ReadController) { _Plugins->Control()->ReadController(Channel,&PIF_Ram[CurPos]); }
|
||||
} else {
|
||||
ReadControllerCommand(Channel,&PIF_Ram[CurPos]);
|
||||
}
|
||||
|
@ -233,17 +205,18 @@ void PifRamRead (void) {
|
|||
CurPos += PIF_Ram[CurPos] + (PIF_Ram[CurPos + 1] & 0x3F) + 1;
|
||||
Channel += 1;
|
||||
} else {
|
||||
if (ShowPifRamErrors) { DisplayError("Unknown Command in PifRamRead(%X)",PIF_Ram[CurPos]); }
|
||||
if (g_ShowPifRamErrors) { DisplayError("Unknown Command in PifRamRead(%X)",PIF_Ram[CurPos]); }
|
||||
CurPos = 0x40;
|
||||
}
|
||||
break;
|
||||
}
|
||||
CurPos += 1;
|
||||
} while( CurPos < 0x40 );
|
||||
if (ReadController) { ReadController(-1,NULL); }
|
||||
if (_Plugins->Control()->ReadController) { _Plugins->Control()->ReadController(-1,NULL); }
|
||||
}
|
||||
|
||||
void PifRamWrite (void) {
|
||||
CONTROL * Controllers = _Plugins->Control()->PluginControllers();
|
||||
BYTE * PIF_Ram = _MMU->PifRam();
|
||||
int Channel, CurPos;
|
||||
|
||||
|
@ -255,7 +228,7 @@ void PifRamWrite (void) {
|
|||
PIF_Ram[0x3F] = 0;
|
||||
_Reg->MI_INTR_REG |= MI_INTR_SI;
|
||||
_Reg->SI_STATUS_REG |= SI_STATUS_INTERRUPT;
|
||||
CheckInterrupts();
|
||||
_Reg->CheckInterrupts();
|
||||
break;
|
||||
case 0x10:
|
||||
memset(PifRom,0,0x7C0);
|
||||
|
@ -267,7 +240,7 @@ void PifRamWrite (void) {
|
|||
memset(PIF_Ram,0,0x40);
|
||||
break;
|
||||
default:
|
||||
if (ShowPifRamErrors) { DisplayError("Unkown PifRam control: %d",PIF_Ram[0x3F]); }
|
||||
if (g_ShowPifRamErrors) { DisplayError("Unkown PifRam control: %d",PIF_Ram[0x3F]); }
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -285,7 +258,7 @@ void PifRamWrite (void) {
|
|||
if ((PIF_Ram[CurPos] & 0xC0) == 0) {
|
||||
if (Channel < 4) {
|
||||
if (Controllers[Channel].Present && Controllers[Channel].RawData) {
|
||||
if (ControllerCommand) { ControllerCommand(Channel,&PIF_Ram[CurPos]); }
|
||||
if (_Plugins->Control()->ControllerCommand) { _Plugins->Control()->ControllerCommand(Channel,&PIF_Ram[CurPos]); }
|
||||
} else {
|
||||
ProcessControllerCommand(Channel,&PIF_Ram[CurPos]);
|
||||
}
|
||||
|
@ -299,17 +272,19 @@ void PifRamWrite (void) {
|
|||
CurPos += PIF_Ram[CurPos] + (PIF_Ram[CurPos + 1] & 0x3F) + 1;
|
||||
Channel += 1;
|
||||
} else {
|
||||
if (ShowPifRamErrors) { DisplayError("Unknown Command in PifRamWrite(%X)",PIF_Ram[CurPos]); }
|
||||
if (g_ShowPifRamErrors) { DisplayError("Unknown Command in PifRamWrite(%X)",PIF_Ram[CurPos]); }
|
||||
CurPos = 0x40;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
PIF_Ram[0x3F] = 0;
|
||||
if (ControllerCommand) { ControllerCommand(-1,NULL); }
|
||||
if (_Plugins->Control()->ControllerCommand) { _Plugins->Control()->ControllerCommand(-1,NULL); }
|
||||
}
|
||||
|
||||
void ProcessControllerCommand ( int Control, BYTE * Command) {
|
||||
CONTROL * Controllers = _Plugins->Control()->PluginControllers();
|
||||
|
||||
switch (Command[2]) {
|
||||
case 0x00: // check
|
||||
case 0xFF: // reset & check ?
|
||||
|
@ -354,7 +329,7 @@ void ProcessControllerCommand ( int Control, BYTE * Command) {
|
|||
Command[0x25] = Mempacks_CalulateCrc(&Command[5]);
|
||||
break;
|
||||
case PLUGIN_MEMPAK: ReadFromMempak(Control, address, &Command[5]); break;
|
||||
case PLUGIN_RAW: if (ControllerCommand) { ControllerCommand(Control, Command); } break;
|
||||
case PLUGIN_RAW: if (_Plugins->Control()->ControllerCommand) { _Plugins->Control()->ControllerCommand(Control, Command); } break;
|
||||
default:
|
||||
memset(&Command[5], 0, 0x20);
|
||||
Command[0x25] = 0;
|
||||
|
@ -377,10 +352,10 @@ void ProcessControllerCommand ( int Control, BYTE * Command) {
|
|||
DWORD address = ((Command[3] << 8) | Command[4]);
|
||||
switch (Controllers[Control].Plugin) {
|
||||
case PLUGIN_MEMPAK: WriteToMempak(Control, address, &Command[5]); break;
|
||||
case PLUGIN_RAW: if (ControllerCommand) { ControllerCommand(Control, Command); } break;
|
||||
case PLUGIN_RAW: if (_Plugins->Control()->ControllerCommand) { _Plugins->Control()->ControllerCommand(Control, Command); } break;
|
||||
case PLUGIN_RUMBLE_PAK:
|
||||
if ((address & 0xFFE0) == 0xC000 && RumbleCommand != NULL) {
|
||||
RumbleCommand(Control, *(BOOL *)(&Command[5]));
|
||||
if ((address & 0xFFE0) == 0xC000 && _Plugins->Control()->RumbleCommand != NULL) {
|
||||
_Plugins->Control()->RumbleCommand(Control, *(BOOL *)(&Command[5]));
|
||||
}
|
||||
default:
|
||||
Command[0x25] = Mempacks_CalulateCrc(&Command[5]);
|
||||
|
@ -393,11 +368,13 @@ void ProcessControllerCommand ( int Control, BYTE * Command) {
|
|||
#endif
|
||||
break;
|
||||
default:
|
||||
if (ShowPifRamErrors) { DisplayError("Unknown ControllerCommand %d",Command[2]); }
|
||||
if (g_ShowPifRamErrors) { DisplayError("Unknown ControllerCommand %d",Command[2]); }
|
||||
}
|
||||
}
|
||||
|
||||
void ReadControllerCommand (int Control, BYTE * Command) {
|
||||
CONTROL * Controllers = _Plugins->Control()->PluginControllers();
|
||||
|
||||
switch (Command[2]) {
|
||||
case 0x01: // read controller
|
||||
if (Controllers[Control].Present == TRUE) {
|
||||
|
@ -405,10 +382,10 @@ void ReadControllerCommand (int Control, BYTE * Command) {
|
|||
if (Command[0] != 1) { DisplayError("What am I meant to do with this Controller Command"); }
|
||||
if (Command[1] != 4) { DisplayError("What am I meant to do with this Controller Command"); }
|
||||
#endif
|
||||
if (GetKeys) {
|
||||
if (_Plugins->Control()->GetKeys) {
|
||||
BUTTONS Keys;
|
||||
|
||||
GetKeys(Control,&Keys);
|
||||
_Plugins->Control()->GetKeys(Control,&Keys);
|
||||
*(DWORD *)&Command[3] = Keys.Value;
|
||||
} else {
|
||||
*(DWORD *)&Command[3] = 0;
|
||||
|
@ -418,14 +395,14 @@ void ReadControllerCommand (int Control, BYTE * Command) {
|
|||
case 0x02: //read from controller pack
|
||||
if (Controllers[Control].Present == TRUE) {
|
||||
switch (Controllers[Control].Plugin) {
|
||||
case PLUGIN_RAW: if (ReadController) { ReadController(Control, Command); } break;
|
||||
case PLUGIN_RAW: if (_Plugins->Control()->ReadController) { _Plugins->Control()->ReadController(Control, Command); } break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0x03: //write controller pak
|
||||
if (Controllers[Control].Present == TRUE) {
|
||||
switch (Controllers[Control].Plugin) {
|
||||
case PLUGIN_RAW: if (ReadController) { ReadController(Control, Command); } break;
|
||||
case PLUGIN_RAW: if (_Plugins->Control()->ReadController) { _Plugins->Control()->ReadController(Control, Command); } break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#ifdef toremove
|
||||
/*
|
||||
* Project 64 - A Nintendo 64 emulator.
|
||||
*
|
||||
|
@ -372,23 +373,15 @@ extern DWORD (__cdecl *AiReadLength) ( void );
|
|||
extern void (__cdecl *ProcessAList) ( void );
|
||||
|
||||
/********** Controller DLL: Functions **************/
|
||||
//extern void (__cdecl *ContCloseDLL) ( void );
|
||||
extern void (__cdecl *ControllerCommand)( int Control, BYTE * Command );
|
||||
//extern void (__cdecl *ContDllAbout) ( HWND hParent );
|
||||
//extern void (__cdecl *ContConfig) ( HWND hParent );
|
||||
//extern void (__cdecl *InitiateControllers_1_0)( HWND hMainWindow, CONTROL Controls[4] );
|
||||
//extern void (__cdecl *InitiateControllers_1_1)( CONTROL_INFO ControlInfo );
|
||||
extern void (__cdecl *GetKeys) ( int Control, BUTTONS * Keys );
|
||||
extern void (__cdecl *ReadController) ( int Control, BYTE * Command );
|
||||
//extern void (__cdecl *ContRomOpen) ( void );
|
||||
//extern void (__cdecl *ContRomClosed) ( void );
|
||||
//extern void (__cdecl *WM_KeyDown) ( WPARAM wParam, LPARAM lParam );
|
||||
//extern void (__cdecl *WM_KeyUp) ( WPARAM wParam, LPARAM lParam );
|
||||
extern void (__cdecl *RumbleCommand) ( int Control, BOOL bRumble );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/********** Plugin: Functions *********************/
|
||||
void GetPluginDir ( char * Directory );
|
||||
|
|
|
@ -100,10 +100,10 @@
|
|||
#define MipsRegLo_S(Reg) Section->RegWorking.MIPS_RegVal[Reg].W[0]
|
||||
#define MipsRegHi(Reg) Section->RegWorking.MIPS_RegVal[Reg].UW[1]
|
||||
#define MipsRegHi_S(Reg) Section->RegWorking.MIPS_RegVal[Reg].W[1]
|
||||
*/
|
||||
#define x86MapOrder(Reg) Section->RegWorking.x86reg_MapOrder[Reg]
|
||||
#define x86Protected(Reg) Section->RegWorking.x86reg_Protected[Reg]
|
||||
#define x86Mapped(Reg) Section->RegWorking.x86reg_MappedTo[Reg]
|
||||
*/
|
||||
|
||||
#define BlockCycleCount Section->RegWorking.CycleCount
|
||||
#define BlockRandomModifier Section->RegWorking.RandomModifier
|
||||
|
@ -233,15 +233,14 @@ void InitilizeInitialCompilerVariable ( void);
|
|||
extern DWORD TLBLoadAddress, TLBStoreAddress, TargetIndex;
|
||||
extern ORIGINAL_MEMMARKER * OrigMem;
|
||||
extern TARGET_INFO * TargetInfo;
|
||||
extern WORD FPU_RoundingMode;
|
||||
extern N64_BLOCKS N64_Blocks;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#define SetJump32(Loc,JumpLoc) *(DWORD *)(Loc)= (DWORD)(((DWORD)(JumpLoc)) - (((DWORD)(Loc)) + 4));
|
||||
#define SetJump8(Loc,JumpLoc) *(BYTE *)(Loc)= (BYTE )(((BYTE )(JumpLoc)) - (((BYTE )(Loc)) + 1));
|
||||
//#define SetJump32(Loc,JumpLoc) *(DWORD *)(Loc)= (DWORD)(((DWORD)(JumpLoc)) - (((DWORD)(Loc)) + 4));
|
||||
//#define SetJump8(Loc,JumpLoc) *(BYTE *)(Loc)= (BYTE )(((BYTE )(JumpLoc)) - (((BYTE )(Loc)) + 1));
|
||||
|
||||
#endif
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,248 +0,0 @@
|
|||
#ifdef toremove
|
||||
|
||||
/*
|
||||
* Project 64 - A Nintendo 64 emulator.
|
||||
*
|
||||
* (c) Copyright 2001 zilmar (zilmar@emulation64.com) and
|
||||
* Jabo (jabo@emulation64.com).
|
||||
*
|
||||
* pj64 homepage: www.pj64.net
|
||||
*
|
||||
* Permission to use, copy, modify and distribute Project64 in both binary and
|
||||
* source form, for non-commercial purposes, is hereby granted without fee,
|
||||
* providing that this license information and copyright notice appear with
|
||||
* all copies and any derived work.
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event shall the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Project64 is freeware for PERSONAL USE only. Commercial users should
|
||||
* seek permission of the copyright holders first. Commercial use includes
|
||||
* charging money for Project64 or software derived from Project64.
|
||||
*
|
||||
* The copyright holders request that bug fixes and improvements to the code
|
||||
* should be forwarded to them so if they want them.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#define INDEX_REGISTER _CP0[0]
|
||||
#define RANDOM_REGISTER _CP0[1]
|
||||
#define ENTRYLO0_REGISTER _CP0[2]
|
||||
#define ENTRYLO1_REGISTER _CP0[3]
|
||||
#define CONTEXT_REGISTER _CP0[4]
|
||||
#define PAGE_MASK_REGISTER _CP0[5]
|
||||
#define WIRED_REGISTER _CP0[6]
|
||||
#define BAD_VADDR_REGISTER _CP0[8]
|
||||
#define COUNT_REGISTER _CP0[9]
|
||||
#define ENTRYHI_REGISTER _CP0[10]
|
||||
#define COMPARE_REGISTER _CP0[11]
|
||||
#define STATUS_REGISTER _CP0[12]
|
||||
#define CAUSE_REGISTER _CP0[13]
|
||||
#define EPC_REGISTER _CP0[14]
|
||||
#define CONFIG_REGISTER _CP0[16]
|
||||
#define TAGLO_REGISTER _CP0[28]
|
||||
#define TAGHI_REGISTER _CP0[29]
|
||||
#define ERROREPC_REGISTER _CP0[30]
|
||||
#define FAKE_CAUSE_REGISTER _CP0[32]
|
||||
|
||||
#define COMPARE_REGISTER_NO 11
|
||||
#define STATUS_REGISTER_NO 12
|
||||
#define CAUSE_REGISTER_NO 13
|
||||
|
||||
#define REVISION_REGISTER _FPCR[0]
|
||||
#define FSTATUS_REGISTER _FPCR[31]
|
||||
|
||||
#define GPR_S0 _GPR[16]
|
||||
#define GPR_S1 _GPR[17]
|
||||
#define GPR_S2 _GPR[18]
|
||||
#define GPR_S3 _GPR[19]
|
||||
#define GPR_S4 _GPR[20]
|
||||
#define GPR_S5 _GPR[21]
|
||||
#define GPR_S6 _GPR[22]
|
||||
#define GPR_S7 _GPR[23]
|
||||
#define GPR_SP _GPR[29]
|
||||
#define GPR_RA _GPR[31]
|
||||
|
||||
#define RDRAM_CONFIG_REG _RegRDRAM[0]
|
||||
#define RDRAM_DEVICE_TYPE_REG _RegRDRAM[0]
|
||||
#define RDRAM_DEVICE_ID_REG _RegRDRAM[1]
|
||||
#define RDRAM_DELAY_REG _RegRDRAM[2]
|
||||
#define RDRAM_MODE_REG _RegRDRAM[3]
|
||||
#define RDRAM_REF_INTERVAL_REG _RegRDRAM[4]
|
||||
#define RDRAM_REF_ROW_REG _RegRDRAM[5]
|
||||
#define RDRAM_RAS_INTERVAL_REG _RegRDRAM[6]
|
||||
#define RDRAM_MIN_INTERVAL_REG _RegRDRAM[7]
|
||||
#define RDRAM_ADDR_SELECT_REG _RegRDRAM[8]
|
||||
#define RDRAM_DEVICE_MANUF_REG _RegRDRAM[9]
|
||||
|
||||
#define SP_MEM_ADDR_REG _RegSP[0]
|
||||
#define SP_DRAM_ADDR_REG _RegSP[1]
|
||||
#define SP_RD_LEN_REG _RegSP[2]
|
||||
#define SP_WR_LEN_REG _RegSP[3]
|
||||
#define SP_STATUS_REG _RegSP[4]
|
||||
#define SP_DMA_FULL_REG _RegSP[5]
|
||||
#define SP_DMA_BUSY_REG _RegSP[6]
|
||||
#define SP_SEMAPHORE_REG _RegSP[7]
|
||||
#define SP_PC_REG _RegSP[8]
|
||||
#define SP_IBIST_REG _RegSP[9]
|
||||
|
||||
#define DPC_START_REG _RegDPC[0]
|
||||
#define DPC_END_REG _RegDPC[1]
|
||||
#define DPC_CURRENT_REG _RegDPC[2]
|
||||
#define DPC_STATUS_REG _RegDPC[3]
|
||||
#define DPC_CLOCK_REG _RegDPC[4]
|
||||
#define DPC_BUFBUSY_REG _RegDPC[5]
|
||||
#define DPC_PIPEBUSY_REG _RegDPC[6]
|
||||
#define DPC_TMEM_REG _RegDPC[7]
|
||||
|
||||
#define MI_INIT_MODE_REG _RegMI[0]
|
||||
#define MI_MODE_REG _RegMI[0]
|
||||
#define MI_VERSION_REG _RegMI[1]
|
||||
#define MI_NOOP_REG _RegMI[1]
|
||||
#define MI_INTR_REG _RegMI[2]
|
||||
#define MI_INTR_MASK_REG _RegMI[3]
|
||||
|
||||
#define VI_STATUS_REG _RegVI[0]
|
||||
#define VI_CONTROL_REG _RegVI[0]
|
||||
#define VI_ORIGIN_REG _RegVI[1]
|
||||
#define VI_DRAM_ADDR_REG _RegVI[1]
|
||||
#define VI_WIDTH_REG _RegVI[2]
|
||||
#define VI_H_WIDTH_REG _RegVI[2]
|
||||
#define VI_INTR_REG _RegVI[3]
|
||||
#define VI_V_INTR_REG _RegVI[3]
|
||||
#define VI_CURRENT_REG _RegVI[4]
|
||||
#define VI_V_CURRENT_LINE_REG _RegVI[4]
|
||||
#define VI_BURST_REG _RegVI[5]
|
||||
#define VI_TIMING_REG _RegVI[5]
|
||||
#define VI_V_SYNC_REG _RegVI[6]
|
||||
#define VI_H_SYNC_REG _RegVI[7]
|
||||
#define VI_LEAP_REG _RegVI[8]
|
||||
#define VI_H_SYNC_LEAP_REG _RegVI[8]
|
||||
#define VI_H_START_REG _RegVI[9]
|
||||
#define VI_H_VIDEO_REG _RegVI[9]
|
||||
#define VI_V_START_REG _RegVI[10]
|
||||
#define VI_V_VIDEO_REG _RegVI[10]
|
||||
#define VI_V_BURST_REG _RegVI[11]
|
||||
#define VI_X_SCALE_REG _RegVI[12]
|
||||
#define VI_Y_SCALE_REG _RegVI[13]
|
||||
|
||||
#define AI_DRAM_ADDR_REG _RegAI[0]
|
||||
#define AI_LEN_REG _RegAI[1]
|
||||
#define AI_CONTROL_REG _RegAI[2]
|
||||
#define AI_STATUS_REG _RegAI[3]
|
||||
#define AI_DACRATE_REG _RegAI[4]
|
||||
#define AI_BITRATE_REG _RegAI[5]
|
||||
|
||||
#define PI_DRAM_ADDR_REG _RegPI[0]
|
||||
#define PI_CART_ADDR_REG _RegPI[1]
|
||||
#define PI_RD_LEN_REG _RegPI[2]
|
||||
#define PI_WR_LEN_REG _RegPI[3]
|
||||
#define PI_STATUS_REG _RegPI[4]
|
||||
#define PI_BSD_DOM1_LAT_REG _RegPI[5]
|
||||
#define PI_DOMAIN1_REG _RegPI[5]
|
||||
#define PI_BSD_DOM1_PWD_REG _RegPI[6]
|
||||
#define PI_BSD_DOM1_PGS_REG _RegPI[7]
|
||||
#define PI_BSD_DOM1_RLS_REG _RegPI[8]
|
||||
#define PI_BSD_DOM2_LAT_REG _RegPI[9]
|
||||
#define PI_DOMAIN2_REG _RegPI[9]
|
||||
#define PI_BSD_DOM2_PWD_REG _RegPI[10]
|
||||
#define PI_BSD_DOM2_PGS_REG _RegPI[11]
|
||||
#define PI_BSD_DOM2_RLS_REG _RegPI[12]
|
||||
|
||||
#define RI_MODE_REG _RegRI[0]
|
||||
#define RI_CONFIG_REG _RegRI[1]
|
||||
#define RI_CURRENT_LOAD_REG _RegRI[2]
|
||||
#define RI_SELECT_REG _RegRI[3]
|
||||
#define RI_COUNT_REG _RegRI[4]
|
||||
#define RI_REFRESH_REG _RegRI[4]
|
||||
#define RI_LATENCY_REG _RegRI[5]
|
||||
#define RI_RERROR_REG _RegRI[6]
|
||||
#define RI_WERROR_REG _RegRI[7]
|
||||
|
||||
#define SI_DRAM_ADDR_REG _RegSI[0]
|
||||
#define SI_PIF_ADDR_RD64B_REG _RegSI[1]
|
||||
#define SI_PIF_ADDR_WR64B_REG _RegSI[2]
|
||||
#define SI_STATUS_REG _RegSI[3]
|
||||
|
||||
enum
|
||||
{
|
||||
|
||||
MI_MODE_INIT = 0x0080, /* Bit 7: init mode */
|
||||
MI_MODE_EBUS = 0x0100, /* Bit 8: ebus test mode */
|
||||
MI_MODE_RDRAM = 0x0200, /* Bit 9: RDRAM reg mode */
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
#define FPR_Type(Reg) (Reg) == R4300i_COP1_S ? "S" : (Reg) == R4300i_COP1_D ? "D" :\
|
||||
(Reg) == R4300i_COP1_W ? "W" : "L"
|
||||
|
||||
typedef struct {
|
||||
DWORD PROGRAM_COUNTER;
|
||||
MIPS_DWORD GPR[32];
|
||||
MIPS_DWORD FPR[32];
|
||||
DWORD CP0[33];
|
||||
DWORD FPCR[32];
|
||||
MIPS_DWORD HI;
|
||||
MIPS_DWORD LO;
|
||||
DWORD RDRAM[10];
|
||||
DWORD SP[10];
|
||||
DWORD DPC[10];
|
||||
DWORD MI[4];
|
||||
DWORD VI[14];
|
||||
DWORD AI[6];
|
||||
DWORD PI[13];
|
||||
DWORD RI[8];
|
||||
DWORD SI[4];
|
||||
BYTE PIF_Ram[0x40];
|
||||
int DMAUsed;
|
||||
} N64_REGISTERS;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern char *GPR_Name[32], *GPR_NameHi[32], *GPR_NameLo[32], *FPR_Name[32], *FPR_NameHi[32],
|
||||
*FPR_NameLo[32],*FPR_Ctrl_Name[32];
|
||||
extern DWORD RegModValue;
|
||||
//extern DWORD RegModValue, ViFieldNumber, LLAddr;
|
||||
extern N64_REGISTERS Registers;
|
||||
|
||||
/*enum FPU_Format {
|
||||
FPU_Unkown,FPU_Dword, FPU_Qword, FPU_Float, FPU_Double
|
||||
};*/
|
||||
|
||||
void ChangeMiIntrMask ( void );
|
||||
void ChangeMiModeReg ( void );
|
||||
void ChangeSpStatus ( void );
|
||||
void InitalizeR4300iRegisters ( int UsePif, int Country, int CIC_Chip );
|
||||
void SetFpuLocations ( void );
|
||||
void SetupRegisters ( N64_REGISTERS * n64_Registers );
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
BOOL Is8BitReg ( int x86Reg);
|
||||
void ChangeFPURegFormat ( CCodeSection * Section, int Reg, CRegInfo::FPU_STATE OldFormat, CRegInfo::FPU_STATE NewFormat, CRegInfo::FPU_ROUND RoundingModel );
|
||||
void Load_FPR_ToTop ( CCodeSection * Section, int Reg, int RegToLoad, CRegInfo::FPU_STATE Format);
|
||||
void Map_GPR_32bit ( CCodeSection * Section, int Reg, BOOL SignValue, int MipsRegToLoad );
|
||||
void Map_GPR_64bit ( CCodeSection * Section, int Reg, int MipsRegToLoad );
|
||||
int Map_MemoryStack ( CCodeSection * Section, int Reg, bool MapRegister );
|
||||
int Map_TempReg ( CCodeSection * Section, int x86Reg, int MipsReg, BOOL LoadHiWord );
|
||||
BOOL RegInStack ( CCodeSection * Section, int Reg, int Format );
|
||||
void ProtectGPR ( CCodeSection * Section, DWORD Reg );
|
||||
int StackPosition ( CCodeSection * Section, int Reg );
|
||||
void UnMap_AllFPRs ( CCodeSection * Section );
|
||||
void UnMap_FPR ( CCodeSection * Section, int Reg, int WriteBackValue );
|
||||
void UnMap_GPR ( CCodeSection * Section, DWORD Reg, int WriteBackValue );
|
||||
BOOL UnMap_X86reg ( CCodeSection * Section, DWORD x86Reg );
|
||||
void UnProtectGPR ( CCodeSection * Section, DWORD Reg );
|
||||
void WriteBackRegisters ( CCodeSection * Section );
|
||||
void FixRoundModel ( CCodeSection * Section, CRegInfo::FPU_ROUND RoundMethod );
|
||||
|
||||
#endif
|
|
@ -1,32 +1,4 @@
|
|||
/*
|
||||
* Project 64 - A Nintendo 64 emulator.
|
||||
*
|
||||
* (c) Copyright 2001 zilmar (zilmar@emulation64.com) and
|
||||
* Jabo (jabo@emulation64.com).
|
||||
*
|
||||
* pj64 homepage: www.pj64.net
|
||||
*
|
||||
* Permission to use, copy, modify and distribute Project64 in both binary and
|
||||
* source form, for non-commercial purposes, is hereby granted without fee,
|
||||
* providing that this license information and copyright notice appear with
|
||||
* all copies and any derived work.
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event shall the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Project64 is freeware for PERSONAL USE only. Commercial users should
|
||||
* seek permission of the copyright holders first. Commercial use includes
|
||||
* charging money for Project64 or software derived from Project64.
|
||||
*
|
||||
* The copyright holders request that bug fixes and improvements to the code
|
||||
* should be forwarded to them so if they want them.
|
||||
*
|
||||
*/
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include "main.h"
|
||||
#include "CPU.h"
|
||||
#include "stdafx.h"
|
||||
|
||||
static HANDLE hSramFile = NULL;
|
||||
|
||||
|
@ -42,7 +14,7 @@ BOOL LoadSram (void) {
|
|||
LPVOID lpMsgBuf;
|
||||
|
||||
GetAutoSaveDir(Directory);
|
||||
sprintf(File,"%s%s.sra",Directory,RomName);
|
||||
sprintf(File,"%s%s.sra",Directory,g_RomName);
|
||||
|
||||
hSramFile = CreateFile(File,GENERIC_WRITE | GENERIC_READ, FILE_SHARE_READ,NULL,OPEN_ALWAYS,
|
||||
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS, NULL);
|
||||
|
|
|
@ -23,14 +23,6 @@
|
|||
* should be forwarded to them so if they want them.
|
||||
*
|
||||
*/
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void CloseSram ( void );
|
||||
void DmaFromSram ( BYTE * dest, int StartOffset, int len);
|
||||
void DmaToSram ( BYTE * Source, int StartOffset, int len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1,30 +1,5 @@
|
|||
/*
|
||||
* Project 64 - A Nintendo 64 emulator.
|
||||
*
|
||||
* (c) Copyright 2001 zilmar (zilmar@emulation64.com) and
|
||||
* Jabo (jabo@emulation64.com).
|
||||
*
|
||||
* pj64 homepage: www.pj64.net
|
||||
*
|
||||
* Permission to use, copy, modify and distribute Project64 in both binary and
|
||||
* source form, for non-commercial purposes, is hereby granted without fee,
|
||||
* providing that this license information and copyright notice appear with
|
||||
* all copies and any derived work.
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event shall the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Project64 is freeware for PERSONAL USE only. Commercial users should
|
||||
* seek permission of the copyright holders first. Commercial use includes
|
||||
* charging money for Project64 or software derived from Project64.
|
||||
*
|
||||
* The copyright holders request that bug fixes and improvements to the code
|
||||
* should be forwarded to them so if they want them.
|
||||
*
|
||||
*/
|
||||
#include <windows.h>
|
||||
#include "main.h"
|
||||
#include "stdafx.h"
|
||||
|
||||
#pragma comment(lib, "Winmm.lib")
|
||||
|
||||
/********************* Win32 Thread Timer ********************/
|
||||
|
@ -43,7 +18,7 @@ void Timer_Start(void) {
|
|||
timeGetDevCaps(&Caps, sizeof(Caps));
|
||||
if (timeBeginPeriod(Caps.wPeriodMin) == TIMERR_NOCANDO)
|
||||
{
|
||||
DisplayError("Error during timer begin");
|
||||
_Notify->DisplayError("Error during timer begin");
|
||||
}
|
||||
|
||||
FPSTimer.Frames = 0;
|
File diff suppressed because it is too large
Load Diff
|
@ -1,287 +0,0 @@
|
|||
#ifdef toremove
|
||||
|
||||
/*
|
||||
* Project 64 - A Nintendo 64 emulator.
|
||||
*
|
||||
* (c) Copyright 2001 zilmar (zilmar@emulation64.com) and
|
||||
* Jabo (jabo@emulation64.com).
|
||||
*
|
||||
* pj64 homepage: www.pj64.net
|
||||
*
|
||||
* Permission to use, copy, modify and distribute Project64 in both binary and
|
||||
* source form, for non-commercial purposes, is hereby granted without fee,
|
||||
* providing that this license information and copyright notice appear with
|
||||
* all copies and any derived work.
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event shall the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Project64 is freeware for PERSONAL USE only. Commercial users should
|
||||
* seek permission of the copyright holders first. Commercial use includes
|
||||
* charging money for Project64 or software derived from Project64.
|
||||
*
|
||||
* The copyright holders request that bug fixes and improvements to the code
|
||||
* should be forwarded to them so if they want them.
|
||||
*
|
||||
*/
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//Little hack to be able to get an address of a member class
|
||||
//with out looking at type safety
|
||||
void * GetAddressOf(int value, ...);
|
||||
#define AddressOf(Addr) GetAddressOf(5,(Addr))
|
||||
|
||||
enum x86RegValues {
|
||||
x86_Any = 0,x86_EAX,x86_EBX,x86_ECX,x86_EDX,x86_ESI,x86_EDI,x86_EBP, x86_ESP, x86_Any8Bit
|
||||
};
|
||||
|
||||
enum x86FpuValues {
|
||||
x86_ST0,x86_ST1,x86_ST2,x86_ST3,x86_ST4,x86_ST5,x86_ST6,x86_ST7
|
||||
};
|
||||
|
||||
#define x86_Name(Reg) (Reg) == x86_EAX ? "eax" : (Reg) == x86_EBX ? "ebx" :\
|
||||
(Reg) == x86_ECX ? "ecx" : (Reg) == x86_EDX ? "edx" :\
|
||||
(Reg) == x86_ESI ? "esi" : (Reg) == x86_EDI ? "edi" :\
|
||||
(Reg) == x86_ESP ? "esp" : (Reg) == x86_EBP ? "ebp" :\
|
||||
"Unknown x86 Register"
|
||||
|
||||
#define x86Byte_Name(Reg) (Reg) == x86_EAX ? "al" : (Reg) == x86_EBX ? "bl" :\
|
||||
(Reg) == x86_ECX ? "cl" : (Reg) == x86_EDX ? "dl" :\
|
||||
"Unknown x86 Register"
|
||||
|
||||
#define x86Half_Name(Reg) (Reg) == x86_EAX ? "ax" : (Reg) == x86_EBX ? "bx" :\
|
||||
(Reg) == x86_ECX ? "cx" : (Reg) == x86_EDX ? "dx" :\
|
||||
(Reg) == x86_ESI ? "si" : (Reg) == x86_EDI ? "di" :\
|
||||
(Reg) == x86_ESP ? "sp" : (Reg) == x86_EBP ? "bp" :\
|
||||
"Unknown x86 Register"
|
||||
|
||||
void WriteX86Comment ( const char * Label);
|
||||
void WriteX86Label ( const char * Label);
|
||||
|
||||
void AdcX86regToVariable ( int x86reg, void * Variable, const char * VariableName );
|
||||
void AdcConstToVariable ( void *Variable, const char * VariableName, BYTE Constant );
|
||||
void AdcConstToX86Reg ( int x86Reg, DWORD Const );
|
||||
void AdcVariableToX86reg ( int x86reg, void * Variable, const char * VariableName );
|
||||
void AdcX86RegToX86Reg ( int Destination, int Source );
|
||||
void AddConstToVariable ( DWORD Const, void *Variable, const char * VariableName );
|
||||
void AddConstToX86Reg ( int x86Reg, DWORD Const );
|
||||
void AddVariableToX86reg ( int x86reg, void * Variable, const char * VariableName );
|
||||
void AddX86regToVariable ( int x86reg, void * Variable, const char * VariableName );
|
||||
void AddX86RegToX86Reg ( int Destination, int Source );
|
||||
void AndConstToVariable ( DWORD Const, void *Variable, const char * VariableName );
|
||||
void AndConstToX86Reg ( int x86Reg, DWORD Const );
|
||||
void AndVariableToX86Reg ( void * Variable, const char * VariableName, int x86Reg );
|
||||
void AndVariableDispToX86Reg ( void * Variable, const char * VariableName, int x86Reg, int AddrReg, int Multiplier);
|
||||
void AndX86RegToX86Reg ( int Destination, int Source );
|
||||
void X86BreakPoint ( LPCSTR FileName, int LineNumber );
|
||||
void Call_Direct ( void * FunctAddress, char * FunctName );
|
||||
void Call_Indirect ( void * FunctAddress, char * FunctName );
|
||||
void CompConstToVariable ( DWORD Const, void * Variable, const char * VariableName );
|
||||
void CompConstToX86reg ( int x86Reg, DWORD Const );
|
||||
void CompX86regToVariable ( int x86Reg, void * Variable, const char * VariableName );
|
||||
void CompVariableToX86reg ( int x86Reg, void * Variable, const char * VariableName );
|
||||
void CompX86RegToX86Reg ( int Destination, int Source );
|
||||
void DecX86reg ( int x86Reg );
|
||||
void DivX86reg ( int x86reg );
|
||||
void idivX86reg ( int x86reg );
|
||||
void imulX86reg ( int x86reg );
|
||||
void IncX86reg ( int x86Reg );
|
||||
void JaeLabel8 ( char * Label, BYTE Value );
|
||||
void JaeLabel32 ( char * Label, DWORD Value );
|
||||
void JaLabel8 ( char * Label, BYTE Value );
|
||||
void JaLabel32 ( char * Label, DWORD Value );
|
||||
void JbLabel8 ( char * Label, BYTE Value );
|
||||
void JbLabel32 ( char * Label, DWORD Value );
|
||||
void JecxzLabel8 ( char * Label, BYTE Value );
|
||||
void JeLabel8 ( char * Label, BYTE Value );
|
||||
void JeLabel32 ( char * Label, DWORD Value );
|
||||
void JgeLabel32 ( char * Label, DWORD Value );
|
||||
void JgLabel8 ( char * Label, BYTE Value );
|
||||
void JgLabel32 ( char * Label, DWORD Value );
|
||||
void JleLabel8 ( char * Label, BYTE Value );
|
||||
void JleLabel32 ( char * Label, DWORD Value );
|
||||
void JlLabel8 ( char * Label, BYTE Value );
|
||||
void JlLabel32 ( char * Label, DWORD Value );
|
||||
void JmpDirectReg ( int x86reg );
|
||||
void JmpIndirectLabel32 ( char * Label, DWORD location );
|
||||
void JmpIndirectReg ( int x86reg );
|
||||
void JmpLabel8 ( char * Label, BYTE Value );
|
||||
void JmpLabel32 ( char * Label, DWORD Value );
|
||||
void JneLabel8 ( char * Label, BYTE Value );
|
||||
void JneLabel32 ( char * Label, DWORD Value );
|
||||
void JnsLabel8 ( char * Label, BYTE Value );
|
||||
void JnsLabel32 ( char * Label, DWORD Value );
|
||||
void JsLabel32 ( char * Label, DWORD Value );
|
||||
void LeaRegReg ( int x86RegDest, int x86RegSrc, int multiplier );
|
||||
void LeaSourceAndOffset ( int x86DestReg, int x86SourceReg, int offset );
|
||||
void MoveConstByteToN64Mem ( BYTE Const, int AddrReg );
|
||||
void MoveConstHalfToN64Mem ( WORD Const, int AddrReg );
|
||||
void MoveConstByteToVariable ( BYTE Const,void *Variable, const char * VariableName );
|
||||
void MoveConstByteToX86regPointer ( BYTE Const, int AddrReg1, int AddrReg2 );
|
||||
void MoveConstHalfToVariable ( WORD Const, void *Variable, const char * VariableName );
|
||||
void MoveConstHalfToX86regPointer ( WORD Const, int AddrReg1, int AddrReg2 );
|
||||
void MoveConstToMemoryDisp ( DWORD Const, int AddrReg, DWORD Disp );
|
||||
void MoveConstToN64Mem ( DWORD Const, int AddrReg );
|
||||
void MoveConstToN64MemDisp ( DWORD Const, int AddrReg, BYTE Disp );
|
||||
void MoveConstToVariable ( DWORD Const, void *Variable, const char * VariableName );
|
||||
void MoveConstToX86Pointer ( DWORD Const, int X86Pointer );
|
||||
void MoveConstToX86reg ( DWORD Const, int x86reg );
|
||||
void MoveConstToX86regPointer ( DWORD Const, int AddrReg1, int AddrReg2 );
|
||||
void MoveN64MemDispToX86reg ( int x86reg, int AddrReg, BYTE Disp );
|
||||
void MoveN64MemToX86reg ( int x86reg, int AddrReg );
|
||||
void MoveN64MemToX86regByte ( int x86reg, int AddrReg );
|
||||
void MoveN64MemToX86regHalf ( int x86reg, int AddrReg );
|
||||
void MoveSxByteX86regPointerToX86reg ( int AddrReg1, int AddrReg2, int x86reg );
|
||||
void MoveSxHalfX86regPointerToX86reg ( int AddrReg1, int AddrReg2, int x86reg );
|
||||
void MoveSxN64MemToX86regByte ( int x86reg, int AddrReg );
|
||||
void MoveSxN64MemToX86regHalf ( int x86reg, int AddrReg );
|
||||
void MoveSxVariableToX86regByte ( void *Variable, const char * VariableName, int x86reg );
|
||||
void MoveSxVariableToX86regHalf ( void *Variable, const char * VariableName, int x86reg );
|
||||
void MoveVariableDispToX86Reg ( void *Variable, const char * VariableName, int x86Reg, int AddrReg, int Multiplier );
|
||||
void MoveVariableToX86reg ( void *Variable, const char * VariableName, int x86reg );
|
||||
void MoveVariableToX86regByte ( void *Variable, const char * VariableName, int x86reg );
|
||||
void MoveVariableToX86regHalf ( void *Variable, const char * VariableName, int x86reg );
|
||||
void MoveX86PointerToX86reg ( int x86reg, int X86Pointer );
|
||||
void MoveX86PointerToX86regDisp ( int x86reg, int X86Pointer, BYTE Disp );
|
||||
void MoveX86regByteToN64Mem ( int x86reg, int AddrReg );
|
||||
void MoveX86regByteToVariable ( int x86reg, void * Variable, const char * VariableName );
|
||||
void MoveX86regByteToX86regPointer ( int x86reg, int AddrReg1, int AddrReg2 );
|
||||
void MoveX86regHalfToN64Mem ( int x86reg, int AddrReg );
|
||||
void MoveX86regHalfToVariable ( int x86reg, void * Variable, const char * VariableName );
|
||||
void MoveX86regHalfToX86regPointer ( int x86reg, int AddrReg1, int AddrReg2 );
|
||||
void MoveX86regPointerToX86reg ( int AddrReg1, int AddrReg2, int x86reg );
|
||||
void MoveX86regPointerToX86regDisp8 ( int AddrReg1, int AddrReg2, int x86reg, BYTE offset );
|
||||
void MoveX86regToMemory ( int x86reg, int AddrReg, DWORD Disp );
|
||||
void MoveX86regToN64Mem ( int x86reg, int AddrReg );
|
||||
void MoveX86regToN64MemDisp ( int x86reg, int AddrReg, BYTE Disp );
|
||||
void MoveX86regToVariable ( int x86reg, void * Variable, const char * VariableName );
|
||||
void MoveX86RegToX86Reg ( int Source, int Destination );
|
||||
void MoveX86regToX86Pointer ( int x86reg, int X86Pointer );
|
||||
void MoveX86regToX86regPointer ( int x86reg, int AddrReg1, int AddrReg2 );
|
||||
void MoveZxByteX86regPointerToX86reg ( int AddrReg1, int AddrReg2, int x86reg );
|
||||
void MoveZxHalfX86regPointerToX86reg ( int AddrReg1, int AddrReg2, int x86reg );
|
||||
void MoveZxN64MemToX86regByte ( int x86reg, int AddrReg );
|
||||
void MoveZxN64MemToX86regHalf ( int x86reg, int AddrReg );
|
||||
void MoveZxVariableToX86regByte ( void *Variable, const char * VariableName, int x86reg );
|
||||
void MoveZxVariableToX86regHalf ( void *Variable, const char * VariableName, int x86reg );
|
||||
void MulX86reg ( int x86reg );
|
||||
void NotX86Reg ( int x86Reg );
|
||||
void OrConstToVariable ( DWORD Const, void * Variable, const char * VariableName );
|
||||
void OrConstToX86Reg ( DWORD Const, int x86Reg );
|
||||
void OrVariableToX86Reg ( void * Variable, const char * VariableName, int x86Reg );
|
||||
void OrX86RegToVariable ( void * Variable, const char * VariableName, int x86Reg );
|
||||
void OrX86RegToX86Reg ( int Destination, int Source );
|
||||
void Popad ( void );
|
||||
void Pushad ( void );
|
||||
void Push ( int x86reg );
|
||||
void Pop ( int x86reg );
|
||||
void PushImm32 ( char * String, DWORD Value );
|
||||
void Ret ( void );
|
||||
void Seta ( int x86reg );
|
||||
void Setae ( int x86reg );
|
||||
void SetaVariable ( void * Variable, const char * VariableName );
|
||||
void Setb ( int x86reg );
|
||||
void SetbVariable ( void * Variable, const char * VariableName );
|
||||
void Setg ( int x86reg );
|
||||
void SetgVariable ( void * Variable, const char * VariableName );
|
||||
void Setl ( int x86reg );
|
||||
void SetlVariable ( void * Variable, const char * VariableName );
|
||||
void Setz ( int x86reg );
|
||||
void Setnz ( int x86reg );
|
||||
void ShiftLeftDouble ( int Destination, int Source );
|
||||
void ShiftLeftDoubleImmed ( int Destination, int Source, BYTE Immediate );
|
||||
void ShiftLeftSign ( int x86reg );
|
||||
void ShiftLeftSignImmed ( int x86reg, BYTE Immediate );
|
||||
void ShiftRightDouble ( int Destination, int Source );
|
||||
void ShiftRightDoubleImmed ( int Destination, int Source, BYTE Immediate );
|
||||
void ShiftRightSign ( int x86reg );
|
||||
void ShiftRightSignImmed ( int x86reg, BYTE Immediate );
|
||||
void ShiftRightUnsign ( int x86reg );
|
||||
void ShiftRightUnsignImmed ( int x86reg, BYTE Immediate );
|
||||
void SbbConstFromX86Reg ( int x86Reg, DWORD Const );
|
||||
void SbbVariableFromX86reg ( int x86reg, void * Variable, const char * VariableName );
|
||||
void SbbX86RegToX86Reg ( int Destination, int Source );
|
||||
void SubConstFromVariable ( DWORD Const, void *Variable, const char * VariableName );
|
||||
void SubConstFromX86Reg ( int x86Reg, DWORD Const );
|
||||
void SubVariableFromX86reg ( int x86reg, void * Variable, const char * VariableName );
|
||||
void SubX86RegToX86Reg ( int Destination, int Source );
|
||||
void TestConstToX86Reg ( DWORD Const, int x86reg );
|
||||
void TestVariable ( DWORD Const, void * Variable, const char * VariableName );
|
||||
void TestX86RegToX86Reg ( int Destination, int Source );
|
||||
void XorConstToX86Reg ( int x86Reg, DWORD Const );
|
||||
void XorX86RegToX86Reg ( int Source, int Destination );
|
||||
void XorVariableToX86reg ( void *Variable, const char * VariableName, int x86reg );
|
||||
|
||||
|
||||
void fpuAbs ( void );
|
||||
void fpuAddDword ( void *Variable, const char * VariableName );
|
||||
void fpuAddDwordRegPointer ( int x86Pointer );
|
||||
void fpuAddQword ( void *Variable, const char * VariableName );
|
||||
void fpuAddQwordRegPointer ( int x86Pointer );
|
||||
void fpuAddReg ( int x86reg );
|
||||
void fpuAddRegPop ( int * StackPos, int x86reg );
|
||||
void fpuComDword ( void *Variable, const char * VariableName, BOOL Pop );
|
||||
void fpuComDwordRegPointer ( int x86Pointer, BOOL Pop );
|
||||
void fpuComQword ( void *Variable, const char * VariableName, BOOL Pop );
|
||||
void fpuComQwordRegPointer ( int x86Pointer, BOOL Pop );
|
||||
void fpuComReg ( int x86reg, BOOL Pop );
|
||||
void fpuDivDword ( void *Variable, const char * VariableName );
|
||||
void fpuDivDwordRegPointer ( int x86Pointer );
|
||||
void fpuDivQword ( void *Variable, const char * VariableName );
|
||||
void fpuDivQwordRegPointer ( int x86Pointer );
|
||||
void fpuDivReg ( int Reg );
|
||||
void fpuDivRegPop ( int x86reg );
|
||||
void fpuExchange ( int Reg );
|
||||
void fpuFree ( int Reg );
|
||||
void fpuDecStack ( int * StackPos );
|
||||
void fpuIncStack ( int * StackPos );
|
||||
void fpuLoadControl ( void *Variable, const char * VariableName );
|
||||
void fpuLoadDword ( int * StackPos, void *Variable, const char * VariableName );
|
||||
void fpuLoadDwordFromX86Reg ( int * StackPos, int x86reg );
|
||||
void fpuLoadDwordFromN64Mem ( int * StackPos, int x86reg );
|
||||
void fpuLoadInt32bFromN64Mem ( int * StackPos, int x86reg );
|
||||
void fpuLoadIntegerDword ( int * StackPos, void *Variable, const char * VariableName );
|
||||
void fpuLoadIntegerDwordFromX86Reg ( int * StackPos,int x86Reg );
|
||||
void fpuLoadIntegerQword ( int * StackPos, void *Variable, const char * VariableName );
|
||||
void fpuLoadIntegerQwordFromX86Reg ( int * StackPos,int x86Reg );
|
||||
void fpuLoadQword ( int * StackPos, void *Variable, const char * VariableName );
|
||||
void fpuLoadQwordFromX86Reg ( int * StackPos, int x86Reg );
|
||||
void fpuLoadQwordFromN64Mem ( int * StackPos, int x86reg );
|
||||
void fpuLoadReg ( int * StackPos, int Reg );
|
||||
void fpuMulDword ( void *Variable, const char * VariableName);
|
||||
void fpuMulDwordRegPointer ( int x86Pointer );
|
||||
void fpuMulQword ( void *Variable, const char * VariableName);
|
||||
void fpuMulQwordRegPointer ( int x86Pointer );
|
||||
void fpuMulReg ( int x86reg );
|
||||
void fpuMulRegPop ( int x86reg );
|
||||
void fpuNeg ( void );
|
||||
void fpuRound ( void );
|
||||
void fpuSqrt ( void );
|
||||
void fpuStoreControl ( void *Variable, const char * VariableName );
|
||||
void fpuStoreDword ( int * StackPos, void *Variable, const char * VariableName, BOOL pop );
|
||||
void fpuStoreDwordFromX86Reg ( int * StackPos,int x86Reg, BOOL pop );
|
||||
void fpuStoreDwordToN64Mem ( int * StackPos, int x86reg, BOOL Pop );
|
||||
void fpuStoreIntegerDword ( int * StackPos, void *Variable, const char * VariableName, BOOL pop );
|
||||
void fpuStoreIntegerDwordFromX86Reg ( int * StackPos,int x86Reg, BOOL pop );
|
||||
void fpuStoreIntegerQword ( int * StackPos, void *Variable, const char * VariableName, BOOL pop );
|
||||
void fpuStoreIntegerQwordFromX86Reg ( int * StackPos, int x86Reg, BOOL pop );
|
||||
void fpuStoreQword ( int * StackPos, void *Variable, const char * VariableName, BOOL pop );
|
||||
void fpuStoreQwordFromX86Reg ( int * StackPos, int x86Reg, BOOL pop );
|
||||
void fpuStoreStatus ( void );
|
||||
void fpuSubDword ( void *Variable, const char * VariableName );
|
||||
void fpuSubDwordRegPointer ( int x86Pointer );
|
||||
void fpuSubDwordReverse ( void *Variable, const char * VariableName );
|
||||
void fpuSubQword ( void *Variable, const char * VariableName );
|
||||
void fpuSubQwordRegPointer ( int x86Pointer );
|
||||
void fpuSubQwordReverse ( void *Variable, const char * VariableName );
|
||||
void fpuSubReg ( int x86reg );
|
||||
void fpuSubRegPop ( int x86reg );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -1,32 +1,4 @@
|
|||
/*
|
||||
* Project 64 - A Nintendo 64 emulator.
|
||||
*
|
||||
* (c) Copyright 2001 zilmar (zilmar@emulation64.com) and
|
||||
* Jabo (jabo@emulation64.com).
|
||||
*
|
||||
* pj64 homepage: www.pj64.net
|
||||
*
|
||||
* Permission to use, copy, modify and distribute Project64 in both binary and
|
||||
* source form, for non-commercial purposes, is hereby granted without fee,
|
||||
* providing that this license information and copyright notice appear with
|
||||
* all copies and any derived work.
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event shall the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Project64 is freeware for PERSONAL USE only. Commercial users should
|
||||
* seek permission of the copyright holders first. Commercial use includes
|
||||
* charging money for Project64 or software derived from Project64.
|
||||
*
|
||||
* The copyright holders request that bug fixes and improvements to the code
|
||||
* should be forwarded to them so if they want them.
|
||||
*
|
||||
*/
|
||||
#include <STDIO.H>
|
||||
#include "main.h"
|
||||
#include "CPU.h"
|
||||
#include "debugger.h"
|
||||
#include "stdafx.h"
|
||||
|
||||
#define FPR_Type(Reg) (Reg) == R4300i_COP1_S ? "S" : (Reg) == R4300i_COP1_D ? "D" :\
|
||||
(Reg) == R4300i_COP1_W ? "W" : "L"
|
||||
|
|
|
@ -42,26 +42,6 @@
|
|||
(Reg) == x86_ST6 ? "ST(6)" : (Reg) == x86_ST7 ? "ST(7)" :\
|
||||
"Unknown x86fpu Register"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void fpuDivDwordReverse(void *Variable, const char * VariableName) {
|
||||
CPU_Message(" fdivr ST(0), dword ptr [%s]", VariableName);
|
||||
|
|
|
@ -53,7 +53,7 @@ LRESULT CDumpMemory::OnClicked(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& b
|
|||
openfilename.lpstrInitialDir = Directory;
|
||||
openfilename.nMaxFile = MAX_PATH;
|
||||
openfilename.Flags = OFN_HIDEREADONLY;
|
||||
_N64System->ExternalEvent(PauseCPU_DumpMemory);
|
||||
_N64System->ExternalEvent(SysEvent_PauseCPU_DumpMemory);
|
||||
if (GetOpenFileName (&openfilename))
|
||||
{
|
||||
char drive[_MAX_DRIVE], dir[_MAX_DIR], fname[_MAX_FNAME], ext[_MAX_EXT];
|
||||
|
@ -64,7 +64,7 @@ LRESULT CDumpMemory::OnClicked(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& b
|
|||
}
|
||||
SetDlgItemText(IDC_FILENAME,FileName);
|
||||
}
|
||||
_N64System->ExternalEvent(ResumeCPU_DumpMemory);
|
||||
_N64System->ExternalEvent(SysEvent_ResumeCPU_DumpMemory);
|
||||
}
|
||||
break;
|
||||
case IDOK:
|
||||
|
@ -96,14 +96,14 @@ LRESULT CDumpMemory::OnClicked(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& b
|
|||
::EnableWindow(GetDlgItem(IDC_FORMAT),FALSE);
|
||||
::EnableWindow(GetDlgItem(IDOK),FALSE);
|
||||
::EnableWindow(GetDlgItem(IDCANCEL),FALSE);
|
||||
_N64System->ExternalEvent(PauseCPU_DumpMemory);
|
||||
_N64System->ExternalEvent(SysEvent_PauseCPU_DumpMemory);
|
||||
if (!DumpMemory(FileName,Format,StartPC,EndPC,DumpPC))
|
||||
{
|
||||
//enable buttons
|
||||
_N64System->ExternalEvent(ResumeCPU_DumpMemory);
|
||||
_N64System->ExternalEvent(SysEvent_ResumeCPU_DumpMemory);
|
||||
return false;
|
||||
}
|
||||
_N64System->ExternalEvent(ResumeCPU_DumpMemory);
|
||||
_N64System->ExternalEvent(SysEvent_ResumeCPU_DumpMemory);
|
||||
}
|
||||
EndDialog(0);
|
||||
break;
|
||||
|
|
|
@ -125,23 +125,23 @@ LRESULT CDebugMemorySearch::OnClicked(WORD wNotifyCode, WORD wID, HWND hWndCtl,
|
|||
case IDC_BTN_SEARCH:
|
||||
if (SendMessage(GetDlgItem(IDC_RADIO_UNKNOWN),BM_GETSTATE, 0,0) == BST_CHECKED)
|
||||
{
|
||||
m_System->ExternalEvent(PauseCPU_SearchMemory);
|
||||
m_System->ExternalEvent(SysEvent_PauseCPU_SearchMemory);
|
||||
SearchForUnknown();
|
||||
m_System->ExternalEvent(ResumeCPU_SearchMemory);
|
||||
m_System->ExternalEvent(SysEvent_ResumeCPU_SearchMemory);
|
||||
break;
|
||||
}
|
||||
if (SendMessage(GetDlgItem(IDC_RADIO_VALUE),BM_GETSTATE, 0,0) == BST_CHECKED)
|
||||
{
|
||||
m_System->ExternalEvent(PauseCPU_SearchMemory);
|
||||
m_System->ExternalEvent(SysEvent_PauseCPU_SearchMemory);
|
||||
SearchForValue();
|
||||
m_System->ExternalEvent(ResumeCPU_SearchMemory);
|
||||
m_System->ExternalEvent(SysEvent_ResumeCPU_SearchMemory);
|
||||
break;
|
||||
}
|
||||
if (SendMessage(GetDlgItem(IDC_RADIO_TEXT),BM_GETSTATE, 0,0) == BST_CHECKED)
|
||||
{
|
||||
m_System->ExternalEvent(PauseCPU_SearchMemory);
|
||||
m_System->ExternalEvent(SysEvent_PauseCPU_SearchMemory);
|
||||
SearchForText();
|
||||
m_System->ExternalEvent(ResumeCPU_SearchMemory);
|
||||
m_System->ExternalEvent(SysEvent_ResumeCPU_SearchMemory);
|
||||
break;
|
||||
}
|
||||
case IDC_RESET_BUTTON:
|
||||
|
|
|
@ -11,7 +11,7 @@ class CDebugger
|
|||
|
||||
protected:
|
||||
CDebugger();
|
||||
~CDebugger();
|
||||
virtual ~CDebugger();
|
||||
|
||||
public:
|
||||
|
||||
|
|
|
@ -8,90 +8,6 @@ void ExecuteInterpreterOps (DWORD Cycles)
|
|||
_Notify->BreakPoint(__FILE__,__LINE__);
|
||||
}
|
||||
|
||||
void DoSomething ( void ) {
|
||||
if (g_CPU_Action->CloseCPU) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (g_CPU_Action->SoftReset)
|
||||
{
|
||||
g_CPU_Action->SoftReset = false;
|
||||
|
||||
_SystemTimer->SetTimer(CSystemTimer::SoftResetTimer,0x3000000,false);
|
||||
ShowCFB();
|
||||
_Reg->FAKE_CAUSE_REGISTER |= CAUSE_IP4;
|
||||
CheckInterrupts();
|
||||
_Plugins->Gfx()->SoftReset();
|
||||
}
|
||||
|
||||
if (g_CPU_Action->GenerateInterrupt)
|
||||
{
|
||||
g_CPU_Action->GenerateInterrupt = FALSE;
|
||||
_Reg->MI_INTR_REG |= g_CPU_Action->InterruptFlag;
|
||||
g_CPU_Action->InterruptFlag = 0;
|
||||
CheckInterrupts();
|
||||
}
|
||||
if (g_CPU_Action->CheckInterrupts) {
|
||||
g_CPU_Action->CheckInterrupts = FALSE;
|
||||
CheckInterrupts();
|
||||
}
|
||||
if (g_CPU_Action->ProfileStartStop) {
|
||||
g_CPU_Action->ProfileStartStop = FALSE;
|
||||
ResetTimer();
|
||||
}
|
||||
if (g_CPU_Action->ProfileResetStats) {
|
||||
g_CPU_Action->ProfileResetStats = FALSE;
|
||||
ResetTimer();
|
||||
}
|
||||
if (g_CPU_Action->ProfileGenerateLogs) {
|
||||
g_CPU_Action->ProfileGenerateLogs = FALSE;
|
||||
GenerateProfileLog();
|
||||
}
|
||||
|
||||
if (g_CPU_Action->DoInterrupt) {
|
||||
g_CPU_Action->DoInterrupt = FALSE;
|
||||
if (DoIntrException(FALSE) && !g_CPU_Action->InterruptExecuted)
|
||||
{
|
||||
g_CPU_Action->InterruptExecuted = TRUE;
|
||||
ClearRecompCodeInitialCode();
|
||||
}
|
||||
}
|
||||
|
||||
if (g_CPU_Action->ChangeWindow) {
|
||||
g_CPU_Action->ChangeWindow = FALSE;
|
||||
ChangeFullScreenFunc();
|
||||
}
|
||||
|
||||
if (g_CPU_Action->Pause) {
|
||||
PauseExecution();
|
||||
g_CPU_Action->Pause = FALSE;
|
||||
}
|
||||
if (g_CPU_Action->ChangePlugin) {
|
||||
ChangePluginFunc();
|
||||
g_CPU_Action->ChangePlugin = FALSE;
|
||||
}
|
||||
if (g_CPU_Action->GSButton) {
|
||||
ApplyGSButtonCheats();
|
||||
g_CPU_Action->GSButton = FALSE;
|
||||
}
|
||||
|
||||
g_CPU_Action->DoSomething = FALSE;
|
||||
|
||||
if (g_CPU_Action->SaveState) {
|
||||
//test if allowed
|
||||
g_CPU_Action->SaveState = FALSE;
|
||||
if (!Machine_SaveState()) {
|
||||
g_CPU_Action->SaveState = TRUE;
|
||||
g_CPU_Action->DoSomething = TRUE;
|
||||
}
|
||||
}
|
||||
if (g_CPU_Action->RestoreState) {
|
||||
g_CPU_Action->RestoreState = FALSE;
|
||||
Machine_LoadState();
|
||||
}
|
||||
if (g_CPU_Action->DoInterrupt == TRUE) { g_CPU_Action->DoSomething = TRUE; }
|
||||
}
|
||||
|
||||
int DelaySlotEffectsCompare (DWORD PC, DWORD Reg1, DWORD Reg2) {
|
||||
OPCODE Command;
|
||||
|
||||
|
@ -253,12 +169,6 @@ int DelaySlotEffectsCompare (DWORD PC, DWORD Reg1, DWORD Reg2) {
|
|||
|
||||
void InPermLoop (void) {
|
||||
// *** Changed ***/
|
||||
if (g_CPU_Action->DoInterrupt)
|
||||
{
|
||||
g_CPU_Action->DoSomething = TRUE;
|
||||
return;
|
||||
}
|
||||
|
||||
//if (CPU_Type == CPU_SyncCores) { SyncRegisters.CP0[9] +=5; }
|
||||
|
||||
/* Interrupts enabled */
|
||||
|
@ -281,12 +191,12 @@ void InPermLoop (void) {
|
|||
return;
|
||||
|
||||
InterruptsDisabled:
|
||||
if (UpdateScreen != NULL) { UpdateScreen(); }
|
||||
if (_Plugins->Gfx()->UpdateScreen != NULL) { _Plugins->Gfx()->UpdateScreen(); }
|
||||
//CurrentFrame = 0;
|
||||
//CurrentPercent = 0;
|
||||
//DisplayFPS();
|
||||
DisplayError(GS(MSG_PERM_LOOP));
|
||||
StopEmulation();
|
||||
_N64System->CloseCpu();
|
||||
|
||||
}
|
||||
|
||||
|
@ -318,6 +228,8 @@ void CInterpreterCPU::ExecuteCPU (void )
|
|||
OPCODE & Opcode = R4300iOp::m_Opcode;
|
||||
DWORD & JumpToLocation = R4300iOp::m_JumpToLocation;
|
||||
BOOL & TestTimer = R4300iOp::m_TestTimer;
|
||||
const BOOL & bDoSomething= _SystemEvents->DoSomething();
|
||||
int & NextTimer = *_NextTimer;
|
||||
|
||||
BuildCPU();
|
||||
|
||||
|
@ -333,7 +245,7 @@ void CInterpreterCPU::ExecuteCPU (void )
|
|||
//WriteTraceF((TraceType)(TraceError | TraceNoHeader),"%X: %s t9: %08X v1: %08X",*_PROGRAM_COUNTER,R4300iOpcodeName(Opcode.Hex,*_PROGRAM_COUNTER),_GPR[0x19].UW[0],_GPR[0x03].UW[0]);
|
||||
//WriteTraceF((TraceType)(TraceError | TraceNoHeader),"%X: %d %d",*_PROGRAM_COUNTER,*_NextTimer,_SystemTimer->CurrentType());
|
||||
}*/
|
||||
*_NextTimer -= m_CountPerOp;
|
||||
NextTimer -= m_CountPerOp;
|
||||
m_R4300i_Opcode[ Opcode.op ]();
|
||||
|
||||
switch (R4300iOp::m_NextInstruction)
|
||||
|
@ -353,16 +265,19 @@ void CInterpreterCPU::ExecuteCPU (void )
|
|||
if (CheckTimer)
|
||||
{
|
||||
TestTimer = FALSE;
|
||||
if (*_NextTimer < 0)
|
||||
if (NextTimer < 0)
|
||||
{
|
||||
_SystemTimer->TimerDone();
|
||||
}
|
||||
if (g_CPU_Action->DoSomething) { DoSomething(); }
|
||||
if (bDoSomething)
|
||||
{
|
||||
_SystemEvents->ExecuteEvents();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
DoTLBMiss(R4300iOp::m_NextInstruction == JUMP,PROGRAM_COUNTER);
|
||||
_Reg->DoTLBMiss(R4300iOp::m_NextInstruction == JUMP,PROGRAM_COUNTER);
|
||||
R4300iOp::m_NextInstruction = NORMAL;
|
||||
}
|
||||
}
|
||||
|
@ -380,6 +295,7 @@ void CInterpreterCPU::ExecuteOps ( int Cycles )
|
|||
OPCODE & Opcode = R4300iOp::m_Opcode;
|
||||
DWORD & JumpToLocation = R4300iOp::m_JumpToLocation;
|
||||
BOOL & TestTimer = R4300iOp::m_TestTimer;
|
||||
const BOOL & DoSomething = _SystemEvents->DoSomething();
|
||||
|
||||
__try
|
||||
{
|
||||
|
@ -423,12 +339,15 @@ void CInterpreterCPU::ExecuteOps ( int Cycles )
|
|||
{
|
||||
_SystemTimer->TimerDone();
|
||||
}
|
||||
if (g_CPU_Action->DoSomething) { DoSomething(); }
|
||||
if (DoSomething)
|
||||
{
|
||||
_SystemEvents->ExecuteEvents();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
DoTLBMiss(R4300iOp::m_NextInstruction == JUMP,PROGRAM_COUNTER);
|
||||
_Reg->DoTLBMiss(R4300iOp::m_NextInstruction == JUMP,PROGRAM_COUNTER);
|
||||
R4300iOp::m_NextInstruction = NORMAL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
#include "stdafx.h"
|
||||
#include "../C Core/Logging.h"
|
||||
//#include "../C Core/Logging.h"
|
||||
|
||||
void InPermLoop ( void );
|
||||
int DelaySlotEffectsCompare ( DWORD PC, DWORD Reg1, DWORD Reg2 );
|
||||
|
||||
#define ADDRESS_ERROR_EXCEPTION(Address,FromRead) \
|
||||
DoAddressError(m_NextInstruction == JUMP,Address,FromRead);\
|
||||
_Reg->DoAddressError(m_NextInstruction == JUMP,Address,FromRead);\
|
||||
m_NextInstruction = JUMP;\
|
||||
m_JumpToLocation = (*_PROGRAM_COUNTER);\
|
||||
return;
|
||||
|
@ -13,14 +13,14 @@ int DelaySlotEffectsCompare ( DWORD PC, DWORD Reg1, DWORD Reg2 );
|
|||
//#define TEST_COP1_USABLE_EXCEPTION
|
||||
#define TEST_COP1_USABLE_EXCEPTION \
|
||||
if ((_Reg->STATUS_REGISTER & STATUS_CU1) == 0) {\
|
||||
DoCopUnusableException(m_NextInstruction == JUMP,1);\
|
||||
_Reg->DoCopUnusableException(m_NextInstruction == JUMP,1);\
|
||||
m_NextInstruction = JUMP;\
|
||||
m_JumpToLocation = (*_PROGRAM_COUNTER);\
|
||||
return;\
|
||||
}
|
||||
|
||||
#define TLB_READ_EXCEPTION(Address) \
|
||||
DoTLBMiss(m_NextInstruction == JUMP,Address);\
|
||||
_Reg->DoTLBMiss(m_NextInstruction == JUMP,Address);\
|
||||
m_NextInstruction = JUMP;\
|
||||
m_JumpToLocation = (*_PROGRAM_COUNTER);\
|
||||
return;
|
||||
|
@ -1079,7 +1079,7 @@ void R4300iOp32::LWC1 (void) {
|
|||
DWORD Address = _GPR[m_Opcode.base].UW[0] + (DWORD)((short)m_Opcode.offset);
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
if ((Address & 3) != 0) { ADDRESS_ERROR_EXCEPTION(Address,TRUE); }
|
||||
if (!_MMU->LW_VAddr(Address,*(DWORD *)_FPRFloatLocation[m_Opcode.ft])) {
|
||||
if (!_MMU->LW_VAddr(Address,*(DWORD *)_FPR_S[m_Opcode.ft])) {
|
||||
if (g_ShowTLBMisses) {
|
||||
DisplayError("LWC1 TLB: %X",Address);
|
||||
}
|
||||
|
@ -1106,7 +1106,7 @@ void R4300iOp32::SWC1 (void) {
|
|||
TEST_COP1_USABLE_EXCEPTION
|
||||
if ((Address & 3) != 0) { ADDRESS_ERROR_EXCEPTION(Address,FALSE); }
|
||||
|
||||
if (!_MMU->SW_VAddr(Address,*(DWORD *)_FPRFloatLocation[m_Opcode.ft])) {
|
||||
if (!_MMU->SW_VAddr(Address,*(DWORD *)_FPR_S[m_Opcode.ft])) {
|
||||
#ifndef EXTERNAL_RELEASE
|
||||
DisplayError("SWC1 TLB: %X",Address);
|
||||
#endif
|
||||
|
@ -1153,13 +1153,13 @@ void R4300iOp32::SPECIAL_JALR (void) {
|
|||
}
|
||||
|
||||
void R4300iOp32::SPECIAL_SYSCALL (void) {
|
||||
DoSysCallException(m_NextInstruction == JUMP);
|
||||
_Reg->DoSysCallException(m_NextInstruction == JUMP);
|
||||
m_NextInstruction = JUMP;
|
||||
m_JumpToLocation = (*_PROGRAM_COUNTER);
|
||||
}
|
||||
|
||||
void R4300iOp32::SPECIAL_BREAK (void) {
|
||||
DoBreakException(m_NextInstruction == JUMP);
|
||||
_Reg->DoBreakException(m_NextInstruction == JUMP);
|
||||
m_NextInstruction = JUMP;
|
||||
m_JumpToLocation = (*_PROGRAM_COUNTER);
|
||||
}
|
||||
|
@ -1400,7 +1400,7 @@ void R4300iOp32::COP0_MT (void) {
|
|||
DisplayError("Left kernel mode ??");
|
||||
#endif
|
||||
}
|
||||
CheckInterrupts();
|
||||
_Reg->CheckInterrupts();
|
||||
break;
|
||||
case 13: //cause
|
||||
_CP0[m_Opcode.rd] &= 0xFFFFCFF;
|
||||
|
@ -1416,17 +1416,17 @@ void R4300iOp32::COP0_MT (void) {
|
|||
/************************** COP0 CO functions ***********************/
|
||||
void R4300iOp32::COP0_CO_TLBR (void) {
|
||||
if (!g_UseTlb) { return; }
|
||||
TLB_ReadEntry();
|
||||
_TLB->ReadEntry();
|
||||
}
|
||||
|
||||
void R4300iOp32::COP0_CO_TLBWI (void) {
|
||||
if (!g_UseTlb) { return; }
|
||||
TLB_WriteEntry(_Reg->INDEX_REGISTER & 0x1F,FALSE);
|
||||
_TLB->WriteEntry(_Reg->INDEX_REGISTER & 0x1F,FALSE);
|
||||
}
|
||||
|
||||
void R4300iOp32::COP0_CO_TLBWR (void) {
|
||||
if (!g_UseTlb) { return; }
|
||||
TLB_WriteEntry(_Reg->RANDOM_REGISTER & 0x1F,TRUE);
|
||||
_TLB->WriteEntry(_Reg->RANDOM_REGISTER & 0x1F,true);
|
||||
}
|
||||
|
||||
void R4300iOp32::COP0_CO_TLBP (void) {
|
||||
|
@ -1444,19 +1444,19 @@ void R4300iOp32::COP0_CO_ERET (void) {
|
|||
_Reg->STATUS_REGISTER &= ~STATUS_EXL;
|
||||
}
|
||||
(*_LLBit) = 0;
|
||||
CheckInterrupts();
|
||||
_Reg->CheckInterrupts();
|
||||
m_TestTimer = TRUE;
|
||||
}
|
||||
|
||||
/************************** COP1 functions **************************/
|
||||
void R4300iOp32::COP1_MF (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_GPR[m_Opcode.rt].W[0] = *(int *)_FPRFloatLocation[m_Opcode.fs];
|
||||
_GPR[m_Opcode.rt].W[0] = *(int *)_FPR_S[m_Opcode.fs];
|
||||
}
|
||||
|
||||
void R4300iOp32::COP1_DMF (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_GPR[m_Opcode.rt].W[0] = *(__int64 *)_FPRDoubleLocation[m_Opcode.fs];
|
||||
_GPR[m_Opcode.rt].W[0] = *(__int64 *)_FPR_D[m_Opcode.fs];
|
||||
}
|
||||
|
||||
void R4300iOp32::COP1_CF (void) {
|
||||
|
@ -1472,12 +1472,12 @@ void R4300iOp32::COP1_CF (void) {
|
|||
|
||||
void R4300iOp32::COP1_MT (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
*(int *)_FPRFloatLocation[m_Opcode.fs] = _GPR[m_Opcode.rt].W[0];
|
||||
*(int *)_FPR_S[m_Opcode.fs] = _GPR[m_Opcode.rt].W[0];
|
||||
}
|
||||
|
||||
void R4300iOp32::COP1_DMT (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
*(__int64 *)_FPRDoubleLocation[m_Opcode.fs] = _GPR[m_Opcode.rt].W[0];
|
||||
*(__int64 *)_FPR_D[m_Opcode.fs] = _GPR[m_Opcode.rt].W[0];
|
||||
}
|
||||
|
||||
void R4300iOp32::COP1_CT (void) {
|
||||
|
@ -1485,10 +1485,10 @@ void R4300iOp32::COP1_CT (void) {
|
|||
if (m_Opcode.fs == 31) {
|
||||
_FPCR[m_Opcode.fs] = _GPR[m_Opcode.rt].W[0];
|
||||
switch((_FPCR[m_Opcode.fs] & 3)) {
|
||||
case 0: RoundingModel = _RC_NEAR; break;
|
||||
case 1: RoundingModel = _RC_CHOP; break;
|
||||
case 2: RoundingModel = _RC_UP; break;
|
||||
case 3: RoundingModel = _RC_DOWN; break;
|
||||
case 0: *_RoundingModel = ROUND_NEAR; break;
|
||||
case 1: *_RoundingModel = ROUND_CHOP; break;
|
||||
case 2: *_RoundingModel = ROUND_UP; break;
|
||||
case 3: *_RoundingModel = ROUND_DOWN; break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -1560,110 +1560,110 @@ __inline void Float_RoundToInteger64( __int64 * Dest, float * Source ) {
|
|||
|
||||
void R4300iOp32::COP1_S_ADD (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(RoundingModel,_MCW_RC);
|
||||
*(float *)_FPRFloatLocation[m_Opcode.fd] = (*(float *)_FPRFloatLocation[m_Opcode.fs] + *(float *)_FPRFloatLocation[m_Opcode.ft]);
|
||||
_controlfp(*_RoundingModel,_MCW_RC);
|
||||
*(float *)_FPR_S[m_Opcode.fd] = (*(float *)_FPR_S[m_Opcode.fs] + *(float *)_FPR_S[m_Opcode.ft]);
|
||||
}
|
||||
|
||||
void R4300iOp32::COP1_S_SUB (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(RoundingModel,_MCW_RC);
|
||||
*(float *)_FPRFloatLocation[m_Opcode.fd] = (*(float *)_FPRFloatLocation[m_Opcode.fs] - *(float *)_FPRFloatLocation[m_Opcode.ft]);
|
||||
_controlfp(*_RoundingModel,_MCW_RC);
|
||||
*(float *)_FPR_S[m_Opcode.fd] = (*(float *)_FPR_S[m_Opcode.fs] - *(float *)_FPR_S[m_Opcode.ft]);
|
||||
}
|
||||
|
||||
void R4300iOp32::COP1_S_MUL (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(RoundingModel,_MCW_RC);
|
||||
*(float *)_FPRFloatLocation[m_Opcode.fd] = (*(float *)_FPRFloatLocation[m_Opcode.fs] * *(float *)_FPRFloatLocation[m_Opcode.ft]);
|
||||
_controlfp(*_RoundingModel,_MCW_RC);
|
||||
*(float *)_FPR_S[m_Opcode.fd] = (*(float *)_FPR_S[m_Opcode.fs] * *(float *)_FPR_S[m_Opcode.ft]);
|
||||
}
|
||||
|
||||
void R4300iOp32::COP1_S_DIV (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(RoundingModel,_MCW_RC);
|
||||
*(float *)_FPRFloatLocation[m_Opcode.fd] = (*(float *)_FPRFloatLocation[m_Opcode.fs] / *(float *)_FPRFloatLocation[m_Opcode.ft]);
|
||||
_controlfp(*_RoundingModel,_MCW_RC);
|
||||
*(float *)_FPR_S[m_Opcode.fd] = (*(float *)_FPR_S[m_Opcode.fs] / *(float *)_FPR_S[m_Opcode.ft]);
|
||||
}
|
||||
|
||||
void R4300iOp32::COP1_S_SQRT (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(RoundingModel,_MCW_RC);
|
||||
*(float *)_FPRFloatLocation[m_Opcode.fd] = (float)sqrt(*(float *)_FPRFloatLocation[m_Opcode.fs]);
|
||||
_controlfp(*_RoundingModel,_MCW_RC);
|
||||
*(float *)_FPR_S[m_Opcode.fd] = (float)sqrt(*(float *)_FPR_S[m_Opcode.fs]);
|
||||
}
|
||||
|
||||
void R4300iOp32::COP1_S_ABS (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(RoundingModel,_MCW_RC);
|
||||
*(float *)_FPRFloatLocation[m_Opcode.fd] = (float)fabs(*(float *)_FPRFloatLocation[m_Opcode.fs]);
|
||||
_controlfp(*_RoundingModel,_MCW_RC);
|
||||
*(float *)_FPR_S[m_Opcode.fd] = (float)fabs(*(float *)_FPR_S[m_Opcode.fs]);
|
||||
}
|
||||
|
||||
void R4300iOp32::COP1_S_MOV (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(RoundingModel,_MCW_RC);
|
||||
*(float *)_FPRFloatLocation[m_Opcode.fd] = *(float *)_FPRFloatLocation[m_Opcode.fs];
|
||||
_controlfp(*_RoundingModel,_MCW_RC);
|
||||
*(float *)_FPR_S[m_Opcode.fd] = *(float *)_FPR_S[m_Opcode.fs];
|
||||
}
|
||||
|
||||
void R4300iOp32::COP1_S_NEG (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(RoundingModel,_MCW_RC);
|
||||
*(float *)_FPRFloatLocation[m_Opcode.fd] = (*(float *)_FPRFloatLocation[m_Opcode.fs] * -1.0f);
|
||||
_controlfp(*_RoundingModel,_MCW_RC);
|
||||
*(float *)_FPR_S[m_Opcode.fd] = (*(float *)_FPR_S[m_Opcode.fs] * -1.0f);
|
||||
}
|
||||
|
||||
void R4300iOp32::COP1_S_TRUNC_L (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(_RC_CHOP,_MCW_RC);
|
||||
Float_RoundToInteger64(&*(__int64 *)_FPRDoubleLocation[m_Opcode.fd],&*(float *)_FPRFloatLocation[m_Opcode.fs]);
|
||||
Float_RoundToInteger64(&*(__int64 *)_FPR_D[m_Opcode.fd],&*(float *)_FPR_S[m_Opcode.fs]);
|
||||
}
|
||||
|
||||
void R4300iOp32::COP1_S_CEIL_L (void) { //added by Witten
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(_RC_UP,_MCW_RC);
|
||||
Float_RoundToInteger64(&*(__int64 *)_FPRDoubleLocation[m_Opcode.fd],&*(float *)_FPRFloatLocation[m_Opcode.fs]);
|
||||
Float_RoundToInteger64(&*(__int64 *)_FPR_D[m_Opcode.fd],&*(float *)_FPR_S[m_Opcode.fs]);
|
||||
}
|
||||
|
||||
void R4300iOp32::COP1_S_FLOOR_L (void) { //added by Witten
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(_RC_DOWN,_MCW_RC);
|
||||
Float_RoundToInteger64(&*(__int64 *)_FPRDoubleLocation[m_Opcode.fd],&*(float *)_FPRFloatLocation[m_Opcode.fs]);
|
||||
Float_RoundToInteger64(&*(__int64 *)_FPR_D[m_Opcode.fd],&*(float *)_FPR_S[m_Opcode.fs]);
|
||||
}
|
||||
|
||||
void R4300iOp32::COP1_S_ROUND_W (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(_RC_NEAR,_MCW_RC);
|
||||
Float_RoundToInteger32(&*(int *)_FPRFloatLocation[m_Opcode.fd],&*(float *)_FPRFloatLocation[m_Opcode.fs]);
|
||||
Float_RoundToInteger32(&*(int *)_FPR_S[m_Opcode.fd],&*(float *)_FPR_S[m_Opcode.fs]);
|
||||
}
|
||||
|
||||
void R4300iOp32::COP1_S_TRUNC_W (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(_RC_CHOP,_MCW_RC);
|
||||
Float_RoundToInteger32(&*(int *)_FPRFloatLocation[m_Opcode.fd],&*(float *)_FPRFloatLocation[m_Opcode.fs]);
|
||||
Float_RoundToInteger32(&*(int *)_FPR_S[m_Opcode.fd],&*(float *)_FPR_S[m_Opcode.fs]);
|
||||
}
|
||||
|
||||
void R4300iOp32::COP1_S_CEIL_W (void) { //added by Witten
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(_RC_UP,_MCW_RC);
|
||||
Float_RoundToInteger32(&*(int *)_FPRFloatLocation[m_Opcode.fd],&*(float *)_FPRFloatLocation[m_Opcode.fs]);
|
||||
Float_RoundToInteger32(&*(int *)_FPR_S[m_Opcode.fd],&*(float *)_FPR_S[m_Opcode.fs]);
|
||||
}
|
||||
|
||||
void R4300iOp32::COP1_S_FLOOR_W (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(_RC_DOWN,_MCW_RC);
|
||||
Float_RoundToInteger32(&*(int *)_FPRFloatLocation[m_Opcode.fd],&*(float *)_FPRFloatLocation[m_Opcode.fs]);
|
||||
Float_RoundToInteger32(&*(int *)_FPR_S[m_Opcode.fd],&*(float *)_FPR_S[m_Opcode.fs]);
|
||||
}
|
||||
|
||||
void R4300iOp32::COP1_S_CVT_D (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(RoundingModel,_MCW_RC);
|
||||
*(double *)_FPRDoubleLocation[m_Opcode.fd] = (double)(*(float *)_FPRFloatLocation[m_Opcode.fs]);
|
||||
_controlfp(*_RoundingModel,_MCW_RC);
|
||||
*(double *)_FPR_D[m_Opcode.fd] = (double)(*(float *)_FPR_S[m_Opcode.fs]);
|
||||
}
|
||||
|
||||
void R4300iOp32::COP1_S_CVT_W (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(RoundingModel,_MCW_RC);
|
||||
Float_RoundToInteger32(&*(int *)_FPRFloatLocation[m_Opcode.fd],&*(float *)_FPRFloatLocation[m_Opcode.fs]);
|
||||
_controlfp(*_RoundingModel,_MCW_RC);
|
||||
Float_RoundToInteger32(&*(int *)_FPR_S[m_Opcode.fd],&*(float *)_FPR_S[m_Opcode.fs]);
|
||||
}
|
||||
|
||||
void R4300iOp32::COP1_S_CVT_L (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(RoundingModel,_MCW_RC);
|
||||
Float_RoundToInteger64(&*(__int64 *)_FPRDoubleLocation[m_Opcode.fd],&*(float *)_FPRFloatLocation[m_Opcode.fs]);
|
||||
_controlfp(*_RoundingModel,_MCW_RC);
|
||||
Float_RoundToInteger64(&*(__int64 *)_FPR_D[m_Opcode.fd],&*(float *)_FPR_S[m_Opcode.fs]);
|
||||
}
|
||||
|
||||
void R4300iOp32::COP1_S_CMP (void) {
|
||||
|
@ -1672,8 +1672,8 @@ void R4300iOp32::COP1_S_CMP (void) {
|
|||
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
|
||||
Temp0 = *(float *)_FPRFloatLocation[m_Opcode.fs];
|
||||
Temp1 = *(float *)_FPRFloatLocation[m_Opcode.ft];
|
||||
Temp0 = *(float *)_FPR_S[m_Opcode.fs];
|
||||
Temp1 = *(float *)_FPR_S[m_Opcode.ft];
|
||||
|
||||
if (_isnan(Temp0) || _isnan(Temp1)) {
|
||||
#ifndef EXTERNAL_RELEASE
|
||||
|
@ -1726,110 +1726,110 @@ __inline void Double_RoundToInteger64( unsigned __int64 * Dest, double * Source
|
|||
|
||||
void R4300iOp32::COP1_D_ADD (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(RoundingModel,_MCW_RC);
|
||||
*(double *)_FPRDoubleLocation[m_Opcode.fd] = *(double *)_FPRDoubleLocation[m_Opcode.fs] + *(double *)_FPRDoubleLocation[m_Opcode.ft];
|
||||
_controlfp(*_RoundingModel,_MCW_RC);
|
||||
*(double *)_FPR_D[m_Opcode.fd] = *(double *)_FPR_D[m_Opcode.fs] + *(double *)_FPR_D[m_Opcode.ft];
|
||||
}
|
||||
|
||||
void R4300iOp32::COP1_D_SUB (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(RoundingModel,_MCW_RC);
|
||||
*(double *)_FPRDoubleLocation[m_Opcode.fd] = *(double *)_FPRDoubleLocation[m_Opcode.fs] - *(double *)_FPRDoubleLocation[m_Opcode.ft];
|
||||
_controlfp(*_RoundingModel,_MCW_RC);
|
||||
*(double *)_FPR_D[m_Opcode.fd] = *(double *)_FPR_D[m_Opcode.fs] - *(double *)_FPR_D[m_Opcode.ft];
|
||||
}
|
||||
|
||||
void R4300iOp32::COP1_D_MUL (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(RoundingModel,_MCW_RC);
|
||||
*(double *)_FPRDoubleLocation[m_Opcode.fd] = *(double *)_FPRDoubleLocation[m_Opcode.fs] * *(double *)_FPRDoubleLocation[m_Opcode.ft];
|
||||
_controlfp(*_RoundingModel,_MCW_RC);
|
||||
*(double *)_FPR_D[m_Opcode.fd] = *(double *)_FPR_D[m_Opcode.fs] * *(double *)_FPR_D[m_Opcode.ft];
|
||||
}
|
||||
|
||||
void R4300iOp32::COP1_D_DIV (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(RoundingModel,_MCW_RC);
|
||||
*(double *)_FPRDoubleLocation[m_Opcode.fd] = *(double *)_FPRDoubleLocation[m_Opcode.fs] / *(double *)_FPRDoubleLocation[m_Opcode.ft];
|
||||
_controlfp(*_RoundingModel,_MCW_RC);
|
||||
*(double *)_FPR_D[m_Opcode.fd] = *(double *)_FPR_D[m_Opcode.fs] / *(double *)_FPR_D[m_Opcode.ft];
|
||||
}
|
||||
|
||||
void R4300iOp32::COP1_D_SQRT (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(RoundingModel,_MCW_RC);
|
||||
*(double *)_FPRDoubleLocation[m_Opcode.fd] = (double)sqrt(*(double *)_FPRDoubleLocation[m_Opcode.fs]);
|
||||
_controlfp(*_RoundingModel,_MCW_RC);
|
||||
*(double *)_FPR_D[m_Opcode.fd] = (double)sqrt(*(double *)_FPR_D[m_Opcode.fs]);
|
||||
}
|
||||
|
||||
void R4300iOp32::COP1_D_ABS (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(RoundingModel,_MCW_RC);
|
||||
*(double *)_FPRDoubleLocation[m_Opcode.fd] = fabs(*(double *)_FPRDoubleLocation[m_Opcode.fs]);
|
||||
_controlfp(*_RoundingModel,_MCW_RC);
|
||||
*(double *)_FPR_D[m_Opcode.fd] = fabs(*(double *)_FPR_D[m_Opcode.fs]);
|
||||
}
|
||||
|
||||
void R4300iOp32::COP1_D_MOV (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(RoundingModel,_MCW_RC);
|
||||
*(__int64 *)_FPRDoubleLocation[m_Opcode.fd] = *(__int64 *)_FPRDoubleLocation[m_Opcode.fs];
|
||||
_controlfp(*_RoundingModel,_MCW_RC);
|
||||
*(__int64 *)_FPR_D[m_Opcode.fd] = *(__int64 *)_FPR_D[m_Opcode.fs];
|
||||
}
|
||||
|
||||
void R4300iOp32::COP1_D_NEG (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(RoundingModel,_MCW_RC);
|
||||
*(double *)_FPRDoubleLocation[m_Opcode.fd] = (*(double *)_FPRDoubleLocation[m_Opcode.fs] * -1.0);
|
||||
_controlfp(*_RoundingModel,_MCW_RC);
|
||||
*(double *)_FPR_D[m_Opcode.fd] = (*(double *)_FPR_D[m_Opcode.fs] * -1.0);
|
||||
}
|
||||
|
||||
void R4300iOp32::COP1_D_TRUNC_L (void) { //added by Witten
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(RC_CHOP,_MCW_RC);
|
||||
Double_RoundToInteger64(&*(QWORD *)_FPRFloatLocation[m_Opcode.fd],&*(double *)_FPRDoubleLocation[m_Opcode.fs] );
|
||||
Double_RoundToInteger64(&*(QWORD *)_FPR_S[m_Opcode.fd],&*(double *)_FPR_D[m_Opcode.fs] );
|
||||
}
|
||||
|
||||
void R4300iOp32::COP1_D_CEIL_L (void) { //added by Witten
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(RC_UP,_MCW_RC);
|
||||
Double_RoundToInteger64(&*(QWORD *)_FPRFloatLocation[m_Opcode.fd],&*(double *)_FPRDoubleLocation[m_Opcode.fs] );
|
||||
Double_RoundToInteger64(&*(QWORD *)_FPR_S[m_Opcode.fd],&*(double *)_FPR_D[m_Opcode.fs] );
|
||||
}
|
||||
|
||||
void R4300iOp32::COP1_D_FLOOR_L (void) { //added by Witten
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(_RC_DOWN,_MCW_RC);
|
||||
Double_RoundToInteger64(&*(QWORD *)_FPRDoubleLocation[m_Opcode.fd],&*(double *)_FPRFloatLocation[m_Opcode.fs]);
|
||||
Double_RoundToInteger64(&*(QWORD *)_FPR_D[m_Opcode.fd],&*(double *)_FPR_S[m_Opcode.fs]);
|
||||
}
|
||||
|
||||
void R4300iOp32::COP1_D_ROUND_W (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(_RC_NEAR,_MCW_RC);
|
||||
Double_RoundToInteger32(&*(DWORD *)_FPRFloatLocation[m_Opcode.fd],&*(double *)_FPRDoubleLocation[m_Opcode.fs] );
|
||||
Double_RoundToInteger32(&*(DWORD *)_FPR_S[m_Opcode.fd],&*(double *)_FPR_D[m_Opcode.fs] );
|
||||
}
|
||||
|
||||
void R4300iOp32::COP1_D_TRUNC_W (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(RC_CHOP,_MCW_RC);
|
||||
Double_RoundToInteger32(&*(DWORD *)_FPRFloatLocation[m_Opcode.fd],&*(double *)_FPRDoubleLocation[m_Opcode.fs] );
|
||||
Double_RoundToInteger32(&*(DWORD *)_FPR_S[m_Opcode.fd],&*(double *)_FPR_D[m_Opcode.fs] );
|
||||
}
|
||||
|
||||
void R4300iOp32::COP1_D_CEIL_W (void) { //added by Witten
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(RC_UP,_MCW_RC);
|
||||
Double_RoundToInteger32(&*(DWORD *)_FPRFloatLocation[m_Opcode.fd],&*(double *)_FPRDoubleLocation[m_Opcode.fs] );
|
||||
Double_RoundToInteger32(&*(DWORD *)_FPR_S[m_Opcode.fd],&*(double *)_FPR_D[m_Opcode.fs] );
|
||||
}
|
||||
|
||||
void R4300iOp32::COP1_D_FLOOR_W (void) { //added by Witten
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(_RC_DOWN,_MCW_RC);
|
||||
Double_RoundToInteger32(&*(DWORD *)_FPRDoubleLocation[m_Opcode.fd],&*(double *)_FPRFloatLocation[m_Opcode.fs]);
|
||||
Double_RoundToInteger32(&*(DWORD *)_FPR_D[m_Opcode.fd],&*(double *)_FPR_S[m_Opcode.fs]);
|
||||
}
|
||||
|
||||
void R4300iOp32::COP1_D_CVT_S (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(RoundingModel,_MCW_RC);
|
||||
*(float *)_FPRFloatLocation[m_Opcode.fd] = (float)*(double *)_FPRDoubleLocation[m_Opcode.fs];
|
||||
_controlfp(*_RoundingModel,_MCW_RC);
|
||||
*(float *)_FPR_S[m_Opcode.fd] = (float)*(double *)_FPR_D[m_Opcode.fs];
|
||||
}
|
||||
|
||||
void R4300iOp32::COP1_D_CVT_W (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(RoundingModel,_MCW_RC);
|
||||
Double_RoundToInteger32(&*(DWORD *)_FPRFloatLocation[m_Opcode.fd],&*(double *)_FPRDoubleLocation[m_Opcode.fs] );
|
||||
_controlfp(*_RoundingModel,_MCW_RC);
|
||||
Double_RoundToInteger32(&*(DWORD *)_FPR_S[m_Opcode.fd],&*(double *)_FPR_D[m_Opcode.fs] );
|
||||
}
|
||||
|
||||
void R4300iOp32::COP1_D_CVT_L (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(RoundingModel,_MCW_RC);
|
||||
Double_RoundToInteger64(&*(unsigned __int64 *)_FPRDoubleLocation[m_Opcode.fd],&*(double *)_FPRDoubleLocation[m_Opcode.fs]);
|
||||
_controlfp(*_RoundingModel,_MCW_RC);
|
||||
Double_RoundToInteger64(&*(unsigned __int64 *)_FPR_D[m_Opcode.fd],&*(double *)_FPR_D[m_Opcode.fs]);
|
||||
}
|
||||
|
||||
void R4300iOp32::COP1_D_CMP (void) {
|
||||
|
@ -1838,8 +1838,8 @@ void R4300iOp32::COP1_D_CMP (void) {
|
|||
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
|
||||
Temp0.DW = *(__int64 *)_FPRDoubleLocation[m_Opcode.fs];
|
||||
Temp1.DW = *(__int64 *)_FPRDoubleLocation[m_Opcode.ft];
|
||||
Temp0.DW = *(__int64 *)_FPR_D[m_Opcode.fs];
|
||||
Temp1.DW = *(__int64 *)_FPR_D[m_Opcode.ft];
|
||||
|
||||
if (_isnan(Temp0.D) || _isnan(Temp1.D)) {
|
||||
#ifndef EXTERNAL_RELEASE
|
||||
|
@ -1872,27 +1872,27 @@ void R4300iOp32::COP1_D_CMP (void) {
|
|||
/************************** COP1: W functions ************************/
|
||||
void R4300iOp32::COP1_W_CVT_S (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(RoundingModel,_MCW_RC);
|
||||
*(float *)_FPRFloatLocation[m_Opcode.fd] = (float)*(int *)_FPRFloatLocation[m_Opcode.fs];
|
||||
_controlfp(*_RoundingModel,_MCW_RC);
|
||||
*(float *)_FPR_S[m_Opcode.fd] = (float)*(int *)_FPR_S[m_Opcode.fs];
|
||||
}
|
||||
|
||||
void R4300iOp32::COP1_W_CVT_D (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(RoundingModel,_MCW_RC);
|
||||
*(double *)_FPRDoubleLocation[m_Opcode.fd] = (double)*(int *)_FPRFloatLocation[m_Opcode.fs];
|
||||
_controlfp(*_RoundingModel,_MCW_RC);
|
||||
*(double *)_FPR_D[m_Opcode.fd] = (double)*(int *)_FPR_S[m_Opcode.fs];
|
||||
}
|
||||
|
||||
/************************** COP1: L functions ************************/
|
||||
void R4300iOp32::COP1_L_CVT_S (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(RoundingModel,_MCW_RC);
|
||||
*(float *)_FPRFloatLocation[m_Opcode.fd] = (float)*(__int64 *)_FPRDoubleLocation[m_Opcode.fs];
|
||||
_controlfp(*_RoundingModel,_MCW_RC);
|
||||
*(float *)_FPR_S[m_Opcode.fd] = (float)*(__int64 *)_FPR_D[m_Opcode.fs];
|
||||
}
|
||||
|
||||
void R4300iOp32::COP1_L_CVT_D (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(RoundingModel,_MCW_RC);
|
||||
*(double *)_FPRDoubleLocation[m_Opcode.fd] = (double)*(__int64 *)_FPRDoubleLocation[m_Opcode.fs];
|
||||
_controlfp(*_RoundingModel,_MCW_RC);
|
||||
*(double *)_FPR_D[m_Opcode.fd] = (double)*(__int64 *)_FPR_D[m_Opcode.fs];
|
||||
}
|
||||
|
||||
/************************** Other functions **************************/
|
||||
|
|
|
@ -56,10 +56,8 @@ const int R4300iOp::SWR_SHIFT[4] = { 24, 16 , 8, 0 };
|
|||
const int R4300iOp::LWL_SHIFT[4] = { 0, 8, 16, 24};
|
||||
const int R4300iOp::LWR_SHIFT[4] = { 24, 16 ,8, 0 };
|
||||
|
||||
int RoundingModel = _RC_NEAR;
|
||||
|
||||
#define ADDRESS_ERROR_EXCEPTION(Address,FromRead) \
|
||||
DoAddressError(m_NextInstruction == JUMP,Address,FromRead);\
|
||||
_Reg->DoAddressError(m_NextInstruction == JUMP,Address,FromRead);\
|
||||
m_NextInstruction = JUMP;\
|
||||
m_JumpToLocation = (*_PROGRAM_COUNTER);\
|
||||
return;
|
||||
|
@ -67,14 +65,14 @@ int RoundingModel = _RC_NEAR;
|
|||
//#define TEST_COP1_USABLE_EXCEPTION
|
||||
#define TEST_COP1_USABLE_EXCEPTION \
|
||||
if ((_Reg->STATUS_REGISTER & STATUS_CU1) == 0) {\
|
||||
DoCopUnusableException(m_NextInstruction == JUMP,1);\
|
||||
_Reg->DoCopUnusableException(m_NextInstruction == JUMP,1);\
|
||||
m_NextInstruction = JUMP;\
|
||||
m_JumpToLocation = (*_PROGRAM_COUNTER);\
|
||||
return;\
|
||||
}
|
||||
|
||||
#define TLB_READ_EXCEPTION(Address) \
|
||||
DoTLBMiss(m_NextInstruction == JUMP,Address);\
|
||||
_Reg->DoTLBMiss(m_NextInstruction == JUMP,Address);\
|
||||
m_NextInstruction = JUMP;\
|
||||
m_JumpToLocation = (*_PROGRAM_COUNTER);\
|
||||
return;
|
||||
|
@ -104,12 +102,12 @@ void R4300iOp::COP1_BC (void) {
|
|||
}
|
||||
|
||||
void R4300iOp::COP1_S (void) {
|
||||
_controlfp(RoundingModel,_MCW_RC);
|
||||
_controlfp(*_RoundingModel,_MCW_RC);
|
||||
Jump_CoP1_S[ m_Opcode.funct ]();
|
||||
}
|
||||
|
||||
void R4300iOp::COP1_D (void) {
|
||||
_controlfp(RoundingModel,_MCW_RC);
|
||||
_controlfp(*_RoundingModel,_MCW_RC);
|
||||
Jump_CoP1_D[ m_Opcode.funct ]();
|
||||
}
|
||||
|
||||
|
@ -1335,7 +1333,7 @@ void R4300iOp::LWC1 (void) {
|
|||
DWORD Address = _GPR[m_Opcode.base].UW[0] + (DWORD)((short)m_Opcode.offset);
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
if ((Address & 3) != 0) { ADDRESS_ERROR_EXCEPTION(Address,TRUE); }
|
||||
if (!_MMU->LW_VAddr(Address,*(DWORD *)_FPRFloatLocation[m_Opcode.ft])) {
|
||||
if (!_MMU->LW_VAddr(Address,*(DWORD *)_FPR_S[m_Opcode.ft])) {
|
||||
if (g_ShowTLBMisses) {
|
||||
DisplayError("LWC1 TLB: %X",Address);
|
||||
}
|
||||
|
@ -1378,7 +1376,7 @@ void R4300iOp::LDC1 (void) {
|
|||
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
if ((Address & 7) != 0) { ADDRESS_ERROR_EXCEPTION(Address,TRUE); }
|
||||
if (!_MMU->LD_VAddr(Address,*(unsigned __int64 *)_FPRDoubleLocation[m_Opcode.ft])) {
|
||||
if (!_MMU->LD_VAddr(Address,*(unsigned __int64 *)_FPR_D[m_Opcode.ft])) {
|
||||
#ifndef EXTERNAL_RELEASE
|
||||
DisplayError("LD TLB: %X",Address);
|
||||
#endif
|
||||
|
@ -1390,7 +1388,7 @@ void R4300iOp::SWC1 (void) {
|
|||
TEST_COP1_USABLE_EXCEPTION
|
||||
if ((Address & 3) != 0) { ADDRESS_ERROR_EXCEPTION(Address,FALSE); }
|
||||
|
||||
if (!_MMU->SW_VAddr(Address,*(DWORD *)_FPRFloatLocation[m_Opcode.ft])) {
|
||||
if (!_MMU->SW_VAddr(Address,*(DWORD *)_FPR_S[m_Opcode.ft])) {
|
||||
#ifndef EXTERNAL_RELEASE
|
||||
DisplayError("SWC1 TLB: %X",Address);
|
||||
#endif
|
||||
|
@ -1402,7 +1400,7 @@ void R4300iOp::SDC1 (void) {
|
|||
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
if ((Address & 7) != 0) { ADDRESS_ERROR_EXCEPTION(Address,FALSE); }
|
||||
if (!_MMU->SD_VAddr(Address,*(__int64 *)_FPRDoubleLocation[m_Opcode.ft])) {
|
||||
if (!_MMU->SD_VAddr(Address,*(__int64 *)_FPR_D[m_Opcode.ft])) {
|
||||
#ifndef EXTERNAL_RELEASE
|
||||
DisplayError("SDC1 TLB: %X",Address);
|
||||
#endif
|
||||
|
@ -1458,13 +1456,13 @@ void R4300iOp::SPECIAL_JALR (void) {
|
|||
}
|
||||
|
||||
void R4300iOp::SPECIAL_SYSCALL (void) {
|
||||
DoSysCallException(m_NextInstruction == JUMP);
|
||||
_Reg->DoSysCallException(m_NextInstruction == JUMP);
|
||||
m_NextInstruction = JUMP;
|
||||
m_JumpToLocation = (*_PROGRAM_COUNTER);
|
||||
}
|
||||
|
||||
void R4300iOp::SPECIAL_BREAK (void) {
|
||||
DoBreakException(m_NextInstruction == JUMP);
|
||||
_Reg->DoBreakException(m_NextInstruction == JUMP);
|
||||
m_NextInstruction = JUMP;
|
||||
m_JumpToLocation = (*_PROGRAM_COUNTER);
|
||||
}
|
||||
|
@ -1811,7 +1809,7 @@ void R4300iOp::COP0_MT (void) {
|
|||
DisplayError("Left kernel mode ??");
|
||||
#endif
|
||||
}
|
||||
CheckInterrupts();
|
||||
_Reg->CheckInterrupts();
|
||||
break;
|
||||
case 13: //cause
|
||||
_CP0[m_Opcode.rd] &= 0xFFFFCFF;
|
||||
|
@ -1827,17 +1825,17 @@ void R4300iOp::COP0_MT (void) {
|
|||
/************************** COP0 CO functions ***********************/
|
||||
void R4300iOp::COP0_CO_TLBR (void) {
|
||||
if (!g_UseTlb) { return; }
|
||||
TLB_ReadEntry();
|
||||
_TLB->ReadEntry();
|
||||
}
|
||||
|
||||
void R4300iOp::COP0_CO_TLBWI (void) {
|
||||
if (!g_UseTlb) { return; }
|
||||
TLB_WriteEntry(_Reg->INDEX_REGISTER & 0x1F,FALSE);
|
||||
_TLB->WriteEntry(_Reg->INDEX_REGISTER & 0x1F,FALSE);
|
||||
}
|
||||
|
||||
void R4300iOp::COP0_CO_TLBWR (void) {
|
||||
if (!g_UseTlb) { return; }
|
||||
TLB_WriteEntry(_Reg->RANDOM_REGISTER & 0x1F,TRUE);
|
||||
_TLB->WriteEntry(_Reg->RANDOM_REGISTER & 0x1F,TRUE);
|
||||
}
|
||||
|
||||
void R4300iOp::COP0_CO_TLBP (void) {
|
||||
|
@ -1855,19 +1853,19 @@ void R4300iOp::COP0_CO_ERET (void) {
|
|||
_Reg->STATUS_REGISTER &= ~STATUS_EXL;
|
||||
}
|
||||
(*_LLBit) = 0;
|
||||
CheckInterrupts();
|
||||
_Reg->CheckInterrupts();
|
||||
m_TestTimer = TRUE;
|
||||
}
|
||||
|
||||
/************************** COP1 functions **************************/
|
||||
void R4300iOp::COP1_MF (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_GPR[m_Opcode.rt].DW = *(int *)_FPRFloatLocation[m_Opcode.fs];
|
||||
_GPR[m_Opcode.rt].DW = *(int *)_FPR_S[m_Opcode.fs];
|
||||
}
|
||||
|
||||
void R4300iOp::COP1_DMF (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_GPR[m_Opcode.rt].DW = *(__int64 *)_FPRDoubleLocation[m_Opcode.fs];
|
||||
_GPR[m_Opcode.rt].DW = *(__int64 *)_FPR_D[m_Opcode.fs];
|
||||
}
|
||||
|
||||
void R4300iOp::COP1_CF (void) {
|
||||
|
@ -1883,12 +1881,12 @@ void R4300iOp::COP1_CF (void) {
|
|||
|
||||
void R4300iOp::COP1_MT (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
*(int *)_FPRFloatLocation[m_Opcode.fs] = _GPR[m_Opcode.rt].W[0];
|
||||
*(int *)_FPR_S[m_Opcode.fs] = _GPR[m_Opcode.rt].W[0];
|
||||
}
|
||||
|
||||
void R4300iOp::COP1_DMT (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
*(__int64 *)_FPRDoubleLocation[m_Opcode.fs] = _GPR[m_Opcode.rt].DW;
|
||||
*(__int64 *)_FPR_D[m_Opcode.fs] = _GPR[m_Opcode.rt].DW;
|
||||
}
|
||||
|
||||
void R4300iOp::COP1_CT (void) {
|
||||
|
@ -1896,10 +1894,10 @@ void R4300iOp::COP1_CT (void) {
|
|||
if (m_Opcode.fs == 31) {
|
||||
_FPCR[m_Opcode.fs] = _GPR[m_Opcode.rt].W[0];
|
||||
switch((_FPCR[m_Opcode.fs] & 3)) {
|
||||
case 0: RoundingModel = _RC_NEAR; break;
|
||||
case 1: RoundingModel = _RC_CHOP; break;
|
||||
case 2: RoundingModel = _RC_UP; break;
|
||||
case 3: RoundingModel = _RC_DOWN; break;
|
||||
case 0: *_RoundingModel = ROUND_NEAR; break;
|
||||
case 1: *_RoundingModel = ROUND_CHOP; break;
|
||||
case 2: *_RoundingModel = ROUND_UP; break;
|
||||
case 3: *_RoundingModel = ROUND_DOWN; break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -1971,110 +1969,110 @@ __inline void Float_RoundToInteger64( __int64 * Dest, float * Source ) {
|
|||
|
||||
void R4300iOp::COP1_S_ADD (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(RoundingModel,_MCW_RC);
|
||||
*(float *)_FPRFloatLocation[m_Opcode.fd] = (*(float *)_FPRFloatLocation[m_Opcode.fs] + *(float *)_FPRFloatLocation[m_Opcode.ft]);
|
||||
_controlfp(*_RoundingModel,_MCW_RC);
|
||||
*(float *)_FPR_S[m_Opcode.fd] = (*(float *)_FPR_S[m_Opcode.fs] + *(float *)_FPR_S[m_Opcode.ft]);
|
||||
}
|
||||
|
||||
void R4300iOp::COP1_S_SUB (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(RoundingModel,_MCW_RC);
|
||||
*(float *)_FPRFloatLocation[m_Opcode.fd] = (*(float *)_FPRFloatLocation[m_Opcode.fs] - *(float *)_FPRFloatLocation[m_Opcode.ft]);
|
||||
_controlfp(*_RoundingModel,_MCW_RC);
|
||||
*(float *)_FPR_S[m_Opcode.fd] = (*(float *)_FPR_S[m_Opcode.fs] - *(float *)_FPR_S[m_Opcode.ft]);
|
||||
}
|
||||
|
||||
void R4300iOp::COP1_S_MUL (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(RoundingModel,_MCW_RC);
|
||||
*(float *)_FPRFloatLocation[m_Opcode.fd] = (*(float *)_FPRFloatLocation[m_Opcode.fs] * *(float *)_FPRFloatLocation[m_Opcode.ft]);
|
||||
_controlfp(*_RoundingModel,_MCW_RC);
|
||||
*(float *)_FPR_S[m_Opcode.fd] = (*(float *)_FPR_S[m_Opcode.fs] * *(float *)_FPR_S[m_Opcode.ft]);
|
||||
}
|
||||
|
||||
void R4300iOp::COP1_S_DIV (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(RoundingModel,_MCW_RC);
|
||||
*(float *)_FPRFloatLocation[m_Opcode.fd] = (*(float *)_FPRFloatLocation[m_Opcode.fs] / *(float *)_FPRFloatLocation[m_Opcode.ft]);
|
||||
_controlfp(*_RoundingModel,_MCW_RC);
|
||||
*(float *)_FPR_S[m_Opcode.fd] = (*(float *)_FPR_S[m_Opcode.fs] / *(float *)_FPR_S[m_Opcode.ft]);
|
||||
}
|
||||
|
||||
void R4300iOp::COP1_S_SQRT (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(RoundingModel,_MCW_RC);
|
||||
*(float *)_FPRFloatLocation[m_Opcode.fd] = (float)sqrt(*(float *)_FPRFloatLocation[m_Opcode.fs]);
|
||||
_controlfp(*_RoundingModel,_MCW_RC);
|
||||
*(float *)_FPR_S[m_Opcode.fd] = (float)sqrt(*(float *)_FPR_S[m_Opcode.fs]);
|
||||
}
|
||||
|
||||
void R4300iOp::COP1_S_ABS (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(RoundingModel,_MCW_RC);
|
||||
*(float *)_FPRFloatLocation[m_Opcode.fd] = (float)fabs(*(float *)_FPRFloatLocation[m_Opcode.fs]);
|
||||
_controlfp(*_RoundingModel,_MCW_RC);
|
||||
*(float *)_FPR_S[m_Opcode.fd] = (float)fabs(*(float *)_FPR_S[m_Opcode.fs]);
|
||||
}
|
||||
|
||||
void R4300iOp::COP1_S_MOV (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(RoundingModel,_MCW_RC);
|
||||
*(float *)_FPRFloatLocation[m_Opcode.fd] = *(float *)_FPRFloatLocation[m_Opcode.fs];
|
||||
_controlfp(*_RoundingModel,_MCW_RC);
|
||||
*(float *)_FPR_S[m_Opcode.fd] = *(float *)_FPR_S[m_Opcode.fs];
|
||||
}
|
||||
|
||||
void R4300iOp::COP1_S_NEG (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(RoundingModel,_MCW_RC);
|
||||
*(float *)_FPRFloatLocation[m_Opcode.fd] = (*(float *)_FPRFloatLocation[m_Opcode.fs] * -1.0f);
|
||||
_controlfp(*_RoundingModel,_MCW_RC);
|
||||
*(float *)_FPR_S[m_Opcode.fd] = (*(float *)_FPR_S[m_Opcode.fs] * -1.0f);
|
||||
}
|
||||
|
||||
void R4300iOp::COP1_S_TRUNC_L (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(_RC_CHOP,_MCW_RC);
|
||||
Float_RoundToInteger64(&*(__int64 *)_FPRDoubleLocation[m_Opcode.fd],&*(float *)_FPRFloatLocation[m_Opcode.fs]);
|
||||
Float_RoundToInteger64(&*(__int64 *)_FPR_D[m_Opcode.fd],&*(float *)_FPR_S[m_Opcode.fs]);
|
||||
}
|
||||
|
||||
void R4300iOp::COP1_S_CEIL_L (void) { //added by Witten
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(_RC_UP,_MCW_RC);
|
||||
Float_RoundToInteger64(&*(__int64 *)_FPRDoubleLocation[m_Opcode.fd],&*(float *)_FPRFloatLocation[m_Opcode.fs]);
|
||||
Float_RoundToInteger64(&*(__int64 *)_FPR_D[m_Opcode.fd],&*(float *)_FPR_S[m_Opcode.fs]);
|
||||
}
|
||||
|
||||
void R4300iOp::COP1_S_FLOOR_L (void) { //added by Witten
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(_RC_DOWN,_MCW_RC);
|
||||
Float_RoundToInteger64(&*(__int64 *)_FPRDoubleLocation[m_Opcode.fd],&*(float *)_FPRFloatLocation[m_Opcode.fs]);
|
||||
Float_RoundToInteger64(&*(__int64 *)_FPR_D[m_Opcode.fd],&*(float *)_FPR_S[m_Opcode.fs]);
|
||||
}
|
||||
|
||||
void R4300iOp::COP1_S_ROUND_W (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(_RC_NEAR,_MCW_RC);
|
||||
Float_RoundToInteger32(&*(int *)_FPRFloatLocation[m_Opcode.fd],&*(float *)_FPRFloatLocation[m_Opcode.fs]);
|
||||
Float_RoundToInteger32(&*(int *)_FPR_S[m_Opcode.fd],&*(float *)_FPR_S[m_Opcode.fs]);
|
||||
}
|
||||
|
||||
void R4300iOp::COP1_S_TRUNC_W (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(_RC_CHOP,_MCW_RC);
|
||||
Float_RoundToInteger32(&*(int *)_FPRFloatLocation[m_Opcode.fd],&*(float *)_FPRFloatLocation[m_Opcode.fs]);
|
||||
Float_RoundToInteger32(&*(int *)_FPR_S[m_Opcode.fd],&*(float *)_FPR_S[m_Opcode.fs]);
|
||||
}
|
||||
|
||||
void R4300iOp::COP1_S_CEIL_W (void) { //added by Witten
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(_RC_UP,_MCW_RC);
|
||||
Float_RoundToInteger32(&*(int *)_FPRFloatLocation[m_Opcode.fd],&*(float *)_FPRFloatLocation[m_Opcode.fs]);
|
||||
Float_RoundToInteger32(&*(int *)_FPR_S[m_Opcode.fd],&*(float *)_FPR_S[m_Opcode.fs]);
|
||||
}
|
||||
|
||||
void R4300iOp::COP1_S_FLOOR_W (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(_RC_DOWN,_MCW_RC);
|
||||
Float_RoundToInteger32(&*(int *)_FPRFloatLocation[m_Opcode.fd],&*(float *)_FPRFloatLocation[m_Opcode.fs]);
|
||||
Float_RoundToInteger32(&*(int *)_FPR_S[m_Opcode.fd],&*(float *)_FPR_S[m_Opcode.fs]);
|
||||
}
|
||||
|
||||
void R4300iOp::COP1_S_CVT_D (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(RoundingModel,_MCW_RC);
|
||||
*(double *)_FPRDoubleLocation[m_Opcode.fd] = (double)(*(float *)_FPRFloatLocation[m_Opcode.fs]);
|
||||
_controlfp(*_RoundingModel,_MCW_RC);
|
||||
*(double *)_FPR_D[m_Opcode.fd] = (double)(*(float *)_FPR_S[m_Opcode.fs]);
|
||||
}
|
||||
|
||||
void R4300iOp::COP1_S_CVT_W (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(RoundingModel,_MCW_RC);
|
||||
Float_RoundToInteger32(&*(int *)_FPRFloatLocation[m_Opcode.fd],&*(float *)_FPRFloatLocation[m_Opcode.fs]);
|
||||
_controlfp(*_RoundingModel,_MCW_RC);
|
||||
Float_RoundToInteger32(&*(int *)_FPR_S[m_Opcode.fd],&*(float *)_FPR_S[m_Opcode.fs]);
|
||||
}
|
||||
|
||||
void R4300iOp::COP1_S_CVT_L (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(RoundingModel,_MCW_RC);
|
||||
Float_RoundToInteger64(&*(__int64 *)_FPRDoubleLocation[m_Opcode.fd],&*(float *)_FPRFloatLocation[m_Opcode.fs]);
|
||||
_controlfp(*_RoundingModel,_MCW_RC);
|
||||
Float_RoundToInteger64(&*(__int64 *)_FPR_D[m_Opcode.fd],&*(float *)_FPR_S[m_Opcode.fs]);
|
||||
}
|
||||
|
||||
void R4300iOp::COP1_S_CMP (void) {
|
||||
|
@ -2083,8 +2081,8 @@ void R4300iOp::COP1_S_CMP (void) {
|
|||
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
|
||||
Temp0 = *(float *)_FPRFloatLocation[m_Opcode.fs];
|
||||
Temp1 = *(float *)_FPRFloatLocation[m_Opcode.ft];
|
||||
Temp0 = *(float *)_FPR_S[m_Opcode.fs];
|
||||
Temp1 = *(float *)_FPR_S[m_Opcode.ft];
|
||||
|
||||
if (_isnan(Temp0) || _isnan(Temp1)) {
|
||||
#ifndef EXTERNAL_RELEASE
|
||||
|
@ -2137,110 +2135,110 @@ __inline void Double_RoundToInteger64( unsigned __int64 * Dest, double * Source
|
|||
|
||||
void R4300iOp::COP1_D_ADD (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(RoundingModel,_MCW_RC);
|
||||
*(double *)_FPRDoubleLocation[m_Opcode.fd] = *(double *)_FPRDoubleLocation[m_Opcode.fs] + *(double *)_FPRDoubleLocation[m_Opcode.ft];
|
||||
_controlfp(*_RoundingModel,_MCW_RC);
|
||||
*(double *)_FPR_D[m_Opcode.fd] = *(double *)_FPR_D[m_Opcode.fs] + *(double *)_FPR_D[m_Opcode.ft];
|
||||
}
|
||||
|
||||
void R4300iOp::COP1_D_SUB (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(RoundingModel,_MCW_RC);
|
||||
*(double *)_FPRDoubleLocation[m_Opcode.fd] = *(double *)_FPRDoubleLocation[m_Opcode.fs] - *(double *)_FPRDoubleLocation[m_Opcode.ft];
|
||||
_controlfp(*_RoundingModel,_MCW_RC);
|
||||
*(double *)_FPR_D[m_Opcode.fd] = *(double *)_FPR_D[m_Opcode.fs] - *(double *)_FPR_D[m_Opcode.ft];
|
||||
}
|
||||
|
||||
void R4300iOp::COP1_D_MUL (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(RoundingModel,_MCW_RC);
|
||||
*(double *)_FPRDoubleLocation[m_Opcode.fd] = *(double *)_FPRDoubleLocation[m_Opcode.fs] * *(double *)_FPRDoubleLocation[m_Opcode.ft];
|
||||
_controlfp(*_RoundingModel,_MCW_RC);
|
||||
*(double *)_FPR_D[m_Opcode.fd] = *(double *)_FPR_D[m_Opcode.fs] * *(double *)_FPR_D[m_Opcode.ft];
|
||||
}
|
||||
|
||||
void R4300iOp::COP1_D_DIV (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(RoundingModel,_MCW_RC);
|
||||
*(double *)_FPRDoubleLocation[m_Opcode.fd] = *(double *)_FPRDoubleLocation[m_Opcode.fs] / *(double *)_FPRDoubleLocation[m_Opcode.ft];
|
||||
_controlfp(*_RoundingModel,_MCW_RC);
|
||||
*(double *)_FPR_D[m_Opcode.fd] = *(double *)_FPR_D[m_Opcode.fs] / *(double *)_FPR_D[m_Opcode.ft];
|
||||
}
|
||||
|
||||
void R4300iOp::COP1_D_SQRT (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(RoundingModel,_MCW_RC);
|
||||
*(double *)_FPRDoubleLocation[m_Opcode.fd] = (double)sqrt(*(double *)_FPRDoubleLocation[m_Opcode.fs]);
|
||||
_controlfp(*_RoundingModel,_MCW_RC);
|
||||
*(double *)_FPR_D[m_Opcode.fd] = (double)sqrt(*(double *)_FPR_D[m_Opcode.fs]);
|
||||
}
|
||||
|
||||
void R4300iOp::COP1_D_ABS (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(RoundingModel,_MCW_RC);
|
||||
*(double *)_FPRDoubleLocation[m_Opcode.fd] = fabs(*(double *)_FPRDoubleLocation[m_Opcode.fs]);
|
||||
_controlfp(*_RoundingModel,_MCW_RC);
|
||||
*(double *)_FPR_D[m_Opcode.fd] = fabs(*(double *)_FPR_D[m_Opcode.fs]);
|
||||
}
|
||||
|
||||
void R4300iOp::COP1_D_MOV (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(RoundingModel,_MCW_RC);
|
||||
*(__int64 *)_FPRDoubleLocation[m_Opcode.fd] = *(__int64 *)_FPRDoubleLocation[m_Opcode.fs];
|
||||
_controlfp(*_RoundingModel,_MCW_RC);
|
||||
*(__int64 *)_FPR_D[m_Opcode.fd] = *(__int64 *)_FPR_D[m_Opcode.fs];
|
||||
}
|
||||
|
||||
void R4300iOp::COP1_D_NEG (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(RoundingModel,_MCW_RC);
|
||||
*(double *)_FPRDoubleLocation[m_Opcode.fd] = (*(double *)_FPRDoubleLocation[m_Opcode.fs] * -1.0);
|
||||
_controlfp(*_RoundingModel,_MCW_RC);
|
||||
*(double *)_FPR_D[m_Opcode.fd] = (*(double *)_FPR_D[m_Opcode.fs] * -1.0);
|
||||
}
|
||||
|
||||
void R4300iOp::COP1_D_TRUNC_L (void) { //added by Witten
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(RC_CHOP,_MCW_RC);
|
||||
Double_RoundToInteger64(&*(QWORD *)_FPRFloatLocation[m_Opcode.fd],&*(double *)_FPRDoubleLocation[m_Opcode.fs] );
|
||||
Double_RoundToInteger64(&*(QWORD *)_FPR_S[m_Opcode.fd],&*(double *)_FPR_D[m_Opcode.fs] );
|
||||
}
|
||||
|
||||
void R4300iOp::COP1_D_CEIL_L (void) { //added by Witten
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(RC_UP,_MCW_RC);
|
||||
Double_RoundToInteger64(&*(QWORD *)_FPRFloatLocation[m_Opcode.fd],&*(double *)_FPRDoubleLocation[m_Opcode.fs] );
|
||||
Double_RoundToInteger64(&*(QWORD *)_FPR_S[m_Opcode.fd],&*(double *)_FPR_D[m_Opcode.fs] );
|
||||
}
|
||||
|
||||
void R4300iOp::COP1_D_FLOOR_L (void) { //added by Witten
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(_RC_DOWN,_MCW_RC);
|
||||
Double_RoundToInteger64(&*(QWORD *)_FPRDoubleLocation[m_Opcode.fd],&*(double *)_FPRFloatLocation[m_Opcode.fs]);
|
||||
Double_RoundToInteger64(&*(QWORD *)_FPR_D[m_Opcode.fd],&*(double *)_FPR_S[m_Opcode.fs]);
|
||||
}
|
||||
|
||||
void R4300iOp::COP1_D_ROUND_W (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(_RC_NEAR,_MCW_RC);
|
||||
Double_RoundToInteger32(&*(DWORD *)_FPRFloatLocation[m_Opcode.fd],&*(double *)_FPRDoubleLocation[m_Opcode.fs] );
|
||||
Double_RoundToInteger32(&*(DWORD *)_FPR_S[m_Opcode.fd],&*(double *)_FPR_D[m_Opcode.fs] );
|
||||
}
|
||||
|
||||
void R4300iOp::COP1_D_TRUNC_W (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(RC_CHOP,_MCW_RC);
|
||||
Double_RoundToInteger32(&*(DWORD *)_FPRFloatLocation[m_Opcode.fd],&*(double *)_FPRDoubleLocation[m_Opcode.fs] );
|
||||
Double_RoundToInteger32(&*(DWORD *)_FPR_S[m_Opcode.fd],&*(double *)_FPR_D[m_Opcode.fs] );
|
||||
}
|
||||
|
||||
void R4300iOp::COP1_D_CEIL_W (void) { //added by Witten
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(RC_UP,_MCW_RC);
|
||||
Double_RoundToInteger32(&*(DWORD *)_FPRFloatLocation[m_Opcode.fd],&*(double *)_FPRDoubleLocation[m_Opcode.fs] );
|
||||
Double_RoundToInteger32(&*(DWORD *)_FPR_S[m_Opcode.fd],&*(double *)_FPR_D[m_Opcode.fs] );
|
||||
}
|
||||
|
||||
void R4300iOp::COP1_D_FLOOR_W (void) { //added by Witten
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(_RC_DOWN,_MCW_RC);
|
||||
Double_RoundToInteger32(&*(DWORD *)_FPRDoubleLocation[m_Opcode.fd],&*(double *)_FPRFloatLocation[m_Opcode.fs]);
|
||||
Double_RoundToInteger32(&*(DWORD *)_FPR_D[m_Opcode.fd],&*(double *)_FPR_S[m_Opcode.fs]);
|
||||
}
|
||||
|
||||
void R4300iOp::COP1_D_CVT_S (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(RoundingModel,_MCW_RC);
|
||||
*(float *)_FPRFloatLocation[m_Opcode.fd] = (float)*(double *)_FPRDoubleLocation[m_Opcode.fs];
|
||||
_controlfp(*_RoundingModel,_MCW_RC);
|
||||
*(float *)_FPR_S[m_Opcode.fd] = (float)*(double *)_FPR_D[m_Opcode.fs];
|
||||
}
|
||||
|
||||
void R4300iOp::COP1_D_CVT_W (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(RoundingModel,_MCW_RC);
|
||||
Double_RoundToInteger32(&*(DWORD *)_FPRFloatLocation[m_Opcode.fd],&*(double *)_FPRDoubleLocation[m_Opcode.fs] );
|
||||
_controlfp(*_RoundingModel,_MCW_RC);
|
||||
Double_RoundToInteger32(&*(DWORD *)_FPR_S[m_Opcode.fd],&*(double *)_FPR_D[m_Opcode.fs] );
|
||||
}
|
||||
|
||||
void R4300iOp::COP1_D_CVT_L (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(RoundingModel,_MCW_RC);
|
||||
Double_RoundToInteger64(&*(unsigned __int64 *)_FPRDoubleLocation[m_Opcode.fd],&*(double *)_FPRDoubleLocation[m_Opcode.fs]);
|
||||
_controlfp(*_RoundingModel,_MCW_RC);
|
||||
Double_RoundToInteger64(&*(unsigned __int64 *)_FPR_D[m_Opcode.fd],&*(double *)_FPR_D[m_Opcode.fs]);
|
||||
}
|
||||
|
||||
void R4300iOp::COP1_D_CMP (void) {
|
||||
|
@ -2249,8 +2247,8 @@ void R4300iOp::COP1_D_CMP (void) {
|
|||
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
|
||||
Temp0.DW = *(__int64 *)_FPRDoubleLocation[m_Opcode.fs];
|
||||
Temp1.DW = *(__int64 *)_FPRDoubleLocation[m_Opcode.ft];
|
||||
Temp0.DW = *(__int64 *)_FPR_D[m_Opcode.fs];
|
||||
Temp1.DW = *(__int64 *)_FPR_D[m_Opcode.ft];
|
||||
|
||||
if (_isnan(Temp0.D) || _isnan(Temp1.D)) {
|
||||
#ifndef EXTERNAL_RELEASE
|
||||
|
@ -2283,27 +2281,27 @@ void R4300iOp::COP1_D_CMP (void) {
|
|||
/************************** COP1: W functions ************************/
|
||||
void R4300iOp::COP1_W_CVT_S (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(RoundingModel,_MCW_RC);
|
||||
*(float *)_FPRFloatLocation[m_Opcode.fd] = (float)*(int *)_FPRFloatLocation[m_Opcode.fs];
|
||||
_controlfp(*_RoundingModel,_MCW_RC);
|
||||
*(float *)_FPR_S[m_Opcode.fd] = (float)*(int *)_FPR_S[m_Opcode.fs];
|
||||
}
|
||||
|
||||
void R4300iOp::COP1_W_CVT_D (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(RoundingModel,_MCW_RC);
|
||||
*(double *)_FPRDoubleLocation[m_Opcode.fd] = (double)*(int *)_FPRFloatLocation[m_Opcode.fs];
|
||||
_controlfp(*_RoundingModel,_MCW_RC);
|
||||
*(double *)_FPR_D[m_Opcode.fd] = (double)*(int *)_FPR_S[m_Opcode.fs];
|
||||
}
|
||||
|
||||
/************************** COP1: L functions ************************/
|
||||
void R4300iOp::COP1_L_CVT_S (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(RoundingModel,_MCW_RC);
|
||||
*(float *)_FPRFloatLocation[m_Opcode.fd] = (float)*(__int64 *)_FPRDoubleLocation[m_Opcode.fs];
|
||||
_controlfp(*_RoundingModel,_MCW_RC);
|
||||
*(float *)_FPR_S[m_Opcode.fd] = (float)*(__int64 *)_FPR_D[m_Opcode.fs];
|
||||
}
|
||||
|
||||
void R4300iOp::COP1_L_CVT_D (void) {
|
||||
TEST_COP1_USABLE_EXCEPTION
|
||||
_controlfp(RoundingModel,_MCW_RC);
|
||||
*(double *)_FPRDoubleLocation[m_Opcode.fd] = (double)*(__int64 *)_FPRDoubleLocation[m_Opcode.fs];
|
||||
_controlfp(*_RoundingModel,_MCW_RC);
|
||||
*(double *)_FPR_D[m_Opcode.fd] = (double)*(__int64 *)_FPR_D[m_Opcode.fs];
|
||||
}
|
||||
|
||||
/************************** Other functions **************************/
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
class R4300iOp
|
||||
class R4300iOp :
|
||||
protected CSystemRegisters
|
||||
{
|
||||
public:
|
||||
typedef void ( * Func )();
|
||||
|
@ -221,14 +222,3 @@ protected:
|
|||
static const int SWL_SHIFT[4], SWR_SHIFT[4], LWL_SHIFT[4], LWR_SHIFT[4];
|
||||
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern int RoundingModel;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -6,13 +6,6 @@ class CMipsMemoryVM :
|
|||
public CMipsMemory,
|
||||
public CTransVaddr,
|
||||
private CRecompilerOps
|
||||
#ifdef toremove
|
||||
,
|
||||
|
||||
public CTLB,
|
||||
public CMemoryLabel/*,
|
||||
private CPIFRam*/
|
||||
#endif
|
||||
{
|
||||
//Make sure plugins can directly access this information
|
||||
friend CGfxPlugin;
|
||||
|
@ -133,7 +126,7 @@ public:
|
|||
void ResetMemoryStack ( CRegInfo & RegInfo );
|
||||
void Compile_LB ( CX86Ops::x86Reg Reg, DWORD Addr, BOOL SignExtend );
|
||||
void Compile_LH ( CX86Ops::x86Reg Reg, DWORD Addr, BOOL SignExtend );
|
||||
void Compile_LW ( CCodeSection * Section, CX86Ops::x86Reg Reg, DWORD Addr );
|
||||
void Compile_LW ( CX86Ops::x86Reg Reg, DWORD Addr );
|
||||
void Compile_SB_Const ( BYTE Value, DWORD Addr );
|
||||
void Compile_SB_Register ( CX86Ops::x86Reg Reg, DWORD Addr );
|
||||
void Compile_SH_Const ( WORD Value, DWORD Addr );
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -36,6 +36,20 @@ const char * CRegName::FPR_Ctrl[32] = {"Revision","Unknown","Unknown","Unknown",
|
|||
"Unknown","Unknown","Unknown","Unknown","Unknown","Unknown",
|
||||
"Unknown","Unknown","FCSR"};
|
||||
|
||||
DWORD * CSystemRegisters::_PROGRAM_COUNTER = NULL;
|
||||
MIPS_DWORD * CSystemRegisters::_GPR = NULL;
|
||||
MIPS_DWORD * CSystemRegisters::_FPR = NULL;
|
||||
DWORD * CSystemRegisters::_CP0 = NULL;
|
||||
MIPS_DWORD * CSystemRegisters::_RegHI = NULL;
|
||||
MIPS_DWORD * CSystemRegisters::_RegLO = NULL;
|
||||
float ** CSystemRegisters::_FPR_S;
|
||||
double ** CSystemRegisters::_FPR_D;
|
||||
DWORD * CSystemRegisters::_FPCR = NULL;
|
||||
DWORD * CSystemRegisters::_LLBit = NULL;
|
||||
DWORD * CSystemRegisters::_LLAddr = NULL;
|
||||
ROUNDING_MODE * CSystemRegisters::_RoundingModel = NULL;
|
||||
|
||||
|
||||
CP0registers::CP0registers(DWORD * _CP0) :
|
||||
INDEX_REGISTER(_CP0[0]),
|
||||
RANDOM_REGISTER(_CP0[1]),
|
||||
|
@ -199,12 +213,21 @@ CRegisters::CRegisters (void) :
|
|||
DisplayControlReg(m_Display_ControlReg),
|
||||
Serial_InterfaceReg(m_SerialInterface)
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
|
||||
void CRegisters::Reset()
|
||||
{
|
||||
m_FirstInterupt = true;
|
||||
|
||||
memset(m_GPR,0,sizeof(m_GPR));
|
||||
memset(m_CP0,0,sizeof(m_CP0));
|
||||
memset(m_FPR,0,sizeof(m_FPR));
|
||||
memset(m_FPCR,0,sizeof(m_FPCR));
|
||||
m_HI.DW = 0;
|
||||
m_LO.DW = 0;
|
||||
m_RoundingModel = ROUND_NEAR;
|
||||
|
||||
//LLBit = 0;
|
||||
//LLAddr = 0;
|
||||
|
||||
|
@ -222,6 +245,78 @@ CRegisters::CRegisters (void) :
|
|||
FixFpuLocations();
|
||||
}
|
||||
|
||||
void CRegisters::SetAsCurrentSystem ( void )
|
||||
{
|
||||
_PROGRAM_COUNTER = &m_PROGRAM_COUNTER;
|
||||
_GPR = m_GPR;
|
||||
_FPR = m_FPR;
|
||||
_CP0 = m_CP0;
|
||||
_RegHI = &m_HI;
|
||||
_RegLO = &m_LO;
|
||||
_FPR_S = m_FPR_S;
|
||||
_FPR_D = m_FPR_D;
|
||||
_FPCR = m_FPCR;
|
||||
_LLBit = &m_LLBit;
|
||||
_LLAddr = &m_LLAddr;
|
||||
_RoundingModel = &m_RoundingModel;
|
||||
}
|
||||
|
||||
void CRegisters::CheckInterrupts ( void )
|
||||
{
|
||||
if (!g_FixedAudio && g_CPU_Type != CPU_SyncCores) {
|
||||
MI_INTR_REG &= ~MI_INTR_AI;
|
||||
MI_INTR_REG |= (m_AudioIntrReg & MI_INTR_AI);
|
||||
}
|
||||
if ((MI_INTR_MASK_REG & MI_INTR_REG) != 0) {
|
||||
FAKE_CAUSE_REGISTER |= CAUSE_IP2;
|
||||
} else {
|
||||
FAKE_CAUSE_REGISTER &= ~CAUSE_IP2;
|
||||
}
|
||||
|
||||
if (( STATUS_REGISTER & STATUS_IE ) == 0 ) { return; }
|
||||
if (( STATUS_REGISTER & STATUS_EXL ) != 0 ) { return; }
|
||||
if (( STATUS_REGISTER & STATUS_ERL ) != 0 ) { return; }
|
||||
|
||||
if (( STATUS_REGISTER & FAKE_CAUSE_REGISTER & 0xFF00) != 0) {
|
||||
if (m_FirstInterupt)
|
||||
{
|
||||
m_FirstInterupt = false;
|
||||
if (_Recompiler)
|
||||
{
|
||||
_Recompiler->ClearRecompCode_Virt(0x80000000,0x200,CRecompiler::Remove_InitialCode);
|
||||
}
|
||||
}
|
||||
_SystemEvents->QueueEvent(SysEvent_ExecuteInterrupt);
|
||||
}
|
||||
}
|
||||
|
||||
void CRegisters::DoAddressError ( BOOL DelaySlot, DWORD BadVaddr, BOOL FromRead)
|
||||
{
|
||||
#ifndef EXTERNAL_RELEASE
|
||||
DisplayError("AddressError");
|
||||
if (( STATUS_REGISTER & STATUS_EXL ) != 0 ) {
|
||||
DisplayError("EXL set in AddressError Exception");
|
||||
}
|
||||
if (( STATUS_REGISTER & STATUS_ERL ) != 0 ) {
|
||||
DisplayError("ERL set in AddressError Exception");
|
||||
}
|
||||
#endif
|
||||
if (FromRead) {
|
||||
CAUSE_REGISTER = EXC_RADE;
|
||||
} else {
|
||||
CAUSE_REGISTER = EXC_WADE;
|
||||
}
|
||||
BAD_VADDR_REGISTER = BadVaddr;
|
||||
if (DelaySlot) {
|
||||
CAUSE_REGISTER |= CAUSE_BD;
|
||||
EPC_REGISTER = m_PROGRAM_COUNTER - 4;
|
||||
} else {
|
||||
EPC_REGISTER = m_PROGRAM_COUNTER;
|
||||
}
|
||||
STATUS_REGISTER |= STATUS_EXL;
|
||||
m_PROGRAM_COUNTER = 0x80000180;
|
||||
}
|
||||
|
||||
void CRegisters::FixFpuLocations ( void ) {
|
||||
if ((STATUS_REGISTER & STATUS_FR) == 0) {
|
||||
for (int count = 0; count < 32; count ++) {
|
||||
|
@ -236,6 +331,126 @@ void CRegisters::FixFpuLocations ( void ) {
|
|||
}
|
||||
}
|
||||
|
||||
void CRegisters::DoBreakException ( BOOL DelaySlot)
|
||||
{
|
||||
#ifndef EXTERNAL_RELEASE
|
||||
if (( STATUS_REGISTER & STATUS_EXL ) != 0 ) {
|
||||
DisplayError("EXL set in Break Exception");
|
||||
}
|
||||
if (( STATUS_REGISTER & STATUS_ERL ) != 0 ) {
|
||||
DisplayError("ERL set in Break Exception");
|
||||
}
|
||||
#endif
|
||||
|
||||
CAUSE_REGISTER = EXC_BREAK;
|
||||
if (DelaySlot) {
|
||||
CAUSE_REGISTER |= CAUSE_BD;
|
||||
EPC_REGISTER = m_PROGRAM_COUNTER - 4;
|
||||
} else {
|
||||
EPC_REGISTER = m_PROGRAM_COUNTER;
|
||||
}
|
||||
STATUS_REGISTER |= STATUS_EXL;
|
||||
m_PROGRAM_COUNTER = 0x80000180;
|
||||
}
|
||||
|
||||
void CRegisters::DoCopUnusableException ( BOOL DelaySlot, int Coprocessor )
|
||||
{
|
||||
#ifndef EXTERNAL_RELEASE
|
||||
if (( STATUS_REGISTER & STATUS_EXL ) != 0 ) {
|
||||
DisplayError("EXL set in Break Exception");
|
||||
}
|
||||
if (( STATUS_REGISTER & STATUS_ERL ) != 0 ) {
|
||||
DisplayError("ERL set in Break Exception");
|
||||
}
|
||||
#endif
|
||||
|
||||
CAUSE_REGISTER = EXC_CPU;
|
||||
if (Coprocessor == 1) { CAUSE_REGISTER |= 0x10000000; }
|
||||
if (DelaySlot) {
|
||||
CAUSE_REGISTER |= CAUSE_BD;
|
||||
EPC_REGISTER = m_PROGRAM_COUNTER - 4;
|
||||
} else {
|
||||
EPC_REGISTER = m_PROGRAM_COUNTER;
|
||||
}
|
||||
STATUS_REGISTER |= STATUS_EXL;
|
||||
m_PROGRAM_COUNTER = 0x80000180;
|
||||
}
|
||||
|
||||
|
||||
BOOL CRegisters::DoIntrException ( BOOL DelaySlot )
|
||||
{
|
||||
if (( STATUS_REGISTER & STATUS_IE ) == 0 ) { return FALSE; }
|
||||
if (( STATUS_REGISTER & STATUS_EXL ) != 0 ) { return FALSE; }
|
||||
if (( STATUS_REGISTER & STATUS_ERL ) != 0 ) { return FALSE; }
|
||||
#if (!defined(EXTERNAL_RELEASE))
|
||||
if (LogOptions.GenerateLog && LogOptions.LogExceptions && !LogOptions.NoInterrupts) {
|
||||
LogMessage("%08X: Interupt Generated", m_PROGRAM_COUNTER );
|
||||
}
|
||||
#endif
|
||||
CAUSE_REGISTER = FAKE_CAUSE_REGISTER;
|
||||
CAUSE_REGISTER |= EXC_INT;
|
||||
if (DelaySlot) {
|
||||
CAUSE_REGISTER |= CAUSE_BD;
|
||||
EPC_REGISTER = m_PROGRAM_COUNTER - 4;
|
||||
} else {
|
||||
EPC_REGISTER = m_PROGRAM_COUNTER;
|
||||
}
|
||||
STATUS_REGISTER |= STATUS_EXL;
|
||||
m_PROGRAM_COUNTER = 0x80000180;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void CRegisters::DoTLBMiss ( BOOL DelaySlot, DWORD BadVaddr )
|
||||
{
|
||||
CAUSE_REGISTER = EXC_RMISS;
|
||||
BAD_VADDR_REGISTER = BadVaddr;
|
||||
CONTEXT_REGISTER &= 0xFF80000F;
|
||||
CONTEXT_REGISTER |= (BadVaddr >> 9) & 0x007FFFF0;
|
||||
ENTRYHI_REGISTER = (BadVaddr & 0xFFFFE000);
|
||||
if ((STATUS_REGISTER & STATUS_EXL) == 0) {
|
||||
if (DelaySlot) {
|
||||
CAUSE_REGISTER |= CAUSE_BD;
|
||||
EPC_REGISTER = m_PROGRAM_COUNTER - 4;
|
||||
} else {
|
||||
EPC_REGISTER = m_PROGRAM_COUNTER;
|
||||
}
|
||||
if (_TLB->AddressDefined(BadVaddr))
|
||||
{
|
||||
m_PROGRAM_COUNTER = 0x80000180;
|
||||
} else {
|
||||
m_PROGRAM_COUNTER = 0x80000000;
|
||||
}
|
||||
STATUS_REGISTER |= STATUS_EXL;
|
||||
} else {
|
||||
#ifndef EXTERNAL_RELEASE
|
||||
DisplayError("TLBMiss - EXL Set\nBadVaddr = %X\nAddress Defined: %s",BadVaddr,_TLB->AddressDefined(BadVaddr)?"TRUE":"FALSE");
|
||||
#endif
|
||||
m_PROGRAM_COUNTER = 0x80000180;
|
||||
}
|
||||
}
|
||||
|
||||
void CRegisters::DoSysCallException ( BOOL DelaySlot)
|
||||
{
|
||||
#ifndef EXTERNAL_RELEASE
|
||||
if (( STATUS_REGISTER & STATUS_EXL ) != 0 ) {
|
||||
DisplayError("EXL set in SysCall Exception");
|
||||
}
|
||||
if (( STATUS_REGISTER & STATUS_ERL ) != 0 ) {
|
||||
DisplayError("ERL set in SysCall Exception");
|
||||
}
|
||||
#endif
|
||||
|
||||
CAUSE_REGISTER = EXC_SYSCALL;
|
||||
if (DelaySlot) {
|
||||
CAUSE_REGISTER |= CAUSE_BD;
|
||||
EPC_REGISTER = m_PROGRAM_COUNTER - 4;
|
||||
} else {
|
||||
EPC_REGISTER = m_PROGRAM_COUNTER;
|
||||
}
|
||||
STATUS_REGISTER |= STATUS_EXL;
|
||||
m_PROGRAM_COUNTER = 0x80000180;
|
||||
}
|
||||
|
||||
#ifdef toremove
|
||||
void CRegisters::InitalizeR4300iRegisters (CMipsMemory & MMU, bool PostPif, int Country, CICChip CIC_Chip)
|
||||
{
|
||||
|
@ -428,127 +643,3 @@ void CRegisters::InitalizeR4300iRegisters (CMipsMemory & MMU, bool PostPif, int
|
|||
FixFpuLocations();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef tofix
|
||||
void CRegisters::CheckInterrupts ( void ) {
|
||||
if ((MI_INTR_MASK_REG & MI_INTR_REG) != 0) {
|
||||
FAKE_CAUSE_REGISTER |= CAUSE_IP2;
|
||||
} else {
|
||||
FAKE_CAUSE_REGISTER &= ~CAUSE_IP2;
|
||||
}
|
||||
|
||||
if (( STATUS_REGISTER & STATUS_IE ) == 0 ) { return; }
|
||||
if (( STATUS_REGISTER & STATUS_EXL ) != 0 ) { return; }
|
||||
if (( STATUS_REGISTER & STATUS_ERL ) != 0 ) { return; }
|
||||
|
||||
if (( STATUS_REGISTER & FAKE_CAUSE_REGISTER & 0xFF00) != 0) {
|
||||
_N64System->ExternalEvent(ExecuteInterrupt);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef toremove
|
||||
|
||||
void CRegisters::ExecuteInterruptException ( bool DelaySlot ) {
|
||||
if (( STATUS_REGISTER & STATUS_IE ) == 0 ) { return; }
|
||||
if (( STATUS_REGISTER & STATUS_EXL ) != 0 ) { return; }
|
||||
if (( STATUS_REGISTER & STATUS_ERL ) != 0 ) { return; }
|
||||
// TlbLog.Log("%08X: ExecuteInterruptException %X", PROGRAM_COUNTER,FAKE_CAUSE_REGISTER);
|
||||
CAUSE_REGISTER = FAKE_CAUSE_REGISTER;
|
||||
CAUSE_REGISTER |= EXC_INT;
|
||||
if (DelaySlot) {
|
||||
CAUSE_REGISTER |= CAUSE_BD;
|
||||
EPC_REGISTER = PROGRAM_COUNTER - 4;
|
||||
} else {
|
||||
EPC_REGISTER = PROGRAM_COUNTER;
|
||||
}
|
||||
STATUS_REGISTER |= STATUS_EXL;
|
||||
PROGRAM_COUNTER = 0x80000180;
|
||||
}
|
||||
|
||||
void CRegisters::ExecuteCopUnusableException ( bool DelaySlot, int Coprocessor ) {
|
||||
// TlbLog.Log("%08X: ExecuteCopUnusableException %X", PROGRAM_COUNTER,Coprocessor);
|
||||
CAUSE_REGISTER = EXC_CPU;
|
||||
if (Coprocessor == 1) { CAUSE_REGISTER |= 0x10000000; }
|
||||
if (DelaySlot) {
|
||||
CAUSE_REGISTER |= CAUSE_BD;
|
||||
EPC_REGISTER = PROGRAM_COUNTER - 4;
|
||||
} else {
|
||||
EPC_REGISTER = PROGRAM_COUNTER;
|
||||
}
|
||||
STATUS_REGISTER |= STATUS_EXL;
|
||||
PROGRAM_COUNTER = 0x80000180;
|
||||
}
|
||||
|
||||
void CRegisters::ExecuteSysCallException ( bool DelaySlot) {
|
||||
if (( STATUS_REGISTER & STATUS_EXL ) != 0 ) {
|
||||
_Notify->DisplayError("EXL set in SysCall Exception");
|
||||
}
|
||||
if (( STATUS_REGISTER & STATUS_ERL ) != 0 ) {
|
||||
_Notify->DisplayError("ERL set in SysCall Exception");
|
||||
}
|
||||
|
||||
CAUSE_REGISTER = EXC_SYSCALL;
|
||||
if (DelaySlot) {
|
||||
CAUSE_REGISTER |= CAUSE_BD;
|
||||
EPC_REGISTER = PROGRAM_COUNTER - 4;
|
||||
} else {
|
||||
EPC_REGISTER = PROGRAM_COUNTER;
|
||||
}
|
||||
STATUS_REGISTER |= STATUS_EXL;
|
||||
PROGRAM_COUNTER = 0x80000180;
|
||||
}
|
||||
|
||||
|
||||
void CRegisters::ExecuteTLBMissException ( CMipsMemory * MMU, bool DelaySlot, DWORD BadVaddr ) {
|
||||
//TlbLog.Log("ExecuteTLBMissException PC: %X BadVaddr: %X",PROGRAM_COUNTER,BadVaddr);
|
||||
CAUSE_REGISTER = EXC_RMISS;
|
||||
BAD_VADDR_REGISTER = BadVaddr;
|
||||
CONTEXT_REGISTER &= 0xFF80000F;
|
||||
CONTEXT_REGISTER |= (BadVaddr >> 9) & 0x007FFFF0;
|
||||
ENTRYHI_REGISTER = (BadVaddr & 0xFFFFE000);
|
||||
if ((STATUS_REGISTER & STATUS_EXL) == 0) {
|
||||
if (DelaySlot) {
|
||||
CAUSE_REGISTER |= CAUSE_BD;
|
||||
EPC_REGISTER = PROGRAM_COUNTER - 4;
|
||||
} else {
|
||||
EPC_REGISTER = PROGRAM_COUNTER;
|
||||
}
|
||||
if (MMU->TLB_AddressDefined(BadVaddr)) {
|
||||
PROGRAM_COUNTER = 0x80000180;
|
||||
} else {
|
||||
PROGRAM_COUNTER = 0x80000000;
|
||||
}
|
||||
STATUS_REGISTER |= STATUS_EXL;
|
||||
} else {
|
||||
_Notify->BreakPoint(__FILE__,__LINE__);
|
||||
PROGRAM_COUNTER = 0x80000180;
|
||||
}
|
||||
}
|
||||
|
||||
void CRegisters::UpdateRegisterAfterOpcode (float StepIncrease) {
|
||||
COUNT_REGISTER += (DWORD)StepIncrease;
|
||||
// RANDOM_REGISTER -= 1;
|
||||
// if ((int)RANDOM_REGISTER < (int)WIRED_REGISTER) { RANDOM_REGISTER = 31; }
|
||||
UpdateTimer(StepIncrease);
|
||||
}
|
||||
|
||||
void CRegisters::SetCurrentRoundingModel (ROUNDING_MODE RoundMode) {
|
||||
switch (RoundMode) {
|
||||
case ROUND_NEAR: _controlfp(_RC_NEAR,_MCW_RC); break;
|
||||
case ROUND_CHOP: _controlfp(_RC_CHOP,_MCW_RC); break;
|
||||
case ROUND_UP: _controlfp(_RC_UP, _MCW_RC); break;
|
||||
case ROUND_DOWN: _controlfp(_RC_DOWN,_MCW_RC); break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void CRegisters::ChangeDefaultRoundingModel (int Reg) {
|
||||
switch((FPCR[Reg] & 3)) {
|
||||
case 0: _RoundingModel = ROUND_NEAR; break;
|
||||
case 1: _RoundingModel = ROUND_CHOP; break;
|
||||
case 2: _RoundingModel = ROUND_UP; break;
|
||||
case 3: _RoundingModel = ROUND_DOWN; break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
|
@ -426,6 +426,13 @@ enum {
|
|||
};
|
||||
|
||||
|
||||
enum ROUNDING_MODE {
|
||||
ROUND_NEAR = _RC_NEAR,
|
||||
ROUND_DOWN = _RC_DOWN,
|
||||
ROUND_UP = _RC_UP,
|
||||
ROUND_CHOP = _RC_CHOP,
|
||||
};
|
||||
|
||||
class CRegName {
|
||||
public:
|
||||
static const char *GPR[32];
|
||||
|
@ -436,7 +443,25 @@ public:
|
|||
static const char *FPR_Ctrl[32];
|
||||
};
|
||||
|
||||
class CSystemRegisters
|
||||
{
|
||||
protected:
|
||||
static DWORD * _PROGRAM_COUNTER;
|
||||
static MIPS_DWORD * _GPR;
|
||||
static MIPS_DWORD * _FPR;
|
||||
static DWORD * _CP0;
|
||||
static MIPS_DWORD * _RegHI;
|
||||
static MIPS_DWORD * _RegLO;
|
||||
static float ** _FPR_S;
|
||||
static double ** _FPR_D;
|
||||
static DWORD * _FPCR;
|
||||
static DWORD * _LLBit;
|
||||
static DWORD * _LLAddr;
|
||||
static ROUNDING_MODE * _RoundingModel;
|
||||
};
|
||||
|
||||
class CRegisters:
|
||||
protected CSystemRegisters,
|
||||
public CP0registers,
|
||||
public Rdram_InterfaceReg,
|
||||
public Mips_InterfaceReg,
|
||||
|
@ -451,13 +476,6 @@ class CRegisters:
|
|||
public:
|
||||
CRegisters();
|
||||
|
||||
enum ROUNDING_MODE {
|
||||
ROUND_NEAR = 0x00000000,
|
||||
ROUND_CHOP = 0x00000300,
|
||||
ROUND_UP = 0x00000200,
|
||||
ROUND_DOWN = 0x00000100,
|
||||
};
|
||||
|
||||
//General Registers
|
||||
DWORD m_PROGRAM_COUNTER;
|
||||
MIPS_DWORD m_GPR[32];
|
||||
|
@ -486,66 +504,19 @@ public:
|
|||
DWORD m_SerialInterface[4];
|
||||
DWORD m_AudioIntrReg;
|
||||
|
||||
|
||||
void CheckInterrupts ( void );
|
||||
void DoAddressError ( BOOL DelaySlot, DWORD BadVaddr, BOOL FromRead );
|
||||
void DoBreakException ( BOOL DelaySlot );
|
||||
void DoCopUnusableException ( BOOL DelaySlot, int Coprocessor );
|
||||
BOOL DoIntrException ( BOOL DelaySlot );
|
||||
void DoTLBMiss ( BOOL DelaySlot, DWORD BadVaddr );
|
||||
void DoSysCallException ( BOOL DelaySlot);
|
||||
void FixFpuLocations ( void );
|
||||
void Reset ( void );
|
||||
void SetAsCurrentSystem ( void );
|
||||
|
||||
private:
|
||||
bool m_FirstInterupt;
|
||||
|
||||
};
|
||||
|
||||
#ifdef toremove
|
||||
|
||||
#ifndef __REGISTER_CLASS__H__
|
||||
#define __REGISTER_CLASS__H__
|
||||
|
||||
#include "System Timing.h" //base class
|
||||
|
||||
enum ROUNDING_MODE {
|
||||
ROUND_NEAR = 0x00000000,
|
||||
ROUND_CHOP = 0x00000300,
|
||||
ROUND_UP = 0x00000200,
|
||||
ROUND_DOWN = 0x00000100,
|
||||
};
|
||||
|
||||
//registers general come from a mapping from the memory class to a pointer
|
||||
//inside Classes. To make the code cleaner with out using global variables
|
||||
//we just use this pointer.
|
||||
|
||||
|
||||
|
||||
|
||||
//Converting FPU
|
||||
__inline void S_RoundToInteger32( int * Dest, float * Source ) {
|
||||
_asm {
|
||||
mov esi, [Source]
|
||||
mov edi, [Dest]
|
||||
fld dword ptr [esi]
|
||||
fistp dword ptr [edi]
|
||||
}
|
||||
}
|
||||
|
||||
__inline void S_RoundToInteger64( __int64 * Dest, float * Source ) {
|
||||
_asm {
|
||||
mov esi, [Source]
|
||||
mov edi, [Dest]
|
||||
fld dword ptr [esi]
|
||||
fistp qword ptr [edi]
|
||||
}
|
||||
}
|
||||
|
||||
__inline void D_RoundToInteger32( int * Dest, double * Source ) {
|
||||
_asm {
|
||||
mov esi, [Source]
|
||||
mov edi, [Dest]
|
||||
fld qword ptr [esi]
|
||||
fistp dword ptr [edi]
|
||||
}
|
||||
}
|
||||
|
||||
__inline void D_RoundToInteger64( __int64 * Dest, double * Source ) {
|
||||
_asm {
|
||||
mov esi, [Source]
|
||||
mov edi, [Dest]
|
||||
fld qword ptr [esi]
|
||||
fistp qword ptr [edi]
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
|
@ -0,0 +1,168 @@
|
|||
#include "stdafx.h"
|
||||
|
||||
CSystemEvents::CSystemEvents() :
|
||||
m_bDoSomething(false)
|
||||
{
|
||||
}
|
||||
|
||||
CSystemEvents::~CSystemEvents()
|
||||
{
|
||||
}
|
||||
|
||||
void CSystemEvents::QueueEvent(SystemEvent action)
|
||||
{
|
||||
m_bDoSomething = true;
|
||||
|
||||
CGuard Guard(m_CS);
|
||||
for (EventList::const_iterator iter = m_Events.begin(); iter != m_Events.end(); iter++)
|
||||
{
|
||||
if (*iter == action)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
m_Events.push_back(action);
|
||||
}
|
||||
|
||||
void CSystemEvents::ExecuteEvents ( void )
|
||||
{
|
||||
CGuard Guard(m_CS);
|
||||
|
||||
m_bDoSomething = false;
|
||||
if (m_Events.size() == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
EventList Events = m_Events;
|
||||
m_Events.clear();
|
||||
bool bPause = false;
|
||||
|
||||
for (EventList::const_iterator iter = Events.begin(); iter != Events.end(); iter++ )
|
||||
{
|
||||
switch (*iter)
|
||||
{
|
||||
case SysEvent_ResetCPU_Soft:
|
||||
_SystemTimer->SetTimer(CSystemTimer::SoftResetTimer,0x3000000,false);
|
||||
_Plugins->Gfx()->ShowCFB();
|
||||
_Reg->FAKE_CAUSE_REGISTER |= CAUSE_IP4;
|
||||
_Reg->CheckInterrupts();
|
||||
_Plugins->Gfx()->SoftReset();
|
||||
break;
|
||||
case SysEvent_Profile_GenerateLogs:
|
||||
GenerateProfileLog();
|
||||
break;
|
||||
case SysEvent_Profile_StartStop:
|
||||
case SysEvent_Profile_ResetLogs:
|
||||
ResetTimer();
|
||||
break;
|
||||
case SysEvent_ExecuteInterrupt:
|
||||
_Reg->DoIntrException(false);
|
||||
break;
|
||||
case SysEvent_Interrupt_SP:
|
||||
_Reg->MI_INTR_REG |= MI_INTR_SP;
|
||||
_Reg->DoIntrException(false);
|
||||
break;
|
||||
case SysEvent_Interrupt_SI:
|
||||
_Reg->MI_INTR_REG |= MI_INTR_SI;
|
||||
_Reg->DoIntrException(false);
|
||||
break;
|
||||
case SysEvent_Interrupt_AI:
|
||||
_Reg->MI_INTR_REG |= MI_INTR_AI;
|
||||
_Reg->DoIntrException(false);
|
||||
break;
|
||||
case SysEvent_Interrupt_VI:
|
||||
_Reg->MI_INTR_REG |= MI_INTR_VI;
|
||||
_Reg->DoIntrException(false);
|
||||
break;
|
||||
case SysEvent_Interrupt_PI:
|
||||
_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||
_Reg->DoIntrException(false);
|
||||
break;
|
||||
case SysEvent_Interrupt_DP:
|
||||
_Reg->MI_INTR_REG |= MI_INTR_DP;
|
||||
_Reg->DoIntrException(false);
|
||||
break;
|
||||
case SysEvent_SaveMachineState:
|
||||
if (!Machine_SaveState())
|
||||
{
|
||||
m_Events.push_back(SysEvent_SaveMachineState);
|
||||
m_bDoSomething = true;
|
||||
}
|
||||
break;
|
||||
case SysEvent_LoadMachineState:
|
||||
Machine_LoadState();
|
||||
break;
|
||||
case SysEvent_ChangePlugins:
|
||||
ChangePluginFunc();
|
||||
break;
|
||||
case SysEvent_ChangingFullScreen:
|
||||
ChangeFullScreenFunc();
|
||||
break;
|
||||
case SysEvent_GSButtonPressed:
|
||||
ApplyGSButtonCheats();
|
||||
break;
|
||||
case SysEvent_PauseCPU_FromMenu:
|
||||
if (!_Settings->LoadBool(GameRunning_CPU_Paused))
|
||||
{
|
||||
_Settings->SaveBool(GameRunning_CPU_Paused,true);
|
||||
_Settings->SaveDword(GameRunning_CPU_PausedType, PauseType_FromMenu);
|
||||
bPause = true;
|
||||
}
|
||||
break;
|
||||
case SysEvent_PauseCPU_AppLostFocus:
|
||||
if (!_Settings->LoadBool(GameRunning_CPU_Paused))
|
||||
{
|
||||
_Settings->SaveBool(GameRunning_CPU_Paused,true);
|
||||
_Settings->SaveDword(GameRunning_CPU_PausedType, PauseType_AppLostFocus);
|
||||
bPause = true;
|
||||
}
|
||||
break;
|
||||
case SysEvent_PauseCPU_AppLostActive:
|
||||
if (!_Settings->LoadBool(GameRunning_CPU_Paused))
|
||||
{
|
||||
_Settings->SaveBool(GameRunning_CPU_Paused,true);
|
||||
_Settings->SaveDword(GameRunning_CPU_PausedType, PauseType_AppLostActive);
|
||||
bPause = true;
|
||||
}
|
||||
break;
|
||||
case SysEvent_PauseCPU_SaveGame:
|
||||
if (!_Settings->LoadBool(GameRunning_CPU_Paused))
|
||||
{
|
||||
_Settings->SaveBool(GameRunning_CPU_Paused,true);
|
||||
_Settings->SaveDword(GameRunning_CPU_PausedType, PauseType_SaveGame);
|
||||
bPause = true;
|
||||
}
|
||||
break;
|
||||
case SysEvent_PauseCPU_LoadGame:
|
||||
if (!_Settings->LoadBool(GameRunning_CPU_Paused))
|
||||
{
|
||||
_Settings->SaveBool(GameRunning_CPU_Paused,true);
|
||||
_Settings->SaveDword(GameRunning_CPU_PausedType, PauseType_LoadGame);
|
||||
bPause = true;
|
||||
}
|
||||
break;
|
||||
case SysEvent_PauseCPU_DumpMemory:
|
||||
if (!_Settings->LoadBool(GameRunning_CPU_Paused))
|
||||
{
|
||||
_Settings->SaveBool(GameRunning_CPU_Paused,true);
|
||||
_Settings->SaveDword(GameRunning_CPU_PausedType, PauseType_DumpMemory);
|
||||
bPause = true;
|
||||
}
|
||||
break;
|
||||
case SysEvent_PauseCPU_SearchMemory:
|
||||
if (!_Settings->LoadBool(GameRunning_CPU_Paused))
|
||||
{
|
||||
_Settings->SaveBool(GameRunning_CPU_Paused,true);
|
||||
_Settings->SaveDword(GameRunning_CPU_PausedType, PauseType_SearchMemory);
|
||||
bPause = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (bPause)
|
||||
{
|
||||
PauseExecution();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
enum SystemEvent {
|
||||
SysEvent_ExecuteInterrupt,
|
||||
SysEvent_GSButtonPressed,
|
||||
SysEvent_ResetCPU_Soft,
|
||||
SysEvent_ResetCPU_Hard,
|
||||
SysEvent_CloseCPU,
|
||||
SysEvent_PauseCPU_FromMenu,
|
||||
SysEvent_PauseCPU_AppLostActive,
|
||||
SysEvent_PauseCPU_AppLostActiveDelay,
|
||||
SysEvent_PauseCPU_AppLostFocus,
|
||||
SysEvent_PauseCPU_SaveGame,
|
||||
SysEvent_PauseCPU_LoadGame,
|
||||
SysEvent_PauseCPU_DumpMemory,
|
||||
SysEvent_PauseCPU_SearchMemory,
|
||||
SysEvent_ResumeCPU_FromMenu,
|
||||
SysEvent_ResumeCPU_AppGainedActive,
|
||||
SysEvent_ResumeCPU_AppGainedFocus,
|
||||
SysEvent_ResumeCPU_SaveGame,
|
||||
SysEvent_ResumeCPU_LoadGame,
|
||||
SysEvent_ResumeCPU_DumpMemory,
|
||||
SysEvent_ResumeCPU_SearchMemory,
|
||||
SysEvent_ChangingFullScreen,
|
||||
SysEvent_ChangePlugins,
|
||||
SysEvent_SaveMachineState,
|
||||
SysEvent_LoadMachineState,
|
||||
SysEvent_Interrupt_SP,
|
||||
SysEvent_Interrupt_SI,
|
||||
SysEvent_Interrupt_AI,
|
||||
SysEvent_Interrupt_VI,
|
||||
SysEvent_Interrupt_PI,
|
||||
SysEvent_Interrupt_DP,
|
||||
SysEvent_Profile_StartStop,
|
||||
SysEvent_Profile_ResetLogs,
|
||||
SysEvent_Profile_GenerateLogs,
|
||||
SysEvent_CPUUsageTimerChanged,
|
||||
};
|
||||
|
||||
class CSystemEvents
|
||||
{
|
||||
typedef std::vector<SystemEvent> EventList;
|
||||
|
||||
protected:
|
||||
CSystemEvents();
|
||||
virtual ~CSystemEvents();
|
||||
|
||||
public:
|
||||
void ExecuteEvents ( void );
|
||||
void QueueEvent ( SystemEvent action);
|
||||
|
||||
inline const BOOL & DoSomething ( void ) const { return m_bDoSomething; }
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
EventList m_Events;
|
||||
BOOL m_bDoSomething;
|
||||
CriticalSection m_CS;
|
||||
};
|
|
@ -132,7 +132,7 @@ void CSystemTimer::TimerDone (void)
|
|||
switch (m_Current) {
|
||||
case CSystemTimer::CompareTimer:
|
||||
_Reg->FAKE_CAUSE_REGISTER |= CAUSE_IP7;
|
||||
CheckInterrupts();
|
||||
_Reg->CheckInterrupts();
|
||||
UpdateCompareTimer();
|
||||
break;
|
||||
case CSystemTimer::SoftResetTimer:
|
||||
|
@ -143,18 +143,18 @@ void CSystemTimer::TimerDone (void)
|
|||
_SystemTimer->StopTimer(CSystemTimer::SiTimer);
|
||||
_Reg->MI_INTR_REG |= MI_INTR_SI;
|
||||
_Reg->SI_STATUS_REG |= SI_STATUS_INTERRUPT;
|
||||
CheckInterrupts();
|
||||
_Reg->CheckInterrupts();
|
||||
break;
|
||||
case CSystemTimer::PiTimer:
|
||||
_SystemTimer->StopTimer(CSystemTimer::PiTimer);
|
||||
_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
||||
_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||
CheckInterrupts();
|
||||
_Reg->CheckInterrupts();
|
||||
break;
|
||||
case CSystemTimer::ViTimer:
|
||||
RefreshScreen();
|
||||
_Reg->MI_INTR_REG |= MI_INTR_VI;
|
||||
CheckInterrupts();
|
||||
_Reg->CheckInterrupts();
|
||||
break;
|
||||
case CSystemTimer::RspTimer:
|
||||
_SystemTimer->StopTimer(CSystemTimer::RspTimer);
|
||||
|
@ -163,7 +163,7 @@ void CSystemTimer::TimerDone (void)
|
|||
case CSystemTimer::AiTimer:
|
||||
_SystemTimer->StopTimer(CSystemTimer::AiTimer);
|
||||
_Reg->MI_INTR_REG |= MI_INTR_AI;
|
||||
CheckInterrupts();
|
||||
_Reg->CheckInterrupts();
|
||||
_Audio->AiCallBack();
|
||||
break;
|
||||
default:
|
||||
|
@ -185,7 +185,7 @@ void CSystemTimer::UpdateCompareTimer ( void )
|
|||
_SystemTimer->SetTimer(CSystemTimer::CompareTimer,NextCompare,false);
|
||||
}
|
||||
|
||||
#ifdef tofix
|
||||
#ifdef toremove
|
||||
extern CLog TlbLog;
|
||||
|
||||
void CSystemTimer::ChangeTimerFixed (TimerType Type, DWORD Cycles) {
|
||||
|
|
|
@ -8,7 +8,8 @@ public:
|
|||
virtual void TLB_Changed ( void ) = 0;
|
||||
};
|
||||
|
||||
class CTLB
|
||||
class CTLB :
|
||||
protected CSystemRegisters
|
||||
{
|
||||
public:
|
||||
typedef struct {
|
||||
|
@ -108,6 +109,7 @@ public:
|
|||
//See if a VAddr has an entry to translate to a PAddr
|
||||
bool AddressDefined ( DWORD VAddr );
|
||||
|
||||
const TLB_ENTRY & TlbEntry ( int Entry) const { return m_tlb[Entry]; }
|
||||
//Change the Virtual address to a Phyiscal Address
|
||||
/*inline bool TranslateVaddr ( DWORD VAddr, DWORD &PAddr) const
|
||||
{
|
||||
|
|
|
@ -4,6 +4,8 @@ CTLB::CTLB(CTLB_CB * CallBack ):
|
|||
m_CB(CallBack)
|
||||
{
|
||||
WriteTrace(TraceTLB,"CTLB::CTLB - Start");
|
||||
memset(m_tlb,0,sizeof(m_tlb));
|
||||
memset(m_FastTlb,0,sizeof(m_FastTlb));
|
||||
Reset(true);
|
||||
WriteTrace(TraceTLB,"CTLB::CTLB - Done");
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -4,7 +4,7 @@ typedef std::list<SystemEvent> EVENT_LIST;
|
|||
|
||||
typedef struct {
|
||||
stdstr FileName;
|
||||
void * ThreadHandle;
|
||||
HANDLE * ThreadHandle;
|
||||
DWORD ThreadID;
|
||||
} FileImageInfo;
|
||||
|
||||
|
@ -19,18 +19,19 @@ class CC_Core;
|
|||
class CN64System :
|
||||
private CMipsMemory_CallBack,
|
||||
private CTLB_CB,
|
||||
private CSystemEvents,
|
||||
protected CN64SystemSettings,
|
||||
public CDebugger
|
||||
{
|
||||
public:
|
||||
CN64System ( CPlugins * Plugins, bool SavesReadOnly );
|
||||
~CN64System ( void );
|
||||
virtual ~CN64System ( void );
|
||||
|
||||
//Methods
|
||||
static bool CN64System::RunFileImage ( const char * FileLoc );
|
||||
|
||||
void CloseCpu ( void );
|
||||
void ExternalEvent ( SystemEvent Event ); //covers gui interacting and timers etc..
|
||||
void ExternalEvent ( SystemEvent action ); //covers gui interacting and timers etc..
|
||||
stdstr ChooseFileToOpen ( WND_HANDLE hParent );
|
||||
void DisplayRomInfo ( WND_HANDLE hParent );
|
||||
void SelectCheats ( WND_HANDLE hParent );
|
||||
|
@ -40,7 +41,6 @@ public:
|
|||
void IncreaseSpeed ( void ) { m_Limitor.IncreaeSpeed(10); }
|
||||
void DecreaeSpeed ( void ) { m_Limitor.DecreaeSpeed(10); }
|
||||
void SoftReset ( void );
|
||||
|
||||
bool m_EndEmulation;
|
||||
|
||||
//Get the pointer to the Internal Classes
|
||||
|
@ -48,6 +48,8 @@ public:
|
|||
//CN64Rom * GetCurrentRom ( void ) { return _Rom; }
|
||||
|
||||
inline CPlugins * Plugins ( void ) const { return m_Plugins; }
|
||||
inline bool DmaUsed ( void ) const { return m_DMAUsed; }
|
||||
inline void SetDmaUsed ( bool DMAUsed) { m_DMAUsed = DMAUsed; }
|
||||
|
||||
//Variable used to track that the SP is being handled and stays the same as the real SP in sync core
|
||||
#ifdef TEST_SP_TRACKING
|
||||
|
@ -70,6 +72,7 @@ private:
|
|||
//Used for loading and potentialy executing the CPU in its own thread.
|
||||
static void stLoadFileImage ( FileImageInfo * Info );
|
||||
static void StartEmulationThread ( FileImageInfo * Info );
|
||||
static bool EmulationStarting ( HANDLE hThread, DWORD ThreadId );
|
||||
|
||||
void ExecuteCPU ( void );
|
||||
void RefreshScreen ( void );
|
||||
|
@ -127,6 +130,7 @@ private:
|
|||
bool m_bCleanFrameBox;
|
||||
bool m_bInitilized;
|
||||
int m_NextTimer;
|
||||
bool m_DMAUsed;
|
||||
|
||||
//When Syncing cores this is the PC where it last Sync'ed correctly
|
||||
DWORD m_LastSuccessSyncPC[10];
|
||||
|
|
|
@ -7,49 +7,6 @@ typedef unsigned long DWORD;
|
|||
typedef unsigned __int64 QWORD;
|
||||
typedef void * HANDLE;
|
||||
|
||||
enum SystemEvent {
|
||||
ExecuteRSP,
|
||||
TimerDone_Vi,
|
||||
TimerDone_Ai,
|
||||
TimerDone_AiDMA,
|
||||
TimerDone_Compare,
|
||||
TimerDone_RSPDlist,
|
||||
ExecuteInterrupt,
|
||||
GSButtonPressed,
|
||||
ResetCPU_Soft,
|
||||
ResetCPU_Hard,
|
||||
CloseCPU,
|
||||
PauseCPU_FromMenu,
|
||||
PauseCPU_AppLostActive,
|
||||
PauseCPU_AppLostActiveDelay,
|
||||
PauseCPU_AppLostFocus,
|
||||
PauseCPU_SaveGame,
|
||||
PauseCPU_LoadGame,
|
||||
PauseCPU_DumpMemory,
|
||||
PauseCPU_SearchMemory,
|
||||
ResumeCPU_FromMenu,
|
||||
ResumeCPU_AppGainedActive,
|
||||
ResumeCPU_AppGainedFocus,
|
||||
ResumeCPU_SaveGame,
|
||||
ResumeCPU_LoadGame,
|
||||
ResumeCPU_DumpMemory,
|
||||
ResumeCPU_SearchMemory,
|
||||
ChangingFullScreen,
|
||||
ChangePlugins,
|
||||
SaveMachineState,
|
||||
LoadMachineState,
|
||||
Interrupt_SP,
|
||||
Interrupt_SI,
|
||||
Interrupt_AI,
|
||||
Interrupt_VI,
|
||||
Interrupt_PI,
|
||||
Interrupt_DP,
|
||||
Profile_StartStop,
|
||||
Profile_ResetLogs,
|
||||
Profile_GenerateLogs,
|
||||
CPUUsageTimerChanged,
|
||||
};
|
||||
|
||||
enum PauseType
|
||||
{
|
||||
PauseType_FromMenu,
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
#include "stdafx.h"
|
|
@ -21,6 +21,7 @@ public:
|
|||
|
||||
private:
|
||||
void AnalyseBlock ( void );
|
||||
void CompileExitCode ( void );
|
||||
|
||||
DWORD m_VAddrEnter;
|
||||
DWORD m_VAddrFirst; // the address of the first opcode in the block
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
void InPermLoop ( void );
|
||||
|
||||
void DoSomething ( void );
|
||||
int DelaySlotEffectsCompare ( DWORD PC, DWORD Reg1, DWORD Reg2 );
|
||||
|
||||
int DelaySlotEffectsJump (DWORD JumpPC) {
|
||||
|
@ -102,7 +101,7 @@ CCodeSection::~CCodeSection( void )
|
|||
{
|
||||
}
|
||||
|
||||
void CCodeSection::CompileExit ( DWORD JumpPC, DWORD TargetPC, CRegInfo ExitRegSet, CExitInfo::EXIT_REASON reason, int CompileNow, void (*x86Jmp)(char * Label, DWORD Value))
|
||||
void CCodeSection::CompileExit ( DWORD JumpPC, DWORD TargetPC, CRegInfo ExitRegSet, CExitInfo::EXIT_REASON reason, int CompileNow, void (*x86Jmp)(const char * Label, DWORD Value))
|
||||
{
|
||||
if (!CompileNow)
|
||||
{
|
||||
|
@ -121,7 +120,7 @@ void CCodeSection::CompileExit ( DWORD JumpPC, DWORD TargetPC, CRegInfo ExitRegS
|
|||
ExitInfo.ExitRegSet = ExitRegSet;
|
||||
ExitInfo.reason = reason;
|
||||
ExitInfo.NextInstruction = m_NextInstruction;
|
||||
ExitInfo.JumpLoc = m_RecompPos - 4;
|
||||
ExitInfo.JumpLoc = (DWORD *)(m_RecompPos - 4);
|
||||
m_BlockInfo->m_ExitInfo.push_back(ExitInfo);
|
||||
return;
|
||||
}
|
||||
|
@ -133,7 +132,7 @@ void CCodeSection::CompileExit ( DWORD JumpPC, DWORD TargetPC, CRegInfo ExitRegS
|
|||
if (TargetPC != (DWORD)-1)
|
||||
{
|
||||
MoveConstToVariable(TargetPC,&_Reg->m_PROGRAM_COUNTER,"PROGRAM_COUNTER");
|
||||
UpdateCounters(ExitRegSet,false,TargetPC <= JumpPC && reason == CExitInfo::Normal);
|
||||
UpdateCounters(ExitRegSet,TargetPC <= JumpPC, reason == CExitInfo::Normal);
|
||||
} else {
|
||||
UpdateCounters(ExitRegSet,false,reason == CExitInfo::Normal);
|
||||
}
|
||||
|
@ -244,7 +243,8 @@ void CCodeSection::CompileExit ( DWORD JumpPC, DWORD TargetPC, CRegInfo ExitRegS
|
|||
#endif
|
||||
break;
|
||||
case CExitInfo::DoCPU_Action:
|
||||
Call_Direct(DoSomething,"DoSomething");
|
||||
MoveConstToX86reg((DWORD)_SystemEvents,x86_ECX);
|
||||
Call_Direct(AddressOf(CSystemEvents::ExecuteEvents),"CSystemEvents::ExecuteEvents");
|
||||
if (_SyncSystem) { Call_Direct(SyncToPC, "SyncToPC"); }
|
||||
ExitCodeBlock();
|
||||
break;
|
||||
|
@ -258,14 +258,13 @@ void CCodeSection::CompileExit ( DWORD JumpPC, DWORD TargetPC, CRegInfo ExitRegS
|
|||
#endif
|
||||
break;
|
||||
case CExitInfo::COP1_Unuseable:
|
||||
_Notify->BreakPoint(__FILE__,__LINE__);
|
||||
#ifdef tofix
|
||||
MoveConstToX86reg(NextInstruction == JUMP || NextInstruction == DELAY_SLOT,x86_ECX);
|
||||
MoveConstToX86reg(1,x86_EDX);
|
||||
Call_Direct(DoCopUnusableException,"DoCopUnusableException");
|
||||
PushImm32("1",1);
|
||||
PushImm32((m_NextInstruction == JUMP || m_NextInstruction == DELAY_SLOT) ? "true" : "false",
|
||||
m_NextInstruction == JUMP || m_NextInstruction == DELAY_SLOT);
|
||||
MoveConstToX86reg((DWORD)_Reg,x86_ECX);
|
||||
Call_Direct(AddressOf(CRegisters::DoCopUnusableException), "CRegisters::DoCopUnusableException");
|
||||
if (_SyncSystem) { Call_Direct(SyncToPC, "SyncToPC"); }
|
||||
ExitCodeBlock();
|
||||
#endif
|
||||
break;
|
||||
case CExitInfo::ExitResetRecompCode:
|
||||
_Notify->BreakPoint(__FILE__,__LINE__);
|
||||
|
@ -297,7 +296,7 @@ void CCodeSection::CompileExit ( DWORD JumpPC, DWORD TargetPC, CRegInfo ExitRegS
|
|||
|
||||
void CCodeSection::CompileSystemCheck (DWORD TargetPC, const CRegInfo & RegSet)
|
||||
{
|
||||
CompConstToVariable(0,&g_CPU_Action->DoSomething,"g_CPU_Action.DoSomething");
|
||||
CompConstToVariable(0,(void *)&_SystemEvents->DoSomething(),"_SystemEvents->DoSomething()");
|
||||
JeLabel32("Continue_From_Interrupt_Test",0);
|
||||
DWORD * Jump = (DWORD *)(m_RecompPos - 4);
|
||||
if (TargetPC != (DWORD)-1)
|
||||
|
@ -614,6 +613,13 @@ _Notify->BreakPoint(__FILE__,__LINE__);
|
|||
}
|
||||
}
|
||||
|
||||
void CCodeSection::CompileCop1Test (void) {
|
||||
if (m_RegWorkingSet.FpuBeenUsed()) { return; }
|
||||
TestVariable(STATUS_CU1,&_Reg->STATUS_REGISTER,"STATUS_REGISTER");
|
||||
CompileExit(m_CompilePC,m_CompilePC,m_RegWorkingSet,CExitInfo::COP1_Unuseable,FALSE,JeLabel32);
|
||||
m_RegWorkingSet.FpuBeenUsed() = TRUE;
|
||||
}
|
||||
|
||||
bool CCodeSection::GenerateX86Code ( DWORD Test )
|
||||
{
|
||||
if (this == NULL) { return false; }
|
||||
|
@ -670,14 +676,24 @@ bool CCodeSection::GenerateX86Code ( DWORD Test )
|
|||
m_BlockInfo->SetVAddrLast(m_CompilePC);
|
||||
}
|
||||
|
||||
if (m_NextInstruction == NORMAL)
|
||||
/*if (m_CompilePC >= 0x803259A0 && m_CompilePC < 0x803259D8 && m_NextInstruction == NORMAL)
|
||||
{
|
||||
m_RegWorkingSet.WriteBackRegisters();
|
||||
UpdateCounters(m_RegWorkingSet,false,true);
|
||||
MoveConstToVariable(m_CompilePC,&_Reg->m_PROGRAM_COUNTER,"PROGRAM_COUNTER");
|
||||
// //MoveConstToVariable((DWORD)RecompPos(),&CurrentBlock,"CurrentBlock");
|
||||
if (_SyncSystem) { Call_Direct(SyncToPC, "SyncToPC"); }
|
||||
}
|
||||
if (m_CompilePC == 0x803259AC && m_NextInstruction == NORMAL)
|
||||
{
|
||||
m_RegWorkingSet.WriteBackRegisters();
|
||||
UpdateCounters(m_RegWorkingSet,false,true);
|
||||
MoveConstToVariable(m_CompilePC,&_Reg->m_PROGRAM_COUNTER,"PROGRAM_COUNTER");
|
||||
if (_SyncSystem) { Call_Direct(SyncToPC, "SyncToPC"); }
|
||||
}
|
||||
if (m_CompilePC == 0x803259C0)
|
||||
{
|
||||
X86BreakPoint(__FILE__,__LINE__);
|
||||
}*/
|
||||
|
||||
m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() + g_CountPerOp);
|
||||
m_RegWorkingSet.ResetX86Protection();
|
||||
|
|
|
@ -9,11 +9,11 @@ public:
|
|||
CCodeSection( CCodeBlock * CodeBlock, DWORD EnterPC, DWORD ID);
|
||||
~CCodeSection( void );
|
||||
|
||||
void CompileCop1Test ( void );
|
||||
bool GenerateX86Code ( DWORD Test );
|
||||
void GenerateSectionLinkage ( void );
|
||||
void CompileSystemCheck ( DWORD TargetPC, const CRegInfo &RegSet );
|
||||
void CompileExit ( DWORD JumpPC, DWORD TargetPC, CRegInfo ExitRegSet, CExitInfo::EXIT_REASON reason, int CompileNow, void (*x86Jmp)(char * Label, DWORD Value));
|
||||
|
||||
void CompileExit ( DWORD JumpPC, DWORD TargetPC, CRegInfo ExitRegSet, CExitInfo::EXIT_REASON reason, int CompileNow, void (*x86Jmp)(const char * Label, DWORD Value));
|
||||
|
||||
/* Block Connection info */
|
||||
CCodeBlock * const m_BlockInfo;
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#include "..\..\N64 System.h"
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
CDelaySlotFunctionMap::CDelaySlotFunctionMap()
|
||||
{
|
||||
|
|
|
@ -18,7 +18,7 @@ public:
|
|||
CRegInfo ExitRegSet;
|
||||
EXIT_REASON reason;
|
||||
STEP_TYPE NextInstruction;
|
||||
BYTE * JumpLoc; //32bit jump
|
||||
DWORD * JumpLoc; //32bit jump
|
||||
};
|
||||
|
||||
typedef std::list<CExitInfo> EXIT_LIST;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include "..\..\N64 System.h"
|
||||
#include "stdafx.h"
|
||||
|
||||
CCompiledFunc::CCompiledFunc( const CCodeBlock & CodeBlock ) :
|
||||
m_EnterPC(CodeBlock.VAddrEnter()),
|
||||
|
|
|
@ -26,3 +26,5 @@ private:
|
|||
//Validation
|
||||
//QWORD MemContents[2], * MemLocation[2];
|
||||
};
|
||||
|
||||
typedef std::vector<CCompiledFunc *> CCompiledFuncList;
|
|
@ -1,4 +1,4 @@
|
|||
#include "..\..\N64 System.h"
|
||||
#include "stdafx.h"
|
||||
|
||||
CFunctionMap::CFunctionMap() :
|
||||
m_FunctionTable(NULL)
|
||||
|
@ -7,9 +7,23 @@ CFunctionMap::CFunctionMap() :
|
|||
|
||||
CFunctionMap::~CFunctionMap()
|
||||
{
|
||||
if (m_FunctionTable)
|
||||
{
|
||||
for (int i = 0, n = 0x100000; i < n; i++)
|
||||
{
|
||||
if (m_FunctionTable[i] != NULL)
|
||||
{
|
||||
delete m_FunctionTable[i];
|
||||
}
|
||||
}
|
||||
VirtualFree( m_FunctionTable, 0 , MEM_RELEASE);
|
||||
m_FunctionTable = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
bool CFunctionMap::AllocateMemory()
|
||||
{
|
||||
if (m_FunctionTable == NULL)
|
||||
{
|
||||
m_FunctionTable = (PCCompiledFunc_TABLE *)VirtualAlloc(NULL,0xFFFFF * sizeof(CCompiledFunc *),MEM_RESERVE|MEM_COMMIT,PAGE_READWRITE);
|
||||
if (m_FunctionTable == NULL) {
|
||||
|
@ -17,13 +31,11 @@ bool CFunctionMap::AllocateMemory()
|
|||
return false;
|
||||
}
|
||||
memset(m_FunctionTable,0,0xFFFFF * sizeof(CCompiledFunc *));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/*CFunctionMap::CFunctionMap( void) :
|
||||
m_FunctionTable(NULL)
|
||||
{
|
||||
}
|
||||
/*
|
||||
|
||||
CFunctionMap::~CFunctionMap()
|
||||
{
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
#include "stdafx.h"
|
File diff suppressed because it is too large
Load Diff
|
@ -1,7 +1,8 @@
|
|||
class CRecompiler :
|
||||
public CRecompilerSettings,
|
||||
private CRecompMemory,
|
||||
private CFunctionMap
|
||||
private CFunctionMap,
|
||||
private CSystemRegisters
|
||||
{
|
||||
public:
|
||||
|
||||
|
@ -24,10 +25,11 @@ public:
|
|||
bool GenerateX86Code (CCodeBlock & BlockInfo, CCodeSection * Section, DWORD Test );
|
||||
|
||||
//Self modifying code methods
|
||||
bool ClearRecompCode_Virt ( DWORD VirtualAddress, int length, REMOVE_REASON Reason );
|
||||
void ClearRecompCode_Virt ( DWORD VirtualAddress, int length, REMOVE_REASON Reason );
|
||||
bool ClearRecompCode_Phys ( DWORD PhysicalAddress, int length, REMOVE_REASON Reason );
|
||||
|
||||
private:
|
||||
CCompiledFuncList m_Functions;
|
||||
CProfiling & m_Profile;
|
||||
bool & m_EndEmulation;
|
||||
|
||||
|
@ -45,7 +47,6 @@ private:
|
|||
// Compiling code
|
||||
bool AnalyseBlock ( CCodeBlock & BlockInfo );
|
||||
bool CreateSectionLinkage ( CCodeSection * Section );
|
||||
void CompileExitCode ( CCodeBlock & BlockInfo );
|
||||
void DetermineLoop ( CCodeSection * Section, DWORD Test, DWORD Test2, DWORD TestID);
|
||||
bool DisplaySectionInformation (CCodeSection * Section, DWORD ID, DWORD Test);
|
||||
bool FixConstants ( CCodeSection * Section, DWORD Test );
|
||||
|
|
|
@ -25,6 +25,7 @@ bool CRecompMemory::AllocateMemory()
|
|||
_Notify->DisplayError(MSG_MEM_ALLOC_ERROR);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
m_RecompCode = (BYTE *)VirtualAlloc( RecompCodeBase, InitialCompileBufferSize, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
|
||||
if (m_RecompCode==NULL)
|
||||
{
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,7 +1,8 @@
|
|||
class CCodeSection;
|
||||
|
||||
class CRecompilerOps :
|
||||
protected CX86Ops
|
||||
protected CX86Ops,
|
||||
protected CSystemRegisters
|
||||
{
|
||||
protected:
|
||||
enum BRANCH_TYPE
|
||||
|
@ -183,9 +184,10 @@ protected:
|
|||
|
||||
static void EnterCodeBlock ( void );
|
||||
static void ExitCodeBlock ( void );
|
||||
static void CompileReadTLBMiss (CCodeSection * Section, int AddressReg, int LookUpReg );
|
||||
static void CompileWriteTLBMiss (CCodeSection * Section, int AddressReg, int LookUpReg );
|
||||
static void CompileReadTLBMiss (int AddressReg, int LookUpReg );
|
||||
static void CompileWriteTLBMiss (int AddressReg, int LookUpReg );
|
||||
static void UpdateCounters (CRegInfo & RegSet, bool CheckTimer, bool ClearValues = false );
|
||||
static void ChangeDefaultRoundingModel ( void );
|
||||
|
||||
|
||||
|
||||
|
@ -193,6 +195,7 @@ protected:
|
|||
static DWORD m_CompilePC;
|
||||
static OPCODE m_Opcode;
|
||||
static CRegInfo m_RegWorkingSet;
|
||||
static DWORD m_BranchCompare;
|
||||
static CCodeSection * m_Section;
|
||||
|
||||
/********* Helper Functions *********/
|
||||
|
@ -207,6 +210,7 @@ protected:
|
|||
static inline long cMipsRegHi_S ( int Reg ) { return m_RegWorkingSet.cMipsRegHi_S(Reg); }
|
||||
static inline CX86Ops::x86Reg cMipsRegMapLo ( int Reg ) { return m_RegWorkingSet.cMipsRegMapLo(Reg); }
|
||||
static inline CX86Ops::x86Reg cMipsRegMapHi ( int Reg ) { return m_RegWorkingSet.cMipsRegMapHi(Reg); }
|
||||
static inline bool cX86Protected ( x86Reg Reg ) { return m_RegWorkingSet.cX86Protected(Reg); }
|
||||
|
||||
static inline REG_STATE & MipsRegState ( int Reg ) { return m_RegWorkingSet.MipsRegState(Reg); }
|
||||
static inline unsigned _int64 & MipsReg ( int Reg ) { return m_RegWorkingSet.MipsReg(Reg); }
|
||||
|
@ -217,6 +221,7 @@ protected:
|
|||
static inline long & MipsRegHi_S ( int Reg ) { return m_RegWorkingSet.MipsRegHi_S(Reg); }
|
||||
static inline CX86Ops::x86Reg & MipsRegMapLo ( int Reg ) { return m_RegWorkingSet.MipsRegMapLo(Reg); }
|
||||
static inline CX86Ops::x86Reg & MipsRegMapHi ( int Reg ) { return m_RegWorkingSet.MipsRegMapHi(Reg); }
|
||||
static inline bool & X86Protected ( x86Reg Reg ) { return m_RegWorkingSet.X86Protected(Reg); }
|
||||
|
||||
static inline bool IsKnown ( int Reg ) { return m_RegWorkingSet.IsKnown(Reg); }
|
||||
static inline bool IsUnknown ( int Reg ) { return m_RegWorkingSet.IsUnknown(Reg); }
|
||||
|
@ -229,6 +234,35 @@ protected:
|
|||
static inline bool Is32BitMapped ( int Reg ) { return m_RegWorkingSet.Is32BitMapped(Reg); }
|
||||
static inline bool Is64BitMapped ( int Reg ) { return m_RegWorkingSet.Is64BitMapped(Reg); }
|
||||
|
||||
static inline void FixRoundModel ( CRegInfo::FPU_ROUND RoundMethod )
|
||||
{
|
||||
m_RegWorkingSet.FixRoundModel(RoundMethod);
|
||||
}
|
||||
static inline void ChangeFPURegFormat ( int Reg, CRegInfo::FPU_STATE OldFormat, CRegInfo::FPU_STATE NewFormat, CRegInfo::FPU_ROUND RoundingModel )
|
||||
{
|
||||
m_RegWorkingSet.ChangeFPURegFormat(Reg,OldFormat,NewFormat,RoundingModel);
|
||||
}
|
||||
static inline void Load_FPR_ToTop ( int Reg, int RegToLoad, CRegInfo::FPU_STATE Format)
|
||||
{
|
||||
m_RegWorkingSet.Load_FPR_ToTop(Reg,RegToLoad,Format);
|
||||
}
|
||||
static inline BOOL RegInStack ( int Reg, CRegInfo::FPU_STATE Format )
|
||||
{
|
||||
return m_RegWorkingSet.RegInStack(Reg,Format);
|
||||
}
|
||||
static inline x86FpuValues StackPosition ( int Reg )
|
||||
{
|
||||
return m_RegWorkingSet.StackPosition(Reg);
|
||||
}
|
||||
static inline void UnMap_AllFPRs ( void )
|
||||
{
|
||||
m_RegWorkingSet.UnMap_AllFPRs();
|
||||
}
|
||||
static inline void UnMap_FPR ( DWORD Reg, bool WriteBackValue )
|
||||
{
|
||||
m_RegWorkingSet.UnMap_FPR(Reg,WriteBackValue);
|
||||
}
|
||||
|
||||
static inline x86Reg FreeX86Reg ( void )
|
||||
{
|
||||
return m_RegWorkingSet.FreeX86Reg();
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
unsigned int CRegInfo::m_fpuControl = 0;
|
||||
|
||||
char *Format_Name[] = {"Unknown","dword","qword","float","double"};
|
||||
|
||||
void CRegInfo::Initilize ( void )
|
||||
{
|
||||
int count;
|
||||
|
@ -27,7 +29,7 @@ void CRegInfo::Initilize ( void )
|
|||
Stack_TopPos = 0;
|
||||
for (count = 0; count < 8; count ++ ) {
|
||||
x86fpu_MappedTo[count] = -1;
|
||||
x86fpu_State[count] = FPU_Unkown;
|
||||
x86fpu_State[count] = FPU_Unknown;
|
||||
x86fpu_RoundingModel[count] = RoundDefault;
|
||||
}
|
||||
Fpu_Used = false;
|
||||
|
@ -40,6 +42,7 @@ void CRegInfo::FixRoundModel(FPU_ROUND RoundMethod )
|
|||
{
|
||||
return;
|
||||
}
|
||||
CPU_Message(" FixRoundModel: CurrentRoundingModel: %s targetRoundModel: %s",RoundingModelName(CurrentRoundingModel()),RoundingModelName(RoundMethod));
|
||||
|
||||
m_fpuControl = 0;
|
||||
fpuStoreControl(&m_fpuControl, "m_fpuControl");
|
||||
|
@ -47,20 +50,205 @@ void CRegInfo::FixRoundModel(FPU_ROUND RoundMethod )
|
|||
MoveVariableToX86reg(&m_fpuControl, "m_fpuControl", reg);
|
||||
AndConstToX86Reg(reg, 0xF3FF);
|
||||
|
||||
if (RoundMethod == RoundDefault)
|
||||
{
|
||||
x86Reg RoundReg = Map_TempReg(x86_Any,-1,FALSE);
|
||||
MoveVariableToX86reg(&_Reg->m_RoundingModel,"m_RoundingModel", RoundReg);
|
||||
ShiftLeftSignImmed(RoundReg,2);
|
||||
OrX86RegToX86Reg(reg,RoundReg);
|
||||
x86Protected(RoundReg) = false;
|
||||
} else {
|
||||
switch (RoundMethod) {
|
||||
case CRegInfo::RoundDefault: OrVariableToX86Reg(&_Reg->m_RoundingModel,"FPU_RoundingMode", reg); break;
|
||||
case CRegInfo::RoundTruncate: OrConstToX86Reg(0x0C00, reg); break;
|
||||
case CRegInfo::RoundNearest: /*OrConstToX86Reg(0x0000, reg);*/ break;
|
||||
case CRegInfo::RoundDown: OrConstToX86Reg(0x0400, reg); break;
|
||||
case CRegInfo::RoundUp: OrConstToX86Reg(0x0800, reg); break;
|
||||
case RoundTruncate: OrConstToX86Reg(0x0C00, reg); break;
|
||||
case RoundNearest: /*OrConstToX86Reg(0x0000, reg);*/ break;
|
||||
case RoundDown: OrConstToX86Reg(0x0400, reg); break;
|
||||
case RoundUp: OrConstToX86Reg(0x0800, reg); break;
|
||||
default:
|
||||
DisplayError("Unknown Rounding model");
|
||||
}
|
||||
}
|
||||
MoveX86regToVariable(reg, &m_fpuControl, "m_fpuControl");
|
||||
x86Protected(reg) = false;
|
||||
fpuLoadControl(&m_fpuControl, "m_fpuControl");
|
||||
CurrentRoundingModel() = RoundMethod;
|
||||
}
|
||||
|
||||
void CRegInfo::ChangeFPURegFormat (int Reg, FPU_STATE OldFormat, FPU_STATE NewFormat, FPU_ROUND RoundingModel)
|
||||
{
|
||||
for (DWORD i = 0; i < 8; i++)
|
||||
{
|
||||
if (FpuMappedTo(i) != (DWORD)Reg)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (FpuState(i) != OldFormat) {
|
||||
UnMap_FPR(Reg,TRUE);
|
||||
Load_FPR_ToTop(Reg,Reg,OldFormat);
|
||||
ChangeFPURegFormat(Reg,OldFormat,NewFormat,RoundingModel);
|
||||
return;
|
||||
}
|
||||
CPU_Message(" regcache: Changed format of ST(%d) from %s to %s", (i - StackTopPos() + 8) & 7,Format_Name[OldFormat],Format_Name[NewFormat]);
|
||||
FpuRoundingModel(i) = RoundingModel;
|
||||
FpuState(i) = NewFormat;
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef EXTERNAL_RELEASE
|
||||
DisplayError("ChangeFormat: Register not on stack!!");
|
||||
#endif
|
||||
}
|
||||
|
||||
void CRegInfo::Load_FPR_ToTop ( int Reg, int RegToLoad, FPU_STATE Format)
|
||||
{
|
||||
if (CurrentRoundingModel() != RoundDefault)
|
||||
{
|
||||
FixRoundModel(RoundDefault);
|
||||
}
|
||||
CPU_Message("CurrentRoundingModel: %s FpuRoundingModel(StackTopPos()): %s",RoundingModelName(CurrentRoundingModel()),RoundingModelName(FpuRoundingModel(StackTopPos())));
|
||||
int i;
|
||||
|
||||
if (RegToLoad < 0) { DisplayError("Load_FPR_ToTop\nRegToLoad < 0 ???"); return; }
|
||||
if (Reg < 0) { DisplayError("Load_FPR_ToTop\nReg < 0 ???"); return; }
|
||||
|
||||
if (Format == FPU_Double || Format == FPU_Qword) {
|
||||
UnMap_FPR(Reg + 1,TRUE);
|
||||
UnMap_FPR(RegToLoad + 1,TRUE);
|
||||
} else {
|
||||
if ((Reg & 1) != 0) {
|
||||
for (i = 0; i < 8; i++) {
|
||||
if (FpuMappedTo(i) == (DWORD)(Reg - 1)) {
|
||||
if (FpuState(i) == FPU_Double || FpuState(i) == FPU_Qword) {
|
||||
UnMap_FPR(Reg,TRUE);
|
||||
}
|
||||
i = 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((RegToLoad & 1) != 0) {
|
||||
for (i = 0; i < 8; i++) {
|
||||
if (FpuMappedTo(i) == (DWORD)(RegToLoad - 1)) {
|
||||
if (FpuState(i) == FPU_Double || FpuState(i) == FPU_Qword) {
|
||||
UnMap_FPR(RegToLoad,TRUE);
|
||||
}
|
||||
i = 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Reg == RegToLoad) {
|
||||
//if different format then unmap original reg from stack
|
||||
for (i = 0; i < 8; i++) {
|
||||
if (FpuMappedTo(i) == (DWORD)Reg) {
|
||||
if (FpuState(i) != (DWORD)Format) {
|
||||
UnMap_FPR(Reg,TRUE);
|
||||
}
|
||||
i = 8;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
UnMap_FPR(Reg,FALSE);
|
||||
}
|
||||
|
||||
if (RegInStack(RegToLoad,Format)) {
|
||||
if (Reg != RegToLoad) {
|
||||
if (FpuMappedTo((StackTopPos() - 1) & 7) != (DWORD)RegToLoad) {
|
||||
UnMap_FPR(FpuMappedTo((StackTopPos() - 1) & 7),TRUE);
|
||||
CPU_Message(" regcache: allocate ST(0) to %s", CRegName::FPR[Reg]);
|
||||
fpuLoadReg(&StackTopPos(),StackPosition(RegToLoad));
|
||||
FpuRoundingModel(StackTopPos()) = RoundDefault;
|
||||
FpuMappedTo(StackTopPos()) = Reg;
|
||||
FpuState(StackTopPos()) = Format;
|
||||
} else {
|
||||
UnMap_FPR(FpuMappedTo((StackTopPos() - 1) & 7),TRUE);
|
||||
Load_FPR_ToTop (Reg, RegToLoad, Format);
|
||||
}
|
||||
} else {
|
||||
x86FpuValues RegPos, StackPos;
|
||||
DWORD i;
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
if (FpuMappedTo(i) == (DWORD)Reg) {
|
||||
RegPos = (x86FpuValues)i;
|
||||
i = 8;
|
||||
}
|
||||
}
|
||||
|
||||
if (RegPos == StackTopPos()) {
|
||||
return;
|
||||
}
|
||||
StackPos = StackPosition(Reg);
|
||||
|
||||
FpuRoundingModel(RegPos) = FpuRoundingModel(StackTopPos());
|
||||
FpuMappedTo(RegPos) = FpuMappedTo(StackTopPos());
|
||||
FpuState(RegPos) = FpuState(StackTopPos());
|
||||
CPU_Message(" regcache: allocate ST(%d) to %s", StackPos,CRegName::FPR[FpuMappedTo(RegPos)]);
|
||||
CPU_Message(" regcache: allocate ST(0) to %s", CRegName::FPR[Reg]);
|
||||
|
||||
fpuExchange(StackPos);
|
||||
|
||||
FpuRoundingModel(StackTopPos()) = RoundDefault;
|
||||
FpuMappedTo(StackTopPos()) = Reg;
|
||||
FpuState(StackTopPos()) = Format;
|
||||
}
|
||||
} else {
|
||||
char Name[50];
|
||||
x86Reg TempReg;
|
||||
|
||||
UnMap_FPR(FpuMappedTo((StackTopPos() - 1) & 7),TRUE);
|
||||
for (i = 0; i < 8; i++) {
|
||||
if (FpuMappedTo(i) == (DWORD)RegToLoad) {
|
||||
UnMap_FPR(RegToLoad,TRUE);
|
||||
i = 8;
|
||||
}
|
||||
}
|
||||
CPU_Message(" regcache: allocate ST(0) to %s", CRegName::FPR[Reg]);
|
||||
TempReg = Map_TempReg(x86_Any,-1,FALSE);
|
||||
switch (Format) {
|
||||
case FPU_Dword:
|
||||
sprintf(Name,"m_FPR_S[%d]",RegToLoad);
|
||||
MoveVariableToX86reg(&_Reg->m_FPR_S[RegToLoad],Name,TempReg);
|
||||
fpuLoadIntegerDwordFromX86Reg(&StackTopPos(),TempReg);
|
||||
break;
|
||||
case FPU_Qword:
|
||||
sprintf(Name,"m_FPR_D[%d]",RegToLoad);
|
||||
MoveVariableToX86reg(&_Reg->m_FPR_D[RegToLoad],Name,TempReg);
|
||||
fpuLoadIntegerQwordFromX86Reg(&StackTopPos(),TempReg);
|
||||
break;
|
||||
case FPU_Float:
|
||||
sprintf(Name,"m_FPR_S[%d]",RegToLoad);
|
||||
MoveVariableToX86reg(&_Reg->m_FPR_S[RegToLoad],Name,TempReg);
|
||||
fpuLoadDwordFromX86Reg(&StackTopPos(),TempReg);
|
||||
break;
|
||||
case FPU_Double:
|
||||
sprintf(Name,"m_FPR_D[%d]",RegToLoad);
|
||||
MoveVariableToX86reg(&_Reg->m_FPR_D[RegToLoad],Name,TempReg);
|
||||
fpuLoadQwordFromX86Reg(&StackTopPos(),TempReg);
|
||||
break;
|
||||
#ifndef EXTERNAL_RELEASE
|
||||
default:
|
||||
DisplayError("Load_FPR_ToTop\nUnkown format to load %d",Format);
|
||||
#endif
|
||||
}
|
||||
x86Protected(TempReg) = FALSE;
|
||||
FpuRoundingModel(StackTopPos()) = RoundDefault;
|
||||
FpuMappedTo(StackTopPos()) = Reg;
|
||||
FpuState(StackTopPos()) = Format;
|
||||
}
|
||||
}
|
||||
|
||||
CRegInfo::x86FpuValues CRegInfo::StackPosition (int Reg)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
if (FpuMappedTo(i) == (DWORD)Reg) {
|
||||
return (x86FpuValues)((i - StackTopPos()) & 7);
|
||||
}
|
||||
}
|
||||
return x86_ST_Unknown;
|
||||
}
|
||||
|
||||
CX86Ops::x86Reg CRegInfo::FreeX86Reg ( void )
|
||||
{
|
||||
if (x86Mapped(x86_EDI) == NotMapped && !x86Protected(x86_EDI)) { return x86_EDI; }
|
||||
|
@ -73,27 +261,28 @@ CX86Ops::x86Reg CRegInfo::FreeX86Reg ( void )
|
|||
x86Reg Reg = UnMap_TempReg();
|
||||
if (Reg != x86_Unknown) { return Reg; }
|
||||
|
||||
_Notify->BreakPoint(__FILE__,__LINE__);
|
||||
#ifdef tofix
|
||||
int count, MapCount[10], MapReg[10];
|
||||
int count, MapCount[10];
|
||||
x86Reg MapReg[10];
|
||||
|
||||
for (count = 0; count < 10; count ++)
|
||||
{
|
||||
MapCount[count] = x86MapOrder(count);
|
||||
MapReg[count] = count;
|
||||
MapCount[count] = x86MapOrder((x86Reg)count);
|
||||
MapReg[count] = (x86Reg)count;
|
||||
}
|
||||
for (count = 0; count < 10; count ++) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 9; i ++) {
|
||||
int temp;
|
||||
x86Reg tempReg;
|
||||
DWORD temp;
|
||||
|
||||
if (MapCount[i] < MapCount[i+1]) {
|
||||
temp = MapCount[i];
|
||||
MapCount[i] = MapCount[i+1];
|
||||
MapCount[i+1] = temp;
|
||||
temp = MapReg[i];
|
||||
tempReg = MapReg[i];
|
||||
MapReg[i] = MapReg[i+1];
|
||||
MapReg[i+1] = temp;
|
||||
MapReg[i+1] = tempReg;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -102,20 +291,20 @@ CX86Ops::x86Reg CRegInfo::FreeX86Reg ( void )
|
|||
x86Reg StackReg = x86_Unknown;
|
||||
for (count = 0; count < 10; count ++)
|
||||
{
|
||||
if (MapCount[count] > 0 && x86Mapped(MapReg[count]) != CRegInfo::Stack_Mapped)
|
||||
if (MapCount[count] > 0 && x86Mapped(MapReg[count]) != Stack_Mapped)
|
||||
{
|
||||
if (UnMap_X86reg((x86Reg)MapReg[count]))
|
||||
{
|
||||
return (x86Reg)MapReg[count];
|
||||
}
|
||||
}
|
||||
if (x86Mapped(MapReg[count]) == CRegInfo::Stack_Mapped) { StackReg = MapReg[count]; }
|
||||
if (x86Mapped(MapReg[count]) == Stack_Mapped) { StackReg = MapReg[count]; }
|
||||
}
|
||||
if (StackReg != x86_Unknown) {
|
||||
UnMap_X86reg(StackReg);
|
||||
return StackReg;
|
||||
}
|
||||
#endif
|
||||
|
||||
return x86_Unknown;
|
||||
}
|
||||
|
||||
|
@ -127,15 +316,13 @@ CX86Ops::x86Reg CRegInfo::Free8BitX86Reg ( void )
|
|||
if (x86Mapped(x86_EDX) == NotMapped && !x86Protected(x86_EDX)) {return x86_EDX; }
|
||||
if (x86Mapped(x86_ECX) == NotMapped && !x86Protected(x86_ECX)) {return x86_ECX; }
|
||||
|
||||
_Notify->BreakPoint(__FILE__,__LINE__);
|
||||
#ifdef tofix
|
||||
int x86Reg, count, MapCount[10], MapReg[10];
|
||||
|
||||
x86Reg = UnMap_8BitTempReg(Section);
|
||||
if (x86Reg > 0) { return x86Reg; }
|
||||
x86Reg Reg = UnMap_8BitTempReg();
|
||||
if (Reg > 0) { return Reg; }
|
||||
|
||||
int count, MapCount[10], MapReg[10];
|
||||
for (count = 0; count < 10; count ++) {
|
||||
MapCount[count] = x86MapOrder(count);
|
||||
MapCount[count] = x86MapOrder((x86Reg)count);
|
||||
MapReg[count] = count;
|
||||
}
|
||||
for (count = 0; count < 10; count ++) {
|
||||
|
@ -157,14 +344,29 @@ CX86Ops::x86Reg CRegInfo::Free8BitX86Reg ( void )
|
|||
}
|
||||
for (count = 0; count < 10; count ++) {
|
||||
if (MapCount[count] > 0) {
|
||||
if (!Is8BitReg(count)) { continue; }
|
||||
if (UnMap_X86reg(Section,count)) {
|
||||
return count;
|
||||
if (!Is8BitReg((x86Reg)count)) { continue; }
|
||||
if (UnMap_X86reg((x86Reg)count)) {
|
||||
return (x86Reg)count;
|
||||
}
|
||||
}
|
||||
}
|
||||
return x86_Unknown;
|
||||
}
|
||||
|
||||
#endif
|
||||
CX86Ops::x86Reg CRegInfo::UnMap_8BitTempReg (void )
|
||||
{
|
||||
int count;
|
||||
|
||||
for (count = 0; count < 10; count ++) {
|
||||
if (!Is8BitReg((x86Reg)count)) { continue; }
|
||||
if (MipsRegState((x86Reg)count) == Temp_Mapped) {
|
||||
if (x86Protected((x86Reg)count) == FALSE) {
|
||||
CPU_Message(" regcache: unallocate %s from temp storage",x86_Name((x86Reg)count));
|
||||
x86Mapped((x86Reg)count) = CRegInfo::NotMapped;
|
||||
return (x86Reg)count;
|
||||
}
|
||||
}
|
||||
}
|
||||
return x86_Unknown;
|
||||
}
|
||||
|
||||
|
@ -193,16 +395,16 @@ void CRegInfo::Map_GPR_32bit (int MipsReg, BOOL SignValue, int MipsRegToLoad)
|
|||
} else {
|
||||
if (Is64Bit(MipsReg)) {
|
||||
CPU_Message(" regcache: unallocate %s from high 32bit of %s",x86_Name(MipsRegMapHi(MipsReg)),CRegName::GPR_Hi[MipsReg]);
|
||||
x86MapOrder(MipsRegHi(MipsReg)) = 0;
|
||||
x86Mapped(MipsRegHi(MipsReg)) = CRegInfo::NotMapped;
|
||||
x86Protected(MipsRegHi(MipsReg)) = FALSE;
|
||||
x86MapOrder(MipsRegMapHi(MipsReg)) = 0;
|
||||
x86Mapped(MipsRegMapHi(MipsReg)) = NotMapped;
|
||||
x86Protected(MipsRegMapHi(MipsReg)) = FALSE;
|
||||
MipsRegHi(MipsReg) = 0;
|
||||
}
|
||||
Reg = MipsRegMapLo(MipsReg);
|
||||
}
|
||||
for (count = 0; count < 10; count ++) {
|
||||
if (x86MapOrder(count) > 0) {
|
||||
x86MapOrder(count) += 1;
|
||||
if (x86MapOrder((x86Reg)count) > 0) {
|
||||
x86MapOrder((x86Reg)count) += 1;
|
||||
}
|
||||
}
|
||||
x86MapOrder(Reg) = 1;
|
||||
|
@ -220,10 +422,10 @@ void CRegInfo::Map_GPR_32bit (int MipsReg, BOOL SignValue, int MipsRegToLoad)
|
|||
} else if (MipsRegToLoad == 0) {
|
||||
XorX86RegToX86Reg(Reg,Reg);
|
||||
}
|
||||
x86Mapped(Reg) = CRegInfo::GPR_Mapped;
|
||||
x86Mapped(Reg) = GPR_Mapped;
|
||||
x86Protected(Reg) = TRUE;
|
||||
MipsRegMapLo(MipsReg) = Reg;
|
||||
MipsRegState(MipsReg) = SignValue ? CRegInfo::STATE_MAPPED_32_SIGN : CRegInfo::STATE_MAPPED_32_ZERO;
|
||||
MipsRegState(MipsReg) = SignValue ? STATE_MAPPED_32_SIGN : STATE_MAPPED_32_ZERO;
|
||||
}
|
||||
|
||||
void CRegInfo::Map_GPR_64bit ( int MipsReg, int MipsRegToLoad)
|
||||
|
@ -263,7 +465,7 @@ void CRegInfo::Map_GPR_64bit ( int MipsReg, int MipsRegToLoad)
|
|||
}
|
||||
|
||||
for (count = 0; count < 10; count ++) {
|
||||
if (x86MapOrder(count) > 0) { x86MapOrder(count) += 1; }
|
||||
if (x86MapOrder((x86Reg)count) > 0) { x86MapOrder((x86Reg)count) += 1; }
|
||||
}
|
||||
|
||||
x86MapOrder(x86Hi) = 1;
|
||||
|
@ -293,7 +495,7 @@ void CRegInfo::Map_GPR_64bit ( int MipsReg, int MipsRegToLoad)
|
|||
CPU_Message("Map_GPR_64bit 11");
|
||||
if (Is32Bit(MipsRegToLoad)) {
|
||||
if (IsSigned(MipsRegToLoad)) {
|
||||
MoveConstToX86reg((int)MipsRegLo(MipsRegToLoad) >> 31,x86Hi);
|
||||
MoveConstToX86reg(MipsRegLo_S(MipsRegToLoad) >> 31,x86Hi);
|
||||
} else {
|
||||
MoveConstToX86reg(0,x86Hi);
|
||||
}
|
||||
|
@ -306,11 +508,11 @@ CPU_Message("Map_GPR_64bit 11");
|
|||
XorX86RegToX86Reg(x86Hi,x86Hi);
|
||||
XorX86RegToX86Reg(x86lo,x86lo);
|
||||
}
|
||||
x86Mapped(x86Hi) = CRegInfo::GPR_Mapped;
|
||||
x86Mapped(x86lo) = CRegInfo::GPR_Mapped;
|
||||
x86Mapped(x86Hi) = GPR_Mapped;
|
||||
x86Mapped(x86lo) = GPR_Mapped;
|
||||
MipsRegMapHi(MipsReg) = x86Hi;
|
||||
MipsRegMapLo(MipsReg) = x86lo;
|
||||
MipsRegState(MipsReg) = CRegInfo::STATE_MAPPED_64;
|
||||
MipsRegState(MipsReg) = STATE_MAPPED_64;
|
||||
}
|
||||
|
||||
CX86Ops::x86Reg CRegInfo::Map_TempReg (CX86Ops::x86Reg Reg, int MipsReg, BOOL LoadHiWord)
|
||||
|
@ -432,7 +634,7 @@ CX86Ops::x86Reg CRegInfo::Map_TempReg (CX86Ops::x86Reg Reg, int MipsReg, BOOL Lo
|
|||
{
|
||||
MoveConstToX86reg(MipsRegHi(MipsReg),Reg);
|
||||
} else {
|
||||
MoveConstToX86reg((int)MipsRegLo(MipsReg) >> 31,Reg);
|
||||
MoveConstToX86reg(MipsRegLo_S(MipsReg) >> 31,Reg);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -441,15 +643,15 @@ CX86Ops::x86Reg CRegInfo::Map_TempReg (CX86Ops::x86Reg Reg, int MipsReg, BOOL Lo
|
|||
} else if (IsMapped(MipsReg)) {
|
||||
MoveX86RegToX86Reg(MipsRegMapLo(MipsReg),Reg);
|
||||
} else {
|
||||
MoveConstToX86reg(MipsRegMapLo(MipsReg),Reg);
|
||||
MoveConstToX86reg(MipsRegLo(MipsReg),Reg);
|
||||
}
|
||||
}
|
||||
}
|
||||
x86Mapped(Reg) = Temp_Mapped;
|
||||
x86Protected(Reg) = TRUE;
|
||||
for (count = 0; count < 10; count ++) {
|
||||
if (x86MapOrder(count) > 0) {
|
||||
x86MapOrder(count) += 1;
|
||||
if (x86MapOrder((x86Reg)count) > 0) {
|
||||
x86MapOrder((x86Reg)count) += 1;
|
||||
}
|
||||
}
|
||||
x86MapOrder(Reg) = 1;
|
||||
|
@ -474,12 +676,29 @@ void CRegInfo::UnProtectGPR(DWORD Reg) {
|
|||
|
||||
void CRegInfo::ResetX86Protection (void)
|
||||
{
|
||||
for (int count = 1; count < 10; count ++)
|
||||
for (int count = 0; count < 10; count ++)
|
||||
{
|
||||
x86Protected(count) = false;
|
||||
x86Protected((x86Reg)count) = false;
|
||||
}
|
||||
}
|
||||
|
||||
BOOL CRegInfo::RegInStack( int Reg, FPU_STATE Format) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 8; i++)
|
||||
{
|
||||
if (FpuMappedTo(i) == (DWORD)Reg)
|
||||
{
|
||||
if (FpuState(i) == Format || Format == FPU_Any)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void CRegInfo::UnMap_AllFPRs ( void )
|
||||
{
|
||||
DWORD StackPos;
|
||||
|
@ -515,7 +734,7 @@ void CRegInfo::UnMap_FPR (int Reg, int WriteBackValue )
|
|||
|
||||
if (((i - StackTopPos() + 8) & 7) != 0) {
|
||||
CRegInfo::FPU_ROUND RoundingModel = FpuRoundingModel(StackTopPos());
|
||||
CRegInfo::FPU_STATE RegState = FpuState(StackTopPos());
|
||||
FPU_STATE RegState = FpuState(StackTopPos());
|
||||
DWORD MappedTo = FpuMappedTo(StackTopPos());
|
||||
FpuRoundingModel(StackTopPos()) = FpuRoundingModel(i);
|
||||
FpuMappedTo(StackTopPos()) = FpuMappedTo(i);
|
||||
|
@ -526,32 +745,29 @@ void CRegInfo::UnMap_FPR (int Reg, int WriteBackValue )
|
|||
fpuExchange((x86FpuValues)((i - StackTopPos()) & 7));
|
||||
}
|
||||
|
||||
CPU_Message("CurrentRoundingModel: %d FpuRoundingModel(i): %d",
|
||||
CurrentRoundingModel(),FpuRoundingModel(i));
|
||||
|
||||
FixRoundModel(FpuRoundingModel(i));
|
||||
|
||||
RegPos = StackTopPos();
|
||||
x86Reg TempReg = Map_TempReg(x86_Any,-1,FALSE);
|
||||
switch (FpuState(StackTopPos())) {
|
||||
case CRegInfo::FPU_Dword:
|
||||
sprintf(Name,"_FPRFloatLocation[%d]",FpuMappedTo(StackTopPos()));
|
||||
MoveVariableToX86reg(&_FPRFloatLocation[FpuMappedTo(StackTopPos())],Name,TempReg);
|
||||
case FPU_Dword:
|
||||
sprintf(Name,"_FPR_S[%d]",FpuMappedTo(StackTopPos()));
|
||||
MoveVariableToX86reg(&_FPR_S[FpuMappedTo(StackTopPos())],Name,TempReg);
|
||||
fpuStoreIntegerDwordFromX86Reg(&StackTopPos(),TempReg, TRUE);
|
||||
break;
|
||||
case CRegInfo::FPU_Qword:
|
||||
sprintf(Name,"_FPRDoubleLocation[%d]",FpuMappedTo(StackTopPos()));
|
||||
MoveVariableToX86reg(&_FPRDoubleLocation[FpuMappedTo(StackTopPos())],Name,TempReg);
|
||||
case FPU_Qword:
|
||||
sprintf(Name,"_FPR_D[%d]",FpuMappedTo(StackTopPos()));
|
||||
MoveVariableToX86reg(&_FPR_D[FpuMappedTo(StackTopPos())],Name,TempReg);
|
||||
fpuStoreIntegerQwordFromX86Reg(&StackTopPos(),TempReg, TRUE);
|
||||
break;
|
||||
case CRegInfo::FPU_Float:
|
||||
sprintf(Name,"_FPRFloatLocation[%d]",FpuMappedTo(StackTopPos()));
|
||||
MoveVariableToX86reg(&_FPRFloatLocation[FpuMappedTo(StackTopPos())],Name,TempReg);
|
||||
case FPU_Float:
|
||||
sprintf(Name,"_FPR_S[%d]",FpuMappedTo(StackTopPos()));
|
||||
MoveVariableToX86reg(&_FPR_S[FpuMappedTo(StackTopPos())],Name,TempReg);
|
||||
fpuStoreDwordFromX86Reg(&StackTopPos(),TempReg, TRUE);
|
||||
break;
|
||||
case CRegInfo::FPU_Double:
|
||||
sprintf(Name,"_FPRDoubleLocation[%d]",FpuMappedTo(StackTopPos()));
|
||||
MoveVariableToX86reg(&_FPRDoubleLocation[FpuMappedTo(StackTopPos())],Name,TempReg);
|
||||
case FPU_Double:
|
||||
sprintf(Name,"_FPR_D[%d]",FpuMappedTo(StackTopPos()));
|
||||
MoveVariableToX86reg(&_FPR_D[FpuMappedTo(StackTopPos())],Name,TempReg);
|
||||
fpuStoreQwordFromX86Reg(&StackTopPos(),TempReg, TRUE);
|
||||
break;
|
||||
#ifndef EXTERNAL_RELEASE
|
||||
|
@ -560,14 +776,14 @@ void CRegInfo::UnMap_FPR (int Reg, int WriteBackValue )
|
|||
#endif
|
||||
}
|
||||
x86Protected(TempReg) = FALSE;
|
||||
FpuRoundingModel(RegPos) = CRegInfo::RoundDefault;
|
||||
FpuRoundingModel(RegPos) = RoundDefault;
|
||||
FpuMappedTo(RegPos) = -1;
|
||||
FpuState(RegPos) = CRegInfo::FPU_Unkown;
|
||||
FpuState(RegPos) = FPU_Unknown;
|
||||
} else {
|
||||
fpuFree((x86FpuValues)((i - StackTopPos()) & 7));
|
||||
FpuRoundingModel(i) = CRegInfo::RoundDefault;
|
||||
FpuRoundingModel(i) = RoundDefault;
|
||||
FpuMappedTo(i) = -1;
|
||||
FpuState(i) = CRegInfo::FPU_Unkown;
|
||||
FpuState(i) = FPU_Unknown;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -586,13 +802,13 @@ void CRegInfo::UnMap_GPR (DWORD Reg, bool WriteBackValue)
|
|||
//CPU_Message("UnMap_GPR: State: %X\tReg: %s\tWriteBack: %s",State,CRegName::GPR[Reg],WriteBackValue?"TRUE":"FALSE");
|
||||
if (IsConst(Reg)) {
|
||||
if (!WriteBackValue) {
|
||||
MipsRegState(Reg) = CRegInfo::STATE_UNKNOWN;
|
||||
MipsRegState(Reg) = STATE_UNKNOWN;
|
||||
return;
|
||||
}
|
||||
if (Is64Bit(Reg)) {
|
||||
MoveConstToVariable(MipsRegHi(Reg),&_GPR[Reg].UW[1],CRegName::GPR_Hi[Reg]);
|
||||
MoveConstToVariable(MipsRegLo(Reg),&_GPR[Reg].UW[0],CRegName::GPR_Lo[Reg]);
|
||||
MipsRegState(Reg) = CRegInfo::STATE_UNKNOWN;
|
||||
MipsRegState(Reg) = STATE_UNKNOWN;
|
||||
return;
|
||||
}
|
||||
if ((MipsRegLo(Reg) & 0x80000000) != 0) {
|
||||
|
@ -601,19 +817,19 @@ void CRegInfo::UnMap_GPR (DWORD Reg, bool WriteBackValue)
|
|||
MoveConstToVariable(0,&_GPR[Reg].UW[1],CRegName::GPR_Hi[Reg]);
|
||||
}
|
||||
MoveConstToVariable(MipsRegLo(Reg),&_GPR[Reg].UW[0],CRegName::GPR_Lo[Reg]);
|
||||
MipsRegState(Reg) = CRegInfo::STATE_UNKNOWN;
|
||||
MipsRegState(Reg) = STATE_UNKNOWN;
|
||||
return;
|
||||
}
|
||||
if (Is64Bit(Reg)) {
|
||||
CPU_Message(" regcache: unallocate %s from %s",x86_Name(MipsRegMapHi(Reg)),CRegName::GPR_Hi[Reg]);
|
||||
x86Mapped(MipsRegHi(Reg)) = NotMapped;
|
||||
x86Protected(MipsRegHi(Reg)) = FALSE;
|
||||
x86Mapped(MipsRegMapHi(Reg)) = NotMapped;
|
||||
x86Protected(MipsRegMapHi(Reg)) = FALSE;
|
||||
}
|
||||
CPU_Message(" regcache: unallocate %s from %s",x86_Name(MipsRegMapLo(Reg)),CRegName::GPR_Lo[Reg]);
|
||||
x86Mapped(MipsRegMapLo(Reg)) = NotMapped;
|
||||
x86Protected(MipsRegMapLo(Reg)) = FALSE;
|
||||
if (!WriteBackValue) {
|
||||
MipsRegState(Reg) = CRegInfo::STATE_UNKNOWN;
|
||||
MipsRegState(Reg) = STATE_UNKNOWN;
|
||||
return;
|
||||
}
|
||||
MoveX86regToVariable(MipsRegMapLo(Reg),&_GPR[Reg].UW[0],CRegName::GPR_Lo[Reg]);
|
||||
|
@ -627,7 +843,7 @@ void CRegInfo::UnMap_GPR (DWORD Reg, bool WriteBackValue)
|
|||
MoveConstToVariable(0,&_GPR[Reg].UW[1],CRegName::GPR_Hi[Reg]);
|
||||
}
|
||||
}
|
||||
MipsRegState(Reg) = CRegInfo::STATE_UNKNOWN;
|
||||
MipsRegState(Reg) = STATE_UNKNOWN;
|
||||
}
|
||||
|
||||
CX86Ops::x86Reg CRegInfo::UnMap_TempReg ( void )
|
||||
|
@ -713,8 +929,8 @@ void CRegInfo::WriteBackRegisters (void)
|
|||
BOOL bEaxGprLo = FALSE;
|
||||
BOOL bEbxGprHi = FALSE;
|
||||
|
||||
for (count = 1; count < 10; count ++) { x86Protected(count) = FALSE; }
|
||||
for (count = 1; count < 10; count ++) { UnMap_X86reg ((CX86Ops::x86Reg)count); }
|
||||
for (count = 0; count < 10; count ++) { x86Protected((CX86Ops::x86Reg)count) = FALSE; }
|
||||
for (count = 0; count < 10; count ++) { UnMap_X86reg ((CX86Ops::x86Reg)count); }
|
||||
|
||||
/*************************************/
|
||||
|
||||
|
@ -776,8 +992,23 @@ void CRegInfo::WriteBackRegisters (void)
|
|||
#ifndef EXTERNAL_RELEASE
|
||||
default:
|
||||
DisplayError("Unknown State: %d\nin WriteBackRegisters",MipsRegState(count));
|
||||
BreakPoint(__FILE__,__LINE__);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
UnMap_AllFPRs();
|
||||
}
|
||||
|
||||
const char * CRegInfo::RoundingModelName ( FPU_ROUND RoundType )
|
||||
{
|
||||
switch (RoundType)
|
||||
{
|
||||
case RoundUnknown: return "RoundUnknown";
|
||||
case RoundDefault: return "RoundDefault";
|
||||
case RoundTruncate: return "RoundTruncate";
|
||||
case RoundNearest: return "RoundNearest";
|
||||
case RoundDown: return "RoundDown";
|
||||
case RoundUp: return "RoundUp";
|
||||
}
|
||||
return "** Invalid **";
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
class CRegInfo :
|
||||
private CX86Ops
|
||||
private CX86Ops,
|
||||
private CSystemRegisters
|
||||
{
|
||||
public:
|
||||
//enums
|
||||
|
@ -26,11 +27,21 @@ public:
|
|||
};
|
||||
|
||||
enum FPU_STATE {
|
||||
FPU_Unkown,FPU_Dword, FPU_Qword, FPU_Float, FPU_Double
|
||||
FPU_Any = -1,
|
||||
FPU_Unknown = 0,
|
||||
FPU_Dword = 1,
|
||||
FPU_Qword = 2,
|
||||
FPU_Float = 3,
|
||||
FPU_Double = 4,
|
||||
};
|
||||
|
||||
enum FPU_ROUND {
|
||||
RoundUnknown, RoundDefault, RoundTruncate, RoundNearest, RoundDown, RoundUp
|
||||
RoundUnknown = -1,
|
||||
RoundDefault = 0,
|
||||
RoundTruncate = 1,
|
||||
RoundNearest = 2,
|
||||
RoundDown = 3,
|
||||
RoundUp = 4,
|
||||
};
|
||||
public:
|
||||
bool operator==(const CRegInfo& right) const;
|
||||
|
@ -41,6 +52,13 @@ public:
|
|||
void Initilize ( void );
|
||||
|
||||
void FixRoundModel ( FPU_ROUND RoundMethod );
|
||||
void ChangeFPURegFormat ( int Reg, FPU_STATE OldFormat, FPU_STATE NewFormat, FPU_ROUND RoundingModel );
|
||||
void Load_FPR_ToTop ( int Reg, int RegToLoad, FPU_STATE Format);
|
||||
BOOL RegInStack ( int Reg, FPU_STATE Format );
|
||||
void UnMap_AllFPRs ( void );
|
||||
void UnMap_FPR ( int Reg, int WriteBackValue );
|
||||
x86FpuValues StackPosition ( int Reg );
|
||||
|
||||
x86Reg FreeX86Reg ( void );
|
||||
x86Reg Free8BitX86Reg ( void );
|
||||
void Map_GPR_32bit ( int MipsReg, BOOL SignValue, int MipsRegToLoad );
|
||||
|
@ -49,8 +67,6 @@ public:
|
|||
void ProtectGPR ( DWORD Reg );
|
||||
void UnProtectGPR ( DWORD Reg );
|
||||
void ResetX86Protection ( void );
|
||||
void UnMap_AllFPRs ( void );
|
||||
void UnMap_FPR ( int Reg, int WriteBackValue );
|
||||
x86Reg UnMap_TempReg ( void );
|
||||
void UnMap_GPR ( DWORD Reg, bool WriteBackValue );
|
||||
bool UnMap_X86reg ( x86Reg Reg );
|
||||
|
@ -80,6 +96,7 @@ public:
|
|||
inline long cMipsRegHi_S ( int Reg ) const { return MIPS_RegVal[Reg].W[1]; }
|
||||
inline CX86Ops::x86Reg cMipsRegMapLo ( int Reg ) const { return RegMapLo[Reg]; }
|
||||
inline CX86Ops::x86Reg cMipsRegMapHi ( int Reg ) const { return RegMapHi[Reg]; }
|
||||
inline bool cX86Protected ( x86Reg Reg ) const { return x86reg_Protected[Reg]; }
|
||||
|
||||
inline REG_STATE & MipsRegState ( int Reg ) { return MIPS_RegState[Reg]; }
|
||||
inline unsigned _int64 & MipsReg ( int Reg ) { return MIPS_RegVal[Reg].UDW; }
|
||||
|
@ -90,10 +107,11 @@ public:
|
|||
inline long & MipsRegHi_S ( int Reg ) { return MIPS_RegVal[Reg].W[1]; }
|
||||
inline CX86Ops::x86Reg & MipsRegMapLo ( int Reg ) { return RegMapLo[Reg]; }
|
||||
inline CX86Ops::x86Reg & MipsRegMapHi ( int Reg ) { return RegMapHi[Reg]; }
|
||||
inline bool & X86Protected ( x86Reg Reg ) { return x86reg_Protected[Reg]; }
|
||||
|
||||
inline DWORD & x86MapOrder( int Reg ) { return x86reg_MapOrder[Reg]; }
|
||||
inline bool & x86Protected( int Reg ) { return x86reg_Protected[Reg]; }
|
||||
inline REG_MAPPED & x86Mapped(int Reg) { return x86reg_MappedTo[Reg]; }
|
||||
inline DWORD & x86MapOrder( x86Reg Reg ) { return x86reg_MapOrder[Reg]; }
|
||||
inline bool & x86Protected( x86Reg Reg ) { return x86reg_Protected[Reg]; }
|
||||
inline REG_MAPPED & x86Mapped(x86Reg Reg) { return x86reg_MappedTo[Reg]; }
|
||||
|
||||
inline DWORD GetBlockCycleCount ( void ) const { return m_CycleCount; }
|
||||
inline void SetBlockCycleCount ( DWORD CyleCount ) { m_CycleCount = CyleCount; }
|
||||
|
@ -106,6 +124,8 @@ public:
|
|||
inline FPU_ROUND & CurrentRoundingModel ( void ) { return RoundingModel; }
|
||||
|
||||
private:
|
||||
x86Reg UnMap_8BitTempReg ( void );
|
||||
|
||||
//r4k
|
||||
REG_STATE MIPS_RegState[32];
|
||||
MIPS_DWORD MIPS_RegVal[32];
|
||||
|
@ -128,6 +148,7 @@ private:
|
|||
FPU_ROUND RoundingModel;
|
||||
|
||||
bool compare(const CRegInfo& right) const;
|
||||
const char * RoundingModelName ( FPU_ROUND RoundType );
|
||||
|
||||
static unsigned int m_fpuControl;
|
||||
};
|
||||
|
|
|
@ -55,13 +55,24 @@ bool CCodeBlock::Compile()
|
|||
}
|
||||
#ifdef tofix
|
||||
}
|
||||
CompileExitCode(BlockInfo);
|
||||
#endif
|
||||
|
||||
|
||||
CompileExitCode();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void CCodeBlock::CompileExitCode ( void )
|
||||
{
|
||||
for (EXIT_LIST::iterator ExitIter = m_ExitInfo.begin(); ExitIter != m_ExitInfo.end(); ExitIter++)
|
||||
{
|
||||
CPU_Message("");
|
||||
CPU_Message(" $Exit_%d",ExitIter->ID);
|
||||
SetJump32(ExitIter->JumpLoc,(DWORD *)m_RecompPos);
|
||||
m_NextInstruction = ExitIter->NextInstruction;
|
||||
m_EnterSection.CompileExit(-1, ExitIter->TargetPC,ExitIter->ExitRegSet,ExitIter->reason,true,NULL);
|
||||
}
|
||||
}
|
||||
|
||||
CJumpInfo::CJumpInfo()
|
||||
{
|
||||
TargetPC = (DWORD)-1;
|
||||
|
|
|
@ -138,7 +138,7 @@ void CX86Ops::AndVariableToX86Reg(void * Variable, const char * VariableName, x8
|
|||
|
||||
void CX86Ops::AndX86RegToX86Reg(x86Reg Destination, x86Reg Source) {
|
||||
CPU_Message(" and %s, %s",x86_Name(Destination),x86_Name(Source));
|
||||
PUTDST16(m_RecompPos,0x0021 + (Destination * 0x100) + (Source * 0x800));
|
||||
PUTDST16(m_RecompPos,0xC021 + (Destination * 0x100) + (Source * 0x800));
|
||||
}
|
||||
|
||||
void CX86Ops::BreakPointNotification (const char * const FileName, const int LineNumber)
|
||||
|
@ -3540,6 +3540,15 @@ const char * CX86Ops::fpu_Name ( x86FpuValues Reg ) {
|
|||
return "???";
|
||||
}
|
||||
|
||||
BOOL CX86Ops::Is8BitReg ( x86Reg Reg )
|
||||
{
|
||||
if (Reg == x86_EAX) { return TRUE; }
|
||||
if (Reg == x86_EBX) { return TRUE; }
|
||||
if (Reg == x86_ECX) { return TRUE; }
|
||||
if (Reg == x86_EDX) { return TRUE; }
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BYTE CX86Ops::CalcMultiplyCode (Multipler Multiply)
|
||||
{
|
||||
switch (Multiply) {
|
||||
|
@ -3555,12 +3564,12 @@ BYTE CX86Ops::CalcMultiplyCode (Multipler Multiply)
|
|||
|
||||
void CX86Ops::SetJump32(DWORD * Loc, DWORD * JumpLoc)
|
||||
{
|
||||
*Loc = (DWORD)(((DWORD)JumpLoc) - (((DWORD)(Loc)) + 4));;
|
||||
*Loc = (DWORD)(((DWORD)JumpLoc) - (((DWORD)(Loc)) + 4));
|
||||
}
|
||||
|
||||
void CX86Ops::SetJump8(BYTE * Loc, BYTE * JumpLoc)
|
||||
{
|
||||
*Loc = (BYTE )(((BYTE)JumpLoc - (BYTE)Loc) + 1);
|
||||
*Loc = (BYTE )((BYTE)JumpLoc - ((BYTE )Loc + 1));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ public:
|
|||
};
|
||||
|
||||
enum x86FpuValues {
|
||||
x86_ST_Unknown = -1,
|
||||
x86_ST0 = 0,
|
||||
x86_ST1 = 1,
|
||||
x86_ST2 = 2,
|
||||
|
@ -266,6 +267,7 @@ protected:
|
|||
static void fpuSubReg ( x86FpuValues reg );
|
||||
static void fpuSubRegPop ( x86FpuValues reg );
|
||||
|
||||
static BOOL Is8BitReg ( x86Reg Reg );
|
||||
static BYTE CalcMultiplyCode ( Multipler Multiply );
|
||||
static BYTE * m_RecompPos;
|
||||
|
||||
|
|
|
@ -1,21 +1,20 @@
|
|||
#include "N64 System/C Core/C Core.h"
|
||||
#include "System Globals.h"
|
||||
#include "stdafx.h"
|
||||
|
||||
CN64System * _N64System;
|
||||
CN64System * _SyncSystem;
|
||||
CRecompiler * _Recompiler;
|
||||
CMipsMemory * _MMU; //Memory of the n64
|
||||
CTLB * _TLB; //TLB Unit
|
||||
CRegisters * _Reg; //Current Register Set attacted to the _MMU
|
||||
CNotification * _Notify;
|
||||
CN64System * _N64System = NULL;
|
||||
CN64System * _SyncSystem = NULL;
|
||||
CRecompiler * _Recompiler = NULL;
|
||||
CMipsMemory * _MMU = NULL; //Memory of the n64
|
||||
CTLB * _TLB = NULL; //TLB Unit
|
||||
CRegisters * _Reg = NULL; //Current Register Set attacted to the _MMU
|
||||
CNotification * _Notify = NULL;
|
||||
//CSettings * _Settings;
|
||||
CPlugins * _Plugins;
|
||||
CN64Rom * _Rom; //The current rom that this system is executing.. it can only execute one file at the time
|
||||
CAudio * _Audio;
|
||||
CMemoryLabel * _Labels;
|
||||
CSystemTimer * _SystemTimer;
|
||||
CTransVaddr * _TransVaddr;
|
||||
|
||||
CPlugins * _Plugins = NULL;
|
||||
CN64Rom * _Rom = NULL; //The current rom that this system is executing.. it can only execute one file at the time
|
||||
CAudio * _Audio = NULL;
|
||||
CMemoryLabel * _Labels = NULL;
|
||||
CSystemTimer * _SystemTimer = NULL;
|
||||
CTransVaddr * _TransVaddr = NULL;
|
||||
CSystemEvents * _SystemEvents = NULL;
|
||||
|
||||
MIPS_DWORD * _GPR, * _FPR, * _RegHI, * _RegLO;
|
||||
DWORD * _PROGRAM_COUNTER, * _CP0, * _RegMI, * _LLBit,
|
||||
|
|
|
@ -1,23 +1,27 @@
|
|||
extern CNotification * _Notify;
|
||||
extern CSettings * _Settings;
|
||||
|
||||
extern CN64System * _N64System;
|
||||
extern CN64System * _SyncSystem;
|
||||
extern CRecompiler * _Recompiler;
|
||||
extern CMipsMemory * _MMU; //Memory of the n64
|
||||
extern CTLB * _TLB; //TLB Unit
|
||||
extern CRegisters * _Reg; //Current Register Set attacted to the _MMU
|
||||
extern CNotification * _Notify;
|
||||
extern CSettings * _Settings;
|
||||
extern CPlugins * _Plugins;
|
||||
extern CN64Rom * _Rom; //The current rom that this system is executing.. it can only execute one file at the time
|
||||
extern CAudio * _Audio;
|
||||
extern CMemoryLabel * _Labels;
|
||||
extern CSystemTimer * _SystemTimer;
|
||||
extern CTransVaddr * _TransVaddr;
|
||||
extern CSystemEvents * _SystemEvents;
|
||||
extern int * _NextTimer;
|
||||
|
||||
|
||||
/*
|
||||
extern MIPS_DWORD * _GPR, * _FPR, * _RegHI, * _RegLO;
|
||||
extern DWORD * _PROGRAM_COUNTER, * _CP0, * _RegMI, * _LLBit,
|
||||
* _LLAddr, * _FPCR, * _RegSI, * _RegRI, * _RegPI, * _RegAI,
|
||||
* _RegVI, * _RegDPC, * _RegSP, * _RegRDRAM;
|
||||
extern double ** _FPRDoubleLocation;
|
||||
extern float ** _FPRFloatLocation;
|
||||
extern int * _NextTimer;
|
||||
*/
|
||||
|
||||
|
|
|
@ -76,9 +76,6 @@ class CControl_Plugin {
|
|||
void (__cdecl *CloseDLL) ( void );
|
||||
void (__cdecl *RomOpen) ( void );
|
||||
void (__cdecl *RomClosed) ( void );
|
||||
void (__cdecl *GetKeys) ( int Control, BUTTONS * Keys );
|
||||
void (__cdecl *ControllerCommand)( int Control, BYTE * Command );
|
||||
void (__cdecl *ReadController) ( int Control, BYTE * Command );
|
||||
void (__cdecl *PluginOpened) ( void );
|
||||
void (__cdecl *SetSettingInfo) ( PLUGIN_SETTINGS * info );
|
||||
void (__cdecl *SetSettingInfo2) ( PLUGIN_SETTINGS2 * info );
|
||||
|
@ -101,7 +98,11 @@ public:
|
|||
void (__cdecl *WM_KeyDown) ( DWORD wParam, DWORD lParam );
|
||||
void (__cdecl *WM_KeyUp) ( DWORD wParam, DWORD lParam );
|
||||
void (__cdecl *RumbleCommand) ( int Control, BOOL bRumble );
|
||||
void (__cdecl *GetKeys) ( int Control, BUTTONS * Keys );
|
||||
void (__cdecl *ReadController) ( int Control, BYTE * Command );
|
||||
void (__cdecl *ControllerCommand)( int Control, BYTE * Command );
|
||||
|
||||
inline bool Initilized ( void ) const { return m_Initilized; }
|
||||
inline CCONTROL const * Controller (int control) { return m_Controllers[control]; }
|
||||
inline CONTROL * PluginControllers ( void ) { return m_PluginControllers; }
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include "..\Plugin.h"
|
||||
#include "stdafx.h"
|
||||
|
||||
CPluginList::CPluginList(bool bAutoFill /* = true */) :
|
||||
m_PluginDir(_Settings->LoadString(Directory_Plugin),"")
|
||||
|
|
|
@ -386,6 +386,10 @@ SOURCE="N64 System\Mips\Register Class.cpp"
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=".\N64 System\Mips\System Events.cpp"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE="N64 System\Mips\System Timing.cpp"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
@ -966,6 +970,10 @@ SOURCE="N64 System\Mips\Audio.h"
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=".\N64 System\Mips\Exception.h"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE="N64 System\Mips\Memory Class.h"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
@ -994,6 +1002,10 @@ SOURCE="N64 System\Mips\Register Class.h"
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=".\N64 System\Mips\System Events.h"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE="N64 System\Mips\System Timing.h"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
|
|
@ -1,23 +1,32 @@
|
|||
#include "..\support.h"
|
||||
#include "..\Settings.h"
|
||||
|
||||
int CGuiSettings::m_RefCount = 0;
|
||||
bool CGuiSettings::m_bCPURunning;
|
||||
bool CGuiSettings::m_bAutoSleep;
|
||||
|
||||
CGuiSettings::CGuiSettings()
|
||||
{
|
||||
RefreshSettings();
|
||||
_Settings->RegisterChangeCB(GameRunning_CPU_Running,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
||||
_Settings->RegisterChangeCB(Setting_AutoSleep,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
||||
m_RefCount += 1;
|
||||
if (m_RefCount == 1)
|
||||
{
|
||||
_Settings->RegisterChangeCB(GameRunning_CPU_Running,NULL,RefreshSettings);
|
||||
_Settings->RegisterChangeCB(Setting_AutoSleep,NULL,RefreshSettings);
|
||||
RefreshSettings(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
CGuiSettings::~CGuiSettings()
|
||||
{
|
||||
_Settings->UnregisterChangeCB(GameRunning_CPU_Running,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
||||
_Settings->UnregisterChangeCB(Setting_AutoSleep,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
||||
m_RefCount -= 1;
|
||||
if (m_RefCount == 0)
|
||||
{
|
||||
_Settings->UnregisterChangeCB(GameRunning_CPU_Running,NULL,RefreshSettings);
|
||||
_Settings->UnregisterChangeCB(Setting_AutoSleep,NULL,RefreshSettings);
|
||||
}
|
||||
}
|
||||
|
||||
void CGuiSettings::RefreshSettings()
|
||||
void CGuiSettings::RefreshSettings(void *)
|
||||
{
|
||||
m_bCPURunning = _Settings->LoadBool(GameRunning_CPU_Running);
|
||||
m_bAutoSleep = _Settings->LoadBool(Setting_AutoSleep);
|
||||
|
|
|
@ -2,16 +2,6 @@
|
|||
|
||||
class CGuiSettings
|
||||
{
|
||||
static void StaticRefreshSettings (CGuiSettings * _this)
|
||||
{
|
||||
_this->RefreshSettings();
|
||||
}
|
||||
|
||||
void RefreshSettings ( void );
|
||||
|
||||
static bool m_bCPURunning;
|
||||
static bool m_bAutoSleep;
|
||||
|
||||
protected:
|
||||
CGuiSettings();
|
||||
virtual ~CGuiSettings();
|
||||
|
@ -19,4 +9,12 @@ protected:
|
|||
static inline bool bCPURunning ( void) { return m_bCPURunning; }
|
||||
static inline bool bAutoSleep ( void) { return m_bAutoSleep; }
|
||||
|
||||
private:
|
||||
static void RefreshSettings (void *);
|
||||
|
||||
static bool m_bCPURunning;
|
||||
static bool m_bAutoSleep;
|
||||
|
||||
static int m_RefCount;
|
||||
|
||||
};
|
|
@ -1,6 +1,8 @@
|
|||
#include "..\support.h"
|
||||
#include "..\Settings.h"
|
||||
|
||||
int CN64SystemSettings::m_RefCount = 0;
|
||||
|
||||
bool CN64SystemSettings::m_bShowCPUPer;
|
||||
bool CN64SystemSettings::m_bProfiling;
|
||||
bool CN64SystemSettings::m_bBasicMode;
|
||||
|
@ -15,40 +17,48 @@ DWORD CN64SystemSettings::m_ViRefreshRate;
|
|||
|
||||
CN64SystemSettings::CN64SystemSettings()
|
||||
{
|
||||
_Settings->RegisterChangeCB(UserInterface_BasicMode,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
||||
_Settings->RegisterChangeCB(UserInterface_ShowCPUPer,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
||||
_Settings->RegisterChangeCB(UserInterface_DisplayFrameRate,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
||||
m_RefCount += 1;
|
||||
if (m_RefCount == 1)
|
||||
{
|
||||
_Settings->RegisterChangeCB(UserInterface_BasicMode,NULL,RefreshSettings);
|
||||
_Settings->RegisterChangeCB(UserInterface_ShowCPUPer,NULL,RefreshSettings);
|
||||
_Settings->RegisterChangeCB(UserInterface_DisplayFrameRate,NULL,RefreshSettings);
|
||||
|
||||
_Settings->RegisterChangeCB(Debugger_ProfileCode,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
||||
_Settings->RegisterChangeCB(Debugger_ShowDListAListCount,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
||||
_Settings->RegisterChangeCB(Debugger_ProfileCode,NULL,RefreshSettings);
|
||||
_Settings->RegisterChangeCB(Debugger_ShowDListAListCount,NULL,RefreshSettings);
|
||||
|
||||
_Settings->RegisterChangeCB(GameRunning_LimitFPS,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
||||
_Settings->RegisterChangeCB(GameRunning_LimitFPS,NULL,RefreshSettings);
|
||||
|
||||
_Settings->RegisterChangeCB(Game_FixedAudio,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
||||
_Settings->RegisterChangeCB(Game_SyncViaAudio,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
||||
_Settings->RegisterChangeCB(Game_SPHack,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
||||
_Settings->RegisterChangeCB(Game_ViRefreshRate,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
||||
RefreshSettings();
|
||||
_Settings->RegisterChangeCB(Game_FixedAudio,NULL,RefreshSettings);
|
||||
_Settings->RegisterChangeCB(Game_SyncViaAudio,NULL,RefreshSettings);
|
||||
_Settings->RegisterChangeCB(Game_SPHack,NULL,RefreshSettings);
|
||||
_Settings->RegisterChangeCB(Game_ViRefreshRate,NULL,RefreshSettings);
|
||||
RefreshSettings(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
CN64SystemSettings::~CN64SystemSettings()
|
||||
{
|
||||
_Settings->UnregisterChangeCB(UserInterface_BasicMode,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
||||
_Settings->UnregisterChangeCB(UserInterface_DisplayFrameRate,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
||||
_Settings->UnregisterChangeCB(UserInterface_ShowCPUPer,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
||||
m_RefCount -= 1;
|
||||
if (m_RefCount == 0)
|
||||
{
|
||||
_Settings->UnregisterChangeCB(UserInterface_BasicMode,NULL,RefreshSettings);
|
||||
_Settings->UnregisterChangeCB(UserInterface_DisplayFrameRate,NULL,RefreshSettings);
|
||||
_Settings->UnregisterChangeCB(UserInterface_ShowCPUPer,NULL,RefreshSettings);
|
||||
|
||||
_Settings->UnregisterChangeCB(Debugger_ProfileCode,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
||||
_Settings->UnregisterChangeCB(Debugger_ShowDListAListCount,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
||||
_Settings->UnregisterChangeCB(Debugger_ProfileCode,NULL,RefreshSettings);
|
||||
_Settings->UnregisterChangeCB(Debugger_ShowDListAListCount,NULL,RefreshSettings);
|
||||
|
||||
_Settings->UnregisterChangeCB(GameRunning_LimitFPS,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
||||
_Settings->UnregisterChangeCB(GameRunning_LimitFPS,NULL,RefreshSettings);
|
||||
|
||||
_Settings->UnregisterChangeCB(Game_FixedAudio,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
||||
_Settings->UnregisterChangeCB(Game_SyncViaAudio,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
||||
_Settings->UnregisterChangeCB(Game_SPHack,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
||||
_Settings->UnregisterChangeCB(Game_ViRefreshRate,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
|
||||
_Settings->UnregisterChangeCB(Game_FixedAudio,NULL,RefreshSettings);
|
||||
_Settings->UnregisterChangeCB(Game_SyncViaAudio,NULL,RefreshSettings);
|
||||
_Settings->UnregisterChangeCB(Game_SPHack,NULL,RefreshSettings);
|
||||
_Settings->UnregisterChangeCB(Game_ViRefreshRate,NULL,RefreshSettings);
|
||||
}
|
||||
}
|
||||
|
||||
void CN64SystemSettings::RefreshSettings()
|
||||
void CN64SystemSettings::RefreshSettings(void *)
|
||||
{
|
||||
m_bBasicMode = _Settings->LoadBool(UserInterface_BasicMode);
|
||||
m_bDisplayFrameRate = _Settings->LoadBool(UserInterface_DisplayFrameRate);
|
||||
|
|
|
@ -2,24 +2,6 @@
|
|||
|
||||
class CN64SystemSettings
|
||||
{
|
||||
static void StaticRefreshSettings (CN64SystemSettings * _this)
|
||||
{
|
||||
_this->RefreshSettings();
|
||||
}
|
||||
|
||||
void RefreshSettings ( void );
|
||||
|
||||
static bool m_bShowCPUPer;
|
||||
static bool m_bProfiling;
|
||||
static bool m_bBasicMode;
|
||||
static bool m_bLimitFPS;
|
||||
static bool m_bShowDListAListCount;
|
||||
static bool m_bFixedAudio;
|
||||
static bool m_bSyncToAudio;
|
||||
static bool m_bDisplayFrameRate;
|
||||
static bool m_SPHack;
|
||||
static DWORD m_ViRefreshRate;
|
||||
|
||||
protected:
|
||||
CN64SystemSettings();
|
||||
virtual ~CN64SystemSettings();
|
||||
|
@ -34,4 +16,21 @@ protected:
|
|||
inline bool bSyncToAudio ( void ) const { return m_bSyncToAudio; }
|
||||
inline bool bSPHack ( void ) const { return m_SPHack; }
|
||||
inline DWORD ViRefreshRate ( void ) const { return m_ViRefreshRate; }
|
||||
|
||||
private:
|
||||
static void RefreshSettings ( void * );
|
||||
|
||||
static bool m_bShowCPUPer;
|
||||
static bool m_bProfiling;
|
||||
static bool m_bBasicMode;
|
||||
static bool m_bLimitFPS;
|
||||
static bool m_bShowDListAListCount;
|
||||
static bool m_bFixedAudio;
|
||||
static bool m_bSyncToAudio;
|
||||
static bool m_bDisplayFrameRate;
|
||||
static bool m_SPHack;
|
||||
static DWORD m_ViRefreshRate;
|
||||
|
||||
static int m_RefCount;
|
||||
|
||||
};
|
|
@ -26,6 +26,11 @@ CSettings::CSettings()
|
|||
|
||||
CSettings::~CSettings()
|
||||
{
|
||||
CSettingTypeApplication::CleanUp();
|
||||
CSettingTypeRomDatabase::CleanUp();
|
||||
CSettingTypeGame::CleanUp();
|
||||
CSettingTypeCheats::CleanUp();
|
||||
|
||||
for (SETTING_MAP::iterator iter = m_SettingInfo.begin(); iter != m_SettingInfo.end(); iter++)
|
||||
{
|
||||
delete iter->second;
|
||||
|
@ -42,11 +47,6 @@ CSettings::~CSettings()
|
|||
delete current_item;
|
||||
}
|
||||
}
|
||||
|
||||
CSettingTypeApplication::CleanUp();
|
||||
CSettingTypeRomDatabase::CleanUp();
|
||||
CSettingTypeGame::CleanUp();
|
||||
CSettingTypeCheats::CleanUp();
|
||||
}
|
||||
|
||||
void CSettings::AddHandler ( SettingID TypeID, CSettingType * Handler )
|
||||
|
@ -283,328 +283,6 @@ void CSettings::AddHowToHandleSetting ()
|
|||
AddHandler(Cheat_Options, new CSettingTypeCheats("_O"));
|
||||
AddHandler(Cheat_Range, new CSettingTypeCheats("_R"));
|
||||
AddHandler(Cheat_RangeNotes, new CSettingTypeCheats("_RN"));
|
||||
|
||||
#ifdef toremove
|
||||
/* INFO(SettingsIniName,Default_None,Data_String,RelativePath,"Project64.cfg","",0);
|
||||
if (SettingsIniFile == NULL)
|
||||
{
|
||||
SettingsIniFile = new CIniFile(LoadString(SettingsIniName).c_str());
|
||||
}
|
||||
|
||||
INFO(UseSettingFromRegistry,Default_False,Data_DWORD,LocalSettings,"Use Registry","Settings",0);
|
||||
SettingLocation SettingLoc = LoadDword(UseSettingFromRegistry) ? InRegistry : LocalSettings;
|
||||
*/
|
||||
|
||||
/* int count;
|
||||
|
||||
#define INFO(ID,X,Y,Z,Q,W,E) SettingInfo.insert(SETTING_MAP::value_type(ID,CSettingInfo(ID,X,Y,Z,Q,W,E)))
|
||||
#define INF2(ID,X,Y,Z,Q,W,E,R) SettingInfo.insert(SETTING_MAP::value_type(ID,CSettingInfo(ID,X,Y,Z,Q,W,E,R)))
|
||||
//Default Values
|
||||
INFO(Default_False, Default_None, Data_DWORD, ConstValue, "","",(DWORD)false);
|
||||
INFO(Default_True, Default_None, Data_DWORD, ConstValue, "","",(DWORD)true);
|
||||
INFO(Default_Language, Default_None, Data_String, ConstString, "","",0);
|
||||
INFO(Default_RomStatus, Default_None, Data_String, ConstString, "Unknown","",0);
|
||||
INFO(Default_RomBrowserWidth, Default_None, Data_DWORD, ConstValue, "","",640);
|
||||
INFO(Default_RomBrowserHeight, Default_None, Data_DWORD, ConstValue, "","",480);
|
||||
INFO(Default_RememberedRomFiles, Default_None, Data_DWORD, ConstValue, "","",MaxRememberedFiles);
|
||||
INFO(Default_RememberedRomDirs, Default_None, Data_DWORD, ConstValue, "","",MaxRememberedDirs);
|
||||
INFO(Default_CPUType, Default_None, Data_DWORD, ConstValue, "","",CPU_Recompiler);
|
||||
INFO(Default_RdramSize, Default_None, Data_DWORD, ConstValue, "","",0x400000);
|
||||
INFO(Default_SaveChip, Default_None, Data_DWORD, ConstValue, "","",SaveChip_Auto);
|
||||
INFO(Default_CFactor, Default_None, Data_DWORD, ConstValue, "","",2);
|
||||
INFO(Default_CheatExt, Default_None, Data_String, ConstString, "?","",0);
|
||||
INFO(Default_FunctionLookup, Default_None, Data_DWORD, ConstValue, "","",FuncFind_PhysicalLookup);
|
||||
INFO(Default_BlockLinking, Default_None, Data_DWORD, ConstValue, "","",(DWORD)false);
|
||||
INFO(Default_SaveSlot, Default_None, Data_DWORD, ConstValue, "","",(DWORD)0);
|
||||
INFO(Default_LogLevel, Default_None, Data_DWORD, ConstValue, "","",(DWORD)TraceError);
|
||||
INFO(Default_FrameDisplayType, Default_None, Data_DWORD, ConstValue, "","",FR_VIs);
|
||||
|
||||
|
||||
//Add setting to see if we get settings from file system or registry
|
||||
INFO(SettingsIniName,Default_None,Data_String,RelativePath,"Project64.cfg","",0);
|
||||
if (SettingsIniFile == NULL)
|
||||
{
|
||||
SettingsIniFile = new CIniFile(LoadString(SettingsIniName).c_str());
|
||||
}
|
||||
|
||||
INFO(UseSettingFromRegistry,Default_False,Data_DWORD,LocalSettings,"Use Registry","Settings",0);
|
||||
SettingLocation SettingLoc = LoadDword(UseSettingFromRegistry) ? InRegistry : LocalSettings;
|
||||
*/
|
||||
//Language
|
||||
/* AddHandler(CurrentLanguage,new CSettingTypeApplication("","Current Language",""));
|
||||
|
||||
//Gui Settings
|
||||
AddHandler(RomBrowser, new CSettingTypeApplication("Rom Browser","Rom Browser",true));
|
||||
AddHandler(RomBrowserTop, new CSettingTypeApplication("Rom Browser","Top" ,Default_None));
|
||||
AddHandler(RomBrowserLeft, new CSettingTypeApplication("Rom Browser","Left" ,Default_None));
|
||||
AddHandler(RomBrowserHeight, new CSettingTypeApplication("Rom Browser","Height", (DWORD)480));
|
||||
AddHandler(RomBrowserWidth, new CSettingTypeApplication("Rom Browser","Width", (DWORD)640));
|
||||
AddHandler(RomBrowserRecursive, new CSettingTypeApplication("Rom Browser","Recursive", false));
|
||||
AddHandler(RomBrowserMaximized, new CSettingTypeApplication("Rom Browser","Maximized", false));
|
||||
AddHandler(RomBrowserSortFieldIndex, new CSettingTypeApplicationIndex("Rom Browser", "Sort Field", Default_None));
|
||||
AddHandler(RomBrowserPosIndex, new CSettingTypeApplicationIndex("Rom Browser\\Field Pos","Field",(DWORD)0));
|
||||
AddHandler(RomBrowserWidthIndex,new CSettingTypeApplicationIndex("Rom Browser\\Field Width","Field",(DWORD)100));
|
||||
|
||||
/*
|
||||
INFO(,Default_False,Data_DWORD,SettingLoc,"","Rom Browser",0);
|
||||
INFO(,Default_False,Data_DWORD,SettingLoc,"","Rom Browser",0);
|
||||
for (int SortID = 0; SortID <= NoOfSortKeys; SortID++ ) {
|
||||
char Name[300];
|
||||
_snprintf(Name,sizeof(Name),"Sort Field %d",SortID);
|
||||
INF2((SettingID)(SortField + SortID),Default_None,Data_String,SettingLoc,Name,"Rom Browser",0,SortField);
|
||||
_snprintf(Name,sizeof(Name),"Sort Ascending %d",SortID);
|
||||
INF2((SettingID)(SortAscending + SortID),Default_True,Data_DWORD,SettingLoc,Name,"Rom Browser",0,SortAscending);
|
||||
}
|
||||
for (int Field = 0; Field <= MaxRomBrowserFields; Field++ ) {
|
||||
char Name[300];
|
||||
_snprintf(Name,sizeof(Name),"Field %02d",Field);
|
||||
INF2((SettingID)(FirstRomBrowserPos + Field),Default_None,Data_DWORD,SettingLoc,Name,"Rom Browser\\Field Pos",0,FirstRomBrowserPos);
|
||||
INF2((SettingID)(FirstRomBrowserWidth + Field),Default_None,Data_DWORD,SettingLoc,Name,"Rom Browser\\Field Width",0,FirstRomBrowserWidth);
|
||||
}
|
||||
INFO(TLBWindowTop,Default_None,Data_DWORD,SettingLoc,"Rom Browser Top","Page Setup",0);
|
||||
INFO(TLBWindowLeft,Default_None,Data_DWORD,SettingLoc,"Rom Browser Left","Page Setup",0);
|
||||
*/
|
||||
|
||||
|
||||
//Beta settings
|
||||
/* AddHandler(IsBetaVersion, new CSettingTypeTempBool(true));
|
||||
AddHandler(BetaUserName, new CSettingTypeTempString("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"));
|
||||
AddHandler(BetaEmailAddress, new CSettingTypeTempString("????????????????????????????????????????????????????????????????????????????????"));
|
||||
|
||||
//General Settings
|
||||
AddHandler(AutoStart, new CSettingTypeApplication("","Auto Start", (DWORD)true));
|
||||
AddHandler(AutoZip, new CSettingTypeApplication("","Auto Zip Saves", (DWORD)true));
|
||||
AddHandler(AutoSleep, new CSettingTypeApplication("","Auto Sleep", (DWORD)true));
|
||||
AddHandler(AutoFullScreen, new CSettingTypeApplication("","Auto Full Screen", (DWORD)true));
|
||||
AddHandler(BasicMode, new CSettingTypeApplication("","Basic Mode", (DWORD)true));
|
||||
AddHandler(RememberCheats, new CSettingTypeApplication("","Remember Cheats", (DWORD)false));
|
||||
AddHandler(DisableScrSaver, new CSettingTypeApplication("","Disable Screen Saver",(DWORD)true));
|
||||
AddHandler(ShowCPUPer, new CSettingTypeApplication("","Display CPU Usage", (DWORD)false));
|
||||
AddHandler(LimitFPS, new CSettingTypeApplication("","Limit FPS", (DWORD)true));
|
||||
AddHandler(ProfileCode, new CSettingTypeApplication("","Profile Code", (DWORD)false));
|
||||
AddHandler(GenerateLogFiles, new CSettingTypeApplication("","Generate Log Files", (DWORD)false));
|
||||
AddHandler(DisableGameFixes, new CSettingTypeApplication("","Disable Game Fixes", (DWORD)false));
|
||||
|
||||
|
||||
//Logging
|
||||
AddHandler(AppLogLevel,new CSettingTypeApplication("Logging","Log Level",(DWORD)TraceError));
|
||||
AddHandler(AppLogFlush,new CSettingTypeApplication("Logging","Log Auto Flush",(DWORD)false));
|
||||
|
||||
//Recent Files
|
||||
AddHandler(RememberedRomFilesCount, new CSettingTypeApplication("","Remembered Rom Files",(DWORD)10));
|
||||
AddHandler(RecentRomFileIndex, new CSettingTypeApplicationIndex("Recent File","Recent Rom",Default_None));
|
||||
AddHandler(RememberedRomDirCount, new CSettingTypeApplication("","Remembered Rom Dirs",(DWORD)10));
|
||||
AddHandler(RecentRomDirIndex, new CSettingTypeApplicationIndex("Recent Dir","Recent Dir",Default_None));
|
||||
|
||||
/* for (count = FirstRecentRom; count != LastRecentRom; count++ ) {
|
||||
char Name[300];
|
||||
_snprintf(Name,sizeof(Name)," %d",count - FirstRecentRom);
|
||||
INF2((SettingID)count,Default_None,Data_String,SettingLoc,Name,"",0,FirstRecentRom);
|
||||
}
|
||||
|
||||
//Recent Dirs
|
||||
for (count = FirstRecentDir; count != LastRecentDir; count++ ) {
|
||||
char Name[300];
|
||||
_snprintf(Name,sizeof(Name),"Recent Dir %d",count - FirstRecentDir);
|
||||
INF2((SettingID)count,Default_None,Data_String,SettingLoc,Name,"Recent Dir",0,FirstRecentDir);
|
||||
}
|
||||
INFO(RememberedRomDir,Default_RememberedRomDirs,Data_DWORD,SettingLoc,"Remembered Rom Dirs","",0);
|
||||
|
||||
|
||||
//Plugins
|
||||
*/
|
||||
/*
|
||||
|
||||
AddHandler(CurVerRSP_Plugin, new CSettingTypeApplication("Plugin","RSP Dll Ver", ""));
|
||||
AddHandler(CurVerGFX_Plugin, new CSettingTypeApplication("Plugin","Graphics Dll Ver", ""));
|
||||
AddHandler(CurVerAUDIO_Plugin, new CSettingTypeApplication("Plugin","Audio Dll Ver", ""));
|
||||
AddHandler(CurVerCONT_Plugin, new CSettingTypeApplication("Plugin","Controller Dll Ver", ""));
|
||||
|
||||
/*INFO(RSP_PluginChanged, Default_None,Data_DWORD,TemporarySetting,"","",0);
|
||||
INFO(AUDIO_PluginChanged,Default_None,Data_DWORD,TemporarySetting,"","",0);
|
||||
INFO(GFX_PluginChanged, Default_None,Data_DWORD,TemporarySetting,"","",0);
|
||||
INFO(CONT_PluginChanged, Default_None,Data_DWORD,TemporarySetting,"","",0);
|
||||
|
||||
//Cheats
|
||||
for (count = 0; count < MaxCheats; count++ ) {
|
||||
char Name[300];
|
||||
|
||||
_snprintf(Name,sizeof(Name),"Cheat%d",count);
|
||||
INF2((SettingID)(count + CheatEntry), Default_None,Data_String,CheatSetting,Name,"",0,CheatEntry);
|
||||
|
||||
_snprintf(Name,sizeof(Name),"Cheat%d",count);
|
||||
INF2((SettingID)(count + CheatPermEntry),Default_None,Data_String,RomSetting,Name,"",0,CheatEntry);
|
||||
|
||||
_snprintf(Name,sizeof(Name),"Cheat%d_O",count);
|
||||
INF2((SettingID)(count + CheatOptions), Default_None,Data_String,CheatSetting,Name,"",0,CheatOptions);
|
||||
|
||||
_snprintf(Name,sizeof(Name),"Cheat%d_R",count);
|
||||
INF2((SettingID)(count + CheatRange), Default_None,Data_String,CheatSetting,Name,"",0,CheatRange);
|
||||
|
||||
_snprintf(Name,sizeof(Name),"Cheat%d_RN",count);
|
||||
INF2((SettingID)(count + CheatRangeNotes), Default_None,Data_String,CheatSetting,Name,"",0,CheatRangeNotes);
|
||||
|
||||
_snprintf(Name,sizeof(Name),"Cheat%d_N",count);
|
||||
INF2((SettingID)(count + CheatNotes), Default_None,Data_String,CheatSetting,Name,"",0,CheatNotes);
|
||||
|
||||
_snprintf(Name,sizeof(Name),"Cheat%d",count);
|
||||
INF2((SettingID)(count + CheatActive), Default_False,Data_DWORD,GameSetting,Name,"",0,CheatActive);
|
||||
|
||||
_snprintf(Name,sizeof(Name),"Cheat%d.exten",count);
|
||||
INF2((SettingID)(count + CheatExtension),Default_CheatExt,Data_String,GameSetting,Name,"",0,CheatExtension);
|
||||
}
|
||||
|
||||
INFO(RememberedRomDir,Default_RememberedRomDirs,Data_DWORD,SettingLoc,"Remembered Rom Dirs","",0);
|
||||
*/
|
||||
|
||||
//Directories
|
||||
/*
|
||||
AddHandler(InitialPluginDirectory, new CSettingTypeRelativePath("Plugin",""));
|
||||
AddHandler(InitialRomDirectory, new CSettingTypeRelativePath("Rom Directory",""));
|
||||
AddHandler(InitialSaveDirectory, new CSettingTypeRelativePath("Save",""));
|
||||
AddHandler(InitialInstantSaveDirectory, new CSettingTypeRelativePath("Save",""));
|
||||
AddHandler(InitialSnapShotDir, new CSettingTypeRelativePath("Screenshots",""));
|
||||
AddHandler(InitialTextureDir, new CSettingTypeRelativePath("textures-load",""));
|
||||
|
||||
AddHandler(SelectedPluginDirectory, new CSettingTypeApplication("Directory","Selected Plugin Dir", InitialPluginDirectory));
|
||||
AddHandler(SelectedRomDir, new CSettingTypeApplication("Directory","Selected Rom Dir", InitialRomDirectory));
|
||||
AddHandler(SelectedSaveDirectory, new CSettingTypeApplication("Directory","Selected Save Dir", InitialSaveDirectory));
|
||||
AddHandler(SelectedInstantSaveDirectory, new CSettingTypeApplication("Directory","Selected Instant Save Dir", InitialInstantSaveDirectory));
|
||||
AddHandler(SelectedSnapShotDir, new CSettingTypeApplication("Directory","Selected Snap Shot Dir", InitialSnapShotDir));
|
||||
|
||||
AddHandler(PluginDirectory, new CSettingTypeApplication("Directory","Plugin Directory", InitialPluginDirectory));
|
||||
AddHandler(RomDirectory, new CSettingTypeApplication("Directory","Rom Directory", InitialRomDirectory));
|
||||
AddHandler(SaveDirectory, new CSettingTypeApplication("Directory","Save Directory", InitialSaveDirectory));
|
||||
AddHandler(InstantSaveDirectory, new CSettingTypeApplication("Directory","Instant Save Directory",InitialInstantSaveDirectory));
|
||||
AddHandler(SnapShotDir, new CSettingTypeApplication("Directory","Snap Shot Directory", InitialSnapShotDir));
|
||||
AddHandler(TextureDir, new CSettingTypeApplication("Directory","Texture Directory", InitialTextureDir));
|
||||
AddHandler(LastSaveDir, new CSettingTypeApplication("Directory","Last Save Directory", InstantSaveDirectory));
|
||||
|
||||
|
||||
AddHandler(UsePluginDirSelected, new CSettingTypeApplication("Directory","Use Default Plugin Dir", false));
|
||||
AddHandler(UseRomDirSelected, new CSettingTypeApplication("Directory","Use Default Rom Dir", InitialPluginDirectory));
|
||||
AddHandler(UseSaveDirSelected, new CSettingTypeApplication("Directory","Use Default Save Dir", InitialPluginDirectory));
|
||||
AddHandler(UseInstantDirSelected, new CSettingTypeApplication("Directory","Use Default Instant Dir", InitialPluginDirectory));
|
||||
AddHandler(UseSnapShotDirSelected, new CSettingTypeApplication("Directory","Use Default Snap Shot Dir", InitialPluginDirectory));
|
||||
/*
|
||||
INFO(ApplicationDir,Default_None,Data_String,RelativePath,"","",0);
|
||||
*/
|
||||
//Debugger
|
||||
/* AddHandler(Debugger, new CSettingTypeApplication("Debugger","Debugger",false));
|
||||
AddHandler(ShowUnhandledMemory, new CSettingTypeApplication("Debugger","Show Unhandled Memory",false));
|
||||
AddHandler(ShowPifErrors, new CSettingTypeApplication("Debugger","Show Pif Errors",false));
|
||||
AddHandler(ShowDListAListCount, new CSettingTypeApplication("Debugger","Show Dlist Alist Count",false));
|
||||
AddHandler(ShowRecompMemSize, new CSettingTypeApplication("Debugger","Show Recompiler Memory size",false));
|
||||
AddHandler(ShowPifRamErrors, new CSettingTypeApplication("Debugger","Show Pif Ram Errors",false));
|
||||
AddHandler(ShowCheckOpUsageErrors, new CSettingTypeApplication("Debugger","Show Check Op Usage Errors",false));
|
||||
AddHandler(LogFunctionCalls, new CSettingTypeApplication("Debugger","Log Function Class",false));
|
||||
AddHandler(GenerateDebugLog, new CSettingTypeApplication("Debugger","Generate Debug Code",false));
|
||||
|
||||
//RSP
|
||||
AddHandler(UseHighLevelAudio, new CSettingTypeApplication("Plugin Directory","RSP",false));
|
||||
AddHandler(UseHighLevelGfx, new CSettingTypeApplication("Plugin Directory","RSP",true));
|
||||
|
||||
//Indvidual Game Settings
|
||||
AddHandler(Game_SaveChip, new CSettingTypeGame("","SaveChip",Rdb_SaveChip));
|
||||
|
||||
|
||||
/* INFO(Game_LastSaveSlot,Default_SaveSlot,Data_DWORD,GameSetting,"Last Used Save Slot","",0);
|
||||
|
||||
//Rom Settings
|
||||
*/
|
||||
/* AddHandler(ROM_IniKey, new CSettingTypeTempString(""));
|
||||
AddHandler(ROM_NAME, new CSettingTypeTempString(""));
|
||||
//AddHandler(ROM_Default, new CSettingTypeTempNumber(-1));
|
||||
AddHandler(ROM_MD5, new CSettingTypeRomDatabase("MD5",""));
|
||||
AddHandler(ROM_InternalName, new CSettingTypeRomDatabase("Internal Name",""));
|
||||
AddHandler(ROM_GoodName, new CSettingTypeRomDatabase("Good Name",ROM_NAME));
|
||||
AddHandler(ROM_Status, new CSettingTypeRomDatabase("Status","Unknown"));
|
||||
AddHandler(ROM_CoreNotes, new CSettingTypeRomDatabase("Core Note",""));
|
||||
AddHandler(ROM_PluginNotes, new CSettingTypeRomDatabase("Plugin Note",""));
|
||||
|
||||
//INFO(ROM_CPUType, ROM_Default, Data_CPUTYPE,RomSetting,"CPU Type","",0);
|
||||
AddHandler(ROM_RomInMemory, new CSettingTypeRomDatabase("Rom In Memory",false));
|
||||
AddHandler(ROM_FunctionLookup,new CSettingTypeRomDatabase("FuncFind",-1));
|
||||
AddHandler(ROM_RamSize, new CSettingTypeRomDatabase("RDRAM Size",-1));
|
||||
//INFO(ROM_SaveChip, Default_SaveChip, Data_SaveChip,RomSetting,"Save Type","",0);
|
||||
AddHandler(ROM_CounterFactor, new CSettingTypeRomDatabase("Counter Factor",-1));
|
||||
AddHandler(ROM_CustomSMM, new CSettingTypeRomDatabase("CustomSMM",false));
|
||||
AddHandler(ROM_SMM_Cache, new CSettingTypeRomDatabase("SMM-Cache",true));
|
||||
AddHandler(ROM_SMM_PIDMA, new CSettingTypeRomDatabase("SMM-PI DMA",true));
|
||||
AddHandler(ROM_SMM_TLB, new CSettingTypeRomDatabase("SMM-TLB",true));
|
||||
AddHandler(ROM_SMM_Protect, new CSettingTypeRomDatabase("SMM-Protect",false));
|
||||
AddHandler(ROM_SMM_ValidFunc, new CSettingTypeRomDatabase("SMM-FUNC",true));
|
||||
//INFO(ROM_UseTlb, Default_True, Data_YesNo, RomSetting,"Use TLB","",0);
|
||||
//INFO(ROM_RegCache, Default_True, Data_YesNo, RomSetting,"Reg Cache","",0);
|
||||
AddHandler(ROM_SyncAudio, new CSettingTypeRomDatabase("Sync Audio",false));
|
||||
//INFO(ROM_BlockLinking, ROM_Default, Data_OnOff, RomSetting,"Linking","",0);
|
||||
AddHandler(ROM_DelayDlists, new CSettingTypeRomDatabase("Delay Dlist",true));
|
||||
AddHandler(ROM_UseJumpTable, new CSettingTypeRomDatabase("Use Jump Table",true));
|
||||
//INFO(ROM_DelaySI, Default_False, Data_YesNo, RomSetting,"Delay SI","",0);
|
||||
//INFO(ROM_AudioSignal, Default_False, Data_YesNo, RomSetting,"Audio Signal","",0);
|
||||
//INFO(ROM_SPHack, Default_False, Data_YesNo, RomSetting,"SP Hack","",0);
|
||||
AddHandler(ROM_FixedAudio, new CSettingTypeRomDatabase("Fixed Audio",true));
|
||||
AddHandler(ROM_TLB_VAddrStart,new CSettingTypeRomDatabase("TLB: Vaddr Start",0));
|
||||
AddHandler(ROM_TLB_VAddrLen, new CSettingTypeRomDatabase("TLB: Vaddr Len",0));
|
||||
AddHandler(ROM_TLB_PAddrStart,new CSettingTypeRomDatabase("TLB: PAddr Start",0));
|
||||
|
||||
/* for (count = ROM_MD5 + 1; count != ROM_LastMD5; count++ ) {
|
||||
char Name[300];
|
||||
_snprintf(Name,sizeof(Name),"MD5%d",count - ROM_LastMD5);
|
||||
INFO((SettingID)count,Default_None,Data_String,RomSetting,Name,"",0);
|
||||
}
|
||||
|
||||
//System Settings
|
||||
INFO(SYSTEM_CPUType, Default_CPUType, Data_DWORD, SettingLoc,"CPU Type","CPU",0);
|
||||
INFO(SYSTEM_SelfModMethod, Default_SelfModCheck, Data_DWORD, SettingLoc,"Self Mod Method","CPU",0);
|
||||
INFO(SYSTEM_FunctionLookup,Default_FunctionLookup, Data_DWORD, SettingLoc,"Function Lookup","CPU",0);
|
||||
INFO(SYSTEM_RDRamSize, Default_RdramSize, Data_DWORD, SettingLoc,"RDRAM Size","CPU",0);
|
||||
INFO(SYSTEM_BlockLinking, Default_BlockLinking, Data_DWORD, SettingLoc,"Advanced Block Linking","CPU",0);
|
||||
INFO(SYSTEM_SMM_Cache, Default_True, Data_DWORD, SettingLoc,"SMM-Cache","",0);
|
||||
INFO(SYSTEM_SMM_PIDMA, Default_True, Data_DWORD, SettingLoc,"SMM-DMA","",0);
|
||||
INFO(SYSTEM_SMM_TLB, Default_True, Data_DWORD, SettingLoc,"SMM-TLB","",0);
|
||||
INFO(SYSTEM_SMM_ValidFunc, Default_True, Data_DWORD, SettingLoc,"SMM-Validate","",0);
|
||||
INFO(SYSTEM_SMM_Protect, Default_False, Data_DWORD, SettingLoc,"SMM-Protect","",0);
|
||||
*/
|
||||
// Verifier
|
||||
/*
|
||||
//Currrent Running Information
|
||||
AddHandler(CPU_Paused, new CSettingTypeTempBool(false));
|
||||
AddHandler(CPU_Paused_type, new CSettingTypeTempNumber(Default_None));
|
||||
/* INFO(RamSize, Default_None, Data_DWORD, TemporarySetting,"","",0);
|
||||
INFO(CPUType, Default_None, Data_DWORD, TemporarySetting,"","",0);
|
||||
INFO(BlockLinking, Default_None, Data_DWORD, TemporarySetting,"","",0);
|
||||
INFO(DelayDlists, Default_None, Data_DWORD, TemporarySetting,"","",0);
|
||||
INFO(DelaySI, Default_None, Data_DWORD, TemporarySetting,"","",0);
|
||||
INFO(CounterFactor, Default_None, Data_DWORD, TemporarySetting,"","",0);
|
||||
INFO(UseJumpTable, Default_None, Data_DWORD, TemporarySetting,"","",0);
|
||||
INFO(RomInMemory, Default_None, Data_DWORD, TemporarySetting,"","",0);
|
||||
INFO(SyncViaAudio, Default_None, Data_DWORD, TemporarySetting,"","",0);
|
||||
INFO(UseTLB, Default_None, Data_DWORD, TemporarySetting,"","",0);
|
||||
INFO(AudioSignal, Default_None, Data_DWORD, TemporarySetting,"","",0);
|
||||
INFO(FuncLookupMode, Default_None, Data_DWORD, TemporarySetting,"","",0);
|
||||
INFO(ApplicationName, Default_None, Data_String, TemporarySetting,"","",0);
|
||||
INFO(SaveChipType, Default_None, Data_DWORD, TemporarySetting,"","",0);
|
||||
INFO(FirstDMA, Default_None, Data_DWORD, TemporarySetting,"","",0);
|
||||
INFO(ShowPifErrors, Default_True, Data_DWORD, TemporarySetting,"","",0);
|
||||
INFO(CurrentSaveState,Default_None, Data_DWORD, TemporarySetting,"","",0);
|
||||
INFO(InstantSaveFile, Default_None, Data_String, TemporarySetting,"","",0);
|
||||
*/
|
||||
/* AddHandler(CurrentSaveState, new CSettingTypeTempNumber(0));
|
||||
AddHandler(LoadingRom, new CSettingTypeTempBool(false));
|
||||
AddHandler(CPU_Running, new CSettingTypeTempBool(false));
|
||||
AddHandler(ScreenHertz, new CSettingTypeTempNumber(60));
|
||||
AddHandler(InFullScreen, new CSettingTypeTempBool(false));
|
||||
/* INFO(InFullScreen, Default_False, Data_DWORD, TemporarySetting,"","",0);
|
||||
INFO(SMM_Cache, Default_None, Data_DWORD, TemporarySetting,"","",0);
|
||||
INFO(SMM_PIDMA, Default_None, Data_DWORD, TemporarySetting,"","",0);
|
||||
INFO(SMM_TLB, Default_None, Data_DWORD, TemporarySetting,"","",0);
|
||||
INFO(SMM_Protect, Default_None, Data_DWORD, TemporarySetting,"","",0);
|
||||
INFO(SMM_ValidFunc, Default_None, Data_DWORD, TemporarySetting,"","",0);
|
||||
|
||||
#undef INFO
|
||||
*/
|
||||
#endif
|
||||
}
|
||||
|
||||
DWORD CSettings::FindGameSetting ( CSettings * _this, char * Name )
|
||||
|
@ -2027,24 +1705,48 @@ void CSettings::RegisterChangeCB(SettingID Type,void * Data, SettingChangedFunc
|
|||
|
||||
void CSettings::UnregisterChangeCB(SettingID Type,void * Data, SettingChangedFunc Func)
|
||||
{
|
||||
bool bRemoved = false;
|
||||
|
||||
//Find out the information for handling the setting type from the list
|
||||
/* SETTING_MAP::iterator FindInfo = SettingInfo.find(Type);
|
||||
if (FindInfo == SettingInfo.end())
|
||||
{ //if not found do nothing
|
||||
SETTING_CALLBACK::iterator Callback = m_Callback.find(Type);
|
||||
if (Callback != m_Callback.end())
|
||||
{
|
||||
SETTING_CHANGED_CB * PrevItem = NULL;
|
||||
SETTING_CHANGED_CB * item = Callback->second;
|
||||
|
||||
while (item)
|
||||
{
|
||||
if (Callback->first == Type && item->Data == Data && item->Func == Func)
|
||||
{
|
||||
bRemoved = true;
|
||||
if (PrevItem == NULL)
|
||||
{
|
||||
if (item->Next)
|
||||
{
|
||||
SettingID Type = Callback->first;
|
||||
_SETTING_CHANGED_CB * Next = item->Next;
|
||||
m_Callback.erase(Callback);
|
||||
m_Callback.insert(SETTING_CALLBACK::value_type(Type,Next));
|
||||
} else {
|
||||
m_Callback.erase(Callback);
|
||||
}
|
||||
} else {
|
||||
PrevItem->Next = item->Next;
|
||||
}
|
||||
delete item;
|
||||
item = NULL;
|
||||
break;
|
||||
}
|
||||
PrevItem = item;
|
||||
item = item->Next;
|
||||
}
|
||||
} else {
|
||||
UnknownSetting(Type);
|
||||
return;
|
||||
}
|
||||
CSettingInfo * Info = &FindInfo->second;
|
||||
if (Info->DataType == Data_DWORD)
|
||||
|
||||
if (!bRemoved)
|
||||
{
|
||||
for (SETTING_CHANGED_CB_LIST::iterator iter = m_CBDwordList.begin(); iter != m_CBDwordList.end(); iter ++)
|
||||
{
|
||||
SETTING_CHANGED_CB & item = *iter;
|
||||
if (item.Type != Type) { continue; }
|
||||
if (item.Data != Data) { continue; }
|
||||
if (item.Func != Func) { continue; }
|
||||
m_CBDwordList.erase(iter);
|
||||
break;
|
||||
_Notify->BreakPoint(__FILE__,__LINE__);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
|
|
@ -1,20 +1,4 @@
|
|||
#include "stdafx.h"
|
||||
/*
|
||||
#include "..\\User Interface.h"
|
||||
#include "..\\N64 System.h"
|
||||
#include "..\\Plugin.h"
|
||||
#include "..\\Validate Binary.h"
|
||||
#include <common/CriticalSection.h>
|
||||
|
||||
#include <vector>
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
*/
|
||||
|
||||
// c functions for old debugger
|
||||
#ifdef toremove
|
||||
extern CSettings * g_Settings;
|
||||
#endif
|
||||
|
||||
extern "C" {
|
||||
void EnterLogOptions(HWND hwndOwner);
|
||||
|
@ -668,7 +652,7 @@ DWORD CALLBACK CMainGui::MainGui_Proc (WND_HANDLE hWnd, DWORD uMsg, DWORD wParam
|
|||
{
|
||||
if (_N64System)
|
||||
{
|
||||
_N64System->ExternalEvent( ResumeCPU_AppGainedFocus );
|
||||
_N64System->ExternalEvent( SysEvent_ResumeCPU_AppGainedFocus );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -685,7 +669,7 @@ DWORD CALLBACK CMainGui::MainGui_Proc (WND_HANDLE hWnd, DWORD uMsg, DWORD wParam
|
|||
{
|
||||
if (_N64System)
|
||||
{
|
||||
_N64System->ExternalEvent( PauseCPU_AppLostFocus );
|
||||
_N64System->ExternalEvent( SysEvent_PauseCPU_AppLostFocus );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -713,7 +697,7 @@ DWORD CALLBACK CMainGui::MainGui_Proc (WND_HANDLE hWnd, DWORD uMsg, DWORD wParam
|
|||
{
|
||||
if (_N64System)
|
||||
{
|
||||
_N64System->ExternalEvent(fActive ? ResumeCPU_AppGainedActive : PauseCPU_AppLostActive );
|
||||
_N64System->ExternalEvent(fActive ? SysEvent_ResumeCPU_AppGainedActive : SysEvent_PauseCPU_AppLostActive );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -99,20 +99,20 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD FromAccelerator, DWORD Men
|
|||
case ID_FILE_EXIT: DestroyWindow((HWND)hWnd); break;
|
||||
case ID_SYSTEM_RESET_SOFT:
|
||||
WriteTrace(TraceDebug,"ID_SYSTEM_RESET_SOFT");
|
||||
_N64System->ExternalEvent(ResetCPU_Soft);
|
||||
_N64System->ExternalEvent(SysEvent_ResetCPU_Soft);
|
||||
break;
|
||||
case ID_SYSTEM_RESET_HARD:
|
||||
WriteTrace(TraceDebug,"ID_SYSTEM_RESET_HARD");
|
||||
_N64System->ExternalEvent(ResetCPU_Hard);
|
||||
_N64System->ExternalEvent(SysEvent_ResetCPU_Hard);
|
||||
break;
|
||||
case ID_SYSTEM_PAUSE:
|
||||
_Gui->SaveWindowLoc();
|
||||
WriteTrace(TraceDebug,"ID_SYSTEM_PAUSE");
|
||||
if (_Settings->LoadBool(GameRunning_CPU_Paused))
|
||||
{
|
||||
_N64System->ExternalEvent(ResumeCPU_FromMenu);
|
||||
_N64System->ExternalEvent(SysEvent_ResumeCPU_FromMenu);
|
||||
} else {
|
||||
_N64System->ExternalEvent(PauseCPU_FromMenu);
|
||||
_N64System->ExternalEvent(SysEvent_PauseCPU_FromMenu);
|
||||
}
|
||||
WriteTrace(TraceDebug,"ID_SYSTEM_PAUSE 1");
|
||||
break;
|
||||
|
@ -129,7 +129,7 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD FromAccelerator, DWORD Men
|
|||
_Settings->SaveBool(GameRunning_LimitFPS,!_Settings->LoadBool(GameRunning_LimitFPS));
|
||||
WriteTrace(TraceDebug,"ID_SYSTEM_LIMITFPS 1");
|
||||
break;
|
||||
case ID_SYSTEM_SAVE: WriteTrace(TraceDebug,"ID_SYSTEM_SAVE"); _N64System->ExternalEvent(SaveMachineState); break;
|
||||
case ID_SYSTEM_SAVE: WriteTrace(TraceDebug,"ID_SYSTEM_SAVE"); _N64System->ExternalEvent(SysEvent_SaveMachineState); break;
|
||||
case ID_SYSTEM_SAVEAS:
|
||||
{
|
||||
char drive[_MAX_DRIVE] ,dir[_MAX_DIR], fname[_MAX_FNAME],ext[_MAX_EXT];
|
||||
|
@ -149,7 +149,7 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD FromAccelerator, DWORD Men
|
|||
openfilename.nMaxFile = MAX_PATH;
|
||||
openfilename.Flags = OFN_HIDEREADONLY;
|
||||
|
||||
_N64System->ExternalEvent(PauseCPU_SaveGame);
|
||||
_N64System->ExternalEvent(SysEvent_PauseCPU_SaveGame);
|
||||
|
||||
if (GetSaveFileName (&openfilename))
|
||||
{
|
||||
|
@ -169,13 +169,13 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD FromAccelerator, DWORD Men
|
|||
_makepath( SaveDir, drive, dir, NULL, NULL );
|
||||
_Settings->SaveString(Directory_LastSave,SaveDir);
|
||||
|
||||
_N64System->ExternalEvent(SaveMachineState);
|
||||
_N64System->ExternalEvent(SysEvent_SaveMachineState);
|
||||
}
|
||||
|
||||
_N64System->ExternalEvent(ResumeCPU_SaveGame);
|
||||
_N64System->ExternalEvent(SysEvent_ResumeCPU_SaveGame);
|
||||
}
|
||||
break;
|
||||
case ID_SYSTEM_RESTORE: WriteTrace(TraceDebug,"ID_SYSTEM_RESTORE"); _N64System->ExternalEvent(LoadMachineState); break;
|
||||
case ID_SYSTEM_RESTORE: WriteTrace(TraceDebug,"ID_SYSTEM_RESTORE"); _N64System->ExternalEvent(SysEvent_LoadMachineState); break;
|
||||
case ID_SYSTEM_LOAD:
|
||||
{
|
||||
char Directory[255], SaveFile[255];
|
||||
|
@ -194,7 +194,7 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD FromAccelerator, DWORD Men
|
|||
openfilename.nMaxFile = MAX_PATH;
|
||||
openfilename.Flags = OFN_HIDEREADONLY;
|
||||
|
||||
_N64System->ExternalEvent(PauseCPU_LoadGame);
|
||||
_N64System->ExternalEvent(SysEvent_PauseCPU_LoadGame);
|
||||
|
||||
if (GetOpenFileName (&openfilename)) {
|
||||
_Settings->SaveString(GameRunning_InstantSaveFile,SaveFile);
|
||||
|
@ -204,9 +204,9 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD FromAccelerator, DWORD Men
|
|||
_makepath( SaveDir, drive, dir, NULL, NULL );
|
||||
_Settings->SaveString(Directory_LastSave,SaveDir);
|
||||
|
||||
_N64System->ExternalEvent(LoadMachineState);
|
||||
_N64System->ExternalEvent(SysEvent_LoadMachineState);
|
||||
}
|
||||
_N64System->ExternalEvent(ResumeCPU_LoadGame);
|
||||
_N64System->ExternalEvent(SysEvent_ResumeCPU_LoadGame);
|
||||
}
|
||||
break;
|
||||
case ID_SYSTEM_CHEAT:
|
||||
|
@ -215,7 +215,7 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD FromAccelerator, DWORD Men
|
|||
}
|
||||
break;
|
||||
case ID_SYSTEM_GSBUTTON:
|
||||
_N64System->ExternalEvent(GSButtonPressed);
|
||||
_N64System->ExternalEvent(SysEvent_GSButtonPressed);
|
||||
break;
|
||||
case ID_OPTIONS_DISPLAY_FR:
|
||||
_Settings->SaveBool(UserInterface_DisplayFrameRate,!_Settings->LoadBool(UserInterface_DisplayFrameRate));
|
||||
|
@ -240,7 +240,7 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD FromAccelerator, DWORD Men
|
|||
_N64System->DecreaeSpeed();
|
||||
break;
|
||||
case ID_OPTIONS_FULLSCREEN:
|
||||
_N64System->ExternalEvent(ChangingFullScreen);
|
||||
_N64System->ExternalEvent(SysEvent_ChangingFullScreen);
|
||||
break;
|
||||
case ID_OPTIONS_FULLSCREEN2:
|
||||
if (_Settings->LoadBool(UserInterface_InFullScreen))
|
||||
|
@ -305,7 +305,7 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD FromAccelerator, DWORD Men
|
|||
} else {
|
||||
_Settings->SaveBool(UserInterface_ShowCPUPer,true);
|
||||
}
|
||||
_N64System->ExternalEvent(CPUUsageTimerChanged);
|
||||
_N64System->ExternalEvent(SysEvent_CPUUsageTimerChanged);
|
||||
break;
|
||||
case ID_OPTIONS_SETTINGS:
|
||||
{
|
||||
|
@ -315,10 +315,10 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD FromAccelerator, DWORD Men
|
|||
break;
|
||||
case ID_PROFILE_PROFILE:
|
||||
_Settings->SaveBool(Debugger_ProfileCode,!_Settings->LoadBool(Debugger_ProfileCode));
|
||||
_N64System->ExternalEvent(Profile_StartStop);
|
||||
_N64System->ExternalEvent(SysEvent_Profile_StartStop);
|
||||
break;
|
||||
case ID_PROFILE_RESETCOUNTER: _N64System->ExternalEvent(Profile_ResetLogs); break;
|
||||
case ID_PROFILE_GENERATELOG: _N64System->ExternalEvent(Profile_GenerateLogs); break;
|
||||
case ID_PROFILE_RESETCOUNTER: _N64System->ExternalEvent(SysEvent_Profile_ResetLogs); break;
|
||||
case ID_PROFILE_GENERATELOG: _N64System->ExternalEvent(SysEvent_Profile_GenerateLogs); break;
|
||||
case ID_DEBUG_SHOW_UNHANDLED_MEM:
|
||||
_Settings->SaveBool(Debugger_ShowUnhandledMemory,!_Settings->LoadBool(Debugger_ShowUnhandledMemory));
|
||||
break;
|
||||
|
@ -445,12 +445,12 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD FromAccelerator, DWORD Men
|
|||
case ID_DEBUGGER_SEARCHMEMORY: _N64System->Debug_ShowMemorySearch(); break;
|
||||
case ID_DEBUGGER_MEMORY: _N64System->Debug_ShowMemoryWindow(); break;
|
||||
case ID_DEBUGGER_TLBENTRIES: _N64System->Debug_ShowTLBWindow(); break;
|
||||
case ID_DEBUGGER_INTERRUPT_SP: _N64System->ExternalEvent(Interrupt_SP); break;
|
||||
case ID_DEBUGGER_INTERRUPT_SI: _N64System->ExternalEvent(Interrupt_SI); break;
|
||||
case ID_DEBUGGER_INTERRUPT_AI: _N64System->ExternalEvent(Interrupt_AI); break;
|
||||
case ID_DEBUGGER_INTERRUPT_VI: _N64System->ExternalEvent(Interrupt_VI); break;
|
||||
case ID_DEBUGGER_INTERRUPT_PI: _N64System->ExternalEvent(Interrupt_PI); break;
|
||||
case ID_DEBUGGER_INTERRUPT_DP: _N64System->ExternalEvent(Interrupt_DP); break;
|
||||
case ID_DEBUGGER_INTERRUPT_SP: _N64System->ExternalEvent(SysEvent_Interrupt_SP); break;
|
||||
case ID_DEBUGGER_INTERRUPT_SI: _N64System->ExternalEvent(SysEvent_Interrupt_SI); break;
|
||||
case ID_DEBUGGER_INTERRUPT_AI: _N64System->ExternalEvent(SysEvent_Interrupt_AI); break;
|
||||
case ID_DEBUGGER_INTERRUPT_VI: _N64System->ExternalEvent(SysEvent_Interrupt_VI); break;
|
||||
case ID_DEBUGGER_INTERRUPT_PI: _N64System->ExternalEvent(SysEvent_Interrupt_PI); break;
|
||||
case ID_DEBUGGER_INTERRUPT_DP: _N64System->ExternalEvent(SysEvent_Interrupt_DP); break;
|
||||
case ID_CURRENT_SAVE_DEFAULT:
|
||||
Notify().DisplayMessage(3,"Save Slot (%s) selected",GetSaveSlotString(MenuID - ID_CURRENT_SAVE_DEFAULT).c_str());
|
||||
_Settings->SaveDword(Game_CurrentSaveState,(DWORD)(MenuID - ID_CURRENT_SAVE_DEFAULT));
|
||||
|
|
|
@ -279,5 +279,6 @@ bool CNotification::ProcessGuiMessages ( void ) const
|
|||
void CNotification::BreakPoint ( const char * File, const int LineNumber ) {
|
||||
DisplayError("Break point found at\n%s\n%d",File, LineNumber);
|
||||
|
||||
|
||||
_asm int 3
|
||||
}
|
|
@ -131,6 +131,8 @@ void FixUPXIssue ( BYTE * ProgramLocation )
|
|||
}*/
|
||||
}
|
||||
|
||||
CTraceFileLog * LogFile = NULL;
|
||||
|
||||
void LogLevelChanged (CTraceFileLog * LogFile)
|
||||
{
|
||||
LogFile->SetTraceLevel((TraceLevel)_Settings->LoadDword(Debugger_AppLogLevel));
|
||||
|
@ -144,7 +146,6 @@ void LogFlushChanged (CTraceFileLog * LogFile)
|
|||
|
||||
void InitializeLog ( void)
|
||||
{
|
||||
|
||||
CPath LogFilePath(CPath::MODULE_DIRECTORY);
|
||||
LogFilePath.AppendDirectory("Logs");
|
||||
if (!LogFilePath.DirectoryExists())
|
||||
|
@ -153,7 +154,7 @@ void InitializeLog ( void)
|
|||
}
|
||||
LogFilePath.SetNameExtension(_T("Project64.log"));
|
||||
|
||||
CTraceFileLog * LogFile = new CTraceFileLog(LogFilePath, _Settings->LoadDword(Debugger_AppLogFlush) != 0, Log_New,500);
|
||||
LogFile = new CTraceFileLog(LogFilePath, _Settings->LoadDword(Debugger_AppLogFlush) != 0, Log_New,500);
|
||||
#ifdef VALIDATE_DEBUG
|
||||
LogFile->SetTraceLevel((TraceLevel)(_Settings->LoadDword(Debugger_AppLogLevel) | TraceValidate));
|
||||
#else
|
||||
|
@ -165,6 +166,7 @@ void InitializeLog ( void)
|
|||
_Settings->RegisterChangeCB(Debugger_AppLogFlush,LogFile,(CSettings::SettingChangedFunc)LogFlushChanged);
|
||||
}
|
||||
|
||||
|
||||
/*bool ChangeDirPermission ( const CPath & Dir)
|
||||
{
|
||||
if (Dir.DirectoryExists())
|
||||
|
@ -317,10 +319,14 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszArgs,
|
|||
|
||||
if (_N64System)
|
||||
{
|
||||
_N64System->CloseCpu();
|
||||
delete _N64System;
|
||||
_N64System = NULL;
|
||||
}
|
||||
WriteTrace(TraceDebug,"WinMain - System Closed");
|
||||
|
||||
_Settings->UnregisterChangeCB(Debugger_AppLogLevel,LogFile,(CSettings::SettingChangedFunc)LogLevelChanged);
|
||||
_Settings->UnregisterChangeCB(Debugger_AppLogFlush,LogFile,(CSettings::SettingChangedFunc)LogFlushChanged);
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
#pragma warning(disable:4247)
|
||||
#pragma warning(disable:4786)
|
||||
|
||||
#include "Multilanguage.h"
|
||||
#include "User Interface.h"
|
||||
#include "N64 System.h"
|
||||
|
|
Loading…
Reference in New Issue