1
0
Fork 0
mirror of https://github.com/eliboa/TegraRcmGUI.git synced 2024-11-24 19:22:04 +00:00
Made a consolidated output path style that seems reasonable, and ignored it from SCM.
Thought the project should build in release mode and found it was over-customized in debug mode.
Also had to fix some random security errors.
Made the build configurations more consistent, and also simplified them, opting now to only enable the env var method that is more flexible and may have been added automatically by the IDE as a successful recommendation.
Simplified README accordingly.
This commit is contained in:
Pysis 2021-09-23 02:22:38 -04:00
parent 5c37ceaa97
commit 6c0fb778f4
5 changed files with 22 additions and 24 deletions

2
.gitignore vendored
View file

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

View file

@ -39,10 +39,7 @@ Please open new [issue](https://github.com/eliboa/TegraRcmGUI/issues) to report
## Development ## Development
Install the [libusbk dev kit](https://sourceforge.net/projects/libusbk/) using the setup program. 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.
If not installed in the default `C:\libusbK-dev-kit` location, then create an encironment variable with the other path as the value.
The project seems to survive a target upgrade from the tools in Visual Studio 2017 to 2019.
Make sure with the library's include files path correct, the actual library name still exists in the Project Settings/Properties > Linker > Input > Additional Dependencies list as `libusbK.lib`.
## How to backup/restore your Nintendo Switch's NAND ? ## How to backup/restore your Nintendo Switch's NAND ?

View file

@ -144,16 +144,16 @@ void DialogTab02::OnBnClickedMountSd()
switch (pmyComboBox->GetCurSel()) switch (pmyComboBox->GetCurSel())
{ {
case 0: 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; break;
case 1: 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; break;
case 2: 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; break;
default: 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; break;
} }

View file

@ -869,10 +869,9 @@ int TegraRcm::Smasher(TCHAR args[4096], BOOL bInheritHandles)
CString csPath2(csPath); CString csPath2(csPath);
csPath.Append(TEXT(".\\TegraRcmSmash.exe ")); csPath.Append(TEXT(".\\TegraRcmSmash.exe "));
TCHAR cmd[4096]; TCHAR cmd[4096];
_tcscpy_s(cmd, csPath); _tcscpy_s(cmd, 4095, csPath);
lstrcat(cmd, args); lstrcat(cmd, args);
SECURITY_ATTRIBUTES sa; SECURITY_ATTRIBUTES sa;
sa.nLength = sizeof(sa); sa.nLength = sizeof(sa);
sa.lpSecurityDescriptor = NULL; sa.lpSecurityDescriptor = NULL;
@ -1126,7 +1125,7 @@ char* TegraRcm::GetRelativeFilename(char *currentDirectory, char *absoluteFilena
if (currentDirectory[0] != absoluteFilename[0]) if (currentDirectory[0] != absoluteFilename[0])
{ {
// not on the same drive, so only absolute filename will do // not on the same drive, so only absolute filename will do
strcpy(relativeFilename, absoluteFilename); strcpy_s(relativeFilename, MAX_FILENAME_LEN, absoluteFilename);
return relativeFilename; return relativeFilename;
} }
// they are on the same drive, find out how much of the current directory // 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... // file name should not have a leading one...
i++; i++;
} }
strcpy(relativeFilename, &absoluteFilename[i]); strcpy_s(relativeFilename, MAX_FILENAME_LEN, &absoluteFilename[i]);
return relativeFilename; return relativeFilename;
} }
// The file is not in a child directory of the current directory, so we // 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; relativeFilename[rfMarker++] = SLASH;
} }
// copy the rest of the filename into the result string // 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; return relativeFilename;
} }

View file

@ -78,12 +78,15 @@
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental> <LinkIncremental>true</LinkIncremental>
<OutDir>$(SolutionDir)\Output\$(Platform)\$(Configuration)\</OutDir>
<IntDir>Output\$(Platform)\$(Configuration)\</IntDir>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental> <LinkIncremental>false</LinkIncremental>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental> <OutDir>$(SolutionDir)\Output\$(Platform)\$(Configuration)\</OutDir>
<IntDir>Output\$(Platform)\$(Configuration)\</IntDir>
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile> <ClCompile>
@ -92,13 +95,13 @@
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_WINDOWS;_CRT_SECURE_NO_WARNINGS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;_WINDOWS;_CRT_SECURE_NO_WARNINGS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>C:\libusbK-dev-kit\includes;$(LIBUSBK_DIR)\includes\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(LIBUSBK_DIR)\includes\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>Version.lib;libusbK.lib</AdditionalDependencies> <AdditionalDependencies>Version.lib;libusbK.lib;%(AdditionalDependencies)</AdditionalDependencies>
<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>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
</Link> </Link>
<Midl> <Midl>
@ -119,14 +122,13 @@
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_WINDOWS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_WINDOWS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>C:\libusbK-dev-kit\includes\;$(LIBUSBK_DIR)\includes\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(LIBUSBK_DIR)\includes\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> <AdditionalLibraryDirectories>$(LIBUSBK_DIR)\bin\lib\$(PlatformShortName.Replace('x64','amd64'))\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>C:\libusbK-dev-kit\bin\lib\amd64\;$(LIBUSBK_DIR)\bin\lib\$(PlatformShortName.Replace('x64','amd64'))\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <AdditionalDependencies>Version.lib;libusbK.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>libusbK.lib</AdditionalDependencies>
</Link> </Link>
<Midl> <Midl>
<MkTypLibCompatible>false</MkTypLibCompatible> <MkTypLibCompatible>false</MkTypLibCompatible>
@ -148,14 +150,14 @@
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;_WINDOWS;_CRT_SECURE_NO_WARNINGS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;_WINDOWS;_CRT_SECURE_NO_WARNINGS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>C:\libusbK-dev-kit\includes;$(LIBUSBK_DIR)\includes\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(LIBUSBK_DIR)\includes\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation> <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> <AdditionalDependencies>Version.lib;libusbK.lib;%(AdditionalDependencies)</AdditionalDependencies>
<UACExecutionLevel>AsInvoker</UACExecutionLevel> <UACExecutionLevel>AsInvoker</UACExecutionLevel>
<EnableUAC>true</EnableUAC> <EnableUAC>true</EnableUAC>