1
0
Fork 0
mirror of https://github.com/eliboa/TegraRcmGUI.git synced 2024-12-28 02:56:02 +00:00

Merge pull request #50 from Pysis868/feature/add-logging-switch

Add logging switch
This commit is contained in:
eliboa 2021-11-14 08:58:21 +01:00 committed by GitHub
commit 2524968059
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 336 additions and 302 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
.vs
Output

View file

@ -37,6 +37,10 @@ For other platforms, you can use :
## Issue / Suggestion
Please open new [issue](https://github.com/eliboa/TegraRcmGUI/issues) to report a bug or submit a suggestion.
## Development
Install the [libusbk dev kit](https://sourceforge.net/projects/libusbk/) using the setup program, then create an environment variable `LIBUSBK_DIR` with the installation path as the value.
## How to backup/restore your Nintendo Switch's NAND ?
1) Use [memloader](https://github.com/rajkosto/memloader) v3 to mount eMMC on your computer

View file

@ -144,16 +144,16 @@ void DialogTab02::OnBnClickedMountSd()
switch (pmyComboBox->GetCurSel())
{
case 0:
_tcscpy(args, TEXT(".\\tools\\memloader\\memloader_usb.bin -r --dataini=.\\tools\\memloader\\ums_boot0.ini"));
_tcscpy_s(args, 255, TEXT(".\\tools\\memloader\\memloader_usb.bin -r --dataini=.\\tools\\memloader\\ums_boot0.ini"));
break;
case 1:
_tcscpy(args, TEXT(".\\tools\\memloader\\memloader_usb.bin -r --dataini=.\\tools\\memloader\\ums_boot1.ini"));
_tcscpy_s(args, 255, TEXT(".\\tools\\memloader\\memloader_usb.bin -r --dataini=.\\tools\\memloader\\ums_boot1.ini"));
break;
case 2:
_tcscpy(args, TEXT(".\\tools\\memloader\\memloader_usb.bin -r --dataini=.\\tools\\memloader\\ums_emmc.ini"));
_tcscpy_s(args, 255, TEXT(".\\tools\\memloader\\memloader_usb.bin -r --dataini=.\\tools\\memloader\\ums_emmc.ini"));
break;
default:
_tcscpy(args, TEXT(".\\tools\\memloader\\memloader_usb.bin -r --dataini=.\\tools\\memloader\\ums_sd.ini"));
_tcscpy_s(args, 255, TEXT(".\\tools\\memloader\\memloader_usb.bin -r --dataini=.\\tools\\memloader\\ums_sd.ini"));
break;
}

View file

@ -45,6 +45,14 @@ BOOL DialogTab03::OnInitDialog()
checkbox->SetCheck(BST_CHECKED);
}
value = m_TegraRcm->GetPreset("LOGGING");
if (value == "TRUE")
{
m_TegraRcm->LOGGING_CURR = TRUE;
CMFCButton* checkbox = (CMFCButton*)GetDlgItem(LOGGING);
checkbox->SetCheck(BST_CHECKED);
}
TCHAR szPath[MAX_PATH];
if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, szPath)))
{
@ -66,6 +74,7 @@ BEGIN_MESSAGE_MAP(DialogTab03, CDialogEx)
ON_BN_CLICKED(MIN_TO_TRAY, &DialogTab03::OnClickedMinToTray)
ON_BN_CLICKED(ID_INSTALL_DRIVER, &DialogTab03::OnBnClickedInstallDriver)
ON_BN_CLICKED(RUN_WINSTART, &DialogTab03::OnBnClickedWinstart)
ON_BN_CLICKED(LOGGING, &DialogTab03::OnClickedLogging)
//ON_BN_CLICKED(IDC_BUTTON2, &DialogTab03::OnBnClickedButton2)
END_MESSAGE_MAP()
@ -113,6 +122,20 @@ void DialogTab03::OnClickedMinToTray()
}
void DialogTab03::OnClickedLogging()
{
// Get Minimize to tray checkbox value (checked, unchecked)
CButton* m_ctlCheck = (CButton*)GetDlgItem(LOGGING);
BOOL IsCheckChecked = (m_ctlCheck->GetCheck() == 1) ? true : false;
if (m_TegraRcm->LOGGING_CURR != IsCheckChecked)
{
if (IsCheckChecked) m_TegraRcm->SetPreset("LOGGING", "TRUE");
else m_TegraRcm->SetPreset("LOGGING", "FALSE");
m_TegraRcm->LOGGING_CURR = IsCheckChecked;
}
}
void DialogTab03::OnBnClickedInstallDriver()
{
m_TegraRcm->InstallDriver();

View file

@ -44,6 +44,7 @@ public:
afx_msg void OnClickedMinToTray();
afx_msg void OnBnClickedInstallDriver();
afx_msg void OnBnClickedWinstart();
afx_msg void OnClickedLogging();
void CreateLink();
afx_msg void CleanRegestry();

View file

@ -37,6 +37,7 @@ TegraRcm::TegraRcm(CDialog* pParent /*=NULL*/)
{
m_Parent = pParent;
m_hWnd = AfxGetMainWnd()->GetSafeHwnd();
this->LOGGING_CURR = GetPreset("LOGGING") == "TRUE";
GetFavorites();
//SendUserMessage("Waiting for device in RCM mode");
}
@ -543,8 +544,7 @@ void TegraRcm::SaveFavorites()
void TegraRcm::AppendLog(string message)
{
// DISABLED
return;
if (!this->LOGGING_CURR) return;
// Get time
@ -869,10 +869,9 @@ int TegraRcm::Smasher(TCHAR args[4096], BOOL bInheritHandles)
CString csPath2(csPath);
csPath.Append(TEXT(".\\TegraRcmSmash.exe "));
TCHAR cmd[4096];
_tcscpy_s(cmd, csPath);
_tcscpy_s(cmd, 4095, csPath);
lstrcat(cmd, args);
SECURITY_ATTRIBUTES sa;
sa.nLength = sizeof(sa);
sa.lpSecurityDescriptor = NULL;
@ -1126,7 +1125,7 @@ char* TegraRcm::GetRelativeFilename(char *currentDirectory, char *absoluteFilena
if (currentDirectory[0] != absoluteFilename[0])
{
// not on the same drive, so only absolute filename will do
strcpy(relativeFilename, absoluteFilename);
strcpy_s(relativeFilename, MAX_FILENAME_LEN, absoluteFilename);
return relativeFilename;
}
// they are on the same drive, find out how much of the current directory
@ -1147,7 +1146,7 @@ char* TegraRcm::GetRelativeFilename(char *currentDirectory, char *absoluteFilena
// file name should not have a leading one...
i++;
}
strcpy(relativeFilename, &absoluteFilename[i]);
strcpy_s(relativeFilename, MAX_FILENAME_LEN, &absoluteFilename[i]);
return relativeFilename;
}
// The file is not in a child directory of the current directory, so we
@ -1192,6 +1191,6 @@ char* TegraRcm::GetRelativeFilename(char *currentDirectory, char *absoluteFilena
relativeFilename[rfMarker++] = SLASH;
}
// copy the rest of the filename into the result string
strcpy(&relativeFilename[rfMarker], &absoluteFilename[afMarker]);
strcpy_s(&relativeFilename[rfMarker], MAX_FILENAME_LEN, &absoluteFilename[afMarker]);
return relativeFilename;
}

View file

@ -72,6 +72,7 @@ public:
BOOL WAITING_RECONNECT = FALSE;
BOOL ASK_FOR_DRIVER = FALSE;
BOOL MIN_TO_TRAY_CURR = FALSE;
BOOL LOGGING_CURR = FALSE;
CString csPath;
COLORREF LabelColor = RGB(0, 0, 0);

Binary file not shown.

View file

@ -22,13 +22,13 @@
<ProjectGuid>{2C091C5B-378F-44D0-91F2-53489BA7B83C}</ProjectGuid>
<RootNamespace>TegraRcmGUI</RootNamespace>
<Keyword>MFCProj</Keyword>
<WindowsTargetPlatformVersion>10.0.14393.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<UseOfMfc>Dynamic</UseOfMfc>
</PropertyGroup>
@ -38,12 +38,12 @@
<WholeProgramOptimization>false</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<UseOfMfc>Dynamic</UseOfMfc>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<UseOfMfc>Dynamic</UseOfMfc>
</PropertyGroup>
@ -53,7 +53,7 @@
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<UseOfMfc>Dynamic</UseOfMfc>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
@ -78,12 +78,15 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<OutDir>$(SolutionDir)\Output\$(Platform)\$(Configuration)\</OutDir>
<IntDir>Output\$(Platform)\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)\Output\$(Platform)\$(Configuration)\</OutDir>
<IntDir>Output\$(Platform)\$(Configuration)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
@ -92,13 +95,13 @@
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_WINDOWS;_CRT_SECURE_NO_WARNINGS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>C:\libusbK-dev-kit\includes;$(LIBUSBK_DIR)\includes\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(LIBUSBK_DIR)\includes\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>Version.lib;libusbK.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>C:\libusbK-dev-kit\bin\lib\x86;$(LIBUSBK_DIR)\bin\lib\$(PlatformShortName.Replace('x64','amd64'))\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>Version.lib;libusbK.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(LIBUSBK_DIR)\bin\lib\$(PlatformShortName.Replace('x64','amd64'))\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
</Link>
<Midl>
@ -119,13 +122,13 @@
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_WINDOWS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>C:\libusbK-dev-kit\includes\;$(LIBUSBK_DIR)\includes\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(LIBUSBK_DIR)\includes\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
<AdditionalLibraryDirectories>C:\libusbK-dev-kit\bin\lib\amd64\;$(LIBUSBK_DIR)\bin\lib\$(PlatformShortName.Replace('x64','amd64'))\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>$(LIBUSBK_DIR)\bin\lib\$(PlatformShortName.Replace('x64','amd64'))\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>Version.lib;libusbK.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<Midl>
<MkTypLibCompatible>false</MkTypLibCompatible>
@ -147,14 +150,14 @@
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;_WINDOWS;_CRT_SECURE_NO_WARNINGS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>C:\libusbK-dev-kit\includes;$(LIBUSBK_DIR)\includes\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(LIBUSBK_DIR)\includes\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>C:\libusbK-dev-kit\bin\lib\x86;$(LIBUSBK_DIR)\bin\lib\$(PlatformShortName.Replace('x64','amd64'))\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>$(LIBUSBK_DIR)\bin\lib\$(PlatformShortName.Replace('x64','amd64'))\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>Version.lib;libusbK.lib;%(AdditionalDependencies)</AdditionalDependencies>
<UACExecutionLevel>AsInvoker</UACExecutionLevel>
<EnableUAC>true</EnableUAC>

View file

@ -101,6 +101,10 @@ END_MESSAGE_MAP()
//
BOOL CTegraRcmGUIDlg::OnInitDialog()
{
m_TegraRcm = new TegraRcm(this);
m_TegraRcm->AppendLog("new TegraRcm()");
CDialog::OnInitDialog();
// Accessibility
@ -187,9 +191,6 @@ BOOL CTegraRcmGUIDlg::OnInitDialog()
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
m_TegraRcm = new TegraRcm(this);
m_TegraRcm->AppendLog("new TegraRcm()");
// Kill other running process of app
m_TegraRcm->KillRunningProcess(TEXT("TegraRcmGUI.exe"));

Binary file not shown.