Skip to content

Commit

Permalink
Update to version 1.2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
dude719 committed Feb 24, 2018
1 parent 04fac31 commit 6daa92a
Show file tree
Hide file tree
Showing 14 changed files with 279 additions and 259 deletions.
3 changes: 1 addition & 2 deletions ReClass/CMainFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -445,8 +445,7 @@ BOOL CMainFrame::OnCmdMsg( UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO
if ((nID >= WM_CLASSMENU) && (nID < (WM_CLASSMENU + WM_MAXITEMS)))
{
pChildClassFrame = STATIC_DOWNCAST( CClassFrame,
CreateNewChild( RUNTIME_CLASS( CClassFrame ),
IDR_ReClass2016TYPE, g_ReClassApp.m_hMDIMenu, g_ReClassApp.m_hMDIAccel ) );
CreateNewChild( RUNTIME_CLASS( CClassFrame ), IDR_ReClassExTYPE, g_ReClassApp.m_hMdiMenu, g_ReClassApp.m_hMdiAccel ) );

pClass = g_ReClassApp.m_Classes[nID - WM_CLASSMENU];

Expand Down
64 changes: 32 additions & 32 deletions ReClass/DialogAbout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,43 +4,43 @@
// For Utils::GetVersionInfo
#pragma comment(lib, "version.lib")

CDialogAbout::CDialogAbout() : CDialogEx(CDialogAbout::IDD)
{
CDialogAbout::CDialogAbout( ) : CDialogEx( CDialogAbout::IDD )
{
}

BEGIN_MESSAGE_MAP(CDialogAbout, CDialogEx)
END_MESSAGE_MAP()
BEGIN_MESSAGE_MAP( CDialogAbout, CDialogEx )
END_MESSAGE_MAP( )

void CDialogAbout::DoDataExchange(CDataExchange * pDX)
void CDialogAbout::DoDataExchange( CDataExchange * pDX )
{
CDialogEx::DoDataExchange(pDX);
CDialogEx::DoDataExchange( pDX );
}

BOOL CDialogAbout::OnInitDialog()
BOOL CDialogAbout::OnInitDialog( )
{
CDialogEx::OnInitDialog();

CString cstring_temp;
cstring_temp.Format(_T("Build Date: %s - %s"), _T(__DATE__), _T(__TIME__));
SetDlgItemText(IDC_ABOUT_BUILD_DATE, cstring_temp);
CString strReclassVersion = Utils::GetVersionInfo(_T("FileVersion"));
cstring_temp.Format(_T("Version: %s"), strReclassVersion);
SetDlgItemText(IDC_ABOUT_BUILD_VERSION, cstring_temp);
CString authors;
authors.LoadString( IDS_AUTHOR_STRING );
SetDlgItemText( IDC_ABOUT_AUTHORS, authors );

CString strLegalCopyright = Utils::GetVersionInfo(_T("LegalCopyright"));
cstring_temp.Format(_T(
"The MIT License (MIT)\r\n\r\n"
"%s %s\r\n\r\n"
"Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files(the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and / or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\r\n\r\n"
"The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\r\n\r\n"
"THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n"
), strLegalCopyright, authors);
SetDlgItemText(IDC_ABOUT_LICENSE, cstring_temp);

SetFocus( );

return TRUE;
CDialogEx::OnInitDialog( );

CString strTemp;
strTemp.Format( _T( "Build Date: %s - %s" ), _T( __DATE__ ), _T( __TIME__ ) );
SetDlgItemText( IDC_ABOUT_BUILD_DATE, strTemp );
CString strReclassVersion = Utils::GetVersionInfo( _T( "FileVersion" ) );
strTemp.Format( _T( "Version: %s" ), strReclassVersion.GetString( ) );
SetDlgItemText( IDC_ABOUT_BUILD_VERSION, strTemp );
CString authors;
authors.LoadString( IDS_AUTHOR_STRING );
SetDlgItemText( IDC_ABOUT_AUTHORS, authors );

CString strLegalCopyright = Utils::GetVersionInfo( _T( "LegalCopyright" ) );
strTemp.Format( _T(
"The MIT License (MIT)\r\n\r\n"
"%s %s\r\n\r\n"
"Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files(the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and / or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\r\n\r\n"
"The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\r\n\r\n"
"THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n"
), strLegalCopyright, authors );
SetDlgItemText( IDC_ABOUT_LICENSE, strTemp );

SetFocus( );

return TRUE;
}
3 changes: 1 addition & 2 deletions ReClass/DialogClasses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,7 @@ void CDialogClasses::OnOK( )
else
{
CClassFrame* pNewChildClassFrame = STATIC_DOWNCAST( CClassFrame,
pMainFrame->CreateNewChild( RUNTIME_CLASS( CClassFrame ),
IDR_ReClass2016TYPE, g_ReClassApp.m_hMDIMenu, g_ReClassApp.m_hMDIAccel ) );
pMainFrame->CreateNewChild( RUNTIME_CLASS( CClassFrame ), IDR_ReClassExTYPE, g_ReClassApp.m_hMdiMenu, g_ReClassApp.m_hMdiAccel ) );
pNewChildClassFrame->SetClass( g_ReClassApp.m_Classes[nItem] );
pNewChildClassFrame->SetTitle( g_ReClassApp.m_Classes[nItem]->GetName( ) );
pNewChildClassFrame->SetWindowText( g_ReClassApp.m_Classes[nItem]->GetName( ) );
Expand Down
22 changes: 10 additions & 12 deletions ReClass/DialogModules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,10 @@ inline int CDialogModules::FindModuleByName( const TCHAR* szName )
return -1;
}

__inline CNodeClass* CDialogModules::GetClassByName( const TCHAR* szClassName )
inline CNodeClass* CDialogModules::GetClassByName( const TCHAR* szClassName )
{
auto iter = std::find_if( g_ReClassApp.m_Classes.begin( ), g_ReClassApp.m_Classes.end( ),
[szClassName] ( const CNodeClass* value ) -> bool { return (value->GetName( ).CompareNoCase( szClassName ) == 0); } );
[szClassName] ( const CNodeClass* pNode ) -> bool { return (pNode->GetName( ).CompareNoCase( szClassName ) == 0); } );
return (iter != g_ReClassApp.m_Classes.end( )) ? *iter : NULL;
}

Expand Down Expand Up @@ -178,8 +178,7 @@ void CDialogModules::SetSelected( )
else
{
CClassFrame* pNewChildClassFrame = STATIC_DOWNCAST( CClassFrame,
pMainFrame->CreateNewChild( RUNTIME_CLASS( CClassFrame ),
IDR_ReClass2016TYPE, g_ReClassApp.m_hMDIMenu, g_ReClassApp.m_hMDIAccel ) );
pMainFrame->CreateNewChild( RUNTIME_CLASS( CClassFrame ), IDR_ReClassExTYPE, g_ReClassApp.m_hMdiMenu, g_ReClassApp.m_hMdiAccel ) );

pNewChildClassFrame->SetClass( pNewClass );
pNewChildClassFrame->SetTitle( pNewClass->GetName( ) );
Expand All @@ -194,14 +193,13 @@ void CDialogModules::SetSelected( )
{
CMainFrame* pMainFrame = static_cast<CMainFrame*>(AfxGetApp( )->m_pMainWnd);
CClassFrame* pChildClassFrame = STATIC_DOWNCAST( CClassFrame,
pMainFrame->CreateNewChild( RUNTIME_CLASS( CClassFrame ),
IDR_ReClass2016TYPE, g_ReClassApp.m_hMDIMenu, g_ReClassApp.m_hMDIAccel ));
pMainFrame->CreateNewChild( RUNTIME_CLASS( CClassFrame ), IDR_ReClassExTYPE, g_ReClassApp.m_hMdiMenu, g_ReClassApp.m_hMdiAccel ));

pNewClass = new CNodeClass;
pNewClass->SetName( ClassName );

TCHAR strStart[64];
_stprintf( strStart, _T( "%IX" ), mod.Start );
_stprintf_s( strStart, 64, _T( "%IX" ), mod.Start );
pNewClass->SetOffsetString( strStart );
pNewClass->SetOffset( mod.Start );
pNewClass->m_pChildClassFrame = pChildClassFrame;
Expand Down Expand Up @@ -230,12 +228,12 @@ void CDialogModules::SetSelected( )

int CALLBACK CDialogModules::CompareFunction( LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort )
{
COMPARESTRUCT* compare = (COMPARESTRUCT*)lParamSort;
if (compare)
LPCOMPARESTRUCT Compare = (LPCOMPARESTRUCT)lParamSort;
if (Compare)
{
CListCtrl* pListCtrl = (CListCtrl*)compare->pListCtrl;
int column = compare->iColumn;
bool ascending = compare->bAscending;
CListCtrl* pListCtrl = (CListCtrl*)Compare->pListCtrl;
int column = Compare->iColumn;
bool ascending = Compare->bAscending;

int item1 = ascending ? static_cast<int>(lParam1) : static_cast<int>(lParam2);
int item2 = ascending ? static_cast<int>(lParam2) : static_cast<int>(lParam1);
Expand Down
5 changes: 2 additions & 3 deletions ReClass/DialogModules.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,11 @@ class CDialogModules : public CDialogEx
int FindModuleByName( const TCHAR* szName );
CNodeClass* GetClassByName( const TCHAR* szClassName );

typedef struct COMPARESTRUCT
{
typedef struct _COMPARESTRUCT {
CListCtrl* pListCtrl;
int iColumn;
bool bAscending;
} *LPCOMPARESTRUCT;
} COMPARESTRUCT, *LPCOMPARESTRUCT;

static int CALLBACK CompareFunction( LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort );

Expand Down
14 changes: 5 additions & 9 deletions ReClass/PluginAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ LoadPlugins(

PluginSettingDlgFunction = (DLGPROC)GetProcAddress( PluginBase, "PluginSettingsDlg" );

Plugin = new RECLASS_PLUGIN;
Plugin = (PRECLASS_PLUGIN)_aligned_malloc( sizeof( RECLASS_PLUGIN ), 16 );
wcscpy_s( Plugin->FileName, FileData.cFileName );
Plugin->LoadedBase = PluginBase;
Plugin->InitFunction = PluginInitFunction;
Expand All @@ -78,17 +78,13 @@ LoadPlugins(

if (PluginInitFunction( &Plugin->Info ))
{
#ifdef UNICODE
Plugin->State = g_ReClassApp.GetProfileInt( L"PluginState", Plugin->Info.Name, 1 ) == 1;
#else
Plugin->State = g_ReClassApp.GetProfileInt( "PluginState", CW2A( Plugin->Info.Name ), 1 ) == 1;
#endif
Plugin->State = g_ReClassApp.GetProfileIntW( L"PluginState", Plugin->Info.Name, 1 ) == 1;

if (Plugin->Info.DialogId == -1)
Plugin->SettingDlgFunction = nullptr;
Plugin->SettingDlgFunction = NULL;

PrintOut( _T( "Loaded plugin %s (%ls version %ls) - %ls" ), FileData.cFileName, Plugin->Info.Name, Plugin->Info.Version, Plugin->Info.About );
if (Plugin->StateChangeFunction != nullptr)
if (Plugin->StateChangeFunction)
Plugin->StateChangeFunction( Plugin->State );

g_LoadedPlugins.push_back( Plugin );
Expand All @@ -110,7 +106,7 @@ UnloadPlugins(
for (PRECLASS_PLUGIN Plugin : g_LoadedPlugins)
{
FreeLibrary( Plugin->LoadedBase );
delete Plugin;
_aligned_free( Plugin );
}
g_LoadedPlugins.clear( );
}
Expand Down
76 changes: 50 additions & 26 deletions ReClass/ReClassEx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,9 @@ BOOL CReClassExApp::InitInstance( )
g_ViewFontName = _T( "Terminal" );

HINSTANCE hInst = AfxGetInstanceHandle( );
m_hMDIMenu = ::LoadMenu( hInst, MAKEINTRESOURCE( IDR_ReClass2016TYPE ) );
m_hMDIAccel = ::LoadAccelerators( hInst, MAKEINTRESOURCE( IDR_ReClass2016TYPE ) );

m_hMdiMenu = ::LoadMenu( hInst, MAKEINTRESOURCE( IDR_ReClassExTYPE ) );
m_hMdiAccel = ::LoadAccelerators( hInst, MAKEINTRESOURCE( IDR_ReClassExTYPE ) );

#define PushIcon(id) g_Icons.emplace_back(::LoadIcon(hInst, MAKEINTRESOURCE(id)));
PushIcon( IDI_ICON_OPEN );
Expand Down Expand Up @@ -220,26 +221,30 @@ BOOL CReClassExApp::InitInstance( )
PushIcon( IDI_ICON_CAMERA );
#undef PushIcon

CMainFrame* pFrame = new CMainFrame( );
if (!pFrame || !pFrame->LoadFrame( IDR_MAINFRAME ))
CMainFrame* pMainFrame = new CMainFrame( );
if (!pMainFrame || !pMainFrame->LoadFrame( IDR_MAINFRAME ))
return FALSE;

m_pMainWnd = pFrame;
m_pMainWnd = pMainFrame;

pFrame->m_hMenuDefault = m_hMDIMenu;
pFrame->m_hAccelTable = m_hMDIAccel;
pMainFrame->m_hMenuDefault = m_hMdiMenu;
pMainFrame->m_hAccelTable = m_hMdiAccel;

pFrame->ShowWindow( m_nCmdShow );
pFrame->UpdateWindow( );
pMainFrame->ShowWindow( m_nCmdShow );
pMainFrame->UpdateWindow( );

//
// Fix for 4k monitors
//
ResizeMemoryFont( g_FontWidth, g_FontHeight );

g_hProcess = NULL;
g_ProcessID = NULL;
g_AttachedProcessAddress = NULL;

//
// Initialize the Scintilla editor
//
if (!Scintilla_RegisterClasses( m_hInstance ))
{
AfxMessageBox( _T( "Scintilla failed to initiailze" ) );
Expand Down Expand Up @@ -273,14 +278,26 @@ BOOL CReClassExApp::InitInstance( )

int CReClassExApp::ExitInstance( )
{
//
// Unload any loaded plugins
//
UnloadPlugins( );

//
// Free resources
if (m_hMDIMenu != NULL)
FreeResource( m_hMDIMenu );

if (m_hMDIAccel != NULL)
FreeResource( m_hMDIAccel );

//
if (m_hMdiMenu != NULL)
{
FreeResource( m_hMdiMenu );
m_hMdiMenu = NULL;
}

if (m_hMdiAccel != NULL)
{
FreeResource( m_hMdiAccel );
m_hMdiAccel = NULL;
}

if (m_pConsole)
{
delete m_pConsole;
Expand All @@ -297,10 +314,12 @@ int CReClassExApp::ExitInstance( )

//
// Release Scintilla
//
Scintilla_ReleaseResources( );

//
// Write settings to profile
//
WriteProfileString( _T( "Typedefs" ), _T( "Hex" ), g_tdHex );
WriteProfileString( _T( "Typedefs" ), _T( "Int64" ), g_tdInt64 );
WriteProfileString( _T( "Typedefs" ), _T( "Int32" ), g_tdInt32 );
Expand Down Expand Up @@ -352,11 +371,10 @@ int CReClassExApp::ExitInstance( )

WriteProfileInt( _T( "Class Generation" ), _T( "PrivatePadding" ), g_bPrivatePadding );
WriteProfileInt( _T( "Class Generation" ), _T( "ClipboardCopy" ), g_bClipboardCopy );

//
// Unload any loaded plugins
UnloadPlugins( );


//
// Exit application instance.
//
return CWinAppEx::ExitInstance( );
}

Expand Down Expand Up @@ -436,10 +454,13 @@ void CReClassExApp::CalcAllOffsets( )
void CReClassExApp::OnFileNew( )
{
CMainFrame* pMainFrame = STATIC_DOWNCAST( CMainFrame, m_pMainWnd );
CClassFrame* pChildClassFrame = STATIC_DOWNCAST( CClassFrame, pMainFrame->CreateNewChild( RUNTIME_CLASS( CClassFrame ), IDR_ReClass2016TYPE, m_hMDIMenu, m_hMDIAccel ) );
CNodeClass* pClass = new CNodeClass;

pClass->m_pChildClassFrame = pChildClassFrame;

CClassFrame* pChildClassFrame = STATIC_DOWNCAST( CClassFrame,
pMainFrame->CreateNewChild( RUNTIME_CLASS( CClassFrame ), IDR_ReClassExTYPE, m_hMdiMenu, m_hMdiAccel ) );

CNodeClass* pClass = new CNodeClass;

pClass->m_pChildClassFrame = pChildClassFrame;
pChildClassFrame->SetClass( pClass );
g_ReClassApp.m_Classes.push_back( pClass );

Expand Down Expand Up @@ -592,8 +613,11 @@ bool CReClassExApp::IsNodeValid( CNodeBase* pCheckNode )
void CReClassExApp::OnButtonNewClass( )
{
CMainFrame* pMainFrame = STATIC_DOWNCAST( CMainFrame, m_pMainWnd );
CClassFrame* pChildClassFrame = STATIC_DOWNCAST( CClassFrame, pMainFrame->CreateNewChild( RUNTIME_CLASS( CClassFrame ), IDR_ReClass2016TYPE, m_hMDIMenu, m_hMDIAccel ) );
CNodeClass* pNewClass = new CNodeClass;

CClassFrame* pChildClassFrame = STATIC_DOWNCAST( CClassFrame,
pMainFrame->CreateNewChild( RUNTIME_CLASS( CClassFrame ), IDR_ReClassExTYPE, m_hMdiMenu, m_hMdiAccel ) );

CNodeClass* pNewClass = new CNodeClass;

pNewClass->SetChildClassFrame( pChildClassFrame );
pNewClass->m_Idx = g_ReClassApp.m_Classes.size( );
Expand Down
4 changes: 2 additions & 2 deletions ReClass/ReClassEx.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ class CReClassExApp : public CWinAppEx

void SaveXML( TCHAR* FileName );

HMENU m_hMDIMenu;
HACCEL m_hMDIAccel;
HMENU m_hMdiMenu;
HACCEL m_hMdiAccel;

UINT m_nAppLook;
BOOL m_bHiColorIcons;
Expand Down
Binary file modified ReClass/ReClassEx.rc
Binary file not shown.
Binary file modified ReClass/Resource.h
Binary file not shown.

0 comments on commit 6daa92a

Please sign in to comment.