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

This commit is contained in:
zilmar 2009-12-28 22:22:50 +00:00
parent e1f5d9a555
commit 3e0e336a52
27 changed files with 1506 additions and 1127 deletions

Binary file not shown.

View File

@ -6024,6 +6024,9 @@ Cheat18="Have Bonus Mode and All Gold Cups",50000401 0000,1018ED10 00??
Cheat18_O=$5A Off,$4F On
Cheat17="Press F9\For Full Debug Menu",8818EDEF 0002
Cheat17_N=Press F9 at the Press Start Menu to access the Debug Menu
Cheat6_N=
Cheat6_O=
Cheat18_N=abc
//----

View File

@ -0,0 +1,181 @@
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

View File

@ -10416,9 +10416,7 @@ SMM-FUNC=0
Good Name=Perfect Dark (U) (V1.0)
Internal Name=Perfect Dark
RDRAM Size=8
Counter Factor=2
Save Type=16kbit Eeprom
CPU Type=Recompiler
Self-modifying code Method=Protected Memory
Status=Compatible
Core Note=high system requirement
@ -10435,8 +10433,8 @@ FuncFind=2
CustomSMM=1
SMM-Cache=0
SMM-PI DMA=0
SMM-TLB=0
SMM-FUNC=0
SMM-TLB=0
[41F2B98F-B458B466-C:45]
Good Name=Perfect Dark (U) (V1.1)
@ -13681,20 +13679,10 @@ Core Note=
[635A2BFF-8B022326-C:45]
Good Name=Super Mario 64 (U)
Internal Name=SUPER MARIO 64
RDRAM Size=4
Counter Factor=2
Save Type=First Save Type
CPU Type=Recompiler
Self-modifying code Method=Cache
Use TLB=Yes
Linking=Global
Reg Cache=Yes
Reg Cache=No
Use Large Buffer=No
Delay SI=No
SP Hack=No
Status=Compatible
Plugin Note=[video] missing:dissolve effect (see GameFAQ)
Core Note=
Clear Frame=0
Self Texture=0
Primary Frame Buffer=0
@ -13703,10 +13691,9 @@ Primary Frame Buffer=0
Culling=1
Emulate Clear=0
MD5=49FBF9C744C458405F685D42B762A0BE
Resolution Width=0
Resolution Height=0
ClearvFrame=0
Aspect Correction=0
Core Note=
Plugin Note=
Status=Compatible
[D6FBA4A8-6326AA2C-C:4A]
Good Name=Super Mario 64 Shindou Edition (J)

View File

@ -13685,14 +13685,10 @@ Primary Frame Buffer=0
Culling=1
Emulate Clear=0
MD5=49FBF9C744C458405F685D42B762A0BE
ClearvFrame=0
Aspect Correction=0
CustomSMM=1
SMM-PI DMA=0
SMM-TLB=0
SMM-FUNC=0
Resolution Width=0
Resolution Height=0
[D6FBA4A8-6326AA2C-C:4A]
Good Name=Super Mario 64 Shindou Edition (J)

View File

@ -3,14 +3,84 @@
<pre>
<h1>Build Log</h1>
<h3>
--------------------Configuration: Common - Win32 Release--------------------
--------------------Configuration: Common - Win32 Debug--------------------
</h3>
<h3>Command Lines</h3>
Creating temporary file "C:\DOCUME~1\NICHOL~1\LOCALS~1\Temp\RSP43E.tmp" with contents
[
/nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /Fp"../../Build/Common/Debug/Common.pch" /Yu"stdafx.h" /Fo"../../Build/Common/Debug/" /Fd"../../Build/Common/Debug/" /FD /GZ /c
"D:\My Programs\Emulation\Project64\SOURCE\Common\File Class.cpp"
"D:\My Programs\Emulation\Project64\SOURCE\Common\Log Class.cpp"
"D:\My Programs\Emulation\Project64\SOURCE\Common\md5.cpp"
"D:\My Programs\Emulation\Project64\SOURCE\Common\MemTest.cpp"
"D:\My Programs\Emulation\Project64\SOURCE\Common\osversion.cpp"
"D:\My Programs\Emulation\Project64\SOURCE\Common\path.cpp"
"D:\My Programs\Emulation\Project64\SOURCE\Common\registry.cpp"
"D:\My Programs\Emulation\Project64\SOURCE\Common\std string.cpp"
"D:\My Programs\Emulation\Project64\SOURCE\Common\Trace.cpp"
"D:\My Programs\Emulation\Project64\SOURCE\Common\Version.cpp"
"D:\My Programs\Emulation\Project64\Source\Common\Ini File Class.cpp"
]
Creating command line "cl.exe @C:\DOCUME~1\NICHOL~1\LOCALS~1\Temp\RSP43E.tmp"
Creating temporary file "C:\DOCUME~1\NICHOL~1\LOCALS~1\Temp\RSP43F.tmp" with contents
[
/nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /Fp"../../Build/Common/Debug/Common.pch" /Yc"stdafx.h" /Fo"../../Build/Common/Debug/" /Fd"../../Build/Common/Debug/" /FD /GZ /c
"D:\My Programs\Emulation\Project64\SOURCE\Common\stdafx.cpp"
]
Creating command line "cl.exe @C:\DOCUME~1\NICHOL~1\LOCALS~1\Temp\RSP43F.tmp"
Creating temporary file "C:\DOCUME~1\NICHOL~1\LOCALS~1\Temp\RSP440.tmp" with contents
[
/nologo /out:"../../Bin/Debug\Common.lib"
"\My Programs\Emulation\Project64\Build\Common\Debug\File Class.obj"
"\My Programs\Emulation\Project64\Build\Common\Debug\Log Class.obj"
"\My Programs\Emulation\Project64\Build\Common\Debug\md5.obj"
"\My Programs\Emulation\Project64\Build\Common\Debug\MemTest.obj"
"\My Programs\Emulation\Project64\Build\Common\Debug\osversion.obj"
"\My Programs\Emulation\Project64\Build\Common\Debug\path.obj"
"\My Programs\Emulation\Project64\Build\Common\Debug\registry.obj"
"\My Programs\Emulation\Project64\Build\Common\Debug\std string.obj"
"\My Programs\Emulation\Project64\Build\Common\Debug\stdafx.obj"
"\My Programs\Emulation\Project64\Build\Common\Debug\Trace.obj"
"\My Programs\Emulation\Project64\Build\Common\Debug\Version.obj"
"\My Programs\Emulation\Project64\Build\Common\Debug\Ini File Class.obj"
]
Creating command line "link.exe -lib @C:\DOCUME~1\NICHOL~1\LOCALS~1\Temp\RSP440.tmp"
<h3>Output Window</h3>
Compiling...
stdafx.cpp
warning C4786: 'std::binary_function<std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,bool>' : identifier was truncated to '255' characters in the debug information
warning C4786: 'std::_Tree<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::map<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >::_Kfn,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >' : identifier was truncated to '255' characters in the debug information
warning C4786: 'std::_Tree<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::map<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >::_Kfn,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >::const_iterator' : identifier was truncated to '255' characters in the debug information
warning C4786: 'std::_Tree<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::map<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >::_Kfn,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >::iterator' : identifier was truncated to '255' characters in the debug information
warning C4786: 'std::_Tree<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::map<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >::_Kfn,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >::_Node' : identifier was truncated to '255' characters in the debug information
warning C4786: 'std::_Tree<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::map<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >::_Kfn,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >::_Redbl' : identifier was truncated to '255' characters in the debug information
warning C4786: 'std::_Tree<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,long>,std::map<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,long,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<long> >::_Kfn,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<long> >' : identifier was truncated to '255' characters in the debug information
warning C4786: 'std::_Tree<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,long>,std::map<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,long,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<long> >::_Kfn,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<long> >::const_iterator' : identifier was truncated to '255' characters in the debug information
warning C4786: 'std::_Tree<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,long>,std::map<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,long,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<long> >::_Kfn,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<long> >::iterator' : identifier was truncated to '255' characters in the debug information
warning C4786: 'std::_Tree<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,long>,std::map<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,long,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<long> >::_Kfn,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<long> >::_Node' : identifier was truncated to '255' characters in the debug information
warning C4786: 'std::_Tree<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,long>,std::map<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,long,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<long> >::_Kfn,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<long> >::_Redbl' : identifier was truncated to '255' characters in the debug information
warning C4786: 'std::map<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >' : identifier was truncated to '255' characters in the debug information
warning C4786: 'std::map<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >::value_compare' : identifier was truncated to '255' characters in the debug information
warning C4786: 'std::map<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >::_Kfn' : identifier was truncated to '255' characters in the debug information
Compiling...
File Class.cpp
Log Class.cpp
md5.cpp
MemTest.cpp
osversion.cpp
path.cpp
registry.cpp
std string.cpp
Trace.cpp
Version.cpp
Ini File Class.cpp
Generating Code...
Creating library...
<h3>Results</h3>
Common.lib - 0 error(s), 0 warning(s)
Common.lib - 0 error(s), 14 warning(s)
</pre>
</body>
</html>

View File

@ -100,6 +100,6 @@ public:
private:
CriticalSection& cs;
CGuard(const CGuard& copy);
operator=(const CGuard& rhs);
CGuard &operator=(const CGuard& rhs);
};

View File

@ -33,7 +33,7 @@ CFile::CFile(LPCTSTR lpszFileName, DWORD nOpenFlags) :
Open(lpszFileName, nOpenFlags);
}
bool CFile::Open(LPCTSTR lpszFileName, DWORD nOpenFlags)
bool CFile::Open(LPCTSTR lpszFileName, ULONG nOpenFlags)
{
if (!Close())
{
@ -48,7 +48,7 @@ bool CFile::Open(LPCTSTR lpszFileName, DWORD nOpenFlags)
m_bCloseOnDelete = true;
m_hFile = INVALID_HANDLE_VALUE;
DWORD dwAccess = 0;
ULONG dwAccess = 0;
switch (nOpenFlags & 3)
{
case modeRead:
@ -68,9 +68,11 @@ bool CFile::Open(LPCTSTR lpszFileName, DWORD nOpenFlags)
WORD ostype = osver.GetOSType();
BOOL is_NT =((ostype & OS_WINNT) != 0);
// map share mode
DWORD dwShareMode = FILE_SHARE_WRITE|FILE_SHARE_READ;
if (is_NT) { dwShareMode |= FILE_SHARE_DELETE; }
ULONG dwShareMode = 0;
dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE;
if ((nOpenFlags & shareDenyWrite) == shareDenyWrite) { dwShareMode &= ~FILE_SHARE_WRITE; }
if ((nOpenFlags & shareDenyRead) == shareDenyRead) { dwShareMode &= ~FILE_SHARE_READ; }
if ((nOpenFlags & shareExclusive) == shareExclusive) { dwShareMode = 0; }
@ -82,7 +84,7 @@ bool CFile::Open(LPCTSTR lpszFileName, DWORD nOpenFlags)
sa.bInheritHandle = (nOpenFlags & modeNoInherit) == 0;
// map creation flags
DWORD dwCreateFlag = 0;
ULONG dwCreateFlag = 0;
if (nOpenFlags & modeCreate)
{
if (nOpenFlags & modeNoTruncate)
@ -98,7 +100,7 @@ bool CFile::Open(LPCTSTR lpszFileName, DWORD nOpenFlags)
dwCreateFlag, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile == INVALID_HANDLE_VALUE)
{ //#define ERROR_PATH_NOT_FOUND 3L
DWORD err = GetLastError();
//ULONG err = GetLastError();
return false;
}
m_hFile = hFile;
@ -119,7 +121,7 @@ bool CFile::Close()
return bError;
}
DWORD CFile::SeekToEnd ( void )
ULONG CFile::SeekToEnd ( void )
{
return Seek(0, CFile::end);
}
@ -144,14 +146,14 @@ bool CFile::Flush()
return ::FlushFileBuffers(m_hFile) != 0;
}
bool CFile::Write(const void* lpBuf, DWORD nCount)
bool CFile::Write(const void* lpBuf, ULONG nCount)
{
if (nCount == 0)
{
return true; // avoid Win32 "null-write" option
}
DWORD nWritten = 0;
ULONG nWritten = 0;
if (!::WriteFile(m_hFile, lpBuf, nCount, &nWritten, NULL))
{
return false;
@ -165,14 +167,14 @@ bool CFile::Write(const void* lpBuf, DWORD nCount)
return true;
}
DWORD CFile::Read(void* lpBuf, DWORD nCount)
ULONG CFile::Read(void* lpBuf, ULONG nCount)
{
if (nCount == 0)
{
return 0; // avoid Win32 "null-read"
}
DWORD dwRead = 0;
ULONG dwRead = 0;
if (!::ReadFile(m_hFile, lpBuf, nCount, &dwRead, NULL))
{
return 0;
@ -182,8 +184,8 @@ DWORD CFile::Read(void* lpBuf, DWORD nCount)
long CFile::Seek(long lOff, SeekPosition nFrom)
{
DWORD dwNew = ::SetFilePointer(m_hFile, lOff, NULL, (DWORD)nFrom);
if (dwNew == (DWORD)-1)
ULONG dwNew = ::SetFilePointer(m_hFile, lOff, NULL, (ULONG)nFrom);
if (dwNew == (ULONG)-1)
{
return -1;
}
@ -191,19 +193,19 @@ long CFile::Seek(long lOff, SeekPosition nFrom)
return dwNew;
}
DWORD CFile::GetPosition() const
ULONG CFile::GetPosition() const
{
return ::SetFilePointer(m_hFile, 0, NULL, FILE_CURRENT);
}
bool CFile::SetLength(DWORD dwNewLen)
bool CFile::SetLength(ULONG dwNewLen)
{
Seek((LONG)dwNewLen, begin);
return ::SetEndOfFile(m_hFile) != 0;
}
DWORD CFile::GetLength() const
ULONG CFile::GetLength() const
{
return GetFileSize(m_hFile,0);
}
@ -212,3 +214,4 @@ bool CFile::SetEndOfFile()
{
return ::SetEndOfFile(m_hFile) != 0;
}

View File

@ -1,15 +1,9 @@
#ifndef __FILE_CLASS__H__
#define __FILE_CLASS__H__
class CFile
class CFileBase
{
// Attributes
HANDLE m_hFile;
bool m_bCloseOnDelete;
public:
// Flag values
enum OpenFlags {
modeRead = 0x0000,
modeWrite = 0x0001,
@ -36,29 +30,56 @@ public:
enum SeekPosition { begin = 0x0, current = 0x1, end = 0x2 };
virtual bool Open(LPCTSTR lpszFileName, ULONG nOpenFlags ) = 0;
virtual ULONG GetPosition() const = 0;
virtual long Seek(long lOff, SeekPosition nFrom) = 0;
virtual bool SetLength(ULONG dwNewLen) = 0;
virtual ULONG GetLength() const = 0;
virtual ULONG Read(void* lpBuf, ULONG nCount) = 0;
virtual bool Write(const void* lpBuf, ULONG nCount) = 0;
virtual bool Flush() = 0;
virtual bool Close() = 0;
virtual bool IsOpen() const = 0;
virtual bool SetEndOfFile() = 0;
};
class CFile : public CFileBase
{
// Attributes
HANDLE m_hFile;
bool m_bCloseOnDelete;
public:
// Flag values
// Constructors
CFile();
CFile(HANDLE hFile);
CFile(LPCTSTR lpszFileName, DWORD nOpenFlags);
CFile(LPCTSTR lpszFileName, ULONG nOpenFlags);
// Deconstructors
virtual ~CFile();
// Operations
virtual bool Open(LPCTSTR lpszFileName, DWORD nOpenFlags );
virtual bool Open(LPCTSTR lpszFileName, ULONG nOpenFlags );
DWORD SeekToEnd ( void );
ULONG SeekToEnd ( void );
void SeekToBegin ( void );
// Overridables
virtual DWORD GetPosition() const;
virtual ULONG GetPosition() const;
virtual long Seek(long lOff, SeekPosition nFrom);
virtual bool SetLength(DWORD dwNewLen);
virtual DWORD GetLength() const;
virtual bool SetLength(ULONG dwNewLen);
virtual ULONG GetLength() const;
virtual DWORD Read(void* lpBuf, DWORD nCount);
virtual bool Write(const void* lpBuf, DWORD nCount);
virtual ULONG Read(void* lpBuf, ULONG nCount);
virtual bool Write(const void* lpBuf, ULONG nCount);
virtual bool Flush();
virtual bool Close();

View File

@ -0,0 +1,816 @@
#include "stdafx.h"
CIniFileBase::CIniFileBase(CFileBase & FileObject, LPCTSTR FileName) :
m_lastSectionSearch(0),
m_CurrentSectionFilePos(0),
m_LineFeed("\r\n"),
m_ReadOnly(true),
m_InstantFlush(false),
m_File(FileObject),
m_FileName(FileName),
m_CurrentSectionDirty(false)
{
}
CIniFileBase::~CIniFileBase(void)
{
SaveCurrentSection();
}
void CIniFileBase::fInsertSpaces ( int Pos, int NoOfSpaces )
{
enum { fIS_MvSize = 0x2000 };
unsigned char Data[fIS_MvSize + 1];
int SizeToRead, result;
long end, WritePos;
m_File.Seek(0,CFileBase::end);
end = m_File.GetPosition();
if (NoOfSpaces > 0) {
stdstr_f SpaceBuffer(_T("%*c"),NoOfSpaces,' ');
do {
SizeToRead = end - Pos;
if (SizeToRead > fIS_MvSize) { SizeToRead = fIS_MvSize; }
if (SizeToRead > 0) {
m_File.Seek(SizeToRead * -1,CFileBase::current);
WritePos = m_File.GetPosition();
memset(Data,0,sizeof(Data));
result = m_File.Read(Data,SizeToRead);
m_File.Seek(WritePos,CFileBase::begin);
end = WritePos;
m_File.Write(SpaceBuffer.c_str(),(ULONG)SpaceBuffer.length());
m_File.Write(Data,result);
m_File.Seek(WritePos,CFileBase::begin);
}
} while (SizeToRead > 0);
} if (NoOfSpaces < 0) {
int ReadPos = Pos + (NoOfSpaces * -1);
int WritePos = Pos;
do {
SizeToRead = end - ReadPos;
if (SizeToRead > fIS_MvSize) { SizeToRead = fIS_MvSize; }
m_File.Seek(ReadPos,CFileBase::begin);
m_File.Read(Data,SizeToRead);
m_File.Seek(WritePos,CFileBase::begin);
m_File.Write(Data,SizeToRead);
ReadPos += SizeToRead;
WritePos += SizeToRead;
} while (SizeToRead > 0);
m_File.Seek(WritePos,CFileBase::begin);
stdstr_f SpaceBuffer(_T("%*c"),(NoOfSpaces * -1),' ');
m_File.Write(SpaceBuffer.c_str(),(ULONG)SpaceBuffer.length());
m_File.Seek(WritePos,CFileBase::begin);
m_File.SetEndOfFile();
m_File.Seek(0,CFileBase::begin);
}
}
int CIniFileBase::GetStringFromFile ( char * & String, char * &Data, int & MaxDataSize, int & DataSize, int & ReadPos )
{
enum { BufferIncrease = 0x2000 };
if (MaxDataSize == 0)
{
ReadPos = 0;
MaxDataSize = BufferIncrease;
Data = new char[MaxDataSize];
DataSize = m_File.Read(&Data[DataSize],MaxDataSize);
}
for (;;) {
int count;
for (count = ReadPos; count < DataSize; count ++) {
if (Data[count] == '\n')
{
int len = (count - ReadPos) + 1;
String = &Data[ReadPos];
String[len-1] = 0;
ReadPos = count + 1;
return len;
}
}
if (ReadPos != 0)
{
if ((DataSize - ReadPos) > 0 )
{
memmove(Data,&Data[ReadPos],DataSize - ReadPos);
}
DataSize -= ReadPos;
ReadPos = 0;
} else {
//Increase buffer size
int NewMaxDataSize = MaxDataSize + BufferIncrease;
char * NewBuffer = new char[NewMaxDataSize];
if (NewBuffer == NULL)
{
return -1;
}
memcpy(NewBuffer,Data,DataSize);
MaxDataSize = NewMaxDataSize;
delete [] Data;
Data = NewBuffer;
}
int dwRead = m_File.Read(&Data[DataSize],MaxDataSize - DataSize);
if (dwRead == 0)
{
return -1;
}
DataSize += dwRead;
}
return 0;
}
void CIniFileBase::SaveCurrentSection ( void )
{
if (!m_CurrentSectionDirty)
{
return;
}
m_CurrentSectionDirty = false;
if (m_CurrentSection.length() == 0)
{
m_CurrentSection = "default";
}
int lineFeedLen = (int)strlen(m_LineFeed);
if (m_CurrentSectionFilePos == -1)
{
//Section has not been added yet
m_File.Seek(0,CFileBase::end);
int len = (int)m_CurrentSection.length() + (lineFeedLen * 2) + 5;
AUTO_PTR<char> SectionName(new char[len]);
if (m_File.GetLength() < (int)strlen(m_LineFeed))
{
sprintf(SectionName.get(),"[%s]%s",m_CurrentSection.c_str(),m_LineFeed);
} else {
sprintf(SectionName.get(),"%s[%s]%s",m_LineFeed,m_CurrentSection.c_str(),m_LineFeed);
}
m_File.Write(SectionName.get(),(int)strlen(SectionName.get()));
m_CurrentSectionFilePos = m_File.GetPosition();
m_SectionsPos.insert(FILELOC::value_type(m_CurrentSection,m_CurrentSectionFilePos));
} else {
//increase/decrease space needed
int NeededBufferLen = 0;
{
AUTO_PTR<char> LineData(NULL);
int len = 0;
for (KeyValueList::iterator iter = m_CurrentSectionData.begin(); iter != m_CurrentSectionData.end(); iter++)
{
int newLen = (int)iter->first.length() + (int)iter->second.length() + lineFeedLen + 5;
if (newLen > len)
{
LineData.reset(new char[newLen]);
len = newLen;
}
sprintf(LineData.get(),"%s=%s%s",iter->first.c_str(),iter->second.c_str(),m_LineFeed);
NeededBufferLen += (int)strlen(LineData.get());
}
}
int currentLen = 0;
m_File.Seek(m_CurrentSectionFilePos, CFileBase::begin);
int MaxDataSize = 0, DataSize = 0, ReadPos = 0, result;
char *Input = NULL, *Data = NULL;
//Skip first line as it is the section name
int StartPos = m_CurrentSectionFilePos;
int EndPos = StartPos;
do {
result = GetStringFromFile(Input,Data,MaxDataSize,DataSize,ReadPos);
if (result <= 1) { continue; }
if (strlen(CleanLine(Input)) <= 1 ||
Input[0] != '[')
{
EndPos = ((m_File.GetPosition() - DataSize) + ReadPos);
continue;
}
if (Input[0] == '[')
{
NeededBufferLen += lineFeedLen;
}
break;
} while (result >= 0);
currentLen = EndPos - StartPos;
if (Data) { delete [] Data; Data = NULL; }
if (NeededBufferLen != currentLen)
{
fInsertSpaces(StartPos,NeededBufferLen - currentLen);
m_File.Flush();
ClearSectionPosList(StartPos);
}
//set pointer to beginning of the start pos
m_File.Seek(StartPos, CFileBase::begin);
}
{
AUTO_PTR<char> LineData(NULL);
int len = 0;
for (KeyValueList::iterator iter = m_CurrentSectionData.begin(); iter != m_CurrentSectionData.end(); iter++)
{
int newLen = (int)iter->first.length() + (int)iter->second.length() + lineFeedLen + 5;
if (newLen > len)
{
LineData.reset(new char[newLen]);
len = newLen;
}
sprintf(LineData.get(),"%s=%s%s",iter->first.c_str(),iter->second.c_str(),m_LineFeed);
m_File.Write(LineData.get(),(int)strlen(LineData.get()));
}
}
m_File.Flush();
}
bool CIniFileBase::MoveToSectionNameData ( LPCSTR lpSectionName, bool ChangeCurrentSection )
{
if (strcmp(lpSectionName,m_CurrentSection.c_str()) == 0)
{
return true;
}
if (ChangeCurrentSection)
{
SaveCurrentSection();
m_CurrentSection = "";
}
char *Input = NULL, *Data = NULL;
int MaxDataSize = 0, DataSize = 0, ReadPos = 0, result;
FILELOC_ITR iter = m_SectionsPos.find(std::string(lpSectionName));
bool bFoundSection = false;
if (iter != m_SectionsPos.end())
{
if (ChangeCurrentSection)
{
m_CurrentSection = iter->first;
m_CurrentSectionFilePos = iter->second;
}
m_File.Seek(iter->second,CFileBase::begin);
bFoundSection = true;
} else {
m_File.Seek(m_lastSectionSearch, CFileBase::begin);
//long Fpos;
BYTE pUTF8[3];
pUTF8[0] = 0xef;
pUTF8[1] = 0xbb;
pUTF8[2] = 0xbf;
do {
result = GetStringFromFile(Input,Data,MaxDataSize,DataSize,ReadPos);
if (result <= 1) { continue; }
if (strlen(CleanLine(Input)) <= 1) { continue; }
//We Only care about sections
char * CurrentSection = Input;
if(m_lastSectionSearch == 0 && !memcmp(CurrentSection, pUTF8, 3))
{
CurrentSection += 3;
}
if (CurrentSection[0] != '[') { continue; }
int lineEndPos = (int)strlen(CurrentSection) - 1;
if (CurrentSection[lineEndPos] != ']') { continue; }
//take off the ']' from the end of the string
CurrentSection[lineEndPos] = 0;
CurrentSection += 1;
m_lastSectionSearch = (m_File.GetPosition() - DataSize) + ReadPos;
m_SectionsPos.insert(FILELOC::value_type(CurrentSection,m_lastSectionSearch));
if (_stricmp(lpSectionName,CurrentSection) != 0) {
continue;
}
if (ChangeCurrentSection)
{
m_CurrentSection = lpSectionName;
m_CurrentSectionFilePos = m_lastSectionSearch;
} else {
m_File.Seek(m_lastSectionSearch,CFileBase::begin);
}
bFoundSection = true;
break;
} while (result >= 0);
}
if (bFoundSection && ChangeCurrentSection)
{
m_CurrentSectionData.clear();
do {
result = GetStringFromFile(Input,Data,MaxDataSize,DataSize,ReadPos);
if (result <= 1) { continue; }
if (strlen(CleanLine(Input)) <= 1) { continue; }
if (Input[0] == '[') { break; }
char * Pos = strchr(Input,'=');
if (Pos == NULL) { continue; }
char * Value = &Pos[1];
char * Pos1 = Pos-1;
while(((*Pos1 == ' ') || (*Pos1 == '\t')) && (Pos1 > Input))
{
Pos1--;
}
Pos1[1] = 0;
m_CurrentSectionData.insert(KeyValueList::value_type(Input,Value));
} while (result >= 0);
}
if (Data) { delete [] Data; Data = NULL; }
return bFoundSection;
}
const char * CIniFileBase::CleanLine ( char * const Line )
{
char * Pos = Line;
//Remove any comment from the line
while (Pos != NULL)
{
Pos = strchr(Pos,'/');
if (Pos != NULL)
{
if (Pos[1] == '/')
{
if(Pos > Line)
{
char * Pos_1 = Pos-1;
if(Pos_1[0] != ':')
{
Pos[0] = 0;
}
else
Pos += 1;
}
else
{
Pos[0] = 0;
}
}
else
{
Pos += 1;
}
}
}
//strip any spaces or line feeds from the end of the line
for (int count = (int)strlen(&Line[0]) - 1; count >= 0; count --) {
if (Line[count] != ' ' && Line[count] != '\r') { break; }
Line[count] = 0;
}
return Line;
}
void CIniFileBase::OpenIniFileReadOnly()
{
if (m_File.Open(m_FileName.c_str(),CFileBase::modeRead))
{
m_ReadOnly = true;
m_File.Seek(0,CFileBase::begin);
}
}
void CIniFileBase::OpenIniFile(bool bCreate)
{
//Open for reading/Writing
m_ReadOnly = false;
if (!m_File.Open(m_FileName.c_str(),CFileBase::modeReadWrite | CFileBase::shareDenyWrite))
{
if (!m_File.Open(m_FileName.c_str(),CFileBase::modeRead))
{
if(bCreate)
{
if (!m_File.Open(m_FileName.c_str(),CFileBase::modeReadWrite | CFileBase::modeCreate | CFileBase::shareDenyWrite))
{
return;
}
}
}
else
{
m_ReadOnly = true;
}
}
m_File.Seek(0,CFileBase::begin);
}
bool CIniFileBase::IsEmpty()
{
if(m_File.GetLength()==0)
return true;
return false;
}
bool CIniFileBase::IsFileOpen ( void )
{
return m_File.IsOpen();
}
bool CIniFileBase::DeleteSection ( LPCTSTR lpSectionName )
{
stdstr_f strSection("[%s]",lpSectionName);
/*if(m_File.IsOpen())
{
m_CurrentSectionFilePos = 0;
m_File.Seek(m_CurrentSectionFilePos,CFileBase::begin);
ULONG dwSize = m_File.GetLength();
if(dwSize)
{
char *pData = new char[dwSize+1];
if(pData)
{
ULONG dwRet = m_File.Read(pData, dwSize);
if(dwRet != 0)
{
if(dwRet <= dwSize)
{
pData[dwRet] = 0;
char *pSection = strstr(pData, strSection.c_str());
if(pSection)
{
char tmp = pSection[0];
pSection[0] = 0;
std::string strNewData = pData;
pSection[0] = tmp;
char *pEndSection = pSection + strlen(strSection.c_str());
char *pNextSection = strstr(pEndSection, "[");
if(pNextSection)
{
strNewData += pNextSection;
}
m_File.Seek(m_CurrentSectionFilePos,CFileBase::begin);
m_File.Write(strNewData.c_str(), (ULONG)strlen(strNewData.c_str()));
m_File.Flush();
m_File.SetEndOfFile();
}
}
else
{
delete [] pData;
return false;
}
}
delete [] pData;
}
else
return false;
}
}
else
return false;*/
return true;
}
bool CIniFileBase::GetString ( LPCSTR lpSectionName, LPCSTR lpKeyName, LPCSTR lpDefault, stdstr & Value )
{
CGuard Guard(m_CS);
if (lpSectionName == NULL || strlen(lpSectionName) == 0)
{
lpSectionName = "default";
}
if (m_File.IsOpen() && MoveToSectionNameData(lpSectionName,true))
{
KeyValueList::iterator iter = m_CurrentSectionData.find(lpKeyName);
if (iter != m_CurrentSectionData.end())
{
Value = iter->second.c_str();
return true;
}
}
Value = lpDefault;
return false;
}
stdstr CIniFileBase::GetString ( LPCSTR lpSectionName, LPCSTR lpKeyName, LPCSTR lpDefault )
{
stdstr Value;
GetString(lpSectionName,lpKeyName,lpDefault,Value);
return Value;
}
#ifdef _UNICODE
bool CIniFileBase::GetString ( LPCWSTR lpSectionName, LPCWSTR lpKeyName, LPCWSTR lpDefault, stdstr & Value )
{
CGuard Guard(m_CS);
std::string strSection;
if (lpSectionName == NULL || wcslen(lpSectionName) == 0)
{
strSection = "default";
} else {
stdstr::fromTString(lpSectionName,strSection);
}
if (m_File.IsOpen() && MoveToSectionNameData(strSection.c_str(),true))
{
KeyValueList::iterator iter = m_CurrentSectionData.find(lpKeyName);
if (iter != m_CurrentSectionData.end())
{
stdstr::toTString(iter->second.c_str(),Value);
return true;
}
}
Value = lpDefault;
return false;
}
stdstr CIniFileBase::GetString ( LPCWSTR lpSectionName, LPCWSTR lpKeyName, LPCWSTR lpDefault )
{
stdstr Value;
GetString(lpSectionName,lpKeyName,lpDefault,Value);
return Value;
}
#endif
ULONG CIniFileBase::GetString ( LPCTSTR lpSectionName, LPCTSTR lpKeyName, LPCTSTR lpDefault, LPTSTR lpReturnedString, ULONG nSize )
{
CGuard Guard(m_CS);
std::string strSection;
if (lpSectionName == NULL || _tcslen(lpSectionName) == 0)
{
strSection = "default";
} else {
strSection = lpSectionName;
}
if (m_File.IsOpen() && MoveToSectionNameData(strSection.c_str(),true))
{
KeyValueList::iterator iter = m_CurrentSectionData.find(lpKeyName);
if (iter != m_CurrentSectionData.end())
{
_tcsncpy(lpReturnedString,iter->second.c_str(),nSize - 1);
lpReturnedString[nSize - 1] = 0;
return (ULONG)_tcslen(lpReturnedString);
}
}
_tcsncpy(lpReturnedString,lpDefault,nSize - 1);
lpReturnedString[nSize - 1] = 0;
return (ULONG)_tcslen(lpReturnedString);
}
#ifdef _UNICODE
ULONG CIniFileBase::GetNumber ( LPCWSTR lpSectionName, LPCWSTR lpKeyName, ULONG nDefault )
{
ULONG Value;
GetNumber(lpSectionName,lpKeyName,nDefault,Value);
return Value;
}
bool CIniFileBase::GetNumber ( LPCWSTR lpSectionName, LPCWSTR lpKeyName, ULONG nDefault, ULONG & Value )
{
std::string strSection;
if (lpSectionName != NULL && wcslen(lpSectionName) > 0)
{
stdstr::fromTString(lpSectionName,strSection);
return GetNumber(strSection.c_str(),lpKeyName.c_str(),nDefault,Value);
} else {
return GetNumber(NULL,lpKeyName.c_str(),nDefault,Value);
}
}
#endif
ULONG CIniFileBase::GetNumber ( LPCSTR lpSectionName, LPCSTR lpKeyName, ULONG nDefault )
{
ULONG Value;
GetNumber(lpSectionName,lpKeyName,nDefault,Value);
return Value;
}
bool CIniFileBase::GetNumber ( LPCSTR lpSectionName, LPCSTR lpKeyName, ULONG nDefault, ULONG & Value )
{
CGuard Guard(m_CS);
if (lpSectionName == NULL || strlen(lpSectionName) == 0)
{
lpSectionName = "default";
}
if (m_File.IsOpen() && MoveToSectionNameData(lpSectionName,true))
{
KeyValueList::iterator iter = m_CurrentSectionData.find(lpKeyName);
if (iter != m_CurrentSectionData.end())
{
Value = 0;
sscanf(iter->second.c_str(), "%u", &Value);
return true;
}
}
Value = nDefault;
return false;
}
void CIniFileBase::SaveString ( LPCTSTR lpSectionName, LPCTSTR lpKeyName, LPCTSTR lpString )
{
CGuard Guard(m_CS);
if (!m_File.IsOpen())
{
if (lpString)
{
OpenIniFile();
}
if (!m_File.IsOpen())
{
return;
}
}
std::string strSection;
if (lpSectionName == NULL || _tcslen(lpSectionName) == 0)
{
strSection = "default";
} else {
strSection = lpSectionName;
}
if (!MoveToSectionNameData(strSection.c_str(),true))
{
m_CurrentSection = strSection;
m_CurrentSectionData.clear();
m_CurrentSectionFilePos = -1;
}
KeyValueList::iterator iter = m_CurrentSectionData.find(lpKeyName);
if (iter != m_CurrentSectionData.end())
{
if (lpString)
{
if (iter->second != lpString)
{
iter->second = lpString;
m_CurrentSectionDirty = true;
}
} else {
m_CurrentSectionData.erase(iter);
m_CurrentSectionDirty = true;
}
} else {
if (lpString)
{
m_CurrentSectionData.insert(KeyValueList::value_type(lpKeyName,lpString));
m_CurrentSectionDirty = true;
}
}
if (m_InstantFlush)
{
SaveCurrentSection();
}
}
void CIniFileBase::SaveNumber ( LPCTSTR lpSectionName, LPCTSTR lpKeyName, ULONG Value )
{
//translate the string to an ascii version and save as text
SaveString(lpSectionName,lpKeyName,stdstr_f(_T("%d"),Value).c_str());
}
void CIniFileBase::FlushChanges (void)
{
SaveCurrentSection();
}
void CIniFileBase::SetAutoFlush (bool AutoFlush)
{
m_InstantFlush = AutoFlush;
if (AutoFlush)
{
FlushChanges();
}
}
void CIniFileBase::GetKeyList ( LPCTSTR lpSectionName, strlist &List )
{
List.clear();
CGuard Guard(m_CS);
if (!m_File.IsOpen())
{
return;
}
if (lpSectionName == NULL || _tcslen(lpSectionName) == 0)
{
lpSectionName = "default";
}
if (MoveToSectionNameData(lpSectionName,true))
{
for (KeyValueList::iterator iter = m_CurrentSectionData.begin(); iter != m_CurrentSectionData.end(); iter++)
{
List.push_back(iter->first);
}
}
}
void CIniFileBase::GetKeyValueData ( LPCTSTR lpSectionName, KeyValueData & List )
{
CGuard Guard(m_CS);
if (!m_File.IsOpen())
{
return;
}
std::string strSection;
if (lpSectionName == NULL || _tcslen(lpSectionName) == 0)
{
strSection = "default";
} else {
strSection = lpSectionName;
}
if (!MoveToSectionNameData(strSection.c_str(),false)) { return; }
int MaxDataSize = 0, DataSize = 0, ReadPos = 0, result;
char *Input = NULL, *Data = NULL;
do {
result = GetStringFromFile(Input,Data,MaxDataSize,DataSize,ReadPos);
if (result <= 1) { continue; }
if (strlen(CleanLine(Input)) <= 1) { continue; }
if (Input[0] == '[') { break; }
char * Pos = strchr(Input,'=');
if (Pos == NULL) { continue; }
Pos[0] = 0;
List.insert(KeyValueData::value_type(Input,&Pos[1]));
} while (result >= 0);
if (Data) { delete [] Data; Data = NULL; }
}
void CIniFileBase::ClearSectionPosList( long FilePos )
{
if (FilePos <= 0)
{
m_SectionsPos.clear();
m_lastSectionSearch = 0;
} else {
FILELOC::iterator iter = m_SectionsPos.begin();
while (iter != m_SectionsPos.end())
{
FILELOC::iterator CurrentIter = iter;
iter ++;
long TestFilePos = CurrentIter->second;
if (TestFilePos > FilePos)
{
m_SectionsPos.erase(CurrentIter);
}
}
m_lastSectionSearch = FilePos;
}
}
void CIniFileBase::GetVectorOfSections( SectionList & sections)
{
sections.clear();
CGuard Guard(m_CS);
if (!m_File.IsOpen())
{
return;
}
{
stdstr_f DoesNotExist(_T("DoesNotExist%d%d%d"),rand(),rand(),rand());
MoveToSectionNameData(DoesNotExist.c_str(),false);
}
for (FILELOC::const_iterator iter = m_SectionsPos.begin(); iter != m_SectionsPos.end(); iter++)
{
sections.push_back(iter->first);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -76,6 +76,19 @@ public:
return (m_AutoPtr);
}
void reset( _Ty *pVal = 0 ) throw()
{
if (m_AutoPtr != pVal)
{
if (m_Owns)
{
delete m_AutoPtr;
}
m_AutoPtr = pVal;
m_Owns = pVal != NULL;
}
}
private:
_Ty * m_AutoPtr;
bool m_Owns;

View File

@ -32,7 +32,7 @@ stdstr ReadVersionInfo( BYTE * Array, LPCTSTR Info )
if (_tcscmp(Info,VERSION_PRODUCT_VERSION) == 0 || _tcscmp(Info,VERSION_FILE_VERSION) == 0)
{
for (DWORD Pos = 0; Pos < _tcslen(pszVersion); Pos ++) {
for (ULONG Pos = 0; Pos < _tcslen(pszVersion); Pos ++) {
if (pszVersion[Pos] == ',')
{
pszVersion[Pos] = '.';
@ -43,10 +43,10 @@ stdstr ReadVersionInfo( BYTE * Array, LPCTSTR Info )
return pszVersion;
}
bool HasFileVersionInfo( LPCTSTR Info, LPCTSTR FileName )
bool HasFileVersionInfo( LPCTSTR /*Info*/, LPCTSTR FileName )
{
DWORD dwHandle;
DWORD Size = GetFileVersionInfoSize(FileName,&dwHandle);;
DWORD Size = GetFileVersionInfoSize((LPTSTR)FileName,&dwHandle);
if ( Size == 0)
{
return false;
@ -63,7 +63,7 @@ stdstr FileVersionInfo( LPCTSTR Info, LPCTSTR FileName )
if(_tcslen(FileName) != 0)
{
DWORD dwHandle = 0;
DWORD Size = GetFileVersionInfoSize(FileName,&dwHandle);
DWORD Size = GetFileVersionInfoSize((LPSTR)FileName,&dwHandle);
if ( Size == 0)
{
//WriteTraceF(TraceError,_T("FileVersionInfo(%s, %s): GetFileVersionInfoSize failed, error (%s)"),Info,FileName,BaseException::GetLastErrorDescription(GetLastError()).c_str());
@ -78,7 +78,7 @@ stdstr FileVersionInfo( LPCTSTR Info, LPCTSTR FileName )
try
{
if (!GetFileVersionInfo(FileName,0,Size,Array))
if (!GetFileVersionInfo((LPSTR)FileName,0,Size,Array))
{
//WriteTraceF(TraceError,_T("FileVersionInfo(%s, %s): GetFileVersionInfo(%d) failed, error (%s)"),Info,FileName,Size,BaseException::GetLastErrorDescription(GetLastError()).c_str());

View File

@ -9,6 +9,8 @@
#define VERSION_PRODUCT_NAME TEXT("ProductName")
#define VERSION_PRODUCT_VERSION TEXT("ProductVersion")
#include "std string.h"
bool HasFileVersionInfo ( LPCTSTR Info, LPCTSTR FileName );
stdstr FileVersionInfo ( LPCTSTR Info, LPCTSTR FileName );
stdstr VersionInfo ( LPCTSTR Info, HMODULE hModule = NULL);

View File

@ -21,11 +21,22 @@ const TCHAR DRIVE_DELIMITER = ':';
const TCHAR DIRECTORY_DELIMITER = '\\';
const TCHAR EXTENSION_DELIMITER = '.';
const TCHAR DIRECTORY_DELIMITER2 = '/';
HINSTANCE CPath::m_hInst = NULL;
//////////////////////////////////////////////////////////////////////
// Helpers
//////////////////////////////////////////////////////////////////////
void CPath::SethInst ( HINSTANCE hInst )
{
m_hInst = hInst;
}
HINSTANCE CPath::GethInst()
{
return m_hInst;
}
//-------------------------------------------------------------
// Task : Create a string of length nDigits containing random digits
//-------------------------------------------------------------
@ -119,13 +130,10 @@ CPath::CPath(LPCTSTR lpszPath)
cleanPathString(m_strPath);
}
//-------------------------------------------------------------
// Task : Constructs a path and points it 2 strPath
//-------------------------------------------------------------
CPath::CPath(LPCTSTR strPath, LPCTSTR NameExten )
CPath::CPath(LPCTSTR lpszPath, LPCTSTR NameExten)
{
Init();
SetDriveDirectory(strPath);
SetDriveDirectory(lpszPath);
SetNameExtension(NameExten);
}
@ -260,37 +268,72 @@ CPath::operator LPCTSTR() const
return (LPCTSTR)m_strPath.c_str();
}
CPath::CPath(DIR_CURRENT_DIRECTORY /*sdt*/, LPCTSTR NameExten)
{
// Application's current directory
Init();
CurrentDirectory();
if (NameExten) { SetNameExtension(NameExten); }
}
CPath::CPath(DIR_WINDOWS_DIRECTORY /*sdt*/, LPCTSTR NameExten)
{
// Windows directory
Init();
WindowsDirectory();
if (NameExten) { SetNameExtension(NameExten); }
}
CPath::CPath(DIR_SYSTEM_DIRECTORY /*sdt*/, LPCTSTR NameExten)
{
// Windows' system directory
Init();
SystemDirectory();
if (NameExten) { SetNameExtension(NameExten); }
}
CPath::CPath(DIR_SYSTEM32_DIRECTORY /*sdt*/, LPCTSTR NameExten)
{
Init();
SystemDirectory();
if (NameExten) { SetNameExtension(NameExten); }
}
CPath::CPath(DIR_SYSTEM_DRIVER_DIRECTORY /*sdt*/, LPCTSTR NameExten)
{
Init();
SystemDirectory();
AppendDirectory(_T("drivers"));
if (NameExten) { SetNameExtension(NameExten); }
}
CPath::CPath(DIR_SYSTEM_DRIVE_ROOT_DIRECTORY /*sdt*/, LPCTSTR NameExten)
{
// The root directory of system drive
Init();
SystemDriveRootDirectory();
if (NameExten) { SetNameExtension(NameExten); }
}
CPath::CPath(DIR_MODULE_DIRECTORY /*sdt*/, LPCTSTR NameExten)
{
// The directory where the executable of this app is
Init();
ModuleDirectory();
if (NameExten) { SetNameExtension(NameExten); }
}
CPath::CPath(DIR_MODULE_FILE /*sdt*/)
{
// The directory where the executable of this app is
Init();
Module();
}
void CPath::SpecialDirectory(SpecialDirectoryType eInitialDir)
{
switch(eInitialDir)
{
// Application's current directory
case CURRENT_DIRECTORY:
CurrentDirectory();
break;
// Windows directory
case WINDOWS_DIRECTORY:
WindowsDirectory();
break;
// Windows' system directory
case SYSTEM_DIRECTORY:
SystemDirectory();
break;
case SYSTEM_DRIVER_DIRECTORY:
SystemDirectory();
AppendDirectory(_T("drivers"));
break;
// The root directory of system drive
case SYSTEM_DRIVE_ROOT_DIRECTORY:
SystemDriveRootDirectory();
break;
// The directory where the executable of this app is
case MODULE_DIRECTORY:
ModuleDirectory();
break;
case MODULE_FILE:
Module();
break;
// Windows temp directory
case TEMP_DIRECTORY:
TempDirectory();
@ -573,6 +616,8 @@ void CPath::GetFullyQualified(stdstr& rFullyQualified) const
{
TCHAR buff_fullname[MAX_PATH];
memset(buff_fullname, 0, sizeof(buff_fullname));
_tfullpath(buff_fullname,m_strPath.c_str(),MAX_PATH-1);
rFullyQualified =buff_fullname;
}
@ -587,6 +632,9 @@ void CPath::GetFullyQualifiedShort(stdstr& rFullyQualifiedShort) const
//#pragma message(Reminder(_T("Also implement a GetFullyQualifiedLong")))
TCHAR buff_fullname[MAX_PATH];
memset(buff_fullname, 0, sizeof(buff_fullname));
GetShortPathName(rFullyQualifiedShort.c_str(),buff_fullname,sizeof(buff_fullname)/sizeof(TCHAR));
rFullyQualifiedShort =buff_fullname;
}
@ -664,6 +712,8 @@ void CPath::SetComponents(LPCTSTR lpszDrive,
{
TCHAR buff_fullname[MAX_PATH];
memset(buff_fullname, 0, sizeof(buff_fullname));
_tmakepath(buff_fullname,lpszDrive,lpszDirectory,lpszName,lpszExtension);
m_strPath.erase();
@ -741,6 +791,8 @@ void CPath::SetName(int iName)
stdstr Extension;
TCHAR sName[33];
memset(sName, 0, sizeof(sName));
_itot(iName, sName, 10);
GetComponents(&Drive,&Directory,NULL,&Extension);
@ -771,6 +823,8 @@ void CPath::SetExtension(int iExtension)
stdstr Name;
TCHAR sExtension[20];
memset(sExtension, 0, sizeof(sExtension));
_itot(iExtension, sExtension, 10);
GetComponents(&Drive,&Directory,&Name);
@ -849,6 +903,8 @@ void CPath::CurrentDirectory()
{
TCHAR buff_path[MAX_PATH];
memset(buff_path, 0, sizeof(buff_path));
::GetCurrentDirectory(MAX_PATH,buff_path);
Empty();
@ -862,6 +918,8 @@ void CPath::WindowsDirectory()
{
TCHAR buff_path[MAX_PATH];
memset(buff_path, 0, sizeof(buff_path));
GetWindowsDirectory(buff_path,MAX_PATH);
Empty();
@ -875,6 +933,8 @@ void CPath::SystemDirectory()
{
TCHAR buff_path[MAX_PATH];
memset(buff_path, 0, sizeof(buff_path));
GetSystemDirectory(buff_path,MAX_PATH);
Empty();
@ -896,6 +956,9 @@ void CPath::SystemDriveRootDirectory()
void CPath::Module(HINSTANCE hInstance)
{
TCHAR buff_path[MAX_PATH];
memset(buff_path, 0, sizeof(buff_path));
GetModuleFileName(hInstance,buff_path,MAX_PATH);
m_strPath =buff_path;
}
@ -906,7 +969,9 @@ void CPath::Module(HINSTANCE hInstance)
void CPath::Module()
{
TCHAR buff_path[MAX_PATH];
GetModuleFileName(NULL,buff_path,MAX_PATH);
memset(buff_path, 0, sizeof(buff_path));
GetModuleFileName(m_hInst,buff_path,MAX_PATH);
m_strPath =buff_path;
}
@ -939,6 +1004,8 @@ void CPath::TempDirectory()
{
TCHAR buff_path[MAX_PATH];
memset(buff_path, 0, sizeof(buff_path));
GetTempPath(MAX_PATH,buff_path);
m_strPath =buff_path;
@ -983,7 +1050,14 @@ void CPath::CommonFilesDirectory()
{
// This is some old or unknown system
Empty();
SetDriveDirectory(_T("C:\\Programs\\Common"));
TCHAR Drive[3];
memset(Drive, 0, sizeof(Drive));
ExpandEnvironmentStrings (_T("%SystemDrive%"), Drive, sizeof(Drive)/sizeof(TCHAR) );
stdstr strDir = stdstr(Drive) + stdstr(_T("\\Program Files\\Common Files"));
SetDriveDirectory(strDir.c_str());
}
}
@ -1084,6 +1158,8 @@ BOOL CPath::ShellDirectory(int nShellFolderID)
LPITEMIDLIST pidl =NULL;
TCHAR special_path[MAX_PATH];
memset(special_path, 0, sizeof(special_path));
// Get a PIDL 2 the special shell folder
HRESULT hr =SHGetSpecialFolderLocation(NULL,nShellFolderID,&pidl);
if(SUCCEEDED(hr))
@ -1093,7 +1169,7 @@ BOOL CPath::ShellDirectory(int nShellFolderID)
// Free the PIDL
// Get the address of our task allocator's IMalloc interface
LPMALLOC pMalloc;
LPMALLOC pMalloc = NULL;
hr =SHGetMalloc(&pMalloc);
if(SUCCEEDED(hr))
@ -1139,7 +1215,7 @@ BOOL CPath::ShellDirectory2(int nShellFolderID)
(is_Win95 || (is_NT && (((osver.GetMajorVersion()==3) && (osver.GetMinorVersion()>=51)) || (osver.GetMajorVersion()>3)))))
{
// These systems support the new Chichago shell, get location from registry
HKEY root;
HKEY root = NULL;
stdstr key;
stdstr value;
@ -1266,16 +1342,17 @@ BOOL CPath::GetRegistryPath(HKEY hRootKey, LPCTSTR lpcszKeyName, LPCTSTR lpcszVa
{
TCHAR path_buffer [MAX_PATH];
TCHAR expanded_buffer[MAX_PATH];
DWORD path_buffer_size =sizeof(path_buffer);
ULONG path_buffer_size =sizeof(path_buffer);
CRegistry reg(hRootKey,lpcszKeyName,KEY_READ);
memset(path_buffer, 0, sizeof(path_buffer));
memset(expanded_buffer, 0, sizeof(expanded_buffer));
if(reg.GetValue(lpcszValueName,(BYTE *)&path_buffer,path_buffer_size))
{
COSVersion osver;
#ifndef _UNICODE
WORD ostype =osver.GetOSType();
BOOL is_NT =((ostype & OS_WINNT) != 0);
#ifndef _UNICODE
if(is_NT)
{
// Running on NT and the ExpandEnvironmentStrings API requires
@ -1283,6 +1360,9 @@ BOOL CPath::GetRegistryPath(HKEY hRootKey, LPCTSTR lpcszKeyName, LPCTSTR lpcszVa
WCHAR path_buffer_unicode [MAX_PATH];
WCHAR expanded_buffer_unicode[MAX_PATH];
memset(path_buffer_unicode, 0, sizeof(path_buffer_unicode));
memset(expanded_buffer_unicode, 0, sizeof(expanded_buffer_unicode));
MultiByteToWideChar(CP_ACP,0,path_buffer,-1,path_buffer_unicode,sizeof(path_buffer_unicode)/sizeof(WCHAR));
ExpandEnvironmentStringsW(path_buffer_unicode,expanded_buffer_unicode,sizeof(expanded_buffer_unicode)/sizeof(WCHAR));
WideCharToMultiByte(CP_ACP,0,expanded_buffer_unicode,-1,expanded_buffer,sizeof(path_buffer)/sizeof(TCHAR),NULL,NULL);
@ -1587,6 +1667,8 @@ BOOL CPath::CreateTempName(LPCTSTR lpcszPrefix)
stdstr Dir;
TCHAR temp_file[MAX_PATH];
memset(temp_file, 0, sizeof(temp_file));
GetDriveDirectory(Dir);
if(::GetTempFileName(Dir.c_str(),lpcszPrefix,0,temp_file) != 0)
@ -1622,6 +1704,7 @@ BOOL CPath::CreateTempDir(LPCTSTR lpcszPrefix, UINT nRetries)
TCHAR temp_name [15];
ZeroMemory(temp_prefix, sizeof(temp_prefix));
ZeroMemory(temp_name , sizeof(temp_name ));
_tcsncpy(temp_prefix,lpcszPrefix,4);
temp_prefix[3] =_T('\0');
@ -1719,17 +1802,17 @@ UINT CPath::GetDriveType() const
// Post : Return -1 on error
// Task : Find out the amount of free space on drive (in bytes)
//-------------------------------------------------------------
DWORD CPath::DriveFreeSpaceBytes() const
ULONG CPath::DriveFreeSpaceBytes() const
{
CPath RootPath = *this;
stdstr Root;
RootPath.MakeRoot();
DWORD nSectorsPerCluster;
DWORD nBytesPerSector;
DWORD nFreeClusters;
DWORD nClusters;
ULONG nSectorsPerCluster = 0;
ULONG nBytesPerSector = 0;
ULONG nFreeClusters = 0;
ULONG nClusters = 0;
if(!GetDiskFreeSpace((LPCTSTR)RootPath,&nSectorsPerCluster,&nBytesPerSector,&nFreeClusters,&nClusters))
return 0;
@ -1741,17 +1824,17 @@ DWORD CPath::DriveFreeSpaceBytes() const
// Post : Return -1 on error
// Task : Find out the size of the drive (in bytes)
//-------------------------------------------------------------
DWORD CPath::DriveTotalSpaceBytes() const
ULONG CPath::DriveTotalSpaceBytes() const
{
CPath RootPath = *this;
stdstr Root;
RootPath.MakeRoot();
DWORD nSectorsPerCluster;
DWORD nBytesPerSector;
DWORD nFreeClusters;
DWORD nClusters;
ULONG nSectorsPerCluster = 0;
ULONG nBytesPerSector = 0;
ULONG nFreeClusters = 0;
ULONG nClusters = 0;
if(!GetDiskFreeSpace((LPCTSTR)RootPath,&nSectorsPerCluster,&nBytesPerSector,&nFreeClusters,&nClusters))
return 0;
@ -1763,17 +1846,17 @@ DWORD CPath::DriveTotalSpaceBytes() const
// Post : Return -1 on error
// Task : Find out the cluster size on this drive (in bytes)
//-------------------------------------------------------------
DWORD CPath::GetDriveClusterSize() const
ULONG CPath::GetDriveClusterSize() const
{
CPath RootPath = *this;
stdstr Root;
RootPath.MakeRoot();
DWORD nSectorsPerCluster;
DWORD nBytesPerSector;
DWORD nFreeClusters;
DWORD nClusters;
ULONG nSectorsPerCluster = 0;
ULONG nBytesPerSector = 0;
ULONG nFreeClusters = 0;
ULONG nClusters = 0;
if(!GetDiskFreeSpace((LPCTSTR)RootPath,&nSectorsPerCluster,&nBytesPerSector,&nFreeClusters,&nClusters))
return 0;
@ -1876,23 +1959,26 @@ BOOL CPath::Exists() const
// Post : Return file size, -1 on error
// Task : Get file size (in bytes)
//-------------------------------------------------------------
DWORD CPath::GetSize() const
ULONG CPath::GetSize() const
{
WIN32_FIND_DATA FindData;
memset(&FindData, 0, sizeof(FindData));
HANDLE hFindFile =FindFirstFile(m_strPath.c_str(),&FindData);
BOOL bSuccess =(hFindFile != INVALID_HANDLE_VALUE);
if(hFindFile != NULL) // Make sure we close the search
FindClose(hFindFile);
return bSuccess ? FindData.nFileSizeLow : (DWORD)-1;
return bSuccess ? FindData.nFileSizeLow : (ULONG)-1;
}
//-------------------------------------------------------------
// Post : Return file attributes
// Task : Get attributes of the file
//-------------------------------------------------------------
DWORD CPath::GetAttributes() const
ULONG CPath::GetAttributes() const
{
return GetFileAttributes(m_strPath.c_str());
}
@ -1901,7 +1987,7 @@ DWORD CPath::GetAttributes() const
// Post : Return TRUE on success
// Task : Set the attributes of the file
//---------------------------------------------------------------------------
BOOL CPath::SetAttributes(DWORD dwAttributes)
BOOL CPath::SetAttributes(ULONG dwAttributes)
{
return SetFileAttributes(m_strPath.c_str(),dwAttributes);
}
@ -2067,10 +2153,10 @@ BOOL CPath::SetTimeLastAccessed(const FILETIME *lpAccessed)
// Post : Return TRUE on success
// Task : Delete file
//-------------------------------------------------------------
BOOL CPath::Delete(BOOL bEvenIfReadOnly)
BOOL CPath::Delete(BOOL bEvenIfReadOnly) const
{
DWORD dwAttr =::GetFileAttributes(m_strPath.c_str());
if(dwAttr == (DWORD)-1)
ULONG dwAttr =::GetFileAttributes(m_strPath.c_str());
if(dwAttr == (ULONG)-1)
// File does not exists
return FALSE;
@ -2147,7 +2233,7 @@ BOOL CPath::MoveTo(LPCTSTR lpcszTargetFile, BOOL bOverwrite)
// Post : Return TRUE if attributes do match
// Task : Compare finder attributes
//-------------------------------------------------------------
BOOL CPath::AttributesMatch(DWORD dwTargetAttributes, DWORD dwFileAttributes)
BOOL CPath::AttributesMatch(ULONG dwTargetAttributes, ULONG dwFileAttributes)
{
if (dwTargetAttributes == _A_ALLFILES)
{
@ -2194,7 +2280,7 @@ BOOL CPath::AttributesMatch(DWORD dwTargetAttributes, DWORD dwFileAttributes)
// if you specify those attributes
// See aso: FindFirstFile, FindNextFile
//-------------------------------------------------------------
BOOL CPath::FindFirst(DWORD dwAttributes /*= _A_NORMAL*/)
BOOL CPath::FindFirst(ULONG dwAttributes /*= _A_NORMAL*/)
{
m_dwFindFileAttributes =dwAttributes;
BOOL bGotFile;
@ -2399,20 +2485,6 @@ BOOL CPath::CreateDirectory(BOOL bCreateIntermediates /*= TRUE*/)
return bSuccess;
}
//-------------------------------------------------------------
// Pre : If bCreateIntermediates is TRUE, create all eventually
// missing parent directories too
// Task : Same as CreateDirectory, but throws an CPathException if
// something goes wrong
//-------------------------------------------------------------
void CPath::CreateDirectoryEx(BOOL bCreateIntermediates /*= TRUE*/)
{
BOOL bSuccess =CreateDirectory(bCreateIntermediates);
if(!bSuccess)
throw new CPathException(GetLastError());
}
//Helpers
//------------------------------------------------------------------------
@ -2421,6 +2493,14 @@ void CPath::CreateDirectoryEx(BOOL bCreateIntermediates /*= TRUE*/)
void CPath::cleanPathString(stdstr& rDirectory) const
{
rDirectory.replace(DIRECTORY_DELIMITER2,DIRECTORY_DELIMITER);
if(!_tcsnicmp(rDirectory.c_str(), _T("\\\\"), 2))
{
rDirectory.replace(DIR_DOUBLEDELIM,DIRECTORY_DELIMITER);
rDirectory.insert(0, _T("\\"));
}
else
rDirectory.replace(DIR_DOUBLEDELIM,DIRECTORY_DELIMITER);
}

View File

@ -22,10 +22,10 @@
class CPathException
{
public:
DWORD m_dwErrorCode;
ULONG m_dwErrorCode;
public:
CPathException(DWORD code =0): m_dwErrorCode(code) {}
CPathException(ULONG code =0): m_dwErrorCode(code) {}
};
class CPath
@ -33,15 +33,17 @@ class CPath
//Enums
public:
enum DIR_CURRENT_DIRECTORY { CURRENT_DIRECTORY = 1 };
enum DIR_WINDOWS_DIRECTORY { WINDOWS_DIRECTORY = 2 };
enum DIR_SYSTEM_DIRECTORY { SYSTEM_DIRECTORY = 3 };
enum DIR_SYSTEM32_DIRECTORY { SYSTEM32_DIRECTORY = 4 };
enum DIR_SYSTEM_DRIVER_DIRECTORY { SYSTEM_DRIVER_DIRECTORY = 5 };
enum DIR_SYSTEM_DRIVE_ROOT_DIRECTORY { SYSTEM_DRIVE_ROOT_DIRECTORY = 6 };
enum DIR_MODULE_DIRECTORY { MODULE_DIRECTORY = 7 };
enum DIR_MODULE_FILE { MODULE_FILE = 8 };
enum SpecialDirectoryType
{
CURRENT_DIRECTORY,
WINDOWS_DIRECTORY,
SYSTEM_DIRECTORY,
SYSTEM_DRIVER_DIRECTORY,
SYSTEM_DRIVE_ROOT_DIRECTORY,
MODULE_DIRECTORY,
MODULE_FILE,
TEMP_DIRECTORY,
PROGRAM_FILES_DIRECTORY,
COMMON_FILES_DIRECTORY,
@ -74,8 +76,9 @@ public:
private:
stdstr m_strPath;
DWORD m_dwFindFileAttributes;
ULONG m_dwFindFileAttributes;
HANDLE m_hFindFile;
static HINSTANCE m_hInst;
public:
//Methods
@ -92,6 +95,16 @@ public:
CPath(SpecialDirectoryType sdt);
CPath(SpecialDirectoryType sdt, LPCTSTR NameExten );
CPath(SpecialDirectoryType sdt, const stdstr& NameExten );
CPath(DIR_CURRENT_DIRECTORY sdt, LPCTSTR NameExten = NULL);
CPath(DIR_WINDOWS_DIRECTORY sdt, LPCTSTR NameExten = NULL);
CPath(DIR_SYSTEM_DIRECTORY sdt, LPCTSTR NameExten = NULL );
CPath(DIR_SYSTEM32_DIRECTORY sdt, LPCTSTR NameExten = NULL);
CPath(DIR_SYSTEM_DRIVER_DIRECTORY sdt, LPCTSTR NameExten = NULL);
CPath(DIR_SYSTEM_DRIVE_ROOT_DIRECTORY sdt, LPCTSTR NameExten = NULL);
CPath(DIR_MODULE_DIRECTORY sdt, LPCTSTR NameExten = NULL);
CPath(DIR_MODULE_FILE sdt);
virtual ~CPath();
//Setup & Cleanup
@ -201,10 +214,11 @@ public:
BOOL IsCDRomDrive() const { return GetDriveType()==DRIVE_CDROM; }
BOOL IsNetworkDrive() const { return GetDriveType()==DRIVE_REMOTE; }
BOOL IsRAMDrive() const { return GetDriveType()==DRIVE_RAMDISK; }
BOOL IsFixedDrive() const { return GetDriveType()==DRIVE_FIXED; }
DWORD DriveTotalSpaceBytes() const;
DWORD DriveFreeSpaceBytes() const;
DWORD GetDriveClusterSize() const;
ULONG DriveTotalSpaceBytes() const;
ULONG DriveFreeSpaceBytes() const;
ULONG GetDriveClusterSize() const;
BOOL GetDiskInfo(LPDWORD lpSectorsPerCluster,
LPDWORD lpBytesPerSector,
LPDWORD lpFreeClusters,
@ -218,8 +232,8 @@ public:
//File Information
BOOL IsFile() const { return !IsDirectory(); }
BOOL Exists() const;
DWORD GetSize() const;
DWORD GetAttributes() const;
ULONG GetSize() const;
ULONG GetAttributes() const;
BOOL GetTime(FILETIME *lpCreated, FILETIME *lpAccessed, FILETIME *lpModified) const;
FILETIME GetTimeCreated() const;
FILETIME GetTimeLastModified() const;
@ -227,29 +241,31 @@ public:
//Directory operations
BOOL CreateDirectory(BOOL bCreateIntermediates =TRUE);
void CreateDirectoryEx(BOOL bCreateIntermediates =TRUE); // Throws CPathException
BOOL RemoveDirectory(BOOL bEvenIfNotEmpty =FALSE);
BOOL RemoveDirectoryContent();
BOOL ChangeDirectory();
//File operations
BOOL Delete(BOOL bEvenIfReadOnly =TRUE);
BOOL Delete(BOOL bEvenIfReadOnly =TRUE) const;
BOOL Rename(LPCTSTR lpszNewPath);
BOOL CopyTo(LPCTSTR lpcszTargetFile, BOOL bOverwrite =TRUE);
BOOL MoveTo(LPCTSTR lpcszTargetFile, BOOL bOverwrite =TRUE);
BOOL SetAttributes(DWORD dwAttributes);
BOOL SetAttributes(ULONG dwAttributes);
BOOL SetTime(const FILETIME *lpCreated, const FILETIME *lpAccessed, const FILETIME *lpModified);
BOOL SetTimeCreated(const FILETIME *lpCreated);
BOOL SetTimeLastModified(const FILETIME *lpModified);
BOOL SetTimeLastAccessed(const FILETIME *lpAccessed);
//Finders
BOOL FindFirst(DWORD dwAttributes =_A_NORMAL);
BOOL FindFirst(ULONG dwAttributes =_A_NORMAL);
BOOL FindNext();
// Helpers
static void SethInst ( HINSTANCE hInst );
static HINSTANCE GethInst();
private:
BOOL AttributesMatch(DWORD dwTargetAttributes, DWORD dwFileAttributes);
BOOL AttributesMatch(ULONG dwTargetAttributes, ULONG dwFileAttributes);
BOOL ShellDirectory(int nShellFolderID);
BOOL ShellDirectory2(int nShellFolderID);
BOOL GetRegistryPath(HKEY hRootKey, LPCTSTR lpcszKeyName, LPCTSTR lpcszValueName, stdstr &strPath);

View File

@ -18,3 +18,4 @@
#include "Trace.h"
#include "Version.h"
#include "md5.h"
#include "Smart Pointer.h"

View File

@ -25,10 +25,10 @@ CN64System::CN64System ( CNotification * Notify, CPlugins * Plugins ):
_Settings->RegisterChangeCB(Plugin_CONT_Current,this,(CSettings::SettingChangedFunc)PluginChanged);
_Settings->RegisterChangeCB(Plugin_UseHleGfx,this,(CSettings::SettingChangedFunc)PluginChanged);
_Settings->RegisterChangeCB(Plugin_UseHleAudio,this,(CSettings::SettingChangedFunc)PluginChanged);
_Settings->RegisterChangeCB(Game_Plugin_Gfx,this,(CSettings::SettingChangedFunc)PluginChanged);
_Settings->RegisterChangeCB(Game_Plugin_Audio,this,(CSettings::SettingChangedFunc)PluginChanged);
_Settings->RegisterChangeCB(Game_Plugin_Controller,this,(CSettings::SettingChangedFunc)PluginChanged);
_Settings->RegisterChangeCB(Game_Plugin_RSP,this,(CSettings::SettingChangedFunc)PluginChanged);
_Settings->RegisterChangeCB(Game_EditPlugin_Gfx,this,(CSettings::SettingChangedFunc)PluginChanged);
_Settings->RegisterChangeCB(Game_EditPlugin_Audio,this,(CSettings::SettingChangedFunc)PluginChanged);
_Settings->RegisterChangeCB(Game_EditPlugin_Contr,this,(CSettings::SettingChangedFunc)PluginChanged);
_Settings->RegisterChangeCB(Game_EditPlugin_RSP,this,(CSettings::SettingChangedFunc)PluginChanged);
//InterpreterOpcode = NULL;
m_hPauseEvent = CreateEvent(NULL,true,false,NULL);
@ -50,10 +50,10 @@ CN64System::~CN64System ( void ) {
_Settings->UnregisterChangeCB(Plugin_CONT_Current,this,(CSettings::SettingChangedFunc)PluginChanged);
_Settings->UnregisterChangeCB(Plugin_UseHleGfx,this,(CSettings::SettingChangedFunc)PluginChanged);
_Settings->UnregisterChangeCB(Plugin_UseHleAudio,this,(CSettings::SettingChangedFunc)PluginChanged);
_Settings->UnregisterChangeCB(Game_Plugin_Gfx,this,(CSettings::SettingChangedFunc)PluginChanged);
_Settings->UnregisterChangeCB(Game_Plugin_Audio,this,(CSettings::SettingChangedFunc)PluginChanged);
_Settings->UnregisterChangeCB(Game_Plugin_Controller,this,(CSettings::SettingChangedFunc)PluginChanged);
_Settings->UnregisterChangeCB(Game_Plugin_RSP,this,(CSettings::SettingChangedFunc)PluginChanged);
_Settings->UnregisterChangeCB(Game_EditPlugin_Gfx,this,(CSettings::SettingChangedFunc)PluginChanged);
_Settings->UnregisterChangeCB(Game_EditPlugin_Gfx,this,(CSettings::SettingChangedFunc)PluginChanged);
_Settings->UnregisterChangeCB(Game_EditPlugin_Contr,this,(CSettings::SettingChangedFunc)PluginChanged);
_Settings->UnregisterChangeCB(Game_EditPlugin_RSP,this,(CSettings::SettingChangedFunc)PluginChanged);
}
void CN64System::PluginChanged ( CN64System * _this )

View File

@ -73,6 +73,10 @@ enum SettingID {
Game_IniKey,
Game_GameName,
Game_GoodName,
Game_EditPlugin_Gfx,
Game_EditPlugin_Audio,
Game_EditPlugin_Contr,
Game_EditPlugin_RSP,
Game_Plugin_Gfx,
Game_Plugin_Audio,
Game_Plugin_Controller,

View File

@ -141,7 +141,7 @@ void CSettingTypeGame::LoadDefault ( int Index, stdstr & Value ) const
_Settings->LoadDefaultString(m_DefaultSetting,Value);
}
} else {
CSettingTypeApplication::Load(Index,Value);
CSettingTypeApplication::LoadDefault(Index,Value);
}
}
@ -206,7 +206,7 @@ void CSettingTypeGame::Save ( int Index, const char * Value )
if (m_EraseDefaults)
{
stdstr szDefault;
LoadDefault(Index,szDefault);
CSettingTypeGame::LoadDefault(Index,szDefault);
if (_stricmp(szDefault.c_str(),Value) == 0)
{
Delete(Index);

View File

@ -34,8 +34,11 @@ bool CSettingTypeRDBYesNo::Load ( int Index, bool & Value ) const
{
LoadDefault(Index,Value);
return false;
} else {
WriteTraceF(TraceError,"Invalid Yes/No setting value (Section: %s Key: %s Value: %s)",m_SectionIdent.c_str(),String,m_KeyName.c_str(),strValue.c_str());
LoadDefault(Index,Value);
return false;
}
else { Notify().BreakPoint(__FILE__,__LINE__); }
return true;
}

View File

@ -42,7 +42,7 @@ void CSettingTypeRelativePath::Save ( int Index, ULONG Value )
void CSettingTypeRelativePath::Save ( int Index, const stdstr & Value )
{
m_FileName = CPath(CPath::MODULE_DIRECTORY,Value);
m_FileName = CPath(CPath::MODULE_DIRECTORY,Value.c_str());
}
void CSettingTypeRelativePath::Save ( int Index, const char * Value )

View File

@ -129,6 +129,10 @@ void CSettings::AddHowToHandleSetting ()
AddHandler(Game_IniKey, new CSettingTypeTempString(""));
AddHandler(Game_GameName, new CSettingTypeTempString(""));
AddHandler(Game_GoodName, new CSettingTypeGame("Good Name",Rdb_GoodName));
AddHandler(Game_EditPlugin_Gfx, new CSettingTypeGame("Plugin-Gfx",Default_None));
AddHandler(Game_EditPlugin_Audio, new CSettingTypeGame("Plugin-Audio",Default_None));
AddHandler(Game_EditPlugin_Contr, new CSettingTypeGame("Plugin-Controller",Default_None));
AddHandler(Game_EditPlugin_RSP, new CSettingTypeGame("Plugin-RSP",Default_None));
AddHandler(Game_Plugin_Gfx, new CSettingTypeGame("Plugin-Gfx",Plugin_GFX_Current));
AddHandler(Game_Plugin_Audio, new CSettingTypeGame("Plugin-Audio",Plugin_AUDIO_Current));
AddHandler(Game_Plugin_Controller, new CSettingTypeGame("Plugin-Controller",Plugin_CONT_Current));

View File

@ -55,10 +55,12 @@ void CNotification::DisplayError ( const char * Message, va_list ap ) const {
if (this == NULL) { return; }
char Msg[1000];
WindowMode();
_vsnprintf( Msg,sizeof(Msg) - 1,Message, ap );
va_end( ap );
WriteTrace(TraceError,Msg);
WindowMode();
HWND Parent = NULL;
if (_hWnd) { Parent = reinterpret_cast<HWND>(_hWnd->GetHandle()); }
MessageBox(Parent,Msg,GS(MSG_MSGBOX_TITLE),MB_OK|MB_ICONERROR|MB_SETFOREGROUND);

View File

@ -28,10 +28,10 @@ CGamePluginPage::CGamePluginPage (HWND hParent, const RECT & rcDispay )
m_ControlGroup.Attach(GetDlgItem(IDC_CONT_NAME));
m_RspGroup.Attach(GetDlgItem(IDC_RSP_NAME));
AddPlugins(GFX_LIST,Game_Plugin_Gfx,PLUGIN_TYPE_GFX);
AddPlugins(AUDIO_LIST,Game_Plugin_Audio,PLUGIN_TYPE_AUDIO);
AddPlugins(CONT_LIST,Game_Plugin_Controller,PLUGIN_TYPE_CONTROLLER);
AddPlugins(RSP_LIST,Game_Plugin_RSP,PLUGIN_TYPE_RSP);
AddPlugins(GFX_LIST,Game_EditPlugin_Gfx,PLUGIN_TYPE_GFX);
AddPlugins(AUDIO_LIST,Game_EditPlugin_Audio,PLUGIN_TYPE_AUDIO);
AddPlugins(CONT_LIST,Game_EditPlugin_Contr,PLUGIN_TYPE_CONTROLLER);
AddPlugins(RSP_LIST,Game_EditPlugin_RSP,PLUGIN_TYPE_RSP);
AddModCheckBox(GetDlgItem(IDC_HLE_GFX),Game_UseHleGfx);
AddModCheckBox(GetDlgItem(IDC_HLE_AUDIO),Game_UseHleAudio);
@ -246,17 +246,20 @@ void CGamePluginPage::ApplyComboBoxes ( void )
const CPluginList::PLUGIN * Plugin = *PluginPtr;
if (Plugin)
{
if (_Settings->LoadString(cb_iter->first) != Plugin->FileName.c_str())
{
_Settings->SaveString(cb_iter->first,Plugin->FileName.c_str());
}
} else {
_Settings->DeleteSetting(cb_iter->first);
}
switch (cb_iter->first)
{
case Game_Plugin_RSP: _Settings->SaveBool(Plugin_RSP_Changed,true); break;
case Game_Plugin_Gfx: _Settings->SaveBool(Plugin_GFX_Changed,true); break;
case Game_Plugin_Audio: _Settings->SaveBool(Plugin_AUDIO_Changed,true); break;
case Game_Plugin_Controller: _Settings->SaveBool(Plugin_CONT_Changed,true); break;
case Game_EditPlugin_RSP: _Settings->SaveBool(Plugin_RSP_Changed,true); break;
case Game_EditPlugin_Gfx: _Settings->SaveBool(Plugin_GFX_Changed,true); break;
case Game_EditPlugin_Audio: _Settings->SaveBool(Plugin_AUDIO_Changed,true); break;
case Game_EditPlugin_Contr: _Settings->SaveBool(Plugin_CONT_Changed,true); break;
default:
Notify().BreakPoint(__FILE__,__LINE__);
}

View File

@ -131,12 +131,12 @@ protected:
if (EditBox.IsbString())
{
stdstr Value = _Settings->LoadDefaultString(Type);
EditBox.SetReset(true);
EditBox.SetWindowText(Value.c_str());
EditBox.SetReset(true);
} else {
DWORD Value = _Settings->LoadDefaultDword(Type);
EditBox.SetReset(true);
EditBox.SetWindowText(stdstr_f("%d",Value).c_str());
EditBox.SetReset(true);
}
return true;
}

View File

@ -1491,6 +1491,7 @@ void RSP_Vector_VMRG (void) {
} else {
RSP_Vect[RSPOpC.sa].HW[el] = RSP_Vect[RSPOpC.rt].HW[del];
}
RSP_ACCUM[el].HW[1] = RSP_Vect[RSPOpC.sa].HW[el]; //suggested by angrylion
}
}