diff --git a/NXTools.sln b/NXTools.sln index 57de5b8..ade6849 100644 --- a/NXTools.sln +++ b/NXTools.sln @@ -37,10 +37,13 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nstool", "programs\nstool\nstool.vcxproj", "{AF09FA96-4463-417D-8FE6-526063F41349}" ProjectSection(ProjectDependencies) = postProject {CF01B5B7-730A-447F-9BB2-5EDA9B082177} = {CF01B5B7-730A-447F-9BB2-5EDA9B082177} + {738CB4FC-CD9E-4B81-A04B-DEADBFA71C63} = {738CB4FC-CD9E-4B81-A04B-DEADBFA71C63} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcompress", "lib\libcompress\libcompress.vcxproj", "{CF01B5B7-730A-447F-9BB2-5EDA9B082177}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libnx-hb", "lib\libnx-hb\libnx-hb.vcxproj", "{738CB4FC-CD9E-4B81-A04B-DEADBFA71C63}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x64 = Debug|x64 @@ -97,6 +100,14 @@ Global {CF01B5B7-730A-447F-9BB2-5EDA9B082177}.Release|x64.Build.0 = Release|x64 {CF01B5B7-730A-447F-9BB2-5EDA9B082177}.Release|x86.ActiveCfg = Release|Win32 {CF01B5B7-730A-447F-9BB2-5EDA9B082177}.Release|x86.Build.0 = Release|Win32 + {738CB4FC-CD9E-4B81-A04B-DEADBFA71C63}.Debug|x64.ActiveCfg = Debug|x64 + {738CB4FC-CD9E-4B81-A04B-DEADBFA71C63}.Debug|x64.Build.0 = Debug|x64 + {738CB4FC-CD9E-4B81-A04B-DEADBFA71C63}.Debug|x86.ActiveCfg = Debug|Win32 + {738CB4FC-CD9E-4B81-A04B-DEADBFA71C63}.Debug|x86.Build.0 = Debug|Win32 + {738CB4FC-CD9E-4B81-A04B-DEADBFA71C63}.Release|x64.ActiveCfg = Release|x64 + {738CB4FC-CD9E-4B81-A04B-DEADBFA71C63}.Release|x64.Build.0 = Release|x64 + {738CB4FC-CD9E-4B81-A04B-DEADBFA71C63}.Release|x86.ActiveCfg = Release|Win32 + {738CB4FC-CD9E-4B81-A04B-DEADBFA71C63}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -108,6 +119,7 @@ Global {7BE99936-0D40-410D-944B-4513C2EFF8DC} = {170B4A09-1B67-4A62-93AB-116EBCFF4A8C} {AF09FA96-4463-417D-8FE6-526063F41349} = {E0863FCC-8E72-490D-BE1B-458F12CA8298} {CF01B5B7-730A-447F-9BB2-5EDA9B082177} = {170B4A09-1B67-4A62-93AB-116EBCFF4A8C} + {738CB4FC-CD9E-4B81-A04B-DEADBFA71C63} = {170B4A09-1B67-4A62-93AB-116EBCFF4A8C} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {07DCCACC-D10D-47C9-85AE-FB9C54DB7D62} diff --git a/lib/libnx-hb/libnx-hb.vcxproj b/lib/libnx-hb/libnx-hb.vcxproj new file mode 100644 index 0000000..927d5d9 --- /dev/null +++ b/lib/libnx-hb/libnx-hb.vcxproj @@ -0,0 +1,135 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 15.0 + {738CB4FC-CD9E-4B81-A04B-DEADBFA71C63} + libnxhb + 10.0.16299.0 + + + + StaticLibrary + true + v141 + MultiByte + + + StaticLibrary + false + v141 + true + MultiByte + + + StaticLibrary + true + v141 + MultiByte + + + StaticLibrary + false + v141 + true + MultiByte + + + + + + + + + + + + + + + + + + + + + + + Level3 + MaxSpeed + true + true + true + true + ..\libfnd\include;..\libcrypto\include;..\libnx\include;..\libnx-hb\include; + + + true + true + + + + + Level3 + Disabled + true + true + ..\libfnd\include;..\libcrypto\include;..\libnx\include;..\libnx-hb\include; + + + + + Level3 + Disabled + true + true + ..\libfnd\include;..\libcrypto\include;..\libnx\include;..\libnx-hb\include; + + + + + Level3 + MaxSpeed + true + true + true + true + ..\libfnd\include;..\libcrypto\include;..\libnx\include;..\libnx-hb\include; + + + true + true + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/lib/libnx-hb/libnx-hb.vcxproj.filters b/lib/libnx-hb/libnx-hb.vcxproj.filters new file mode 100644 index 0000000..01df9d5 --- /dev/null +++ b/lib/libnx-hb/libnx-hb.vcxproj.filters @@ -0,0 +1,36 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Header Files + + + Header Files + + + Header Files + + + + + Source Files + + + + + + \ No newline at end of file diff --git a/lib/libnx-hb/libnx-hb.vcxproj.user b/lib/libnx-hb/libnx-hb.vcxproj.user new file mode 100644 index 0000000..be25078 --- /dev/null +++ b/lib/libnx-hb/libnx-hb.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/lib/libnx/nx.vcxproj b/lib/libnx/nx.vcxproj index dcd2072..87b23d0 100644 --- a/lib/libnx/nx.vcxproj +++ b/lib/libnx/nx.vcxproj @@ -56,6 +56,7 @@ + @@ -104,6 +105,7 @@ + diff --git a/lib/libnx/nx.vcxproj.filters b/lib/libnx/nx.vcxproj.filters index d4d2667..bd88b48 100644 --- a/lib/libnx/nx.vcxproj.filters +++ b/lib/libnx/nx.vcxproj.filters @@ -174,6 +174,9 @@ Header Files + + Header Files + @@ -260,6 +263,9 @@ Source Files + + Source Files + Source Files diff --git a/programs/nstool/nstool.vcxproj b/programs/nstool/nstool.vcxproj index 1d211b8..565e8ae 100644 --- a/programs/nstool/nstool.vcxproj +++ b/programs/nstool/nstool.vcxproj @@ -90,7 +90,7 @@ true _DEBUG;_CONSOLE;%(PreprocessorDefinitions) true - ..\..\lib\libfnd\include;..\..\lib\libcompress\include;..\..\lib\libcrypto\include;..\..\lib\libnx\include + ..\..\lib\libfnd\include;..\..\lib\libcompress\include;..\..\lib\libcrypto\include;..\..\lib\libnx\include;..\..\lib\libnx-hb\include Console @@ -105,7 +105,7 @@ true WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) true - ..\..\lib\libfnd\include;..\..\lib\libcompress\include;..\..\lib\libcrypto\include;..\..\lib\libnx\include + ..\..\lib\libfnd\include;..\..\lib\libcompress\include;..\..\lib\libcrypto\include;..\..\lib\libnx\include;..\..\lib\libnx-hb\include Console @@ -122,7 +122,7 @@ true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true - ..\..\lib\libfnd\include;..\..\lib\libcompress\include;..\..\lib\libcrypto\include;..\..\lib\libnx\include + ..\..\lib\libfnd\include;..\..\lib\libcompress\include;..\..\lib\libcrypto\include;..\..\lib\libnx\include;..\..\lib\libnx-hb\include Console @@ -141,7 +141,7 @@ true NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true - ..\..\lib\libfnd\include;..\..\lib\libcompress\include;..\..\lib\libcrypto\include;..\..\lib\libnx\include + ..\..\lib\libfnd\include;..\..\lib\libcompress\include;..\..\lib\libcrypto\include;..\..\lib\libnx\include;..\..\lib\libnx-hb\include Console @@ -160,29 +160,36 @@ {4d27edb9-5110-44fe-8ce2-d46c5ad3c55b} + + {738cb4fc-cd9e-4b81-a04b-deadbfa71c63} + {91ba9e79-8242-4f7d-b997-0dfec95ea22b} + + + + @@ -190,10 +197,12 @@ + + diff --git a/programs/nstool/nstool.vcxproj.filters b/programs/nstool/nstool.vcxproj.filters index 558275e..d9bc781 100644 --- a/programs/nstool/nstool.vcxproj.filters +++ b/programs/nstool/nstool.vcxproj.filters @@ -60,6 +60,15 @@ Header Files + + Header Files + + + Header Files + + + Header Files + @@ -104,6 +113,15 @@ Source Files + + Source Files + + + Source Files + + + Source Files + diff --git a/programs/nstool/source/NsoProcess.cpp b/programs/nstool/source/NsoProcess.cpp index cec7823..3af7460 100644 --- a/programs/nstool/source/NsoProcess.cpp +++ b/programs/nstool/source/NsoProcess.cpp @@ -95,7 +95,7 @@ void NsoProcess::importCodeSegments() scratch.alloc(mNsoHdr.getTextSegmentInfo().file_layout.size); mFile->read(scratch.getBytes(), mNsoHdr.getTextSegmentInfo().file_layout.offset, scratch.getSize()); mTextBlob.alloc(mNsoHdr.getTextSegmentInfo().memory_layout.size); - compress::lz4::decompressData(scratch.getBytes(), scratch.getSize(), mTextBlob.getBytes(), mTextBlob.getSize(), decompressed_len); + compress::lz4::decompressData(scratch.getBytes(), (uint32_t)scratch.getSize(), mTextBlob.getBytes(), (uint32_t)mTextBlob.getSize(), decompressed_len); if (decompressed_len != mTextBlob.getSize()) { throw fnd::Exception(kModuleName, "NSO text segment failed to decompress"); @@ -121,7 +121,7 @@ void NsoProcess::importCodeSegments() scratch.alloc(mNsoHdr.getRoSegmentInfo().file_layout.size); mFile->read(scratch.getBytes(), mNsoHdr.getRoSegmentInfo().file_layout.offset, scratch.getSize()); mRoBlob.alloc(mNsoHdr.getRoSegmentInfo().memory_layout.size); - compress::lz4::decompressData(scratch.getBytes(), scratch.getSize(), mRoBlob.getBytes(), mRoBlob.getSize(), decompressed_len); + compress::lz4::decompressData(scratch.getBytes(), (uint32_t)scratch.getSize(), mRoBlob.getBytes(), (uint32_t)mRoBlob.getSize(), decompressed_len); if (decompressed_len != mRoBlob.getSize()) { throw fnd::Exception(kModuleName, "NSO ro segment failed to decompress"); @@ -147,7 +147,7 @@ void NsoProcess::importCodeSegments() scratch.alloc(mNsoHdr.getDataSegmentInfo().file_layout.size); mFile->read(scratch.getBytes(), mNsoHdr.getDataSegmentInfo().file_layout.offset, scratch.getSize()); mDataBlob.alloc(mNsoHdr.getDataSegmentInfo().memory_layout.size); - compress::lz4::decompressData(scratch.getBytes(), scratch.getSize(), mDataBlob.getBytes(), mDataBlob.getSize(), decompressed_len); + compress::lz4::decompressData(scratch.getBytes(), (uint32_t)scratch.getSize(), mDataBlob.getBytes(), (uint32_t)mDataBlob.getSize(), decompressed_len); if (decompressed_len != mDataBlob.getSize()) { throw fnd::Exception(kModuleName, "NSO data segment failed to decompress"); diff --git a/programs/nstool/source/XciProcess.cpp b/programs/nstool/source/XciProcess.cpp index 45fad92..277811a 100644 --- a/programs/nstool/source/XciProcess.cpp +++ b/programs/nstool/source/XciProcess.cpp @@ -179,7 +179,7 @@ void XciProcess::displayHeader() printf(" SelT1Key: 0x%x\n", mHdr.getSelT1Key()); printf(" SelKey: 0x%x\n", mHdr.getSelKey()); printf(" LimArea: 0x%x", mHdr.getLimAreaPage()); - if (mHdr.getLimAreaPage() != -1) + if (mHdr.getLimAreaPage() != (uint32_t)(-1)) printf(" (0x%" PRIx64 ")", nx::XciUtils::blockToAddr(mHdr.getLimAreaPage())); printf("\n");