diff --git a/Project64.dsw b/Project64.dsw index 634945846..3b0dcb394 100644 --- a/Project64.dsw +++ b/Project64.dsw @@ -27,6 +27,21 @@ Package=<4> ############################################################################### +Project: "PjDirValidation"=".\SOURCE\PjDirValidation\PjDirValidation.dsp" - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name Common + End Project Dependency +}}} + +############################################################################### + Project: "Project64"=".\Source\Project64\Project64.dsp" - Package Owner=<4> Package=<5> diff --git a/Source/7zip/7zip.dsp b/Source/7zip/7zip.dsp index eaf48ebd7..666cf0348 100644 --- a/Source/7zip/7zip.dsp +++ b/Source/7zip/7zip.dsp @@ -61,7 +61,7 @@ LIB32=link.exe -lib # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 -# PROP Output_Dir "../../Bin/Debug" +# PROP Output_Dir "../../Build/7zip/Debug" # PROP Intermediate_Dir "../../Build/7zip/Debug" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c diff --git a/Source/Common/Common.dsp b/Source/Common/Common.dsp index a06d4e80c..9d9380e0f 100644 --- a/Source/Common/Common.dsp +++ b/Source/Common/Common.dsp @@ -61,11 +61,11 @@ LIB32=link.exe -lib # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 -# PROP Output_Dir "../../Bin/Debug" +# PROP Output_Dir "../../Build/Common/Debug" # PROP Intermediate_Dir "../../Build/Common/Debug" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /Yu"stdafx.h" /FD /GZ /c # ADD BASE RSC /l 0xc09 /d "_DEBUG" # ADD RSC /l 0xc09 /d "_DEBUG" BSC32=bscmake.exe @@ -114,6 +114,10 @@ SOURCE=".\File Class.cpp" # End Source File # Begin Source File +SOURCE=".\Ini File Class.cpp" +# End Source File +# Begin Source File + SOURCE=".\Log Class.cpp" # End Source File # Begin Source File @@ -143,6 +147,17 @@ SOURCE=".\std string.cpp" # Begin Source File SOURCE=.\stdafx.cpp + +!IF "$(CFG)" == "Common - Win32 Release" + +!ELSEIF "$(CFG)" == "Common - Win32 Debug" + +# ADD CPP /Yc"stdafx.h" + +!ELSEIF "$(CFG)" == "Common - Win32 External Release" + +!ENDIF + # End Source File # Begin Source File diff --git a/Source/Common/Common.plg b/Source/Common/Common.plg index 47c4bc949..127701df7 100644 --- a/Source/Common/Common.plg +++ b/Source/Common/Common.plg @@ -6,45 +6,12 @@ --------------------Configuration: Common - Win32 Debug--------------------

Command Lines

-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 +Creating temporary file "C:\DOCUME~1\NICHOL~1\LOCALS~1\Temp\RSP60.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" +Creating command line "cl.exe @C:\DOCUME~1\NICHOL~1\LOCALS~1\Temp\RSP60.tmp"

Output Window

Compiling... stdafx.cpp @@ -62,25 +29,11 @@ warning C4786: 'std::_Tree,std::al warning C4786: 'std::map,std::allocator >,std::basic_string,std::allocator >,std::less,std::allocator > >,std::allocator,std::allocator > > >' : identifier was truncated to '255' characters in the debug information warning C4786: 'std::map,std::allocator >,std::basic_string,std::allocator >,std::less,std::allocator > >,std::allocator,std::allocator > > >::value_compare' : identifier was truncated to '255' characters in the debug information warning C4786: 'std::map,std::allocator >,std::basic_string,std::allocator >,std::less,std::allocator > >,std::allocator,std::allocator > > >::_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...

Results

-Common.lib - 0 error(s), 14 warning(s) +stdafx.obj - 0 error(s), 14 warning(s) diff --git a/Source/Common/File Class.cpp b/Source/Common/File Class.cpp index 43dfb7211..e0dfc358c 100644 --- a/Source/Common/File Class.cpp +++ b/Source/Common/File Class.cpp @@ -15,7 +15,6 @@ CFile::CFile(HANDLE hFile) : { ATLASSERT(hFile != 0); } - } CFile::~CFile() @@ -26,7 +25,7 @@ CFile::~CFile() } } -CFile::CFile(LPCTSTR lpszFileName, DWORD nOpenFlags) : +CFile::CFile(LPCTSTR lpszFileName, ULONG nOpenFlags) : m_hFile(INVALID_HANDLE_VALUE), m_bCloseOnDelete(true) { diff --git a/Source/Common/Log Class.cpp b/Source/Common/Log Class.cpp index 15d036e64..714a1e012 100644 --- a/Source/Common/Log Class.cpp +++ b/Source/Common/Log Class.cpp @@ -32,13 +32,14 @@ bool CLog::Open( LPCTSTR FileName, LOG_OPEN_MODE mode /* = Log_New */) m_hLogFile.Close(); } - DWORD nOpenFlags = CFile::modeReadWrite | CFile::modeCreate; + ULONG nOpenFlags = CFile::modeReadWrite | CFile::modeCreate; if (mode == Log_Append) { nOpenFlags |= CFile::modeNoTruncate; } if (!m_hLogFile.Open(File, nOpenFlags)) { return false; } + m_FileName = (LPCTSTR)File; m_hLogFile.Seek(0,mode == Log_Append ? CFile::end : CFile::begin); #ifdef _UNICODE @@ -46,7 +47,6 @@ bool CLog::Open( LPCTSTR FileName, LOG_OPEN_MODE mode /* = Log_New */) if(m_hLogFile.GetLength()==0) { WORD wUNICODE = 0xFEFF; - DWORD dwWriten=0; m_hLogFile.Write(&wUNICODE, 2); } @@ -118,7 +118,7 @@ void CLog::LogArgs(LPCTSTR Message, va_list & args ) void CLog::Log( LPCTSTR Message ) { if (!m_hLogFile.IsOpen()) { return; } - m_hLogFile.Write(Message,(DWORD)_tcslen(Message)*sizeof(TCHAR)); + m_hLogFile.Write(Message,(ULONG)_tcslen(Message)*sizeof(TCHAR)); if (m_FlushOnWrite) { m_hLogFile.Flush(); @@ -127,7 +127,7 @@ void CLog::Log( LPCTSTR Message ) if (m_TruncateFileLog) { // check file size - DWORD FileSize = m_hLogFile.GetLength(); + ULONG FileSize = m_hLogFile.GetLength(); // if larger then max size then if (FileSize > m_MaxFileSize) { @@ -194,8 +194,8 @@ void CLog::Log( LPCTSTR Message ) } while (SizeToRead > 0); //clean up - m_hLogFile.SetEndOfFile(); - m_hLogFile.Flush(); + m_hLogFile.SetEndOfFile(); + m_hLogFile.Flush(); } // end if } } diff --git a/Source/Common/Log Class.h b/Source/Common/Log Class.h index 44437ed35..1ba18d229 100644 --- a/Source/Common/Log Class.h +++ b/Source/Common/Log Class.h @@ -13,8 +13,8 @@ class CLog { bool m_FlushOnWrite; stdstr m_FileName; bool m_TruncateFileLog; - DWORD m_MaxFileSize; - DWORD m_FileChangeSize; + ULONG m_MaxFileSize; + ULONG m_FileChangeSize; public: CLog ( void ); @@ -28,16 +28,16 @@ public: void Reset ( void ); void Close ( void ); - inline void SetMaxFileSize ( DWORD Size ) + inline void SetMaxFileSize ( ULONG Size ) { m_MaxFileSize = Size; - m_FileChangeSize = (DWORD)(Size * 0.1); + m_FileChangeSize = (ULONG)(Size * 0.1); } inline void SetTruncateFile( bool Truncate ) { m_TruncateFileLog = Truncate; } inline void SetFlush ( bool Always ) { m_FlushOnWrite = Always; } inline bool IsOpen ( void ) const { return m_hLogFile.IsOpen(); } inline bool Flush ( void ) { return m_hLogFile.Flush(); } - inline stdstr FileName ( void ) const { return m_FileName; } + inline const stdstr & FileName ( void ) const { return m_FileName; } }; #endif diff --git a/Source/Common/stdafx.cpp b/Source/Common/stdafx.cpp index 303e93800..71d3a37f4 100644 --- a/Source/Common/stdafx.cpp +++ b/Source/Common/stdafx.cpp @@ -1,3 +1,3 @@ -#pragma warning (disable : 4786) +#pragma warning(disable:4786) #include "stdafx.h" \ No newline at end of file diff --git a/Source/PjDirValidation/PjDirValidation.dsp b/Source/PjDirValidation/PjDirValidation.dsp new file mode 100644 index 000000000..50363e766 --- /dev/null +++ b/Source/PjDirValidation/PjDirValidation.dsp @@ -0,0 +1,110 @@ +# Microsoft Developer Studio Project File - Name="PjDirValidation" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +CFG=PjDirValidation - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "PjDirValidation.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "PjDirValidation.mak" CFG="PjDirValidation - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "PjDirValidation - Win32 Release" (based on "Win32 (x86) Application") +!MESSAGE "PjDirValidation - Win32 Debug" (based on "Win32 (x86) Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "PjDirValidation - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "../../Bin/Release" +# PROP Intermediate_Dir "../../Build/PjDirValidation/Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "../" /I "./" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c +# SUBTRACT CPP /Fr +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0xc09 /d "NDEBUG" +# ADD RSC /l 0xc09 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 + +!ELSEIF "$(CFG)" == "PjDirValidation - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "../../Bin/Debug" +# PROP Intermediate_Dir "../../Build/PjDirValidation/Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../" /I "./" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c +# SUBTRACT CPP /Fr +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0xc09 /d "_DEBUG" +# ADD RSC /l 0xc09 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept +# SUBTRACT LINK32 /map + +!ENDIF + +# Begin Target + +# Name "PjDirValidation - Win32 Release" +# Name "PjDirValidation - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\main.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# End Target +# End Project diff --git a/Source/PjDirValidation/main.cpp b/Source/PjDirValidation/main.cpp new file mode 100644 index 000000000..2f54344d1 --- /dev/null +++ b/Source/PjDirValidation/main.cpp @@ -0,0 +1,6 @@ +#include + +int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszArgs, int nWinMode) +{ + return 0; +} diff --git a/Source/Project64/N64 System/C Core/CPU Log.c b/Source/Project64/N64 System/C Core/CPU Log.cpp similarity index 82% rename from Source/Project64/N64 System/C Core/CPU Log.c rename to Source/Project64/N64 System/C Core/CPU Log.cpp index 6c389691a..9854b5577 100644 --- a/Source/Project64/N64 System/C Core/CPU Log.c +++ b/Source/Project64/N64 System/C Core/CPU Log.cpp @@ -54,12 +54,10 @@ void CPU_Message (char * Message, ...) { } void Start_x86_Log (void) { - char path_buffer[_MAX_PATH], drive[_MAX_DRIVE] ,dir[_MAX_DIR]; - char fname[_MAX_FNAME],ext[_MAX_EXT], LogFileName[_MAX_PATH]; - GetModuleFileName(NULL,path_buffer,sizeof(path_buffer)); - _splitpath( path_buffer, drive, dir, fname, ext ); - _makepath( LogFileName, drive, dir, "CPUoutput", "log" ); + CPath LogFileName(CPath::MODULE_DIRECTORY); + LogFileName.AppendDirectory("Logs"); + LogFileName.SetNameExtension(_T("CPUoutput.log")); if (hCPULogFile) { Stop_x86_Log(); } hCPULogFile = CreateFile(LogFileName,GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE,NULL, diff --git a/Source/Project64/N64 System/C Core/Logging.c b/Source/Project64/N64 System/C Core/Logging.cpp similarity index 96% rename from Source/Project64/N64 System/C Core/Logging.c rename to Source/Project64/N64 System/C Core/Logging.cpp index 611f32950..edec59db6 100644 --- a/Source/Project64/N64 System/C Core/Logging.c +++ b/Source/Project64/N64 System/C Core/Logging.cpp @@ -51,7 +51,7 @@ void EnterLogOptions(HWND hwndOwner) { psp[0].dwFlags = PSP_USETITLE; psp[0].hInstance = GetModuleHandle(NULL); psp[0].pszTemplate = MAKEINTRESOURCE(IDD_Logging_Registers); - psp[0].pfnDlgProc = LogRegProc; + psp[0].pfnDlgProc = (DLGPROC)LogRegProc; psp[0].pszTitle = "Registers"; psp[0].lParam = 0; psp[0].pfnCallback = NULL; @@ -60,7 +60,7 @@ void EnterLogOptions(HWND hwndOwner) { psp[1].dwFlags = PSP_USETITLE; psp[1].hInstance = GetModuleHandle(NULL); psp[1].pszTemplate = MAKEINTRESOURCE(IDD_Logging_PifRam); - psp[1].pfnDlgProc = LogPifProc; + psp[1].pfnDlgProc = (DLGPROC)LogPifProc; psp[1].pszTitle = "Pif Ram"; psp[1].lParam = 0; psp[1].pfnCallback = NULL; @@ -69,7 +69,7 @@ void EnterLogOptions(HWND hwndOwner) { psp[2].dwFlags = PSP_USETITLE; psp[2].hInstance = GetModuleHandle(NULL); psp[2].pszTemplate = MAKEINTRESOURCE(IDD_Logging_General); - psp[2].pfnDlgProc = LogGeneralProc; + psp[2].pfnDlgProc = (DLGPROC)LogGeneralProc; psp[2].pszTitle = "General"; psp[2].lParam = 0; psp[2].pfnCallback = NULL; @@ -701,21 +701,19 @@ void SaveLogOptions (void) { RegCloseKey(hKeyResults); } -void StartLog (void) { - char path_buffer[_MAX_PATH], drive[_MAX_DRIVE] ,dir[_MAX_DIR]; - char fname[_MAX_FNAME],ext[_MAX_EXT],File[255]; - +void StartLog (void) +{ if (!LogOptions.GenerateLog) { StopLog(); return; } if (hLogFile) { return; } - GetModuleFileName(NULL,path_buffer,sizeof(path_buffer)); - _splitpath( path_buffer, drive, dir, fname, ext ); - sprintf(File,"%s%s\\cpudebug.log",drive,dir); - - hLogFile = CreateFile(File,GENERIC_WRITE, FILE_SHARE_READ,NULL,CREATE_ALWAYS, + CPath LogFile(CPath::MODULE_DIRECTORY); + LogFile.AppendDirectory(_T("Logs")); + LogFile.SetNameExtension(_T("cpudebug.log")); + + hLogFile = CreateFile(LogFile,GENERIC_WRITE, FILE_SHARE_READ,NULL,CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL); SetFilePointer(hLogFile,0,NULL,FILE_BEGIN); } diff --git a/Source/Project64/N64 System/C Core/Pif.cpp b/Source/Project64/N64 System/C Core/Pif.cpp index 1f3ef5e0c..08d9290a4 100644 --- a/Source/Project64/N64 System/C Core/Pif.cpp +++ b/Source/Project64/N64 System/C Core/Pif.cpp @@ -97,21 +97,12 @@ void LogControllerPakData (char * Description) { int MaxPif2Cmds = 300; unsigned __int64 * Pif2Reply[4]; -char * GetPif2FileName(void) { - char path_buffer[_MAX_PATH], drive[_MAX_DRIVE] ,dir[_MAX_DIR]; - char fname[_MAX_FNAME],ext[_MAX_EXT]; - static char IniFileName[_MAX_PATH]; - - GetModuleFileName(NULL,path_buffer,sizeof(path_buffer)); - _splitpath( path_buffer, drive, dir, fname, ext ); - sprintf(IniFileName,"%s%s%s",drive,dir,"pif2.dat"); - return IniFileName; -} - BOOLEAN pif2valid = FALSE; void LoadPIF2 () { - FILE *pif2db = fopen (GetPif2FileName(), "rt"); + CPath Pif2FileName(CPath::MODULE_DIRECTORY,"pif2.dat"); + + FILE *pif2db = fopen (Pif2FileName, "rt"); // unsigned __int64 p1, p2, r1, r2; char buff[255]; int cnt = 0; diff --git a/Source/Project64/N64 System/Cheat Class.cpp b/Source/Project64/N64 System/Cheat Class.cpp index 612d2e8bf..99d1c9b1c 100644 --- a/Source/Project64/N64 System/Cheat Class.cpp +++ b/Source/Project64/N64 System/Cheat Class.cpp @@ -4,6 +4,8 @@ #include #include +#include "Settings/SettingType/SettingsType-Cheats.h" + enum { WM_EDITCHEAT = WM_USER + 0x120 }; enum { UM_CHANGECODEEXTENSION = WM_USER + 0x121 }; @@ -780,6 +782,7 @@ int CALLBACK CCheats::CheatAddProc (WND_HANDLE hDlg,DWORD uMsg,DWORD wParam, DWO _Settings->SaveStringIndex(Cheat_Notes, _this->m_EditCheat,GetDlgItemStr(hDlg,IDC_NOTES)); _Settings->SaveStringIndex(Cheat_Options, _this->m_EditCheat,Options); _this->RecordCheatValues(hDlg); + CSettingTypeCheats::FlushChanges(); _this->RefreshCheatManager(); } break; @@ -954,7 +957,7 @@ int CALLBACK CCheats::CheatListProc (WND_HANDLE hDlg,DWORD uMsg,DWORD wParam, DW TreeView_GetItem((HWND)_this->m_hCheatTree,&item); _this->ChangeChildrenStatus((WND_HANDLE)TVI_ROOT,false); -// _this->DeleteCheat(item.lParam); + _this->DeleteCheat(item.lParam); _this->RefreshCheatManager(); } break; @@ -1534,6 +1537,70 @@ void CCheats::MenuSetText ( MENU_HANDLE hMenu, int MenuPos, const char * Title, SetMenuItemInfo((HMENU)hMenu,MenuPos,true,&MenuInfo); } +void CCheats::DeleteCheat(int Index) +{ + for (int CheatNo = Index; CheatNo < MaxCheats; CheatNo ++ ) + { + stdstr LineEntry = _Settings->LoadStringIndex(Cheat_Entry,CheatNo + 1); + if (LineEntry.empty()) + { + _Settings->DeleteSettingIndex(Cheat_RangeNotes,CheatNo); + _Settings->DeleteSettingIndex(Cheat_Range,CheatNo); + _Settings->DeleteSettingIndex(Cheat_Options,CheatNo); + _Settings->DeleteSettingIndex(Cheat_Notes,CheatNo); + _Settings->DeleteSettingIndex(Cheat_Extension,CheatNo); + _Settings->DeleteSettingIndex(Cheat_Entry,CheatNo); + _Settings->DeleteSettingIndex(Cheat_Active,CheatNo); + break; + } + stdstr Value; + if (_Settings->LoadStringIndex(Cheat_RangeNotes,CheatNo+1,Value)) + { + _Settings->SaveStringIndex(Cheat_RangeNotes,CheatNo, Value); + } else { + _Settings->DeleteSettingIndex(Cheat_RangeNotes,CheatNo); + } + + if (_Settings->LoadStringIndex(Cheat_Range,CheatNo+1,Value)) + { + _Settings->SaveStringIndex(Cheat_Range,CheatNo, Value); + } else { + _Settings->DeleteSettingIndex(Cheat_Range,CheatNo); + } + + if (_Settings->LoadStringIndex(Cheat_Options,CheatNo+1,Value)) + { + _Settings->SaveStringIndex(Cheat_Options,CheatNo, Value); + } else { + _Settings->DeleteSettingIndex(Cheat_Options,CheatNo); + } + + if (_Settings->LoadStringIndex(Cheat_Notes,CheatNo+1,Value)) + { + _Settings->SaveStringIndex(Cheat_Notes,CheatNo, Value); + } else { + _Settings->DeleteSettingIndex(Cheat_Notes,CheatNo); + } + + if (_Settings->LoadStringIndex(Cheat_Extension,CheatNo+1,Value)) + { + _Settings->SaveStringIndex(Cheat_Extension,CheatNo, Value); + } else { + _Settings->DeleteSettingIndex(Cheat_Extension,CheatNo); + } + + bool bValue; + if (_Settings->LoadBoolIndex(Cheat_Active,CheatNo+1,bValue)) + { + _Settings->SaveBoolIndex(Cheat_Active,CheatNo, bValue); + } else { + _Settings->DeleteSettingIndex(Cheat_Active,CheatNo); + } + _Settings->SaveStringIndex(Cheat_Entry,CheatNo, LineEntry); + } + CSettingTypeCheats::FlushChanges(); +} + void CCheats::ChangeChildrenStatus(WND_HANDLE hParent, bool Checked) { HTREEITEM hItem = TreeView_GetChild((HWND)m_hCheatTree, hParent); if (hItem == NULL) { diff --git a/Source/Project64/N64 System/Cheat Class.h b/Source/Project64/N64 System/Cheat Class.h index 807e01023..e790053ca 100644 --- a/Source/Project64/N64 System/Cheat Class.h +++ b/Source/Project64/N64 System/Cheat Class.h @@ -50,6 +50,7 @@ class CCheats { void RecordCheatValues ( WND_HANDLE hDlg ); bool CheatChanged ( WND_HANDLE hDlg ); bool IsValid16BitCode ( LPCSTR CheatString ) const; + void DeleteCheat(int Index); //Get Information about the Cheat stdstr GetCheatName ( int CheatNo, bool AddExtension ) const; diff --git a/Source/Project64/Project64.dsp b/Source/Project64/Project64.dsp index 1eaa3d2ab..726da02b6 100644 --- a/Source/Project64/Project64.dsp +++ b/Source/Project64/Project64.dsp @@ -386,7 +386,7 @@ SOURCE="N64 System\C Core\C Memory.cpp" # End Source File # Begin Source File -SOURCE="N64 System\C Core\CPU Log.c" +SOURCE=".\N64 System\C Core\CPU Log.cpp" # End Source File # Begin Source File @@ -418,7 +418,7 @@ SOURCE="N64 System\C Core\Interpreter Ops.c" # End Source File # Begin Source File -SOURCE="N64 System\C Core\Logging.c" +SOURCE=".\N64 System\C Core\Logging.cpp" # End Source File # Begin Source File diff --git a/Source/Project64/Settings.h b/Source/Project64/Settings.h index ca0a2ae38..13e233ff2 100644 --- a/Source/Project64/Settings.h +++ b/Source/Project64/Settings.h @@ -13,6 +13,7 @@ enum SettingID { //Support Files SupportFile_Settings, + SupportFile_SettingsDefault, SupportFile_RomDatabase, SupportFile_Cheats, SupportFile_Notes, diff --git a/Source/Project64/Settings/SettingType/SettingsType-Application.cpp b/Source/Project64/Settings/SettingType/SettingsType-Application.cpp index ac81d89ae..5791392f1 100644 --- a/Source/Project64/Settings/SettingType/SettingsType-Application.cpp +++ b/Source/Project64/Settings/SettingType/SettingsType-Application.cpp @@ -52,7 +52,23 @@ CSettingTypeApplication::~CSettingTypeApplication() void CSettingTypeApplication::Initilize( const char * AppName ) { - m_SettingsIniFile = new CIniFile(_Settings->LoadString(SupportFile_Settings).c_str()); + stdstr SettingsFile, OrigSettingsFile; + + for (int i = 0; i < 100; i++) + { + OrigSettingsFile = SettingsFile; + SettingsFile = _Settings->LoadString(SupportFile_Settings); + if (SettingsFile == OrigSettingsFile) + { + break; + } + if (m_SettingsIniFile) + { + delete m_SettingsIniFile; + } + m_SettingsIniFile = new CIniFile(SettingsFile.c_str()); + } while (SettingsFile != OrigSettingsFile); + m_SettingsIniFile->SetAutoFlush(false); m_UseRegistry = _Settings->LoadBool(Setting_UseFromRegistry); } @@ -127,7 +143,12 @@ bool CSettingTypeApplication::Load ( int Index, stdstr & Value ) const bool bRes; if (!m_UseRegistry) { - bRes = m_SettingsIniFile->GetString(SectionName(),m_KeyNameIdex.c_str(),m_DefaultStr,Value); + if (m_SettingsIniFile) + { + bRes = m_SettingsIniFile->GetString(SectionName(),m_KeyNameIdex.c_str(),m_DefaultStr,Value); + } else { + bRes = false; + } } else { Notify().BreakPoint(__FILE__,__LINE__); } diff --git a/Source/Project64/Settings/SettingType/SettingsType-Cheats.cpp b/Source/Project64/Settings/SettingType/SettingsType-Cheats.cpp index c2a1e8867..9ebf64727 100644 --- a/Source/Project64/Settings/SettingType/SettingsType-Cheats.cpp +++ b/Source/Project64/Settings/SettingType/SettingsType-Cheats.cpp @@ -29,6 +29,14 @@ void CSettingTypeCheats::CleanUp ( void ) } } +void CSettingTypeCheats::FlushChanges( void ) +{ + if (m_CheatIniFile) + { + m_CheatIniFile->FlushChanges(); + } +} + void CSettingTypeCheats::GameChanged ( void * /*Data */ ) { m_SectionIdent = _Settings->LoadString(Game_IniKey); @@ -116,5 +124,6 @@ void CSettingTypeCheats::Save ( int Index, const char * Value ) void CSettingTypeCheats::Delete ( int Index ) { - Notify().BreakPoint(__FILE__,__LINE__); + stdstr_f Key("Cheat%d%s",Index,m_PostFix); + m_CheatIniFile->SaveString(m_SectionIdent.c_str(),Key.c_str(),NULL); } diff --git a/Source/Project64/Settings/SettingType/SettingsType-Cheats.h b/Source/Project64/Settings/SettingType/SettingsType-Cheats.h index c8ea134f4..081d1d32b 100644 --- a/Source/Project64/Settings/SettingType/SettingsType-Cheats.h +++ b/Source/Project64/Settings/SettingType/SettingsType-Cheats.h @@ -8,18 +8,6 @@ protected: static CIniFile * m_CheatIniFile; static stdstr m_SectionIdent; const LPCSTR m_PostFix; -/* const LPCSTR m_DefaultStr; - const DWORD m_DefaultValue; - const SettingID m_DefaultSetting; - - stdstr FixSectionName (LPCSTR Section); - - static CIniFile * m_SettingsIniFile; - static bool m_UseRegistry; - const stdstr m_Section; - const stdstr m_KeyName; - - virtual LPCSTR SectionName ( void ) const;*/ static void GameChanged ( void * /*Data */ ); public: @@ -49,7 +37,9 @@ public: virtual void Delete ( int Index ); // Initilize this class to use ini or registry - static void Initilize ( void ); - static void CleanUp ( void ); + static void Initilize ( void ); + static void CleanUp ( void ); + static void FlushChanges ( void ); + }; diff --git a/Source/Project64/Settings/SettingType/SettingsType-GameSettingIndex.cpp b/Source/Project64/Settings/SettingType/SettingsType-GameSettingIndex.cpp index fd94ab39e..ec6f39826 100644 --- a/Source/Project64/Settings/SettingType/SettingsType-GameSettingIndex.cpp +++ b/Source/Project64/Settings/SettingType/SettingsType-GameSettingIndex.cpp @@ -51,7 +51,8 @@ bool CSettingTypeGameIndex::Load ( int Index, stdstr & Value ) const //return the default values void CSettingTypeGameIndex::LoadDefault ( int Index, bool & Value ) const { - Notify().BreakPoint(__FILE__,__LINE__); + m_KeyNameIdex.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str()); + CSettingTypeGame::LoadDefault(0,Value); } void CSettingTypeGameIndex::LoadDefault ( int Index, ULONG & Value ) const @@ -90,5 +91,6 @@ void CSettingTypeGameIndex::Save ( int Index, const char * Value ) void CSettingTypeGameIndex::Delete ( int Index ) { - Notify().BreakPoint(__FILE__,__LINE__); + m_KeyNameIdex.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str()); + CSettingTypeGame::Delete(0); } diff --git a/Source/Project64/Settings/Settings Class.cpp b/Source/Project64/Settings/Settings Class.cpp index 372ea008a..4aef76fdb 100644 --- a/Source/Project64/Settings/Settings Class.cpp +++ b/Source/Project64/Settings/Settings Class.cpp @@ -68,14 +68,16 @@ void CSettings::AddHowToHandleSetting () //Support Files - AddHandler(SupportFile_Settings, new CSettingTypeRelativePath("","Project64.cfg")); - AddHandler(SupportFile_RomDatabase, new CSettingTypeRelativePath("","Project64.rdb")); - AddHandler(SupportFile_Cheats, new CSettingTypeRelativePath("","Project64.cht")); - AddHandler(SupportFile_Notes, new CSettingTypeRelativePath("","Project64.rdn")); - AddHandler(SupportFile_ExtInfo, new CSettingTypeRelativePath("","Project64.rdx")); - AddHandler(SupportFile_ShortCuts, new CSettingTypeRelativePath("","Project64.sc3")); - AddHandler(SupportFile_RomListCache,new CSettingTypeRelativePath("","Project64.cache3")); - AddHandler(SupportFile_7zipCache, new CSettingTypeRelativePath("","Project64.zcache")); + AddHandler(SupportFile_SettingsDefault, new CSettingTypeRelativePath("Config","Project64.cfg")); + AddHandler(SupportFile_Settings, new CSettingTypeApplication("","ConfigFile",SupportFile_SettingsDefault)); + AddHandler(SupportFile_SettingsDefault, new CSettingTypeRelativePath("Config","Project64.cfg")); + AddHandler(SupportFile_RomDatabase, new CSettingTypeRelativePath("Config","Project64.rdb")); + AddHandler(SupportFile_Cheats, new CSettingTypeRelativePath("Config","Project64.cht")); + AddHandler(SupportFile_Notes, new CSettingTypeRelativePath("Config","Project64.rdn")); + AddHandler(SupportFile_ExtInfo, new CSettingTypeRelativePath("Config","Project64.rdx")); + AddHandler(SupportFile_ShortCuts, new CSettingTypeRelativePath("Config","Project64.sc3")); + AddHandler(SupportFile_RomListCache,new CSettingTypeRelativePath("Config","Project64.cache3")); + AddHandler(SupportFile_7zipCache, new CSettingTypeRelativePath("Config","Project64.zcache")); //AddHandler(SyncPluginDir, new CSettingTypeRelativePath("SyncPlugin","")); @@ -279,6 +281,8 @@ void CSettings::AddHowToHandleSetting () AddHandler(Cheat_Extension, new CSettingTypeGameIndex("Cheat",".exten","??? - Not Set")); AddHandler(Cheat_Notes, new CSettingTypeCheats("_N")); AddHandler(Cheat_Options, new CSettingTypeCheats("_O")); + AddHandler(Cheat_Range, new CSettingTypeCheats("_R")); + AddHandler(Cheat_RangeNotes, new CSettingTypeCheats("_RN")); /* INFO(SettingsIniName,Default_None,Data_String,RelativePath,"Project64.cfg","",0); if (SettingsIniFile == NULL) diff --git a/Source/Project64/User Interface/UI Resources.aps b/Source/Project64/User Interface/UI Resources.aps index 68ea8439f..768c034cd 100644 Binary files a/Source/Project64/User Interface/UI Resources.aps and b/Source/Project64/User Interface/UI Resources.aps differ diff --git a/Source/Project64/User Interface/UI Resources.rc b/Source/Project64/User Interface/UI Resources.rc index 17fe0adbd..707b8ae02 100644 --- a/Source/Project64/User Interface/UI Resources.rc +++ b/Source/Project64/User Interface/UI Resources.rc @@ -13,11 +13,11 @@ #undef APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// -// English (Australia) resources +// English (U.S.) resources -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENA) +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) #ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_AUS +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US #pragma code_page(1252) #endif //_WIN32 diff --git a/Source/Project64/main.cpp b/Source/Project64/main.cpp index 037a6c564..ea6b625b6 100644 --- a/Source/Project64/main.cpp +++ b/Source/Project64/main.cpp @@ -5,6 +5,7 @@ #include "Support.h" #include #include "Validate Binary.h" +#include //#pragma comment(linker,"/merge:.rdata=.text") @@ -152,7 +153,13 @@ void LogFlushChanged (CTraceFileLog * LogFile) void InitializeLog ( void) { - CPath LogFilePath(CPath::MODULE_DIRECTORY,_T("Project64.log")); + CPath LogFilePath(CPath::MODULE_DIRECTORY); + LogFilePath.AppendDirectory("Logs"); + if (!LogFilePath.DirectoryExists()) + { + LogFilePath.CreateDirectory(); + } + LogFilePath.SetNameExtension(_T("Project64.log")); CTraceFileLog * LogFile = new CTraceFileLog(LogFilePath, _Settings->LoadDword(Debugger_AppLogFlush) != 0, Log_New); #ifdef VALIDATE_DEBUG @@ -166,11 +173,79 @@ void InitializeLog ( void) _Settings->RegisterChangeCB(Debugger_AppLogFlush,LogFile,(CSettings::SettingChangedFunc)LogFlushChanged); } -int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszArgs, int nWinMode) { +/*bool ChangeDirPermission ( const CPath & Dir) +{ + if (Dir.DirectoryExists()) + { + HANDLE hDir = CreateFile(Dir,READ_CONTROL|WRITE_DAC,0,NULL,OPEN_EXISTING,FILE_FLAG_BACKUP_SEMANTICS,NULL); + if (hDir != INVALID_HANDLE_VALUE) + { + ACL * pOldDACL = NULL; + PSECURITY_DESCRIPTOR pSD = NULL; + + if (GetSecurityInfo(hDir,SE_FILE_OBJECT,DACL_SECURITY_INFORMATION,NULL,NULL,&pOldDACL,NULL,&pSD) == ERROR_SUCCESS) + { + bool bAdd = true; + + PEXPLICIT_ACCESS_W pListOfExplictEntries; + ULONG cCountOfExplicitEntries; + if (GetExplicitEntriesFromAclW(pOldDACL,&cCountOfExplicitEntries,&pListOfExplictEntries) == ERROR_SUCCESS) + { + for (int i = 0; i < cCountOfExplicitEntries; i ++) + { + EXPLICIT_ACCESS_W &ea = pListOfExplictEntries[i]; + if (ea.grfAccessMode != GRANT_ACCESS) { continue; } + if (ea.grfAccessPermissions != GENERIC_ALL) { continue; } + if ((ea.grfInheritance & (CONTAINER_INHERIT_ACE|OBJECT_INHERIT_ACE)) != (CONTAINER_INHERIT_ACE|OBJECT_INHERIT_ACE)) { continue; } + + if (ea.Trustee.TrusteeType == TRUSTEE_IS_SID) + { + + } + bAdd = false; + } + } + + if (bAdd) + { + EXPLICIT_ACCESS ea = {0}; + ea.grfAccessMode = GRANT_ACCESS; + ea.grfAccessPermissions = GENERIC_ALL; + ea.grfInheritance = CONTAINER_INHERIT_ACE|OBJECT_INHERIT_ACE; + ea.Trustee.TrusteeType = TRUSTEE_IS_GROUP; + ea.Trustee.TrusteeForm = TRUSTEE_IS_NAME; + ea.Trustee.ptstrName = TEXT("Users"); + + ACL * pNewDACL = NULL; + SetEntriesInAcl(1,&ea,pOldDACL,&pNewDACL); + + SetSecurityInfo(hDir,SE_FILE_OBJECT,DACL_SECURITY_INFORMATION,NULL,NULL,pNewDACL,NULL); + LocalFree(pNewDACL); + } + LocalFree(pSD); + } + CloseHandle(hDir); + } + } + return true; +}*/ + +void FixDirectories ( void ) +{ + + CPath(CPath::MODULE_DIRECTORY,_T("Config")).CreateDirectory(); + CPath(CPath::MODULE_DIRECTORY,_T("Logs")).CreateDirectory(); + CPath(CPath::MODULE_DIRECTORY,_T("Save")).CreateDirectory(); + CPath(CPath::MODULE_DIRECTORY,_T("Screenshots")).CreateDirectory(); +} + +int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszArgs, int nWinMode) +{ + FixDirectories(); + CoInitialize(NULL); try { - LPCSTR AppName = "Project64 1.7"; _Lang = new CLanguage();