mirror of
https://github.com/jakcron/nstool.git
synced 2024-12-22 18:55:29 +00:00
commit
44a9f7744c
248
NNTools.sln
248
NNTools.sln
|
@ -1,124 +1,124 @@
|
||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio 15
|
# Visual Studio 15
|
||||||
VisualStudioVersion = 15.0.27428.2015
|
VisualStudioVersion = 15.0.27428.2015
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Libraries", "Libraries", "{170B4A09-1B67-4A62-93AB-116EBCFF4A8C}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Libraries", "Libraries", "{170B4A09-1B67-4A62-93AB-116EBCFF4A8C}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Programs", "Programs", "{E0863FCC-8E72-490D-BE1B-458F12CA8298}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Programs", "Programs", "{E0863FCC-8E72-490D-BE1B-458F12CA8298}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8F6C846D-35E2-47FD-AF42-7A3FD036346E}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8F6C846D-35E2-47FD-AF42-7A3FD036346E}"
|
||||||
ProjectSection(SolutionItems) = preProject
|
ProjectSection(SolutionItems) = preProject
|
||||||
.gitignore = .gitignore
|
.gitignore = .gitignore
|
||||||
LICENSE = LICENSE
|
LICENSE = LICENSE
|
||||||
makefile = makefile
|
makefile = makefile
|
||||||
README.md = README.md
|
README.md = README.md
|
||||||
SWITCH_KEYS.md = SWITCH_KEYS.md
|
SWITCH_KEYS.md = SWITCH_KEYS.md
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nstool", "programs\nstool\nstool.vcxproj", "{AF09FA96-4463-417D-8FE6-526063F41349}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nstool", "programs\nstool\nstool.vcxproj", "{AF09FA96-4463-417D-8FE6-526063F41349}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libfnd", "lib\libfnd\libfnd.vcxproj", "{4D27EDB9-5110-44FE-8CE2-D46C5AD3C55B}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libfnd", "lib\libfnd\libfnd.vcxproj", "{4D27EDB9-5110-44FE-8CE2-D46C5AD3C55B}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libpolarssl", "lib\libpolarssl\libpolarssl.vcxproj", "{394EFC16-BD3A-4538-B33D-7BA1EDB8DAC1}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libpolarssl", "lib\libpolarssl\libpolarssl.vcxproj", "{394EFC16-BD3A-4538-B33D-7BA1EDB8DAC1}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "liblz4", "lib\liblz4\liblz4.vcxproj", "{AB0C3362-63AB-480A-ADBC-2EF7D859778B}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "liblz4", "lib\liblz4\liblz4.vcxproj", "{AB0C3362-63AB-480A-ADBC-2EF7D859778B}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libpki", "lib\libpki\libpki.vcxproj", "{B9113734-6E84-44FF-8CF7-58199AA815C5}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libpki", "lib\libpki\libpki.vcxproj", "{B9113734-6E84-44FF-8CF7-58199AA815C5}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libes", "lib\libes\libes.vcxproj", "{7BE99936-0D40-410D-944B-4513C2EFF8DC}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libes", "lib\libes\libes.vcxproj", "{7BE99936-0D40-410D-944B-4513C2EFF8DC}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libhac", "lib\libhac\libhac.vcxproj", "{91BA9E79-8242-4F7D-B997-0DFEC95EA22B}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libhac", "lib\libhac\libhac.vcxproj", "{91BA9E79-8242-4F7D-B997-0DFEC95EA22B}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libhac-hb", "lib\libhac-hb\libhac-hb.vcxproj", "{738CB4FC-CD9E-4B81-A04B-DEADBFA71C63}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libhac-hb", "lib\libhac-hb\libhac-hb.vcxproj", "{738CB4FC-CD9E-4B81-A04B-DEADBFA71C63}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|x64 = Debug|x64
|
Debug|x64 = Debug|x64
|
||||||
Debug|x86 = Debug|x86
|
Debug|x86 = Debug|x86
|
||||||
Release|x64 = Release|x64
|
Release|x64 = Release|x64
|
||||||
Release|x86 = Release|x86
|
Release|x86 = Release|x86
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{AF09FA96-4463-417D-8FE6-526063F41349}.Debug|x64.ActiveCfg = Debug|x64
|
{AF09FA96-4463-417D-8FE6-526063F41349}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
{AF09FA96-4463-417D-8FE6-526063F41349}.Debug|x64.Build.0 = Debug|x64
|
{AF09FA96-4463-417D-8FE6-526063F41349}.Debug|x64.Build.0 = Debug|x64
|
||||||
{AF09FA96-4463-417D-8FE6-526063F41349}.Debug|x86.ActiveCfg = Debug|Win32
|
{AF09FA96-4463-417D-8FE6-526063F41349}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
{AF09FA96-4463-417D-8FE6-526063F41349}.Debug|x86.Build.0 = Debug|Win32
|
{AF09FA96-4463-417D-8FE6-526063F41349}.Debug|x86.Build.0 = Debug|Win32
|
||||||
{AF09FA96-4463-417D-8FE6-526063F41349}.Release|x64.ActiveCfg = Release|x64
|
{AF09FA96-4463-417D-8FE6-526063F41349}.Release|x64.ActiveCfg = Release|x64
|
||||||
{AF09FA96-4463-417D-8FE6-526063F41349}.Release|x64.Build.0 = Release|x64
|
{AF09FA96-4463-417D-8FE6-526063F41349}.Release|x64.Build.0 = Release|x64
|
||||||
{AF09FA96-4463-417D-8FE6-526063F41349}.Release|x86.ActiveCfg = Release|Win32
|
{AF09FA96-4463-417D-8FE6-526063F41349}.Release|x86.ActiveCfg = Release|Win32
|
||||||
{AF09FA96-4463-417D-8FE6-526063F41349}.Release|x86.Build.0 = Release|Win32
|
{AF09FA96-4463-417D-8FE6-526063F41349}.Release|x86.Build.0 = Release|Win32
|
||||||
{4D27EDB9-5110-44FE-8CE2-D46C5AD3C55B}.Debug|x64.ActiveCfg = Debug|x64
|
{4D27EDB9-5110-44FE-8CE2-D46C5AD3C55B}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
{4D27EDB9-5110-44FE-8CE2-D46C5AD3C55B}.Debug|x64.Build.0 = Debug|x64
|
{4D27EDB9-5110-44FE-8CE2-D46C5AD3C55B}.Debug|x64.Build.0 = Debug|x64
|
||||||
{4D27EDB9-5110-44FE-8CE2-D46C5AD3C55B}.Debug|x86.ActiveCfg = Debug|Win32
|
{4D27EDB9-5110-44FE-8CE2-D46C5AD3C55B}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
{4D27EDB9-5110-44FE-8CE2-D46C5AD3C55B}.Debug|x86.Build.0 = Debug|Win32
|
{4D27EDB9-5110-44FE-8CE2-D46C5AD3C55B}.Debug|x86.Build.0 = Debug|Win32
|
||||||
{4D27EDB9-5110-44FE-8CE2-D46C5AD3C55B}.Release|x64.ActiveCfg = Release|x64
|
{4D27EDB9-5110-44FE-8CE2-D46C5AD3C55B}.Release|x64.ActiveCfg = Release|x64
|
||||||
{4D27EDB9-5110-44FE-8CE2-D46C5AD3C55B}.Release|x64.Build.0 = Release|x64
|
{4D27EDB9-5110-44FE-8CE2-D46C5AD3C55B}.Release|x64.Build.0 = Release|x64
|
||||||
{4D27EDB9-5110-44FE-8CE2-D46C5AD3C55B}.Release|x86.ActiveCfg = Release|Win32
|
{4D27EDB9-5110-44FE-8CE2-D46C5AD3C55B}.Release|x86.ActiveCfg = Release|Win32
|
||||||
{4D27EDB9-5110-44FE-8CE2-D46C5AD3C55B}.Release|x86.Build.0 = Release|Win32
|
{4D27EDB9-5110-44FE-8CE2-D46C5AD3C55B}.Release|x86.Build.0 = Release|Win32
|
||||||
{394EFC16-BD3A-4538-B33D-7BA1EDB8DAC1}.Debug|x64.ActiveCfg = Debug|x64
|
{394EFC16-BD3A-4538-B33D-7BA1EDB8DAC1}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
{394EFC16-BD3A-4538-B33D-7BA1EDB8DAC1}.Debug|x64.Build.0 = Debug|x64
|
{394EFC16-BD3A-4538-B33D-7BA1EDB8DAC1}.Debug|x64.Build.0 = Debug|x64
|
||||||
{394EFC16-BD3A-4538-B33D-7BA1EDB8DAC1}.Debug|x86.ActiveCfg = Debug|Win32
|
{394EFC16-BD3A-4538-B33D-7BA1EDB8DAC1}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
{394EFC16-BD3A-4538-B33D-7BA1EDB8DAC1}.Debug|x86.Build.0 = Debug|Win32
|
{394EFC16-BD3A-4538-B33D-7BA1EDB8DAC1}.Debug|x86.Build.0 = Debug|Win32
|
||||||
{394EFC16-BD3A-4538-B33D-7BA1EDB8DAC1}.Release|x64.ActiveCfg = Release|x64
|
{394EFC16-BD3A-4538-B33D-7BA1EDB8DAC1}.Release|x64.ActiveCfg = Release|x64
|
||||||
{394EFC16-BD3A-4538-B33D-7BA1EDB8DAC1}.Release|x64.Build.0 = Release|x64
|
{394EFC16-BD3A-4538-B33D-7BA1EDB8DAC1}.Release|x64.Build.0 = Release|x64
|
||||||
{394EFC16-BD3A-4538-B33D-7BA1EDB8DAC1}.Release|x86.ActiveCfg = Release|Win32
|
{394EFC16-BD3A-4538-B33D-7BA1EDB8DAC1}.Release|x86.ActiveCfg = Release|Win32
|
||||||
{394EFC16-BD3A-4538-B33D-7BA1EDB8DAC1}.Release|x86.Build.0 = Release|Win32
|
{394EFC16-BD3A-4538-B33D-7BA1EDB8DAC1}.Release|x86.Build.0 = Release|Win32
|
||||||
{AB0C3362-63AB-480A-ADBC-2EF7D859778B}.Debug|x64.ActiveCfg = Debug|x64
|
{AB0C3362-63AB-480A-ADBC-2EF7D859778B}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
{AB0C3362-63AB-480A-ADBC-2EF7D859778B}.Debug|x64.Build.0 = Debug|x64
|
{AB0C3362-63AB-480A-ADBC-2EF7D859778B}.Debug|x64.Build.0 = Debug|x64
|
||||||
{AB0C3362-63AB-480A-ADBC-2EF7D859778B}.Debug|x86.ActiveCfg = Debug|Win32
|
{AB0C3362-63AB-480A-ADBC-2EF7D859778B}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
{AB0C3362-63AB-480A-ADBC-2EF7D859778B}.Debug|x86.Build.0 = Debug|Win32
|
{AB0C3362-63AB-480A-ADBC-2EF7D859778B}.Debug|x86.Build.0 = Debug|Win32
|
||||||
{AB0C3362-63AB-480A-ADBC-2EF7D859778B}.Release|x64.ActiveCfg = Release|x64
|
{AB0C3362-63AB-480A-ADBC-2EF7D859778B}.Release|x64.ActiveCfg = Release|x64
|
||||||
{AB0C3362-63AB-480A-ADBC-2EF7D859778B}.Release|x64.Build.0 = Release|x64
|
{AB0C3362-63AB-480A-ADBC-2EF7D859778B}.Release|x64.Build.0 = Release|x64
|
||||||
{AB0C3362-63AB-480A-ADBC-2EF7D859778B}.Release|x86.ActiveCfg = Release|Win32
|
{AB0C3362-63AB-480A-ADBC-2EF7D859778B}.Release|x86.ActiveCfg = Release|Win32
|
||||||
{AB0C3362-63AB-480A-ADBC-2EF7D859778B}.Release|x86.Build.0 = Release|Win32
|
{AB0C3362-63AB-480A-ADBC-2EF7D859778B}.Release|x86.Build.0 = Release|Win32
|
||||||
{B9113734-6E84-44FF-8CF7-58199AA815C5}.Debug|x64.ActiveCfg = Debug|x64
|
{B9113734-6E84-44FF-8CF7-58199AA815C5}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
{B9113734-6E84-44FF-8CF7-58199AA815C5}.Debug|x64.Build.0 = Debug|x64
|
{B9113734-6E84-44FF-8CF7-58199AA815C5}.Debug|x64.Build.0 = Debug|x64
|
||||||
{B9113734-6E84-44FF-8CF7-58199AA815C5}.Debug|x86.ActiveCfg = Debug|Win32
|
{B9113734-6E84-44FF-8CF7-58199AA815C5}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
{B9113734-6E84-44FF-8CF7-58199AA815C5}.Debug|x86.Build.0 = Debug|Win32
|
{B9113734-6E84-44FF-8CF7-58199AA815C5}.Debug|x86.Build.0 = Debug|Win32
|
||||||
{B9113734-6E84-44FF-8CF7-58199AA815C5}.Release|x64.ActiveCfg = Release|x64
|
{B9113734-6E84-44FF-8CF7-58199AA815C5}.Release|x64.ActiveCfg = Release|x64
|
||||||
{B9113734-6E84-44FF-8CF7-58199AA815C5}.Release|x64.Build.0 = Release|x64
|
{B9113734-6E84-44FF-8CF7-58199AA815C5}.Release|x64.Build.0 = Release|x64
|
||||||
{B9113734-6E84-44FF-8CF7-58199AA815C5}.Release|x86.ActiveCfg = Release|Win32
|
{B9113734-6E84-44FF-8CF7-58199AA815C5}.Release|x86.ActiveCfg = Release|Win32
|
||||||
{B9113734-6E84-44FF-8CF7-58199AA815C5}.Release|x86.Build.0 = Release|Win32
|
{B9113734-6E84-44FF-8CF7-58199AA815C5}.Release|x86.Build.0 = Release|Win32
|
||||||
{7BE99936-0D40-410D-944B-4513C2EFF8DC}.Debug|x64.ActiveCfg = Debug|x64
|
{7BE99936-0D40-410D-944B-4513C2EFF8DC}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
{7BE99936-0D40-410D-944B-4513C2EFF8DC}.Debug|x64.Build.0 = Debug|x64
|
{7BE99936-0D40-410D-944B-4513C2EFF8DC}.Debug|x64.Build.0 = Debug|x64
|
||||||
{7BE99936-0D40-410D-944B-4513C2EFF8DC}.Debug|x86.ActiveCfg = Debug|Win32
|
{7BE99936-0D40-410D-944B-4513C2EFF8DC}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
{7BE99936-0D40-410D-944B-4513C2EFF8DC}.Debug|x86.Build.0 = Debug|Win32
|
{7BE99936-0D40-410D-944B-4513C2EFF8DC}.Debug|x86.Build.0 = Debug|Win32
|
||||||
{7BE99936-0D40-410D-944B-4513C2EFF8DC}.Release|x64.ActiveCfg = Release|x64
|
{7BE99936-0D40-410D-944B-4513C2EFF8DC}.Release|x64.ActiveCfg = Release|x64
|
||||||
{7BE99936-0D40-410D-944B-4513C2EFF8DC}.Release|x64.Build.0 = Release|x64
|
{7BE99936-0D40-410D-944B-4513C2EFF8DC}.Release|x64.Build.0 = Release|x64
|
||||||
{7BE99936-0D40-410D-944B-4513C2EFF8DC}.Release|x86.ActiveCfg = Release|Win32
|
{7BE99936-0D40-410D-944B-4513C2EFF8DC}.Release|x86.ActiveCfg = Release|Win32
|
||||||
{7BE99936-0D40-410D-944B-4513C2EFF8DC}.Release|x86.Build.0 = Release|Win32
|
{7BE99936-0D40-410D-944B-4513C2EFF8DC}.Release|x86.Build.0 = Release|Win32
|
||||||
{91BA9E79-8242-4F7D-B997-0DFEC95EA22B}.Debug|x64.ActiveCfg = Debug|x64
|
{91BA9E79-8242-4F7D-B997-0DFEC95EA22B}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
{91BA9E79-8242-4F7D-B997-0DFEC95EA22B}.Debug|x64.Build.0 = Debug|x64
|
{91BA9E79-8242-4F7D-B997-0DFEC95EA22B}.Debug|x64.Build.0 = Debug|x64
|
||||||
{91BA9E79-8242-4F7D-B997-0DFEC95EA22B}.Debug|x86.ActiveCfg = Debug|Win32
|
{91BA9E79-8242-4F7D-B997-0DFEC95EA22B}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
{91BA9E79-8242-4F7D-B997-0DFEC95EA22B}.Debug|x86.Build.0 = Debug|Win32
|
{91BA9E79-8242-4F7D-B997-0DFEC95EA22B}.Debug|x86.Build.0 = Debug|Win32
|
||||||
{91BA9E79-8242-4F7D-B997-0DFEC95EA22B}.Release|x64.ActiveCfg = Release|x64
|
{91BA9E79-8242-4F7D-B997-0DFEC95EA22B}.Release|x64.ActiveCfg = Release|x64
|
||||||
{91BA9E79-8242-4F7D-B997-0DFEC95EA22B}.Release|x64.Build.0 = Release|x64
|
{91BA9E79-8242-4F7D-B997-0DFEC95EA22B}.Release|x64.Build.0 = Release|x64
|
||||||
{91BA9E79-8242-4F7D-B997-0DFEC95EA22B}.Release|x86.ActiveCfg = Release|Win32
|
{91BA9E79-8242-4F7D-B997-0DFEC95EA22B}.Release|x86.ActiveCfg = Release|Win32
|
||||||
{91BA9E79-8242-4F7D-B997-0DFEC95EA22B}.Release|x86.Build.0 = Release|Win32
|
{91BA9E79-8242-4F7D-B997-0DFEC95EA22B}.Release|x86.Build.0 = Release|Win32
|
||||||
{738CB4FC-CD9E-4B81-A04B-DEADBFA71C63}.Debug|x64.ActiveCfg = Debug|x64
|
{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|x64.Build.0 = Debug|x64
|
||||||
{738CB4FC-CD9E-4B81-A04B-DEADBFA71C63}.Debug|x86.ActiveCfg = Debug|Win32
|
{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}.Debug|x86.Build.0 = Debug|Win32
|
||||||
{738CB4FC-CD9E-4B81-A04B-DEADBFA71C63}.Release|x64.ActiveCfg = Release|x64
|
{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|x64.Build.0 = Release|x64
|
||||||
{738CB4FC-CD9E-4B81-A04B-DEADBFA71C63}.Release|x86.ActiveCfg = Release|Win32
|
{738CB4FC-CD9E-4B81-A04B-DEADBFA71C63}.Release|x86.ActiveCfg = Release|Win32
|
||||||
{738CB4FC-CD9E-4B81-A04B-DEADBFA71C63}.Release|x86.Build.0 = Release|Win32
|
{738CB4FC-CD9E-4B81-A04B-DEADBFA71C63}.Release|x86.Build.0 = Release|Win32
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(NestedProjects) = preSolution
|
GlobalSection(NestedProjects) = preSolution
|
||||||
{AF09FA96-4463-417D-8FE6-526063F41349} = {E0863FCC-8E72-490D-BE1B-458F12CA8298}
|
{AF09FA96-4463-417D-8FE6-526063F41349} = {E0863FCC-8E72-490D-BE1B-458F12CA8298}
|
||||||
{4D27EDB9-5110-44FE-8CE2-D46C5AD3C55B} = {170B4A09-1B67-4A62-93AB-116EBCFF4A8C}
|
{4D27EDB9-5110-44FE-8CE2-D46C5AD3C55B} = {170B4A09-1B67-4A62-93AB-116EBCFF4A8C}
|
||||||
{394EFC16-BD3A-4538-B33D-7BA1EDB8DAC1} = {170B4A09-1B67-4A62-93AB-116EBCFF4A8C}
|
{394EFC16-BD3A-4538-B33D-7BA1EDB8DAC1} = {170B4A09-1B67-4A62-93AB-116EBCFF4A8C}
|
||||||
{AB0C3362-63AB-480A-ADBC-2EF7D859778B} = {170B4A09-1B67-4A62-93AB-116EBCFF4A8C}
|
{AB0C3362-63AB-480A-ADBC-2EF7D859778B} = {170B4A09-1B67-4A62-93AB-116EBCFF4A8C}
|
||||||
{B9113734-6E84-44FF-8CF7-58199AA815C5} = {170B4A09-1B67-4A62-93AB-116EBCFF4A8C}
|
{B9113734-6E84-44FF-8CF7-58199AA815C5} = {170B4A09-1B67-4A62-93AB-116EBCFF4A8C}
|
||||||
{7BE99936-0D40-410D-944B-4513C2EFF8DC} = {170B4A09-1B67-4A62-93AB-116EBCFF4A8C}
|
{7BE99936-0D40-410D-944B-4513C2EFF8DC} = {170B4A09-1B67-4A62-93AB-116EBCFF4A8C}
|
||||||
{91BA9E79-8242-4F7D-B997-0DFEC95EA22B} = {170B4A09-1B67-4A62-93AB-116EBCFF4A8C}
|
{91BA9E79-8242-4F7D-B997-0DFEC95EA22B} = {170B4A09-1B67-4A62-93AB-116EBCFF4A8C}
|
||||||
{738CB4FC-CD9E-4B81-A04B-DEADBFA71C63} = {170B4A09-1B67-4A62-93AB-116EBCFF4A8C}
|
{738CB4FC-CD9E-4B81-A04B-DEADBFA71C63} = {170B4A09-1B67-4A62-93AB-116EBCFF4A8C}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {07DCCACC-D10D-47C9-85AE-FB9C54DB7D62}
|
SolutionGuid = {07DCCACC-D10D-47C9-85AE-FB9C54DB7D62}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
|
|
@ -1,58 +1,58 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <fnd/ISerialisable.h>
|
#include <fnd/IByteModel.h>
|
||||||
#include <nn/es/ticket.h>
|
#include <nn/es/ticket.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
{
|
{
|
||||||
namespace es
|
namespace es
|
||||||
{
|
{
|
||||||
class SectionHeader_V2 :
|
class SectionHeader_V2 :
|
||||||
public fnd::ISerialisable
|
public fnd::IByteModel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SectionHeader_V2();
|
SectionHeader_V2();
|
||||||
SectionHeader_V2(const SectionHeader_V2& other);
|
SectionHeader_V2(const SectionHeader_V2& other);
|
||||||
|
|
||||||
void operator=(const SectionHeader_V2& other);
|
void operator=(const SectionHeader_V2& other);
|
||||||
bool operator==(const SectionHeader_V2& other) const;
|
bool operator==(const SectionHeader_V2& other) const;
|
||||||
bool operator!=(const SectionHeader_V2& other) const;
|
bool operator!=(const SectionHeader_V2& other) const;
|
||||||
|
|
||||||
// export/import binary
|
// IByteModel
|
||||||
void toBytes();
|
void toBytes();
|
||||||
void fromBytes(const byte_t* data, size_t len);
|
void fromBytes(const byte_t* data, size_t len);
|
||||||
const fnd::Vec<byte_t>& getBytes() const;
|
const fnd::Vec<byte_t>& getBytes() const;
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
virtual void clear();
|
virtual void clear();
|
||||||
|
|
||||||
uint32_t getSectionOffset() const;
|
uint32_t getSectionOffset() const;
|
||||||
void setSectionOffset(uint32_t offset);
|
void setSectionOffset(uint32_t offset);
|
||||||
|
|
||||||
uint32_t getRecordSize() const;
|
uint32_t getRecordSize() const;
|
||||||
void setRecordSize(uint32_t size);
|
void setRecordSize(uint32_t size);
|
||||||
|
|
||||||
uint32_t getSectionSize() const;
|
uint32_t getSectionSize() const;
|
||||||
void getSectionSize(uint32_t size);
|
void getSectionSize(uint32_t size);
|
||||||
|
|
||||||
uint16_t getRecordNum() const;
|
uint16_t getRecordNum() const;
|
||||||
void setRecordNum(uint16_t record_num);
|
void setRecordNum(uint16_t record_num);
|
||||||
|
|
||||||
ticket::SectionType getSectionType() const;
|
ticket::SectionType getSectionType() const;
|
||||||
void setSectionType(ticket::SectionType type);
|
void setSectionType(ticket::SectionType type);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const std::string kModuleName = "SECTION_HEADER_V2";
|
const std::string kModuleName = "SECTION_HEADER_V2";
|
||||||
|
|
||||||
// raw binary
|
// raw binary
|
||||||
fnd::Vec<byte_t> mRawBinary;
|
fnd::Vec<byte_t> mRawBinary;
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
uint32_t mSectionOffset;
|
uint32_t mSectionOffset;
|
||||||
uint32_t mRecordSize;
|
uint32_t mRecordSize;
|
||||||
uint32_t mSectionSize;
|
uint32_t mSectionSize;
|
||||||
uint16_t mRecordNum;
|
uint16_t mRecordNum;
|
||||||
ticket::SectionType mSectionType;
|
ticket::SectionType mSectionType;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,103 +1,103 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <fnd/ISerialisable.h>
|
#include <fnd/IByteModel.h>
|
||||||
#include <fnd/List.h>
|
#include <fnd/List.h>
|
||||||
#include <nn/es/ticket.h>
|
#include <nn/es/ticket.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
{
|
{
|
||||||
namespace es
|
namespace es
|
||||||
{
|
{
|
||||||
class TicketBody_V2 :
|
class TicketBody_V2 :
|
||||||
public fnd::ISerialisable
|
public fnd::IByteModel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TicketBody_V2();
|
TicketBody_V2();
|
||||||
TicketBody_V2(const TicketBody_V2& other);
|
TicketBody_V2(const TicketBody_V2& other);
|
||||||
|
|
||||||
void operator=(const TicketBody_V2& other);
|
void operator=(const TicketBody_V2& other);
|
||||||
bool operator==(const TicketBody_V2& other) const;
|
bool operator==(const TicketBody_V2& other) const;
|
||||||
bool operator!=(const TicketBody_V2& other) const;
|
bool operator!=(const TicketBody_V2& other) const;
|
||||||
|
|
||||||
// export/import binary
|
// IByteModel
|
||||||
void toBytes();
|
void toBytes();
|
||||||
void fromBytes(const byte_t* bytes, size_t len);
|
void fromBytes(const byte_t* bytes, size_t len);
|
||||||
const fnd::Vec<byte_t>& getBytes() const;
|
const fnd::Vec<byte_t>& getBytes() const;
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
const std::string& getIssuer() const;
|
const std::string& getIssuer() const;
|
||||||
void setIssuer(const std::string& issuer);
|
void setIssuer(const std::string& issuer);
|
||||||
|
|
||||||
const byte_t* getEncTitleKey() const;
|
const byte_t* getEncTitleKey() const;
|
||||||
void setEncTitleKey(const byte_t* data, size_t len);
|
void setEncTitleKey(const byte_t* data, size_t len);
|
||||||
|
|
||||||
ticket::TitleKeyEncType getTitleKeyEncType() const;
|
ticket::TitleKeyEncType getTitleKeyEncType() const;
|
||||||
void setTitleKeyEncType(ticket::TitleKeyEncType type);
|
void setTitleKeyEncType(ticket::TitleKeyEncType type);
|
||||||
|
|
||||||
uint16_t getTicketVersion() const;
|
uint16_t getTicketVersion() const;
|
||||||
void setTicketVersion(uint16_t version);
|
void setTicketVersion(uint16_t version);
|
||||||
|
|
||||||
ticket::LicenseType getLicenseType() const;
|
ticket::LicenseType getLicenseType() const;
|
||||||
void setLicenseType(ticket::LicenseType type);
|
void setLicenseType(ticket::LicenseType type);
|
||||||
|
|
||||||
byte_t getCommonKeyId() const;
|
byte_t getCommonKeyId() const;
|
||||||
void setCommonKeyId(byte_t id);
|
void setCommonKeyId(byte_t id);
|
||||||
|
|
||||||
const fnd::List<es::ticket::PropertyMaskFlags>& getPropertyFlags() const;
|
const fnd::List<es::ticket::PropertyMaskFlags>& getPropertyFlags() const;
|
||||||
void setPropertyFlags(const fnd::List<es::ticket::PropertyMaskFlags>& flags);
|
void setPropertyFlags(const fnd::List<es::ticket::PropertyMaskFlags>& flags);
|
||||||
|
|
||||||
const byte_t* getReservedRegion() const;
|
const byte_t* getReservedRegion() const;
|
||||||
void setReservedRegion(const byte_t* data, size_t len);
|
void setReservedRegion(const byte_t* data, size_t len);
|
||||||
|
|
||||||
uint64_t getTicketId() const;
|
uint64_t getTicketId() const;
|
||||||
void setTicketId(uint64_t id);
|
void setTicketId(uint64_t id);
|
||||||
|
|
||||||
uint64_t getDeviceId() const;
|
uint64_t getDeviceId() const;
|
||||||
void setDeviceId(uint64_t id);
|
void setDeviceId(uint64_t id);
|
||||||
|
|
||||||
const byte_t* getRightsId() const;
|
const byte_t* getRightsId() const;
|
||||||
void setRightsId(const byte_t* id);
|
void setRightsId(const byte_t* id);
|
||||||
|
|
||||||
uint32_t getAccountId() const;
|
uint32_t getAccountId() const;
|
||||||
void setAccountId(uint32_t id);
|
void setAccountId(uint32_t id);
|
||||||
|
|
||||||
uint32_t getSectionTotalSize() const;
|
uint32_t getSectionTotalSize() const;
|
||||||
void setSectionTotalSize(uint32_t size);
|
void setSectionTotalSize(uint32_t size);
|
||||||
|
|
||||||
uint32_t getSectionHeaderOffset() const;
|
uint32_t getSectionHeaderOffset() const;
|
||||||
void setSectionHeaderOffset(uint32_t offset);
|
void setSectionHeaderOffset(uint32_t offset);
|
||||||
|
|
||||||
uint16_t getSectionNum() const;
|
uint16_t getSectionNum() const;
|
||||||
void setSectionNum(uint16_t num);
|
void setSectionNum(uint16_t num);
|
||||||
|
|
||||||
uint16_t getSectionEntrySize() const;
|
uint16_t getSectionEntrySize() const;
|
||||||
void setSectionEntrySize(uint16_t size);
|
void setSectionEntrySize(uint16_t size);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const std::string kModuleName = "TICKET_BODY_V2";
|
const std::string kModuleName = "TICKET_BODY_V2";
|
||||||
|
|
||||||
// raw binary
|
// raw binary
|
||||||
fnd::Vec<byte_t> mRawBinary;
|
fnd::Vec<byte_t> mRawBinary;
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
std::string mIssuer;
|
std::string mIssuer;
|
||||||
byte_t mEncTitleKey[ticket::kEncTitleKeySize];
|
byte_t mEncTitleKey[ticket::kEncTitleKeySize];
|
||||||
ticket::TitleKeyEncType mEncType;
|
ticket::TitleKeyEncType mEncType;
|
||||||
uint16_t mTicketVersion;
|
uint16_t mTicketVersion;
|
||||||
ticket::LicenseType mLicenseType;
|
ticket::LicenseType mLicenseType;
|
||||||
byte_t mCommonKeyId;
|
byte_t mCommonKeyId;
|
||||||
fnd::List<es::ticket::PropertyMaskFlags> mPropertyFlags;
|
fnd::List<es::ticket::PropertyMaskFlags> mPropertyFlags;
|
||||||
byte_t mReservedRegion[ticket::kReservedRegionSize]; // explicitly reserved
|
byte_t mReservedRegion[ticket::kReservedRegionSize]; // explicitly reserved
|
||||||
uint64_t mTicketId;
|
uint64_t mTicketId;
|
||||||
uint64_t mDeviceId;
|
uint64_t mDeviceId;
|
||||||
byte_t mRightsId[ticket::kRightsIdSize];
|
byte_t mRightsId[ticket::kRightsIdSize];
|
||||||
uint32_t mAccountId;
|
uint32_t mAccountId;
|
||||||
uint32_t mSectTotalSize;
|
uint32_t mSectTotalSize;
|
||||||
uint32_t mSectHeaderOffset;
|
uint32_t mSectHeaderOffset;
|
||||||
uint16_t mSectNum;
|
uint16_t mSectNum;
|
||||||
uint16_t mSectEntrySize;
|
uint16_t mSectEntrySize;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,23 +1,23 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <fnd/Vec.h>
|
#include <fnd/Vec.h>
|
||||||
|
|
||||||
namespace fnd
|
namespace fnd
|
||||||
{
|
{
|
||||||
class ISerialisable
|
class IByteModel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~ISerialisable() = default;
|
virtual ~IByteModel() = default;
|
||||||
|
|
||||||
// serialise
|
// serialise
|
||||||
virtual void toBytes() = 0;
|
virtual void toBytes() = 0;
|
||||||
// deserialise
|
// deserialise
|
||||||
virtual void fromBytes(const byte_t* data, size_t len) = 0;
|
virtual void fromBytes(const byte_t* data, size_t len) = 0;
|
||||||
|
|
||||||
// get byte vector
|
// get byte vector
|
||||||
virtual const fnd::Vec<byte_t>& getBytes() const = 0;
|
virtual const fnd::Vec<byte_t>& getBytes() const = 0;
|
||||||
|
|
||||||
// clear data
|
// clear data
|
||||||
virtual void clear() = 0;
|
virtual void clear() = 0;
|
||||||
};
|
};
|
||||||
}
|
}
|
|
@ -1,170 +1,170 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<ItemGroup Label="ProjectConfigurations">
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
<ProjectConfiguration Include="Debug|Win32">
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
<Configuration>Debug</Configuration>
|
<Configuration>Debug</Configuration>
|
||||||
<Platform>Win32</Platform>
|
<Platform>Win32</Platform>
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
<ProjectConfiguration Include="Release|Win32">
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
<Configuration>Release</Configuration>
|
<Configuration>Release</Configuration>
|
||||||
<Platform>Win32</Platform>
|
<Platform>Win32</Platform>
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
<ProjectConfiguration Include="Debug|x64">
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
<Configuration>Debug</Configuration>
|
<Configuration>Debug</Configuration>
|
||||||
<Platform>x64</Platform>
|
<Platform>x64</Platform>
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
<ProjectConfiguration Include="Release|x64">
|
<ProjectConfiguration Include="Release|x64">
|
||||||
<Configuration>Release</Configuration>
|
<Configuration>Release</Configuration>
|
||||||
<Platform>x64</Platform>
|
<Platform>x64</Platform>
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<PropertyGroup Label="Globals">
|
<PropertyGroup Label="Globals">
|
||||||
<VCProjectVersion>15.0</VCProjectVersion>
|
<VCProjectVersion>15.0</VCProjectVersion>
|
||||||
<ProjectGuid>{4D27EDB9-5110-44FE-8CE2-D46C5AD3C55B}</ProjectGuid>
|
<ProjectGuid>{4D27EDB9-5110-44FE-8CE2-D46C5AD3C55B}</ProjectGuid>
|
||||||
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
|
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Label="Shared">
|
<ImportGroup Label="Shared">
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
<PropertyGroup />
|
<PropertyGroup />
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>..\libfnd\include;..\libpolarssl\include;..\liblz4\include;</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\libfnd\include;..\libpolarssl\include;..\liblz4\include;</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>_MBCS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_MBCS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>..\libfnd\include;..\libpolarssl\include;..\liblz4\include;</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\libfnd\include;..\libpolarssl\include;..\liblz4\include;</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>_MBCS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_MBCS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>MaxSpeed</Optimization>
|
<Optimization>MaxSpeed</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>..\libfnd\include;..\libpolarssl\include;..\liblz4\include;</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\libfnd\include;..\libpolarssl\include;..\liblz4\include;</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>_MBCS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_MBCS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>MaxSpeed</Optimization>
|
<Optimization>MaxSpeed</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>..\libfnd\include;..\libpolarssl\include;..\liblz4\include;</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\libfnd\include;..\libpolarssl\include;..\liblz4\include;</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>_MBCS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_MBCS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="makefile" />
|
<None Include="makefile" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="include\fnd\aes.h" />
|
<ClInclude Include="include\fnd\aes.h" />
|
||||||
<ClInclude Include="include\fnd\AesCtrWrappedIFile.h" />
|
<ClInclude Include="include\fnd\AesCtrWrappedIFile.h" />
|
||||||
<ClInclude Include="include\fnd\base64.h" />
|
<ClInclude Include="include\fnd\base64.h" />
|
||||||
<ClInclude Include="include\fnd\BitMath.h" />
|
<ClInclude Include="include\fnd\BitMath.h" />
|
||||||
<ClInclude Include="include\fnd\ecdsa.h" />
|
<ClInclude Include="include\fnd\ecdsa.h" />
|
||||||
<ClInclude Include="include\fnd\elf.h" />
|
<ClInclude Include="include\fnd\elf.h" />
|
||||||
<ClInclude Include="include\fnd\Endian.h" />
|
<ClInclude Include="include\fnd\Endian.h" />
|
||||||
<ClInclude Include="include\fnd\Exception.h" />
|
<ClInclude Include="include\fnd\Exception.h" />
|
||||||
<ClInclude Include="include\fnd\IFile.h" />
|
<ClInclude Include="include\fnd\IByteModel.h" />
|
||||||
<ClInclude Include="include\fnd\io.h" />
|
<ClInclude Include="include\fnd\IFile.h" />
|
||||||
<ClInclude Include="include\fnd\ISerialisable.h" />
|
<ClInclude Include="include\fnd\io.h" />
|
||||||
<ClInclude Include="include\fnd\LayeredIntegrityMetadata.h" />
|
<ClInclude Include="include\fnd\LayeredIntegrityMetadata.h" />
|
||||||
<ClInclude Include="include\fnd\LayeredIntegrityWrappedIFile.h" />
|
<ClInclude Include="include\fnd\LayeredIntegrityWrappedIFile.h" />
|
||||||
<ClInclude Include="include\fnd\List.h" />
|
<ClInclude Include="include\fnd\List.h" />
|
||||||
<ClInclude Include="include\fnd\lz4.h" />
|
<ClInclude Include="include\fnd\lz4.h" />
|
||||||
<ClInclude Include="include\fnd\OffsetAdjustedIFile.h" />
|
<ClInclude Include="include\fnd\OffsetAdjustedIFile.h" />
|
||||||
<ClInclude Include="include\fnd\ResourceFileReader.h" />
|
<ClInclude Include="include\fnd\ResourceFileReader.h" />
|
||||||
<ClInclude Include="include\fnd\rsa.h" />
|
<ClInclude Include="include\fnd\rsa.h" />
|
||||||
<ClInclude Include="include\fnd\sha.h" />
|
<ClInclude Include="include\fnd\sha.h" />
|
||||||
<ClInclude Include="include\fnd\SharedPtr.h" />
|
<ClInclude Include="include\fnd\SharedPtr.h" />
|
||||||
<ClInclude Include="include\fnd\SimpleFile.h" />
|
<ClInclude Include="include\fnd\SimpleFile.h" />
|
||||||
<ClInclude Include="include\fnd\SimpleTextOutput.h" />
|
<ClInclude Include="include\fnd\SimpleTextOutput.h" />
|
||||||
<ClInclude Include="include\fnd\StringConv.h" />
|
<ClInclude Include="include\fnd\StringConv.h" />
|
||||||
<ClInclude Include="include\fnd\types.h" />
|
<ClInclude Include="include\fnd\types.h" />
|
||||||
<ClInclude Include="include\fnd\Vec.h" />
|
<ClInclude Include="include\fnd\Vec.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="source\AesCtrWrappedIFile.cpp" />
|
<ClCompile Include="source\AesCtrWrappedIFile.cpp" />
|
||||||
<ClCompile Include="source\aes_wrapper.cpp" />
|
<ClCompile Include="source\aes_wrapper.cpp" />
|
||||||
<ClCompile Include="source\base64_wrapper.cpp" />
|
<ClCompile Include="source\base64_wrapper.cpp" />
|
||||||
<ClCompile Include="source\Exception.cpp" />
|
<ClCompile Include="source\Exception.cpp" />
|
||||||
<ClCompile Include="source\io.cpp" />
|
<ClCompile Include="source\io.cpp" />
|
||||||
<ClCompile Include="source\LayeredIntegrityMetadata.cpp" />
|
<ClCompile Include="source\LayeredIntegrityMetadata.cpp" />
|
||||||
<ClCompile Include="source\LayeredIntegrityWrappedIFile.cpp" />
|
<ClCompile Include="source\LayeredIntegrityWrappedIFile.cpp" />
|
||||||
<ClCompile Include="source\lz4_wrapper.cpp" />
|
<ClCompile Include="source\lz4_wrapper.cpp" />
|
||||||
<ClCompile Include="source\OffsetAdjustedIFile.cpp" />
|
<ClCompile Include="source\OffsetAdjustedIFile.cpp" />
|
||||||
<ClCompile Include="source\ResourceFileReader.cpp" />
|
<ClCompile Include="source\ResourceFileReader.cpp" />
|
||||||
<ClCompile Include="source\rsa_wrapper.cpp" />
|
<ClCompile Include="source\rsa_wrapper.cpp" />
|
||||||
<ClCompile Include="source\sha_wrapper.cpp" />
|
<ClCompile Include="source\sha_wrapper.cpp" />
|
||||||
<ClCompile Include="source\SimpleFile.cpp" />
|
<ClCompile Include="source\SimpleFile.cpp" />
|
||||||
<ClCompile Include="source\SimpleTextOutput.cpp" />
|
<ClCompile Include="source\SimpleTextOutput.cpp" />
|
||||||
<ClCompile Include="source\StringConv.cpp" />
|
<ClCompile Include="source\StringConv.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -1,144 +1,144 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Filter Include="Source Files">
|
<Filter Include="Source Files">
|
||||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter Include="Header Files">
|
<Filter Include="Header Files">
|
||||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter Include="Resource Files">
|
<Filter Include="Resource Files">
|
||||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||||
</Filter>
|
</Filter>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="makefile" />
|
<None Include="makefile" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="include\fnd\aes.h">
|
<ClInclude Include="include\fnd\aes.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\fnd\AesCtrWrappedIFile.h">
|
<ClInclude Include="include\fnd\AesCtrWrappedIFile.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\fnd\base64.h">
|
<ClInclude Include="include\fnd\base64.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\fnd\BitMath.h">
|
<ClInclude Include="include\fnd\BitMath.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\fnd\ecdsa.h">
|
<ClInclude Include="include\fnd\ecdsa.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\fnd\elf.h">
|
<ClInclude Include="include\fnd\elf.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\fnd\Endian.h">
|
<ClInclude Include="include\fnd\Endian.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\fnd\Exception.h">
|
<ClInclude Include="include\fnd\Exception.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\fnd\IFile.h">
|
<ClInclude Include="include\fnd\IByteModel.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\fnd\io.h">
|
<ClInclude Include="include\fnd\IFile.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\fnd\ISerialisable.h">
|
<ClInclude Include="include\fnd\io.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\fnd\LayeredIntegrityMetadata.h">
|
<ClInclude Include="include\fnd\LayeredIntegrityMetadata.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\fnd\LayeredIntegrityWrappedIFile.h">
|
<ClInclude Include="include\fnd\LayeredIntegrityWrappedIFile.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\fnd\List.h">
|
<ClInclude Include="include\fnd\List.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\fnd\lz4.h">
|
<ClInclude Include="include\fnd\lz4.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\fnd\OffsetAdjustedIFile.h">
|
<ClInclude Include="include\fnd\OffsetAdjustedIFile.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\fnd\ResourceFileReader.h">
|
<ClInclude Include="include\fnd\ResourceFileReader.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\fnd\rsa.h">
|
<ClInclude Include="include\fnd\rsa.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\fnd\sha.h">
|
<ClInclude Include="include\fnd\sha.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\fnd\SharedPtr.h">
|
<ClInclude Include="include\fnd\SharedPtr.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\fnd\SimpleFile.h">
|
<ClInclude Include="include\fnd\SimpleFile.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\fnd\SimpleTextOutput.h">
|
<ClInclude Include="include\fnd\SimpleTextOutput.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\fnd\StringConv.h">
|
<ClInclude Include="include\fnd\StringConv.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\fnd\types.h">
|
<ClInclude Include="include\fnd\types.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\fnd\Vec.h">
|
<ClInclude Include="include\fnd\Vec.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="source\aes_wrapper.cpp">
|
<ClCompile Include="source\aes_wrapper.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\AesCtrWrappedIFile.cpp">
|
<ClCompile Include="source\AesCtrWrappedIFile.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\base64_wrapper.cpp">
|
<ClCompile Include="source\base64_wrapper.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\Exception.cpp">
|
<ClCompile Include="source\Exception.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\io.cpp">
|
<ClCompile Include="source\io.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\LayeredIntegrityMetadata.cpp">
|
<ClCompile Include="source\LayeredIntegrityMetadata.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\LayeredIntegrityWrappedIFile.cpp">
|
<ClCompile Include="source\LayeredIntegrityWrappedIFile.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\lz4_wrapper.cpp">
|
<ClCompile Include="source\lz4_wrapper.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\OffsetAdjustedIFile.cpp">
|
<ClCompile Include="source\OffsetAdjustedIFile.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\ResourceFileReader.cpp">
|
<ClCompile Include="source\ResourceFileReader.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\rsa_wrapper.cpp">
|
<ClCompile Include="source\rsa_wrapper.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\sha_wrapper.cpp">
|
<ClCompile Include="source\sha_wrapper.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\SimpleFile.cpp">
|
<ClCompile Include="source\SimpleFile.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\SimpleTextOutput.cpp">
|
<ClCompile Include="source\SimpleTextOutput.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\StringConv.cpp">
|
<ClCompile Include="source\StringConv.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -1,72 +1,72 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <nn/hac/aset.h>
|
#include <nn/hac/define/aset.h>
|
||||||
#include <fnd/List.h>
|
#include <fnd/List.h>
|
||||||
#include <fnd/ISerialisable.h>
|
#include <fnd/IByteModel.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
{
|
{
|
||||||
namespace hac
|
namespace hac
|
||||||
{
|
{
|
||||||
class AssetHeader :
|
class AssetHeader :
|
||||||
public fnd::ISerialisable
|
public fnd::IByteModel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
struct sSection
|
struct sSection
|
||||||
{
|
{
|
||||||
uint64_t offset;
|
uint64_t offset;
|
||||||
uint64_t size;
|
uint64_t size;
|
||||||
|
|
||||||
void operator=(const sSection& other)
|
void operator=(const sSection& other)
|
||||||
{
|
{
|
||||||
offset = other.offset;
|
offset = other.offset;
|
||||||
size = other.size;
|
size = other.size;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator==(const sSection& other) const
|
bool operator==(const sSection& other) const
|
||||||
{
|
{
|
||||||
return (offset == other.offset) \
|
return (offset == other.offset) \
|
||||||
&& (size == other.size);
|
&& (size == other.size);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=(const sSection& other) const
|
bool operator!=(const sSection& other) const
|
||||||
{
|
{
|
||||||
return !operator==(other);
|
return !operator==(other);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
AssetHeader();
|
AssetHeader();
|
||||||
AssetHeader(const AssetHeader& other);
|
AssetHeader(const AssetHeader& other);
|
||||||
|
|
||||||
void operator=(const AssetHeader& other);
|
void operator=(const AssetHeader& other);
|
||||||
bool operator==(const AssetHeader& other) const;
|
bool operator==(const AssetHeader& other) const;
|
||||||
bool operator!=(const AssetHeader& other) const;
|
bool operator!=(const AssetHeader& other) const;
|
||||||
|
|
||||||
// export/import binary
|
// IByteModel
|
||||||
void toBytes();
|
void toBytes();
|
||||||
void fromBytes(const byte_t* bytes, size_t len);
|
void fromBytes(const byte_t* bytes, size_t len);
|
||||||
const fnd::Vec<byte_t>& getBytes() const;
|
const fnd::Vec<byte_t>& getBytes() const;
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
const sSection& getIconInfo() const;
|
const sSection& getIconInfo() const;
|
||||||
void setIconInfo(const sSection& info);
|
void setIconInfo(const sSection& info);
|
||||||
|
|
||||||
const sSection& getNacpInfo() const;
|
const sSection& getNacpInfo() const;
|
||||||
void setNacpInfo(const sSection& info);
|
void setNacpInfo(const sSection& info);
|
||||||
|
|
||||||
const sSection& getRomfsInfo() const;
|
const sSection& getRomfsInfo() const;
|
||||||
void setRomfsInfo(const sSection& info);
|
void setRomfsInfo(const sSection& info);
|
||||||
private:
|
private:
|
||||||
const std::string kModuleName = "NRO_ASSET_HEADER";
|
const std::string kModuleName = "NRO_ASSET_HEADER";
|
||||||
|
|
||||||
// binary
|
// binary
|
||||||
fnd::Vec<byte_t> mRawBinary;
|
fnd::Vec<byte_t> mRawBinary;
|
||||||
|
|
||||||
// data
|
// data
|
||||||
sSection mIconInfo;
|
sSection mIconInfo;
|
||||||
sSection mNacpInfo;
|
sSection mNacpInfo;
|
||||||
sSection mRomfsInfo;
|
sSection mRomfsInfo;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,33 +1,33 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <nn/hac/macro.h>
|
#include <nn/hac/define/macro.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
{
|
{
|
||||||
namespace hac
|
namespace hac
|
||||||
{
|
{
|
||||||
namespace aset
|
namespace aset
|
||||||
{
|
{
|
||||||
static const uint32_t kAssetStructMagic = _MAKE_STRUCT_MAGIC_U32("ASET");
|
static const uint32_t kAssetStructMagic = _MAKE_STRUCT_MAGIC_U32("ASET");
|
||||||
|
|
||||||
static const uint32_t kDefaultAssetFormatVersion = 0;
|
static const uint32_t kDefaultAssetFormatVersion = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma pack(push,1)
|
#pragma pack(push,1)
|
||||||
struct sAssetSection
|
struct sAssetSection
|
||||||
{
|
{
|
||||||
le_uint64_t offset;
|
le_uint64_t offset;
|
||||||
le_uint64_t size;
|
le_uint64_t size;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sAssetHeader
|
struct sAssetHeader
|
||||||
{
|
{
|
||||||
le_uint32_t st_magic;
|
le_uint32_t st_magic;
|
||||||
le_uint32_t format_version;
|
le_uint32_t format_version;
|
||||||
sAssetSection icon;
|
sAssetSection icon;
|
||||||
sAssetSection nacp;
|
sAssetSection nacp;
|
||||||
sAssetSection romfs;
|
sAssetSection romfs;
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,14 +1,14 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <nn/hac/nro.h>
|
#include <nn/hac/define/nro.h>
|
||||||
#include <nn/hac/macro.h>
|
#include <nn/hac/define/macro.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
{
|
{
|
||||||
namespace hac
|
namespace hac
|
||||||
{
|
{
|
||||||
namespace nro
|
namespace nro
|
||||||
{
|
{
|
||||||
static const uint64_t kNroHomebrewStructMagic = _MAKE_STRUCT_MAGIC_U64("HOMEBREW");
|
static const uint64_t kNroHomebrewStructMagic = _MAKE_STRUCT_MAGIC_U64("HOMEBREW");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,134 +1,134 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<ItemGroup Label="ProjectConfigurations">
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
<ProjectConfiguration Include="Debug|Win32">
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
<Configuration>Debug</Configuration>
|
<Configuration>Debug</Configuration>
|
||||||
<Platform>Win32</Platform>
|
<Platform>Win32</Platform>
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
<ProjectConfiguration Include="Release|Win32">
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
<Configuration>Release</Configuration>
|
<Configuration>Release</Configuration>
|
||||||
<Platform>Win32</Platform>
|
<Platform>Win32</Platform>
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
<ProjectConfiguration Include="Debug|x64">
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
<Configuration>Debug</Configuration>
|
<Configuration>Debug</Configuration>
|
||||||
<Platform>x64</Platform>
|
<Platform>x64</Platform>
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
<ProjectConfiguration Include="Release|x64">
|
<ProjectConfiguration Include="Release|x64">
|
||||||
<Configuration>Release</Configuration>
|
<Configuration>Release</Configuration>
|
||||||
<Platform>x64</Platform>
|
<Platform>x64</Platform>
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<PropertyGroup Label="Globals">
|
<PropertyGroup Label="Globals">
|
||||||
<VCProjectVersion>15.0</VCProjectVersion>
|
<VCProjectVersion>15.0</VCProjectVersion>
|
||||||
<ProjectGuid>{738CB4FC-CD9E-4B81-A04B-DEADBFA71C63}</ProjectGuid>
|
<ProjectGuid>{738CB4FC-CD9E-4B81-A04B-DEADBFA71C63}</ProjectGuid>
|
||||||
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
|
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Label="Shared">
|
<ImportGroup Label="Shared">
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
<PropertyGroup />
|
<PropertyGroup />
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>MaxSpeed</Optimization>
|
<Optimization>MaxSpeed</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
<AdditionalIncludeDirectories>..\libfnd\include;..\libhac\include;..\libhac-hb\include;</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\libfnd\include;..\libhac\include;..\libhac-hb\include;</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
<AdditionalIncludeDirectories>..\libfnd\include;..\libhac\include;..\libhac-hb\include;</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\libfnd\include;..\libhac\include;..\libhac-hb\include;</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
<AdditionalIncludeDirectories>..\libfnd\include;..\libhac\include;..\libhac-hb\include;</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\libfnd\include;..\libhac\include;..\libhac-hb\include;</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>MaxSpeed</Optimization>
|
<Optimization>MaxSpeed</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
<AdditionalIncludeDirectories>..\libfnd\include;..\libhac\include;..\libhac-hb\include;</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\libfnd\include;..\libhac\include;..\libhac-hb\include;</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="include\nn\hac\aset.h" />
|
<ClInclude Include="include\nn\hac\AssetHeader.h" />
|
||||||
<ClInclude Include="include\nn\hac\AssetHeader.h" />
|
<ClInclude Include="include\nn\hac\define\aset.h" />
|
||||||
<ClInclude Include="include\nn\hac\nro-hb.h" />
|
<ClInclude Include="include\nn\hac\define\nro-hb.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="source\AssetHeader.cpp" />
|
<ClCompile Include="source\AssetHeader.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="makefile" />
|
<None Include="makefile" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -1,36 +1,39 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Filter Include="Source Files">
|
<Filter Include="Source Files">
|
||||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter Include="Header Files">
|
<Filter Include="Header Files">
|
||||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
|
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter Include="Resource Files">
|
<Filter Include="Resource Files">
|
||||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||||
</Filter>
|
</Filter>
|
||||||
</ItemGroup>
|
<Filter Include="Header Files\define">
|
||||||
<ItemGroup>
|
<UniqueIdentifier>{33064298-d382-4e79-9fcd-bc401bdaa763}</UniqueIdentifier>
|
||||||
<ClInclude Include="include\nn\hac\aset.h">
|
</Filter>
|
||||||
<Filter>Header Files</Filter>
|
</ItemGroup>
|
||||||
</ClInclude>
|
<ItemGroup>
|
||||||
<ClInclude Include="include\nn\hac\AssetHeader.h">
|
<ClInclude Include="include\nn\hac\AssetHeader.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\nro-hb.h">
|
<ClInclude Include="include\nn\hac\define\aset.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files\define</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
</ItemGroup>
|
<ClInclude Include="include\nn\hac\define\nro-hb.h">
|
||||||
<ItemGroup>
|
<Filter>Header Files\define</Filter>
|
||||||
<ClCompile Include="source\AssetHeader.cpp">
|
</ClInclude>
|
||||||
<Filter>Source Files</Filter>
|
</ItemGroup>
|
||||||
</ClCompile>
|
<ItemGroup>
|
||||||
</ItemGroup>
|
<ClCompile Include="source\AssetHeader.cpp">
|
||||||
<ItemGroup>
|
<Filter>Source Files</Filter>
|
||||||
<None Include="makefile" />
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="makefile" />
|
||||||
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
57
lib/libhac/include/nn/hac/AccessControlInfo.h
Normal file
57
lib/libhac/include/nn/hac/AccessControlInfo.h
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
#pragma once
|
||||||
|
#include <string>
|
||||||
|
#include <fnd/types.h>
|
||||||
|
#include <fnd/IByteModel.h>
|
||||||
|
#include <nn/hac/define/aci.h>
|
||||||
|
#include <nn/hac/FileSystemAccessControl.h>
|
||||||
|
#include <nn/hac/ServiceAccessControl.h>
|
||||||
|
#include <nn/hac/KernelCapabilityControl.h>
|
||||||
|
|
||||||
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
|
{
|
||||||
|
class AccessControlInfo :
|
||||||
|
public fnd::IByteModel
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
AccessControlInfo();
|
||||||
|
AccessControlInfo(const AccessControlInfo& other);
|
||||||
|
|
||||||
|
void operator=(const AccessControlInfo& other);
|
||||||
|
bool operator==(const AccessControlInfo& other) const;
|
||||||
|
bool operator!=(const AccessControlInfo& other) const;
|
||||||
|
|
||||||
|
// IByteModel
|
||||||
|
void toBytes();
|
||||||
|
void fromBytes(const byte_t* data, size_t len);
|
||||||
|
const fnd::Vec<byte_t>& getBytes() const;
|
||||||
|
|
||||||
|
// variables
|
||||||
|
void clear();
|
||||||
|
|
||||||
|
uint64_t getProgramId() const;
|
||||||
|
void setProgramId(uint64_t program_id);
|
||||||
|
|
||||||
|
const nn::hac::FileSystemAccessControl& getFileSystemAccessControl() const;
|
||||||
|
void setFileSystemAccessControl(const FileSystemAccessControl& fac);
|
||||||
|
|
||||||
|
const nn::hac::ServiceAccessControl& getServiceAccessControl() const;
|
||||||
|
void setServiceAccessControl(const ServiceAccessControl& sac);
|
||||||
|
|
||||||
|
const nn::hac::KernelCapabilityControl& getKernelCapabilities() const;
|
||||||
|
void setKernelCapabilities(const KernelCapabilityControl& kc);
|
||||||
|
private:
|
||||||
|
const std::string kModuleName = "ACCESS_CONTROL_INFO_BINARY";
|
||||||
|
|
||||||
|
// raw data
|
||||||
|
fnd::Vec<byte_t> mRawBinary;
|
||||||
|
|
||||||
|
// variables
|
||||||
|
uint64_t mProgramId;
|
||||||
|
nn::hac::FileSystemAccessControl mFileSystemAccessControl;
|
||||||
|
nn::hac::ServiceAccessControl mServiceAccessControl;
|
||||||
|
nn::hac::KernelCapabilityControl mKernelCapabilities;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,56 +0,0 @@
|
||||||
#pragma once
|
|
||||||
#include <string>
|
|
||||||
#include <fnd/types.h>
|
|
||||||
#include <fnd/ISerialisable.h>
|
|
||||||
#include <nn/hac/aci.h>
|
|
||||||
#include <nn/hac/FileSystemAccessControlBinary.h>
|
|
||||||
#include <nn/hac/ServiceAccessControlBinary.h>
|
|
||||||
#include <nn/hac/KernelCapabilityBinary.h>
|
|
||||||
|
|
||||||
namespace nn
|
|
||||||
{
|
|
||||||
namespace hac
|
|
||||||
{
|
|
||||||
class AccessControlInfoBinary : public fnd::ISerialisable
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
AccessControlInfoBinary();
|
|
||||||
AccessControlInfoBinary(const AccessControlInfoBinary& other);
|
|
||||||
|
|
||||||
void operator=(const AccessControlInfoBinary& other);
|
|
||||||
bool operator==(const AccessControlInfoBinary& other) const;
|
|
||||||
bool operator!=(const AccessControlInfoBinary& other) const;
|
|
||||||
|
|
||||||
// export/import binary
|
|
||||||
void toBytes();
|
|
||||||
void fromBytes(const byte_t* data, size_t len);
|
|
||||||
const fnd::Vec<byte_t>& getBytes() const;
|
|
||||||
|
|
||||||
// variables
|
|
||||||
void clear();
|
|
||||||
|
|
||||||
uint64_t getProgramId() const;
|
|
||||||
void setProgramId(uint64_t program_id);
|
|
||||||
|
|
||||||
const nn::hac::FileSystemAccessControlBinary& getFileSystemAccessControl() const;
|
|
||||||
void setFileSystemAccessControl(const FileSystemAccessControlBinary& fac);
|
|
||||||
|
|
||||||
const nn::hac::ServiceAccessControlBinary& getServiceAccessControl() const;
|
|
||||||
void setServiceAccessControl(const ServiceAccessControlBinary& sac);
|
|
||||||
|
|
||||||
const nn::hac::KernelCapabilityBinary& getKernelCapabilities() const;
|
|
||||||
void setKernelCapabilities(const KernelCapabilityBinary& kc);
|
|
||||||
private:
|
|
||||||
const std::string kModuleName = "ACCESS_CONTROL_INFO_BINARY";
|
|
||||||
|
|
||||||
// raw data
|
|
||||||
fnd::Vec<byte_t> mRawBinary;
|
|
||||||
|
|
||||||
// variables
|
|
||||||
uint64_t mProgramId;
|
|
||||||
nn::hac::FileSystemAccessControlBinary mFileSystemAccessControl;
|
|
||||||
nn::hac::ServiceAccessControlBinary mServiceAccessControl;
|
|
||||||
nn::hac::KernelCapabilityBinary mKernelCapabilities;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
92
lib/libhac/include/nn/hac/AccessControlInfoDesc.h
Normal file
92
lib/libhac/include/nn/hac/AccessControlInfoDesc.h
Normal file
|
@ -0,0 +1,92 @@
|
||||||
|
#pragma once
|
||||||
|
#include <string>
|
||||||
|
#include <fnd/types.h>
|
||||||
|
#include <fnd/List.h>
|
||||||
|
#include <fnd/IByteModel.h>
|
||||||
|
#include <nn/hac/define/aci.h>
|
||||||
|
#include <nn/hac/FileSystemAccessControl.h>
|
||||||
|
#include <nn/hac/ServiceAccessControl.h>
|
||||||
|
#include <nn/hac/KernelCapabilityControl.h>
|
||||||
|
|
||||||
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
|
{
|
||||||
|
class AccessControlInfoDesc :
|
||||||
|
public fnd::IByteModel
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
struct sProgramIdRestrict
|
||||||
|
{
|
||||||
|
uint64_t min;
|
||||||
|
uint64_t max;
|
||||||
|
|
||||||
|
void operator=(const sProgramIdRestrict& other)
|
||||||
|
{
|
||||||
|
min = other.min;
|
||||||
|
max = other.max;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator==(const sProgramIdRestrict& other) const
|
||||||
|
{
|
||||||
|
return (min == other.min) \
|
||||||
|
&& (max == other.max);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator!=(const sProgramIdRestrict& other) const
|
||||||
|
{
|
||||||
|
return !(*this == other);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
AccessControlInfoDesc();
|
||||||
|
AccessControlInfoDesc(const AccessControlInfoDesc& other);
|
||||||
|
|
||||||
|
void operator=(const AccessControlInfoDesc& other);
|
||||||
|
bool operator==(const AccessControlInfoDesc& other) const;
|
||||||
|
bool operator!=(const AccessControlInfoDesc& other) const;
|
||||||
|
|
||||||
|
// IByteModel
|
||||||
|
void toBytes();
|
||||||
|
void fromBytes(const byte_t* data, size_t len);
|
||||||
|
const fnd::Vec<byte_t>& getBytes() const;
|
||||||
|
|
||||||
|
void generateSignature(const fnd::rsa::sRsa2048Key& key);
|
||||||
|
void validateSignature(const fnd::rsa::sRsa2048Key& key) const;
|
||||||
|
|
||||||
|
// variables
|
||||||
|
void clear();
|
||||||
|
|
||||||
|
const fnd::rsa::sRsa2048Key& getContentArchiveHeaderSignature2Key() const;
|
||||||
|
void setContentArchiveHeaderSignature2Key(const fnd::rsa::sRsa2048Key& key);
|
||||||
|
|
||||||
|
const fnd::List<aci::Flag>& getFlagList() const;
|
||||||
|
void setFlagList(const fnd::List<aci::Flag>& flags);
|
||||||
|
|
||||||
|
const sProgramIdRestrict& getProgramIdRestrict() const;
|
||||||
|
void setProgramIdRestrict(const sProgramIdRestrict& pid_restrict);
|
||||||
|
|
||||||
|
const nn::hac::FileSystemAccessControl& getFileSystemAccessControl() const;
|
||||||
|
void setFileSystemAccessControl(const FileSystemAccessControl& fac);
|
||||||
|
|
||||||
|
const nn::hac::ServiceAccessControl& getServiceAccessControl() const;
|
||||||
|
void setServiceAccessControl(const ServiceAccessControl& sac);
|
||||||
|
|
||||||
|
const nn::hac::KernelCapabilityControl& getKernelCapabilities() const;
|
||||||
|
void setKernelCapabilities(const KernelCapabilityControl& kc);
|
||||||
|
private:
|
||||||
|
const std::string kModuleName = "ACCESS_CONTROL_INFO_DESC_BINARY";
|
||||||
|
|
||||||
|
// raw data
|
||||||
|
fnd::Vec<byte_t> mRawBinary;
|
||||||
|
|
||||||
|
// variables
|
||||||
|
fnd::rsa::sRsa2048Key mContentArchiveHeaderSignature2Key;
|
||||||
|
fnd::List<aci::Flag> mFlags;
|
||||||
|
sProgramIdRestrict mProgramIdRestrict;
|
||||||
|
nn::hac::FileSystemAccessControl mFileSystemAccessControl;
|
||||||
|
nn::hac::ServiceAccessControl mServiceAccessControl;
|
||||||
|
nn::hac::KernelCapabilityControl mKernelCapabilities;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,91 +0,0 @@
|
||||||
#pragma once
|
|
||||||
#include <string>
|
|
||||||
#include <fnd/types.h>
|
|
||||||
#include <fnd/List.h>
|
|
||||||
#include <fnd/ISerialisable.h>
|
|
||||||
#include <nn/hac/aci.h>
|
|
||||||
#include <nn/hac/FileSystemAccessControlBinary.h>
|
|
||||||
#include <nn/hac/ServiceAccessControlBinary.h>
|
|
||||||
#include <nn/hac/KernelCapabilityBinary.h>
|
|
||||||
|
|
||||||
namespace nn
|
|
||||||
{
|
|
||||||
namespace hac
|
|
||||||
{
|
|
||||||
class AccessControlInfoDescBinary : public fnd::ISerialisable
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
struct sProgramIdRestrict
|
|
||||||
{
|
|
||||||
uint64_t min;
|
|
||||||
uint64_t max;
|
|
||||||
|
|
||||||
void operator=(const sProgramIdRestrict& other)
|
|
||||||
{
|
|
||||||
min = other.min;
|
|
||||||
max = other.max;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator==(const sProgramIdRestrict& other) const
|
|
||||||
{
|
|
||||||
return (min == other.min) \
|
|
||||||
&& (max == other.max);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator!=(const sProgramIdRestrict& other) const
|
|
||||||
{
|
|
||||||
return !(*this == other);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
AccessControlInfoDescBinary();
|
|
||||||
AccessControlInfoDescBinary(const AccessControlInfoDescBinary& other);
|
|
||||||
|
|
||||||
void operator=(const AccessControlInfoDescBinary& other);
|
|
||||||
bool operator==(const AccessControlInfoDescBinary& other) const;
|
|
||||||
bool operator!=(const AccessControlInfoDescBinary& other) const;
|
|
||||||
|
|
||||||
// export/import binary
|
|
||||||
void toBytes();
|
|
||||||
void fromBytes(const byte_t* data, size_t len);
|
|
||||||
const fnd::Vec<byte_t>& getBytes() const;
|
|
||||||
|
|
||||||
void generateSignature(const fnd::rsa::sRsa2048Key& key);
|
|
||||||
void validateSignature(const fnd::rsa::sRsa2048Key& key) const;
|
|
||||||
|
|
||||||
// variables
|
|
||||||
void clear();
|
|
||||||
|
|
||||||
const fnd::rsa::sRsa2048Key& getNcaHeaderSignature2Key() const;
|
|
||||||
void setNcaHeaderSignature2Key(const fnd::rsa::sRsa2048Key& key);
|
|
||||||
|
|
||||||
const fnd::List<aci::Flag>& getFlagList() const;
|
|
||||||
void setFlagList(const fnd::List<aci::Flag>& flags);
|
|
||||||
|
|
||||||
const sProgramIdRestrict& getProgramIdRestrict() const;
|
|
||||||
void setProgramIdRestrict(const sProgramIdRestrict& pid_restrict);
|
|
||||||
|
|
||||||
const nn::hac::FileSystemAccessControlBinary& getFileSystemAccessControl() const;
|
|
||||||
void setFileSystemAccessControl(const FileSystemAccessControlBinary& fac);
|
|
||||||
|
|
||||||
const nn::hac::ServiceAccessControlBinary& getServiceAccessControl() const;
|
|
||||||
void setServiceAccessControl(const ServiceAccessControlBinary& sac);
|
|
||||||
|
|
||||||
const nn::hac::KernelCapabilityBinary& getKernelCapabilities() const;
|
|
||||||
void setKernelCapabilities(const KernelCapabilityBinary& kc);
|
|
||||||
private:
|
|
||||||
const std::string kModuleName = "ACCESS_CONTROL_INFO_DESC_BINARY";
|
|
||||||
|
|
||||||
// raw data
|
|
||||||
fnd::Vec<byte_t> mRawBinary;
|
|
||||||
|
|
||||||
// variables
|
|
||||||
fnd::rsa::sRsa2048Key mNcaHeaderSignature2Key;
|
|
||||||
fnd::List<aci::Flag> mFlags;
|
|
||||||
sProgramIdRestrict mProgramIdRestrict;
|
|
||||||
nn::hac::FileSystemAccessControlBinary mFileSystemAccessControl;
|
|
||||||
nn::hac::ServiceAccessControlBinary mServiceAccessControl;
|
|
||||||
nn::hac::KernelCapabilityBinary mKernelCapabilities;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
46
lib/libhac/include/nn/hac/AddOnContentMetaExtendedHeader.h
Normal file
46
lib/libhac/include/nn/hac/AddOnContentMetaExtendedHeader.h
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
#pragma once
|
||||||
|
#include <string>
|
||||||
|
#include <cstring>
|
||||||
|
#include <fnd/IByteModel.h>
|
||||||
|
#include <nn/hac/define/cnmt.h>
|
||||||
|
|
||||||
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
|
{
|
||||||
|
class AddOnContentMetaExtendedHeader :
|
||||||
|
public fnd::IByteModel
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
AddOnContentMetaExtendedHeader();
|
||||||
|
AddOnContentMetaExtendedHeader(const AddOnContentMetaExtendedHeader& other);
|
||||||
|
|
||||||
|
void operator=(const AddOnContentMetaExtendedHeader& other);
|
||||||
|
bool operator==(const AddOnContentMetaExtendedHeader& other) const;
|
||||||
|
bool operator!=(const AddOnContentMetaExtendedHeader& other) const;
|
||||||
|
|
||||||
|
// IByteModel
|
||||||
|
void toBytes();
|
||||||
|
void fromBytes(const byte_t* bytes, size_t len);
|
||||||
|
const fnd::Vec<byte_t>& getBytes() const;
|
||||||
|
|
||||||
|
// variables
|
||||||
|
void clear();
|
||||||
|
|
||||||
|
uint64_t getApplicationId() const;
|
||||||
|
void setApplicationId(uint64_t application_id);
|
||||||
|
|
||||||
|
uint32_t getRequiredApplicationVersion() const;
|
||||||
|
void setRequiredApplicationVersion(uint32_t app_ver);
|
||||||
|
private:
|
||||||
|
const std::string kModuleName = "ADD_ON_CONTENT_META_EXTENDED_HEADER";
|
||||||
|
|
||||||
|
// binary blob
|
||||||
|
fnd::Vec<byte_t> mRawBinary;
|
||||||
|
|
||||||
|
// variables
|
||||||
|
uint64_t mApplicationId;
|
||||||
|
uint32_t mRequiredApplicationVersion;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,269 +1,269 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <fnd/ISerialisable.h>
|
#include <fnd/IByteModel.h>
|
||||||
#include <fnd/List.h>
|
#include <fnd/List.h>
|
||||||
#include <nn/hac/nacp.h>
|
#include <nn/hac/define/nacp.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
{
|
{
|
||||||
namespace hac
|
namespace hac
|
||||||
{
|
{
|
||||||
class ApplicationControlPropertyBinary :
|
class ApplicationControlProperty :
|
||||||
public fnd::ISerialisable
|
public fnd::IByteModel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
struct sTitle
|
struct sTitle
|
||||||
{
|
{
|
||||||
nacp::Language language;
|
nacp::Language language;
|
||||||
std::string name;
|
std::string name;
|
||||||
std::string publisher;
|
std::string publisher;
|
||||||
|
|
||||||
void operator=(const sTitle& other)
|
void operator=(const sTitle& other)
|
||||||
{
|
{
|
||||||
language = other.language;
|
language = other.language;
|
||||||
name = other.name;
|
name = other.name;
|
||||||
publisher = other.publisher;
|
publisher = other.publisher;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator==(const sTitle& other) const
|
bool operator==(const sTitle& other) const
|
||||||
{
|
{
|
||||||
return (language == other.language) \
|
return (language == other.language) \
|
||||||
&& (name == other.name) \
|
&& (name == other.name) \
|
||||||
&& (publisher == other.publisher);
|
&& (publisher == other.publisher);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=(const sTitle& other) const
|
bool operator!=(const sTitle& other) const
|
||||||
{
|
{
|
||||||
return !operator==(other);
|
return !operator==(other);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sRating
|
struct sRating
|
||||||
{
|
{
|
||||||
nacp::Organisation organisation;
|
nacp::Organisation organisation;
|
||||||
int8_t age;
|
int8_t age;
|
||||||
|
|
||||||
void operator=(const sRating& other)
|
void operator=(const sRating& other)
|
||||||
{
|
{
|
||||||
organisation = other.organisation;
|
organisation = other.organisation;
|
||||||
age = other.age;
|
age = other.age;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator==(const sRating& other) const
|
bool operator==(const sRating& other) const
|
||||||
{
|
{
|
||||||
return (organisation == other.organisation) \
|
return (organisation == other.organisation) \
|
||||||
&& (age == other.age);
|
&& (age == other.age);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=(const sRating& other) const
|
bool operator!=(const sRating& other) const
|
||||||
{
|
{
|
||||||
return !operator==(other);
|
return !operator==(other);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sStorageSize
|
struct sStorageSize
|
||||||
{
|
{
|
||||||
int64_t size;
|
int64_t size;
|
||||||
int64_t journal_size;
|
int64_t journal_size;
|
||||||
|
|
||||||
void operator=(const sStorageSize& other)
|
void operator=(const sStorageSize& other)
|
||||||
{
|
{
|
||||||
size = other.size;
|
size = other.size;
|
||||||
journal_size = other.journal_size;
|
journal_size = other.journal_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator==(const sStorageSize& other) const
|
bool operator==(const sStorageSize& other) const
|
||||||
{
|
{
|
||||||
return (size == other.size) \
|
return (size == other.size) \
|
||||||
&& (journal_size == other.journal_size);
|
&& (journal_size == other.journal_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=(const sStorageSize& other) const
|
bool operator!=(const sStorageSize& other) const
|
||||||
{
|
{
|
||||||
return !operator==(other);
|
return !operator==(other);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ApplicationControlPropertyBinary();
|
ApplicationControlProperty();
|
||||||
ApplicationControlPropertyBinary(const ApplicationControlPropertyBinary& other);
|
ApplicationControlProperty(const ApplicationControlProperty& other);
|
||||||
|
|
||||||
void operator=(const ApplicationControlPropertyBinary& other);
|
void operator=(const ApplicationControlProperty& other);
|
||||||
bool operator==(const ApplicationControlPropertyBinary& other) const;
|
bool operator==(const ApplicationControlProperty& other) const;
|
||||||
bool operator!=(const ApplicationControlPropertyBinary& other) const;
|
bool operator!=(const ApplicationControlProperty& other) const;
|
||||||
|
|
||||||
// export/import binary
|
// IByteModel
|
||||||
void toBytes();
|
void toBytes();
|
||||||
void fromBytes(const byte_t* bytes, size_t len);
|
void fromBytes(const byte_t* bytes, size_t len);
|
||||||
const fnd::Vec<byte_t>& getBytes() const;
|
const fnd::Vec<byte_t>& getBytes() const;
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
const fnd::List<sTitle>& getTitle() const;
|
const fnd::List<sTitle>& getTitle() const;
|
||||||
void setTitle(const fnd::List<sTitle>& title);
|
void setTitle(const fnd::List<sTitle>& title);
|
||||||
|
|
||||||
const std::string& getIsbn() const;
|
const std::string& getIsbn() const;
|
||||||
void setIsbn(const std::string& isbn);
|
void setIsbn(const std::string& isbn);
|
||||||
|
|
||||||
nacp::StartupUserAccount getStartupUserAccount() const;
|
nacp::StartupUserAccount getStartupUserAccount() const;
|
||||||
void setStartupUserAccount(nacp::StartupUserAccount var);
|
void setStartupUserAccount(nacp::StartupUserAccount var);
|
||||||
|
|
||||||
nacp::TouchScreenUsageMode getTouchScreenUsageMode() const;
|
nacp::TouchScreenUsageMode getTouchScreenUsageMode() const;
|
||||||
void setTouchScreenUsageMode(nacp::TouchScreenUsageMode var);
|
void setTouchScreenUsageMode(nacp::TouchScreenUsageMode var);
|
||||||
|
|
||||||
nacp::AocRegistrationType getAocRegistrationType() const;
|
nacp::AocRegistrationType getAocRegistrationType() const;
|
||||||
void setAocRegistrationType(nacp::AocRegistrationType var);
|
void setAocRegistrationType(nacp::AocRegistrationType var);
|
||||||
|
|
||||||
nacp::AttributeFlag getAttributeFlag() const;
|
nacp::AttributeFlag getAttributeFlag() const;
|
||||||
void setAttributeFlag(nacp::AttributeFlag var);
|
void setAttributeFlag(nacp::AttributeFlag var);
|
||||||
|
|
||||||
const fnd::List<nacp::Language>& getSupportedLanguages() const;
|
const fnd::List<nacp::Language>& getSupportedLanguages() const;
|
||||||
void setSupportedLanguages(const fnd::List<nacp::Language>& var);
|
void setSupportedLanguages(const fnd::List<nacp::Language>& var);
|
||||||
|
|
||||||
nacp::ParentalControlFlag getParentalControlFlag() const;
|
nacp::ParentalControlFlag getParentalControlFlag() const;
|
||||||
void setParentalControlFlag(nacp::ParentalControlFlag var);
|
void setParentalControlFlag(nacp::ParentalControlFlag var);
|
||||||
|
|
||||||
nacp::ScreenshotMode getScreenshotMode() const;
|
nacp::ScreenshotMode getScreenshotMode() const;
|
||||||
void setScreenshotMode(nacp::ScreenshotMode var);
|
void setScreenshotMode(nacp::ScreenshotMode var);
|
||||||
|
|
||||||
nacp::VideoCaptureMode getVideoCaptureMode() const;
|
nacp::VideoCaptureMode getVideoCaptureMode() const;
|
||||||
void setVideoCaptureMode(nacp::VideoCaptureMode var);
|
void setVideoCaptureMode(nacp::VideoCaptureMode var);
|
||||||
|
|
||||||
nacp::DataLossConfirmation getDataLossConfirmation() const;
|
nacp::DataLossConfirmation getDataLossConfirmation() const;
|
||||||
void setDataLossConfirmation(nacp::DataLossConfirmation var);
|
void setDataLossConfirmation(nacp::DataLossConfirmation var);
|
||||||
|
|
||||||
nacp::PlayLogPolicy getPlayLogPolicy() const;
|
nacp::PlayLogPolicy getPlayLogPolicy() const;
|
||||||
void setPlayLogPolicy(nacp::PlayLogPolicy var);
|
void setPlayLogPolicy(nacp::PlayLogPolicy var);
|
||||||
|
|
||||||
uint64_t getPresenceGroupId() const;
|
uint64_t getPresenceGroupId() const;
|
||||||
void setPresenceGroupId(uint64_t var);
|
void setPresenceGroupId(uint64_t var);
|
||||||
|
|
||||||
const fnd::List<sRating>& getRatingAge() const;
|
const fnd::List<sRating>& getRatingAge() const;
|
||||||
void setRatingAge(const fnd::List<sRating>& var);
|
void setRatingAge(const fnd::List<sRating>& var);
|
||||||
|
|
||||||
const std::string& getDisplayVersion() const;
|
const std::string& getDisplayVersion() const;
|
||||||
void setDisplayVersion(const std::string& var);
|
void setDisplayVersion(const std::string& var);
|
||||||
|
|
||||||
uint64_t getAocBaseId() const;
|
uint64_t getAocBaseId() const;
|
||||||
void setAocBaseId(uint64_t var);
|
void setAocBaseId(uint64_t var);
|
||||||
|
|
||||||
uint64_t getSaveDatawOwnerId() const;
|
uint64_t getSaveDatawOwnerId() const;
|
||||||
void setSaveDatawOwnerId(uint64_t var);
|
void setSaveDatawOwnerId(uint64_t var);
|
||||||
|
|
||||||
const sStorageSize& getUserAccountSaveDataSize() const;
|
const sStorageSize& getUserAccountSaveDataSize() const;
|
||||||
void setUserAccountSaveDataSize(const sStorageSize& var);
|
void setUserAccountSaveDataSize(const sStorageSize& var);
|
||||||
|
|
||||||
const sStorageSize& getDeviceSaveDataSize() const;
|
const sStorageSize& getDeviceSaveDataSize() const;
|
||||||
void setDeviceSaveDataSize(const sStorageSize& var);
|
void setDeviceSaveDataSize(const sStorageSize& var);
|
||||||
|
|
||||||
int64_t getBcatDeliveryCacheStorageSize() const;
|
int64_t getBcatDeliveryCacheStorageSize() const;
|
||||||
void setBcatDeliveryCacheStorageSize(int64_t var);
|
void setBcatDeliveryCacheStorageSize(int64_t var);
|
||||||
|
|
||||||
const std::string& getApplicationErrorCodeCategory() const;
|
const std::string& getApplicationErrorCodeCategory() const;
|
||||||
void setApplicationErrorCodeCategory(const std::string& var);
|
void setApplicationErrorCodeCategory(const std::string& var);
|
||||||
|
|
||||||
const fnd::List<uint64_t>& getLocalCommunicationId() const;
|
const fnd::List<uint64_t>& getLocalCommunicationId() const;
|
||||||
void setLocalCommunicationId(const fnd::List<uint64_t>& var);
|
void setLocalCommunicationId(const fnd::List<uint64_t>& var);
|
||||||
|
|
||||||
nacp::LogoType getLogoType() const;
|
nacp::LogoType getLogoType() const;
|
||||||
void setLogoType(nacp::LogoType var);
|
void setLogoType(nacp::LogoType var);
|
||||||
|
|
||||||
nacp::LogoHandling getLogoHandling() const;
|
nacp::LogoHandling getLogoHandling() const;
|
||||||
void setLogoHandling(nacp::LogoHandling var);
|
void setLogoHandling(nacp::LogoHandling var);
|
||||||
|
|
||||||
nacp::RuntimeAocInstallMode getRuntimeAocInstallMode() const;
|
nacp::RuntimeAocInstallMode getRuntimeAocInstallMode() const;
|
||||||
void setRuntimeAocInstallMode(nacp::RuntimeAocInstallMode var);
|
void setRuntimeAocInstallMode(nacp::RuntimeAocInstallMode var);
|
||||||
|
|
||||||
nacp::CrashReportMode getCrashReportMode() const;
|
nacp::CrashReportMode getCrashReportMode() const;
|
||||||
void setCrashReportMode(nacp::CrashReportMode var);
|
void setCrashReportMode(nacp::CrashReportMode var);
|
||||||
|
|
||||||
nacp::Hdcp getHdcp() const;
|
nacp::Hdcp getHdcp() const;
|
||||||
void setHdcp(nacp::Hdcp var);
|
void setHdcp(nacp::Hdcp var);
|
||||||
|
|
||||||
uint64_t getSeedForPsuedoDeviceId() const;
|
uint64_t getSeedForPsuedoDeviceId() const;
|
||||||
void setSeedForPsuedoDeviceId(uint64_t var);
|
void setSeedForPsuedoDeviceId(uint64_t var);
|
||||||
|
|
||||||
const std::string& getBcatPassphase() const;
|
const std::string& getBcatPassphase() const;
|
||||||
void setBcatPassphase(const std::string& var);
|
void setBcatPassphase(const std::string& var);
|
||||||
|
|
||||||
const sStorageSize& getUserAccountSaveDataMax() const;
|
const sStorageSize& getUserAccountSaveDataMax() const;
|
||||||
void setUserAccountSaveDataMax(const sStorageSize& var);
|
void setUserAccountSaveDataMax(const sStorageSize& var);
|
||||||
|
|
||||||
const sStorageSize& getDeviceSaveDataMax() const;
|
const sStorageSize& getDeviceSaveDataMax() const;
|
||||||
void setDeviceSaveDataMax(const sStorageSize& var);
|
void setDeviceSaveDataMax(const sStorageSize& var);
|
||||||
|
|
||||||
int64_t getTemporaryStorageSize() const;
|
int64_t getTemporaryStorageSize() const;
|
||||||
void setTemporaryStorageSize(int64_t var);
|
void setTemporaryStorageSize(int64_t var);
|
||||||
|
|
||||||
const sStorageSize& getCacheStorageSize() const;
|
const sStorageSize& getCacheStorageSize() const;
|
||||||
void setCacheStorageSize(const sStorageSize& var);
|
void setCacheStorageSize(const sStorageSize& var);
|
||||||
|
|
||||||
int64_t getCacheStorageDataAndJournalSizeMax() const;
|
int64_t getCacheStorageDataAndJournalSizeMax() const;
|
||||||
void setCacheStorageDataAndJournalSizeMax(int64_t var);
|
void setCacheStorageDataAndJournalSizeMax(int64_t var);
|
||||||
|
|
||||||
uint16_t getCacheStorageIndexMax() const;
|
uint16_t getCacheStorageIndexMax() const;
|
||||||
void setCacheStorageIndexMax(uint16_t var);
|
void setCacheStorageIndexMax(uint16_t var);
|
||||||
|
|
||||||
const fnd::List<uint64_t>& getPlayLogQueryableApplicationId() const;
|
const fnd::List<uint64_t>& getPlayLogQueryableApplicationId() const;
|
||||||
void setPlayLogQueryableApplicationId(const fnd::List<uint64_t>& var);
|
void setPlayLogQueryableApplicationId(const fnd::List<uint64_t>& var);
|
||||||
|
|
||||||
nacp::PlayLogQueryCapability getPlayLogQueryCapability() const;
|
nacp::PlayLogQueryCapability getPlayLogQueryCapability() const;
|
||||||
void setPlayLogQueryCapability(nacp::PlayLogQueryCapability var);
|
void setPlayLogQueryCapability(nacp::PlayLogQueryCapability var);
|
||||||
|
|
||||||
nacp::RepairFlag getRepairFlag() const;
|
nacp::RepairFlag getRepairFlag() const;
|
||||||
void setRepairFlag(nacp::RepairFlag var);
|
void setRepairFlag(nacp::RepairFlag var);
|
||||||
|
|
||||||
byte_t getProgramIndex() const;
|
byte_t getProgramIndex() const;
|
||||||
void setProgramIndex(byte_t var);
|
void setProgramIndex(byte_t var);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const std::string kModuleName = "APPLICATION_CONTROL_PROPERTY";
|
const std::string kModuleName = "APPLICATION_CONTROL_PROPERTY";
|
||||||
|
|
||||||
// raw data
|
// raw data
|
||||||
fnd::Vec<byte_t> mRawBinary;
|
fnd::Vec<byte_t> mRawBinary;
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
fnd::List<sTitle> mTitle;
|
fnd::List<sTitle> mTitle;
|
||||||
std::string mIsbn;
|
std::string mIsbn;
|
||||||
nacp::StartupUserAccount mStartupUserAccount;
|
nacp::StartupUserAccount mStartupUserAccount;
|
||||||
nacp::TouchScreenUsageMode mTouchScreenUsageMode;
|
nacp::TouchScreenUsageMode mTouchScreenUsageMode;
|
||||||
nacp::AocRegistrationType mAocRegistrationType;
|
nacp::AocRegistrationType mAocRegistrationType;
|
||||||
nacp::AttributeFlag mAttributeFlag;
|
nacp::AttributeFlag mAttributeFlag;
|
||||||
fnd::List<nn::hac::nacp::Language> mSupportedLanguages;
|
fnd::List<nn::hac::nacp::Language> mSupportedLanguages;
|
||||||
nacp::ParentalControlFlag mParentalControlFlag;
|
nacp::ParentalControlFlag mParentalControlFlag;
|
||||||
nacp::ScreenshotMode mScreenshotMode;
|
nacp::ScreenshotMode mScreenshotMode;
|
||||||
nacp::VideoCaptureMode mVideoCaptureMode;
|
nacp::VideoCaptureMode mVideoCaptureMode;
|
||||||
nacp::DataLossConfirmation mDataLossConfirmation;
|
nacp::DataLossConfirmation mDataLossConfirmation;
|
||||||
nacp::PlayLogPolicy mPlayLogPolicy;
|
nacp::PlayLogPolicy mPlayLogPolicy;
|
||||||
uint64_t mPresenceGroupId;
|
uint64_t mPresenceGroupId;
|
||||||
fnd::List<sRating> mRatingAge;
|
fnd::List<sRating> mRatingAge;
|
||||||
std::string mDisplayVersion;
|
std::string mDisplayVersion;
|
||||||
uint64_t mAocBaseId;
|
uint64_t mAocBaseId;
|
||||||
uint64_t mSaveDatawOwnerId;
|
uint64_t mSaveDatawOwnerId;
|
||||||
sStorageSize mUserAccountSaveDataSize;
|
sStorageSize mUserAccountSaveDataSize;
|
||||||
sStorageSize mDeviceSaveDataSize;
|
sStorageSize mDeviceSaveDataSize;
|
||||||
int64_t mBcatDeliveryCacheStorageSize;
|
int64_t mBcatDeliveryCacheStorageSize;
|
||||||
std::string mApplicationErrorCodeCategory;
|
std::string mApplicationErrorCodeCategory;
|
||||||
fnd::List<uint64_t> mLocalCommunicationId;
|
fnd::List<uint64_t> mLocalCommunicationId;
|
||||||
nacp::LogoType mLogoType;
|
nacp::LogoType mLogoType;
|
||||||
nacp::LogoHandling mLogoHandling;
|
nacp::LogoHandling mLogoHandling;
|
||||||
nacp::RuntimeAocInstallMode mRuntimeAocInstallMode;
|
nacp::RuntimeAocInstallMode mRuntimeAocInstallMode;
|
||||||
nacp::CrashReportMode mCrashReportMode;
|
nacp::CrashReportMode mCrashReportMode;
|
||||||
nacp::Hdcp mHdcp;
|
nacp::Hdcp mHdcp;
|
||||||
uint64_t mSeedForPsuedoDeviceId;
|
uint64_t mSeedForPsuedoDeviceId;
|
||||||
std::string mBcatPassphase;
|
std::string mBcatPassphase;
|
||||||
sStorageSize mUserAccountSaveDataMax;
|
sStorageSize mUserAccountSaveDataMax;
|
||||||
sStorageSize mDeviceSaveDataMax;
|
sStorageSize mDeviceSaveDataMax;
|
||||||
int64_t mTemporaryStorageSize;
|
int64_t mTemporaryStorageSize;
|
||||||
sStorageSize mCacheStorageSize;
|
sStorageSize mCacheStorageSize;
|
||||||
int64_t mCacheStorageDataAndJournalSizeMax;
|
int64_t mCacheStorageDataAndJournalSizeMax;
|
||||||
uint16_t mCacheStorageIndexMax;
|
uint16_t mCacheStorageIndexMax;
|
||||||
fnd::List<uint64_t> mPlayLogQueryableApplicationId;
|
fnd::List<uint64_t> mPlayLogQueryableApplicationId;
|
||||||
nacp::PlayLogQueryCapability mPlayLogQueryCapability;
|
nacp::PlayLogQueryCapability mPlayLogQueryCapability;
|
||||||
nacp::RepairFlag mRepairFlag;
|
nacp::RepairFlag mRepairFlag;
|
||||||
byte_t mProgramIndex;
|
byte_t mProgramIndex;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,15 +1,15 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <nn/hac/nacp.h>
|
#include <nn/hac/define/nacp.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
{
|
{
|
||||||
namespace hac
|
namespace hac
|
||||||
{
|
{
|
||||||
class ApplicationControlPropertyUtils
|
class ApplicationControlPropertyUtils
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static bool validateSaveDataSizeMax(int64_t size, int64_t alignment);
|
static bool validateSaveDataSizeMax(int64_t size, int64_t alignment);
|
||||||
static bool validateSaveDataSize(int64_t size);
|
static bool validateSaveDataSize(int64_t size);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
46
lib/libhac/include/nn/hac/ApplicationMetaExtendedHeader.h
Normal file
46
lib/libhac/include/nn/hac/ApplicationMetaExtendedHeader.h
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
#pragma once
|
||||||
|
#include <string>
|
||||||
|
#include <cstring>
|
||||||
|
#include <fnd/IByteModel.h>
|
||||||
|
#include <nn/hac/define/cnmt.h>
|
||||||
|
|
||||||
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
|
{
|
||||||
|
class ApplicationMetaExtendedHeader :
|
||||||
|
public fnd::IByteModel
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ApplicationMetaExtendedHeader();
|
||||||
|
ApplicationMetaExtendedHeader(const ApplicationMetaExtendedHeader& other);
|
||||||
|
|
||||||
|
void operator=(const ApplicationMetaExtendedHeader& other);
|
||||||
|
bool operator==(const ApplicationMetaExtendedHeader& other) const;
|
||||||
|
bool operator!=(const ApplicationMetaExtendedHeader& other) const;
|
||||||
|
|
||||||
|
// IByteModel
|
||||||
|
void toBytes();
|
||||||
|
void fromBytes(const byte_t* bytes, size_t len);
|
||||||
|
const fnd::Vec<byte_t>& getBytes() const;
|
||||||
|
|
||||||
|
// variables
|
||||||
|
void clear();
|
||||||
|
|
||||||
|
uint64_t getPatchId() const;
|
||||||
|
void setPatchId(uint64_t patch_id);
|
||||||
|
|
||||||
|
uint32_t getRequiredSystemVersion() const;
|
||||||
|
void setRequiredSystemVersion(uint32_t sys_ver);
|
||||||
|
private:
|
||||||
|
const std::string kModuleName = "APPLICATION_META_EXTENDED_HEADER";
|
||||||
|
|
||||||
|
// binary blob
|
||||||
|
fnd::Vec<byte_t> mRawBinary;
|
||||||
|
|
||||||
|
// variables
|
||||||
|
uint64_t mPatchId;
|
||||||
|
uint32_t mRequiredSystemVersion;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
121
lib/libhac/include/nn/hac/ContentArchiveHeader.h
Normal file
121
lib/libhac/include/nn/hac/ContentArchiveHeader.h
Normal file
|
@ -0,0 +1,121 @@
|
||||||
|
#pragma once
|
||||||
|
#include <nn/hac/define/nca.h>
|
||||||
|
#include <fnd/IByteModel.h>
|
||||||
|
#include <fnd/List.h>
|
||||||
|
|
||||||
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
|
{
|
||||||
|
class ContentArchiveHeader :
|
||||||
|
public fnd::IByteModel
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
struct sPartitionEntry
|
||||||
|
{
|
||||||
|
byte_t header_index;
|
||||||
|
uint64_t offset;
|
||||||
|
uint64_t size;
|
||||||
|
fnd::sha::sSha256Hash fs_header_hash;
|
||||||
|
|
||||||
|
const sPartitionEntry& operator=(const sPartitionEntry& other)
|
||||||
|
{
|
||||||
|
header_index = other.header_index;
|
||||||
|
offset = other.offset;
|
||||||
|
size = other.size;
|
||||||
|
fs_header_hash = other.fs_header_hash;
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator==(const sPartitionEntry& other) const
|
||||||
|
{
|
||||||
|
return (header_index == other.header_index) \
|
||||||
|
&& (offset == other.offset) \
|
||||||
|
&& (size == other.size) \
|
||||||
|
&& (fs_header_hash == other.fs_header_hash);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator!=(const sPartitionEntry& other) const
|
||||||
|
{
|
||||||
|
return !operator==(other);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
ContentArchiveHeader();
|
||||||
|
ContentArchiveHeader(const ContentArchiveHeader& other);
|
||||||
|
|
||||||
|
void operator=(const ContentArchiveHeader& other);
|
||||||
|
bool operator==(const ContentArchiveHeader& other) const;
|
||||||
|
bool operator!=(const ContentArchiveHeader& other) const;
|
||||||
|
|
||||||
|
// IByteModel
|
||||||
|
void toBytes();
|
||||||
|
void fromBytes(const byte_t* bytes, size_t len);
|
||||||
|
const fnd::Vec<byte_t>& getBytes() const;
|
||||||
|
|
||||||
|
// variables
|
||||||
|
void clear();
|
||||||
|
|
||||||
|
byte_t getFormatVersion() const;
|
||||||
|
void setFormatVersion(byte_t ver);
|
||||||
|
|
||||||
|
nca::DistributionType getDistributionType() const;
|
||||||
|
void setDistributionType(nca::DistributionType type);
|
||||||
|
|
||||||
|
nca::ContentType getContentType() const;
|
||||||
|
void setContentType(nca::ContentType type);
|
||||||
|
|
||||||
|
byte_t getKeyGeneration() const;
|
||||||
|
void setKeyGeneration(byte_t gen);
|
||||||
|
|
||||||
|
byte_t getKeyAreaEncryptionKeyIndex() const;
|
||||||
|
void setKeyAreaEncryptionKeyIndex(byte_t index);
|
||||||
|
|
||||||
|
uint64_t getContentSize() const;
|
||||||
|
void setContentSize(uint64_t size);
|
||||||
|
|
||||||
|
uint64_t getProgramId() const;
|
||||||
|
void setProgramId(uint64_t program_id);
|
||||||
|
|
||||||
|
uint32_t getContentIndex() const;
|
||||||
|
void setContentIndex(uint32_t index);
|
||||||
|
|
||||||
|
uint32_t getSdkAddonVersion() const;
|
||||||
|
void setSdkAddonVersion(uint32_t version);
|
||||||
|
|
||||||
|
bool hasRightsId() const;
|
||||||
|
const byte_t* getRightsId() const;
|
||||||
|
void setRightsId(const byte_t* rights_id);
|
||||||
|
|
||||||
|
const fnd::List<sPartitionEntry>& getPartitionEntryList() const;
|
||||||
|
void setPartitionEntryList(const fnd::List<sPartitionEntry>& partition_entry_list);
|
||||||
|
|
||||||
|
const byte_t* getKeyArea() const;
|
||||||
|
void setKeyArea(const byte_t* key_area);
|
||||||
|
|
||||||
|
private:
|
||||||
|
const std::string kModuleName = "CONTENT_ARCHIVE_HEADER";
|
||||||
|
|
||||||
|
// binary
|
||||||
|
fnd::Vec<byte_t> mRawBinary;
|
||||||
|
|
||||||
|
// data
|
||||||
|
byte_t mFormatVersion;
|
||||||
|
nca::DistributionType mDistributionType;
|
||||||
|
nca::ContentType mContentType;
|
||||||
|
byte_t mKeyGeneration;
|
||||||
|
byte_t mKaekIndex;
|
||||||
|
uint64_t mContentSize;
|
||||||
|
uint64_t mProgramId;
|
||||||
|
uint32_t mContentIndex;
|
||||||
|
uint32_t mSdkAddonVersion;
|
||||||
|
fnd::Vec<byte_t> mRightsId;
|
||||||
|
fnd::List<sPartitionEntry> mPartitionEntryList;
|
||||||
|
fnd::Vec<byte_t> mKeyArea;
|
||||||
|
|
||||||
|
uint64_t blockNumToSize(uint32_t block_num) const;
|
||||||
|
uint32_t sizeToBlockNum(uint64_t real_size) const;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,17 +1,17 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <nn/hac/nca.h>
|
#include <nn/hac/define/nca.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
{
|
{
|
||||||
namespace hac
|
namespace hac
|
||||||
{
|
{
|
||||||
class NcaUtils
|
class ContentArchiveUtils
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static inline size_t sectorToOffset(size_t sector_index) { return sector_index * nn::hac::nca::kSectorSize; }
|
static inline size_t sectorToOffset(size_t sector_index) { return sector_index * nn::hac::nca::kSectorSize; }
|
||||||
static void decryptNcaHeader(const byte_t* src, byte_t* dst, const fnd::aes::sAesXts128Key& key);
|
static void decryptContentArchiveHeader(const byte_t* src, byte_t* dst, const fnd::aes::sAesXts128Key& key);
|
||||||
static byte_t getMasterKeyRevisionFromKeyGeneration(byte_t key_generation);
|
static byte_t getMasterKeyRevisionFromKeyGeneration(byte_t key_generation);
|
||||||
static void getNcaPartitionAesCtr(const nn::hac::sNcaFsHeader* hdr, byte_t* ctr);
|
static void getNcaPartitionAesCtr(const nn::hac::sNcaFsHeader* hdr, byte_t* ctr);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
59
lib/libhac/include/nn/hac/ContentInfo.h
Normal file
59
lib/libhac/include/nn/hac/ContentInfo.h
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
#pragma once
|
||||||
|
#include <string>
|
||||||
|
#include <cstring>
|
||||||
|
#include <fnd/IByteModel.h>
|
||||||
|
#include <nn/hac/define/cnmt.h>
|
||||||
|
|
||||||
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
|
{
|
||||||
|
class ContentInfo :
|
||||||
|
public fnd::IByteModel
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ContentInfo();
|
||||||
|
ContentInfo(const ContentInfo& other);
|
||||||
|
|
||||||
|
void operator=(const ContentInfo& other);
|
||||||
|
bool operator==(const ContentInfo& other) const;
|
||||||
|
bool operator!=(const ContentInfo& other) const;
|
||||||
|
|
||||||
|
// IByteModel
|
||||||
|
void toBytes();
|
||||||
|
void fromBytes(const byte_t* bytes, size_t len);
|
||||||
|
const fnd::Vec<byte_t>& getBytes() const;
|
||||||
|
|
||||||
|
// variables
|
||||||
|
void clear();
|
||||||
|
|
||||||
|
const fnd::sha::sSha256Hash& getContentHash() const;
|
||||||
|
void setContentHash(const fnd::sha::sSha256Hash& hash);
|
||||||
|
|
||||||
|
const cnmt::sContentId& getContentId() const;
|
||||||
|
void setContentId(const cnmt::sContentId& content_id);
|
||||||
|
|
||||||
|
size_t getContentSize() const;
|
||||||
|
void setContentSize(size_t size);
|
||||||
|
|
||||||
|
cnmt::ContentType getContentType() const;
|
||||||
|
void setContentType(cnmt::ContentType type);
|
||||||
|
|
||||||
|
byte_t getIdOffset() const;
|
||||||
|
void setIdOffset(byte_t id_offset);
|
||||||
|
|
||||||
|
private:
|
||||||
|
const std::string kModuleName = "CONTENT_INFO";
|
||||||
|
|
||||||
|
// binary blob
|
||||||
|
fnd::Vec<byte_t> mRawBinary;
|
||||||
|
|
||||||
|
// variables
|
||||||
|
fnd::sha::sSha256Hash mHash;
|
||||||
|
cnmt::sContentId mContentId;
|
||||||
|
size_t mSize;
|
||||||
|
cnmt::ContentType mType;
|
||||||
|
byte_t mIdOffset;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
113
lib/libhac/include/nn/hac/ContentMeta.h
Normal file
113
lib/libhac/include/nn/hac/ContentMeta.h
Normal file
|
@ -0,0 +1,113 @@
|
||||||
|
#pragma once
|
||||||
|
#include <string>
|
||||||
|
#include <cstring>
|
||||||
|
#include <fnd/IByteModel.h>
|
||||||
|
#include <fnd/List.h>
|
||||||
|
#include <nn/hac/define/cnmt.h>
|
||||||
|
#include <nn/hac/ContentInfo.h>
|
||||||
|
#include <nn/hac/ContentMetaInfo.h>
|
||||||
|
#include <nn/hac/ApplicationMetaExtendedHeader.h>
|
||||||
|
#include <nn/hac/PatchMetaExtendedHeader.h>
|
||||||
|
#include <nn/hac/AddOnContentMetaExtendedHeader.h>
|
||||||
|
#include <nn/hac/DeltaMetaExtendedHeader.h>
|
||||||
|
|
||||||
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
|
{
|
||||||
|
class ContentMeta :
|
||||||
|
public fnd::IByteModel
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ContentMeta();
|
||||||
|
ContentMeta(const ContentMeta& other);
|
||||||
|
|
||||||
|
void operator=(const ContentMeta& other);
|
||||||
|
bool operator==(const ContentMeta& other) const;
|
||||||
|
bool operator!=(const ContentMeta& other) const;
|
||||||
|
|
||||||
|
// IByteModel
|
||||||
|
void toBytes();
|
||||||
|
void fromBytes(const byte_t* bytes, size_t len);
|
||||||
|
const fnd::Vec<byte_t>& getBytes() const;
|
||||||
|
|
||||||
|
// variables
|
||||||
|
void clear();
|
||||||
|
|
||||||
|
uint64_t getTitleId() const;
|
||||||
|
void setTitleId(uint64_t title_id);
|
||||||
|
|
||||||
|
uint32_t getTitleVersion() const;
|
||||||
|
void setTitleVersion(uint32_t version);
|
||||||
|
|
||||||
|
cnmt::ContentMetaType getContentMetaType() const;
|
||||||
|
void setContentMetaType(cnmt::ContentMetaType type);
|
||||||
|
|
||||||
|
byte_t getAttributes() const;
|
||||||
|
void setAttributes(byte_t attributes);
|
||||||
|
|
||||||
|
uint32_t getRequiredDownloadSystemVersion() const;
|
||||||
|
void setRequiredDownloadSystemVersion(uint32_t version);
|
||||||
|
|
||||||
|
const ApplicationMetaExtendedHeader& getApplicationMetaExtendedHeader() const;
|
||||||
|
void setApplicationMetaExtendedHeader(const ApplicationMetaExtendedHeader& exhdr);
|
||||||
|
|
||||||
|
const PatchMetaExtendedHeader& getPatchMetaExtendedHeader() const;
|
||||||
|
void setPatchMetaExtendedHeader(const PatchMetaExtendedHeader& exhdr);
|
||||||
|
|
||||||
|
const AddOnContentMetaExtendedHeader& getAddOnContentMetaExtendedHeader() const;
|
||||||
|
void setAddOnContentMetaExtendedHeader(const AddOnContentMetaExtendedHeader& exhdr);
|
||||||
|
|
||||||
|
const DeltaMetaExtendedHeader& getDeltaMetaExtendedHeader() const;
|
||||||
|
void setDeltaMetaExtendedHeader(const DeltaMetaExtendedHeader& exhdr);
|
||||||
|
|
||||||
|
const fnd::List<ContentInfo>& getContentInfo() const;
|
||||||
|
void setContentInfo(const fnd::List<ContentInfo>& info);
|
||||||
|
|
||||||
|
const fnd::List<ContentMetaInfo>& getContentMetaInfo() const;
|
||||||
|
void setContentMetaInfo(const fnd::List<ContentMetaInfo>& info);
|
||||||
|
|
||||||
|
const fnd::Vec<byte_t>& getExtendedData() const;
|
||||||
|
void setExtendedData(const fnd::Vec<byte_t>& data);
|
||||||
|
|
||||||
|
const cnmt::sDigest& getDigest() const;
|
||||||
|
void setDigest(const cnmt::sDigest& digest);
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
const std::string kModuleName = "CONTENT_META";
|
||||||
|
|
||||||
|
// binary blob
|
||||||
|
fnd::Vec<byte_t> mRawBinary;
|
||||||
|
|
||||||
|
// variables
|
||||||
|
uint64_t mTitleId;
|
||||||
|
uint32_t mTitleVersion;
|
||||||
|
cnmt::ContentMetaType mType;
|
||||||
|
byte_t mAttributes;
|
||||||
|
uint32_t mRequiredDownloadSystemVersion;
|
||||||
|
fnd::Vec<byte_t> mExtendedHeader;
|
||||||
|
|
||||||
|
ApplicationMetaExtendedHeader mApplicationMetaExtendedHeader;
|
||||||
|
PatchMetaExtendedHeader mPatchMetaExtendedHeader;
|
||||||
|
AddOnContentMetaExtendedHeader mAddOnContentMetaExtendedHeader;
|
||||||
|
DeltaMetaExtendedHeader mDeltaMetaExtendedHeader;
|
||||||
|
|
||||||
|
fnd::List<ContentInfo> mContentInfo;
|
||||||
|
fnd::List<ContentMetaInfo> mContentMetaInfo;
|
||||||
|
fnd::Vec<byte_t> mExtendedData;
|
||||||
|
cnmt::sDigest mDigest;
|
||||||
|
|
||||||
|
inline size_t getExtendedHeaderOffset() const { return sizeof(sContentMetaHeader); }
|
||||||
|
inline size_t getContentInfoOffset(size_t exhdrSize) const { return getExtendedHeaderOffset() + exhdrSize; }
|
||||||
|
inline size_t getContentMetaInfoOffset(size_t exhdrSize, size_t contentInfoNum) const { return getContentInfoOffset(exhdrSize) + contentInfoNum * sizeof(sContentInfo); }
|
||||||
|
inline size_t getExtendedDataOffset(size_t exhdrSize, size_t contentInfoNum, size_t contentMetaNum) const { return getContentMetaInfoOffset(exhdrSize, contentInfoNum) + contentMetaNum * sizeof(sContentMetaInfo); }
|
||||||
|
inline size_t getDigestOffset(size_t exhdrSize, size_t contentInfoNum, size_t contentMetaNum, size_t exdataSize) const { return getExtendedDataOffset(exhdrSize, contentInfoNum, contentMetaNum) + exdataSize; }
|
||||||
|
inline size_t getTotalSize(size_t exhdrSize, size_t contentInfoNum, size_t contentMetaNum, size_t exdataSize) const { return getDigestOffset(exhdrSize, contentInfoNum, contentMetaNum, exdataSize) + cnmt::kDigestLen; }
|
||||||
|
|
||||||
|
bool validateExtendedHeaderSize(cnmt::ContentMetaType type, size_t exhdrSize) const;
|
||||||
|
size_t getExtendedDataSize(cnmt::ContentMetaType type, const byte_t* data) const;
|
||||||
|
void validateBinary(const byte_t* bytes, size_t len) const;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,254 +0,0 @@
|
||||||
#pragma once
|
|
||||||
#include <string>
|
|
||||||
#include <cstring>
|
|
||||||
#include <fnd/ISerialisable.h>
|
|
||||||
#include <fnd/List.h>
|
|
||||||
#include <nn/hac/cnmt.h>
|
|
||||||
|
|
||||||
namespace nn
|
|
||||||
{
|
|
||||||
namespace hac
|
|
||||||
{
|
|
||||||
class ContentMetaBinary :
|
|
||||||
public fnd::ISerialisable
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
struct ContentInfo
|
|
||||||
{
|
|
||||||
fnd::sha::sSha256Hash hash;
|
|
||||||
byte_t nca_id[cnmt::kContentIdLen];
|
|
||||||
size_t size;
|
|
||||||
cnmt::ContentType type;
|
|
||||||
|
|
||||||
void operator=(const ContentInfo& other)
|
|
||||||
{
|
|
||||||
hash = other.hash;
|
|
||||||
memcpy(nca_id, other.nca_id, cnmt::kContentIdLen);
|
|
||||||
size = other.size;
|
|
||||||
type = other.type;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator==(const ContentInfo& other) const
|
|
||||||
{
|
|
||||||
return (hash == other.hash) \
|
|
||||||
&& (memcmp(nca_id, other.nca_id, cnmt::kContentIdLen) == 0) \
|
|
||||||
&& (size == other.size) \
|
|
||||||
&& (type == other.type);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator!=(const ContentInfo& other) const
|
|
||||||
{
|
|
||||||
return !operator==(other);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ContentMetaInfo
|
|
||||||
{
|
|
||||||
uint64_t id;
|
|
||||||
uint32_t version;
|
|
||||||
cnmt::ContentMetaType type;
|
|
||||||
byte_t attributes;
|
|
||||||
|
|
||||||
void operator=(const ContentMetaInfo& other)
|
|
||||||
{
|
|
||||||
id = other.id;
|
|
||||||
version = other.version;
|
|
||||||
type = other.type;
|
|
||||||
attributes = other.attributes;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator==(const ContentMetaInfo& other) const
|
|
||||||
{
|
|
||||||
return (id == other.id) \
|
|
||||||
&& (version == other.version) \
|
|
||||||
&& (type == other.type) \
|
|
||||||
&& (attributes == other.attributes);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator!=(const ContentMetaInfo& other) const
|
|
||||||
{
|
|
||||||
return !operator==(other);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ApplicationMetaExtendedHeader
|
|
||||||
{
|
|
||||||
uint64_t patch_id;
|
|
||||||
uint32_t required_system_version;
|
|
||||||
|
|
||||||
void operator=(const ApplicationMetaExtendedHeader& other)
|
|
||||||
{
|
|
||||||
patch_id = other.patch_id;
|
|
||||||
required_system_version = other.required_system_version;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator==(const ApplicationMetaExtendedHeader& other) const
|
|
||||||
{
|
|
||||||
return (patch_id == other.patch_id) \
|
|
||||||
&& (required_system_version == other.required_system_version);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator!=(const ApplicationMetaExtendedHeader& other) const
|
|
||||||
{
|
|
||||||
return !operator==(other);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct PatchMetaExtendedHeader
|
|
||||||
{
|
|
||||||
uint64_t application_id;
|
|
||||||
uint32_t required_system_version;
|
|
||||||
|
|
||||||
void operator=(const PatchMetaExtendedHeader& other)
|
|
||||||
{
|
|
||||||
application_id = other.application_id;
|
|
||||||
required_system_version = other.required_system_version;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator==(const PatchMetaExtendedHeader& other) const
|
|
||||||
{
|
|
||||||
return (application_id == other.application_id) \
|
|
||||||
&& (required_system_version == other.required_system_version);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator!=(const PatchMetaExtendedHeader& other) const
|
|
||||||
{
|
|
||||||
return !operator==(other);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct AddOnContentMetaExtendedHeader
|
|
||||||
{
|
|
||||||
uint64_t application_id;
|
|
||||||
uint32_t required_application_version;
|
|
||||||
|
|
||||||
void operator=(const AddOnContentMetaExtendedHeader& other)
|
|
||||||
{
|
|
||||||
application_id = other.application_id;
|
|
||||||
required_application_version = other.required_application_version;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator==(const AddOnContentMetaExtendedHeader& other) const
|
|
||||||
{
|
|
||||||
return (application_id == other.application_id) \
|
|
||||||
&& (required_application_version == other.required_application_version);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator!=(const AddOnContentMetaExtendedHeader& other) const
|
|
||||||
{
|
|
||||||
return !operator==(other);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct DeltaMetaExtendedHeader
|
|
||||||
{
|
|
||||||
uint64_t application_id;
|
|
||||||
|
|
||||||
void operator=(const DeltaMetaExtendedHeader& other)
|
|
||||||
{
|
|
||||||
application_id = other.application_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator==(const DeltaMetaExtendedHeader& other) const
|
|
||||||
{
|
|
||||||
return (application_id == other.application_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator!=(const DeltaMetaExtendedHeader& other) const
|
|
||||||
{
|
|
||||||
return !operator==(other);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
ContentMetaBinary();
|
|
||||||
ContentMetaBinary(const ContentMetaBinary& other);
|
|
||||||
|
|
||||||
void operator=(const ContentMetaBinary& other);
|
|
||||||
bool operator==(const ContentMetaBinary& other) const;
|
|
||||||
bool operator!=(const ContentMetaBinary& other) const;
|
|
||||||
|
|
||||||
// export/import binary
|
|
||||||
void toBytes();
|
|
||||||
void fromBytes(const byte_t* bytes, size_t len);
|
|
||||||
const fnd::Vec<byte_t>& getBytes() const;
|
|
||||||
|
|
||||||
// variables
|
|
||||||
void clear();
|
|
||||||
|
|
||||||
uint64_t getTitleId() const;
|
|
||||||
void setTitleId(uint64_t title_id);
|
|
||||||
|
|
||||||
uint32_t getTitleVersion() const;
|
|
||||||
void setTitleVersion(uint32_t version);
|
|
||||||
|
|
||||||
cnmt::ContentMetaType getType() const;
|
|
||||||
void setType(cnmt::ContentMetaType type);
|
|
||||||
|
|
||||||
byte_t getAttributes() const;
|
|
||||||
void setAttributes(byte_t attributes);
|
|
||||||
|
|
||||||
uint32_t getRequiredDownloadSystemVersion() const;
|
|
||||||
void setRequiredDownloadSystemVersion(uint32_t version);
|
|
||||||
|
|
||||||
const ApplicationMetaExtendedHeader& getApplicationMetaExtendedHeader() const;
|
|
||||||
void setApplicationMetaExtendedHeader(const ApplicationMetaExtendedHeader& exhdr);
|
|
||||||
|
|
||||||
const PatchMetaExtendedHeader& getPatchMetaExtendedHeader() const;
|
|
||||||
void setPatchMetaExtendedHeader(const PatchMetaExtendedHeader& exhdr);
|
|
||||||
|
|
||||||
const AddOnContentMetaExtendedHeader& getAddOnContentMetaExtendedHeader() const;
|
|
||||||
void setAddOnContentMetaExtendedHeader(const AddOnContentMetaExtendedHeader& exhdr);
|
|
||||||
|
|
||||||
const DeltaMetaExtendedHeader& getDeltaMetaExtendedHeader() const;
|
|
||||||
void setDeltaMetaExtendedHeader(const DeltaMetaExtendedHeader& exhdr);
|
|
||||||
|
|
||||||
const fnd::List<nn::hac::ContentMetaBinary::ContentInfo>& getContentInfo() const;
|
|
||||||
void setContentInfo(const fnd::List<nn::hac::ContentMetaBinary::ContentInfo>& info);
|
|
||||||
|
|
||||||
const fnd::List<nn::hac::ContentMetaBinary::ContentMetaInfo>& getContentMetaInfo() const;
|
|
||||||
void setContentMetaInfo(const fnd::List<nn::hac::ContentMetaBinary::ContentMetaInfo>& info);
|
|
||||||
|
|
||||||
const fnd::Vec<byte_t>& getExtendedData() const;
|
|
||||||
void setExtendedData(const fnd::Vec<byte_t>& data);
|
|
||||||
|
|
||||||
const nn::hac::sDigest& getDigest() const;
|
|
||||||
void setDigest(const nn::hac::sDigest& digest);
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
|
||||||
const std::string kModuleName = "CONTENT_META_BINARY";
|
|
||||||
|
|
||||||
// binary blob
|
|
||||||
fnd::Vec<byte_t> mRawBinary;
|
|
||||||
|
|
||||||
// variables
|
|
||||||
uint64_t mTitleId;
|
|
||||||
uint32_t mTitleVersion;
|
|
||||||
cnmt::ContentMetaType mType;
|
|
||||||
byte_t mAttributes;
|
|
||||||
uint32_t mRequiredDownloadSystemVersion;
|
|
||||||
fnd::Vec<byte_t> mExtendedHeader;
|
|
||||||
|
|
||||||
ApplicationMetaExtendedHeader mApplicationMetaExtendedHeader;
|
|
||||||
PatchMetaExtendedHeader mPatchMetaExtendedHeader;
|
|
||||||
AddOnContentMetaExtendedHeader mAddOnContentMetaExtendedHeader;
|
|
||||||
DeltaMetaExtendedHeader mDeltaMetaExtendedHeader;
|
|
||||||
|
|
||||||
fnd::List<nn::hac::ContentMetaBinary::ContentInfo> mContentInfo;
|
|
||||||
fnd::List<nn::hac::ContentMetaBinary::ContentMetaInfo> mContentMetaInfo;
|
|
||||||
fnd::Vec<byte_t> mExtendedData;
|
|
||||||
nn::hac::sDigest mDigest;
|
|
||||||
|
|
||||||
inline size_t getExtendedHeaderOffset() const { return sizeof(sContentMetaHeader); }
|
|
||||||
inline size_t getContentInfoOffset(size_t exhdrSize) const { return getExtendedHeaderOffset() + exhdrSize; }
|
|
||||||
inline size_t getContentMetaInfoOffset(size_t exhdrSize, size_t contentInfoNum) const { return getContentInfoOffset(exhdrSize) + contentInfoNum * sizeof(sContentInfo); }
|
|
||||||
inline size_t getExtendedDataOffset(size_t exhdrSize, size_t contentInfoNum, size_t contentMetaNum) const { return getContentMetaInfoOffset(exhdrSize, contentInfoNum) + contentMetaNum * sizeof(sContentMetaInfo); }
|
|
||||||
inline size_t getDigestOffset(size_t exhdrSize, size_t contentInfoNum, size_t contentMetaNum, size_t exdataSize) const { return getExtendedDataOffset(exhdrSize, contentInfoNum, contentMetaNum) + exdataSize; }
|
|
||||||
inline size_t getTotalSize(size_t exhdrSize, size_t contentInfoNum, size_t contentMetaNum, size_t exdataSize) const { return getDigestOffset(exhdrSize, contentInfoNum, contentMetaNum, exdataSize) + cnmt::kDigestLen; }
|
|
||||||
|
|
||||||
bool validateExtendedHeaderSize(cnmt::ContentMetaType type, size_t exhdrSize) const;
|
|
||||||
size_t getExtendedDataSize(cnmt::ContentMetaType type, const byte_t* data) const;
|
|
||||||
void validateBinary(const byte_t* bytes, size_t len) const;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
55
lib/libhac/include/nn/hac/ContentMetaInfo.h
Normal file
55
lib/libhac/include/nn/hac/ContentMetaInfo.h
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
#pragma once
|
||||||
|
#include <string>
|
||||||
|
#include <cstring>
|
||||||
|
#include <fnd/IByteModel.h>
|
||||||
|
#include <nn/hac/define/cnmt.h>
|
||||||
|
|
||||||
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
|
{
|
||||||
|
class ContentMetaInfo :
|
||||||
|
public fnd::IByteModel
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ContentMetaInfo();
|
||||||
|
ContentMetaInfo(const ContentMetaInfo& other);
|
||||||
|
|
||||||
|
void operator=(const ContentMetaInfo& other);
|
||||||
|
bool operator==(const ContentMetaInfo& other) const;
|
||||||
|
bool operator!=(const ContentMetaInfo& other) const;
|
||||||
|
|
||||||
|
// IByteModel
|
||||||
|
void toBytes();
|
||||||
|
void fromBytes(const byte_t* bytes, size_t len);
|
||||||
|
const fnd::Vec<byte_t>& getBytes() const;
|
||||||
|
|
||||||
|
// variables
|
||||||
|
void clear();
|
||||||
|
|
||||||
|
uint64_t getTitleId() const;
|
||||||
|
void setTitleId(uint64_t title_id);
|
||||||
|
|
||||||
|
uint32_t getTitleVersion() const;
|
||||||
|
void setTitleVersion(uint32_t ver);
|
||||||
|
|
||||||
|
cnmt::ContentMetaType getContentMetaType() const;
|
||||||
|
void setContentMetaType(cnmt::ContentMetaType type);
|
||||||
|
|
||||||
|
byte_t getAttributes() const;
|
||||||
|
void setAttributes(byte_t attr);
|
||||||
|
|
||||||
|
private:
|
||||||
|
const std::string kModuleName = "CONTENT_META_INFO";
|
||||||
|
|
||||||
|
// byte model
|
||||||
|
fnd::Vec<byte_t> mRawBinary;
|
||||||
|
|
||||||
|
// variables
|
||||||
|
uint64_t mTitleId;
|
||||||
|
uint32_t mTitleVersion;
|
||||||
|
cnmt::ContentMetaType mType;
|
||||||
|
byte_t mAttributes;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
47
lib/libhac/include/nn/hac/DeltaMetaExtendedHeader.h
Normal file
47
lib/libhac/include/nn/hac/DeltaMetaExtendedHeader.h
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
#pragma once
|
||||||
|
#include <string>
|
||||||
|
#include <cstring>
|
||||||
|
#include <fnd/IByteModel.h>
|
||||||
|
#include <nn/hac/define/cnmt.h>
|
||||||
|
|
||||||
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
|
{
|
||||||
|
class DeltaMetaExtendedHeader :
|
||||||
|
public fnd::IByteModel
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DeltaMetaExtendedHeader();
|
||||||
|
DeltaMetaExtendedHeader(const DeltaMetaExtendedHeader& other);
|
||||||
|
|
||||||
|
void operator=(const DeltaMetaExtendedHeader& other);
|
||||||
|
bool operator==(const DeltaMetaExtendedHeader& other) const;
|
||||||
|
bool operator!=(const DeltaMetaExtendedHeader& other) const;
|
||||||
|
|
||||||
|
// IByteModel
|
||||||
|
void toBytes();
|
||||||
|
void fromBytes(const byte_t* bytes, size_t len);
|
||||||
|
const fnd::Vec<byte_t>& getBytes() const;
|
||||||
|
|
||||||
|
// variables
|
||||||
|
void clear();
|
||||||
|
|
||||||
|
uint64_t getApplicationId() const;
|
||||||
|
void setApplicationId(uint64_t application_id);
|
||||||
|
|
||||||
|
uint32_t getExtendedDataSize() const;
|
||||||
|
void setExtendedDataSize(uint32_t size);
|
||||||
|
|
||||||
|
private:
|
||||||
|
const std::string kModuleName = "DELTA_META_EXTENDED_HEADER";
|
||||||
|
|
||||||
|
// binary blob
|
||||||
|
fnd::Vec<byte_t> mRawBinary;
|
||||||
|
|
||||||
|
// variables
|
||||||
|
uint64_t mApplicationId;
|
||||||
|
uint32_t mExtendedDataSize;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,77 +1,78 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <fnd/ISerialisable.h>
|
#include <fnd/IByteModel.h>
|
||||||
#include <fnd/List.h>
|
#include <fnd/List.h>
|
||||||
#include <nn/hac/fac.h>
|
#include <nn/hac/define/fac.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
{
|
{
|
||||||
namespace hac
|
namespace hac
|
||||||
{
|
{
|
||||||
class FileSystemAccessControlBinary : public fnd::ISerialisable
|
class FileSystemAccessControl :
|
||||||
{
|
public fnd::IByteModel
|
||||||
public:
|
{
|
||||||
struct sSaveDataOwnerId
|
public:
|
||||||
{
|
struct sSaveDataOwnerId
|
||||||
nn::hac::fac::SaveDataOwnerIdAccessType access_type;
|
{
|
||||||
uint64_t id;
|
nn::hac::fac::SaveDataOwnerIdAccessType access_type;
|
||||||
|
uint64_t id;
|
||||||
void operator=(const sSaveDataOwnerId& other)
|
|
||||||
{
|
void operator=(const sSaveDataOwnerId& other)
|
||||||
access_type = other.access_type;
|
{
|
||||||
id = other.id;
|
access_type = other.access_type;
|
||||||
}
|
id = other.id;
|
||||||
|
}
|
||||||
bool operator==(const sSaveDataOwnerId& other) const
|
|
||||||
{
|
bool operator==(const sSaveDataOwnerId& other) const
|
||||||
return (access_type == other.access_type) \
|
{
|
||||||
&& (id == other.id);
|
return (access_type == other.access_type) \
|
||||||
}
|
&& (id == other.id);
|
||||||
|
}
|
||||||
bool operator!=(const sSaveDataOwnerId& other) const
|
|
||||||
{
|
bool operator!=(const sSaveDataOwnerId& other) const
|
||||||
return !(*this == other);
|
{
|
||||||
}
|
return !(*this == other);
|
||||||
};
|
}
|
||||||
|
};
|
||||||
FileSystemAccessControlBinary();
|
|
||||||
FileSystemAccessControlBinary(const FileSystemAccessControlBinary& other);
|
FileSystemAccessControl();
|
||||||
|
FileSystemAccessControl(const FileSystemAccessControl& other);
|
||||||
void operator=(const FileSystemAccessControlBinary& other);
|
|
||||||
bool operator==(const FileSystemAccessControlBinary& other) const;
|
void operator=(const FileSystemAccessControl& other);
|
||||||
bool operator!=(const FileSystemAccessControlBinary& other) const;
|
bool operator==(const FileSystemAccessControl& other) const;
|
||||||
|
bool operator!=(const FileSystemAccessControl& other) const;
|
||||||
// export/import binary
|
|
||||||
void toBytes();
|
// IByteModel
|
||||||
void fromBytes(const byte_t* data, size_t len);
|
void toBytes();
|
||||||
const fnd::Vec<byte_t>& getBytes() const;
|
void fromBytes(const byte_t* data, size_t len);
|
||||||
|
const fnd::Vec<byte_t>& getBytes() const;
|
||||||
// variables
|
|
||||||
void clear();
|
// variables
|
||||||
|
void clear();
|
||||||
uint32_t getFormatVersion() const;
|
|
||||||
void setFormatVersion(uint32_t version);
|
uint32_t getFormatVersion() const;
|
||||||
|
void setFormatVersion(uint32_t version);
|
||||||
const fnd::List<fac::FsAccessFlag>& getFsaRightsList() const;
|
|
||||||
void setFsaRightsList(const fnd::List<fac::FsAccessFlag>& list);
|
const fnd::List<fac::FsAccessFlag>& getFsaRightsList() const;
|
||||||
|
void setFsaRightsList(const fnd::List<fac::FsAccessFlag>& list);
|
||||||
const fnd::List<uint64_t>& getContentOwnerIdList() const;
|
|
||||||
void setContentOwnerIdList(const fnd::List<uint64_t>& list);
|
const fnd::List<uint64_t>& getContentOwnerIdList() const;
|
||||||
|
void setContentOwnerIdList(const fnd::List<uint64_t>& list);
|
||||||
const fnd::List<sSaveDataOwnerId>& getSaveDataOwnerIdList() const;
|
|
||||||
void setSaveDataOwnerIdList(const fnd::List<sSaveDataOwnerId>& list);
|
const fnd::List<sSaveDataOwnerId>& getSaveDataOwnerIdList() const;
|
||||||
private:
|
void setSaveDataOwnerIdList(const fnd::List<sSaveDataOwnerId>& list);
|
||||||
const std::string kModuleName = "FILE_SYSTEM_ACCESS_CONTROL_BINARY";
|
private:
|
||||||
|
const std::string kModuleName = "FILE_SYSTEM_ACCESS_CONTROL";
|
||||||
// raw data
|
|
||||||
fnd::Vec<byte_t> mRawBinary;
|
// raw data
|
||||||
|
fnd::Vec<byte_t> mRawBinary;
|
||||||
// variables
|
|
||||||
uint32_t mVersion;
|
// variables
|
||||||
fnd::List<fac::FsAccessFlag> mFsaRights;
|
uint32_t mVersion;
|
||||||
fnd::List<uint64_t> mContentOwnerIdList;
|
fnd::List<fac::FsAccessFlag> mFsaRights;
|
||||||
fnd::List<sSaveDataOwnerId> mSaveDataOwnerIdList;
|
fnd::List<uint64_t> mContentOwnerIdList;
|
||||||
};
|
fnd::List<sSaveDataOwnerId> mSaveDataOwnerIdList;
|
||||||
}
|
};
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,127 +1,127 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <nn/hac/xci.h>
|
#include <nn/hac/define/gc.h>
|
||||||
#include <fnd/ISerialisable.h>
|
#include <fnd/IByteModel.h>
|
||||||
#include <fnd/List.h>
|
#include <fnd/List.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
{
|
{
|
||||||
namespace hac
|
namespace hac
|
||||||
{
|
{
|
||||||
class XciHeader :
|
class GameCardHeader :
|
||||||
public fnd::ISerialisable
|
public fnd::IByteModel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
XciHeader();
|
GameCardHeader();
|
||||||
XciHeader(const XciHeader& other);
|
GameCardHeader(const GameCardHeader& other);
|
||||||
|
|
||||||
void operator=(const XciHeader& other);
|
void operator=(const GameCardHeader& other);
|
||||||
bool operator==(const XciHeader& other) const;
|
bool operator==(const GameCardHeader& other) const;
|
||||||
bool operator!=(const XciHeader& other) const;
|
bool operator!=(const GameCardHeader& other) const;
|
||||||
|
|
||||||
// export/import binary
|
// IByteModel
|
||||||
void toBytes();
|
void toBytes();
|
||||||
void fromBytes(const byte_t* bytes, size_t len);
|
void fromBytes(const byte_t* bytes, size_t len);
|
||||||
const fnd::Vec<byte_t>& getBytes() const;
|
const fnd::Vec<byte_t>& getBytes() const;
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
void clear();
|
void clear();
|
||||||
uint32_t getRomAreaStartPage() const;
|
uint32_t getRomAreaStartPage() const;
|
||||||
void setRomAreaStartPage(uint32_t startPage);
|
void setRomAreaStartPage(uint32_t startPage);
|
||||||
uint32_t getBackupAreaStartPage() const;
|
uint32_t getBackupAreaStartPage() const;
|
||||||
void setBackupAreaStartPage(uint32_t startPage);
|
void setBackupAreaStartPage(uint32_t startPage);
|
||||||
byte_t getKekIndex() const;
|
byte_t getKekIndex() const;
|
||||||
void setKekIndex(byte_t kekIndex);
|
void setKekIndex(byte_t kekIndex);
|
||||||
byte_t getTitleKeyDecIndex() const;
|
byte_t getTitleKeyDecIndex() const;
|
||||||
void setTitleKeyDecIndex(byte_t index);
|
void setTitleKeyDecIndex(byte_t index);
|
||||||
byte_t getRomSizeType() const;
|
byte_t getRomSizeType() const;
|
||||||
void setRomSizeType(byte_t romSizeType);
|
void setRomSizeType(byte_t romSizeType);
|
||||||
byte_t getCardHeaderVersion() const;
|
byte_t getCardHeaderVersion() const;
|
||||||
void setCardHeaderVersion(byte_t version);
|
void setCardHeaderVersion(byte_t version);
|
||||||
byte_t getFlags() const;
|
byte_t getFlags() const;
|
||||||
void setFlags(byte_t flags);
|
void setFlags(byte_t flags);
|
||||||
uint64_t getPackageId() const;
|
uint64_t getPackageId() const;
|
||||||
void setPackageId(uint64_t id);
|
void setPackageId(uint64_t id);
|
||||||
uint32_t getValidDataEndPage() const;
|
uint32_t getValidDataEndPage() const;
|
||||||
void setValidDataEndPage(uint32_t page);
|
void setValidDataEndPage(uint32_t page);
|
||||||
const fnd::aes::sAesIvCtr& getAesCbcIv() const;
|
const fnd::aes::sAesIvCtr& getAesCbcIv() const;
|
||||||
void setAesCbcIv(const fnd::aes::sAesIvCtr& iv);
|
void setAesCbcIv(const fnd::aes::sAesIvCtr& iv);
|
||||||
uint64_t getPartitionFsAddress() const;
|
uint64_t getPartitionFsAddress() const;
|
||||||
void setPartitionFsAddress(uint64_t address);
|
void setPartitionFsAddress(uint64_t address);
|
||||||
uint64_t getPartitionFsSize() const;
|
uint64_t getPartitionFsSize() const;
|
||||||
void setPartitionFsSize(uint64_t size);
|
void setPartitionFsSize(uint64_t size);
|
||||||
const fnd::sha::sSha256Hash& getPartitionFsHash() const;
|
const fnd::sha::sSha256Hash& getPartitionFsHash() const;
|
||||||
void setPartitionFsHash(const fnd::sha::sSha256Hash& hash);
|
void setPartitionFsHash(const fnd::sha::sSha256Hash& hash);
|
||||||
const fnd::sha::sSha256Hash& getInitialDataHash() const;
|
const fnd::sha::sSha256Hash& getInitialDataHash() const;
|
||||||
void setInitialDataHash(const fnd::sha::sSha256Hash& hash);
|
void setInitialDataHash(const fnd::sha::sSha256Hash& hash);
|
||||||
uint32_t getSelSec() const;
|
uint32_t getSelSec() const;
|
||||||
void setSelSec(uint32_t sel_sec);
|
void setSelSec(uint32_t sel_sec);
|
||||||
uint32_t getSelT1Key() const;
|
uint32_t getSelT1Key() const;
|
||||||
void setSelT1Key(uint32_t sel_t1_key);
|
void setSelT1Key(uint32_t sel_t1_key);
|
||||||
uint32_t getSelKey() const;
|
uint32_t getSelKey() const;
|
||||||
void setSelKey(uint32_t sel_key);
|
void setSelKey(uint32_t sel_key);
|
||||||
uint32_t getLimAreaPage() const;
|
uint32_t getLimAreaPage() const;
|
||||||
void setLimAreaPage(uint32_t page);
|
void setLimAreaPage(uint32_t page);
|
||||||
|
|
||||||
uint32_t getFwVerMajor() const;
|
uint32_t getFwVerMajor() const;
|
||||||
void setFwVerMajor(uint32_t ver);
|
void setFwVerMajor(uint32_t ver);
|
||||||
uint32_t getFwVerMinor() const;
|
uint32_t getFwVerMinor() const;
|
||||||
void setFwVerMinor(uint32_t ver);
|
void setFwVerMinor(uint32_t ver);
|
||||||
uint32_t getAccCtrl1() const;
|
uint32_t getAccCtrl1() const;
|
||||||
void setAccCtrl1(uint32_t acc_ctrl_1);
|
void setAccCtrl1(uint32_t acc_ctrl_1);
|
||||||
uint32_t getWait1TimeRead() const;
|
uint32_t getWait1TimeRead() const;
|
||||||
void setWait1TimeRead(uint32_t seconds);
|
void setWait1TimeRead(uint32_t seconds);
|
||||||
uint32_t getWait2TimeRead() const;
|
uint32_t getWait2TimeRead() const;
|
||||||
void setWait2TimeRead(uint32_t seconds);
|
void setWait2TimeRead(uint32_t seconds);
|
||||||
uint32_t getWait1TimeWrite() const;
|
uint32_t getWait1TimeWrite() const;
|
||||||
void setWait1TimeWrite(uint32_t seconds);
|
void setWait1TimeWrite(uint32_t seconds);
|
||||||
uint32_t getWait2TimeWrite() const;
|
uint32_t getWait2TimeWrite() const;
|
||||||
void setWait2TimeWrite(uint32_t seconds);
|
void setWait2TimeWrite(uint32_t seconds);
|
||||||
uint32_t getFwMode() const;
|
uint32_t getFwMode() const;
|
||||||
void setFwMode(uint32_t fw_mode);
|
void setFwMode(uint32_t fw_mode);
|
||||||
uint32_t getUppVersion() const;
|
uint32_t getUppVersion() const;
|
||||||
void setUppVersion(uint32_t version);
|
void setUppVersion(uint32_t version);
|
||||||
const byte_t* getUppHash() const;
|
const byte_t* getUppHash() const;
|
||||||
void setUppHash(const byte_t* hash);
|
void setUppHash(const byte_t* hash);
|
||||||
uint64_t getUppId() const;
|
uint64_t getUppId() const;
|
||||||
void setUppId(uint64_t id);
|
void setUppId(uint64_t id);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const std::string kModuleName = "XCI_HEADER";
|
const std::string kModuleName = "GAMECARD_HEADER";
|
||||||
|
|
||||||
// binary
|
// binary
|
||||||
fnd::Vec<byte_t> mRawBinary;
|
fnd::Vec<byte_t> mRawBinary;
|
||||||
|
|
||||||
// data
|
// data
|
||||||
uint32_t mRomAreaStartPage;
|
uint32_t mRomAreaStartPage;
|
||||||
uint32_t mBackupAreaStartPage;
|
uint32_t mBackupAreaStartPage;
|
||||||
byte_t mKekIndex;
|
byte_t mKekIndex;
|
||||||
byte_t mTitleKeyDecIndex;
|
byte_t mTitleKeyDecIndex;
|
||||||
byte_t mRomSize;
|
byte_t mRomSize;
|
||||||
byte_t mCardHeaderVersion;
|
byte_t mCardHeaderVersion;
|
||||||
byte_t mFlags;
|
byte_t mFlags;
|
||||||
uint64_t mPackageId;
|
uint64_t mPackageId;
|
||||||
uint32_t mValidDataEndPage;
|
uint32_t mValidDataEndPage;
|
||||||
fnd::aes::sAesIvCtr mAesCbcIv;
|
fnd::aes::sAesIvCtr mAesCbcIv;
|
||||||
uint64_t mPartitionFsHeaderAddress;
|
uint64_t mPartitionFsHeaderAddress;
|
||||||
uint64_t mPartitionFsHeaderSize;
|
uint64_t mPartitionFsHeaderSize;
|
||||||
fnd::sha::sSha256Hash mPartitionFsHeaderHash;
|
fnd::sha::sSha256Hash mPartitionFsHeaderHash;
|
||||||
fnd::sha::sSha256Hash mInitialDataHash;
|
fnd::sha::sSha256Hash mInitialDataHash;
|
||||||
uint32_t mSelSec;
|
uint32_t mSelSec;
|
||||||
uint32_t mSelT1Key;
|
uint32_t mSelT1Key;
|
||||||
uint32_t mSelKey;
|
uint32_t mSelKey;
|
||||||
uint32_t mLimAreaPage;
|
uint32_t mLimAreaPage;
|
||||||
|
|
||||||
// Encrypted Data
|
// Encrypted/Extended Data
|
||||||
uint32_t mFwVersion[2];
|
uint32_t mFwVersion[2];
|
||||||
uint32_t mAccCtrl1;
|
uint32_t mAccCtrl1;
|
||||||
uint32_t mWait1TimeRead;
|
uint32_t mWait1TimeRead;
|
||||||
uint32_t mWait2TimeRead;
|
uint32_t mWait2TimeRead;
|
||||||
uint32_t mWait1TimeWrite;
|
uint32_t mWait1TimeWrite;
|
||||||
uint32_t mWait2TimeWrite;
|
uint32_t mWait2TimeWrite;
|
||||||
uint32_t mFwMode;
|
uint32_t mFwMode;
|
||||||
uint32_t mUppVersion;
|
uint32_t mUppVersion;
|
||||||
byte_t mUppHash[8];
|
byte_t mUppHash[8];
|
||||||
uint64_t mUppId;
|
uint64_t mUppId;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,16 +1,16 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <nn/hac/xci.h>
|
#include <nn/hac/define/gc.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
{
|
{
|
||||||
namespace hac
|
namespace hac
|
||||||
{
|
{
|
||||||
class XciUtils
|
class GameCardUtils
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static inline uint64_t blockToAddr(uint32_t block) { return ((uint64_t)block) << 9; }
|
static inline uint64_t blockToAddr(uint32_t block) { return ((uint64_t)block) << 9; }
|
||||||
static void getXciHeaderAesIv(const nn::hac::sXciHeader* hdr, byte_t* iv);
|
static void getXciHeaderAesIv(const nn::hac::sGcHeader* hdr, byte_t* iv);
|
||||||
static void decryptXciHeader(const byte_t* src, byte_t* dst, const byte_t* key);
|
static void decryptXciHeader(const byte_t* src, byte_t* dst, const byte_t* key);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,70 +1,70 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <nn/hac/hierarchicalintegrity.h>
|
#include <nn/hac/define/hierarchicalintegrity.h>
|
||||||
#include <fnd/ISerialisable.h>
|
#include <fnd/IByteModel.h>
|
||||||
#include <fnd/List.h>
|
#include <fnd/List.h>
|
||||||
#include <fnd/sha.h>
|
#include <fnd/sha.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
{
|
{
|
||||||
namespace hac
|
namespace hac
|
||||||
{
|
{
|
||||||
class HierarchicalIntegrityHeader :
|
class HierarchicalIntegrityHeader :
|
||||||
public fnd::ISerialisable
|
public fnd::IByteModel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
struct sLayer
|
struct sLayer
|
||||||
{
|
{
|
||||||
size_t offset;
|
size_t offset;
|
||||||
size_t size;
|
size_t size;
|
||||||
size_t block_size;
|
size_t block_size;
|
||||||
|
|
||||||
void operator=(const sLayer& other)
|
void operator=(const sLayer& other)
|
||||||
{
|
{
|
||||||
offset = other.offset;
|
offset = other.offset;
|
||||||
size = other.size;
|
size = other.size;
|
||||||
block_size = other.block_size;
|
block_size = other.block_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator==(const sLayer& other) const
|
bool operator==(const sLayer& other) const
|
||||||
{
|
{
|
||||||
return (offset == other.offset && size == other.size && block_size == other.block_size);
|
return (offset == other.offset && size == other.size && block_size == other.block_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=(const sLayer& other) const
|
bool operator!=(const sLayer& other) const
|
||||||
{
|
{
|
||||||
return !(*this == other);
|
return !(*this == other);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
HierarchicalIntegrityHeader();
|
HierarchicalIntegrityHeader();
|
||||||
HierarchicalIntegrityHeader(const HierarchicalIntegrityHeader& other);
|
HierarchicalIntegrityHeader(const HierarchicalIntegrityHeader& other);
|
||||||
|
|
||||||
void operator=(const HierarchicalIntegrityHeader& other);
|
void operator=(const HierarchicalIntegrityHeader& other);
|
||||||
bool operator==(const HierarchicalIntegrityHeader& other) const;
|
bool operator==(const HierarchicalIntegrityHeader& other) const;
|
||||||
bool operator!=(const HierarchicalIntegrityHeader& other) const;
|
bool operator!=(const HierarchicalIntegrityHeader& other) const;
|
||||||
|
|
||||||
// export/import binary
|
// IByteModel
|
||||||
void toBytes();
|
void toBytes();
|
||||||
void fromBytes(const byte_t* bytes, size_t len);
|
void fromBytes(const byte_t* bytes, size_t len);
|
||||||
const fnd::Vec<byte_t>& getBytes() const;
|
const fnd::Vec<byte_t>& getBytes() const;
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
const fnd::List<sLayer>& getLayerInfo() const;
|
const fnd::List<sLayer>& getLayerInfo() const;
|
||||||
void setLayerInfo(const fnd::List<sLayer>& layer_info);
|
void setLayerInfo(const fnd::List<sLayer>& layer_info);
|
||||||
|
|
||||||
const fnd::List<fnd::sha::sSha256Hash>& getMasterHashList() const;
|
const fnd::List<fnd::sha::sSha256Hash>& getMasterHashList() const;
|
||||||
void setMasterHashList(const fnd::List<fnd::sha::sSha256Hash>& master_hash_list);
|
void setMasterHashList(const fnd::List<fnd::sha::sSha256Hash>& master_hash_list);
|
||||||
private:
|
private:
|
||||||
const std::string kModuleName = "HIERARCHICAL_INTEGRITY_HEADER";
|
const std::string kModuleName = "HIERARCHICAL_INTEGRITY_HEADER";
|
||||||
|
|
||||||
// binary
|
// binary
|
||||||
fnd::Vec<byte_t> mRawBinary;
|
fnd::Vec<byte_t> mRawBinary;
|
||||||
|
|
||||||
// data
|
// data
|
||||||
fnd::List<sLayer> mLayerInfo;
|
fnd::List<sLayer> mLayerInfo;
|
||||||
fnd::List<fnd::sha::sSha256Hash> mMasterHashList;
|
fnd::List<fnd::sha::sSha256Hash> mMasterHashList;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,71 +1,71 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <nn/hac/hierarchicalsha256.h>
|
#include <nn/hac/define/hierarchicalsha256.h>
|
||||||
#include <fnd/ISerialisable.h>
|
#include <fnd/IByteModel.h>
|
||||||
#include <fnd/List.h>
|
#include <fnd/List.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
{
|
{
|
||||||
namespace hac
|
namespace hac
|
||||||
{
|
{
|
||||||
class HierarchicalSha256Header :
|
class HierarchicalSha256Header :
|
||||||
public fnd::ISerialisable
|
public fnd::IByteModel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
struct sLayer
|
struct sLayer
|
||||||
{
|
{
|
||||||
size_t offset;
|
size_t offset;
|
||||||
size_t size;
|
size_t size;
|
||||||
|
|
||||||
void operator=(const sLayer& other)
|
void operator=(const sLayer& other)
|
||||||
{
|
{
|
||||||
offset = other.offset;
|
offset = other.offset;
|
||||||
size = other.size;
|
size = other.size;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator==(const sLayer& other) const
|
bool operator==(const sLayer& other) const
|
||||||
{
|
{
|
||||||
return (offset == other.offset && size == other.size);
|
return (offset == other.offset && size == other.size);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=(const sLayer& other) const
|
bool operator!=(const sLayer& other) const
|
||||||
{
|
{
|
||||||
return !(*this == other);
|
return !(*this == other);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
HierarchicalSha256Header();
|
HierarchicalSha256Header();
|
||||||
HierarchicalSha256Header(const HierarchicalSha256Header& other);
|
HierarchicalSha256Header(const HierarchicalSha256Header& other);
|
||||||
|
|
||||||
void operator=(const HierarchicalSha256Header& other);
|
void operator=(const HierarchicalSha256Header& other);
|
||||||
bool operator==(const HierarchicalSha256Header& other) const;
|
bool operator==(const HierarchicalSha256Header& other) const;
|
||||||
bool operator!=(const HierarchicalSha256Header& other) const;
|
bool operator!=(const HierarchicalSha256Header& other) const;
|
||||||
|
|
||||||
// export/import binary
|
// IByteModel
|
||||||
void toBytes();
|
void toBytes();
|
||||||
void fromBytes(const byte_t* bytes, size_t len);
|
void fromBytes(const byte_t* bytes, size_t len);
|
||||||
const fnd::Vec<byte_t>& getBytes() const;
|
const fnd::Vec<byte_t>& getBytes() const;
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
const fnd::sha::sSha256Hash& getMasterHash() const;
|
const fnd::sha::sSha256Hash& getMasterHash() const;
|
||||||
void setMasterHash(const fnd::sha::sSha256Hash& master_hash);
|
void setMasterHash(const fnd::sha::sSha256Hash& master_hash);
|
||||||
|
|
||||||
size_t getHashBlockSize() const;
|
size_t getHashBlockSize() const;
|
||||||
void setHashBlockSize(size_t hash_block_size);
|
void setHashBlockSize(size_t hash_block_size);
|
||||||
|
|
||||||
const fnd::List<sLayer>& getLayerInfo() const;
|
const fnd::List<sLayer>& getLayerInfo() const;
|
||||||
void setLayerInfo(const fnd::List<sLayer>& layer_info);
|
void setLayerInfo(const fnd::List<sLayer>& layer_info);
|
||||||
private:
|
private:
|
||||||
const std::string kModuleName = "HIERARCHICAL_SHA256_HEADER";
|
const std::string kModuleName = "HIERARCHICAL_SHA256_HEADER";
|
||||||
|
|
||||||
// binary
|
// binary
|
||||||
fnd::Vec<byte_t> mRawBinary;
|
fnd::Vec<byte_t> mRawBinary;
|
||||||
|
|
||||||
// data
|
// data
|
||||||
fnd::sha::sSha256Hash mMasterHash;
|
fnd::sha::sSha256Hash mMasterHash;
|
||||||
size_t mHashBlockSize;
|
size_t mHashBlockSize;
|
||||||
fnd::List<sLayer> mLayerInfo;
|
fnd::List<sLayer> mLayerInfo;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,78 +1,78 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <fnd/ISerialisable.h>
|
#include <fnd/IByteModel.h>
|
||||||
#include <fnd/List.h>
|
#include <fnd/List.h>
|
||||||
#include <nn/hac/ThreadInfoHandler.h>
|
#include <nn/hac/ThreadInfoHandler.h>
|
||||||
#include <nn/hac/SystemCallHandler.h>
|
#include <nn/hac/SystemCallHandler.h>
|
||||||
#include <nn/hac/MemoryMappingHandler.h>
|
#include <nn/hac/MemoryMappingHandler.h>
|
||||||
#include <nn/hac/InteruptHandler.h>
|
#include <nn/hac/InteruptHandler.h>
|
||||||
#include <nn/hac/MiscParamsHandler.h>
|
#include <nn/hac/MiscParamsHandler.h>
|
||||||
#include <nn/hac/KernelVersionHandler.h>
|
#include <nn/hac/KernelVersionHandler.h>
|
||||||
#include <nn/hac/HandleTableSizeHandler.h>
|
#include <nn/hac/HandleTableSizeHandler.h>
|
||||||
#include <nn/hac/MiscFlagsHandler.h>
|
#include <nn/hac/MiscFlagsHandler.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
{
|
{
|
||||||
namespace hac
|
namespace hac
|
||||||
{
|
{
|
||||||
class KernelCapabilityBinary :
|
class KernelCapabilityControl :
|
||||||
public fnd::ISerialisable
|
public fnd::IByteModel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
KernelCapabilityBinary();
|
KernelCapabilityControl();
|
||||||
KernelCapabilityBinary(const KernelCapabilityBinary& other);
|
KernelCapabilityControl(const KernelCapabilityControl& other);
|
||||||
|
|
||||||
void operator=(const KernelCapabilityBinary& other);
|
void operator=(const KernelCapabilityControl& other);
|
||||||
bool operator==(const KernelCapabilityBinary& other) const;
|
bool operator==(const KernelCapabilityControl& other) const;
|
||||||
bool operator!=(const KernelCapabilityBinary& other) const;
|
bool operator!=(const KernelCapabilityControl& other) const;
|
||||||
|
|
||||||
// export/import binary
|
// IByteModel
|
||||||
void toBytes();
|
void toBytes();
|
||||||
void fromBytes(const byte_t* bytes, size_t len);
|
void fromBytes(const byte_t* bytes, size_t len);
|
||||||
virtual const fnd::Vec<byte_t>& getBytes() const;
|
virtual const fnd::Vec<byte_t>& getBytes() const;
|
||||||
|
|
||||||
// variables (consider further abstraction?)
|
// variables (consider further abstraction?)
|
||||||
void clear();
|
void clear();
|
||||||
const ThreadInfoHandler& getThreadInfo() const;
|
const ThreadInfoHandler& getThreadInfo() const;
|
||||||
ThreadInfoHandler& getThreadInfo();
|
ThreadInfoHandler& getThreadInfo();
|
||||||
|
|
||||||
const SystemCallHandler& getSystemCalls() const;
|
const SystemCallHandler& getSystemCalls() const;
|
||||||
SystemCallHandler& getSystemCalls();
|
SystemCallHandler& getSystemCalls();
|
||||||
|
|
||||||
const MemoryMappingHandler& getMemoryMaps() const;
|
const MemoryMappingHandler& getMemoryMaps() const;
|
||||||
MemoryMappingHandler& getMemoryMaps();
|
MemoryMappingHandler& getMemoryMaps();
|
||||||
|
|
||||||
const InteruptHandler& getInterupts() const;
|
const InteruptHandler& getInterupts() const;
|
||||||
InteruptHandler& getInterupts();
|
InteruptHandler& getInterupts();
|
||||||
|
|
||||||
const MiscParamsHandler& getMiscParams() const;
|
const MiscParamsHandler& getMiscParams() const;
|
||||||
MiscParamsHandler& getMiscParams();
|
MiscParamsHandler& getMiscParams();
|
||||||
|
|
||||||
const KernelVersionHandler& getKernelVersion() const;
|
const KernelVersionHandler& getKernelVersion() const;
|
||||||
KernelVersionHandler& getKernelVersion();
|
KernelVersionHandler& getKernelVersion();
|
||||||
|
|
||||||
const HandleTableSizeHandler& getHandleTableSize() const;
|
const HandleTableSizeHandler& getHandleTableSize() const;
|
||||||
HandleTableSizeHandler& getHandleTableSize();
|
HandleTableSizeHandler& getHandleTableSize();
|
||||||
|
|
||||||
const MiscFlagsHandler& getMiscFlags() const;
|
const MiscFlagsHandler& getMiscFlags() const;
|
||||||
MiscFlagsHandler& getMiscFlags();
|
MiscFlagsHandler& getMiscFlags();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const std::string kModuleName = "KC_BINARY";
|
const std::string kModuleName = "KERNEL_CAPABILITY_CONTROL";
|
||||||
|
|
||||||
// raw binary
|
// raw binary
|
||||||
fnd::Vec<byte_t> mRawBinary;
|
fnd::Vec<byte_t> mRawBinary;
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
ThreadInfoHandler mThreadInfo;
|
ThreadInfoHandler mThreadInfo;
|
||||||
SystemCallHandler mSystemCalls;
|
SystemCallHandler mSystemCalls;
|
||||||
MemoryMappingHandler mMemoryMap;
|
MemoryMappingHandler mMemoryMap;
|
||||||
InteruptHandler mInterupts;
|
InteruptHandler mInterupts;
|
||||||
MiscParamsHandler mMiscParams;
|
MiscParamsHandler mMiscParams;
|
||||||
KernelVersionHandler mKernelVersion;
|
KernelVersionHandler mKernelVersion;
|
||||||
HandleTableSizeHandler mHandleTableSize;
|
HandleTableSizeHandler mHandleTableSize;
|
||||||
MiscFlagsHandler mMiscFlags;
|
MiscFlagsHandler mMiscFlags;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,52 +1,52 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <nn/hac/kc.h>
|
#include <nn/hac/define/kc.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
{
|
{
|
||||||
namespace hac
|
namespace hac
|
||||||
{
|
{
|
||||||
class KernelCapabilityEntry
|
class KernelCapabilityEntry
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
KernelCapabilityEntry();
|
KernelCapabilityEntry();
|
||||||
KernelCapabilityEntry(kc::KernelCapId type);
|
KernelCapabilityEntry(kc::KernelCapId type);
|
||||||
KernelCapabilityEntry(kc::KernelCapId type, uint32_t field);
|
KernelCapabilityEntry(kc::KernelCapId type, uint32_t field);
|
||||||
|
|
||||||
void operator=(const KernelCapabilityEntry& other);
|
void operator=(const KernelCapabilityEntry& other);
|
||||||
bool operator==(const KernelCapabilityEntry& other) const;
|
bool operator==(const KernelCapabilityEntry& other) const;
|
||||||
bool operator!=(const KernelCapabilityEntry& other) const;
|
bool operator!=(const KernelCapabilityEntry& other) const;
|
||||||
|
|
||||||
uint32_t getCap() const;
|
uint32_t getCap() const;
|
||||||
void setCap(uint32_t cap);
|
void setCap(uint32_t cap);
|
||||||
|
|
||||||
kc::KernelCapId getType() const;
|
kc::KernelCapId getType() const;
|
||||||
void setType(kc::KernelCapId type);
|
void setType(kc::KernelCapId type);
|
||||||
|
|
||||||
uint32_t getField() const;
|
uint32_t getField() const;
|
||||||
void setField(uint32_t field);
|
void setField(uint32_t field);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
kc::KernelCapId mType;
|
kc::KernelCapId mType;
|
||||||
uint32_t mField;
|
uint32_t mField;
|
||||||
|
|
||||||
inline uint32_t getFieldShift() const { return mType + 1; }
|
inline uint32_t getFieldShift() const { return mType + 1; }
|
||||||
inline uint32_t getFieldMask() const { return BIT(31 - mType) - 1; }
|
inline uint32_t getFieldMask() const { return BIT(31 - mType) - 1; }
|
||||||
inline uint32_t getCapMask() const { return BIT(mType) - 1; }
|
inline uint32_t getCapMask() const { return BIT(mType) - 1; }
|
||||||
inline kc::KernelCapId getCapId(uint32_t cap) const
|
inline kc::KernelCapId getCapId(uint32_t cap) const
|
||||||
{
|
{
|
||||||
kc::KernelCapId id = kc::KC_INVALID;
|
kc::KernelCapId id = kc::KC_INVALID;
|
||||||
for (byte_t tmp = 0; tmp < 31; tmp++)
|
for (byte_t tmp = 0; tmp < 31; tmp++)
|
||||||
{
|
{
|
||||||
if (((cap >> tmp) & 1) == 0)
|
if (((cap >> tmp) & 1) == 0)
|
||||||
{
|
{
|
||||||
id = (kc::KernelCapId)tmp;
|
id = (kc::KernelCapId)tmp;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,80 +1,80 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <fnd/List.h>
|
#include <fnd/List.h>
|
||||||
#include <fnd/ISerialisable.h>
|
#include <fnd/IByteModel.h>
|
||||||
#include <nn/hac/meta.h>
|
#include <nn/hac/define/meta.h>
|
||||||
#include <nn/hac/AccessControlInfoBinary.h>
|
#include <nn/hac/AccessControlInfo.h>
|
||||||
#include <nn/hac/AccessControlInfoDescBinary.h>
|
#include <nn/hac/AccessControlInfoDesc.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
{
|
{
|
||||||
namespace hac
|
namespace hac
|
||||||
{
|
{
|
||||||
class MetaBinary :
|
class Meta :
|
||||||
public fnd::ISerialisable
|
public fnd::IByteModel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MetaBinary();
|
Meta();
|
||||||
MetaBinary(const MetaBinary& other);
|
Meta(const Meta& other);
|
||||||
|
|
||||||
void operator=(const MetaBinary& other);
|
void operator=(const Meta& other);
|
||||||
bool operator==(const MetaBinary& other) const;
|
bool operator==(const Meta& other) const;
|
||||||
bool operator!=(const MetaBinary& other) const;
|
bool operator!=(const Meta& other) const;
|
||||||
|
|
||||||
// export/import binary
|
// IByteModel
|
||||||
void toBytes();
|
void toBytes();
|
||||||
void fromBytes(const byte_t* bytes, size_t len);
|
void fromBytes(const byte_t* bytes, size_t len);
|
||||||
const fnd::Vec<byte_t>& getBytes() const;
|
const fnd::Vec<byte_t>& getBytes() const;
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
meta::InstructionType getInstructionType() const;
|
meta::InstructionType getInstructionType() const;
|
||||||
void setInstructionType(meta::InstructionType type);
|
void setInstructionType(meta::InstructionType type);
|
||||||
|
|
||||||
meta::ProcAddrSpaceType getProcAddressSpaceType() const;
|
meta::ProcAddrSpaceType getProcAddressSpaceType() const;
|
||||||
void setProcAddressSpaceType(meta::ProcAddrSpaceType type);
|
void setProcAddressSpaceType(meta::ProcAddrSpaceType type);
|
||||||
|
|
||||||
byte_t getMainThreadPriority() const;
|
byte_t getMainThreadPriority() const;
|
||||||
void setMainThreadPriority(byte_t priority);
|
void setMainThreadPriority(byte_t priority);
|
||||||
|
|
||||||
byte_t getMainThreadCpuId() const;
|
byte_t getMainThreadCpuId() const;
|
||||||
void setMainThreadCpuId(byte_t cpu_id);
|
void setMainThreadCpuId(byte_t cpu_id);
|
||||||
|
|
||||||
uint32_t getVersion() const;
|
uint32_t getVersion() const;
|
||||||
void setVersion(uint32_t version);
|
void setVersion(uint32_t version);
|
||||||
|
|
||||||
uint32_t getMainThreadStackSize() const;
|
uint32_t getMainThreadStackSize() const;
|
||||||
void setMainThreadStackSize(uint32_t size);
|
void setMainThreadStackSize(uint32_t size);
|
||||||
|
|
||||||
const std::string& getName() const;
|
const std::string& getName() const;
|
||||||
void setName(const std::string& name);
|
void setName(const std::string& name);
|
||||||
|
|
||||||
const std::string& getProductCode() const;
|
const std::string& getProductCode() const;
|
||||||
void setProductCode(const std::string& product_code);
|
void setProductCode(const std::string& product_code);
|
||||||
|
|
||||||
const AccessControlInfoBinary& getAci() const;
|
const AccessControlInfo& getAci() const;
|
||||||
void setAci(const AccessControlInfoBinary& aci);
|
void setAci(const AccessControlInfo& aci);
|
||||||
|
|
||||||
const AccessControlInfoDescBinary& getAcid() const;
|
const AccessControlInfoDesc& getAcid() const;
|
||||||
void setAcid(const AccessControlInfoDescBinary& acid);
|
void setAcid(const AccessControlInfoDesc& acid);
|
||||||
private:
|
private:
|
||||||
const std::string kModuleName = "META_BINARY";
|
const std::string kModuleName = "META";
|
||||||
|
|
||||||
// raw binary
|
// raw binary
|
||||||
fnd::Vec<byte_t> mRawBinary;
|
fnd::Vec<byte_t> mRawBinary;
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
meta::InstructionType mInstructionType;
|
meta::InstructionType mInstructionType;
|
||||||
meta::ProcAddrSpaceType mProcAddressSpaceType;
|
meta::ProcAddrSpaceType mProcAddressSpaceType;
|
||||||
byte_t mMainThreadPriority;
|
byte_t mMainThreadPriority;
|
||||||
byte_t mMainThreadCpuId;
|
byte_t mMainThreadCpuId;
|
||||||
uint32_t mVersion;
|
uint32_t mVersion;
|
||||||
uint32_t mMainThreadStackSize;
|
uint32_t mMainThreadStackSize;
|
||||||
std::string mName;
|
std::string mName;
|
||||||
std::string mProductCode;
|
std::string mProductCode;
|
||||||
AccessControlInfoBinary mAci;
|
AccessControlInfo mAci;
|
||||||
AccessControlInfoDescBinary mAcid;
|
AccessControlInfoDesc mAcid;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,115 +0,0 @@
|
||||||
#pragma once
|
|
||||||
#include <nn/hac/nca.h>
|
|
||||||
#include <fnd/ISerialisable.h>
|
|
||||||
#include <fnd/List.h>
|
|
||||||
|
|
||||||
namespace nn
|
|
||||||
{
|
|
||||||
namespace hac
|
|
||||||
{
|
|
||||||
class NcaHeader :
|
|
||||||
public fnd::ISerialisable
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
enum FormatVersion
|
|
||||||
{
|
|
||||||
NCA2_FORMAT,
|
|
||||||
NCA3_FORMAT
|
|
||||||
};
|
|
||||||
|
|
||||||
struct sPartition
|
|
||||||
{
|
|
||||||
byte_t index;
|
|
||||||
uint64_t offset;
|
|
||||||
uint64_t size;
|
|
||||||
fnd::sha::sSha256Hash hash;
|
|
||||||
|
|
||||||
const sPartition& operator=(const sPartition& other)
|
|
||||||
{
|
|
||||||
index = other.index;
|
|
||||||
offset = other.offset;
|
|
||||||
size = other.size;
|
|
||||||
hash = other.hash;
|
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator==(const sPartition& other) const
|
|
||||||
{
|
|
||||||
return (index == other.index) \
|
|
||||||
&& (offset == other.offset) \
|
|
||||||
&& (size == other.size) \
|
|
||||||
&& (hash == other.hash);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator!=(const sPartition& other) const
|
|
||||||
{
|
|
||||||
return !operator==(other);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
NcaHeader();
|
|
||||||
NcaHeader(const NcaHeader& other);
|
|
||||||
|
|
||||||
void operator=(const NcaHeader& other);
|
|
||||||
bool operator==(const NcaHeader& other) const;
|
|
||||||
bool operator!=(const NcaHeader& other) const;
|
|
||||||
|
|
||||||
// export/import binary
|
|
||||||
void toBytes();
|
|
||||||
void fromBytes(const byte_t* bytes, size_t len);
|
|
||||||
const fnd::Vec<byte_t>& getBytes() const;
|
|
||||||
|
|
||||||
// variables
|
|
||||||
void clear();
|
|
||||||
FormatVersion getFormatVersion() const;
|
|
||||||
void setFormatVersion(FormatVersion ver);
|
|
||||||
nca::DistributionType getDistributionType() const;
|
|
||||||
void setDistributionType(nca::DistributionType type);
|
|
||||||
nca::ContentType getContentType() const;
|
|
||||||
void setContentType(nca::ContentType type);
|
|
||||||
byte_t getKeyGeneration() const;
|
|
||||||
void setKeyGeneration(byte_t gen);
|
|
||||||
byte_t getKaekIndex() const;
|
|
||||||
void setKaekIndex(byte_t index);
|
|
||||||
uint64_t getContentSize() const;
|
|
||||||
void setContentSize(uint64_t size);
|
|
||||||
uint64_t getProgramId() const;
|
|
||||||
void setProgramId(uint64_t program_id);
|
|
||||||
uint32_t getContentIndex() const;
|
|
||||||
void setContentIndex(uint32_t index);
|
|
||||||
uint32_t getSdkAddonVersion() const;
|
|
||||||
void setSdkAddonVersion(uint32_t version);
|
|
||||||
bool hasRightsId() const;
|
|
||||||
const byte_t* getRightsId() const;
|
|
||||||
void setRightsId(const byte_t* rights_id);
|
|
||||||
const fnd::List<sPartition>& getPartitions() const;
|
|
||||||
void setPartitions(const fnd::List<sPartition>& partitions);
|
|
||||||
const fnd::List<fnd::aes::sAes128Key>& getEncAesKeys() const;
|
|
||||||
void setEncAesKeys(const fnd::List<fnd::aes::sAes128Key>& keys);
|
|
||||||
|
|
||||||
private:
|
|
||||||
const std::string kModuleName = "NCA_HEADER";
|
|
||||||
|
|
||||||
// binary
|
|
||||||
fnd::Vec<byte_t> mRawBinary;
|
|
||||||
|
|
||||||
// data
|
|
||||||
FormatVersion mFormatVersion;
|
|
||||||
nca::DistributionType mDistributionType;
|
|
||||||
nca::ContentType mContentType;
|
|
||||||
byte_t mKeyGeneration;
|
|
||||||
byte_t mKaekIndex;
|
|
||||||
uint64_t mContentSize;
|
|
||||||
uint64_t mProgramId;
|
|
||||||
uint32_t mContentIndex;
|
|
||||||
uint32_t mSdkAddonVersion;
|
|
||||||
byte_t mRightsId[nca::kRightsIdLen];
|
|
||||||
fnd::List<sPartition> mPartitions;
|
|
||||||
fnd::List<fnd::aes::sAes128Key> mEncAesKeys;
|
|
||||||
|
|
||||||
uint64_t blockNumToSize(uint32_t block_num) const;
|
|
||||||
uint32_t sizeToBlockNum(uint64_t real_size) const;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,141 +1,141 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <nn/hac/nro.h>
|
#include <nn/hac/define/nro.h>
|
||||||
#include <fnd/ISerialisable.h>
|
#include <fnd/IByteModel.h>
|
||||||
#include <fnd/List.h>
|
#include <fnd/List.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
{
|
{
|
||||||
namespace hac
|
namespace hac
|
||||||
{
|
{
|
||||||
class NroHeader :
|
class NroHeader :
|
||||||
public fnd::ISerialisable
|
public fnd::IByteModel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
struct sRoCrt
|
struct sRoCrt
|
||||||
{
|
{
|
||||||
byte_t data[nro::kRoCrtSize];
|
byte_t data[nro::kRoCrtSize];
|
||||||
|
|
||||||
void operator=(const sRoCrt& other)
|
void operator=(const sRoCrt& other)
|
||||||
{
|
{
|
||||||
memcpy(data, other.data, nro::kRoCrtSize);
|
memcpy(data, other.data, nro::kRoCrtSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator==(const sRoCrt& other) const
|
bool operator==(const sRoCrt& other) const
|
||||||
{
|
{
|
||||||
return memcmp(data, other.data, nro::kRoCrtSize) == 0;
|
return memcmp(data, other.data, nro::kRoCrtSize) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=(const sRoCrt& other) const
|
bool operator!=(const sRoCrt& other) const
|
||||||
{
|
{
|
||||||
return !(*this == other);
|
return !(*this == other);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sModuleId
|
struct sModuleId
|
||||||
{
|
{
|
||||||
byte_t data[nro::kModuleIdSize];
|
byte_t data[nro::kModuleIdSize];
|
||||||
|
|
||||||
void operator=(const sModuleId& other)
|
void operator=(const sModuleId& other)
|
||||||
{
|
{
|
||||||
memcpy(data, other.data, nro::kModuleIdSize);
|
memcpy(data, other.data, nro::kModuleIdSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator==(const sModuleId& other) const
|
bool operator==(const sModuleId& other) const
|
||||||
{
|
{
|
||||||
return memcmp(data, other.data, nro::kModuleIdSize) == 0;
|
return memcmp(data, other.data, nro::kModuleIdSize) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=(const sModuleId& other) const
|
bool operator!=(const sModuleId& other) const
|
||||||
{
|
{
|
||||||
return !(*this == other);
|
return !(*this == other);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sSection
|
struct sSection
|
||||||
{
|
{
|
||||||
uint32_t memory_offset;
|
uint32_t memory_offset;
|
||||||
uint32_t size;
|
uint32_t size;
|
||||||
|
|
||||||
void operator=(const sSection& other)
|
void operator=(const sSection& other)
|
||||||
{
|
{
|
||||||
memory_offset = other.memory_offset;
|
memory_offset = other.memory_offset;
|
||||||
size = other.size;
|
size = other.size;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator==(const sSection& other) const
|
bool operator==(const sSection& other) const
|
||||||
{
|
{
|
||||||
return (memory_offset == other.memory_offset) \
|
return (memory_offset == other.memory_offset) \
|
||||||
&& (size == other.size);
|
&& (size == other.size);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=(const sSection& other) const
|
bool operator!=(const sSection& other) const
|
||||||
{
|
{
|
||||||
return !(*this == other);
|
return !(*this == other);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
NroHeader();
|
NroHeader();
|
||||||
NroHeader(const NroHeader& other);
|
NroHeader(const NroHeader& other);
|
||||||
|
|
||||||
void operator=(const NroHeader& other);
|
void operator=(const NroHeader& other);
|
||||||
bool operator==(const NroHeader& other) const;
|
bool operator==(const NroHeader& other) const;
|
||||||
bool operator!=(const NroHeader& other) const;
|
bool operator!=(const NroHeader& other) const;
|
||||||
|
|
||||||
// export/import binary
|
// IByteModel
|
||||||
void toBytes();
|
void toBytes();
|
||||||
void fromBytes(const byte_t* bytes, size_t len);
|
void fromBytes(const byte_t* bytes, size_t len);
|
||||||
const fnd::Vec<byte_t>& getBytes() const;
|
const fnd::Vec<byte_t>& getBytes() const;
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
const sRoCrt& getRoCrt() const;
|
const sRoCrt& getRoCrt() const;
|
||||||
void setRoCrt(const sRoCrt& ro_crt);
|
void setRoCrt(const sRoCrt& ro_crt);
|
||||||
|
|
||||||
uint32_t getNroSize() const;
|
uint32_t getNroSize() const;
|
||||||
void setNroSize(uint32_t size);
|
void setNroSize(uint32_t size);
|
||||||
|
|
||||||
const sSection& getTextInfo() const;
|
const sSection& getTextInfo() const;
|
||||||
void setTextInfo(const sSection& info);
|
void setTextInfo(const sSection& info);
|
||||||
|
|
||||||
const sSection& getRoInfo() const;
|
const sSection& getRoInfo() const;
|
||||||
void setRoInfo(const sSection& info);
|
void setRoInfo(const sSection& info);
|
||||||
|
|
||||||
const sSection& getDataInfo() const;
|
const sSection& getDataInfo() const;
|
||||||
void setDataInfo(const sSection& info);
|
void setDataInfo(const sSection& info);
|
||||||
|
|
||||||
uint32_t getBssSize() const;
|
uint32_t getBssSize() const;
|
||||||
void setBssSize(uint32_t size);
|
void setBssSize(uint32_t size);
|
||||||
|
|
||||||
const sModuleId& getModuleId() const;
|
const sModuleId& getModuleId() const;
|
||||||
void setModuleId(const sModuleId& id);
|
void setModuleId(const sModuleId& id);
|
||||||
|
|
||||||
const sSection& getRoEmbeddedInfo() const;
|
const sSection& getRoEmbeddedInfo() const;
|
||||||
void setRoEmbeddedInfo(const sSection& info);
|
void setRoEmbeddedInfo(const sSection& info);
|
||||||
|
|
||||||
const sSection& getRoDynStrInfo() const;
|
const sSection& getRoDynStrInfo() const;
|
||||||
void setRoDynStrInfo(const sSection& info);
|
void setRoDynStrInfo(const sSection& info);
|
||||||
|
|
||||||
const sSection& getRoDynSymInfo() const;
|
const sSection& getRoDynSymInfo() const;
|
||||||
void setRoDynSymInfo(const sSection& info);
|
void setRoDynSymInfo(const sSection& info);
|
||||||
private:
|
private:
|
||||||
const std::string kModuleName = "NRO_HEADER";
|
const std::string kModuleName = "NRO_HEADER";
|
||||||
|
|
||||||
// binary
|
// binary
|
||||||
fnd::Vec<byte_t> mRawBinary;
|
fnd::Vec<byte_t> mRawBinary;
|
||||||
|
|
||||||
// data
|
// data
|
||||||
sRoCrt mRoCrt;
|
sRoCrt mRoCrt;
|
||||||
uint32_t mNroSize;
|
uint32_t mNroSize;
|
||||||
sSection mTextInfo;
|
sSection mTextInfo;
|
||||||
sSection mRoInfo;
|
sSection mRoInfo;
|
||||||
sSection mDataInfo;
|
sSection mDataInfo;
|
||||||
uint32_t mBssSize;
|
uint32_t mBssSize;
|
||||||
sModuleId mModuleId;
|
sModuleId mModuleId;
|
||||||
sSection mRoEmbeddedInfo;
|
sSection mRoEmbeddedInfo;
|
||||||
sSection mRoDynStrInfo;
|
sSection mRoDynStrInfo;
|
||||||
sSection mRoDynSymInfo;
|
sSection mRoDynSymInfo;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,149 +1,149 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <nn/hac/nso.h>
|
#include <nn/hac/define/nso.h>
|
||||||
#include <fnd/ISerialisable.h>
|
#include <fnd/IByteModel.h>
|
||||||
#include <fnd/List.h>
|
#include <fnd/List.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
{
|
{
|
||||||
namespace hac
|
namespace hac
|
||||||
{
|
{
|
||||||
class NsoHeader :
|
class NsoHeader :
|
||||||
public fnd::ISerialisable
|
public fnd::IByteModel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
struct sModuleId
|
struct sModuleId
|
||||||
{
|
{
|
||||||
byte_t data[nso::kModuleIdSize];
|
byte_t data[nso::kModuleIdSize];
|
||||||
|
|
||||||
void operator=(const sModuleId& other)
|
void operator=(const sModuleId& other)
|
||||||
{
|
{
|
||||||
memcpy(data, other.data, nso::kModuleIdSize);
|
memcpy(data, other.data, nso::kModuleIdSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator==(const sModuleId& other) const
|
bool operator==(const sModuleId& other) const
|
||||||
{
|
{
|
||||||
return memcmp(data, other.data, nso::kModuleIdSize) == 0;
|
return memcmp(data, other.data, nso::kModuleIdSize) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=(const sModuleId& other) const
|
bool operator!=(const sModuleId& other) const
|
||||||
{
|
{
|
||||||
return !(*this == other);
|
return !(*this == other);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sLayout
|
struct sLayout
|
||||||
{
|
{
|
||||||
uint32_t offset;
|
uint32_t offset;
|
||||||
uint32_t size;
|
uint32_t size;
|
||||||
|
|
||||||
void operator=(const sLayout& other)
|
void operator=(const sLayout& other)
|
||||||
{
|
{
|
||||||
offset = other.offset;
|
offset = other.offset;
|
||||||
size = other.size;
|
size = other.size;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator==(const sLayout& other) const
|
bool operator==(const sLayout& other) const
|
||||||
{
|
{
|
||||||
return (offset == other.offset) \
|
return (offset == other.offset) \
|
||||||
&& (size == other.size);
|
&& (size == other.size);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=(const sLayout& other) const
|
bool operator!=(const sLayout& other) const
|
||||||
{
|
{
|
||||||
return !(*this == other);
|
return !(*this == other);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sCodeSegment
|
struct sCodeSegment
|
||||||
{
|
{
|
||||||
sLayout file_layout;
|
sLayout file_layout;
|
||||||
sLayout memory_layout;
|
sLayout memory_layout;
|
||||||
bool is_compressed;
|
bool is_compressed;
|
||||||
bool is_hashed;
|
bool is_hashed;
|
||||||
fnd::sha::sSha256Hash hash;
|
fnd::sha::sSha256Hash hash;
|
||||||
|
|
||||||
void operator=(const sCodeSegment& other)
|
void operator=(const sCodeSegment& other)
|
||||||
{
|
{
|
||||||
file_layout = other.file_layout;
|
file_layout = other.file_layout;
|
||||||
memory_layout = other.memory_layout;
|
memory_layout = other.memory_layout;
|
||||||
is_compressed = other.is_compressed;
|
is_compressed = other.is_compressed;
|
||||||
is_hashed = other.is_hashed;
|
is_hashed = other.is_hashed;
|
||||||
hash = other.hash;
|
hash = other.hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator==(const sCodeSegment& other) const
|
bool operator==(const sCodeSegment& other) const
|
||||||
{
|
{
|
||||||
return (file_layout == other.file_layout) \
|
return (file_layout == other.file_layout) \
|
||||||
&& (memory_layout == other.memory_layout) \
|
&& (memory_layout == other.memory_layout) \
|
||||||
&& (is_compressed == other.is_compressed) \
|
&& (is_compressed == other.is_compressed) \
|
||||||
&& (is_hashed == other.is_hashed) \
|
&& (is_hashed == other.is_hashed) \
|
||||||
&& (hash == other.hash);
|
&& (hash == other.hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=(const sCodeSegment& other) const
|
bool operator!=(const sCodeSegment& other) const
|
||||||
{
|
{
|
||||||
return !(*this == other);
|
return !(*this == other);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
NsoHeader();
|
NsoHeader();
|
||||||
NsoHeader(const NsoHeader& other);
|
NsoHeader(const NsoHeader& other);
|
||||||
|
|
||||||
void operator=(const NsoHeader& other);
|
void operator=(const NsoHeader& other);
|
||||||
bool operator==(const NsoHeader& other) const;
|
bool operator==(const NsoHeader& other) const;
|
||||||
bool operator!=(const NsoHeader& other) const;
|
bool operator!=(const NsoHeader& other) const;
|
||||||
|
|
||||||
// export/import binary
|
// IByteModel
|
||||||
void toBytes();
|
void toBytes();
|
||||||
void fromBytes(const byte_t* bytes, size_t len);
|
void fromBytes(const byte_t* bytes, size_t len);
|
||||||
const fnd::Vec<byte_t>& getBytes() const;
|
const fnd::Vec<byte_t>& getBytes() const;
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
const sModuleId& getModuleId() const;
|
const sModuleId& getModuleId() const;
|
||||||
void setModuleId(const sModuleId& id);
|
void setModuleId(const sModuleId& id);
|
||||||
|
|
||||||
uint32_t getBssSize() const;
|
uint32_t getBssSize() const;
|
||||||
void setBssSize(uint32_t size);
|
void setBssSize(uint32_t size);
|
||||||
|
|
||||||
const sCodeSegment& getTextSegmentInfo() const;
|
const sCodeSegment& getTextSegmentInfo() const;
|
||||||
void setTextSegmentInfo(const sCodeSegment& info);
|
void setTextSegmentInfo(const sCodeSegment& info);
|
||||||
|
|
||||||
const sCodeSegment& getRoSegmentInfo() const;
|
const sCodeSegment& getRoSegmentInfo() const;
|
||||||
void setRoSegmentInfo(const sCodeSegment& info);
|
void setRoSegmentInfo(const sCodeSegment& info);
|
||||||
|
|
||||||
const sCodeSegment& getDataSegmentInfo() const;
|
const sCodeSegment& getDataSegmentInfo() const;
|
||||||
void setDataSegmentInfo(const sCodeSegment& info);
|
void setDataSegmentInfo(const sCodeSegment& info);
|
||||||
|
|
||||||
const sLayout& getModuleNameInfo() const;
|
const sLayout& getModuleNameInfo() const;
|
||||||
void setModuleNameInfo(const sLayout& info);
|
void setModuleNameInfo(const sLayout& info);
|
||||||
|
|
||||||
const sLayout& getRoEmbeddedInfo() const;
|
const sLayout& getRoEmbeddedInfo() const;
|
||||||
void setRoEmbeddedInfo(const sLayout& info);
|
void setRoEmbeddedInfo(const sLayout& info);
|
||||||
|
|
||||||
const sLayout& getRoDynStrInfo() const;
|
const sLayout& getRoDynStrInfo() const;
|
||||||
void setRoDynStrInfo(const sLayout& info);
|
void setRoDynStrInfo(const sLayout& info);
|
||||||
|
|
||||||
const sLayout& getRoDynSymInfo() const;
|
const sLayout& getRoDynSymInfo() const;
|
||||||
void setRoDynSymInfo(const sLayout& info);
|
void setRoDynSymInfo(const sLayout& info);
|
||||||
private:
|
private:
|
||||||
const std::string kModuleName = "NSO_HEADER";
|
const std::string kModuleName = "NSO_HEADER";
|
||||||
|
|
||||||
// binary
|
// binary
|
||||||
fnd::Vec<byte_t> mRawBinary;
|
fnd::Vec<byte_t> mRawBinary;
|
||||||
|
|
||||||
// data
|
// data
|
||||||
sModuleId mModuleId;
|
sModuleId mModuleId;
|
||||||
uint32_t mBssSize;
|
uint32_t mBssSize;
|
||||||
sCodeSegment mTextSegmentInfo;
|
sCodeSegment mTextSegmentInfo;
|
||||||
sCodeSegment mRoSegmentInfo;
|
sCodeSegment mRoSegmentInfo;
|
||||||
sCodeSegment mDataSegmentInfo;
|
sCodeSegment mDataSegmentInfo;
|
||||||
sLayout mModuleNameInfo;
|
sLayout mModuleNameInfo;
|
||||||
sLayout mRoEmbeddedInfo;
|
sLayout mRoEmbeddedInfo;
|
||||||
sLayout mRoDynStrInfo;
|
sLayout mRoDynStrInfo;
|
||||||
sLayout mRoDynSymInfo;
|
sLayout mRoDynSymInfo;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,100 +1,100 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <fnd/ISerialisable.h>
|
#include <fnd/IByteModel.h>
|
||||||
#include <fnd/List.h>
|
#include <fnd/List.h>
|
||||||
#include <nn/hac/pfs.h>
|
#include <nn/hac/define/pfs.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
{
|
{
|
||||||
namespace hac
|
namespace hac
|
||||||
{
|
{
|
||||||
class PfsHeader :
|
class PartitionFsHeader :
|
||||||
public fnd::ISerialisable
|
public fnd::IByteModel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum FsType
|
enum FsType
|
||||||
{
|
{
|
||||||
TYPE_PFS0,
|
TYPE_PFS0,
|
||||||
TYPE_HFS0
|
TYPE_HFS0
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sFile
|
struct sFile
|
||||||
{
|
{
|
||||||
std::string name;
|
std::string name;
|
||||||
size_t offset;
|
size_t offset;
|
||||||
size_t size;
|
size_t size;
|
||||||
size_t hash_protected_size;
|
size_t hash_protected_size;
|
||||||
fnd::sha::sSha256Hash hash;
|
fnd::sha::sSha256Hash hash;
|
||||||
|
|
||||||
sFile& operator=(const sFile& other)
|
sFile& operator=(const sFile& other)
|
||||||
{
|
{
|
||||||
name = other.name;
|
name = other.name;
|
||||||
offset = other.offset;
|
offset = other.offset;
|
||||||
size = other.size;
|
size = other.size;
|
||||||
hash_protected_size = other.hash_protected_size;
|
hash_protected_size = other.hash_protected_size;
|
||||||
hash = other.hash;
|
hash = other.hash;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator==(const sFile& other) const
|
bool operator==(const sFile& other) const
|
||||||
{
|
{
|
||||||
return (name == other.name) \
|
return (name == other.name) \
|
||||||
&& (offset == other.offset) \
|
&& (offset == other.offset) \
|
||||||
&& (size == other.size) \
|
&& (size == other.size) \
|
||||||
&& (hash_protected_size == other.hash_protected_size) \
|
&& (hash_protected_size == other.hash_protected_size) \
|
||||||
&& (hash == other.hash);
|
&& (hash == other.hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=(const sFile& other) const
|
bool operator!=(const sFile& other) const
|
||||||
{
|
{
|
||||||
return !operator==(other);
|
return !operator==(other);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator==(const std::string& other) const
|
bool operator==(const std::string& other) const
|
||||||
{
|
{
|
||||||
return (name == other);
|
return (name == other);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=(const std::string& other) const
|
bool operator!=(const std::string& other) const
|
||||||
{
|
{
|
||||||
return !operator==(other);
|
return !operator==(other);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
PfsHeader();
|
PartitionFsHeader();
|
||||||
PfsHeader(const PfsHeader& other);
|
PartitionFsHeader(const PartitionFsHeader& other);
|
||||||
|
|
||||||
void operator=(const PfsHeader& other);
|
void operator=(const PartitionFsHeader& other);
|
||||||
bool operator==(const PfsHeader& other) const;
|
bool operator==(const PartitionFsHeader& other) const;
|
||||||
bool operator!=(const PfsHeader& other) const;
|
bool operator!=(const PartitionFsHeader& other) const;
|
||||||
|
|
||||||
// export/import binary
|
// IByteModel
|
||||||
void toBytes();
|
void toBytes();
|
||||||
void fromBytes(const byte_t* bytes, size_t len);
|
void fromBytes(const byte_t* bytes, size_t len);
|
||||||
const fnd::Vec<byte_t>& getBytes() const;
|
const fnd::Vec<byte_t>& getBytes() const;
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
FsType getFsType() const;
|
FsType getFsType() const;
|
||||||
void setFsType(FsType type);
|
void setFsType(FsType type);
|
||||||
const fnd::List<sFile>& getFileList() const;
|
const fnd::List<sFile>& getFileList() const;
|
||||||
void addFile(const std::string& name, size_t size);
|
void addFile(const std::string& name, size_t size);
|
||||||
void addFile(const std::string& name, size_t size, size_t hash_protected_size, const fnd::sha::sSha256Hash& hash);
|
void addFile(const std::string& name, size_t size, size_t hash_protected_size, const fnd::sha::sSha256Hash& hash);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const std::string kModuleName = "PFS_HEADER";
|
const std::string kModuleName = "PARTITIONFS_HEADER";
|
||||||
|
|
||||||
// binary blob
|
// binary blob
|
||||||
fnd::Vec<byte_t> mRawBinary;
|
fnd::Vec<byte_t> mRawBinary;
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
FsType mFsType;
|
FsType mFsType;
|
||||||
fnd::List<sFile> mFileList;
|
fnd::List<sFile> mFileList;
|
||||||
|
|
||||||
size_t getFileEntrySize(FsType fs_type);
|
size_t getFileEntrySize(FsType fs_type);
|
||||||
void calculateOffsets(size_t data_offset);
|
void calculateOffsets(size_t data_offset);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
51
lib/libhac/include/nn/hac/PatchMetaExtendedHeader.h
Normal file
51
lib/libhac/include/nn/hac/PatchMetaExtendedHeader.h
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
#pragma once
|
||||||
|
#include <string>
|
||||||
|
#include <cstring>
|
||||||
|
#include <fnd/IByteModel.h>
|
||||||
|
#include <nn/hac/define/cnmt.h>
|
||||||
|
|
||||||
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
|
{
|
||||||
|
class PatchMetaExtendedHeader :
|
||||||
|
public fnd::IByteModel
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
PatchMetaExtendedHeader();
|
||||||
|
PatchMetaExtendedHeader(const PatchMetaExtendedHeader& other);
|
||||||
|
|
||||||
|
void operator=(const PatchMetaExtendedHeader& other);
|
||||||
|
bool operator==(const PatchMetaExtendedHeader& other) const;
|
||||||
|
bool operator!=(const PatchMetaExtendedHeader& other) const;
|
||||||
|
|
||||||
|
// IByteModel
|
||||||
|
void toBytes();
|
||||||
|
void fromBytes(const byte_t* bytes, size_t len);
|
||||||
|
const fnd::Vec<byte_t>& getBytes() const;
|
||||||
|
|
||||||
|
// variables
|
||||||
|
void clear();
|
||||||
|
|
||||||
|
uint64_t getApplicationId() const;
|
||||||
|
void setApplicationId(uint64_t application_id);
|
||||||
|
|
||||||
|
uint32_t getRequiredSystemVersion() const;
|
||||||
|
void setRequiredSystemVersion(uint32_t sys_ver);
|
||||||
|
|
||||||
|
uint32_t getExtendedDataSize() const;
|
||||||
|
void setExtendedDataSize(uint32_t size);
|
||||||
|
|
||||||
|
private:
|
||||||
|
const std::string kModuleName = "PATCH_META_EXTENDED_HEADER";
|
||||||
|
|
||||||
|
// binary blob
|
||||||
|
fnd::Vec<byte_t> mRawBinary;
|
||||||
|
|
||||||
|
// variables
|
||||||
|
uint64_t mApplicationId;
|
||||||
|
uint32_t mRequiredSystemVersion;
|
||||||
|
uint32_t mExtendedDataSize;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
42
lib/libhac/include/nn/hac/ServiceAccessControl.h
Normal file
42
lib/libhac/include/nn/hac/ServiceAccessControl.h
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
#pragma once
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
#include <fnd/IByteModel.h>
|
||||||
|
#include <fnd/List.h>
|
||||||
|
#include <nn/hac/ServiceAccessControlEntry.h>
|
||||||
|
|
||||||
|
namespace nn
|
||||||
|
{
|
||||||
|
namespace hac
|
||||||
|
{
|
||||||
|
class ServiceAccessControl :
|
||||||
|
public fnd::IByteModel
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ServiceAccessControl();
|
||||||
|
ServiceAccessControl(const ServiceAccessControl& other);
|
||||||
|
|
||||||
|
void operator=(const ServiceAccessControl& other);
|
||||||
|
bool operator==(const ServiceAccessControl& other) const;
|
||||||
|
bool operator!=(const ServiceAccessControl& other) const;
|
||||||
|
|
||||||
|
// IByteModel
|
||||||
|
void toBytes();
|
||||||
|
void fromBytes(const byte_t* bytes, size_t len);
|
||||||
|
const fnd::Vec<byte_t>& getBytes() const;
|
||||||
|
|
||||||
|
// variables
|
||||||
|
void clear();
|
||||||
|
const fnd::List<ServiceAccessControlEntry>& getServiceList() const;
|
||||||
|
void setServiceList(const fnd::List<ServiceAccessControlEntry>& list);
|
||||||
|
private:
|
||||||
|
const std::string kModuleName = "SERVICE_ACCESS_CONTROL";
|
||||||
|
|
||||||
|
// raw binary
|
||||||
|
fnd::Vec<byte_t> mRawBinary;
|
||||||
|
|
||||||
|
// variables
|
||||||
|
fnd::List<ServiceAccessControlEntry> mServices;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,42 +0,0 @@
|
||||||
#pragma once
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
#include <fnd/ISerialisable.h>
|
|
||||||
#include <fnd/List.h>
|
|
||||||
#include <nn/hac/ServiceAccessControlEntry.h>
|
|
||||||
|
|
||||||
namespace nn
|
|
||||||
{
|
|
||||||
namespace hac
|
|
||||||
{
|
|
||||||
class ServiceAccessControlBinary :
|
|
||||||
public fnd::ISerialisable
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
ServiceAccessControlBinary();
|
|
||||||
ServiceAccessControlBinary(const ServiceAccessControlBinary& other);
|
|
||||||
|
|
||||||
void operator=(const ServiceAccessControlBinary& other);
|
|
||||||
bool operator==(const ServiceAccessControlBinary& other) const;
|
|
||||||
bool operator!=(const ServiceAccessControlBinary& other) const;
|
|
||||||
|
|
||||||
// export/import binary
|
|
||||||
void toBytes();
|
|
||||||
void fromBytes(const byte_t* bytes, size_t len);
|
|
||||||
const fnd::Vec<byte_t>& getBytes() const;
|
|
||||||
|
|
||||||
// variables
|
|
||||||
void clear();
|
|
||||||
const fnd::List<ServiceAccessControlEntry>& getServiceList() const;
|
|
||||||
void addService(const ServiceAccessControlEntry& service);
|
|
||||||
private:
|
|
||||||
const std::string kModuleName = "SERVICE_ACCESS_CONTROL_BINARY";
|
|
||||||
|
|
||||||
// raw binary
|
|
||||||
fnd::Vec<byte_t> mRawBinary;
|
|
||||||
|
|
||||||
// variables
|
|
||||||
fnd::List<ServiceAccessControlEntry> mServices;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,51 +1,51 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <fnd/ISerialisable.h>
|
#include <fnd/IByteModel.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
{
|
{
|
||||||
namespace hac
|
namespace hac
|
||||||
{
|
{
|
||||||
class ServiceAccessControlEntry :
|
class ServiceAccessControlEntry :
|
||||||
public fnd::ISerialisable
|
public fnd::IByteModel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ServiceAccessControlEntry();
|
ServiceAccessControlEntry();
|
||||||
ServiceAccessControlEntry(const std::string& name, bool isServer);
|
ServiceAccessControlEntry(const std::string& name, bool isServer);
|
||||||
ServiceAccessControlEntry(const ServiceAccessControlEntry& other);
|
ServiceAccessControlEntry(const ServiceAccessControlEntry& other);
|
||||||
|
|
||||||
void operator=(const ServiceAccessControlEntry& other);
|
void operator=(const ServiceAccessControlEntry& other);
|
||||||
bool operator==(const ServiceAccessControlEntry& other) const;
|
bool operator==(const ServiceAccessControlEntry& other) const;
|
||||||
bool operator!=(const ServiceAccessControlEntry& other) const;
|
bool operator!=(const ServiceAccessControlEntry& other) const;
|
||||||
|
|
||||||
// export/import binary
|
// IByteModel
|
||||||
void toBytes();
|
void toBytes();
|
||||||
void fromBytes(const byte_t* bytes, size_t len);
|
void fromBytes(const byte_t* bytes, size_t len);
|
||||||
const fnd::Vec<byte_t>& getBytes() const;
|
const fnd::Vec<byte_t>& getBytes() const;
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
void clear();
|
void clear();
|
||||||
bool isServer() const;
|
bool isServer() const;
|
||||||
void setIsServer(bool isServer);
|
void setIsServer(bool isServer);
|
||||||
const std::string& getName() const;
|
const std::string& getName() const;
|
||||||
void setName(const std::string& name);
|
void setName(const std::string& name);
|
||||||
private:
|
private:
|
||||||
const std::string kModuleName = "SERVICE_ACCESS_CONTROL_ENTRY";
|
const std::string kModuleName = "SERVICE_ACCESS_CONTROL_ENTRY";
|
||||||
static const size_t kMaxServiceNameLen = 8;
|
static const size_t kMaxServiceNameLen = 8;
|
||||||
|
|
||||||
enum ServiceAccessControlEntryFlag
|
enum ServiceAccessControlEntryFlag
|
||||||
{
|
{
|
||||||
SAC_IS_SERVER = _BIT(7),
|
SAC_IS_SERVER = _BIT(7),
|
||||||
SAC_NAME_LEN_MASK = _BIT(7) - 1
|
SAC_NAME_LEN_MASK = _BIT(7) - 1
|
||||||
};
|
};
|
||||||
|
|
||||||
// raw binary
|
// raw binary
|
||||||
fnd::Vec<byte_t> mRawBinary;
|
fnd::Vec<byte_t> mRawBinary;
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
bool mIsServer;
|
bool mIsServer;
|
||||||
std::string mName;
|
std::string mName;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,56 +1,56 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <fnd/rsa.h>
|
#include <fnd/rsa.h>
|
||||||
#include <nn/hac/macro.h>
|
#include <nn/hac/define/macro.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
{
|
{
|
||||||
namespace hac
|
namespace hac
|
||||||
{
|
{
|
||||||
namespace aci
|
namespace aci
|
||||||
{
|
{
|
||||||
static const uint32_t kAciStructMagic = _MAKE_STRUCT_MAGIC_U32("ACI0");
|
static const uint32_t kAciStructMagic = _MAKE_STRUCT_MAGIC_U32("ACI0");
|
||||||
static const uint32_t kAciDescStructMagic = _MAKE_STRUCT_MAGIC_U32("ACID");
|
static const uint32_t kAciDescStructMagic = _MAKE_STRUCT_MAGIC_U32("ACID");
|
||||||
static const size_t kSectionAlignSize = 0x10;
|
static const size_t kSectionAlignSize = 0x10;
|
||||||
|
|
||||||
enum Flag
|
enum Flag
|
||||||
{
|
{
|
||||||
FLAG_PRODUCTION,
|
FLAG_PRODUCTION,
|
||||||
FLAG_UNQUALIFIED_APPROVAL
|
FLAG_UNQUALIFIED_APPROVAL
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#pragma pack(push,1)
|
#pragma pack(push,1)
|
||||||
struct sAciSection
|
struct sAciSection
|
||||||
{
|
{
|
||||||
le_uint32_t offset;
|
le_uint32_t offset;
|
||||||
le_uint32_t size;
|
le_uint32_t size;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sAciHeader
|
struct sAciHeader
|
||||||
{
|
{
|
||||||
le_uint32_t st_magic;
|
le_uint32_t st_magic;
|
||||||
byte_t reserved_00[0xC];
|
byte_t reserved_00[0xC];
|
||||||
le_uint64_t program_id;
|
le_uint64_t program_id;
|
||||||
byte_t reserved_01[0x8];
|
byte_t reserved_01[0x8];
|
||||||
sAciSection fac;
|
sAciSection fac;
|
||||||
sAciSection sac;
|
sAciSection sac;
|
||||||
sAciSection kc;
|
sAciSection kc;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sAciDescHeader
|
struct sAciDescHeader
|
||||||
{
|
{
|
||||||
byte_t signature[fnd::rsa::kRsa2048Size];
|
byte_t signature[fnd::rsa::kRsa2048Size];
|
||||||
byte_t nca_rsa_signature2_modulus[fnd::rsa::kRsa2048Size];
|
byte_t nca_rsa_signature2_modulus[fnd::rsa::kRsa2048Size];
|
||||||
le_uint32_t st_magic;
|
le_uint32_t st_magic;
|
||||||
le_uint32_t signed_size;
|
le_uint32_t signed_size;
|
||||||
byte_t reserved_00[0x4];
|
byte_t reserved_00[0x4];
|
||||||
le_uint32_t flags;
|
le_uint32_t flags;
|
||||||
le_uint64_t program_id_min;
|
le_uint64_t program_id_min;
|
||||||
le_uint64_t program_id_max;
|
le_uint64_t program_id_max;
|
||||||
sAciSection fac;
|
sAciSection fac;
|
||||||
sAciSection sac;
|
sAciSection sac;
|
||||||
sAciSection kc;
|
sAciSection kc;
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,138 +1,181 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <fnd/sha.h>
|
#include <fnd/sha.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
{
|
{
|
||||||
namespace hac
|
namespace hac
|
||||||
{
|
{
|
||||||
namespace cnmt
|
namespace cnmt
|
||||||
{
|
{
|
||||||
enum ContentType
|
enum ContentType
|
||||||
{
|
{
|
||||||
TYPE_META = 0,
|
TYPE_META = 0,
|
||||||
TYPE_PROGRAM,
|
TYPE_PROGRAM,
|
||||||
TYPE_DATA,
|
TYPE_DATA,
|
||||||
TYPE_CONTROL,
|
TYPE_CONTROL,
|
||||||
TYPE_HTML_DOCUMENT,
|
TYPE_HTML_DOCUMENT,
|
||||||
TYPE_LEGAL_INFORMATION,
|
TYPE_LEGAL_INFORMATION,
|
||||||
TYPE_DELTA_FRAGMENT
|
TYPE_DELTA_FRAGMENT
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ContentMetaType
|
enum ContentMetaType
|
||||||
{
|
{
|
||||||
METATYPE_SYSTEM_PROGRAM = 1,
|
METATYPE_SYSTEM_PROGRAM = 1,
|
||||||
METATYPE_SYSTEM_DATA,
|
METATYPE_SYSTEM_DATA,
|
||||||
METATYPE_SYSTEM_UPDATE,
|
METATYPE_SYSTEM_UPDATE,
|
||||||
METATYPE_BOOT_IMAGE_PACKAGE,
|
METATYPE_BOOT_IMAGE_PACKAGE,
|
||||||
METATYPE_BOOT_IMAGE_PACKAGE_SAFE,
|
METATYPE_BOOT_IMAGE_PACKAGE_SAFE,
|
||||||
|
|
||||||
METATYPE_APPLICATION = 0x80,
|
METATYPE_APPLICATION = 0x80,
|
||||||
METATYPE_PATCH, // can have extended data
|
METATYPE_PATCH, // can have extended data
|
||||||
METATYPE_ADD_ON_CONTENT,
|
METATYPE_ADD_ON_CONTENT,
|
||||||
METATYPE_DELTA // can have extended data
|
METATYPE_DELTA // can have extended data
|
||||||
};
|
};
|
||||||
|
|
||||||
enum UpdateType
|
enum UpdateType
|
||||||
{
|
{
|
||||||
UPDATETYPE_APPLY_AS_DELTA,
|
UPDATETYPE_APPLY_AS_DELTA,
|
||||||
UPDATETYPE_OVERWRITE,
|
UPDATETYPE_OVERWRITE,
|
||||||
UPDATETYPE_CREATE
|
UPDATETYPE_CREATE
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ContentMetaAttribute
|
enum ContentMetaAttribute
|
||||||
{
|
{
|
||||||
ATTRIBUTE_INCLUDES_EX_FAT_DRIVER,
|
ATTRIBUTE_INCLUDES_EX_FAT_DRIVER,
|
||||||
ATTRIBUTE_REBOOTLESS
|
ATTRIBUTE_REBOOTLESS
|
||||||
};
|
};
|
||||||
|
|
||||||
static const uint32_t kRequiredSystemVersion = 335544320;
|
static const size_t kContentIdLen = 0x10;
|
||||||
static const uint32_t kDefaultVersion = 335545344;
|
static const size_t kDigestLen = 0x20;
|
||||||
static const size_t kContentIdLen = 0x10;
|
|
||||||
static const size_t kDigestLen = 0x20;
|
struct sContentId
|
||||||
}
|
{
|
||||||
|
byte_t data[kContentIdLen];
|
||||||
|
|
||||||
#pragma pack(push,1)
|
void set(const byte_t content_id[kContentIdLen])
|
||||||
/*
|
{
|
||||||
struct sContentMeta
|
memcpy(this->data, content_id, kContentIdLen);
|
||||||
{
|
}
|
||||||
sContentMetaHeader hdr;
|
|
||||||
byte_t exhdr[]; // optional
|
void operator=(const sContentId& other)
|
||||||
sContentInfo info[];
|
{
|
||||||
sContentMetaInfo meta[];
|
set(other.data);
|
||||||
byte_t extdata[];
|
}
|
||||||
byte_t digest[32]
|
|
||||||
};
|
bool operator==(const sContentId& other) const
|
||||||
*/
|
{
|
||||||
|
return memcmp(this->data, other.data, kContentIdLen) == 0;
|
||||||
struct sContentMetaHeader
|
}
|
||||||
{
|
|
||||||
le_uint64_t id;
|
bool operator!=(const sContentId& other) const
|
||||||
le_uint32_t version;
|
{
|
||||||
byte_t type;
|
return !(*this == other);
|
||||||
byte_t reserved_0;
|
}
|
||||||
le_uint16_t exhdr_size;
|
};
|
||||||
le_uint16_t content_count;
|
|
||||||
le_uint16_t content_meta_count;
|
struct sDigest
|
||||||
byte_t attributes;
|
{
|
||||||
byte_t reserved_1[3];
|
byte_t data[kDigestLen];
|
||||||
le_uint32_t required_download_system_version;
|
|
||||||
byte_t reserved_2[4];
|
void set(const byte_t digest[kDigestLen])
|
||||||
};
|
{
|
||||||
|
memcpy(this->data, digest, kDigestLen);
|
||||||
struct sContentInfo
|
}
|
||||||
{
|
|
||||||
fnd::sha::sSha256Hash content_hash;
|
void operator=(const sDigest& other)
|
||||||
byte_t content_id[cnmt::kContentIdLen];
|
{
|
||||||
le_uint32_t size_lower;
|
set(other.data);
|
||||||
le_uint16_t size_higher;
|
}
|
||||||
byte_t content_type;
|
|
||||||
byte_t id_offset;
|
bool operator==(const sDigest& other) const
|
||||||
};
|
{
|
||||||
|
return memcmp(this->data, other.data, kDigestLen) == 0;
|
||||||
struct sContentMetaInfo
|
}
|
||||||
{
|
|
||||||
le_uint64_t id;
|
bool operator!=(const sDigest& other) const
|
||||||
le_uint32_t version;
|
{
|
||||||
byte_t type;
|
return !(*this == other);
|
||||||
byte_t attributes;
|
}
|
||||||
byte_t reserved[2];
|
};
|
||||||
};
|
}
|
||||||
|
|
||||||
struct sApplicationMetaExtendedHeader
|
|
||||||
{
|
#pragma pack(push,1)
|
||||||
le_uint64_t patch_id;
|
/*
|
||||||
le_uint32_t required_system_version;
|
struct sContentMeta
|
||||||
byte_t reserved[4];
|
{
|
||||||
};
|
sContentMetaHeader hdr;
|
||||||
|
byte_t exhdr[]; // optional
|
||||||
struct sPatchMetaExtendedHeader
|
sContentInfo info[];
|
||||||
{
|
sContentMetaInfo meta[];
|
||||||
le_uint64_t application_id;
|
byte_t extdata[];
|
||||||
le_uint32_t required_system_version;
|
byte_t digest[32]
|
||||||
le_uint32_t extended_data_size;
|
};
|
||||||
byte_t reserved[8];
|
*/
|
||||||
};
|
|
||||||
|
struct sContentMetaHeader
|
||||||
struct sAddOnContentMetaExtendedHeader
|
{
|
||||||
{
|
le_uint64_t id;
|
||||||
le_uint64_t application_id;
|
le_uint32_t version;
|
||||||
le_uint32_t required_application_version;
|
byte_t type;
|
||||||
byte_t reserved[4];
|
byte_t reserved_0;
|
||||||
};
|
le_uint16_t exhdr_size;
|
||||||
|
le_uint16_t content_count;
|
||||||
struct sDeltaMetaExtendedHeader
|
le_uint16_t content_meta_count;
|
||||||
{
|
byte_t attributes;
|
||||||
le_uint64_t application_id;
|
byte_t reserved_1[3];
|
||||||
le_uint32_t extended_data_size;
|
le_uint32_t required_download_system_version;
|
||||||
byte_t reserved[4];
|
byte_t reserved_2[4];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sDigest
|
struct sContentInfo
|
||||||
{
|
{
|
||||||
byte_t data[cnmt::kDigestLen];
|
fnd::sha::sSha256Hash content_hash;
|
||||||
};
|
cnmt::sContentId content_id;
|
||||||
#pragma pack(pop)
|
le_uint32_t size_lower;
|
||||||
}
|
le_uint16_t size_higher;
|
||||||
|
byte_t content_type;
|
||||||
|
byte_t id_offset;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct sContentMetaInfo
|
||||||
|
{
|
||||||
|
le_uint64_t id;
|
||||||
|
le_uint32_t version;
|
||||||
|
byte_t type;
|
||||||
|
byte_t attributes;
|
||||||
|
byte_t reserved[2];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct sApplicationMetaExtendedHeader
|
||||||
|
{
|
||||||
|
le_uint64_t patch_id;
|
||||||
|
le_uint32_t required_system_version;
|
||||||
|
byte_t reserved[4];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct sPatchMetaExtendedHeader
|
||||||
|
{
|
||||||
|
le_uint64_t application_id;
|
||||||
|
le_uint32_t required_system_version;
|
||||||
|
le_uint32_t extended_data_size;
|
||||||
|
byte_t reserved[8];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct sAddOnContentMetaExtendedHeader
|
||||||
|
{
|
||||||
|
le_uint64_t application_id;
|
||||||
|
le_uint32_t required_application_version;
|
||||||
|
byte_t reserved[4];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct sDeltaMetaExtendedHeader
|
||||||
|
{
|
||||||
|
le_uint64_t application_id;
|
||||||
|
le_uint32_t extended_data_size;
|
||||||
|
byte_t reserved[4];
|
||||||
|
};
|
||||||
|
#pragma pack(pop)
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,26 +1,26 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <nn/hac/macro.h>
|
#include <nn/hac/define/macro.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
{
|
{
|
||||||
namespace hac
|
namespace hac
|
||||||
{
|
{
|
||||||
namespace delta
|
namespace delta
|
||||||
{
|
{
|
||||||
static const uint32_t kDeltaStructMagic = _MAKE_STRUCT_MAGIC_U32("NDV0");
|
static const uint32_t kDeltaStructMagic = _MAKE_STRUCT_MAGIC_U32("NDV0");
|
||||||
}
|
}
|
||||||
#pragma pack(push,1)
|
#pragma pack(push,1)
|
||||||
struct sDeltaHeader
|
struct sDeltaHeader
|
||||||
{
|
{
|
||||||
le_uint32_t st_magic;
|
le_uint32_t st_magic;
|
||||||
byte_t reserved_00[4];
|
byte_t reserved_00[4];
|
||||||
le_uint64_t source_size;
|
le_uint64_t source_size;
|
||||||
le_uint64_t destination_size;
|
le_uint64_t destination_size;
|
||||||
le_uint64_t header_size;
|
le_uint64_t header_size;
|
||||||
le_uint64_t body_size;
|
le_uint64_t body_size;
|
||||||
byte_t reserved_01[0x18];
|
byte_t reserved_01[0x18];
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,60 +1,60 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
{
|
{
|
||||||
namespace hac
|
namespace hac
|
||||||
{
|
{
|
||||||
namespace fac
|
namespace fac
|
||||||
{
|
{
|
||||||
static const uint32_t kFacFormatVersion = 1;
|
static const uint32_t kFacFormatVersion = 1;
|
||||||
static const size_t kSectionAlignSize = 4;
|
static const size_t kSectionAlignSize = 4;
|
||||||
|
|
||||||
enum FsAccessFlag
|
enum FsAccessFlag
|
||||||
{
|
{
|
||||||
FSA_APPLICATION_INFO,
|
FSA_APPLICATION_INFO,
|
||||||
FSA_BOOT_MODE_CONTROL,
|
FSA_BOOT_MODE_CONTROL,
|
||||||
FSA_CALIBRATION,
|
FSA_CALIBRATION,
|
||||||
FSA_SYSTEM_SAVE_DATA,
|
FSA_SYSTEM_SAVE_DATA,
|
||||||
FSA_GAME_CARD,
|
FSA_GAME_CARD,
|
||||||
FSA_SAVE_DATA_BACKUP,
|
FSA_SAVE_DATA_BACKUP,
|
||||||
FSA_SAVE_DATA_MANAGEMENT,
|
FSA_SAVE_DATA_MANAGEMENT,
|
||||||
FSA_BIS_ALL_RAW,
|
FSA_BIS_ALL_RAW,
|
||||||
FSA_GAME_CARD_RAW,
|
FSA_GAME_CARD_RAW,
|
||||||
FSA_GAME_CARD_PRIVATE,
|
FSA_GAME_CARD_PRIVATE,
|
||||||
FSA_SET_TIME,
|
FSA_SET_TIME,
|
||||||
FSA_CONTENT_MANAGER,
|
FSA_CONTENT_MANAGER,
|
||||||
FSA_IMAGE_MANAGER,
|
FSA_IMAGE_MANAGER,
|
||||||
FSA_CREATE_SAVE_DATA,
|
FSA_CREATE_SAVE_DATA,
|
||||||
FSA_SYSTEM_SAVE_DATA_MANAGEMENT,
|
FSA_SYSTEM_SAVE_DATA_MANAGEMENT,
|
||||||
FSA_BIS_FILE_SYSTEM,
|
FSA_BIS_FILE_SYSTEM,
|
||||||
FSA_SYSTEM_UPDATE,
|
FSA_SYSTEM_UPDATE,
|
||||||
FSA_SAVE_DATA_META,
|
FSA_SAVE_DATA_META,
|
||||||
FSA_DEVICE_SAVE_CONTROL,
|
FSA_DEVICE_SAVE_CONTROL,
|
||||||
FSA_SETTINGS_CONTROL,
|
FSA_SETTINGS_CONTROL,
|
||||||
FSA_DEBUG = 62,
|
FSA_DEBUG = 62,
|
||||||
FSA_FULL_PERMISSION = 63,
|
FSA_FULL_PERMISSION = 63,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum SaveDataOwnerIdAccessType
|
enum SaveDataOwnerIdAccessType
|
||||||
{
|
{
|
||||||
SDO_READ = 1,
|
SDO_READ = 1,
|
||||||
SDO_WRITE,
|
SDO_WRITE,
|
||||||
SDO_READWRITE
|
SDO_READWRITE
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma pack(push,1)
|
#pragma pack(push,1)
|
||||||
struct sFacHeader
|
struct sFacHeader
|
||||||
{
|
{
|
||||||
le_uint32_t version; // default 1
|
le_uint32_t version; // default 1
|
||||||
le_uint64_t fac_flags;
|
le_uint64_t fac_flags;
|
||||||
struct sFacSection
|
struct sFacSection
|
||||||
{
|
{
|
||||||
le_uint32_t offset;
|
le_uint32_t offset;
|
||||||
le_uint32_t size;
|
le_uint32_t size;
|
||||||
} content_owner_ids, save_data_owner_ids; // the data for these follow later in binary. start/end relative to base of FacData instance
|
} content_owner_ids, save_data_owner_ids; // the data for these follow later in binary. start/end relative to base of FacData instance
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,133 +1,133 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <fnd/List.h>
|
#include <fnd/List.h>
|
||||||
#include <fnd/aes.h>
|
#include <fnd/aes.h>
|
||||||
#include <fnd/sha.h>
|
#include <fnd/sha.h>
|
||||||
#include <fnd/rsa.h>
|
#include <fnd/rsa.h>
|
||||||
#include <nn/hac/macro.h>
|
#include <nn/hac/define/macro.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
{
|
{
|
||||||
namespace hac
|
namespace hac
|
||||||
{
|
{
|
||||||
namespace xci
|
namespace gc
|
||||||
{
|
{
|
||||||
static const uint32_t kXciStructMagic = _MAKE_STRUCT_MAGIC_U32("HEAD");
|
static const uint32_t kGcHeaderStructMagic = _MAKE_STRUCT_MAGIC_U32("HEAD");
|
||||||
static const uint32_t kHeaderEncOffset = 0x90;
|
static const uint32_t kHeaderEncOffset = 0x90;
|
||||||
static const uint32_t kHeaderEncSize = 0x70;
|
static const uint32_t kHeaderEncSize = 0x70;
|
||||||
static const uint32_t kPageSize = 0x200;
|
static const uint32_t kPageSize = 0x200;
|
||||||
static const uint32_t kUppHashLen = 8;
|
static const uint32_t kUppHashLen = 8;
|
||||||
/*
|
/*
|
||||||
static const uint32_t kCardKeyAreaPageCount = 8;
|
static const uint32_t kCardKeyAreaPageCount = 8;
|
||||||
static const uint32_t kCardHeaderPageCount = 1;
|
static const uint32_t kCardHeaderPageCount = 1;
|
||||||
static const uint32_t kReservedAreaPageCount = 55;
|
static const uint32_t kReservedAreaPageCount = 55;
|
||||||
static const uint32_t kCertAreaStartPageAddress = kCardHeaderPageCount + kReservedAreaPageCount + kCardKeyAreaPageCount;
|
static const uint32_t kCertAreaStartPageAddress = kCardHeaderPageCount + kReservedAreaPageCount + kCardKeyAreaPageCount;
|
||||||
static const uint32_t kCertAreaPageCount = 64;
|
static const uint32_t kCertAreaPageCount = 64;
|
||||||
static const uint32_t kNormalAreaStartPageAddress = kReservedAreaPageCount + kCertAreaPageCount + kCardHeaderPageCount + kCardKeyAreaPageCount;
|
static const uint32_t kNormalAreaStartPageAddress = kReservedAreaPageCount + kCertAreaPageCount + kCardHeaderPageCount + kCardKeyAreaPageCount;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const std::string kUpdatePartitionStr = "update";
|
const std::string kUpdatePartitionStr = "update";
|
||||||
const std::string kLogoPartitionStr = "logo";
|
const std::string kLogoPartitionStr = "logo";
|
||||||
const std::string kNormalPartitionStr = "normal";
|
const std::string kNormalPartitionStr = "normal";
|
||||||
const std::string kSecurePartitionStr = "secure";
|
const std::string kSecurePartitionStr = "secure";
|
||||||
|
|
||||||
enum KekIndex
|
enum KekIndex
|
||||||
{
|
{
|
||||||
KEK_XCIE,
|
KEK_XCIE,
|
||||||
KEK_XCIR
|
KEK_XCIR
|
||||||
};
|
};
|
||||||
|
|
||||||
enum RomSize
|
enum RomSize
|
||||||
{
|
{
|
||||||
ROM_SIZE_1GB = 0xFA,
|
ROM_SIZE_1GB = 0xFA,
|
||||||
ROM_SIZE_2GB = 0xF8,
|
ROM_SIZE_2GB = 0xF8,
|
||||||
ROM_SIZE_4GB = 0xF0,
|
ROM_SIZE_4GB = 0xF0,
|
||||||
ROM_SIZE_8GB = 0xE0,
|
ROM_SIZE_8GB = 0xE0,
|
||||||
ROM_SIZE_16GB = 0xE1,
|
ROM_SIZE_16GB = 0xE1,
|
||||||
ROM_SIZE_32GB = 0xE2
|
ROM_SIZE_32GB = 0xE2
|
||||||
};
|
};
|
||||||
|
|
||||||
enum HeaderFlags
|
enum HeaderFlags
|
||||||
{
|
{
|
||||||
FLAG_AUTOBOOT,
|
FLAG_AUTOBOOT,
|
||||||
FLAG_HISTORY_ERASE,
|
FLAG_HISTORY_ERASE,
|
||||||
FLAG_REPAIR_TOOL
|
FLAG_REPAIR_TOOL
|
||||||
};
|
};
|
||||||
|
|
||||||
enum FwVersionIndex
|
enum FwVersionIndex
|
||||||
{
|
{
|
||||||
FWVER_MINOR,
|
FWVER_MINOR,
|
||||||
FWVER_MAJOR
|
FWVER_MAJOR
|
||||||
};
|
};
|
||||||
|
|
||||||
enum CardClockRate
|
enum CardClockRate
|
||||||
{
|
{
|
||||||
CLOCK_RATE_25 = 10551312,
|
CLOCK_RATE_25 = 10551312,
|
||||||
CLOCK_RATE_50 = 10551313,
|
CLOCK_RATE_50 = 10551313,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma pack(push,1)
|
#pragma pack(push,1)
|
||||||
struct sXciHeader
|
struct sGcHeader
|
||||||
{
|
{
|
||||||
le_uint32_t st_magic;
|
le_uint32_t st_magic;
|
||||||
le_uint32_t rom_area_start_page;
|
le_uint32_t rom_area_start_page;
|
||||||
le_uint32_t backup_area_start_page;
|
le_uint32_t backup_area_start_page;
|
||||||
byte_t key_flag;
|
byte_t key_flag;
|
||||||
byte_t rom_size;
|
byte_t rom_size;
|
||||||
byte_t card_header_version;
|
byte_t card_header_version;
|
||||||
byte_t flags;
|
byte_t flags;
|
||||||
le_uint64_t package_id;
|
le_uint64_t package_id;
|
||||||
le_uint32_t valid_data_end_page;
|
le_uint32_t valid_data_end_page;
|
||||||
byte_t reserved_00[4];
|
byte_t reserved_00[4];
|
||||||
fnd::aes::sAesIvCtr aescbc_iv;
|
fnd::aes::sAesIvCtr aescbc_iv;
|
||||||
le_uint64_t partition_fs_header_address;
|
le_uint64_t partition_fs_header_address;
|
||||||
le_uint64_t partition_fs_header_size;
|
le_uint64_t partition_fs_header_size;
|
||||||
fnd::sha::sSha256Hash partition_fs_header_hash;
|
fnd::sha::sSha256Hash partition_fs_header_hash;
|
||||||
fnd::sha::sSha256Hash initial_data_hash;
|
fnd::sha::sSha256Hash initial_data_hash;
|
||||||
le_uint32_t sel_sec;
|
le_uint32_t sel_sec;
|
||||||
le_uint32_t sel_t1_key;
|
le_uint32_t sel_t1_key;
|
||||||
le_uint32_t sel_key;
|
le_uint32_t sel_key;
|
||||||
le_uint32_t lim_area;
|
le_uint32_t lim_area;
|
||||||
// START ENCRYPTION
|
// START ENCRYPTION
|
||||||
le_uint32_t fw_version[2];
|
le_uint32_t fw_version[2];
|
||||||
le_uint32_t acc_ctrl_1;
|
le_uint32_t acc_ctrl_1;
|
||||||
le_uint32_t wait_1_time_read;
|
le_uint32_t wait_1_time_read;
|
||||||
le_uint32_t wait_2_time_read;
|
le_uint32_t wait_2_time_read;
|
||||||
le_uint32_t wait_1_time_write;
|
le_uint32_t wait_1_time_write;
|
||||||
le_uint32_t wait_2_time_write;
|
le_uint32_t wait_2_time_write;
|
||||||
le_uint32_t fw_mode;
|
le_uint32_t fw_mode;
|
||||||
le_uint32_t upp_version;
|
le_uint32_t upp_version;
|
||||||
byte_t reserved_01[0x4];
|
byte_t reserved_01[0x4];
|
||||||
byte_t upp_hash[xci::kUppHashLen];
|
byte_t upp_hash[gc::kUppHashLen];
|
||||||
le_uint64_t upp_id;
|
le_uint64_t upp_id;
|
||||||
byte_t reserved_02[0x38];
|
byte_t reserved_02[0x38];
|
||||||
// END ENCRYPTION
|
// END ENCRYPTION
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sXciHeaderPage
|
struct sGcHeaderPage
|
||||||
{
|
{
|
||||||
byte_t signature[fnd::rsa::kRsa2048Size];
|
byte_t signature[fnd::rsa::kRsa2048Size];
|
||||||
sXciHeader header;
|
sGcHeader header;
|
||||||
}; // sizeof() = 512 (1 page)
|
}; // sizeof() = 512 (1 page)
|
||||||
|
|
||||||
struct sInitialData
|
struct sInitialData
|
||||||
{
|
{
|
||||||
byte_t key_source[16]; // { package_id[8], zeros[8]}
|
byte_t key_source[16]; // { package_id[8], zeros[8]}
|
||||||
byte_t title_key_enc[16];
|
byte_t title_key_enc[16];
|
||||||
byte_t ccm_mac[16];
|
byte_t ccm_mac[16];
|
||||||
byte_t ccm_nonce[12];
|
byte_t ccm_nonce[12];
|
||||||
byte_t reserved[0x1c4];
|
byte_t reserved[0x1c4];
|
||||||
}; // sizeof() = 512 (1 page)
|
}; // sizeof() = 512 (1 page)
|
||||||
|
|
||||||
struct sKeyDataArea
|
struct sKeyDataArea
|
||||||
{
|
{
|
||||||
sInitialData initial_data; // AES128-CCM encrypted {titlekey[16]}
|
sInitialData initial_data; // AES128-CCM encrypted {titlekey[16]}
|
||||||
byte_t encrypted_00[xci::kPageSize * 6]; // AES128-CTR encrypted {titlekey[16]}
|
byte_t encrypted_00[gc::kPageSize * 6]; // AES128-CTR encrypted {titlekey[16]}
|
||||||
byte_t encrypted_00_aesctr_data[fnd::rsa::kRsa2048Size]; // RSA2048-OAEP-SHA256 encrypted AES-CTR data used for encrypted_00 {key[16],iv[16]}
|
byte_t encrypted_00_aesctr_data[fnd::rsa::kRsa2048Size]; // RSA2048-OAEP-SHA256 encrypted AES-CTR data used for encrypted_00 {key[16],iv[16]}
|
||||||
byte_t reserved[xci::kPageSize - fnd::rsa::kRsa2048Size];
|
byte_t reserved[gc::kPageSize - fnd::rsa::kRsa2048Size];
|
||||||
}; // sizeof() = 512*8 (8 pages)
|
}; // sizeof() = 512*8 (8 pages)
|
||||||
|
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,35 +1,35 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <nn/hac/macro.h>
|
#include <nn/hac/define/macro.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
{
|
{
|
||||||
namespace hac
|
namespace hac
|
||||||
{
|
{
|
||||||
namespace hierarchicalintegrity
|
namespace hierarchicalintegrity
|
||||||
{
|
{
|
||||||
static const uint32_t kStructMagic = _MAKE_STRUCT_MAGIC_U32("IVFC");
|
static const uint32_t kStructMagic = _MAKE_STRUCT_MAGIC_U32("IVFC");
|
||||||
static const uint32_t kRomfsTypeId = 0x20000;
|
static const uint32_t kRomfsTypeId = 0x20000;
|
||||||
static const size_t kDefaultLayerNum = 6;
|
static const size_t kDefaultLayerNum = 6;
|
||||||
static const size_t kHeaderAlignLen = 0x20;
|
static const size_t kHeaderAlignLen = 0x20;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma pack(push,1)
|
#pragma pack(push,1)
|
||||||
struct sHierarchicalIntegrityHeader
|
struct sHierarchicalIntegrityHeader
|
||||||
{
|
{
|
||||||
le_uint32_t st_magic;
|
le_uint32_t st_magic;
|
||||||
le_uint32_t type_id;
|
le_uint32_t type_id;
|
||||||
le_uint32_t master_hash_size;
|
le_uint32_t master_hash_size;
|
||||||
le_uint32_t layer_num;
|
le_uint32_t layer_num;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sHierarchicalIntegrityLayerInfo // sizeof(0x18)
|
struct sHierarchicalIntegrityLayerInfo // sizeof(0x18)
|
||||||
{
|
{
|
||||||
le_uint64_t offset;
|
le_uint64_t offset;
|
||||||
le_uint64_t size;
|
le_uint64_t size;
|
||||||
le_uint32_t block_size;
|
le_uint32_t block_size;
|
||||||
byte_t reserved[4];
|
byte_t reserved[4];
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,29 +1,29 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <fnd/sha.h>
|
#include <fnd/sha.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
{
|
{
|
||||||
namespace hac
|
namespace hac
|
||||||
{
|
{
|
||||||
namespace hierarchicalsha256
|
namespace hierarchicalsha256
|
||||||
{
|
{
|
||||||
static const size_t kDefaultLayerNum = 2;
|
static const size_t kDefaultLayerNum = 2;
|
||||||
static const size_t kMaxLayerNum = 2;
|
static const size_t kMaxLayerNum = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma pack(push,1)
|
#pragma pack(push,1)
|
||||||
struct sHierarchicalSha256Header
|
struct sHierarchicalSha256Header
|
||||||
{
|
{
|
||||||
fnd::sha::sSha256Hash master_hash;
|
fnd::sha::sSha256Hash master_hash;
|
||||||
le_uint32_t hash_block_size;
|
le_uint32_t hash_block_size;
|
||||||
le_uint32_t layer_num;
|
le_uint32_t layer_num;
|
||||||
struct sLayer
|
struct sLayer
|
||||||
{
|
{
|
||||||
le_uint64_t offset;
|
le_uint64_t offset;
|
||||||
le_uint64_t size;
|
le_uint64_t size;
|
||||||
} layer[hierarchicalsha256::kMaxLayerNum];
|
} layer[hierarchicalsha256::kMaxLayerNum];
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,27 +1,27 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <fnd/rsa.h>
|
#include <fnd/rsa.h>
|
||||||
#include <nn/hac/macro.h>
|
#include <nn/hac/define/macro.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
{
|
{
|
||||||
namespace hac
|
namespace hac
|
||||||
{
|
{
|
||||||
namespace kc
|
namespace kc
|
||||||
{
|
{
|
||||||
enum KernelCapId
|
enum KernelCapId
|
||||||
{
|
{
|
||||||
KC_INVALID = 0,
|
KC_INVALID = 0,
|
||||||
KC_THREAD_INFO = 3,
|
KC_THREAD_INFO = 3,
|
||||||
KC_ENABLE_SYSTEM_CALLS = 4,
|
KC_ENABLE_SYSTEM_CALLS = 4,
|
||||||
KC_MEMORY_MAP = 6,
|
KC_MEMORY_MAP = 6,
|
||||||
KC_IO_MEMORY_MAP = 7,
|
KC_IO_MEMORY_MAP = 7,
|
||||||
KC_ENABLE_INTERUPTS = 11,
|
KC_ENABLE_INTERUPTS = 11,
|
||||||
KC_MISC_PARAMS = 13,
|
KC_MISC_PARAMS = 13,
|
||||||
KC_KERNEL_VERSION = 14,
|
KC_KERNEL_VERSION = 14,
|
||||||
KC_HANDLE_TABLE_SIZE = 15,
|
KC_HANDLE_TABLE_SIZE = 15,
|
||||||
KC_MISC_FLAGS = 16
|
KC_MISC_FLAGS = 16
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
#define _MAKE_STRUCT_MAGIC_U32(x) ((uint32_t)(x[3]) << 24 | (uint32_t)(x[2]) << 16 | (uint32_t)(x[1]) << 8 | (uint32_t)(x[0]))
|
#define _MAKE_STRUCT_MAGIC_U32(x) ((uint32_t)(x[3]) << 24 | (uint32_t)(x[2]) << 16 | (uint32_t)(x[1]) << 8 | (uint32_t)(x[0]))
|
||||||
#define _MAKE_STRUCT_MAGIC_U64(x) ((uint64_t)(x[7]) << 56 | (uint64_t)(x[6]) << 48 | (uint64_t)(x[5]) << 40 | (uint64_t)(x[4]) << 32 | (uint64_t)(x[3]) << 24 | (uint64_t)(x[2]) << 16 | (uint64_t)(x[1]) << 8 | (uint64_t)(x[0]))
|
#define _MAKE_STRUCT_MAGIC_U64(x) ((uint64_t)(x[7]) << 56 | (uint64_t)(x[6]) << 48 | (uint64_t)(x[5]) << 40 | (uint64_t)(x[4]) << 32 | (uint64_t)(x[3]) << 24 | (uint64_t)(x[2]) << 16 | (uint64_t)(x[1]) << 8 | (uint64_t)(x[0]))
|
|
@ -1,58 +1,58 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <nn/hac/macro.h>
|
#include <nn/hac/define/macro.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
{
|
{
|
||||||
namespace hac
|
namespace hac
|
||||||
{
|
{
|
||||||
namespace meta
|
namespace meta
|
||||||
{
|
{
|
||||||
static const uint32_t kMetaStructMagic = _MAKE_STRUCT_MAGIC_U32("META");
|
static const uint32_t kMetaStructMagic = _MAKE_STRUCT_MAGIC_U32("META");
|
||||||
static const size_t kNameMaxLen = 0x10;
|
static const size_t kNameMaxLen = 0x10;
|
||||||
static const size_t kProductCodeMaxLen = 0x10;
|
static const size_t kProductCodeMaxLen = 0x10;
|
||||||
static const uint32_t kMaxPriority = BIT(6) - 1;
|
static const uint32_t kMaxPriority = BIT(6) - 1;
|
||||||
static const size_t kSectionAlignSize = 0x10;
|
static const size_t kSectionAlignSize = 0x10;
|
||||||
static const uint32_t kDefaultMainThreadStackSize = 4096;
|
static const uint32_t kDefaultMainThreadStackSize = 4096;
|
||||||
|
|
||||||
enum InstructionType
|
enum InstructionType
|
||||||
{
|
{
|
||||||
INSTR_32BIT,
|
INSTR_32BIT,
|
||||||
INSTR_64BIT,
|
INSTR_64BIT,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ProcAddrSpaceType
|
enum ProcAddrSpaceType
|
||||||
{
|
{
|
||||||
ADDR_SPACE_64BIT = 1,
|
ADDR_SPACE_64BIT = 1,
|
||||||
ADDR_SPACE_32BIT,
|
ADDR_SPACE_32BIT,
|
||||||
ADDR_SPACE_32BIT_NO_RESERVED,
|
ADDR_SPACE_32BIT_NO_RESERVED,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#pragma pack(push,1)
|
#pragma pack(push,1)
|
||||||
struct sMetaSection
|
struct sMetaSection
|
||||||
{
|
{
|
||||||
le_uint32_t offset;
|
le_uint32_t offset;
|
||||||
le_uint32_t size;
|
le_uint32_t size;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sMetaHeader
|
struct sMetaHeader
|
||||||
{
|
{
|
||||||
le_uint32_t st_magic;
|
le_uint32_t st_magic;
|
||||||
byte_t reserved_0[8];
|
byte_t reserved_0[8];
|
||||||
byte_t flags;
|
byte_t flags;
|
||||||
byte_t reserved_1;
|
byte_t reserved_1;
|
||||||
byte_t main_thread_priority;
|
byte_t main_thread_priority;
|
||||||
byte_t main_thread_cpu_id;
|
byte_t main_thread_cpu_id;
|
||||||
byte_t reserved_2[8];
|
byte_t reserved_2[8];
|
||||||
le_uint32_t version;
|
le_uint32_t version;
|
||||||
le_uint32_t main_thread_stack_size;
|
le_uint32_t main_thread_stack_size;
|
||||||
char name[meta::kNameMaxLen]; // important
|
char name[meta::kNameMaxLen]; // important
|
||||||
char product_code[meta::kProductCodeMaxLen]; // can be empty
|
char product_code[meta::kProductCodeMaxLen]; // can be empty
|
||||||
byte_t reserved_3[48];
|
byte_t reserved_3[48];
|
||||||
sMetaSection aci;
|
sMetaSection aci;
|
||||||
sMetaSection acid;
|
sMetaSection acid;
|
||||||
};
|
};
|
||||||
|
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,223 +1,223 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
{
|
{
|
||||||
namespace hac
|
namespace hac
|
||||||
{
|
{
|
||||||
namespace nacp
|
namespace nacp
|
||||||
{
|
{
|
||||||
static const size_t kNameLength = 0x200;
|
static const size_t kNameLength = 0x200;
|
||||||
static const size_t kPublisherLength = 0x100;
|
static const size_t kPublisherLength = 0x100;
|
||||||
static const size_t kMaxLanguageCount = 16;
|
static const size_t kMaxLanguageCount = 16;
|
||||||
static const size_t kIsbnLength = 37;
|
static const size_t kIsbnLength = 37;
|
||||||
static const size_t kRatingAgeCount = 32;
|
static const size_t kRatingAgeCount = 32;
|
||||||
static const size_t kDisplayVersionLength = 16;
|
static const size_t kDisplayVersionLength = 16;
|
||||||
static const size_t kApplicationErrorCodeCategoryLength = 8;
|
static const size_t kApplicationErrorCodeCategoryLength = 8;
|
||||||
static const size_t kLocalCommunicationIdCount = 8;
|
static const size_t kLocalCommunicationIdCount = 8;
|
||||||
static const size_t kBcatPassphraseLength = 65;
|
static const size_t kBcatPassphraseLength = 65;
|
||||||
static const size_t kPlayLogQueryableApplicationIdCount = 16;
|
static const size_t kPlayLogQueryableApplicationIdCount = 16;
|
||||||
static const int8_t kUnusedAgeRating = -1;
|
static const int8_t kUnusedAgeRating = -1;
|
||||||
|
|
||||||
enum AocRegistrationType
|
enum AocRegistrationType
|
||||||
{
|
{
|
||||||
AOC_AllOnLaunch,
|
AOC_AllOnLaunch,
|
||||||
AOC_OnDemand
|
AOC_OnDemand
|
||||||
};
|
};
|
||||||
|
|
||||||
enum AttributeFlag
|
enum AttributeFlag
|
||||||
{
|
{
|
||||||
ATTR_None,
|
ATTR_None,
|
||||||
ATTR_Demo,
|
ATTR_Demo,
|
||||||
ATTR_RetailInteractiveDisplay
|
ATTR_RetailInteractiveDisplay
|
||||||
};
|
};
|
||||||
|
|
||||||
enum CrashReportMode
|
enum CrashReportMode
|
||||||
{
|
{
|
||||||
CREP_Deny,
|
CREP_Deny,
|
||||||
CREP_Allow
|
CREP_Allow
|
||||||
};
|
};
|
||||||
|
|
||||||
enum DataLossConfirmation
|
enum DataLossConfirmation
|
||||||
{
|
{
|
||||||
DLOSS_None,
|
DLOSS_None,
|
||||||
DLOSS_Required
|
DLOSS_Required
|
||||||
};
|
};
|
||||||
|
|
||||||
enum Hdcp
|
enum Hdcp
|
||||||
{
|
{
|
||||||
HDCP_None,
|
HDCP_None,
|
||||||
HDCP_Required
|
HDCP_Required
|
||||||
};
|
};
|
||||||
|
|
||||||
enum Language
|
enum Language
|
||||||
{
|
{
|
||||||
LANG_AmericanEnglish,
|
LANG_AmericanEnglish,
|
||||||
LANG_BritishEnglish,
|
LANG_BritishEnglish,
|
||||||
LANG_Japanese,
|
LANG_Japanese,
|
||||||
LANG_French,
|
LANG_French,
|
||||||
LANG_German,
|
LANG_German,
|
||||||
LANG_LatinAmericanSpanish,
|
LANG_LatinAmericanSpanish,
|
||||||
LANG_Spanish,
|
LANG_Spanish,
|
||||||
LANG_Italian,
|
LANG_Italian,
|
||||||
LANG_Dutch,
|
LANG_Dutch,
|
||||||
LANG_CanadianFrench,
|
LANG_CanadianFrench,
|
||||||
LANG_Portuguese,
|
LANG_Portuguese,
|
||||||
LANG_Russian,
|
LANG_Russian,
|
||||||
LANG_Korean,
|
LANG_Korean,
|
||||||
LANG_TraditionalChinese,
|
LANG_TraditionalChinese,
|
||||||
LANG_SimplifiedChinese
|
LANG_SimplifiedChinese
|
||||||
};
|
};
|
||||||
|
|
||||||
enum LogoHandling
|
enum LogoHandling
|
||||||
{
|
{
|
||||||
LHND_Auto,
|
LHND_Auto,
|
||||||
LHND_None
|
LHND_None
|
||||||
};
|
};
|
||||||
|
|
||||||
enum LogoType
|
enum LogoType
|
||||||
{
|
{
|
||||||
LOGO_LicensedByNintendo,
|
LOGO_LicensedByNintendo,
|
||||||
LOGO_DistributedByNintendo,
|
LOGO_DistributedByNintendo,
|
||||||
LOGO_Nintendo
|
LOGO_Nintendo
|
||||||
};
|
};
|
||||||
|
|
||||||
enum Organisation
|
enum Organisation
|
||||||
{
|
{
|
||||||
ORGN_CERO,
|
ORGN_CERO,
|
||||||
ORGN_GRACGCRB,
|
ORGN_GRACGCRB,
|
||||||
ORGN_GSRMR,
|
ORGN_GSRMR,
|
||||||
ORGN_ESRB,
|
ORGN_ESRB,
|
||||||
ORGN_ClassInd,
|
ORGN_ClassInd,
|
||||||
ORGN_USK,
|
ORGN_USK,
|
||||||
ORGN_PEGI,
|
ORGN_PEGI,
|
||||||
ORGN_PEGIPortugal,
|
ORGN_PEGIPortugal,
|
||||||
ORGN_PEGIBBFC,
|
ORGN_PEGIBBFC,
|
||||||
ORGN_Russian,
|
ORGN_Russian,
|
||||||
ORGN_ACB,
|
ORGN_ACB,
|
||||||
ORGN_OFLC
|
ORGN_OFLC
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ParentalControlFlag
|
enum ParentalControlFlag
|
||||||
{
|
{
|
||||||
PC_None,
|
PC_None,
|
||||||
PC_FreeCommunication
|
PC_FreeCommunication
|
||||||
};
|
};
|
||||||
|
|
||||||
enum PlayLogPolicy
|
enum PlayLogPolicy
|
||||||
{
|
{
|
||||||
PLP_All,
|
PLP_All,
|
||||||
PLP_LogOnly,
|
PLP_LogOnly,
|
||||||
PLP_None
|
PLP_None
|
||||||
};
|
};
|
||||||
|
|
||||||
enum PlayLogQueryCapability
|
enum PlayLogQueryCapability
|
||||||
{
|
{
|
||||||
PLQC_None,
|
PLQC_None,
|
||||||
PLQC_Whitelist,
|
PLQC_Whitelist,
|
||||||
PLQC_All
|
PLQC_All
|
||||||
};
|
};
|
||||||
|
|
||||||
enum RepairFlag
|
enum RepairFlag
|
||||||
{
|
{
|
||||||
REPF_None,
|
REPF_None,
|
||||||
REPF_SuppressGameCardAccess
|
REPF_SuppressGameCardAccess
|
||||||
};
|
};
|
||||||
|
|
||||||
enum RuntimeAocInstallMode
|
enum RuntimeAocInstallMode
|
||||||
{
|
{
|
||||||
RTAOC_Deny,
|
RTAOC_Deny,
|
||||||
RTAOC_AllowAppend
|
RTAOC_AllowAppend
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ScreenshotMode
|
enum ScreenshotMode
|
||||||
{
|
{
|
||||||
SCRN_Allow,
|
SCRN_Allow,
|
||||||
SCRN_Deny
|
SCRN_Deny
|
||||||
};
|
};
|
||||||
|
|
||||||
enum StartupUserAccount
|
enum StartupUserAccount
|
||||||
{
|
{
|
||||||
USER_None,
|
USER_None,
|
||||||
USER_Required,
|
USER_Required,
|
||||||
USER_RequiredWithNetworkServiceAccountAvailable
|
USER_RequiredWithNetworkServiceAccountAvailable
|
||||||
};
|
};
|
||||||
|
|
||||||
enum TouchScreenUsageMode
|
enum TouchScreenUsageMode
|
||||||
{
|
{
|
||||||
TOUCH_None,
|
TOUCH_None,
|
||||||
TOUCH_Supported,
|
TOUCH_Supported,
|
||||||
TOUCH_Required,
|
TOUCH_Required,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum VideoCaptureMode
|
enum VideoCaptureMode
|
||||||
{
|
{
|
||||||
VCAP_Disable,
|
VCAP_Disable,
|
||||||
VCAP_Manual,
|
VCAP_Manual,
|
||||||
VCAP_Enable
|
VCAP_Enable
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#pragma pack(push,1)
|
#pragma pack(push,1)
|
||||||
struct sApplicationTitle
|
struct sApplicationTitle
|
||||||
{
|
{
|
||||||
char name[nacp::kNameLength];
|
char name[nacp::kNameLength];
|
||||||
char publisher[nacp::kPublisherLength];
|
char publisher[nacp::kPublisherLength];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sApplicationControlProperty
|
struct sApplicationControlProperty
|
||||||
{
|
{
|
||||||
sApplicationTitle title[nacp::kMaxLanguageCount];
|
sApplicationTitle title[nacp::kMaxLanguageCount];
|
||||||
char isbn[nacp::kIsbnLength];
|
char isbn[nacp::kIsbnLength];
|
||||||
byte_t startup_user_account;
|
byte_t startup_user_account;
|
||||||
byte_t touch_screen_usage;
|
byte_t touch_screen_usage;
|
||||||
byte_t add_on_content_registration_type;
|
byte_t add_on_content_registration_type;
|
||||||
le_uint32_t attribute_flag;
|
le_uint32_t attribute_flag;
|
||||||
le_uint32_t supported_language_flag;
|
le_uint32_t supported_language_flag;
|
||||||
le_uint32_t parental_control_flag;
|
le_uint32_t parental_control_flag;
|
||||||
byte_t screenshot;
|
byte_t screenshot;
|
||||||
byte_t video_capture;
|
byte_t video_capture;
|
||||||
byte_t data_loss_confirmation;
|
byte_t data_loss_confirmation;
|
||||||
byte_t play_log_policy;
|
byte_t play_log_policy;
|
||||||
le_uint64_t presence_group_id;
|
le_uint64_t presence_group_id;
|
||||||
int8_t rating_age[nacp::kRatingAgeCount];
|
int8_t rating_age[nacp::kRatingAgeCount];
|
||||||
char display_version[nacp::kDisplayVersionLength];
|
char display_version[nacp::kDisplayVersionLength];
|
||||||
le_uint64_t add_on_content_base_id;
|
le_uint64_t add_on_content_base_id;
|
||||||
le_uint64_t save_data_owner_id;
|
le_uint64_t save_data_owner_id;
|
||||||
le_uint64_t user_account_save_data_size;
|
le_uint64_t user_account_save_data_size;
|
||||||
le_uint64_t user_account_save_data_journal_size;
|
le_uint64_t user_account_save_data_journal_size;
|
||||||
le_uint64_t device_save_data_size;
|
le_uint64_t device_save_data_size;
|
||||||
le_uint64_t device_save_data_journal_size;
|
le_uint64_t device_save_data_journal_size;
|
||||||
le_uint64_t bcat_delivery_cache_storage_size;
|
le_uint64_t bcat_delivery_cache_storage_size;
|
||||||
char application_error_code_category[nacp::kApplicationErrorCodeCategoryLength];
|
char application_error_code_category[nacp::kApplicationErrorCodeCategoryLength];
|
||||||
le_uint64_t local_communication_id[nacp::kLocalCommunicationIdCount];
|
le_uint64_t local_communication_id[nacp::kLocalCommunicationIdCount];
|
||||||
byte_t logo_type;
|
byte_t logo_type;
|
||||||
byte_t logo_handling;
|
byte_t logo_handling;
|
||||||
byte_t runtime_add_on_content_install;
|
byte_t runtime_add_on_content_install;
|
||||||
byte_t reserved_00[3];
|
byte_t reserved_00[3];
|
||||||
byte_t crash_report;
|
byte_t crash_report;
|
||||||
byte_t hdcp;
|
byte_t hdcp;
|
||||||
le_uint64_t seed_for_pseudo_device_id;
|
le_uint64_t seed_for_pseudo_device_id;
|
||||||
char bcat_passphrase[nacp::kBcatPassphraseLength];
|
char bcat_passphrase[nacp::kBcatPassphraseLength];
|
||||||
byte_t reserved_01;
|
byte_t reserved_01;
|
||||||
byte_t reserved_02[6]; //reserved_for_user_account_save_data_operation
|
byte_t reserved_02[6]; //reserved_for_user_account_save_data_operation
|
||||||
le_uint64_t user_account_save_data_size_max;
|
le_uint64_t user_account_save_data_size_max;
|
||||||
le_uint64_t user_account_save_data_journal_size_max;
|
le_uint64_t user_account_save_data_journal_size_max;
|
||||||
le_uint64_t device_save_data_size_max;
|
le_uint64_t device_save_data_size_max;
|
||||||
le_uint64_t device_save_data_journal_size_max;
|
le_uint64_t device_save_data_journal_size_max;
|
||||||
le_uint64_t temporary_storage_size;
|
le_uint64_t temporary_storage_size;
|
||||||
le_uint64_t cache_storage_size;
|
le_uint64_t cache_storage_size;
|
||||||
le_uint64_t cache_storage_journal_size;
|
le_uint64_t cache_storage_journal_size;
|
||||||
le_uint64_t cache_storage_data_and_journal_size_max;
|
le_uint64_t cache_storage_data_and_journal_size_max;
|
||||||
le_uint16_t cache_storage_index_max;
|
le_uint16_t cache_storage_index_max;
|
||||||
byte_t reserved_03[6];
|
byte_t reserved_03[6];
|
||||||
le_uint64_t play_log_queryable_application_id[nacp::kPlayLogQueryableApplicationIdCount];
|
le_uint64_t play_log_queryable_application_id[nacp::kPlayLogQueryableApplicationIdCount];
|
||||||
byte_t play_log_query_capability;
|
byte_t play_log_query_capability;
|
||||||
byte_t repair_flag;
|
byte_t repair_flag;
|
||||||
byte_t program_index;
|
byte_t program_index;
|
||||||
byte_t reserved_04[0xDED];
|
byte_t reserved_04[0xDED];
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,137 +1,144 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <fnd/aes.h>
|
#include <fnd/aes.h>
|
||||||
#include <fnd/sha.h>
|
#include <fnd/sha.h>
|
||||||
#include <fnd/rsa.h>
|
#include <fnd/rsa.h>
|
||||||
#include <nn/hac/macro.h>
|
#include <nn/hac/define/macro.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
{
|
{
|
||||||
namespace hac
|
namespace hac
|
||||||
{
|
{
|
||||||
namespace nca
|
namespace nca
|
||||||
{
|
{
|
||||||
static const uint32_t kNca2StructMagic = _MAKE_STRUCT_MAGIC_U32("NCA2");
|
static const uint32_t kNca2StructMagic = _MAKE_STRUCT_MAGIC_U32("NCA2");
|
||||||
static const uint32_t kNca3StructMagic = _MAKE_STRUCT_MAGIC_U32("NCA3");
|
static const uint32_t kNca3StructMagic = _MAKE_STRUCT_MAGIC_U32("NCA3");
|
||||||
static const size_t kSectorSize = 0x200;
|
static const size_t kSectorSize = 0x200;
|
||||||
static const size_t kPartitionNum = 4;
|
static const size_t kPartitionNum = 4;
|
||||||
static const size_t kHeaderSectorNum = 6;
|
static const size_t kHeaderSectorNum = 6;
|
||||||
static const size_t kHeaderSize = kSectorSize * kHeaderSectorNum;
|
static const size_t kHeaderSize = kSectorSize * kHeaderSectorNum;
|
||||||
static const size_t kAesKeyNum = 16;
|
static const size_t kRightsIdLen = 0x10;
|
||||||
static const size_t kRightsIdLen = 0x10;
|
static const size_t kKeyAreaSize = 0x100;
|
||||||
static const size_t kKeyAreaEncryptionKeyNum = 3;
|
static const size_t kKeyAreaKeyNum = kKeyAreaSize / fnd::aes::kAes128KeySize;
|
||||||
static const size_t kFsHeaderHashSuperblockLen = 0x138;
|
static const size_t kKeyAreaEncryptionKeyNum = 3;
|
||||||
static const uint16_t kDefaultFsHeaderVersion = 2;
|
static const size_t kFsHeaderHashSuperblockLen = 0x138;
|
||||||
|
static const uint16_t kDefaultFsHeaderVersion = 2;
|
||||||
enum ProgramPartitionId
|
|
||||||
{
|
enum HeaderFormatVersion
|
||||||
PARTITION_CODE,
|
{
|
||||||
PARTITION_DATA,
|
FORMAT_NCA2 = 2,
|
||||||
PARTITION_LOGO,
|
FORMAT_NCA3 = 3
|
||||||
};
|
};
|
||||||
|
|
||||||
enum DistributionType
|
enum ProgramContentPartitionIndex
|
||||||
{
|
{
|
||||||
DIST_DOWNLOAD,
|
PARTITION_CODE = 0,
|
||||||
DIST_GAME_CARD
|
PARTITION_DATA = 1,
|
||||||
};
|
PARTITION_LOGO = 2,
|
||||||
|
};
|
||||||
enum ContentType
|
|
||||||
{
|
enum DistributionType
|
||||||
TYPE_PROGRAM,
|
{
|
||||||
TYPE_META,
|
DIST_DOWNLOAD,
|
||||||
TYPE_CONTROL,
|
DIST_GAME_CARD
|
||||||
TYPE_MANUAL,
|
};
|
||||||
TYPE_DATA,
|
|
||||||
TYPE_PUBLIC_DATA
|
enum ContentType
|
||||||
};
|
{
|
||||||
|
TYPE_PROGRAM,
|
||||||
enum KeyBankIndex
|
TYPE_META,
|
||||||
{
|
TYPE_CONTROL,
|
||||||
KEY_AESXTS_0,
|
TYPE_MANUAL,
|
||||||
KEY_AESXTS_1,
|
TYPE_DATA,
|
||||||
KEY_AESCTR,
|
TYPE_PUBLIC_DATA
|
||||||
KEY_UNUSED_3,
|
};
|
||||||
KEY_AESCTR_HW
|
|
||||||
};
|
enum KeyBankIndex
|
||||||
|
{
|
||||||
enum KeyAreaEncryptionKeyIndex
|
KEY_AESXTS_0,
|
||||||
{
|
KEY_AESXTS_1,
|
||||||
KAEK_IDX_APPLICATION,
|
KEY_AESCTR,
|
||||||
KAEK_IDX_OCEAN,
|
KEY_UNUSED_3,
|
||||||
KAEK_IDX_SYSTEM
|
KEY_AESCTR_HW
|
||||||
};
|
};
|
||||||
|
|
||||||
enum FormatType
|
enum KeyAreaEncryptionKeyIndex
|
||||||
{
|
{
|
||||||
FORMAT_ROMFS,
|
KAEK_IDX_APPLICATION,
|
||||||
FORMAT_PFS0
|
KAEK_IDX_OCEAN,
|
||||||
};
|
KAEK_IDX_SYSTEM
|
||||||
|
};
|
||||||
enum HashType
|
|
||||||
{
|
enum FormatType
|
||||||
HASH_AUTO,
|
{
|
||||||
HASH_NONE,
|
FORMAT_ROMFS,
|
||||||
HASH_HIERARCHICAL_SHA256,
|
FORMAT_PFS0
|
||||||
HASH_HIERARCHICAL_INTERGRITY // IVFC
|
};
|
||||||
};
|
|
||||||
|
enum HashType
|
||||||
enum EncryptionType
|
{
|
||||||
{
|
HASH_AUTO,
|
||||||
CRYPT_AUTO,
|
HASH_NONE,
|
||||||
CRYPT_NONE,
|
HASH_HIERARCHICAL_SHA256,
|
||||||
CRYPT_AESXTS,
|
HASH_HIERARCHICAL_INTERGRITY // IVFC
|
||||||
CRYPT_AESCTR,
|
};
|
||||||
CRYPT_AESCTREX
|
|
||||||
};
|
enum EncryptionType
|
||||||
}
|
{
|
||||||
|
CRYPT_AUTO,
|
||||||
#pragma pack(push,1)
|
CRYPT_NONE,
|
||||||
struct sNcaHeader
|
CRYPT_AESXTS,
|
||||||
{
|
CRYPT_AESCTR,
|
||||||
le_uint32_t st_magic;
|
CRYPT_AESCTREX
|
||||||
byte_t distribution_type;
|
};
|
||||||
byte_t content_type;
|
}
|
||||||
byte_t key_generation;
|
|
||||||
byte_t key_area_encryption_key_index;
|
#pragma pack(push,1)
|
||||||
le_uint64_t content_size;
|
struct sContentArchiveHeader
|
||||||
le_uint64_t program_id;
|
{
|
||||||
le_uint32_t content_index;
|
le_uint32_t st_magic;
|
||||||
le_uint32_t sdk_addon_version;
|
byte_t distribution_type;
|
||||||
byte_t key_generation_2;
|
byte_t content_type;
|
||||||
byte_t reserved_2[0xf];
|
byte_t key_generation;
|
||||||
byte_t rights_id[nca::kRightsIdLen];
|
byte_t key_area_encryption_key_index;
|
||||||
struct sNcaSection
|
le_uint64_t content_size;
|
||||||
{
|
le_uint64_t program_id;
|
||||||
le_uint32_t start; // block units
|
le_uint32_t content_index;
|
||||||
le_uint32_t end; // block units
|
le_uint32_t sdk_addon_version;
|
||||||
byte_t enabled;
|
byte_t key_generation_2;
|
||||||
byte_t reserved[7];
|
byte_t reserved_2[0xf];
|
||||||
} partition[nca::kPartitionNum];
|
byte_t rights_id[nca::kRightsIdLen];
|
||||||
fnd::sha::sSha256Hash partition_hash[nca::kPartitionNum];
|
struct sPartitionEntry
|
||||||
fnd::aes::sAes128Key enc_aes_key[nca::kAesKeyNum];
|
{
|
||||||
};
|
le_uint32_t start_blk; // block units
|
||||||
|
le_uint32_t end_blk; // block units
|
||||||
struct sNcaFsHeader
|
byte_t enabled;
|
||||||
{
|
byte_t reserved[7];
|
||||||
le_uint16_t version;
|
} partition_entry[nca::kPartitionNum];
|
||||||
byte_t format_type;
|
fnd::sha::sSha256Hash fs_header_hash[nca::kPartitionNum];
|
||||||
byte_t hash_type;
|
byte_t key_area[nca::kKeyAreaSize];
|
||||||
byte_t encryption_type;
|
};
|
||||||
byte_t reserved_0[3];
|
|
||||||
byte_t hash_superblock[nca::kFsHeaderHashSuperblockLen];
|
struct sNcaFsHeader
|
||||||
byte_t aes_ctr_upper[8];
|
{
|
||||||
byte_t reserved_1[0xB8];
|
le_uint16_t version;
|
||||||
};
|
byte_t format_type;
|
||||||
|
byte_t hash_type;
|
||||||
struct sNcaHeaderBlock
|
byte_t encryption_type;
|
||||||
{
|
byte_t reserved_0[3];
|
||||||
byte_t signature_main[fnd::rsa::kRsa2048Size];
|
byte_t hash_superblock[nca::kFsHeaderHashSuperblockLen];
|
||||||
byte_t signature_acid[fnd::rsa::kRsa2048Size];
|
byte_t aes_ctr_upper[8];
|
||||||
sNcaHeader header;
|
byte_t reserved_1[0xB8];
|
||||||
sNcaFsHeader fs_header[nn::hac::nca::kPartitionNum];
|
};
|
||||||
};
|
|
||||||
|
struct sContentArchiveHeaderBlock
|
||||||
#pragma pack(pop)
|
{
|
||||||
}
|
byte_t signature_main[fnd::rsa::kRsa2048Size];
|
||||||
|
byte_t signature_acid[fnd::rsa::kRsa2048Size];
|
||||||
|
sContentArchiveHeader header;
|
||||||
|
sNcaFsHeader fs_header[nn::hac::nca::kPartitionNum];
|
||||||
|
};
|
||||||
|
|
||||||
|
#pragma pack(pop)
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,45 +1,45 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <nn/hac/macro.h>
|
#include <nn/hac/define/macro.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
{
|
{
|
||||||
namespace hac
|
namespace hac
|
||||||
{
|
{
|
||||||
namespace nro
|
namespace nro
|
||||||
{
|
{
|
||||||
static const uint32_t kNroStructMagic = _MAKE_STRUCT_MAGIC_U32("NRO0");
|
static const uint32_t kNroStructMagic = _MAKE_STRUCT_MAGIC_U32("NRO0");
|
||||||
static const uint32_t kDefaultFormatVersion = 0;
|
static const uint32_t kDefaultFormatVersion = 0;
|
||||||
static const size_t kRoCrtSize = 8;
|
static const size_t kRoCrtSize = 8;
|
||||||
static const size_t kModuleIdSize = 32;
|
static const size_t kModuleIdSize = 32;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma pack(push,1)
|
#pragma pack(push,1)
|
||||||
struct sNroSection
|
struct sNroSection
|
||||||
{
|
{
|
||||||
le_uint32_t memory_offset;
|
le_uint32_t memory_offset;
|
||||||
le_uint32_t size;
|
le_uint32_t size;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sNroHeader
|
struct sNroHeader
|
||||||
{
|
{
|
||||||
byte_t ro_crt[nro::kRoCrtSize];
|
byte_t ro_crt[nro::kRoCrtSize];
|
||||||
byte_t reserved_0[8];
|
byte_t reserved_0[8];
|
||||||
le_uint32_t st_magic;
|
le_uint32_t st_magic;
|
||||||
le_uint32_t format_version;
|
le_uint32_t format_version;
|
||||||
le_uint32_t size;
|
le_uint32_t size;
|
||||||
le_uint32_t flags;
|
le_uint32_t flags;
|
||||||
sNroSection text;
|
sNroSection text;
|
||||||
sNroSection ro;
|
sNroSection ro;
|
||||||
sNroSection data;
|
sNroSection data;
|
||||||
le_uint32_t bss_size;
|
le_uint32_t bss_size;
|
||||||
byte_t reserved_1[4];
|
byte_t reserved_1[4];
|
||||||
byte_t module_id[nro::kModuleIdSize];
|
byte_t module_id[nro::kModuleIdSize];
|
||||||
byte_t reserved_2[8];
|
byte_t reserved_2[8];
|
||||||
sNroSection embedded;
|
sNroSection embedded;
|
||||||
sNroSection dyn_str;
|
sNroSection dyn_str;
|
||||||
sNroSection dyn_sym;
|
sNroSection dyn_sym;
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,39 +1,39 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <fnd/rsa.h>
|
#include <fnd/rsa.h>
|
||||||
#include <nn/hac/macro.h>
|
#include <nn/hac/define/macro.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
{
|
{
|
||||||
namespace hac
|
namespace hac
|
||||||
{
|
{
|
||||||
namespace nrr
|
namespace nrr
|
||||||
{
|
{
|
||||||
static const uint32_t kNrrStructMagic = _MAKE_STRUCT_MAGIC_U32("NRR0");
|
static const uint32_t kNrrStructMagic = _MAKE_STRUCT_MAGIC_U32("NRR0");
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma pack(push,1)
|
#pragma pack(push,1)
|
||||||
struct sNrrCertificate
|
struct sNrrCertificate
|
||||||
{
|
{
|
||||||
le_uint64_t application_id_mask;
|
le_uint64_t application_id_mask;
|
||||||
le_uint64_t application_id_pattern;
|
le_uint64_t application_id_pattern;
|
||||||
byte_t nrr_body_modulus[fnd::rsa::kRsa2048Size];
|
byte_t nrr_body_modulus[fnd::rsa::kRsa2048Size];
|
||||||
byte_t nrr_cert_signature[fnd::rsa::kRsa2048Size];
|
byte_t nrr_cert_signature[fnd::rsa::kRsa2048Size];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sNrrHeader
|
struct sNrrHeader
|
||||||
{
|
{
|
||||||
le_uint32_t st_magic;
|
le_uint32_t st_magic;
|
||||||
byte_t reserved_0[28];
|
byte_t reserved_0[28];
|
||||||
sNrrCertificate certificate;
|
sNrrCertificate certificate;
|
||||||
byte_t nrr_body_signature[fnd::rsa::kRsa2048Size];
|
byte_t nrr_body_signature[fnd::rsa::kRsa2048Size];
|
||||||
le_uint64_t application_id;
|
le_uint64_t application_id;
|
||||||
le_uint32_t size;
|
le_uint32_t size;
|
||||||
byte_t reserved_1[4];
|
byte_t reserved_1[4];
|
||||||
le_uint32_t hash_offset;
|
le_uint32_t hash_offset;
|
||||||
le_uint32_t hash_count;
|
le_uint32_t hash_count;
|
||||||
byte_t reserved_2[8];
|
byte_t reserved_2[8];
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,68 +1,68 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <fnd/sha.h>
|
#include <fnd/sha.h>
|
||||||
#include <nn/hac/macro.h>
|
#include <nn/hac/define/macro.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
{
|
{
|
||||||
namespace hac
|
namespace hac
|
||||||
{
|
{
|
||||||
namespace nso
|
namespace nso
|
||||||
{
|
{
|
||||||
static const uint32_t kNsoStructMagic = _MAKE_STRUCT_MAGIC_U32("NSO0");
|
static const uint32_t kNsoStructMagic = _MAKE_STRUCT_MAGIC_U32("NSO0");
|
||||||
static const uint32_t kDefaultFormatVersion = 0;
|
static const uint32_t kDefaultFormatVersion = 0;
|
||||||
static const size_t kModuleIdSize = 32;
|
static const size_t kModuleIdSize = 32;
|
||||||
|
|
||||||
enum HeaderFlags
|
enum HeaderFlags
|
||||||
{
|
{
|
||||||
FLAG_TEXT_COMPRESS,
|
FLAG_TEXT_COMPRESS,
|
||||||
FLAG_RO_COMPRESS,
|
FLAG_RO_COMPRESS,
|
||||||
FLAG_DATA_COMPRESS,
|
FLAG_DATA_COMPRESS,
|
||||||
FLAG_TEXT_HASH,
|
FLAG_TEXT_HASH,
|
||||||
FLAG_RO_HASH,
|
FLAG_RO_HASH,
|
||||||
FLAG_DATA_HASH
|
FLAG_DATA_HASH
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma pack(push,1)
|
#pragma pack(push,1)
|
||||||
struct sNsoCodeSegment
|
struct sNsoCodeSegment
|
||||||
{
|
{
|
||||||
le_uint32_t file_offset;
|
le_uint32_t file_offset;
|
||||||
le_uint32_t memory_offset;
|
le_uint32_t memory_offset;
|
||||||
le_uint32_t size;
|
le_uint32_t size;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sNsoSection
|
struct sNsoSection
|
||||||
{
|
{
|
||||||
le_uint32_t offset;
|
le_uint32_t offset;
|
||||||
le_uint32_t size;
|
le_uint32_t size;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sNsoHeader
|
struct sNsoHeader
|
||||||
{
|
{
|
||||||
le_uint32_t st_magic;
|
le_uint32_t st_magic;
|
||||||
le_uint32_t format_version;
|
le_uint32_t format_version;
|
||||||
byte_t reserved_1[4];
|
byte_t reserved_1[4];
|
||||||
le_uint32_t flags;
|
le_uint32_t flags;
|
||||||
sNsoCodeSegment text;
|
sNsoCodeSegment text;
|
||||||
le_uint32_t module_name_offset;
|
le_uint32_t module_name_offset;
|
||||||
sNsoCodeSegment ro;
|
sNsoCodeSegment ro;
|
||||||
le_uint32_t module_name_size;
|
le_uint32_t module_name_size;
|
||||||
sNsoCodeSegment data;
|
sNsoCodeSegment data;
|
||||||
le_uint32_t bss_size;
|
le_uint32_t bss_size;
|
||||||
byte_t module_id[nso::kModuleIdSize];
|
byte_t module_id[nso::kModuleIdSize];
|
||||||
le_uint32_t text_file_size;
|
le_uint32_t text_file_size;
|
||||||
le_uint32_t ro_file_size;
|
le_uint32_t ro_file_size;
|
||||||
le_uint32_t data_file_size;
|
le_uint32_t data_file_size;
|
||||||
byte_t reserved_2[28];
|
byte_t reserved_2[28];
|
||||||
sNsoSection embedded;
|
sNsoSection embedded;
|
||||||
sNsoSection dyn_str;
|
sNsoSection dyn_str;
|
||||||
sNsoSection dyn_sym;
|
sNsoSection dyn_sym;
|
||||||
fnd::sha::sSha256Hash text_hash;
|
fnd::sha::sSha256Hash text_hash;
|
||||||
fnd::sha::sSha256Hash ro_hash;
|
fnd::sha::sSha256Hash ro_hash;
|
||||||
fnd::sha::sSha256Hash data_hash;
|
fnd::sha::sSha256Hash data_hash;
|
||||||
};
|
};
|
||||||
|
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,45 +1,45 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <fnd/sha.h>
|
#include <fnd/sha.h>
|
||||||
#include <nn/hac/macro.h>
|
#include <nn/hac/define/macro.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
{
|
{
|
||||||
namespace hac
|
namespace hac
|
||||||
{
|
{
|
||||||
namespace pfs
|
namespace pfs
|
||||||
{
|
{
|
||||||
static const uint32_t kPfsStructMagic = _MAKE_STRUCT_MAGIC_U32("PFS0");
|
static const uint32_t kPfsStructMagic = _MAKE_STRUCT_MAGIC_U32("PFS0");
|
||||||
static const uint32_t kHashedPfsStructMagic = _MAKE_STRUCT_MAGIC_U32("HFS0");
|
static const uint32_t kHashedPfsStructMagic = _MAKE_STRUCT_MAGIC_U32("HFS0");
|
||||||
static const size_t kHeaderAlign = 64;
|
static const size_t kHeaderAlign = 64;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma pack(push,1)
|
#pragma pack(push,1)
|
||||||
struct sPfsHeader
|
struct sPfsHeader
|
||||||
{
|
{
|
||||||
le_uint32_t st_magic;
|
le_uint32_t st_magic;
|
||||||
le_uint32_t file_num;
|
le_uint32_t file_num;
|
||||||
le_uint32_t name_table_size;
|
le_uint32_t name_table_size;
|
||||||
byte_t padding[4];
|
byte_t padding[4];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sPfsFile
|
struct sPfsFile
|
||||||
{
|
{
|
||||||
le_uint64_t data_offset;
|
le_uint64_t data_offset;
|
||||||
le_uint64_t size;
|
le_uint64_t size;
|
||||||
le_uint32_t name_offset;
|
le_uint32_t name_offset;
|
||||||
byte_t padding[4];
|
byte_t padding[4];
|
||||||
}; // sizeof(0x18)
|
}; // sizeof(0x18)
|
||||||
|
|
||||||
struct sHashedPfsFile
|
struct sHashedPfsFile
|
||||||
{
|
{
|
||||||
le_uint64_t data_offset;
|
le_uint64_t data_offset;
|
||||||
le_uint64_t size;
|
le_uint64_t size;
|
||||||
le_uint32_t name_offset;
|
le_uint32_t name_offset;
|
||||||
le_uint32_t hash_protected_size;
|
le_uint32_t hash_protected_size;
|
||||||
byte_t padding[8];
|
byte_t padding[8];
|
||||||
fnd::sha::sSha256Hash hash;
|
fnd::sha::sSha256Hash hash;
|
||||||
}; // sizeof(0x40)
|
}; // sizeof(0x40)
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,60 +1,60 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
{
|
{
|
||||||
namespace hac
|
namespace hac
|
||||||
{
|
{
|
||||||
namespace romfs
|
namespace romfs
|
||||||
{
|
{
|
||||||
static const uint64_t kRomfsHeaderAlign = 0x200;
|
static const uint64_t kRomfsHeaderAlign = 0x200;
|
||||||
static const uint32_t kInvalidAddr = 0xffffffff;
|
static const uint32_t kInvalidAddr = 0xffffffff;
|
||||||
|
|
||||||
enum HeaderSectionIndex
|
enum HeaderSectionIndex
|
||||||
{
|
{
|
||||||
DIR_HASHMAP_TABLE,
|
DIR_HASHMAP_TABLE,
|
||||||
DIR_NODE_TABLE,
|
DIR_NODE_TABLE,
|
||||||
FILE_HASHMAP_TABLE,
|
FILE_HASHMAP_TABLE,
|
||||||
FILE_NODE_TABLE,
|
FILE_NODE_TABLE,
|
||||||
SECTION_NUM
|
SECTION_NUM
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma pack(push,1)
|
#pragma pack(push,1)
|
||||||
struct sRomfsHeader
|
struct sRomfsHeader
|
||||||
{
|
{
|
||||||
le_uint64_t header_size;
|
le_uint64_t header_size;
|
||||||
struct sSection
|
struct sSection
|
||||||
{
|
{
|
||||||
le_uint64_t offset;
|
le_uint64_t offset;
|
||||||
le_uint64_t size;
|
le_uint64_t size;
|
||||||
} sections[romfs::SECTION_NUM];
|
} sections[romfs::SECTION_NUM];
|
||||||
le_uint64_t data_offset;
|
le_uint64_t data_offset;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sRomfsDirEntry
|
struct sRomfsDirEntry
|
||||||
{
|
{
|
||||||
le_uint32_t parent;
|
le_uint32_t parent;
|
||||||
le_uint32_t sibling;
|
le_uint32_t sibling;
|
||||||
le_uint32_t child;
|
le_uint32_t child;
|
||||||
le_uint32_t file;
|
le_uint32_t file;
|
||||||
le_uint32_t hash;
|
le_uint32_t hash;
|
||||||
le_uint32_t name_size;
|
le_uint32_t name_size;
|
||||||
char* name() { return ((char*)(this)) + sizeof(sRomfsDirEntry); }
|
char* name() { return ((char*)(this)) + sizeof(sRomfsDirEntry); }
|
||||||
const char* name() const { return ((char*)(this)) + sizeof(sRomfsDirEntry); }
|
const char* name() const { return ((char*)(this)) + sizeof(sRomfsDirEntry); }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sRomfsFileEntry
|
struct sRomfsFileEntry
|
||||||
{
|
{
|
||||||
le_uint32_t parent;
|
le_uint32_t parent;
|
||||||
le_uint32_t sibling;
|
le_uint32_t sibling;
|
||||||
le_uint64_t offset;
|
le_uint64_t offset;
|
||||||
le_uint64_t size;
|
le_uint64_t size;
|
||||||
le_uint32_t hash;
|
le_uint32_t hash;
|
||||||
le_uint32_t name_size;
|
le_uint32_t name_size;
|
||||||
char* name() { return ((char*)(this)) + sizeof(sRomfsFileEntry); }
|
char* name() { return ((char*)(this)) + sizeof(sRomfsFileEntry); }
|
||||||
const char* name() const { return ((char*)(this)) + sizeof(sRomfsFileEntry); }
|
const char* name() const { return ((char*)(this)) + sizeof(sRomfsFileEntry); }
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,228 +1,240 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<ItemGroup Label="ProjectConfigurations">
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
<ProjectConfiguration Include="Debug|Win32">
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
<Configuration>Debug</Configuration>
|
<Configuration>Debug</Configuration>
|
||||||
<Platform>Win32</Platform>
|
<Platform>Win32</Platform>
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
<ProjectConfiguration Include="Release|Win32">
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
<Configuration>Release</Configuration>
|
<Configuration>Release</Configuration>
|
||||||
<Platform>Win32</Platform>
|
<Platform>Win32</Platform>
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
<ProjectConfiguration Include="Debug|x64">
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
<Configuration>Debug</Configuration>
|
<Configuration>Debug</Configuration>
|
||||||
<Platform>x64</Platform>
|
<Platform>x64</Platform>
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
<ProjectConfiguration Include="Release|x64">
|
<ProjectConfiguration Include="Release|x64">
|
||||||
<Configuration>Release</Configuration>
|
<Configuration>Release</Configuration>
|
||||||
<Platform>x64</Platform>
|
<Platform>x64</Platform>
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="makefile" />
|
<None Include="makefile" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="include\nn\hac\AccessControlInfoBinary.h" />
|
<ClInclude Include="include\nn\hac\AccessControlInfo.h" />
|
||||||
<ClInclude Include="include\nn\hac\AccessControlInfoDescBinary.h" />
|
<ClInclude Include="include\nn\hac\AccessControlInfoDesc.h" />
|
||||||
<ClInclude Include="include\nn\hac\aci.h" />
|
<ClInclude Include="include\nn\hac\AddOnContentMetaExtendedHeader.h" />
|
||||||
<ClInclude Include="include\nn\hac\AesKeygen.h" />
|
<ClInclude Include="include\nn\hac\AesKeygen.h" />
|
||||||
<ClInclude Include="include\nn\hac\ApplicationControlPropertyBinary.h" />
|
<ClInclude Include="include\nn\hac\ApplicationControlProperty.h" />
|
||||||
<ClInclude Include="include\nn\hac\ApplicationControlPropertyUtils.h" />
|
<ClInclude Include="include\nn\hac\ApplicationControlPropertyUtils.h" />
|
||||||
<ClInclude Include="include\nn\hac\cnmt.h" />
|
<ClInclude Include="include\nn\hac\ApplicationMetaExtendedHeader.h" />
|
||||||
<ClInclude Include="include\nn\hac\ContentMetaBinary.h" />
|
<ClInclude Include="include\nn\hac\ContentArchiveHeader.h" />
|
||||||
<ClInclude Include="include\nn\hac\delta.h" />
|
<ClInclude Include="include\nn\hac\ContentArchiveUtils.h" />
|
||||||
<ClInclude Include="include\nn\hac\fac.h" />
|
<ClInclude Include="include\nn\hac\ContentInfo.h" />
|
||||||
<ClInclude Include="include\nn\hac\FileSystemAccessControlBinary.h" />
|
<ClInclude Include="include\nn\hac\ContentMeta.h" />
|
||||||
<ClInclude Include="include\nn\hac\HandleTableSizeEntry.h" />
|
<ClInclude Include="include\nn\hac\ContentMetaInfo.h" />
|
||||||
<ClInclude Include="include\nn\hac\HandleTableSizeHandler.h" />
|
<ClInclude Include="include\nn\hac\define\aci.h" />
|
||||||
<ClInclude Include="include\nn\hac\hierarchicalintegrity.h" />
|
<ClInclude Include="include\nn\hac\define\cnmt.h" />
|
||||||
<ClInclude Include="include\nn\hac\HierarchicalIntegrityHeader.h" />
|
<ClInclude Include="include\nn\hac\define\delta.h" />
|
||||||
<ClInclude Include="include\nn\hac\hierarchicalsha256.h" />
|
<ClInclude Include="include\nn\hac\define\fac.h" />
|
||||||
<ClInclude Include="include\nn\hac\HierarchicalSha256Header.h" />
|
<ClInclude Include="include\nn\hac\define\gc.h" />
|
||||||
<ClInclude Include="include\nn\hac\IdConverter.h" />
|
<ClInclude Include="include\nn\hac\define\hierarchicalintegrity.h" />
|
||||||
<ClInclude Include="include\nn\hac\IKernelCapabilityHandler.h" />
|
<ClInclude Include="include\nn\hac\define\hierarchicalsha256.h" />
|
||||||
<ClInclude Include="include\nn\hac\InteruptEntry.h" />
|
<ClInclude Include="include\nn\hac\define\kc.h" />
|
||||||
<ClInclude Include="include\nn\hac\InteruptHandler.h" />
|
<ClInclude Include="include\nn\hac\define\macro.h" />
|
||||||
<ClInclude Include="include\nn\hac\kc.h" />
|
<ClInclude Include="include\nn\hac\define\meta.h" />
|
||||||
<ClInclude Include="include\nn\hac\KernelCapabilityBinary.h" />
|
<ClInclude Include="include\nn\hac\define\nacp.h" />
|
||||||
<ClInclude Include="include\nn\hac\KernelCapabilityEntry.h" />
|
<ClInclude Include="include\nn\hac\define\nca.h" />
|
||||||
<ClInclude Include="include\nn\hac\KernelVersionEntry.h" />
|
<ClInclude Include="include\nn\hac\define\nro.h" />
|
||||||
<ClInclude Include="include\nn\hac\KernelVersionHandler.h" />
|
<ClInclude Include="include\nn\hac\define\nrr.h" />
|
||||||
<ClInclude Include="include\nn\hac\macro.h" />
|
<ClInclude Include="include\nn\hac\define\nso.h" />
|
||||||
<ClInclude Include="include\nn\hac\MemoryMappingHandler.h" />
|
<ClInclude Include="include\nn\hac\define\pfs.h" />
|
||||||
<ClInclude Include="include\nn\hac\MemoryPageEntry.h" />
|
<ClInclude Include="include\nn\hac\define\romfs.h" />
|
||||||
<ClInclude Include="include\nn\hac\meta.h" />
|
<ClInclude Include="include\nn\hac\DeltaMetaExtendedHeader.h" />
|
||||||
<ClInclude Include="include\nn\hac\MetaBinary.h" />
|
<ClInclude Include="include\nn\hac\FileSystemAccessControl.h" />
|
||||||
<ClInclude Include="include\nn\hac\MiscFlagsEntry.h" />
|
<ClInclude Include="include\nn\hac\GameCardHeader.h" />
|
||||||
<ClInclude Include="include\nn\hac\MiscFlagsHandler.h" />
|
<ClInclude Include="include\nn\hac\GameCardUtils.h" />
|
||||||
<ClInclude Include="include\nn\hac\MiscParamsEntry.h" />
|
<ClInclude Include="include\nn\hac\HandleTableSizeEntry.h" />
|
||||||
<ClInclude Include="include\nn\hac\MiscParamsHandler.h" />
|
<ClInclude Include="include\nn\hac\HandleTableSizeHandler.h" />
|
||||||
<ClInclude Include="include\nn\hac\nacp.h" />
|
<ClInclude Include="include\nn\hac\HierarchicalIntegrityHeader.h" />
|
||||||
<ClInclude Include="include\nn\hac\nca.h" />
|
<ClInclude Include="include\nn\hac\HierarchicalSha256Header.h" />
|
||||||
<ClInclude Include="include\nn\hac\NcaHeader.h" />
|
<ClInclude Include="include\nn\hac\IdConverter.h" />
|
||||||
<ClInclude Include="include\nn\hac\NcaUtils.h" />
|
<ClInclude Include="include\nn\hac\IKernelCapabilityHandler.h" />
|
||||||
<ClInclude Include="include\nn\hac\nro.h" />
|
<ClInclude Include="include\nn\hac\InteruptEntry.h" />
|
||||||
<ClInclude Include="include\nn\hac\NroHeader.h" />
|
<ClInclude Include="include\nn\hac\InteruptHandler.h" />
|
||||||
<ClInclude Include="include\nn\hac\nrr.h" />
|
<ClInclude Include="include\nn\hac\KernelCapabilityControl.h" />
|
||||||
<ClInclude Include="include\nn\hac\nso.h" />
|
<ClInclude Include="include\nn\hac\KernelCapabilityEntry.h" />
|
||||||
<ClInclude Include="include\nn\hac\NsoHeader.h" />
|
<ClInclude Include="include\nn\hac\KernelVersionEntry.h" />
|
||||||
<ClInclude Include="include\nn\hac\pfs.h" />
|
<ClInclude Include="include\nn\hac\KernelVersionHandler.h" />
|
||||||
<ClInclude Include="include\nn\hac\PfsHeader.h" />
|
<ClInclude Include="include\nn\hac\MemoryMappingHandler.h" />
|
||||||
<ClInclude Include="include\nn\hac\Result.h" />
|
<ClInclude Include="include\nn\hac\MemoryPageEntry.h" />
|
||||||
<ClInclude Include="include\nn\hac\romfs.h" />
|
<ClInclude Include="include\nn\hac\Meta.h" />
|
||||||
<ClInclude Include="include\nn\hac\ServiceAccessControlBinary.h" />
|
<ClInclude Include="include\nn\hac\MiscFlagsEntry.h" />
|
||||||
<ClInclude Include="include\nn\hac\ServiceAccessControlEntry.h" />
|
<ClInclude Include="include\nn\hac\MiscFlagsHandler.h" />
|
||||||
<ClInclude Include="include\nn\hac\SystemCallEntry.h" />
|
<ClInclude Include="include\nn\hac\MiscParamsEntry.h" />
|
||||||
<ClInclude Include="include\nn\hac\SystemCallHandler.h" />
|
<ClInclude Include="include\nn\hac\MiscParamsHandler.h" />
|
||||||
<ClInclude Include="include\nn\hac\ThreadInfoEntry.h" />
|
<ClInclude Include="include\nn\hac\NroHeader.h" />
|
||||||
<ClInclude Include="include\nn\hac\ThreadInfoHandler.h" />
|
<ClInclude Include="include\nn\hac\NsoHeader.h" />
|
||||||
<ClInclude Include="include\nn\hac\xci.h" />
|
<ClInclude Include="include\nn\hac\PartitionFsHeader.h" />
|
||||||
<ClInclude Include="include\nn\hac\XciHeader.h" />
|
<ClInclude Include="include\nn\hac\PatchMetaExtendedHeader.h" />
|
||||||
<ClInclude Include="include\nn\hac\XciUtils.h" />
|
<ClInclude Include="include\nn\hac\Result.h" />
|
||||||
</ItemGroup>
|
<ClInclude Include="include\nn\hac\ServiceAccessControl.h" />
|
||||||
<ItemGroup>
|
<ClInclude Include="include\nn\hac\ServiceAccessControlEntry.h" />
|
||||||
<ClCompile Include="source\AccessControlInfoBinary.cpp" />
|
<ClInclude Include="include\nn\hac\SystemCallEntry.h" />
|
||||||
<ClCompile Include="source\AccessControlInfoDescBinary.cpp" />
|
<ClInclude Include="include\nn\hac\SystemCallHandler.h" />
|
||||||
<ClCompile Include="source\AesKeygen.cpp" />
|
<ClInclude Include="include\nn\hac\ThreadInfoEntry.h" />
|
||||||
<ClCompile Include="source\ApplicationControlPropertyBinary.cpp" />
|
<ClInclude Include="include\nn\hac\ThreadInfoHandler.h" />
|
||||||
<ClCompile Include="source\ApplicationControlPropertyUtils.cpp" />
|
</ItemGroup>
|
||||||
<ClCompile Include="source\ContentMetaBinary.cpp" />
|
<ItemGroup>
|
||||||
<ClCompile Include="source\FileSystemAccessControlBinary.cpp" />
|
<ClCompile Include="source\AccessControlInfo.cpp" />
|
||||||
<ClCompile Include="source\HandleTableSizeEntry.cpp" />
|
<ClCompile Include="source\AccessControlInfoDesc.cpp" />
|
||||||
<ClCompile Include="source\HandleTableSizeHandler.cpp" />
|
<ClCompile Include="source\AddOnContentMetaExtendedHeader.cpp" />
|
||||||
<ClCompile Include="source\HierarchicalIntegrityHeader.cpp" />
|
<ClCompile Include="source\AesKeygen.cpp" />
|
||||||
<ClCompile Include="source\HierarchicalSha256Header.cpp" />
|
<ClCompile Include="source\ApplicationControlProperty.cpp" />
|
||||||
<ClCompile Include="source\IdConverter.cpp" />
|
<ClCompile Include="source\ApplicationControlPropertyUtils.cpp" />
|
||||||
<ClCompile Include="source\InteruptEntry.cpp" />
|
<ClCompile Include="source\ApplicationMetaExtendedHeader.cpp" />
|
||||||
<ClCompile Include="source\InteruptHandler.cpp" />
|
<ClCompile Include="source\ContentArchiveHeader.cpp" />
|
||||||
<ClCompile Include="source\KernelCapabilityBinary.cpp" />
|
<ClCompile Include="source\ContentArchiveUtils.cpp" />
|
||||||
<ClCompile Include="source\KernelCapabilityEntry.cpp" />
|
<ClCompile Include="source\ContentInfo.cpp" />
|
||||||
<ClCompile Include="source\KernelVersionEntry.cpp" />
|
<ClCompile Include="source\ContentMeta.cpp" />
|
||||||
<ClCompile Include="source\KernelVersionHandler.cpp" />
|
<ClCompile Include="source\ContentMetaInfo.cpp" />
|
||||||
<ClCompile Include="source\MemoryMappingHandler.cpp" />
|
<ClCompile Include="source\DeltaMetaExtendedHeader.cpp" />
|
||||||
<ClCompile Include="source\MemoryPageEntry.cpp" />
|
<ClCompile Include="source\FileSystemAccessControl.cpp" />
|
||||||
<ClCompile Include="source\MetaBinary.cpp" />
|
<ClCompile Include="source\GameCardHeader.cpp" />
|
||||||
<ClCompile Include="source\MiscFlagsEntry.cpp" />
|
<ClCompile Include="source\GameCardUtils.cpp" />
|
||||||
<ClCompile Include="source\MiscFlagsHandler.cpp" />
|
<ClCompile Include="source\HandleTableSizeEntry.cpp" />
|
||||||
<ClCompile Include="source\MiscParamsEntry.cpp" />
|
<ClCompile Include="source\HandleTableSizeHandler.cpp" />
|
||||||
<ClCompile Include="source\MiscParamsHandler.cpp" />
|
<ClCompile Include="source\HierarchicalIntegrityHeader.cpp" />
|
||||||
<ClCompile Include="source\NcaHeader.cpp" />
|
<ClCompile Include="source\HierarchicalSha256Header.cpp" />
|
||||||
<ClCompile Include="source\NcaUtils.cpp" />
|
<ClCompile Include="source\IdConverter.cpp" />
|
||||||
<ClCompile Include="source\NroHeader.cpp" />
|
<ClCompile Include="source\InteruptEntry.cpp" />
|
||||||
<ClCompile Include="source\NsoHeader.cpp" />
|
<ClCompile Include="source\InteruptHandler.cpp" />
|
||||||
<ClCompile Include="source\PfsHeader.cpp" />
|
<ClCompile Include="source\KernelCapabilityControl.cpp" />
|
||||||
<ClCompile Include="source\Result.cpp" />
|
<ClCompile Include="source\KernelCapabilityEntry.cpp" />
|
||||||
<ClCompile Include="source\ServiceAccessControlBinary.cpp" />
|
<ClCompile Include="source\KernelVersionEntry.cpp" />
|
||||||
<ClCompile Include="source\ServiceAccessControlEntry.cpp" />
|
<ClCompile Include="source\KernelVersionHandler.cpp" />
|
||||||
<ClCompile Include="source\SystemCallEntry.cpp" />
|
<ClCompile Include="source\MemoryMappingHandler.cpp" />
|
||||||
<ClCompile Include="source\SystemCallHandler.cpp" />
|
<ClCompile Include="source\MemoryPageEntry.cpp" />
|
||||||
<ClCompile Include="source\ThreadInfoEntry.cpp" />
|
<ClCompile Include="source\Meta.cpp" />
|
||||||
<ClCompile Include="source\ThreadInfoHandler.cpp" />
|
<ClCompile Include="source\MiscFlagsEntry.cpp" />
|
||||||
<ClCompile Include="source\XciHeader.cpp" />
|
<ClCompile Include="source\MiscFlagsHandler.cpp" />
|
||||||
<ClCompile Include="source\XciUtils.cpp" />
|
<ClCompile Include="source\MiscParamsEntry.cpp" />
|
||||||
</ItemGroup>
|
<ClCompile Include="source\MiscParamsHandler.cpp" />
|
||||||
<PropertyGroup Label="Globals">
|
<ClCompile Include="source\NroHeader.cpp" />
|
||||||
<VCProjectVersion>15.0</VCProjectVersion>
|
<ClCompile Include="source\NsoHeader.cpp" />
|
||||||
<ProjectGuid>{91BA9E79-8242-4F7D-B997-0DFEC95EA22B}</ProjectGuid>
|
<ClCompile Include="source\PartitionFsHeader.cpp" />
|
||||||
<RootNamespace>hac</RootNamespace>
|
<ClCompile Include="source\PatchMetaExtendedHeader.cpp" />
|
||||||
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
|
<ClCompile Include="source\Result.cpp" />
|
||||||
<ProjectName>libhac</ProjectName>
|
<ClCompile Include="source\ServiceAccessControl.cpp" />
|
||||||
</PropertyGroup>
|
<ClCompile Include="source\ServiceAccessControlEntry.cpp" />
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<ClCompile Include="source\SystemCallEntry.cpp" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<ClCompile Include="source\SystemCallHandler.cpp" />
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ClCompile Include="source\ThreadInfoEntry.cpp" />
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<ClCompile Include="source\ThreadInfoHandler.cpp" />
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
</ItemGroup>
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
<PropertyGroup Label="Globals">
|
||||||
</PropertyGroup>
|
<VCProjectVersion>15.0</VCProjectVersion>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
<ProjectGuid>{91BA9E79-8242-4F7D-B997-0DFEC95EA22B}</ProjectGuid>
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<RootNamespace>hac</RootNamespace>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<ProjectName>libhac</ProjectName>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
</PropertyGroup>
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
</PropertyGroup>
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
</PropertyGroup>
|
||||||
</PropertyGroup>
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
</PropertyGroup>
|
||||||
</PropertyGroup>
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
</ImportGroup>
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
<ImportGroup Label="Shared">
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
</ImportGroup>
|
</PropertyGroup>
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
</ImportGroup>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
</ImportGroup>
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
</PropertyGroup>
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
</ImportGroup>
|
<ImportGroup Label="ExtensionSettings">
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
</ImportGroup>
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<ImportGroup Label="Shared">
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<PropertyGroup Label="UserMacros" />
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<PropertyGroup />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
</ImportGroup>
|
||||||
<ClCompile>
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
<Optimization>Disabled</Optimization>
|
</ImportGroup>
|
||||||
<SDLCheck>true</SDLCheck>
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<AdditionalIncludeDirectories>..\libfnd\include;..\libhac\include;</AdditionalIncludeDirectories>
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
<PreprocessorDefinitions>_MBCS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
</ImportGroup>
|
||||||
</ClCompile>
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
</ItemDefinitionGroup>
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
</ImportGroup>
|
||||||
<ClCompile>
|
<PropertyGroup Label="UserMacros" />
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<PropertyGroup />
|
||||||
<Optimization>Disabled</Optimization>
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<SDLCheck>true</SDLCheck>
|
<ClCompile>
|
||||||
<AdditionalIncludeDirectories>..\libfnd\include;..\libhac\include;</AdditionalIncludeDirectories>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<PreprocessorDefinitions>_MBCS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<Optimization>Disabled</Optimization>
|
||||||
</ClCompile>
|
<SDLCheck>true</SDLCheck>
|
||||||
</ItemDefinitionGroup>
|
<AdditionalIncludeDirectories>..\libfnd\include;..\libhac\include;</AdditionalIncludeDirectories>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<PreprocessorDefinitions>_MBCS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<ClCompile>
|
</ClCompile>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
</ItemDefinitionGroup>
|
||||||
<Optimization>MaxSpeed</Optimization>
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<ClCompile>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<SDLCheck>true</SDLCheck>
|
<Optimization>Disabled</Optimization>
|
||||||
<AdditionalIncludeDirectories>..\libfnd\include;..\libhac\include;</AdditionalIncludeDirectories>
|
<SDLCheck>true</SDLCheck>
|
||||||
<PreprocessorDefinitions>_MBCS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<AdditionalIncludeDirectories>..\libfnd\include;..\libhac\include;</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
<PreprocessorDefinitions>_MBCS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<Link>
|
</ClCompile>
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
</ItemDefinitionGroup>
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
</Link>
|
<ClCompile>
|
||||||
</ItemDefinitionGroup>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<Optimization>MaxSpeed</Optimization>
|
||||||
<ClCompile>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<Optimization>MaxSpeed</Optimization>
|
<SDLCheck>true</SDLCheck>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<AdditionalIncludeDirectories>..\libfnd\include;..\libhac\include;</AdditionalIncludeDirectories>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<PreprocessorDefinitions>_MBCS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<SDLCheck>true</SDLCheck>
|
</ClCompile>
|
||||||
<AdditionalIncludeDirectories>..\libfnd\include;..\libhac\include;</AdditionalIncludeDirectories>
|
<Link>
|
||||||
<PreprocessorDefinitions>_MBCS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
</ClCompile>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
<Link>
|
</Link>
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
</ItemDefinitionGroup>
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
</Link>
|
<ClCompile>
|
||||||
</ItemDefinitionGroup>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Optimization>MaxSpeed</Optimization>
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
</ImportGroup>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<AdditionalIncludeDirectories>..\libfnd\include;..\libhac\include;</AdditionalIncludeDirectories>
|
||||||
|
<PreprocessorDefinitions>_MBCS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -1,312 +1,345 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Filter Include="Source Files">
|
<None Include="makefile" />
|
||||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
</ItemGroup>
|
||||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
<ItemGroup>
|
||||||
</Filter>
|
<Filter Include="Header Files">
|
||||||
<Filter Include="Header Files">
|
<UniqueIdentifier>{040358e3-f1c5-4875-b34f-23607459567c}</UniqueIdentifier>
|
||||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
</Filter>
|
||||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
<Filter Include="Source Files">
|
||||||
</Filter>
|
<UniqueIdentifier>{1c33ce2b-25c4-4857-966c-9dc24daf3f61}</UniqueIdentifier>
|
||||||
<Filter Include="Resource Files">
|
</Filter>
|
||||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
<Filter Include="Header Files\define">
|
||||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
<UniqueIdentifier>{a9fd54c0-9fd8-46a1-978e-fb531bf3ee1c}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="makefile" />
|
<ClInclude Include="include\nn\hac\define\aci.h">
|
||||||
</ItemGroup>
|
<Filter>Header Files\define</Filter>
|
||||||
<ItemGroup>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\AccessControlInfoBinary.h">
|
<ClInclude Include="include\nn\hac\define\cnmt.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files\define</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\AccessControlInfoDescBinary.h">
|
<ClInclude Include="include\nn\hac\define\delta.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files\define</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\aci.h">
|
<ClInclude Include="include\nn\hac\define\fac.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files\define</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\AesKeygen.h">
|
<ClInclude Include="include\nn\hac\define\gc.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files\define</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\ApplicationControlPropertyBinary.h">
|
<ClInclude Include="include\nn\hac\define\hierarchicalintegrity.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files\define</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\ApplicationControlPropertyUtils.h">
|
<ClInclude Include="include\nn\hac\define\hierarchicalsha256.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files\define</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\cnmt.h">
|
<ClInclude Include="include\nn\hac\define\kc.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files\define</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\ContentMetaBinary.h">
|
<ClInclude Include="include\nn\hac\define\macro.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files\define</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\delta.h">
|
<ClInclude Include="include\nn\hac\define\meta.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files\define</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\fac.h">
|
<ClInclude Include="include\nn\hac\define\nacp.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files\define</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\FileSystemAccessControlBinary.h">
|
<ClInclude Include="include\nn\hac\define\nca.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files\define</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\HandleTableSizeEntry.h">
|
<ClInclude Include="include\nn\hac\define\nro.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files\define</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\HandleTableSizeHandler.h">
|
<ClInclude Include="include\nn\hac\define\nrr.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files\define</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\hierarchicalintegrity.h">
|
<ClInclude Include="include\nn\hac\define\nso.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files\define</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\HierarchicalIntegrityHeader.h">
|
<ClInclude Include="include\nn\hac\define\pfs.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files\define</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\hierarchicalsha256.h">
|
<ClInclude Include="include\nn\hac\define\romfs.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files\define</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\HierarchicalSha256Header.h">
|
<ClInclude Include="include\nn\hac\AccessControlInfo.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\IdConverter.h">
|
<ClInclude Include="include\nn\hac\AccessControlInfoDesc.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\IKernelCapabilityHandler.h">
|
<ClInclude Include="include\nn\hac\AddOnContentMetaExtendedHeader.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\InteruptEntry.h">
|
<ClInclude Include="include\nn\hac\AesKeygen.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\InteruptHandler.h">
|
<ClInclude Include="include\nn\hac\ApplicationControlProperty.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\kc.h">
|
<ClInclude Include="include\nn\hac\ApplicationControlPropertyUtils.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\KernelCapabilityBinary.h">
|
<ClInclude Include="include\nn\hac\ApplicationMetaExtendedHeader.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\KernelCapabilityEntry.h">
|
<ClInclude Include="include\nn\hac\ContentArchiveHeader.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\KernelVersionEntry.h">
|
<ClInclude Include="include\nn\hac\ContentArchiveUtils.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\KernelVersionHandler.h">
|
<ClInclude Include="include\nn\hac\ContentInfo.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\macro.h">
|
<ClInclude Include="include\nn\hac\ContentMeta.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\MemoryMappingHandler.h">
|
<ClInclude Include="include\nn\hac\ContentMetaInfo.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\MemoryPageEntry.h">
|
<ClInclude Include="include\nn\hac\DeltaMetaExtendedHeader.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\meta.h">
|
<ClInclude Include="include\nn\hac\FileSystemAccessControl.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\MetaBinary.h">
|
<ClInclude Include="include\nn\hac\GameCardHeader.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\MiscFlagsEntry.h">
|
<ClInclude Include="include\nn\hac\GameCardUtils.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\MiscFlagsHandler.h">
|
<ClInclude Include="include\nn\hac\HandleTableSizeEntry.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\MiscParamsEntry.h">
|
<ClInclude Include="include\nn\hac\HandleTableSizeHandler.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\MiscParamsHandler.h">
|
<ClInclude Include="include\nn\hac\HierarchicalIntegrityHeader.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\nacp.h">
|
<ClInclude Include="include\nn\hac\HierarchicalSha256Header.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\nca.h">
|
<ClInclude Include="include\nn\hac\IdConverter.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\NcaHeader.h">
|
<ClInclude Include="include\nn\hac\IKernelCapabilityHandler.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\NcaUtils.h">
|
<ClInclude Include="include\nn\hac\InteruptEntry.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\nro.h">
|
<ClInclude Include="include\nn\hac\InteruptHandler.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\NroHeader.h">
|
<ClInclude Include="include\nn\hac\KernelCapabilityControl.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\nrr.h">
|
<ClInclude Include="include\nn\hac\KernelCapabilityEntry.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\nso.h">
|
<ClInclude Include="include\nn\hac\KernelVersionEntry.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\NsoHeader.h">
|
<ClInclude Include="include\nn\hac\KernelVersionHandler.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\pfs.h">
|
<ClInclude Include="include\nn\hac\MemoryMappingHandler.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\PfsHeader.h">
|
<ClInclude Include="include\nn\hac\MemoryPageEntry.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\Result.h">
|
<ClInclude Include="include\nn\hac\Meta.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\romfs.h">
|
<ClInclude Include="include\nn\hac\MiscFlagsEntry.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\ServiceAccessControlBinary.h">
|
<ClInclude Include="include\nn\hac\MiscFlagsHandler.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\ServiceAccessControlEntry.h">
|
<ClInclude Include="include\nn\hac\MiscParamsEntry.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\SystemCallEntry.h">
|
<ClInclude Include="include\nn\hac\MiscParamsHandler.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\SystemCallHandler.h">
|
<ClInclude Include="include\nn\hac\NroHeader.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\ThreadInfoEntry.h">
|
<ClInclude Include="include\nn\hac\NsoHeader.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\ThreadInfoHandler.h">
|
<ClInclude Include="include\nn\hac\PartitionFsHeader.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\xci.h">
|
<ClInclude Include="include\nn\hac\PatchMetaExtendedHeader.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\XciHeader.h">
|
<ClInclude Include="include\nn\hac\Result.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\nn\hac\XciUtils.h">
|
<ClInclude Include="include\nn\hac\ServiceAccessControl.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
</ItemGroup>
|
<ClInclude Include="include\nn\hac\ServiceAccessControlEntry.h">
|
||||||
<ItemGroup>
|
<Filter>Header Files</Filter>
|
||||||
<ClCompile Include="source\AccessControlInfoBinary.cpp">
|
</ClInclude>
|
||||||
<Filter>Source Files</Filter>
|
<ClInclude Include="include\nn\hac\SystemCallEntry.h">
|
||||||
</ClCompile>
|
<Filter>Header Files</Filter>
|
||||||
<ClCompile Include="source\AccessControlInfoDescBinary.cpp">
|
</ClInclude>
|
||||||
<Filter>Source Files</Filter>
|
<ClInclude Include="include\nn\hac\SystemCallHandler.h">
|
||||||
</ClCompile>
|
<Filter>Header Files</Filter>
|
||||||
<ClCompile Include="source\AesKeygen.cpp">
|
</ClInclude>
|
||||||
<Filter>Source Files</Filter>
|
<ClInclude Include="include\nn\hac\ThreadInfoEntry.h">
|
||||||
</ClCompile>
|
<Filter>Header Files</Filter>
|
||||||
<ClCompile Include="source\ApplicationControlPropertyBinary.cpp">
|
</ClInclude>
|
||||||
<Filter>Source Files</Filter>
|
<ClInclude Include="include\nn\hac\ThreadInfoHandler.h">
|
||||||
</ClCompile>
|
<Filter>Header Files</Filter>
|
||||||
<ClCompile Include="source\ApplicationControlPropertyUtils.cpp">
|
</ClInclude>
|
||||||
<Filter>Source Files</Filter>
|
</ItemGroup>
|
||||||
</ClCompile>
|
<ItemGroup>
|
||||||
<ClCompile Include="source\ContentMetaBinary.cpp">
|
<ClCompile Include="source\AccessControlInfo.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\FileSystemAccessControlBinary.cpp">
|
<ClCompile Include="source\AccessControlInfoDesc.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\HandleTableSizeEntry.cpp">
|
<ClCompile Include="source\AddOnContentMetaExtendedHeader.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\HandleTableSizeHandler.cpp">
|
<ClCompile Include="source\AesKeygen.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\HierarchicalIntegrityHeader.cpp">
|
<ClCompile Include="source\ApplicationControlProperty.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\HierarchicalSha256Header.cpp">
|
<ClCompile Include="source\ApplicationControlPropertyUtils.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\InteruptEntry.cpp">
|
<ClCompile Include="source\ApplicationMetaExtendedHeader.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\InteruptHandler.cpp">
|
<ClCompile Include="source\ContentArchiveHeader.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\KernelCapabilityBinary.cpp">
|
<ClCompile Include="source\ContentArchiveUtils.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\KernelCapabilityEntry.cpp">
|
<ClCompile Include="source\ContentInfo.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\KernelVersionEntry.cpp">
|
<ClCompile Include="source\ContentMeta.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\KernelVersionHandler.cpp">
|
<ClCompile Include="source\ContentMetaInfo.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\MemoryMappingHandler.cpp">
|
<ClCompile Include="source\DeltaMetaExtendedHeader.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\MemoryPageEntry.cpp">
|
<ClCompile Include="source\FileSystemAccessControl.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\MiscFlagsEntry.cpp">
|
<ClCompile Include="source\GameCardHeader.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\MiscFlagsHandler.cpp">
|
<ClCompile Include="source\GameCardUtils.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\MiscParamsEntry.cpp">
|
<ClCompile Include="source\HandleTableSizeEntry.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\MiscParamsHandler.cpp">
|
<ClCompile Include="source\HandleTableSizeHandler.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\NcaHeader.cpp">
|
<ClCompile Include="source\HierarchicalIntegrityHeader.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\NcaUtils.cpp">
|
<ClCompile Include="source\HierarchicalSha256Header.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\MetaBinary.cpp">
|
<ClCompile Include="source\IdConverter.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\NroHeader.cpp">
|
<ClCompile Include="source\InteruptEntry.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\NsoHeader.cpp">
|
<ClCompile Include="source\InteruptHandler.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\PfsHeader.cpp">
|
<ClCompile Include="source\KernelCapabilityControl.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\ServiceAccessControlBinary.cpp">
|
<ClCompile Include="source\KernelCapabilityEntry.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\ServiceAccessControlEntry.cpp">
|
<ClCompile Include="source\KernelVersionEntry.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\SystemCallEntry.cpp">
|
<ClCompile Include="source\KernelVersionHandler.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\SystemCallHandler.cpp">
|
<ClCompile Include="source\MemoryMappingHandler.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\ThreadInfoEntry.cpp">
|
<ClCompile Include="source\MemoryPageEntry.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\ThreadInfoHandler.cpp">
|
<ClCompile Include="source\Meta.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\XciHeader.cpp">
|
<ClCompile Include="source\MiscFlagsEntry.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\XciUtils.cpp">
|
<ClCompile Include="source\MiscFlagsHandler.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\IdConverter.cpp">
|
<ClCompile Include="source\MiscParamsEntry.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\Result.cpp">
|
<ClCompile Include="source\MiscParamsHandler.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemGroup>
|
<ClCompile Include="source\NroHeader.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="source\NsoHeader.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="source\PartitionFsHeader.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="source\PatchMetaExtendedHeader.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="source\Result.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="source\ServiceAccessControl.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="source\ServiceAccessControlEntry.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="source\SystemCallEntry.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="source\SystemCallHandler.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="source\ThreadInfoEntry.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="source\ThreadInfoHandler.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -1,173 +1,173 @@
|
||||||
#include <nn/hac/AccessControlInfoBinary.h>
|
#include <nn/hac/AccessControlInfo.h>
|
||||||
|
|
||||||
nn::hac::AccessControlInfoBinary::AccessControlInfoBinary()
|
nn::hac::AccessControlInfo::AccessControlInfo()
|
||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
nn::hac::AccessControlInfoBinary::AccessControlInfoBinary(const AccessControlInfoBinary & other)
|
nn::hac::AccessControlInfo::AccessControlInfo(const AccessControlInfo & other)
|
||||||
{
|
{
|
||||||
*this = other;
|
*this = other;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::AccessControlInfoBinary::operator=(const AccessControlInfoBinary & other)
|
void nn::hac::AccessControlInfo::operator=(const AccessControlInfo & other)
|
||||||
{
|
{
|
||||||
mRawBinary = other.mRawBinary;
|
mRawBinary = other.mRawBinary;
|
||||||
mProgramId = other.mProgramId;
|
mProgramId = other.mProgramId;
|
||||||
mFileSystemAccessControl = other.mFileSystemAccessControl;
|
mFileSystemAccessControl = other.mFileSystemAccessControl;
|
||||||
mServiceAccessControl = other.mServiceAccessControl;
|
mServiceAccessControl = other.mServiceAccessControl;
|
||||||
mKernelCapabilities = other.mKernelCapabilities;
|
mKernelCapabilities = other.mKernelCapabilities;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nn::hac::AccessControlInfoBinary::operator==(const AccessControlInfoBinary & other) const
|
bool nn::hac::AccessControlInfo::operator==(const AccessControlInfo & other) const
|
||||||
{
|
{
|
||||||
return (mProgramId == other.mProgramId) \
|
return (mProgramId == other.mProgramId) \
|
||||||
&& (mFileSystemAccessControl == other.mFileSystemAccessControl) \
|
&& (mFileSystemAccessControl == other.mFileSystemAccessControl) \
|
||||||
&& (mServiceAccessControl == other.mServiceAccessControl) \
|
&& (mServiceAccessControl == other.mServiceAccessControl) \
|
||||||
&& (mKernelCapabilities == other.mKernelCapabilities);
|
&& (mKernelCapabilities == other.mKernelCapabilities);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nn::hac::AccessControlInfoBinary::operator!=(const AccessControlInfoBinary & other) const
|
bool nn::hac::AccessControlInfo::operator!=(const AccessControlInfo & other) const
|
||||||
{
|
{
|
||||||
return !(*this == other);
|
return !(*this == other);
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::AccessControlInfoBinary::toBytes()
|
void nn::hac::AccessControlInfo::toBytes()
|
||||||
{
|
{
|
||||||
// serialise the sections
|
// serialise the sections
|
||||||
mFileSystemAccessControl.toBytes();
|
mFileSystemAccessControl.toBytes();
|
||||||
mServiceAccessControl.toBytes();
|
mServiceAccessControl.toBytes();
|
||||||
mKernelCapabilities.toBytes();
|
mKernelCapabilities.toBytes();
|
||||||
|
|
||||||
// determine section layout
|
// determine section layout
|
||||||
struct sLayout {
|
struct sLayout {
|
||||||
uint32_t offset, size;
|
uint32_t offset, size;
|
||||||
} fac, sac, kc;
|
} fac, sac, kc;
|
||||||
|
|
||||||
fac.offset = (uint32_t)align(sizeof(sAciHeader), aci::kSectionAlignSize);
|
fac.offset = (uint32_t)align(sizeof(sAciHeader), aci::kSectionAlignSize);
|
||||||
fac.size = (uint32_t)mFileSystemAccessControl.getBytes().size();
|
fac.size = (uint32_t)mFileSystemAccessControl.getBytes().size();
|
||||||
sac.offset = (uint32_t)align(fac.offset + fac.size, aci::kSectionAlignSize);
|
sac.offset = (uint32_t)align(fac.offset + fac.size, aci::kSectionAlignSize);
|
||||||
sac.size = (uint32_t)mServiceAccessControl.getBytes().size();
|
sac.size = (uint32_t)mServiceAccessControl.getBytes().size();
|
||||||
kc.offset = (uint32_t)align(sac.offset + sac.size, aci::kSectionAlignSize);
|
kc.offset = (uint32_t)align(sac.offset + sac.size, aci::kSectionAlignSize);
|
||||||
kc.size = (uint32_t)mKernelCapabilities.getBytes().size();
|
kc.size = (uint32_t)mKernelCapabilities.getBytes().size();
|
||||||
|
|
||||||
// get total size
|
// get total size
|
||||||
size_t total_size = _MAX(_MAX(fac.offset + fac.size, sac.offset + sac.size), kc.offset + kc.size);
|
size_t total_size = _MAX(_MAX(fac.offset + fac.size, sac.offset + sac.size), kc.offset + kc.size);
|
||||||
|
|
||||||
mRawBinary.alloc(total_size);
|
mRawBinary.alloc(total_size);
|
||||||
sAciHeader* hdr = (sAciHeader*)mRawBinary.data();
|
sAciHeader* hdr = (sAciHeader*)mRawBinary.data();
|
||||||
|
|
||||||
// set type
|
// set type
|
||||||
hdr->st_magic = aci::kAciStructMagic;
|
hdr->st_magic = aci::kAciStructMagic;
|
||||||
|
|
||||||
// set program id
|
// set program id
|
||||||
hdr->program_id = mProgramId;
|
hdr->program_id = mProgramId;
|
||||||
|
|
||||||
// set offset/size
|
// set offset/size
|
||||||
hdr->fac.offset = fac.offset;
|
hdr->fac.offset = fac.offset;
|
||||||
hdr->fac.size = fac.size;
|
hdr->fac.size = fac.size;
|
||||||
hdr->sac.offset = sac.offset;
|
hdr->sac.offset = sac.offset;
|
||||||
hdr->sac.size = sac.size;
|
hdr->sac.size = sac.size;
|
||||||
hdr->kc.offset = kc.offset;
|
hdr->kc.offset = kc.offset;
|
||||||
hdr->kc.size = kc.size;
|
hdr->kc.size = kc.size;
|
||||||
|
|
||||||
// write data
|
// write data
|
||||||
memcpy(mRawBinary.data() + fac.offset, mFileSystemAccessControl.getBytes().data(), fac.size);
|
memcpy(mRawBinary.data() + fac.offset, mFileSystemAccessControl.getBytes().data(), fac.size);
|
||||||
memcpy(mRawBinary.data() + sac.offset, mServiceAccessControl.getBytes().data(), sac.size);
|
memcpy(mRawBinary.data() + sac.offset, mServiceAccessControl.getBytes().data(), sac.size);
|
||||||
memcpy(mRawBinary.data() + kc.offset, mKernelCapabilities.getBytes().data(), kc.size);
|
memcpy(mRawBinary.data() + kc.offset, mKernelCapabilities.getBytes().data(), kc.size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::AccessControlInfoBinary::fromBytes(const byte_t* data, size_t len)
|
void nn::hac::AccessControlInfo::fromBytes(const byte_t* data, size_t len)
|
||||||
{
|
{
|
||||||
// check size
|
// check size
|
||||||
if (len < sizeof(sAciHeader))
|
if (len < sizeof(sAciHeader))
|
||||||
{
|
{
|
||||||
throw fnd::Exception(kModuleName, "AccessControlInfo binary is too small");
|
throw fnd::Exception(kModuleName, "AccessControlInfo binary is too small");
|
||||||
}
|
}
|
||||||
|
|
||||||
// clear variables
|
// clear variables
|
||||||
clear();
|
clear();
|
||||||
|
|
||||||
// save a copy of the header
|
// save a copy of the header
|
||||||
sAciHeader hdr;
|
sAciHeader hdr;
|
||||||
memcpy((void*)&hdr, data, sizeof(sAciHeader));
|
memcpy((void*)&hdr, data, sizeof(sAciHeader));
|
||||||
|
|
||||||
// check magic
|
// check magic
|
||||||
if (hdr.st_magic.get() != aci::kAciStructMagic)
|
if (hdr.st_magic.get() != aci::kAciStructMagic)
|
||||||
{
|
{
|
||||||
throw fnd::Exception(kModuleName, "AccessControlInfo header corrupt");
|
throw fnd::Exception(kModuleName, "AccessControlInfo header corrupt");
|
||||||
}
|
}
|
||||||
|
|
||||||
// get total size
|
// get total size
|
||||||
size_t total_size = _MAX(_MAX(hdr.fac.offset.get() + hdr.fac.size.get(), hdr.sac.offset.get() + hdr.sac.size.get()), hdr.kc.offset.get() + hdr.kc.size.get());
|
size_t total_size = _MAX(_MAX(hdr.fac.offset.get() + hdr.fac.size.get(), hdr.sac.offset.get() + hdr.sac.size.get()), hdr.kc.offset.get() + hdr.kc.size.get());
|
||||||
|
|
||||||
// validate binary size
|
// validate binary size
|
||||||
if (len < total_size)
|
if (len < total_size)
|
||||||
{
|
{
|
||||||
throw fnd::Exception(kModuleName, "AccessControlInfo binary is too small");
|
throw fnd::Exception(kModuleName, "AccessControlInfo binary is too small");
|
||||||
}
|
}
|
||||||
|
|
||||||
// allocate memory for header
|
// allocate memory for header
|
||||||
mRawBinary.alloc(total_size);
|
mRawBinary.alloc(total_size);
|
||||||
memcpy(mRawBinary.data(), data, mRawBinary.size());
|
memcpy(mRawBinary.data(), data, mRawBinary.size());
|
||||||
|
|
||||||
// save variables
|
// save variables
|
||||||
mProgramId = hdr.program_id.get();
|
mProgramId = hdr.program_id.get();
|
||||||
mFileSystemAccessControl.fromBytes(mRawBinary.data() + hdr.fac.offset.get(), hdr.fac.size.get());
|
mFileSystemAccessControl.fromBytes(mRawBinary.data() + hdr.fac.offset.get(), hdr.fac.size.get());
|
||||||
mServiceAccessControl.fromBytes(mRawBinary.data() + hdr.sac.offset.get(), hdr.sac.size.get());
|
mServiceAccessControl.fromBytes(mRawBinary.data() + hdr.sac.offset.get(), hdr.sac.size.get());
|
||||||
mKernelCapabilities.fromBytes(mRawBinary.data() + hdr.kc.offset.get(), hdr.kc.size.get());
|
mKernelCapabilities.fromBytes(mRawBinary.data() + hdr.kc.offset.get(), hdr.kc.size.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
const fnd::Vec<byte_t>& nn::hac::AccessControlInfoBinary::getBytes() const
|
const fnd::Vec<byte_t>& nn::hac::AccessControlInfo::getBytes() const
|
||||||
{
|
{
|
||||||
return mRawBinary;
|
return mRawBinary;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::AccessControlInfoBinary::clear()
|
void nn::hac::AccessControlInfo::clear()
|
||||||
{
|
{
|
||||||
mRawBinary.clear();
|
mRawBinary.clear();
|
||||||
mProgramId = 0;
|
mProgramId = 0;
|
||||||
mFileSystemAccessControl.clear();
|
mFileSystemAccessControl.clear();
|
||||||
mServiceAccessControl.clear();
|
mServiceAccessControl.clear();
|
||||||
mKernelCapabilities.clear();
|
mKernelCapabilities.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t nn::hac::AccessControlInfoBinary::getProgramId() const
|
uint64_t nn::hac::AccessControlInfo::getProgramId() const
|
||||||
{
|
{
|
||||||
return mProgramId;
|
return mProgramId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::AccessControlInfoBinary::setProgramId(uint64_t program_id)
|
void nn::hac::AccessControlInfo::setProgramId(uint64_t program_id)
|
||||||
{
|
{
|
||||||
mProgramId = program_id;
|
mProgramId = program_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
const nn::hac::FileSystemAccessControlBinary& nn::hac::AccessControlInfoBinary::getFileSystemAccessControl() const
|
const nn::hac::FileSystemAccessControl& nn::hac::AccessControlInfo::getFileSystemAccessControl() const
|
||||||
{
|
{
|
||||||
return mFileSystemAccessControl;
|
return mFileSystemAccessControl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::AccessControlInfoBinary::setFileSystemAccessControl(const nn::hac::FileSystemAccessControlBinary& fac)
|
void nn::hac::AccessControlInfo::setFileSystemAccessControl(const nn::hac::FileSystemAccessControl& fac)
|
||||||
{
|
{
|
||||||
mFileSystemAccessControl = fac;
|
mFileSystemAccessControl = fac;
|
||||||
}
|
}
|
||||||
|
|
||||||
const nn::hac::ServiceAccessControlBinary& nn::hac::AccessControlInfoBinary::getServiceAccessControl() const
|
const nn::hac::ServiceAccessControl& nn::hac::AccessControlInfo::getServiceAccessControl() const
|
||||||
{
|
{
|
||||||
return mServiceAccessControl;
|
return mServiceAccessControl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::AccessControlInfoBinary::setServiceAccessControl(const nn::hac::ServiceAccessControlBinary& sac)
|
void nn::hac::AccessControlInfo::setServiceAccessControl(const nn::hac::ServiceAccessControl& sac)
|
||||||
{
|
{
|
||||||
mServiceAccessControl = sac;
|
mServiceAccessControl = sac;
|
||||||
}
|
}
|
||||||
|
|
||||||
const nn::hac::KernelCapabilityBinary& nn::hac::AccessControlInfoBinary::getKernelCapabilities() const
|
const nn::hac::KernelCapabilityControl& nn::hac::AccessControlInfo::getKernelCapabilities() const
|
||||||
{
|
{
|
||||||
return mKernelCapabilities;
|
return mKernelCapabilities;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::AccessControlInfoBinary::setKernelCapabilities(const nn::hac::KernelCapabilityBinary& kc)
|
void nn::hac::AccessControlInfo::setKernelCapabilities(const nn::hac::KernelCapabilityControl& kc)
|
||||||
{
|
{
|
||||||
mKernelCapabilities = kc;
|
mKernelCapabilities = kc;
|
||||||
}
|
}
|
|
@ -1,251 +1,251 @@
|
||||||
#include <nn/hac/AccessControlInfoDescBinary.h>
|
#include <nn/hac/AccessControlInfoDesc.h>
|
||||||
|
|
||||||
nn::hac::AccessControlInfoDescBinary::AccessControlInfoDescBinary()
|
nn::hac::AccessControlInfoDesc::AccessControlInfoDesc()
|
||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
nn::hac::AccessControlInfoDescBinary::AccessControlInfoDescBinary(const AccessControlInfoDescBinary & other)
|
nn::hac::AccessControlInfoDesc::AccessControlInfoDesc(const AccessControlInfoDesc & other)
|
||||||
{
|
{
|
||||||
*this = other;
|
*this = other;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::AccessControlInfoDescBinary::operator=(const AccessControlInfoDescBinary & other)
|
void nn::hac::AccessControlInfoDesc::operator=(const AccessControlInfoDesc & other)
|
||||||
{
|
{
|
||||||
mRawBinary = other.mRawBinary;
|
mRawBinary = other.mRawBinary;
|
||||||
mNcaHeaderSignature2Key = other.mNcaHeaderSignature2Key;
|
mContentArchiveHeaderSignature2Key = other.mContentArchiveHeaderSignature2Key;
|
||||||
mFlags = other.mFlags;
|
mFlags = other.mFlags;
|
||||||
mProgramIdRestrict = other.mProgramIdRestrict;
|
mProgramIdRestrict = other.mProgramIdRestrict;
|
||||||
mFileSystemAccessControl = other.mFileSystemAccessControl;
|
mFileSystemAccessControl = other.mFileSystemAccessControl;
|
||||||
mServiceAccessControl = other.mServiceAccessControl;
|
mServiceAccessControl = other.mServiceAccessControl;
|
||||||
mKernelCapabilities = other.mKernelCapabilities;
|
mKernelCapabilities = other.mKernelCapabilities;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nn::hac::AccessControlInfoDescBinary::operator==(const AccessControlInfoDescBinary & other) const
|
bool nn::hac::AccessControlInfoDesc::operator==(const AccessControlInfoDesc & other) const
|
||||||
{
|
{
|
||||||
return (mNcaHeaderSignature2Key == other.mNcaHeaderSignature2Key) \
|
return (mContentArchiveHeaderSignature2Key == other.mContentArchiveHeaderSignature2Key) \
|
||||||
&& (mFlags == other.mFlags) \
|
&& (mFlags == other.mFlags) \
|
||||||
&& (mProgramIdRestrict == other.mProgramIdRestrict) \
|
&& (mProgramIdRestrict == other.mProgramIdRestrict) \
|
||||||
&& (mFileSystemAccessControl == other.mFileSystemAccessControl) \
|
&& (mFileSystemAccessControl == other.mFileSystemAccessControl) \
|
||||||
&& (mServiceAccessControl == other.mServiceAccessControl) \
|
&& (mServiceAccessControl == other.mServiceAccessControl) \
|
||||||
&& (mKernelCapabilities == other.mKernelCapabilities);
|
&& (mKernelCapabilities == other.mKernelCapabilities);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nn::hac::AccessControlInfoDescBinary::operator!=(const AccessControlInfoDescBinary & other) const
|
bool nn::hac::AccessControlInfoDesc::operator!=(const AccessControlInfoDesc & other) const
|
||||||
{
|
{
|
||||||
return !(*this == other);
|
return !(*this == other);
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::AccessControlInfoDescBinary::toBytes()
|
void nn::hac::AccessControlInfoDesc::toBytes()
|
||||||
{
|
{
|
||||||
// serialise the sections
|
// serialise the sections
|
||||||
mFileSystemAccessControl.toBytes();
|
mFileSystemAccessControl.toBytes();
|
||||||
mServiceAccessControl.toBytes();
|
mServiceAccessControl.toBytes();
|
||||||
mKernelCapabilities.toBytes();
|
mKernelCapabilities.toBytes();
|
||||||
|
|
||||||
// determine section layout
|
// determine section layout
|
||||||
struct sLayout {
|
struct sLayout {
|
||||||
uint32_t offset, size;
|
uint32_t offset, size;
|
||||||
} fac, sac, kc;
|
} fac, sac, kc;
|
||||||
|
|
||||||
fac.offset = (uint32_t)align(sizeof(sAciDescHeader), aci::kSectionAlignSize);
|
fac.offset = (uint32_t)align(sizeof(sAciDescHeader), aci::kSectionAlignSize);
|
||||||
fac.size = (uint32_t)mFileSystemAccessControl.getBytes().size();
|
fac.size = (uint32_t)mFileSystemAccessControl.getBytes().size();
|
||||||
sac.offset = (uint32_t)align(fac.offset + fac.size, aci::kSectionAlignSize);
|
sac.offset = (uint32_t)align(fac.offset + fac.size, aci::kSectionAlignSize);
|
||||||
sac.size = (uint32_t)mServiceAccessControl.getBytes().size();
|
sac.size = (uint32_t)mServiceAccessControl.getBytes().size();
|
||||||
kc.offset = (uint32_t)align(sac.offset + sac.size, aci::kSectionAlignSize);
|
kc.offset = (uint32_t)align(sac.offset + sac.size, aci::kSectionAlignSize);
|
||||||
kc.size = (uint32_t)mKernelCapabilities.getBytes().size();
|
kc.size = (uint32_t)mKernelCapabilities.getBytes().size();
|
||||||
|
|
||||||
// get total size
|
// get total size
|
||||||
size_t total_size = _MAX(_MAX(fac.offset + fac.size, sac.offset + sac.size), kc.offset + kc.size);
|
size_t total_size = _MAX(_MAX(fac.offset + fac.size, sac.offset + sac.size), kc.offset + kc.size);
|
||||||
|
|
||||||
mRawBinary.alloc(total_size);
|
mRawBinary.alloc(total_size);
|
||||||
sAciDescHeader* hdr = (sAciDescHeader*)mRawBinary.data();
|
sAciDescHeader* hdr = (sAciDescHeader*)mRawBinary.data();
|
||||||
|
|
||||||
// set rsa modulus
|
// set rsa modulus
|
||||||
memcpy(hdr->nca_rsa_signature2_modulus, mNcaHeaderSignature2Key.modulus, fnd::rsa::kRsa2048Size);
|
memcpy(hdr->nca_rsa_signature2_modulus, mContentArchiveHeaderSignature2Key.modulus, fnd::rsa::kRsa2048Size);
|
||||||
|
|
||||||
// set type
|
// set type
|
||||||
hdr->st_magic = aci::kAciDescStructMagic;
|
hdr->st_magic = aci::kAciDescStructMagic;
|
||||||
|
|
||||||
// set "acid size"
|
// set "acid size"
|
||||||
hdr->signed_size = (uint32_t)(total_size - fnd::rsa::kRsa2048Size);
|
hdr->signed_size = (uint32_t)(total_size - fnd::rsa::kRsa2048Size);
|
||||||
|
|
||||||
// set flags
|
// set flags
|
||||||
uint32_t flags = 0;
|
uint32_t flags = 0;
|
||||||
for (size_t i = 0; i < mFlags.size(); i++)
|
for (size_t i = 0; i < mFlags.size(); i++)
|
||||||
flags |= _BIT(mFlags[i]);
|
flags |= _BIT(mFlags[i]);
|
||||||
hdr->flags = flags;
|
hdr->flags = flags;
|
||||||
|
|
||||||
// set program id restrict settings
|
// set program id restrict settings
|
||||||
hdr->program_id_min = mProgramIdRestrict.min;
|
hdr->program_id_min = mProgramIdRestrict.min;
|
||||||
hdr->program_id_max = mProgramIdRestrict.max;
|
hdr->program_id_max = mProgramIdRestrict.max;
|
||||||
|
|
||||||
// set offset/size
|
// set offset/size
|
||||||
hdr->fac.offset = fac.offset;
|
hdr->fac.offset = fac.offset;
|
||||||
hdr->fac.size = fac.size;
|
hdr->fac.size = fac.size;
|
||||||
hdr->sac.offset = sac.offset;
|
hdr->sac.offset = sac.offset;
|
||||||
hdr->sac.size = sac.size;
|
hdr->sac.size = sac.size;
|
||||||
hdr->kc.offset = kc.offset;
|
hdr->kc.offset = kc.offset;
|
||||||
hdr->kc.size = kc.size;
|
hdr->kc.size = kc.size;
|
||||||
|
|
||||||
// write data
|
// write data
|
||||||
memcpy(mRawBinary.data() + fac.offset, mFileSystemAccessControl.getBytes().data(), fac.size);
|
memcpy(mRawBinary.data() + fac.offset, mFileSystemAccessControl.getBytes().data(), fac.size);
|
||||||
memcpy(mRawBinary.data() + sac.offset, mServiceAccessControl.getBytes().data(), sac.size);
|
memcpy(mRawBinary.data() + sac.offset, mServiceAccessControl.getBytes().data(), sac.size);
|
||||||
memcpy(mRawBinary.data() + kc.offset, mKernelCapabilities.getBytes().data(), kc.size);
|
memcpy(mRawBinary.data() + kc.offset, mKernelCapabilities.getBytes().data(), kc.size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::AccessControlInfoDescBinary::fromBytes(const byte_t* data, size_t len)
|
void nn::hac::AccessControlInfoDesc::fromBytes(const byte_t* data, size_t len)
|
||||||
{
|
{
|
||||||
// check size
|
// check size
|
||||||
if (len < sizeof(sAciDescHeader))
|
if (len < sizeof(sAciDescHeader))
|
||||||
{
|
{
|
||||||
throw fnd::Exception(kModuleName, "AccessControlInfoDesc binary is too small");
|
throw fnd::Exception(kModuleName, "AccessControlInfoDesc binary is too small");
|
||||||
}
|
}
|
||||||
|
|
||||||
// clear variables
|
// clear variables
|
||||||
clear();
|
clear();
|
||||||
|
|
||||||
// save a copy of the header
|
// save a copy of the header
|
||||||
sAciDescHeader hdr;
|
sAciDescHeader hdr;
|
||||||
memcpy((void*)&hdr, data, sizeof(sAciDescHeader));
|
memcpy((void*)&hdr, data, sizeof(sAciDescHeader));
|
||||||
|
|
||||||
// check magic
|
// check magic
|
||||||
if (hdr.st_magic.get() != aci::kAciDescStructMagic)
|
if (hdr.st_magic.get() != aci::kAciDescStructMagic)
|
||||||
{
|
{
|
||||||
throw fnd::Exception(kModuleName, "AccessControlInfoDesc header corrupt");
|
throw fnd::Exception(kModuleName, "AccessControlInfoDesc header corrupt");
|
||||||
}
|
}
|
||||||
|
|
||||||
// get total size
|
// get total size
|
||||||
size_t total_size = _MAX(_MAX(hdr.fac.offset.get() + hdr.fac.size.get(), hdr.sac.offset.get() + hdr.sac.size.get()), hdr.kc.offset.get() + hdr.kc.size.get());
|
size_t total_size = _MAX(_MAX(hdr.fac.offset.get() + hdr.fac.size.get(), hdr.sac.offset.get() + hdr.sac.size.get()), hdr.kc.offset.get() + hdr.kc.size.get());
|
||||||
|
|
||||||
// validate binary size
|
// validate binary size
|
||||||
if (len < total_size)
|
if (len < total_size)
|
||||||
{
|
{
|
||||||
throw fnd::Exception(kModuleName, "AccessControlInfoDesc binary is too small");
|
throw fnd::Exception(kModuleName, "AccessControlInfoDesc binary is too small");
|
||||||
}
|
}
|
||||||
|
|
||||||
// allocate memory for header
|
// allocate memory for header
|
||||||
mRawBinary.alloc(total_size);
|
mRawBinary.alloc(total_size);
|
||||||
memcpy(mRawBinary.data(), data, mRawBinary.size());
|
memcpy(mRawBinary.data(), data, mRawBinary.size());
|
||||||
|
|
||||||
// save variables
|
// save variables
|
||||||
memcpy(mNcaHeaderSignature2Key.modulus, hdr.nca_rsa_signature2_modulus, fnd::rsa::kRsa2048Size);
|
memcpy(mContentArchiveHeaderSignature2Key.modulus, hdr.nca_rsa_signature2_modulus, fnd::rsa::kRsa2048Size);
|
||||||
|
|
||||||
for (size_t i = 0; i < 32; i++)
|
for (size_t i = 0; i < 32; i++)
|
||||||
{
|
{
|
||||||
if (_HAS_BIT(hdr.flags.get(), i))
|
if (_HAS_BIT(hdr.flags.get(), i))
|
||||||
mFlags.addElement((aci::Flag)i);
|
mFlags.addElement((aci::Flag)i);
|
||||||
}
|
}
|
||||||
|
|
||||||
mProgramIdRestrict.min = hdr.program_id_min.get();
|
mProgramIdRestrict.min = hdr.program_id_min.get();
|
||||||
mProgramIdRestrict.max = hdr.program_id_max.get();
|
mProgramIdRestrict.max = hdr.program_id_max.get();
|
||||||
|
|
||||||
mFileSystemAccessControl.fromBytes(mRawBinary.data() + hdr.fac.offset.get(), hdr.fac.size.get());
|
mFileSystemAccessControl.fromBytes(mRawBinary.data() + hdr.fac.offset.get(), hdr.fac.size.get());
|
||||||
mServiceAccessControl.fromBytes(mRawBinary.data() + hdr.sac.offset.get(), hdr.sac.size.get());
|
mServiceAccessControl.fromBytes(mRawBinary.data() + hdr.sac.offset.get(), hdr.sac.size.get());
|
||||||
mKernelCapabilities.fromBytes(mRawBinary.data() + hdr.kc.offset.get(), hdr.kc.size.get());
|
mKernelCapabilities.fromBytes(mRawBinary.data() + hdr.kc.offset.get(), hdr.kc.size.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
const fnd::Vec<byte_t>& nn::hac::AccessControlInfoDescBinary::getBytes() const
|
const fnd::Vec<byte_t>& nn::hac::AccessControlInfoDesc::getBytes() const
|
||||||
{
|
{
|
||||||
return mRawBinary;
|
return mRawBinary;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::AccessControlInfoDescBinary::generateSignature(const fnd::rsa::sRsa2048Key& key)
|
void nn::hac::AccessControlInfoDesc::generateSignature(const fnd::rsa::sRsa2048Key& key)
|
||||||
{
|
{
|
||||||
if (mRawBinary.size() == 0)
|
if (mRawBinary.size() == 0)
|
||||||
toBytes();
|
toBytes();
|
||||||
|
|
||||||
byte_t hash[fnd::sha::kSha256HashLen];
|
byte_t hash[fnd::sha::kSha256HashLen];
|
||||||
fnd::sha::Sha256(mRawBinary.data() + fnd::rsa::kRsa2048Size, mRawBinary.size() - fnd::rsa::kRsa2048Size, hash);
|
fnd::sha::Sha256(mRawBinary.data() + fnd::rsa::kRsa2048Size, mRawBinary.size() - fnd::rsa::kRsa2048Size, hash);
|
||||||
|
|
||||||
if (fnd::rsa::pss::rsaSign(key, fnd::sha::HASH_SHA256, hash, mRawBinary.data()) != 0)
|
if (fnd::rsa::pss::rsaSign(key, fnd::sha::HASH_SHA256, hash, mRawBinary.data()) != 0)
|
||||||
{
|
{
|
||||||
throw fnd::Exception(kModuleName, "Failed to sign Access Control Info Desc");
|
throw fnd::Exception(kModuleName, "Failed to sign Access Control Info Desc");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::AccessControlInfoDescBinary::validateSignature(const fnd::rsa::sRsa2048Key& key) const
|
void nn::hac::AccessControlInfoDesc::validateSignature(const fnd::rsa::sRsa2048Key& key) const
|
||||||
{
|
{
|
||||||
if (mRawBinary.size() == 0)
|
if (mRawBinary.size() == 0)
|
||||||
throw fnd::Exception(kModuleName, "No Access Control Info Desc binary exists to verify");
|
throw fnd::Exception(kModuleName, "No Access Control Info Desc binary exists to verify");
|
||||||
|
|
||||||
byte_t hash[fnd::sha::kSha256HashLen];
|
byte_t hash[fnd::sha::kSha256HashLen];
|
||||||
fnd::sha::Sha256(mRawBinary.data() + fnd::rsa::kRsa2048Size, mRawBinary.size() - fnd::rsa::kRsa2048Size, hash);
|
fnd::sha::Sha256(mRawBinary.data() + fnd::rsa::kRsa2048Size, mRawBinary.size() - fnd::rsa::kRsa2048Size, hash);
|
||||||
|
|
||||||
if (fnd::rsa::pss::rsaVerify(key, fnd::sha::HASH_SHA256, hash, mRawBinary.data()) != 0)
|
if (fnd::rsa::pss::rsaVerify(key, fnd::sha::HASH_SHA256, hash, mRawBinary.data()) != 0)
|
||||||
{
|
{
|
||||||
throw fnd::Exception(kModuleName, "Failed to verify Access Control Info Desc");
|
throw fnd::Exception(kModuleName, "Failed to verify Access Control Info Desc");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::AccessControlInfoDescBinary::clear()
|
void nn::hac::AccessControlInfoDesc::clear()
|
||||||
{
|
{
|
||||||
mRawBinary.clear();
|
mRawBinary.clear();
|
||||||
memset((void*)&mNcaHeaderSignature2Key, 0, sizeof(mNcaHeaderSignature2Key));
|
memset((void*)&mContentArchiveHeaderSignature2Key, 0, sizeof(mContentArchiveHeaderSignature2Key));
|
||||||
mFlags.clear();
|
mFlags.clear();
|
||||||
mProgramIdRestrict.min = 0;
|
mProgramIdRestrict.min = 0;
|
||||||
mProgramIdRestrict.max = 0;
|
mProgramIdRestrict.max = 0;
|
||||||
mFileSystemAccessControl.clear();
|
mFileSystemAccessControl.clear();
|
||||||
mServiceAccessControl.clear();
|
mServiceAccessControl.clear();
|
||||||
mKernelCapabilities.clear();
|
mKernelCapabilities.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
const fnd::rsa::sRsa2048Key& nn::hac::AccessControlInfoDescBinary::getNcaHeaderSignature2Key() const
|
const fnd::rsa::sRsa2048Key& nn::hac::AccessControlInfoDesc::getContentArchiveHeaderSignature2Key() const
|
||||||
{
|
{
|
||||||
return mNcaHeaderSignature2Key;
|
return mContentArchiveHeaderSignature2Key;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::AccessControlInfoDescBinary::setNcaHeaderSignature2Key(const fnd::rsa::sRsa2048Key& key)
|
void nn::hac::AccessControlInfoDesc::setContentArchiveHeaderSignature2Key(const fnd::rsa::sRsa2048Key& key)
|
||||||
{
|
{
|
||||||
mNcaHeaderSignature2Key = key;
|
mContentArchiveHeaderSignature2Key = key;
|
||||||
}
|
}
|
||||||
|
|
||||||
const fnd::List<nn::hac::aci::Flag>& nn::hac::AccessControlInfoDescBinary::getFlagList() const
|
const fnd::List<nn::hac::aci::Flag>& nn::hac::AccessControlInfoDesc::getFlagList() const
|
||||||
{
|
{
|
||||||
return mFlags;
|
return mFlags;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::AccessControlInfoDescBinary::setFlagList(const fnd::List<nn::hac::aci::Flag>& flags)
|
void nn::hac::AccessControlInfoDesc::setFlagList(const fnd::List<nn::hac::aci::Flag>& flags)
|
||||||
{
|
{
|
||||||
mFlags = flags;
|
mFlags = flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
const nn::hac::AccessControlInfoDescBinary::sProgramIdRestrict& nn::hac::AccessControlInfoDescBinary::getProgramIdRestrict() const
|
const nn::hac::AccessControlInfoDesc::sProgramIdRestrict& nn::hac::AccessControlInfoDesc::getProgramIdRestrict() const
|
||||||
{
|
{
|
||||||
return mProgramIdRestrict;
|
return mProgramIdRestrict;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::AccessControlInfoDescBinary::setProgramIdRestrict(const sProgramIdRestrict& pid_restrict)
|
void nn::hac::AccessControlInfoDesc::setProgramIdRestrict(const sProgramIdRestrict& pid_restrict)
|
||||||
{
|
{
|
||||||
mProgramIdRestrict = pid_restrict;
|
mProgramIdRestrict = pid_restrict;
|
||||||
}
|
}
|
||||||
|
|
||||||
const nn::hac::FileSystemAccessControlBinary& nn::hac::AccessControlInfoDescBinary::getFileSystemAccessControl() const
|
const nn::hac::FileSystemAccessControl& nn::hac::AccessControlInfoDesc::getFileSystemAccessControl() const
|
||||||
{
|
{
|
||||||
return mFileSystemAccessControl;
|
return mFileSystemAccessControl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::AccessControlInfoDescBinary::setFileSystemAccessControl(const nn::hac::FileSystemAccessControlBinary& fac)
|
void nn::hac::AccessControlInfoDesc::setFileSystemAccessControl(const nn::hac::FileSystemAccessControl& fac)
|
||||||
{
|
{
|
||||||
mFileSystemAccessControl = fac;
|
mFileSystemAccessControl = fac;
|
||||||
}
|
}
|
||||||
|
|
||||||
const nn::hac::ServiceAccessControlBinary& nn::hac::AccessControlInfoDescBinary::getServiceAccessControl() const
|
const nn::hac::ServiceAccessControl& nn::hac::AccessControlInfoDesc::getServiceAccessControl() const
|
||||||
{
|
{
|
||||||
return mServiceAccessControl;
|
return mServiceAccessControl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::AccessControlInfoDescBinary::setServiceAccessControl(const nn::hac::ServiceAccessControlBinary& sac)
|
void nn::hac::AccessControlInfoDesc::setServiceAccessControl(const nn::hac::ServiceAccessControl& sac)
|
||||||
{
|
{
|
||||||
mServiceAccessControl = sac;
|
mServiceAccessControl = sac;
|
||||||
}
|
}
|
||||||
|
|
||||||
const nn::hac::KernelCapabilityBinary& nn::hac::AccessControlInfoDescBinary::getKernelCapabilities() const
|
const nn::hac::KernelCapabilityControl& nn::hac::AccessControlInfoDesc::getKernelCapabilities() const
|
||||||
{
|
{
|
||||||
return mKernelCapabilities;
|
return mKernelCapabilities;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::AccessControlInfoDescBinary::setKernelCapabilities(const nn::hac::KernelCapabilityBinary& kc)
|
void nn::hac::AccessControlInfoDesc::setKernelCapabilities(const nn::hac::KernelCapabilityControl& kc)
|
||||||
{
|
{
|
||||||
mKernelCapabilities = kc;
|
mKernelCapabilities = kc;
|
||||||
}
|
}
|
84
lib/libhac/source/AddOnContentMetaExtendedHeader.cpp
Normal file
84
lib/libhac/source/AddOnContentMetaExtendedHeader.cpp
Normal file
|
@ -0,0 +1,84 @@
|
||||||
|
#include <nn/hac/AddOnContentMetaExtendedHeader.h>
|
||||||
|
|
||||||
|
nn::hac::AddOnContentMetaExtendedHeader::AddOnContentMetaExtendedHeader()
|
||||||
|
{
|
||||||
|
clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
nn::hac::AddOnContentMetaExtendedHeader::AddOnContentMetaExtendedHeader(const AddOnContentMetaExtendedHeader& other)
|
||||||
|
{
|
||||||
|
*this = other;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::AddOnContentMetaExtendedHeader::operator=(const AddOnContentMetaExtendedHeader& other)
|
||||||
|
{
|
||||||
|
clear();
|
||||||
|
mRawBinary = other.mRawBinary;
|
||||||
|
mApplicationId = other.mApplicationId;
|
||||||
|
mRequiredApplicationVersion = other.mRequiredApplicationVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool nn::hac::AddOnContentMetaExtendedHeader::operator==(const AddOnContentMetaExtendedHeader& other) const
|
||||||
|
{
|
||||||
|
return (mApplicationId == other.mApplicationId) \
|
||||||
|
&& (mRequiredApplicationVersion == other.mRequiredApplicationVersion);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool nn::hac::AddOnContentMetaExtendedHeader::operator!=(const AddOnContentMetaExtendedHeader& other) const
|
||||||
|
{
|
||||||
|
return !(*this == other);
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::AddOnContentMetaExtendedHeader::toBytes()
|
||||||
|
{
|
||||||
|
mRawBinary.alloc(sizeof(sAddOnContentMetaExtendedHeader));
|
||||||
|
sAddOnContentMetaExtendedHeader* info = (sAddOnContentMetaExtendedHeader*)mRawBinary.data();
|
||||||
|
|
||||||
|
info->application_id = mApplicationId;
|
||||||
|
info->required_application_version = mRequiredApplicationVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::AddOnContentMetaExtendedHeader::fromBytes(const byte_t* bytes, size_t len)
|
||||||
|
{
|
||||||
|
if (len < sizeof(sAddOnContentMetaExtendedHeader))
|
||||||
|
{
|
||||||
|
throw fnd::Exception(kModuleName, "AddOnContentMetaExtendedHeader too small");
|
||||||
|
}
|
||||||
|
|
||||||
|
const sAddOnContentMetaExtendedHeader* info = (const sAddOnContentMetaExtendedHeader*)bytes;
|
||||||
|
|
||||||
|
mApplicationId = info->application_id.get();
|
||||||
|
mRequiredApplicationVersion = info->required_application_version.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
const fnd::Vec<byte_t>& nn::hac::AddOnContentMetaExtendedHeader::getBytes() const
|
||||||
|
{
|
||||||
|
return mRawBinary;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::AddOnContentMetaExtendedHeader::clear()
|
||||||
|
{
|
||||||
|
mRawBinary.clear();
|
||||||
|
mApplicationId = 0;
|
||||||
|
mRequiredApplicationVersion = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t nn::hac::AddOnContentMetaExtendedHeader::getApplicationId() const
|
||||||
|
{
|
||||||
|
return mApplicationId;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::AddOnContentMetaExtendedHeader::setApplicationId(uint64_t application_id)
|
||||||
|
{
|
||||||
|
mApplicationId = application_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t nn::hac::AddOnContentMetaExtendedHeader::getRequiredApplicationVersion() const
|
||||||
|
{
|
||||||
|
return mRequiredApplicationVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::AddOnContentMetaExtendedHeader::setRequiredApplicationVersion(uint32_t sys_ver)
|
||||||
|
{
|
||||||
|
mRequiredApplicationVersion = sys_ver;
|
||||||
|
}
|
File diff suppressed because it is too large
Load diff
84
lib/libhac/source/ApplicationMetaExtendedHeader.cpp
Normal file
84
lib/libhac/source/ApplicationMetaExtendedHeader.cpp
Normal file
|
@ -0,0 +1,84 @@
|
||||||
|
#include <nn/hac/ApplicationMetaExtendedHeader.h>
|
||||||
|
|
||||||
|
nn::hac::ApplicationMetaExtendedHeader::ApplicationMetaExtendedHeader()
|
||||||
|
{
|
||||||
|
clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
nn::hac::ApplicationMetaExtendedHeader::ApplicationMetaExtendedHeader(const ApplicationMetaExtendedHeader& other)
|
||||||
|
{
|
||||||
|
*this = other;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ApplicationMetaExtendedHeader::operator=(const ApplicationMetaExtendedHeader& other)
|
||||||
|
{
|
||||||
|
clear();
|
||||||
|
mRawBinary = other.mRawBinary;
|
||||||
|
mPatchId = other.mPatchId;
|
||||||
|
mRequiredSystemVersion = other.mRequiredSystemVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool nn::hac::ApplicationMetaExtendedHeader::operator==(const ApplicationMetaExtendedHeader& other) const
|
||||||
|
{
|
||||||
|
return (mPatchId == other.mPatchId) \
|
||||||
|
&& (mRequiredSystemVersion == other.mRequiredSystemVersion);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool nn::hac::ApplicationMetaExtendedHeader::operator!=(const ApplicationMetaExtendedHeader& other) const
|
||||||
|
{
|
||||||
|
return !(*this == other);
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ApplicationMetaExtendedHeader::toBytes()
|
||||||
|
{
|
||||||
|
mRawBinary.alloc(sizeof(sApplicationMetaExtendedHeader));
|
||||||
|
sApplicationMetaExtendedHeader* info = (sApplicationMetaExtendedHeader*)mRawBinary.data();
|
||||||
|
|
||||||
|
info->patch_id = mPatchId;
|
||||||
|
info->required_system_version = mRequiredSystemVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ApplicationMetaExtendedHeader::fromBytes(const byte_t* bytes, size_t len)
|
||||||
|
{
|
||||||
|
if (len < sizeof(sApplicationMetaExtendedHeader))
|
||||||
|
{
|
||||||
|
throw fnd::Exception(kModuleName, "ApplicationMetaExtendedHeader too small");
|
||||||
|
}
|
||||||
|
|
||||||
|
const sApplicationMetaExtendedHeader* info = (const sApplicationMetaExtendedHeader*)bytes;
|
||||||
|
|
||||||
|
mPatchId = info->patch_id.get();
|
||||||
|
mRequiredSystemVersion = info->required_system_version.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
const fnd::Vec<byte_t>& nn::hac::ApplicationMetaExtendedHeader::getBytes() const
|
||||||
|
{
|
||||||
|
return mRawBinary;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ApplicationMetaExtendedHeader::clear()
|
||||||
|
{
|
||||||
|
mRawBinary.clear();
|
||||||
|
mPatchId = 0;
|
||||||
|
mRequiredSystemVersion = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t nn::hac::ApplicationMetaExtendedHeader::getPatchId() const
|
||||||
|
{
|
||||||
|
return mPatchId;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ApplicationMetaExtendedHeader::setPatchId(uint64_t application_id)
|
||||||
|
{
|
||||||
|
mPatchId = application_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t nn::hac::ApplicationMetaExtendedHeader::getRequiredSystemVersion() const
|
||||||
|
{
|
||||||
|
return mRequiredSystemVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ApplicationMetaExtendedHeader::setRequiredSystemVersion(uint32_t sys_ver)
|
||||||
|
{
|
||||||
|
mRequiredSystemVersion = sys_ver;
|
||||||
|
}
|
334
lib/libhac/source/ContentArchiveHeader.cpp
Normal file
334
lib/libhac/source/ContentArchiveHeader.cpp
Normal file
|
@ -0,0 +1,334 @@
|
||||||
|
#include <nn/hac/ContentArchiveHeader.h>
|
||||||
|
|
||||||
|
nn::hac::ContentArchiveHeader::ContentArchiveHeader()
|
||||||
|
{
|
||||||
|
mRightsId.alloc(nca::kRightsIdLen);
|
||||||
|
mKeyArea.alloc(nca::kKeyAreaSize);
|
||||||
|
clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
nn::hac::ContentArchiveHeader::ContentArchiveHeader(const ContentArchiveHeader & other) :
|
||||||
|
ContentArchiveHeader()
|
||||||
|
{
|
||||||
|
*this = other;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool nn::hac::ContentArchiveHeader::operator==(const ContentArchiveHeader & other) const
|
||||||
|
{
|
||||||
|
return (mFormatVersion == other.mFormatVersion) \
|
||||||
|
&& (mDistributionType == other.mDistributionType) \
|
||||||
|
&& (mContentType == other.mContentType) \
|
||||||
|
&& (mKeyGeneration == other.mKeyGeneration) \
|
||||||
|
&& (mKaekIndex == other.mKaekIndex) \
|
||||||
|
&& (mContentSize == other.mContentSize) \
|
||||||
|
&& (mProgramId == other.mProgramId) \
|
||||||
|
&& (mContentIndex == other.mContentIndex) \
|
||||||
|
&& (mSdkAddonVersion == other.mSdkAddonVersion) \
|
||||||
|
&& (mRightsId == other.mRightsId) \
|
||||||
|
&& (mPartitionEntryList == other.mPartitionEntryList) \
|
||||||
|
&& (mKeyArea == other.mKeyArea);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool nn::hac::ContentArchiveHeader::operator!=(const ContentArchiveHeader & other) const
|
||||||
|
{
|
||||||
|
return !(*this == other);
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentArchiveHeader::operator=(const ContentArchiveHeader & other)
|
||||||
|
{
|
||||||
|
mRawBinary = other.mRawBinary;
|
||||||
|
mDistributionType = other.mDistributionType;
|
||||||
|
mContentType = other.mContentType;
|
||||||
|
mKeyGeneration = other.mKeyGeneration;
|
||||||
|
mKaekIndex = other.mKaekIndex;
|
||||||
|
mContentSize = other.mContentSize;
|
||||||
|
mProgramId = other.mProgramId;
|
||||||
|
mContentIndex = other.mContentIndex;
|
||||||
|
mSdkAddonVersion = other.mSdkAddonVersion;
|
||||||
|
mRightsId = other.mRightsId;
|
||||||
|
mPartitionEntryList = other.mPartitionEntryList;
|
||||||
|
mKeyArea = other.mKeyArea;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentArchiveHeader::toBytes()
|
||||||
|
{
|
||||||
|
mRawBinary.alloc(sizeof(sContentArchiveHeader));
|
||||||
|
sContentArchiveHeader* hdr = (sContentArchiveHeader*)mRawBinary.data();
|
||||||
|
|
||||||
|
// set header magic
|
||||||
|
switch(mFormatVersion)
|
||||||
|
{
|
||||||
|
case (nca::FORMAT_NCA2):
|
||||||
|
hdr->st_magic = nca::kNca2StructMagic;
|
||||||
|
break;
|
||||||
|
case (nca::FORMAT_NCA3):
|
||||||
|
hdr->st_magic = nca::kNca3StructMagic;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw fnd::Exception(kModuleName, "Unsupported format version");
|
||||||
|
}
|
||||||
|
|
||||||
|
// set variables
|
||||||
|
hdr->distribution_type = mDistributionType;
|
||||||
|
hdr->content_type = mContentType;
|
||||||
|
if (mKeyGeneration > 2)
|
||||||
|
{
|
||||||
|
hdr->key_generation = 2;
|
||||||
|
hdr->key_generation_2 = mKeyGeneration;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
hdr->key_generation = mKeyGeneration;
|
||||||
|
hdr->key_generation_2 = 0;
|
||||||
|
}
|
||||||
|
hdr->key_area_encryption_key_index = mKaekIndex;
|
||||||
|
hdr->content_size = mContentSize;
|
||||||
|
hdr->program_id = mProgramId;
|
||||||
|
hdr->content_index = mContentIndex;
|
||||||
|
hdr->sdk_addon_version = mSdkAddonVersion;
|
||||||
|
memcpy(hdr->rights_id, mRightsId.data(), nca::kRightsIdLen);
|
||||||
|
memcpy(hdr->key_area, mKeyArea.data(), nca::kKeyAreaSize);
|
||||||
|
|
||||||
|
for (size_t i = 0; i < mPartitionEntryList.size(); i++)
|
||||||
|
{
|
||||||
|
byte_t index = mPartitionEntryList[i].header_index;
|
||||||
|
|
||||||
|
if (index >= nca::kPartitionNum) continue;
|
||||||
|
|
||||||
|
hdr->partition_entry[index].start_blk = sizeToBlockNum(mPartitionEntryList[index].offset);
|
||||||
|
hdr->partition_entry[index].end_blk = (sizeToBlockNum(mPartitionEntryList[index].offset) + sizeToBlockNum(mPartitionEntryList[index].size));
|
||||||
|
hdr->partition_entry[index].enabled = true;
|
||||||
|
hdr->fs_header_hash[index] = mPartitionEntryList[i].fs_header_hash;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentArchiveHeader::fromBytes(const byte_t * data, size_t len)
|
||||||
|
{
|
||||||
|
if (len < sizeof(sContentArchiveHeader))
|
||||||
|
{
|
||||||
|
throw fnd::Exception(kModuleName, "ContentArchive header size is too small");
|
||||||
|
}
|
||||||
|
|
||||||
|
clear();
|
||||||
|
|
||||||
|
mRawBinary.alloc(sizeof(sContentArchiveHeader));
|
||||||
|
memcpy(mRawBinary.data(), data, sizeof(sContentArchiveHeader));
|
||||||
|
|
||||||
|
sContentArchiveHeader* hdr = (sContentArchiveHeader*)mRawBinary.data();
|
||||||
|
|
||||||
|
// check magic
|
||||||
|
switch(hdr->st_magic.get())
|
||||||
|
{
|
||||||
|
case (nca::kNca2StructMagic) :
|
||||||
|
mFormatVersion = nca::FORMAT_NCA2;
|
||||||
|
break;
|
||||||
|
case (nca::kNca3StructMagic) :
|
||||||
|
mFormatVersion = nca::FORMAT_NCA3;
|
||||||
|
break;
|
||||||
|
throw fnd::Exception(kModuleName, "ContentArchive header corrupt (unrecognised header magic).");
|
||||||
|
}
|
||||||
|
|
||||||
|
// variables
|
||||||
|
mDistributionType = (nca::DistributionType)hdr->distribution_type;
|
||||||
|
mContentType = (nca::ContentType)hdr->content_type;
|
||||||
|
mKeyGeneration = _MAX(hdr->key_generation, hdr->key_generation_2);
|
||||||
|
mKaekIndex = hdr->key_area_encryption_key_index;
|
||||||
|
mContentSize = *hdr->content_size;
|
||||||
|
mProgramId = *hdr->program_id;
|
||||||
|
mContentIndex = *hdr->content_index;
|
||||||
|
mSdkAddonVersion = *hdr->sdk_addon_version;
|
||||||
|
memcpy(mRightsId.data(), hdr->rights_id, nca::kRightsIdLen);
|
||||||
|
memcpy(mKeyArea.data(), hdr->key_area, nca::kKeyAreaSize);
|
||||||
|
|
||||||
|
for (size_t i = 0; i < nca::kPartitionNum; i++)
|
||||||
|
{
|
||||||
|
if (hdr->partition_entry[i].enabled)
|
||||||
|
{
|
||||||
|
mPartitionEntryList.addElement({(byte_t)i, blockNumToSize(hdr->partition_entry[i].start_blk.get()), blockNumToSize(hdr->partition_entry[i].end_blk.get() - hdr->partition_entry[i].start_blk.get()), hdr->fs_header_hash[i] });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const fnd::Vec<byte_t>& nn::hac::ContentArchiveHeader::getBytes() const
|
||||||
|
{
|
||||||
|
return mRawBinary;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentArchiveHeader::clear()
|
||||||
|
{
|
||||||
|
mFormatVersion = nca::FORMAT_NCA3;
|
||||||
|
mDistributionType = nca::DIST_DOWNLOAD;
|
||||||
|
mContentType = nca::TYPE_PROGRAM;
|
||||||
|
mKeyGeneration = 0;
|
||||||
|
mKaekIndex = 0;
|
||||||
|
mContentSize = 0;
|
||||||
|
mProgramId = 0;
|
||||||
|
mContentIndex = 0;
|
||||||
|
mSdkAddonVersion = 0;
|
||||||
|
memset(mRightsId.data(), 0, mRightsId.size());
|
||||||
|
mPartitionEntryList.clear();
|
||||||
|
memset(mKeyArea.data(), 0, mKeyArea.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
byte_t nn::hac::ContentArchiveHeader::getFormatVersion() const
|
||||||
|
{
|
||||||
|
return mFormatVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentArchiveHeader::setFormatVersion(byte_t version)
|
||||||
|
{
|
||||||
|
mFormatVersion = version;
|
||||||
|
}
|
||||||
|
|
||||||
|
nn::hac::nca::DistributionType nn::hac::ContentArchiveHeader::getDistributionType() const
|
||||||
|
{
|
||||||
|
return mDistributionType;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentArchiveHeader::setDistributionType(nca::DistributionType type)
|
||||||
|
{
|
||||||
|
mDistributionType = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
nn::hac::nca::ContentType nn::hac::ContentArchiveHeader::getContentType() const
|
||||||
|
{
|
||||||
|
return mContentType;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentArchiveHeader::setContentType(nca::ContentType type)
|
||||||
|
{
|
||||||
|
mContentType = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
byte_t nn::hac::ContentArchiveHeader::getKeyGeneration() const
|
||||||
|
{
|
||||||
|
return mKeyGeneration;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentArchiveHeader::setKeyGeneration(byte_t gen)
|
||||||
|
{
|
||||||
|
mKeyGeneration = gen;
|
||||||
|
}
|
||||||
|
|
||||||
|
byte_t nn::hac::ContentArchiveHeader::getKeyAreaEncryptionKeyIndex() const
|
||||||
|
{
|
||||||
|
return mKaekIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentArchiveHeader::setKeyAreaEncryptionKeyIndex(byte_t index)
|
||||||
|
{
|
||||||
|
mKaekIndex = index;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t nn::hac::ContentArchiveHeader::getContentSize() const
|
||||||
|
{
|
||||||
|
return mContentSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentArchiveHeader::setContentSize(uint64_t size)
|
||||||
|
{
|
||||||
|
mContentSize = size;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t nn::hac::ContentArchiveHeader::getProgramId() const
|
||||||
|
{
|
||||||
|
return mProgramId;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentArchiveHeader::setProgramId(uint64_t program_id)
|
||||||
|
{
|
||||||
|
mProgramId = program_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t nn::hac::ContentArchiveHeader::getContentIndex() const
|
||||||
|
{
|
||||||
|
return mContentIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentArchiveHeader::setContentIndex(uint32_t index)
|
||||||
|
{
|
||||||
|
mContentIndex = index;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t nn::hac::ContentArchiveHeader::getSdkAddonVersion() const
|
||||||
|
{
|
||||||
|
return mSdkAddonVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentArchiveHeader::setSdkAddonVersion(uint32_t version)
|
||||||
|
{
|
||||||
|
mSdkAddonVersion = version;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool nn::hac::ContentArchiveHeader::hasRightsId() const
|
||||||
|
{
|
||||||
|
bool rightsIdIsSet = false;
|
||||||
|
|
||||||
|
for (size_t i = 0; i < nca::kRightsIdLen; i++)
|
||||||
|
{
|
||||||
|
if (mRightsId[i] != 0)
|
||||||
|
rightsIdIsSet = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return rightsIdIsSet;
|
||||||
|
}
|
||||||
|
|
||||||
|
const byte_t* nn::hac::ContentArchiveHeader::getRightsId() const
|
||||||
|
{
|
||||||
|
return mRightsId.data();
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentArchiveHeader::setRightsId(const byte_t* rights_id)
|
||||||
|
{
|
||||||
|
memcpy(mRightsId.data(), rights_id, nca::kRightsIdLen);
|
||||||
|
}
|
||||||
|
|
||||||
|
const fnd::List<nn::hac::ContentArchiveHeader::sPartitionEntry>& nn::hac::ContentArchiveHeader::getPartitionEntryList() const
|
||||||
|
{
|
||||||
|
return mPartitionEntryList;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentArchiveHeader::setPartitionEntryList(const fnd::List<nn::hac::ContentArchiveHeader::sPartitionEntry>& partition_entry_list)
|
||||||
|
{
|
||||||
|
mPartitionEntryList = partition_entry_list;
|
||||||
|
|
||||||
|
// sanity check the list
|
||||||
|
if (mPartitionEntryList.size() >= nca::kPartitionNum)
|
||||||
|
{
|
||||||
|
throw fnd::Exception(kModuleName, "Too many partitions");
|
||||||
|
}
|
||||||
|
for (size_t i = 0; i < mPartitionEntryList.size(); i++)
|
||||||
|
{
|
||||||
|
if (mPartitionEntryList[i].header_index >= nca::kPartitionNum)
|
||||||
|
{
|
||||||
|
throw fnd::Exception(kModuleName, "Illegal partition index");
|
||||||
|
}
|
||||||
|
for (size_t j = i+1; j < mPartitionEntryList.size(); j++)
|
||||||
|
{
|
||||||
|
if (mPartitionEntryList[i].header_index == mPartitionEntryList[j].header_index)
|
||||||
|
{
|
||||||
|
throw fnd::Exception(kModuleName, "Duplicated partition index");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const byte_t* nn::hac::ContentArchiveHeader::getKeyArea() const
|
||||||
|
{
|
||||||
|
return mKeyArea.data();
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentArchiveHeader::setKeyArea(const byte_t* key_area)
|
||||||
|
{
|
||||||
|
memcpy(mKeyArea.data(), key_area, nca::kKeyAreaSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t nn::hac::ContentArchiveHeader::blockNumToSize(uint32_t block_num) const
|
||||||
|
{
|
||||||
|
return block_num * nca::kSectorSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t nn::hac::ContentArchiveHeader::sizeToBlockNum(uint64_t real_size) const
|
||||||
|
{
|
||||||
|
return (uint32_t)(align(real_size, nca::kSectorSize) / nca::kSectorSize);
|
||||||
|
}
|
|
@ -1,58 +1,58 @@
|
||||||
#include <nn/hac/NcaUtils.h>
|
#include <nn/hac/ContentArchiveUtils.h>
|
||||||
|
|
||||||
void nn::hac::NcaUtils::decryptNcaHeader(const byte_t* src, byte_t* dst, const fnd::aes::sAesXts128Key& key)
|
void nn::hac::ContentArchiveUtils::decryptContentArchiveHeader(const byte_t* src, byte_t* dst, const fnd::aes::sAesXts128Key& key)
|
||||||
{
|
{
|
||||||
byte_t tweak[fnd::aes::kAesBlockSize];
|
byte_t tweak[fnd::aes::kAesBlockSize];
|
||||||
|
|
||||||
// decrypt main header
|
// decrypt main header
|
||||||
byte_t raw_hdr[nn::hac::nca::kSectorSize];
|
byte_t raw_hdr[nn::hac::nca::kSectorSize];
|
||||||
fnd::aes::AesXtsMakeTweak(tweak, 1);
|
fnd::aes::AesXtsMakeTweak(tweak, 1);
|
||||||
fnd::aes::AesXtsDecryptSector(src + sectorToOffset(1), nn::hac::nca::kSectorSize, key.key[0], key.key[1], tweak, raw_hdr);
|
fnd::aes::AesXtsDecryptSector(src + sectorToOffset(1), nn::hac::nca::kSectorSize, key.key[0], key.key[1], tweak, raw_hdr);
|
||||||
|
|
||||||
bool useNca2SectorIndex = ((nn::hac::sNcaHeader*)(raw_hdr))->st_magic.get() == nn::hac::nca::kNca2StructMagic;
|
bool useNca2SectorIndex = ((nn::hac::sContentArchiveHeader*)(raw_hdr))->st_magic.get() == nn::hac::nca::kNca2StructMagic;
|
||||||
|
|
||||||
// decrypt whole header
|
// decrypt whole header
|
||||||
for (size_t i = 0; i < nn::hac::nca::kHeaderSectorNum; i++)
|
for (size_t i = 0; i < nn::hac::nca::kHeaderSectorNum; i++)
|
||||||
{
|
{
|
||||||
fnd::aes::AesXtsMakeTweak(tweak, (i > 1 && useNca2SectorIndex)? 0 : i);
|
fnd::aes::AesXtsMakeTweak(tweak, (i > 1 && useNca2SectorIndex)? 0 : i);
|
||||||
fnd::aes::AesXtsDecryptSector(src + sectorToOffset(i), nn::hac::nca::kSectorSize, key.key[0], key.key[1], tweak, dst + sectorToOffset(i));
|
fnd::aes::AesXtsDecryptSector(src + sectorToOffset(i), nn::hac::nca::kSectorSize, key.key[0], key.key[1], tweak, dst + sectorToOffset(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
byte_t nn::hac::NcaUtils::getMasterKeyRevisionFromKeyGeneration(byte_t key_generation)
|
byte_t nn::hac::ContentArchiveUtils::getMasterKeyRevisionFromKeyGeneration(byte_t key_generation)
|
||||||
{
|
{
|
||||||
byte_t masterkey_rev;
|
byte_t masterkey_rev;
|
||||||
|
|
||||||
switch (key_generation)
|
switch (key_generation)
|
||||||
{
|
{
|
||||||
case(0):
|
case(0):
|
||||||
case(1):
|
case(1):
|
||||||
masterkey_rev = 0;
|
masterkey_rev = 0;
|
||||||
break;
|
break;
|
||||||
case(2):
|
case(2):
|
||||||
masterkey_rev = 1;
|
masterkey_rev = 1;
|
||||||
break;
|
break;
|
||||||
case(3):
|
case(3):
|
||||||
masterkey_rev = 2;
|
masterkey_rev = 2;
|
||||||
break;
|
break;
|
||||||
case(4):
|
case(4):
|
||||||
masterkey_rev = 3;
|
masterkey_rev = 3;
|
||||||
break;
|
break;
|
||||||
case(5):
|
case(5):
|
||||||
masterkey_rev = 4;
|
masterkey_rev = 4;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
masterkey_rev = key_generation - 1;
|
masterkey_rev = key_generation - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return masterkey_rev;
|
return masterkey_rev;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::NcaUtils::getNcaPartitionAesCtr(const nn::hac::sNcaFsHeader* hdr, byte_t* ctr)
|
void nn::hac::ContentArchiveUtils::getNcaPartitionAesCtr(const nn::hac::sNcaFsHeader* hdr, byte_t* ctr)
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < 8; i++)
|
for (size_t i = 0; i < 8; i++)
|
||||||
{
|
{
|
||||||
ctr[7-i] = hdr->aes_ctr_upper[i];
|
ctr[7-i] = hdr->aes_ctr_upper[i];
|
||||||
ctr[15-i] = 0;
|
ctr[15-i] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
123
lib/libhac/source/ContentInfo.cpp
Normal file
123
lib/libhac/source/ContentInfo.cpp
Normal file
|
@ -0,0 +1,123 @@
|
||||||
|
#include <nn/hac/ContentInfo.h>
|
||||||
|
|
||||||
|
nn::hac::ContentInfo::ContentInfo()
|
||||||
|
{
|
||||||
|
clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
nn::hac::ContentInfo::ContentInfo(const ContentInfo& other)
|
||||||
|
{
|
||||||
|
*this = other;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentInfo::operator=(const ContentInfo& other)
|
||||||
|
{
|
||||||
|
clear();
|
||||||
|
mRawBinary = other.mRawBinary;
|
||||||
|
mHash = other.mHash;
|
||||||
|
mContentId = other.mContentId;
|
||||||
|
mSize = other.mSize;
|
||||||
|
mType = other.mType;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool nn::hac::ContentInfo::operator==(const ContentInfo& other) const
|
||||||
|
{
|
||||||
|
return (mHash == other.mHash) \
|
||||||
|
&& (mContentId == other.mContentId) \
|
||||||
|
&& (mSize == other.mSize) \
|
||||||
|
&& (mType == other.mType);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool nn::hac::ContentInfo::operator!=(const ContentInfo& other) const
|
||||||
|
{
|
||||||
|
return !(*this == other);
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentInfo::toBytes()
|
||||||
|
{
|
||||||
|
mRawBinary.alloc(sizeof(sContentInfo));
|
||||||
|
sContentInfo* info = (sContentInfo*)mRawBinary.data();
|
||||||
|
|
||||||
|
info->content_hash = mHash;
|
||||||
|
info->content_id = mContentId;
|
||||||
|
info->size_lower = mSize & (uint32_t)(-1);
|
||||||
|
info->size_higher = (mSize >> 32) & (uint16_t)(-1);
|
||||||
|
info->content_type = mType;
|
||||||
|
info->id_offset = mIdOffset;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentInfo::fromBytes(const byte_t* bytes, size_t len)
|
||||||
|
{
|
||||||
|
if (len < sizeof(sContentInfo))
|
||||||
|
{
|
||||||
|
throw fnd::Exception(kModuleName, "ContentInfo too small");
|
||||||
|
}
|
||||||
|
|
||||||
|
const sContentInfo* info = (const sContentInfo*)bytes;
|
||||||
|
|
||||||
|
mHash = info->content_hash;
|
||||||
|
mContentId = info->content_id;
|
||||||
|
mSize = (uint64_t)(info->size_lower.get()) | (uint64_t)(info->size_higher.get()) << 32;
|
||||||
|
mType = (cnmt::ContentType)info->content_type;
|
||||||
|
mIdOffset = info->id_offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
const fnd::Vec<byte_t>& nn::hac::ContentInfo::getBytes() const
|
||||||
|
{
|
||||||
|
return mRawBinary;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentInfo::clear()
|
||||||
|
{
|
||||||
|
mRawBinary.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
const fnd::sha::sSha256Hash& nn::hac::ContentInfo::getContentHash() const
|
||||||
|
{
|
||||||
|
return mHash;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentInfo::setContentHash(const fnd::sha::sSha256Hash& hash)
|
||||||
|
{
|
||||||
|
mHash = hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
const nn::hac::cnmt::sContentId& nn::hac::ContentInfo::getContentId() const
|
||||||
|
{
|
||||||
|
return mContentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentInfo::setContentId(const cnmt::sContentId& content_id)
|
||||||
|
{
|
||||||
|
mContentId = content_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t nn::hac::ContentInfo::getContentSize() const
|
||||||
|
{
|
||||||
|
return mSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentInfo::setContentSize(size_t size)
|
||||||
|
{
|
||||||
|
mSize = size;
|
||||||
|
}
|
||||||
|
|
||||||
|
nn::hac::cnmt::ContentType nn::hac::ContentInfo::getContentType() const
|
||||||
|
{
|
||||||
|
return mType;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentInfo::setContentType(cnmt::ContentType type)
|
||||||
|
{
|
||||||
|
mType = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
byte_t nn::hac::ContentInfo::getIdOffset() const
|
||||||
|
{
|
||||||
|
return mIdOffset;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentInfo::setIdOffset(byte_t id_offset)
|
||||||
|
{
|
||||||
|
mIdOffset = id_offset;
|
||||||
|
}
|
|
@ -1,380 +1,368 @@
|
||||||
#include <nn/hac/ContentMetaBinary.h>
|
#include <nn/hac/ContentMeta.h>
|
||||||
|
|
||||||
nn::hac::ContentMetaBinary::ContentMetaBinary()
|
nn::hac::ContentMeta::ContentMeta()
|
||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
nn::hac::ContentMetaBinary::ContentMetaBinary(const ContentMetaBinary & other)
|
nn::hac::ContentMeta::ContentMeta(const ContentMeta & other)
|
||||||
{
|
{
|
||||||
*this = other;
|
*this = other;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ContentMetaBinary::operator=(const ContentMetaBinary& other)
|
void nn::hac::ContentMeta::operator=(const ContentMeta& other)
|
||||||
{
|
{
|
||||||
if (other.getBytes().size() > 0)
|
if (other.getBytes().size() > 0)
|
||||||
{
|
{
|
||||||
fromBytes(other.getBytes().data(), other.getBytes().size());
|
fromBytes(other.getBytes().data(), other.getBytes().size());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
mTitleId = other.mTitleId;
|
mTitleId = other.mTitleId;
|
||||||
mTitleVersion = other.mTitleVersion;
|
mTitleVersion = other.mTitleVersion;
|
||||||
mType = other.mType;
|
mType = other.mType;
|
||||||
mAttributes = other.mAttributes;
|
mAttributes = other.mAttributes;
|
||||||
mRequiredDownloadSystemVersion = other.mRequiredDownloadSystemVersion;
|
mRequiredDownloadSystemVersion = other.mRequiredDownloadSystemVersion;
|
||||||
mExtendedHeader = other.mExtendedHeader;
|
mApplicationMetaExtendedHeader = other.mApplicationMetaExtendedHeader;
|
||||||
mApplicationMetaExtendedHeader = other.mApplicationMetaExtendedHeader;
|
mPatchMetaExtendedHeader = other.mPatchMetaExtendedHeader;
|
||||||
mPatchMetaExtendedHeader = other.mPatchMetaExtendedHeader;
|
mAddOnContentMetaExtendedHeader = other.mAddOnContentMetaExtendedHeader;
|
||||||
mAddOnContentMetaExtendedHeader = other.mAddOnContentMetaExtendedHeader;
|
mDeltaMetaExtendedHeader = other.mDeltaMetaExtendedHeader;
|
||||||
mDeltaMetaExtendedHeader = other.mDeltaMetaExtendedHeader;
|
mContentInfo = other.mContentInfo;
|
||||||
mContentInfo = other.mContentInfo;
|
mContentMetaInfo = other.mContentMetaInfo;
|
||||||
mContentMetaInfo = other.mContentMetaInfo;
|
mExtendedData = other.mExtendedData;
|
||||||
mExtendedData = other.mExtendedData;
|
memcpy(mDigest.data, other.mDigest.data, cnmt::kDigestLen);
|
||||||
memcpy(mDigest.data, other.mDigest.data, cnmt::kDigestLen);
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
bool nn::hac::ContentMeta::operator==(const ContentMeta& other) const
|
||||||
bool nn::hac::ContentMetaBinary::operator==(const ContentMetaBinary& other) const
|
{
|
||||||
{
|
return (mTitleId == other.mTitleId) \
|
||||||
return (mTitleId == other.mTitleId) \
|
&& (mTitleVersion == other.mTitleVersion) \
|
||||||
&& (mTitleVersion == other.mTitleVersion) \
|
&& (mType == other.mType) \
|
||||||
&& (mType == other.mType) \
|
&& (mAttributes == other.mAttributes) \
|
||||||
&& (mAttributes == other.mAttributes) \
|
&& (mRequiredDownloadSystemVersion == other.mRequiredDownloadSystemVersion) \
|
||||||
&& (mRequiredDownloadSystemVersion == other.mRequiredDownloadSystemVersion) \
|
&& (mApplicationMetaExtendedHeader == other.mApplicationMetaExtendedHeader) \
|
||||||
&& (mExtendedHeader == other.mExtendedHeader) \
|
&& (mPatchMetaExtendedHeader == other.mPatchMetaExtendedHeader) \
|
||||||
&& (mApplicationMetaExtendedHeader == other.mApplicationMetaExtendedHeader) \
|
&& (mAddOnContentMetaExtendedHeader == other.mAddOnContentMetaExtendedHeader) \
|
||||||
&& (mPatchMetaExtendedHeader == other.mPatchMetaExtendedHeader) \
|
&& (mDeltaMetaExtendedHeader == other.mDeltaMetaExtendedHeader) \
|
||||||
&& (mAddOnContentMetaExtendedHeader == other.mAddOnContentMetaExtendedHeader) \
|
&& (mContentInfo == other.mContentInfo) \
|
||||||
&& (mDeltaMetaExtendedHeader == other.mDeltaMetaExtendedHeader) \
|
&& (mContentMetaInfo == other.mContentMetaInfo) \
|
||||||
&& (mContentInfo == other.mContentInfo) \
|
&& (mExtendedData == other.mExtendedData) \
|
||||||
&& (mContentMetaInfo == other.mContentMetaInfo) \
|
&& (memcmp(mDigest.data, other.mDigest.data, cnmt::kDigestLen) == 0);
|
||||||
&& (mExtendedData == other.mExtendedData) \
|
}
|
||||||
&& (memcmp(mDigest.data, other.mDigest.data, cnmt::kDigestLen) == 0);
|
|
||||||
}
|
bool nn::hac::ContentMeta::operator!=(const ContentMeta& other) const
|
||||||
|
{
|
||||||
bool nn::hac::ContentMetaBinary::operator!=(const ContentMetaBinary& other) const
|
return !(*this == other);
|
||||||
{
|
}
|
||||||
return !(*this == other);
|
|
||||||
}
|
void nn::hac::ContentMeta::toBytes()
|
||||||
|
{
|
||||||
void nn::hac::ContentMetaBinary::toBytes()
|
throw fnd::Exception(kModuleName, "toBytes() not implemented");
|
||||||
{
|
}
|
||||||
throw fnd::Exception(kModuleName, "exportBinary() not implemented");
|
|
||||||
}
|
void nn::hac::ContentMeta::fromBytes(const byte_t* data, size_t len)
|
||||||
|
{
|
||||||
void nn::hac::ContentMetaBinary::fromBytes(const byte_t* data, size_t len)
|
// clear member variables
|
||||||
{
|
clear();
|
||||||
// clear member variables
|
|
||||||
clear();
|
// validate layout
|
||||||
|
validateBinary(data, len);
|
||||||
// validate layout
|
|
||||||
validateBinary(data, len);
|
// get pointer to header structure
|
||||||
|
const sContentMetaHeader* hdr = (const sContentMetaHeader*)data;
|
||||||
// get pointer to header structure
|
|
||||||
const sContentMetaHeader* hdr = (const sContentMetaHeader*)data;
|
mTitleId = hdr->id.get();
|
||||||
|
mTitleVersion = hdr->version.get();
|
||||||
mTitleId = hdr->id.get();
|
mType = (cnmt::ContentMetaType)hdr->type;
|
||||||
mTitleVersion = hdr->version.get();
|
mAttributes = hdr->attributes;
|
||||||
mType = (cnmt::ContentMetaType)hdr->type;
|
mRequiredDownloadSystemVersion = hdr->required_download_system_version.get();
|
||||||
mAttributes = hdr->attributes;
|
size_t exdata_size = 0;
|
||||||
mRequiredDownloadSystemVersion = hdr->required_download_system_version.get();
|
|
||||||
size_t exdata_size = 0;
|
// save exheader
|
||||||
|
if (hdr->exhdr_size.get() > 0)
|
||||||
// save exheader
|
{
|
||||||
if (hdr->exhdr_size.get() > 0)
|
switch (mType)
|
||||||
{
|
{
|
||||||
mExtendedHeader.alloc(hdr->exhdr_size.get());
|
case (cnmt::METATYPE_APPLICATION):
|
||||||
memcpy(mExtendedHeader.data(), data + getExtendedHeaderOffset(), hdr->exhdr_size.get());
|
mApplicationMetaExtendedHeader.fromBytes(data + getExtendedHeaderOffset(), hdr->exhdr_size.get());
|
||||||
|
exdata_size = 0;
|
||||||
switch (mType)
|
break;
|
||||||
{
|
case (cnmt::METATYPE_PATCH):
|
||||||
case (cnmt::METATYPE_APPLICATION):
|
mPatchMetaExtendedHeader.fromBytes(data + getExtendedHeaderOffset(), hdr->exhdr_size.get());
|
||||||
mApplicationMetaExtendedHeader.patch_id = ((sApplicationMetaExtendedHeader*)mExtendedHeader.data())->patch_id.get();
|
exdata_size = mPatchMetaExtendedHeader.getExtendedDataSize();
|
||||||
mApplicationMetaExtendedHeader.required_system_version = ((sApplicationMetaExtendedHeader*)mExtendedHeader.data())->required_system_version.get();
|
break;
|
||||||
break;
|
case (cnmt::METATYPE_ADD_ON_CONTENT):
|
||||||
case (cnmt::METATYPE_PATCH):
|
mAddOnContentMetaExtendedHeader.fromBytes(data + getExtendedHeaderOffset(), hdr->exhdr_size.get());
|
||||||
mPatchMetaExtendedHeader.application_id = ((sPatchMetaExtendedHeader*)mExtendedHeader.data())->application_id.get();
|
exdata_size = 0;
|
||||||
mPatchMetaExtendedHeader.required_system_version = ((sPatchMetaExtendedHeader*)mExtendedHeader.data())->required_system_version.get();
|
break;
|
||||||
break;
|
case (cnmt::METATYPE_DELTA):
|
||||||
case (cnmt::METATYPE_ADD_ON_CONTENT):
|
mDeltaMetaExtendedHeader.fromBytes(data + getExtendedHeaderOffset(), hdr->exhdr_size.get());
|
||||||
mAddOnContentMetaExtendedHeader.application_id = ((sAddOnContentMetaExtendedHeader*)mExtendedHeader.data())->application_id.get();
|
exdata_size = mDeltaMetaExtendedHeader.getExtendedDataSize();
|
||||||
mAddOnContentMetaExtendedHeader.required_application_version = ((sAddOnContentMetaExtendedHeader*)mExtendedHeader.data())->required_application_version.get();
|
break;
|
||||||
break;
|
default:
|
||||||
case (cnmt::METATYPE_DELTA):
|
throw fnd::Exception(kModuleName, "Unhandled extended header for ContentMeta");
|
||||||
mDeltaMetaExtendedHeader.application_id = ((sDeltaMetaExtendedHeader*)mExtendedHeader.data())->application_id.get();
|
//exdata_size = 0;
|
||||||
break;
|
//break;
|
||||||
default:
|
}
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
|
// save content info
|
||||||
exdata_size = getExtendedDataSize(mType, mExtendedHeader.data());
|
if (hdr->content_count.get() > 0)
|
||||||
}
|
{
|
||||||
|
const sContentInfo* info = (const sContentInfo*)(data + getContentInfoOffset(hdr->exhdr_size.get()));
|
||||||
// save content info
|
ContentInfo cinfo;
|
||||||
if (hdr->content_count.get() > 0)
|
for (size_t i = 0; i < hdr->content_count.get(); i++)
|
||||||
{
|
{
|
||||||
const sContentInfo* info = (const sContentInfo*)(data + getContentInfoOffset(hdr->exhdr_size.get()));
|
cinfo.fromBytes((const byte_t*)&info[i], sizeof(sContentInfo));
|
||||||
ContentInfo cinfo;
|
mContentInfo.addElement(cinfo);
|
||||||
for (size_t i = 0; i < hdr->content_count.get(); i++)
|
}
|
||||||
{
|
}
|
||||||
cinfo.hash = info[i].content_hash;
|
|
||||||
memcpy(cinfo.nca_id, info[i].content_id, cnmt::kContentIdLen);
|
// save content meta info
|
||||||
cinfo.size = (uint64_t)(info[i].size_lower.get()) | (uint64_t)(info[i].size_higher.get()) << 32;
|
if (hdr->content_meta_count.get() > 0)
|
||||||
cinfo.type = (cnmt::ContentType)info[i].content_type;
|
{
|
||||||
mContentInfo.addElement(cinfo);
|
const sContentMetaInfo* info = (const sContentMetaInfo*)(data + getContentMetaInfoOffset(hdr->exhdr_size.get(), hdr->content_count.get()));
|
||||||
}
|
ContentMetaInfo cmeta;
|
||||||
}
|
for (size_t i = 0; i < hdr->content_meta_count.get(); i++)
|
||||||
|
{
|
||||||
// save content meta info
|
cmeta.fromBytes((const byte_t*)&info[i], sizeof(sContentMetaInfo));
|
||||||
if (hdr->content_meta_count.get() > 0)
|
mContentMetaInfo.addElement(cmeta);
|
||||||
{
|
}
|
||||||
const sContentMetaInfo* info = (const sContentMetaInfo*)(data + getContentMetaInfoOffset(hdr->exhdr_size.get(), hdr->content_count.get()));
|
}
|
||||||
ContentMetaInfo cmeta;
|
|
||||||
for (size_t i = 0; i < hdr->content_meta_count.get(); i++)
|
// save exdata
|
||||||
{
|
if (exdata_size > 0)
|
||||||
cmeta.id = info[i].id.get();
|
{
|
||||||
cmeta.version = info[i].version.get();
|
mExtendedData.alloc(exdata_size);
|
||||||
cmeta.type = (cnmt::ContentMetaType)info[i].type;
|
memcpy(mExtendedData.data(), data + getExtendedDataOffset(hdr->exhdr_size.get(), hdr->content_count.get(), hdr->content_meta_count.get()), exdata_size);
|
||||||
cmeta.attributes = info[i].attributes;
|
}
|
||||||
mContentMetaInfo.addElement(cmeta);
|
|
||||||
}
|
// save digest
|
||||||
}
|
memcpy(mDigest.data, data + getDigestOffset(hdr->exhdr_size.get(), hdr->content_count.get(), hdr->content_meta_count.get(), exdata_size), cnmt::kDigestLen);
|
||||||
|
}
|
||||||
// save exdata
|
|
||||||
if (exdata_size > 0)
|
const fnd::Vec<byte_t>& nn::hac::ContentMeta::getBytes() const
|
||||||
{
|
{
|
||||||
mExtendedData.alloc(exdata_size);
|
return mRawBinary;
|
||||||
memcpy(mExtendedData.data(), data + getExtendedDataOffset(hdr->exhdr_size.get(), hdr->content_count.get(), hdr->content_meta_count.get()), exdata_size);
|
}
|
||||||
}
|
|
||||||
|
void nn::hac::ContentMeta::clear()
|
||||||
// save digest
|
{
|
||||||
memcpy(mDigest.data, data + getDigestOffset(hdr->exhdr_size.get(), hdr->content_count.get(), hdr->content_meta_count.get(), exdata_size), cnmt::kDigestLen);
|
mRawBinary.clear();
|
||||||
}
|
mTitleId = 0;
|
||||||
|
mTitleVersion = 0;
|
||||||
const fnd::Vec<byte_t>& nn::hac::ContentMetaBinary::getBytes() const
|
mType = cnmt::METATYPE_SYSTEM_PROGRAM;
|
||||||
{
|
mAttributes = 0;
|
||||||
return mRawBinary;
|
mRequiredDownloadSystemVersion = 0;
|
||||||
}
|
mApplicationMetaExtendedHeader.clear();
|
||||||
|
mPatchMetaExtendedHeader.clear();
|
||||||
void nn::hac::ContentMetaBinary::clear()
|
mAddOnContentMetaExtendedHeader.clear();
|
||||||
{
|
mDeltaMetaExtendedHeader.clear();
|
||||||
mRawBinary.clear();
|
mContentInfo.clear();
|
||||||
mTitleId = 0;
|
mContentMetaInfo.clear();
|
||||||
mTitleVersion = 0;
|
mExtendedData.clear();
|
||||||
mType = cnmt::METATYPE_SYSTEM_PROGRAM;
|
memset(mDigest.data, 0, cnmt::kDigestLen);
|
||||||
mAttributes = 0;
|
}
|
||||||
mRequiredDownloadSystemVersion = 0;
|
|
||||||
mExtendedHeader.clear();
|
uint64_t nn::hac::ContentMeta::getTitleId() const
|
||||||
memset(&mApplicationMetaExtendedHeader, 0, sizeof(mApplicationMetaExtendedHeader));
|
{
|
||||||
memset(&mPatchMetaExtendedHeader, 0, sizeof(mPatchMetaExtendedHeader));
|
return mTitleId;
|
||||||
memset(&mAddOnContentMetaExtendedHeader, 0, sizeof(mAddOnContentMetaExtendedHeader));
|
}
|
||||||
memset(&mDeltaMetaExtendedHeader, 0, sizeof(mDeltaMetaExtendedHeader));
|
|
||||||
mContentInfo.clear();
|
void nn::hac::ContentMeta::setTitleId(uint64_t title_id)
|
||||||
mContentMetaInfo.clear();
|
{
|
||||||
mExtendedData.clear();
|
mTitleId = title_id;
|
||||||
memset(mDigest.data, 0, cnmt::kDigestLen);
|
}
|
||||||
}
|
|
||||||
|
uint32_t nn::hac::ContentMeta::getTitleVersion() const
|
||||||
uint64_t nn::hac::ContentMetaBinary::getTitleId() const
|
{
|
||||||
{
|
return mTitleVersion;
|
||||||
return mTitleId;
|
}
|
||||||
}
|
|
||||||
|
void nn::hac::ContentMeta::setTitleVersion(uint32_t version)
|
||||||
void nn::hac::ContentMetaBinary::setTitleId(uint64_t title_id)
|
{
|
||||||
{
|
mTitleVersion = version;
|
||||||
mTitleId = title_id;
|
}
|
||||||
}
|
|
||||||
|
nn::hac::cnmt::ContentMetaType nn::hac::ContentMeta::getContentMetaType() const
|
||||||
uint32_t nn::hac::ContentMetaBinary::getTitleVersion() const
|
{
|
||||||
{
|
return mType;
|
||||||
return mTitleVersion;
|
}
|
||||||
}
|
|
||||||
|
void nn::hac::ContentMeta::setContentMetaType(cnmt::ContentMetaType type)
|
||||||
void nn::hac::ContentMetaBinary::setTitleVersion(uint32_t version)
|
{
|
||||||
{
|
mType = type;
|
||||||
mTitleVersion = version;
|
}
|
||||||
}
|
|
||||||
|
byte_t nn::hac::ContentMeta::getAttributes() const
|
||||||
nn::hac::cnmt::ContentMetaType nn::hac::ContentMetaBinary::getType() const
|
{
|
||||||
{
|
return mAttributes;
|
||||||
return mType;
|
}
|
||||||
}
|
|
||||||
|
void nn::hac::ContentMeta::setAttributes(byte_t attributes)
|
||||||
void nn::hac::ContentMetaBinary::setType(cnmt::ContentMetaType type)
|
{
|
||||||
{
|
mAttributes = attributes;
|
||||||
mType = type;
|
}
|
||||||
}
|
|
||||||
|
uint32_t nn::hac::ContentMeta::getRequiredDownloadSystemVersion() const
|
||||||
byte_t nn::hac::ContentMetaBinary::getAttributes() const
|
{
|
||||||
{
|
return mRequiredDownloadSystemVersion;
|
||||||
return mAttributes;
|
}
|
||||||
}
|
|
||||||
|
void nn::hac::ContentMeta::setRequiredDownloadSystemVersion(uint32_t version)
|
||||||
void nn::hac::ContentMetaBinary::setAttributes(byte_t attributes)
|
{
|
||||||
{
|
mRequiredDownloadSystemVersion = version;
|
||||||
mAttributes = attributes;
|
}
|
||||||
}
|
|
||||||
|
const nn::hac::ApplicationMetaExtendedHeader& nn::hac::ContentMeta::getApplicationMetaExtendedHeader() const
|
||||||
uint32_t nn::hac::ContentMetaBinary::getRequiredDownloadSystemVersion() const
|
{
|
||||||
{
|
return mApplicationMetaExtendedHeader;
|
||||||
return mRequiredDownloadSystemVersion;
|
}
|
||||||
}
|
|
||||||
|
void nn::hac::ContentMeta::setApplicationMetaExtendedHeader(const ApplicationMetaExtendedHeader& exhdr)
|
||||||
void nn::hac::ContentMetaBinary::setRequiredDownloadSystemVersion(uint32_t version)
|
{
|
||||||
{
|
mApplicationMetaExtendedHeader = exhdr;
|
||||||
mRequiredDownloadSystemVersion = version;
|
}
|
||||||
}
|
|
||||||
|
const nn::hac::PatchMetaExtendedHeader& nn::hac::ContentMeta::getPatchMetaExtendedHeader() const
|
||||||
const nn::hac::ContentMetaBinary::ApplicationMetaExtendedHeader& nn::hac::ContentMetaBinary::getApplicationMetaExtendedHeader() const
|
{
|
||||||
{
|
return mPatchMetaExtendedHeader;
|
||||||
return mApplicationMetaExtendedHeader;
|
}
|
||||||
}
|
|
||||||
|
void nn::hac::ContentMeta::setPatchMetaExtendedHeader(const PatchMetaExtendedHeader& exhdr)
|
||||||
void nn::hac::ContentMetaBinary::setApplicationMetaExtendedHeader(const ApplicationMetaExtendedHeader& exhdr)
|
{
|
||||||
{
|
mPatchMetaExtendedHeader = exhdr;
|
||||||
mApplicationMetaExtendedHeader = exhdr;
|
}
|
||||||
}
|
|
||||||
|
const nn::hac::AddOnContentMetaExtendedHeader& nn::hac::ContentMeta::getAddOnContentMetaExtendedHeader() const
|
||||||
const nn::hac::ContentMetaBinary::PatchMetaExtendedHeader& nn::hac::ContentMetaBinary::getPatchMetaExtendedHeader() const
|
{
|
||||||
{
|
return mAddOnContentMetaExtendedHeader;
|
||||||
return mPatchMetaExtendedHeader;
|
}
|
||||||
}
|
|
||||||
|
void nn::hac::ContentMeta::setAddOnContentMetaExtendedHeader(const AddOnContentMetaExtendedHeader& exhdr)
|
||||||
void nn::hac::ContentMetaBinary::setPatchMetaExtendedHeader(const PatchMetaExtendedHeader& exhdr)
|
{
|
||||||
{
|
mAddOnContentMetaExtendedHeader = exhdr;
|
||||||
mPatchMetaExtendedHeader = exhdr;
|
}
|
||||||
}
|
|
||||||
|
const nn::hac::DeltaMetaExtendedHeader& nn::hac::ContentMeta::getDeltaMetaExtendedHeader() const
|
||||||
const nn::hac::ContentMetaBinary::AddOnContentMetaExtendedHeader& nn::hac::ContentMetaBinary::getAddOnContentMetaExtendedHeader() const
|
{
|
||||||
{
|
return mDeltaMetaExtendedHeader;
|
||||||
return mAddOnContentMetaExtendedHeader;
|
}
|
||||||
}
|
|
||||||
|
void nn::hac::ContentMeta::setDeltaMetaExtendedHeader(const DeltaMetaExtendedHeader& exhdr)
|
||||||
void nn::hac::ContentMetaBinary::setAddOnContentMetaExtendedHeader(const AddOnContentMetaExtendedHeader& exhdr)
|
{
|
||||||
{
|
mDeltaMetaExtendedHeader = exhdr;
|
||||||
mAddOnContentMetaExtendedHeader = exhdr;
|
}
|
||||||
}
|
|
||||||
|
const fnd::List<nn::hac::ContentInfo>& nn::hac::ContentMeta::getContentInfo() const
|
||||||
const nn::hac::ContentMetaBinary::DeltaMetaExtendedHeader& nn::hac::ContentMetaBinary::getDeltaMetaExtendedHeader() const
|
{
|
||||||
{
|
return mContentInfo;
|
||||||
return mDeltaMetaExtendedHeader;
|
}
|
||||||
}
|
|
||||||
|
void nn::hac::ContentMeta::setContentInfo(const fnd::List<nn::hac::ContentInfo>& info)
|
||||||
void nn::hac::ContentMetaBinary::setDeltaMetaExtendedHeader(const DeltaMetaExtendedHeader& exhdr)
|
{
|
||||||
{
|
mContentInfo = info;
|
||||||
mDeltaMetaExtendedHeader = exhdr;
|
}
|
||||||
}
|
|
||||||
|
const fnd::List<nn::hac::ContentMetaInfo>& nn::hac::ContentMeta::getContentMetaInfo() const
|
||||||
const fnd::List<nn::hac::ContentMetaBinary::ContentInfo>& nn::hac::ContentMetaBinary::getContentInfo() const
|
{
|
||||||
{
|
return mContentMetaInfo;
|
||||||
return mContentInfo;
|
}
|
||||||
}
|
|
||||||
|
void nn::hac::ContentMeta::setContentMetaInfo(const fnd::List<nn::hac::ContentMetaInfo>& info)
|
||||||
void nn::hac::ContentMetaBinary::setContentInfo(const fnd::List<nn::hac::ContentMetaBinary::ContentInfo>& info)
|
{
|
||||||
{
|
mContentMetaInfo = info;
|
||||||
mContentInfo = info;
|
}
|
||||||
}
|
|
||||||
|
const fnd::Vec<byte_t> & nn::hac::ContentMeta::getExtendedData() const
|
||||||
const fnd::List<nn::hac::ContentMetaBinary::ContentMetaInfo>& nn::hac::ContentMetaBinary::getContentMetaInfo() const
|
{
|
||||||
{
|
return mExtendedData;
|
||||||
return mContentMetaInfo;
|
}
|
||||||
}
|
|
||||||
|
void nn::hac::ContentMeta::setExtendedData(const fnd::Vec<byte_t>& data)
|
||||||
void nn::hac::ContentMetaBinary::setContentMetaInfo(const fnd::List<nn::hac::ContentMetaBinary::ContentMetaInfo>& info)
|
{
|
||||||
{
|
mExtendedData = data;
|
||||||
mContentMetaInfo = info;
|
}
|
||||||
}
|
|
||||||
|
const nn::hac::cnmt::sDigest & nn::hac::ContentMeta::getDigest() const
|
||||||
const fnd::Vec<byte_t> & nn::hac::ContentMetaBinary::getExtendedData() const
|
{
|
||||||
{
|
return mDigest;
|
||||||
return mExtendedData;
|
}
|
||||||
}
|
|
||||||
|
void nn::hac::ContentMeta::setDigest(const nn::hac::cnmt::sDigest& digest)
|
||||||
void nn::hac::ContentMetaBinary::setExtendedData(const fnd::Vec<byte_t> & data)
|
{
|
||||||
{
|
mDigest = digest;
|
||||||
mExtendedData = data;
|
}
|
||||||
}
|
|
||||||
|
bool nn::hac::ContentMeta::validateExtendedHeaderSize(cnmt::ContentMetaType type, size_t exhdrSize) const
|
||||||
const nn::hac::sDigest & nn::hac::ContentMetaBinary::getDigest() const
|
{
|
||||||
{
|
bool validSize = false;
|
||||||
return mDigest;
|
|
||||||
}
|
switch (type)
|
||||||
|
{
|
||||||
void nn::hac::ContentMetaBinary::setDigest(const nn::hac::sDigest & digest)
|
case (cnmt::METATYPE_APPLICATION):
|
||||||
{
|
validSize = (exhdrSize == sizeof(sApplicationMetaExtendedHeader));
|
||||||
|
break;
|
||||||
memcpy(mDigest.data, digest.data, cnmt::kDigestLen);
|
case (cnmt::METATYPE_PATCH):
|
||||||
}
|
validSize = (exhdrSize == sizeof(sPatchMetaExtendedHeader));
|
||||||
|
break;
|
||||||
bool nn::hac::ContentMetaBinary::validateExtendedHeaderSize(cnmt::ContentMetaType type, size_t exhdrSize) const
|
case (cnmt::METATYPE_ADD_ON_CONTENT):
|
||||||
{
|
validSize = (exhdrSize == sizeof(sAddOnContentMetaExtendedHeader));
|
||||||
bool validSize = false;
|
break;
|
||||||
|
case (cnmt::METATYPE_DELTA):
|
||||||
switch (type)
|
validSize = (exhdrSize == sizeof(sDeltaMetaExtendedHeader));
|
||||||
{
|
break;
|
||||||
case (cnmt::METATYPE_APPLICATION):
|
default:
|
||||||
validSize = (exhdrSize == sizeof(sApplicationMetaExtendedHeader));
|
validSize = (exhdrSize == 0);
|
||||||
break;
|
}
|
||||||
case (cnmt::METATYPE_PATCH):
|
|
||||||
validSize = (exhdrSize == sizeof(sPatchMetaExtendedHeader));
|
return validSize;
|
||||||
break;
|
}
|
||||||
case (cnmt::METATYPE_ADD_ON_CONTENT):
|
|
||||||
validSize = (exhdrSize == sizeof(sAddOnContentMetaExtendedHeader));
|
size_t nn::hac::ContentMeta::getExtendedDataSize(cnmt::ContentMetaType type, const byte_t * data) const
|
||||||
break;
|
{
|
||||||
case (cnmt::METATYPE_DELTA):
|
size_t exdata_len = 0;
|
||||||
validSize = (exhdrSize == sizeof(sDeltaMetaExtendedHeader));
|
if (type == cnmt::METATYPE_PATCH)
|
||||||
break;
|
{
|
||||||
default:
|
const sPatchMetaExtendedHeader* exhdr = (const sPatchMetaExtendedHeader*)(data);
|
||||||
validSize = (exhdrSize == 0);
|
exdata_len = exhdr->extended_data_size.get();
|
||||||
}
|
}
|
||||||
|
else if (type == cnmt::METATYPE_DELTA)
|
||||||
return validSize;
|
{
|
||||||
}
|
const sDeltaMetaExtendedHeader* exhdr = (const sDeltaMetaExtendedHeader*)(data);
|
||||||
|
exdata_len = exhdr->extended_data_size.get();
|
||||||
size_t nn::hac::ContentMetaBinary::getExtendedDataSize(cnmt::ContentMetaType type, const byte_t * data) const
|
}
|
||||||
{
|
return exdata_len;
|
||||||
size_t exdata_len = 0;
|
}
|
||||||
if (type == cnmt::METATYPE_PATCH)
|
|
||||||
{
|
void nn::hac::ContentMeta::validateBinary(const byte_t * data, size_t len) const
|
||||||
const sPatchMetaExtendedHeader* exhdr = (const sPatchMetaExtendedHeader*)(data);
|
{
|
||||||
exdata_len = exhdr->extended_data_size.get();
|
// check if it is large enough to read the header
|
||||||
}
|
if (len < sizeof(sContentMetaHeader))
|
||||||
else if (type == cnmt::METATYPE_DELTA)
|
{
|
||||||
{
|
throw fnd::Exception(kModuleName, "Binary too small");
|
||||||
const sDeltaMetaExtendedHeader* exhdr = (const sDeltaMetaExtendedHeader*)(data);
|
}
|
||||||
exdata_len = exhdr->extended_data_size.get();
|
|
||||||
}
|
// get pointer to header structure
|
||||||
return exdata_len;
|
const sContentMetaHeader* hdr = (const sContentMetaHeader*)data;
|
||||||
}
|
|
||||||
|
// validate extended header size
|
||||||
void nn::hac::ContentMetaBinary::validateBinary(const byte_t * data, size_t len) const
|
if (validateExtendedHeaderSize((cnmt::ContentMetaType)hdr->type, hdr->exhdr_size.get()) == false)
|
||||||
{
|
{
|
||||||
// check if it is large enough to read the header
|
throw fnd::Exception(kModuleName, "Invalid extended header size");
|
||||||
if (len < sizeof(sContentMetaHeader))
|
}
|
||||||
{
|
|
||||||
throw fnd::Exception(kModuleName, "Binary too small");
|
// check binary size again for new minimum size
|
||||||
}
|
if (len < getTotalSize(hdr->exhdr_size.get(), hdr->content_count.get(), hdr->content_meta_count.get(), 0))
|
||||||
|
{
|
||||||
// get pointer to header structure
|
throw fnd::Exception(kModuleName, "Binary too small");
|
||||||
const sContentMetaHeader* hdr = (const sContentMetaHeader*)data;
|
}
|
||||||
|
|
||||||
// validate extended header size
|
// check binary size again with extended data size
|
||||||
if (validateExtendedHeaderSize((cnmt::ContentMetaType)hdr->type, hdr->exhdr_size.get()) == false)
|
if (len < getTotalSize(hdr->exhdr_size.get(), hdr->content_count.get(), hdr->content_meta_count.get(), getExtendedDataSize((cnmt::ContentMetaType)hdr->type, data + getExtendedHeaderOffset())))
|
||||||
{
|
{
|
||||||
throw fnd::Exception(kModuleName, "Invalid extended header size");
|
throw fnd::Exception(kModuleName, "Binary too small");
|
||||||
}
|
}
|
||||||
|
|
||||||
// check binary size again for new minimum size
|
|
||||||
if (len < getTotalSize(hdr->exhdr_size.get(), hdr->content_count.get(), hdr->content_meta_count.get(), 0))
|
|
||||||
{
|
|
||||||
throw fnd::Exception(kModuleName, "Binary too small");
|
|
||||||
}
|
|
||||||
|
|
||||||
// check binary size again with extended data size
|
|
||||||
if (len < getTotalSize(hdr->exhdr_size.get(), hdr->content_count.get(), hdr->content_meta_count.get(), getExtendedDataSize((cnmt::ContentMetaType)hdr->type, data + getExtendedHeaderOffset())))
|
|
||||||
{
|
|
||||||
throw fnd::Exception(kModuleName, "Binary too small");
|
|
||||||
}
|
|
||||||
}
|
}
|
114
lib/libhac/source/ContentMetaInfo.cpp
Normal file
114
lib/libhac/source/ContentMetaInfo.cpp
Normal file
|
@ -0,0 +1,114 @@
|
||||||
|
#include <nn/hac/ContentMetaInfo.h>
|
||||||
|
|
||||||
|
nn::hac::ContentMetaInfo::ContentMetaInfo()
|
||||||
|
{
|
||||||
|
clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
nn::hac::ContentMetaInfo::ContentMetaInfo(const ContentMetaInfo& other)
|
||||||
|
{
|
||||||
|
*this = other;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentMetaInfo::operator=(const ContentMetaInfo& other)
|
||||||
|
{
|
||||||
|
clear();
|
||||||
|
mRawBinary = other.mRawBinary;
|
||||||
|
mTitleId = other.mTitleId;
|
||||||
|
mTitleVersion = other.mTitleVersion;
|
||||||
|
mType = other.mType;
|
||||||
|
mAttributes = other.mAttributes;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool nn::hac::ContentMetaInfo::operator==(const ContentMetaInfo& other) const
|
||||||
|
{
|
||||||
|
return (mTitleId == other.mTitleId) \
|
||||||
|
&& (mTitleVersion == other.mTitleVersion) \
|
||||||
|
&& (mType == other.mType) \
|
||||||
|
&& (mAttributes == other.mAttributes);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool nn::hac::ContentMetaInfo::operator!=(const ContentMetaInfo& other) const
|
||||||
|
{
|
||||||
|
return !(*this == other);
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentMetaInfo::toBytes()
|
||||||
|
{
|
||||||
|
mRawBinary.alloc(sizeof(sContentMetaInfo));
|
||||||
|
sContentMetaInfo* info = (sContentMetaInfo*)mRawBinary.data();
|
||||||
|
|
||||||
|
info->id = mTitleId;
|
||||||
|
info->version = mTitleVersion;
|
||||||
|
info->type = mType;
|
||||||
|
info->attributes = mAttributes;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentMetaInfo::fromBytes(const byte_t* bytes, size_t len)
|
||||||
|
{
|
||||||
|
if (len < sizeof(sContentMetaInfo))
|
||||||
|
{
|
||||||
|
throw fnd::Exception(kModuleName, "ContentMetaInfo too small");
|
||||||
|
}
|
||||||
|
|
||||||
|
const sContentMetaInfo* info = (const sContentMetaInfo*)bytes;
|
||||||
|
|
||||||
|
mTitleId = info->id.get();
|
||||||
|
mTitleVersion = info->version.get();
|
||||||
|
mType = (cnmt::ContentMetaType)info->type;
|
||||||
|
mAttributes = info->attributes;
|
||||||
|
}
|
||||||
|
|
||||||
|
const fnd::Vec<byte_t>& nn::hac::ContentMetaInfo::getBytes() const
|
||||||
|
{
|
||||||
|
return mRawBinary;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentMetaInfo::clear()
|
||||||
|
{
|
||||||
|
mRawBinary.clear();
|
||||||
|
mTitleId = 0;
|
||||||
|
mTitleVersion = 0;
|
||||||
|
mType = cnmt::ContentMetaType::METATYPE_APPLICATION;
|
||||||
|
mAttributes = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t nn::hac::ContentMetaInfo::getTitleId() const
|
||||||
|
{
|
||||||
|
return mTitleId;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentMetaInfo::setTitleId(uint64_t title_id)
|
||||||
|
{
|
||||||
|
mTitleId = title_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t nn::hac::ContentMetaInfo::getTitleVersion() const
|
||||||
|
{
|
||||||
|
return mTitleVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentMetaInfo::setTitleVersion(uint32_t ver)
|
||||||
|
{
|
||||||
|
mTitleVersion = ver;
|
||||||
|
}
|
||||||
|
|
||||||
|
nn::hac::cnmt::ContentMetaType nn::hac::ContentMetaInfo::getContentMetaType() const
|
||||||
|
{
|
||||||
|
return mType;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentMetaInfo::setContentMetaType(cnmt::ContentMetaType type)
|
||||||
|
{
|
||||||
|
mType = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
byte_t nn::hac::ContentMetaInfo::getAttributes() const
|
||||||
|
{
|
||||||
|
return mAttributes;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::ContentMetaInfo::setAttributes(byte_t attr)
|
||||||
|
{
|
||||||
|
mAttributes = attr;
|
||||||
|
}
|
84
lib/libhac/source/DeltaMetaExtendedHeader.cpp
Normal file
84
lib/libhac/source/DeltaMetaExtendedHeader.cpp
Normal file
|
@ -0,0 +1,84 @@
|
||||||
|
#include <nn/hac/DeltaMetaExtendedHeader.h>
|
||||||
|
|
||||||
|
nn::hac::DeltaMetaExtendedHeader::DeltaMetaExtendedHeader()
|
||||||
|
{
|
||||||
|
clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
nn::hac::DeltaMetaExtendedHeader::DeltaMetaExtendedHeader(const DeltaMetaExtendedHeader& other)
|
||||||
|
{
|
||||||
|
*this = other;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::DeltaMetaExtendedHeader::operator=(const DeltaMetaExtendedHeader& other)
|
||||||
|
{
|
||||||
|
clear();
|
||||||
|
mRawBinary = other.mRawBinary;
|
||||||
|
mApplicationId = other.mApplicationId;
|
||||||
|
mExtendedDataSize = other.mExtendedDataSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool nn::hac::DeltaMetaExtendedHeader::operator==(const DeltaMetaExtendedHeader& other) const
|
||||||
|
{
|
||||||
|
return (mApplicationId == other.mApplicationId) \
|
||||||
|
&& (mExtendedDataSize == other.mExtendedDataSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool nn::hac::DeltaMetaExtendedHeader::operator!=(const DeltaMetaExtendedHeader& other) const
|
||||||
|
{
|
||||||
|
return !(*this == other);
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::DeltaMetaExtendedHeader::toBytes()
|
||||||
|
{
|
||||||
|
mRawBinary.alloc(sizeof(sDeltaMetaExtendedHeader));
|
||||||
|
sDeltaMetaExtendedHeader* info = (sDeltaMetaExtendedHeader*)mRawBinary.data();
|
||||||
|
|
||||||
|
info->application_id = mApplicationId;
|
||||||
|
info->extended_data_size = mExtendedDataSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::DeltaMetaExtendedHeader::fromBytes(const byte_t* bytes, size_t len)
|
||||||
|
{
|
||||||
|
if (len < sizeof(sDeltaMetaExtendedHeader))
|
||||||
|
{
|
||||||
|
throw fnd::Exception(kModuleName, "DeltaMetaExtendedHeader too small");
|
||||||
|
}
|
||||||
|
|
||||||
|
const sDeltaMetaExtendedHeader* info = (const sDeltaMetaExtendedHeader*)bytes;
|
||||||
|
|
||||||
|
mApplicationId = info->application_id.get();
|
||||||
|
mExtendedDataSize = info->extended_data_size.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
const fnd::Vec<byte_t>& nn::hac::DeltaMetaExtendedHeader::getBytes() const
|
||||||
|
{
|
||||||
|
return mRawBinary;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::DeltaMetaExtendedHeader::clear()
|
||||||
|
{
|
||||||
|
mRawBinary.clear();
|
||||||
|
mApplicationId = 0;
|
||||||
|
mExtendedDataSize = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t nn::hac::DeltaMetaExtendedHeader::getApplicationId() const
|
||||||
|
{
|
||||||
|
return mApplicationId;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::DeltaMetaExtendedHeader::setApplicationId(uint64_t application_id)
|
||||||
|
{
|
||||||
|
mApplicationId = application_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t nn::hac::DeltaMetaExtendedHeader::getExtendedDataSize() const
|
||||||
|
{
|
||||||
|
return mExtendedDataSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::DeltaMetaExtendedHeader::setExtendedDataSize(uint32_t size)
|
||||||
|
{
|
||||||
|
mExtendedDataSize = size;
|
||||||
|
}
|
|
@ -1,219 +1,219 @@
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <nn/hac/FileSystemAccessControlBinary.h>
|
#include <nn/hac/FileSystemAccessControl.h>
|
||||||
|
|
||||||
nn::hac::FileSystemAccessControlBinary::FileSystemAccessControlBinary()
|
nn::hac::FileSystemAccessControl::FileSystemAccessControl()
|
||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
nn::hac::FileSystemAccessControlBinary::FileSystemAccessControlBinary(const FileSystemAccessControlBinary & other)
|
nn::hac::FileSystemAccessControl::FileSystemAccessControl(const FileSystemAccessControl & other)
|
||||||
{
|
{
|
||||||
*this = other;
|
*this = other;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::FileSystemAccessControlBinary::operator=(const FileSystemAccessControlBinary & other)
|
void nn::hac::FileSystemAccessControl::operator=(const FileSystemAccessControl & other)
|
||||||
{
|
{
|
||||||
mRawBinary = other.mRawBinary;
|
mRawBinary = other.mRawBinary;
|
||||||
mVersion = other.mVersion;
|
mVersion = other.mVersion;
|
||||||
mFsaRights = other.mFsaRights;
|
mFsaRights = other.mFsaRights;
|
||||||
mContentOwnerIdList = other.mContentOwnerIdList;
|
mContentOwnerIdList = other.mContentOwnerIdList;
|
||||||
mSaveDataOwnerIdList = other.mSaveDataOwnerIdList;
|
mSaveDataOwnerIdList = other.mSaveDataOwnerIdList;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nn::hac::FileSystemAccessControlBinary::operator==(const FileSystemAccessControlBinary & other) const
|
bool nn::hac::FileSystemAccessControl::operator==(const FileSystemAccessControl & other) const
|
||||||
{
|
{
|
||||||
return (mVersion == other.mVersion) \
|
return (mVersion == other.mVersion) \
|
||||||
&& (mFsaRights == other.mFsaRights) \
|
&& (mFsaRights == other.mFsaRights) \
|
||||||
&& (mContentOwnerIdList == other.mContentOwnerIdList) \
|
&& (mContentOwnerIdList == other.mContentOwnerIdList) \
|
||||||
&& (mSaveDataOwnerIdList == other.mSaveDataOwnerIdList);
|
&& (mSaveDataOwnerIdList == other.mSaveDataOwnerIdList);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nn::hac::FileSystemAccessControlBinary::operator!=(const FileSystemAccessControlBinary & other) const
|
bool nn::hac::FileSystemAccessControl::operator!=(const FileSystemAccessControl & other) const
|
||||||
{
|
{
|
||||||
return !(*this == other);
|
return !(*this == other);
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::FileSystemAccessControlBinary::toBytes()
|
void nn::hac::FileSystemAccessControl::toBytes()
|
||||||
{
|
{
|
||||||
// determine section layout
|
// determine section layout
|
||||||
struct sLayout {
|
struct sLayout {
|
||||||
uint32_t offset, size;
|
uint32_t offset, size;
|
||||||
} content, savedata;
|
} content, savedata;
|
||||||
|
|
||||||
content.offset = (uint32_t)align(sizeof(sFacHeader), fac::kSectionAlignSize);
|
content.offset = (uint32_t)align(sizeof(sFacHeader), fac::kSectionAlignSize);
|
||||||
if (mContentOwnerIdList.size() > 0)
|
if (mContentOwnerIdList.size() > 0)
|
||||||
content.size = (uint32_t)(sizeof(uint32_t) + mContentOwnerIdList.size() * sizeof(uint64_t));
|
content.size = (uint32_t)(sizeof(uint32_t) + mContentOwnerIdList.size() * sizeof(uint64_t));
|
||||||
else
|
else
|
||||||
content.size = 0;
|
content.size = 0;
|
||||||
|
|
||||||
savedata.offset = (uint32_t)(content.offset + (content.size > 0 ? align(content.size, fac::kSectionAlignSize) : 0));
|
savedata.offset = (uint32_t)(content.offset + (content.size > 0 ? align(content.size, fac::kSectionAlignSize) : 0));
|
||||||
if (mSaveDataOwnerIdList.size() > 0)
|
if (mSaveDataOwnerIdList.size() > 0)
|
||||||
savedata.size = (uint32_t)(sizeof(uint32_t) + align(mSaveDataOwnerIdList.size(), fac::kSectionAlignSize) + mSaveDataOwnerIdList.size() * sizeof(uint64_t));
|
savedata.size = (uint32_t)(sizeof(uint32_t) + align(mSaveDataOwnerIdList.size(), fac::kSectionAlignSize) + mSaveDataOwnerIdList.size() * sizeof(uint64_t));
|
||||||
else
|
else
|
||||||
savedata.size = 0;
|
savedata.size = 0;
|
||||||
|
|
||||||
|
|
||||||
// get total size
|
// get total size
|
||||||
size_t total_size = _MAX(_MAX(content.offset + content.size, savedata.offset + savedata.size), align(sizeof(sFacHeader), fac::kSectionAlignSize));
|
size_t total_size = _MAX(_MAX(content.offset + content.size, savedata.offset + savedata.size), align(sizeof(sFacHeader), fac::kSectionAlignSize));
|
||||||
|
|
||||||
mRawBinary.alloc(total_size);
|
mRawBinary.alloc(total_size);
|
||||||
sFacHeader* hdr = (sFacHeader*)mRawBinary.data();
|
sFacHeader* hdr = (sFacHeader*)mRawBinary.data();
|
||||||
|
|
||||||
// set type
|
// set type
|
||||||
hdr->version = mVersion;
|
hdr->version = mVersion;
|
||||||
|
|
||||||
// flags
|
// flags
|
||||||
uint64_t flag = 0;
|
uint64_t flag = 0;
|
||||||
for (size_t i = 0; i < mFsaRights.size(); i++)
|
for (size_t i = 0; i < mFsaRights.size(); i++)
|
||||||
{
|
{
|
||||||
flag |= _BIT((uint64_t)mFsaRights[i]);
|
flag |= _BIT((uint64_t)mFsaRights[i]);
|
||||||
}
|
}
|
||||||
hdr->fac_flags = flag;
|
hdr->fac_flags = flag;
|
||||||
|
|
||||||
// set offset/size
|
// set offset/size
|
||||||
hdr->content_owner_ids.offset = content.offset;
|
hdr->content_owner_ids.offset = content.offset;
|
||||||
if (content.size > 0)
|
if (content.size > 0)
|
||||||
hdr->content_owner_ids.size = content.size;
|
hdr->content_owner_ids.size = content.size;
|
||||||
hdr->save_data_owner_ids.offset = savedata.offset;
|
hdr->save_data_owner_ids.offset = savedata.offset;
|
||||||
if (savedata.size > 0)
|
if (savedata.size > 0)
|
||||||
hdr->save_data_owner_ids.size = savedata.size;
|
hdr->save_data_owner_ids.size = savedata.size;
|
||||||
|
|
||||||
// set ids
|
// set ids
|
||||||
le_uint32_t* content_owner_id_num = (le_uint32_t*)(mRawBinary.data() + content.offset);
|
le_uint32_t* content_owner_id_num = (le_uint32_t*)(mRawBinary.data() + content.offset);
|
||||||
le_uint64_t* content_owner_ids = (le_uint64_t*)(mRawBinary.data() + content.offset + sizeof(uint32_t));
|
le_uint64_t* content_owner_ids = (le_uint64_t*)(mRawBinary.data() + content.offset + sizeof(uint32_t));
|
||||||
content_owner_id_num->set((uint32_t)mContentOwnerIdList.size());
|
content_owner_id_num->set((uint32_t)mContentOwnerIdList.size());
|
||||||
for (size_t i = 0; i < mContentOwnerIdList.size(); i++)
|
for (size_t i = 0; i < mContentOwnerIdList.size(); i++)
|
||||||
{
|
{
|
||||||
content_owner_ids[i] = mContentOwnerIdList[i];
|
content_owner_ids[i] = mContentOwnerIdList[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
le_uint32_t* save_data_owner_id_num = (le_uint32_t*)(mRawBinary.data() + savedata.offset);
|
le_uint32_t* save_data_owner_id_num = (le_uint32_t*)(mRawBinary.data() + savedata.offset);
|
||||||
byte_t* save_data_owner_id_accessibility_array = (mRawBinary.data() + savedata.offset + sizeof(uint32_t));
|
byte_t* save_data_owner_id_accessibility_array = (mRawBinary.data() + savedata.offset + sizeof(uint32_t));
|
||||||
le_uint64_t* save_data_owner_ids = (le_uint64_t*)(mRawBinary.data() + savedata.offset + sizeof(uint32_t) + align(mSaveDataOwnerIdList.size(), sizeof(uint32_t)));
|
le_uint64_t* save_data_owner_ids = (le_uint64_t*)(mRawBinary.data() + savedata.offset + sizeof(uint32_t) + align(mSaveDataOwnerIdList.size(), sizeof(uint32_t)));
|
||||||
save_data_owner_id_num->set((uint32_t)mSaveDataOwnerIdList.size());
|
save_data_owner_id_num->set((uint32_t)mSaveDataOwnerIdList.size());
|
||||||
for (size_t i = 0; i < mSaveDataOwnerIdList.size(); i++)
|
for (size_t i = 0; i < mSaveDataOwnerIdList.size(); i++)
|
||||||
{
|
{
|
||||||
save_data_owner_id_accessibility_array[i] = mSaveDataOwnerIdList[i].access_type;
|
save_data_owner_id_accessibility_array[i] = mSaveDataOwnerIdList[i].access_type;
|
||||||
save_data_owner_ids[i] = mSaveDataOwnerIdList[i].id;
|
save_data_owner_ids[i] = mSaveDataOwnerIdList[i].id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::FileSystemAccessControlBinary::fromBytes(const byte_t* data, size_t len)
|
void nn::hac::FileSystemAccessControl::fromBytes(const byte_t* data, size_t len)
|
||||||
{
|
{
|
||||||
// check size
|
// check size
|
||||||
if (len < sizeof(sFacHeader))
|
if (len < sizeof(sFacHeader))
|
||||||
{
|
{
|
||||||
throw fnd::Exception(kModuleName, "FileSystemAccessControlInfo binary is too small");
|
throw fnd::Exception(kModuleName, "FileSystemAccessControlInfo binary is too small");
|
||||||
}
|
}
|
||||||
|
|
||||||
// clear variables
|
// clear variables
|
||||||
clear();
|
clear();
|
||||||
|
|
||||||
// save a copy of the header
|
// save a copy of the header
|
||||||
sFacHeader hdr;
|
sFacHeader hdr;
|
||||||
memcpy((void*)&hdr, data, sizeof(sFacHeader));
|
memcpy((void*)&hdr, data, sizeof(sFacHeader));
|
||||||
|
|
||||||
// check format version
|
// check format version
|
||||||
if (hdr.version.get() != fac::kFacFormatVersion)
|
if (hdr.version.get() != fac::kFacFormatVersion)
|
||||||
{
|
{
|
||||||
throw fnd::Exception(kModuleName, "FileSystemAccessControlInfo format version unsupported");
|
throw fnd::Exception(kModuleName, "FileSystemAccessControlInfo format version unsupported");
|
||||||
}
|
}
|
||||||
|
|
||||||
// get total size
|
// get total size
|
||||||
size_t total_size = _MAX(_MAX(hdr.content_owner_ids.offset.get() + hdr.content_owner_ids.size.get(), hdr.save_data_owner_ids.offset.get() + hdr.save_data_owner_ids.size.get()), align(sizeof(sFacHeader), fac::kSectionAlignSize));
|
size_t total_size = _MAX(_MAX(hdr.content_owner_ids.offset.get() + hdr.content_owner_ids.size.get(), hdr.save_data_owner_ids.offset.get() + hdr.save_data_owner_ids.size.get()), align(sizeof(sFacHeader), fac::kSectionAlignSize));
|
||||||
|
|
||||||
// validate binary size
|
// validate binary size
|
||||||
if (len < total_size)
|
if (len < total_size)
|
||||||
{
|
{
|
||||||
throw fnd::Exception(kModuleName, "FileSystemAccessControlInfo binary is too small");
|
throw fnd::Exception(kModuleName, "FileSystemAccessControlInfo binary is too small");
|
||||||
}
|
}
|
||||||
|
|
||||||
// allocate memory
|
// allocate memory
|
||||||
mRawBinary.alloc(total_size);
|
mRawBinary.alloc(total_size);
|
||||||
memcpy(mRawBinary.data(), data, mRawBinary.size());
|
memcpy(mRawBinary.data(), data, mRawBinary.size());
|
||||||
|
|
||||||
// save variables
|
// save variables
|
||||||
mVersion = hdr.version.get();
|
mVersion = hdr.version.get();
|
||||||
for (size_t i = 0; i < 64; i++)
|
for (size_t i = 0; i < 64; i++)
|
||||||
{
|
{
|
||||||
if (_HAS_BIT(hdr.fac_flags.get(), i))
|
if (_HAS_BIT(hdr.fac_flags.get(), i))
|
||||||
{
|
{
|
||||||
mFsaRights.addElement((fac::FsAccessFlag)i);
|
mFsaRights.addElement((fac::FsAccessFlag)i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// save ids
|
// save ids
|
||||||
if (hdr.content_owner_ids.size.get() > 0)
|
if (hdr.content_owner_ids.size.get() > 0)
|
||||||
{
|
{
|
||||||
size_t content_owner_id_num = ((le_uint32_t*)(mRawBinary.data() + hdr.content_owner_ids.offset.get()))->get();
|
size_t content_owner_id_num = ((le_uint32_t*)(mRawBinary.data() + hdr.content_owner_ids.offset.get()))->get();
|
||||||
le_uint64_t* content_owner_ids = (le_uint64_t*)(mRawBinary.data() + hdr.content_owner_ids.offset.get() + sizeof(uint32_t));
|
le_uint64_t* content_owner_ids = (le_uint64_t*)(mRawBinary.data() + hdr.content_owner_ids.offset.get() + sizeof(uint32_t));
|
||||||
for (size_t i = 0; i < content_owner_id_num; i++)
|
for (size_t i = 0; i < content_owner_id_num; i++)
|
||||||
{
|
{
|
||||||
mContentOwnerIdList.addElement(content_owner_ids[i].get());
|
mContentOwnerIdList.addElement(content_owner_ids[i].get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (hdr.save_data_owner_ids.size.get() > 0)
|
if (hdr.save_data_owner_ids.size.get() > 0)
|
||||||
{
|
{
|
||||||
size_t save_data_owner_id_num = ((le_uint32_t*)(mRawBinary.data() + hdr.save_data_owner_ids.offset.get()))->get();
|
size_t save_data_owner_id_num = ((le_uint32_t*)(mRawBinary.data() + hdr.save_data_owner_ids.offset.get()))->get();
|
||||||
byte_t* save_data_owner_id_accessibility_array = (mRawBinary.data() + hdr.save_data_owner_ids.offset.get() + sizeof(uint32_t));
|
byte_t* save_data_owner_id_accessibility_array = (mRawBinary.data() + hdr.save_data_owner_ids.offset.get() + sizeof(uint32_t));
|
||||||
le_uint64_t* save_data_owner_ids = (le_uint64_t*)(mRawBinary.data() + hdr.save_data_owner_ids.offset.get() + sizeof(uint32_t) + align(save_data_owner_id_num, fac::kSectionAlignSize));
|
le_uint64_t* save_data_owner_ids = (le_uint64_t*)(mRawBinary.data() + hdr.save_data_owner_ids.offset.get() + sizeof(uint32_t) + align(save_data_owner_id_num, fac::kSectionAlignSize));
|
||||||
for (size_t i = 0; i < save_data_owner_id_num; i++)
|
for (size_t i = 0; i < save_data_owner_id_num; i++)
|
||||||
{
|
{
|
||||||
mSaveDataOwnerIdList.addElement({ (fac::SaveDataOwnerIdAccessType)save_data_owner_id_accessibility_array[i], save_data_owner_ids[i].get() });
|
mSaveDataOwnerIdList.addElement({ (fac::SaveDataOwnerIdAccessType)save_data_owner_id_accessibility_array[i], save_data_owner_ids[i].get() });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const fnd::Vec<byte_t>& nn::hac::FileSystemAccessControlBinary::getBytes() const
|
const fnd::Vec<byte_t>& nn::hac::FileSystemAccessControl::getBytes() const
|
||||||
{
|
{
|
||||||
return mRawBinary;
|
return mRawBinary;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::FileSystemAccessControlBinary::clear()
|
void nn::hac::FileSystemAccessControl::clear()
|
||||||
{
|
{
|
||||||
mRawBinary.clear();
|
mRawBinary.clear();
|
||||||
mVersion = 0;
|
mVersion = 0;
|
||||||
mFsaRights.clear();
|
mFsaRights.clear();
|
||||||
mContentOwnerIdList.clear();
|
mContentOwnerIdList.clear();
|
||||||
mSaveDataOwnerIdList.clear();
|
mSaveDataOwnerIdList.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nn::hac::FileSystemAccessControlBinary::getFormatVersion() const
|
uint32_t nn::hac::FileSystemAccessControl::getFormatVersion() const
|
||||||
{
|
{
|
||||||
return mVersion;
|
return mVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::FileSystemAccessControlBinary::setFormatVersion(uint32_t format_version)
|
void nn::hac::FileSystemAccessControl::setFormatVersion(uint32_t format_version)
|
||||||
{
|
{
|
||||||
mVersion = format_version;
|
mVersion = format_version;
|
||||||
}
|
}
|
||||||
|
|
||||||
const fnd::List<nn::hac::fac::FsAccessFlag>& nn::hac::FileSystemAccessControlBinary::getFsaRightsList() const
|
const fnd::List<nn::hac::fac::FsAccessFlag>& nn::hac::FileSystemAccessControl::getFsaRightsList() const
|
||||||
{
|
{
|
||||||
return mFsaRights;
|
return mFsaRights;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::FileSystemAccessControlBinary::setFsaRightsList(const fnd::List<fac::FsAccessFlag>& list)
|
void nn::hac::FileSystemAccessControl::setFsaRightsList(const fnd::List<fac::FsAccessFlag>& list)
|
||||||
{
|
{
|
||||||
mFsaRights = list;
|
mFsaRights = list;
|
||||||
}
|
}
|
||||||
|
|
||||||
const fnd::List<uint64_t>& nn::hac::FileSystemAccessControlBinary::getContentOwnerIdList() const
|
const fnd::List<uint64_t>& nn::hac::FileSystemAccessControl::getContentOwnerIdList() const
|
||||||
{
|
{
|
||||||
return mContentOwnerIdList;
|
return mContentOwnerIdList;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::FileSystemAccessControlBinary::setContentOwnerIdList(const fnd::List<uint64_t>& list)
|
void nn::hac::FileSystemAccessControl::setContentOwnerIdList(const fnd::List<uint64_t>& list)
|
||||||
{
|
{
|
||||||
mContentOwnerIdList = list;
|
mContentOwnerIdList = list;
|
||||||
}
|
}
|
||||||
|
|
||||||
const fnd::List<nn::hac::FileSystemAccessControlBinary::sSaveDataOwnerId>& nn::hac::FileSystemAccessControlBinary::getSaveDataOwnerIdList() const
|
const fnd::List<nn::hac::FileSystemAccessControl::sSaveDataOwnerId>& nn::hac::FileSystemAccessControl::getSaveDataOwnerIdList() const
|
||||||
{
|
{
|
||||||
return mSaveDataOwnerIdList;
|
return mSaveDataOwnerIdList;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::FileSystemAccessControlBinary::setSaveDataOwnerIdList(const fnd::List<sSaveDataOwnerId>& list)
|
void nn::hac::FileSystemAccessControl::setSaveDataOwnerIdList(const fnd::List<sSaveDataOwnerId>& list)
|
||||||
{
|
{
|
||||||
mSaveDataOwnerIdList = list;
|
mSaveDataOwnerIdList = list;
|
||||||
}
|
}
|
|
@ -1,16 +1,16 @@
|
||||||
#include <nn/hac/XciHeader.h>
|
#include <nn/hac/GameCardHeader.h>
|
||||||
|
|
||||||
nn::hac::XciHeader::XciHeader()
|
nn::hac::GameCardHeader::GameCardHeader()
|
||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
nn::hac::XciHeader::XciHeader(const XciHeader& other)
|
nn::hac::GameCardHeader::GameCardHeader(const GameCardHeader& other)
|
||||||
{
|
{
|
||||||
*this = other;
|
*this = other;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::XciHeader::operator=(const XciHeader& other)
|
void nn::hac::GameCardHeader::operator=(const GameCardHeader& other)
|
||||||
{
|
{
|
||||||
mRomAreaStartPage = other.mRomAreaStartPage;
|
mRomAreaStartPage = other.mRomAreaStartPage;
|
||||||
mBackupAreaStartPage = other.mBackupAreaStartPage;
|
mBackupAreaStartPage = other.mBackupAreaStartPage;
|
||||||
|
@ -39,11 +39,11 @@ void nn::hac::XciHeader::operator=(const XciHeader& other)
|
||||||
mWait2TimeWrite = other.mWait2TimeWrite;
|
mWait2TimeWrite = other.mWait2TimeWrite;
|
||||||
mFwMode = other.mFwMode;
|
mFwMode = other.mFwMode;
|
||||||
mUppVersion = other.mUppVersion;
|
mUppVersion = other.mUppVersion;
|
||||||
memcpy(mUppHash, other.mUppHash, xci::kUppHashLen);
|
memcpy(mUppHash, other.mUppHash, gc::kUppHashLen);
|
||||||
mUppId = other.mUppId;
|
mUppId = other.mUppId;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nn::hac::XciHeader::operator==(const XciHeader& other) const
|
bool nn::hac::GameCardHeader::operator==(const GameCardHeader& other) const
|
||||||
{
|
{
|
||||||
return (mRomAreaStartPage == other.mRomAreaStartPage)
|
return (mRomAreaStartPage == other.mRomAreaStartPage)
|
||||||
&& (mBackupAreaStartPage == other.mBackupAreaStartPage)
|
&& (mBackupAreaStartPage == other.mBackupAreaStartPage)
|
||||||
|
@ -72,42 +72,42 @@ bool nn::hac::XciHeader::operator==(const XciHeader& other) const
|
||||||
&& (mWait2TimeWrite == other.mWait2TimeWrite)
|
&& (mWait2TimeWrite == other.mWait2TimeWrite)
|
||||||
&& (mFwMode == other.mFwMode)
|
&& (mFwMode == other.mFwMode)
|
||||||
&& (mUppVersion == other.mUppVersion)
|
&& (mUppVersion == other.mUppVersion)
|
||||||
&& (memcmp(mUppHash, other.mUppHash, xci::kUppHashLen) == 0)
|
&& (memcmp(mUppHash, other.mUppHash, gc::kUppHashLen) == 0)
|
||||||
&& (mUppId == other.mUppId);
|
&& (mUppId == other.mUppId);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nn::hac::XciHeader::operator!=(const XciHeader& other) const
|
bool nn::hac::GameCardHeader::operator!=(const GameCardHeader& other) const
|
||||||
{
|
{
|
||||||
return !(*this == other);
|
return !(*this == other);
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::XciHeader::toBytes()
|
void nn::hac::GameCardHeader::toBytes()
|
||||||
{
|
{
|
||||||
fnd::Exception(kModuleName, "exportBinary() not implemented");
|
fnd::Exception(kModuleName, "toBytes() not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::XciHeader::fromBytes(const byte_t* data, size_t len)
|
void nn::hac::GameCardHeader::fromBytes(const byte_t* data, size_t len)
|
||||||
{
|
{
|
||||||
// check input data size
|
// check input data size
|
||||||
if (len < sizeof(sXciHeader))
|
if (len < sizeof(sGcHeader))
|
||||||
{
|
{
|
||||||
throw fnd::Exception(kModuleName, "XCI header size is too small");
|
throw fnd::Exception(kModuleName, "GameCardImage header size is too small");
|
||||||
}
|
}
|
||||||
|
|
||||||
// clear internal members
|
// clear internal members
|
||||||
clear();
|
clear();
|
||||||
|
|
||||||
// allocate internal local binary copy
|
// allocate internal local binary copy
|
||||||
mRawBinary.alloc(sizeof(sXciHeader));
|
mRawBinary.alloc(sizeof(sGcHeader));
|
||||||
memcpy(mRawBinary.data(), data, mRawBinary.size());
|
memcpy(mRawBinary.data(), data, mRawBinary.size());
|
||||||
|
|
||||||
// get sXciHeader ptr
|
// get sGcHeader ptr
|
||||||
const nn::hac::sXciHeader* hdr = (const nn::hac::sXciHeader*)mRawBinary.data();
|
const nn::hac::sGcHeader* hdr = (const nn::hac::sGcHeader*)mRawBinary.data();
|
||||||
|
|
||||||
// check XCI signature
|
// check GameCardImage signature
|
||||||
if (hdr->st_magic.get() != xci::kXciStructMagic)
|
if (hdr->st_magic.get() != gc::kGcHeaderStructMagic)
|
||||||
{
|
{
|
||||||
throw fnd::Exception(kModuleName, "XCI header corrupt");
|
throw fnd::Exception(kModuleName, "GameCardImage header corrupt");
|
||||||
}
|
}
|
||||||
|
|
||||||
mRomAreaStartPage = hdr->rom_area_start_page.get();
|
mRomAreaStartPage = hdr->rom_area_start_page.get();
|
||||||
|
@ -133,8 +133,8 @@ void nn::hac::XciHeader::fromBytes(const byte_t* data, size_t len)
|
||||||
// if decrypted
|
// if decrypted
|
||||||
if (hdr->reserved_02[sizeof(hdr->reserved_02)-1] == 0x00 && hdr->reserved_02[sizeof(hdr->reserved_02)-2] == 0x00)
|
if (hdr->reserved_02[sizeof(hdr->reserved_02)-1] == 0x00 && hdr->reserved_02[sizeof(hdr->reserved_02)-2] == 0x00)
|
||||||
{
|
{
|
||||||
mFwVersion[xci::FWVER_MAJOR] = hdr->fw_version[xci::FWVER_MAJOR].get();
|
mFwVersion[gc::FWVER_MAJOR] = hdr->fw_version[gc::FWVER_MAJOR].get();
|
||||||
mFwVersion[xci::FWVER_MINOR] = hdr->fw_version[xci::FWVER_MINOR].get();
|
mFwVersion[gc::FWVER_MINOR] = hdr->fw_version[gc::FWVER_MINOR].get();
|
||||||
mAccCtrl1 = hdr->acc_ctrl_1.get();
|
mAccCtrl1 = hdr->acc_ctrl_1.get();
|
||||||
mWait1TimeRead = hdr->wait_1_time_read.get();
|
mWait1TimeRead = hdr->wait_1_time_read.get();
|
||||||
mWait2TimeRead = hdr->wait_2_time_read.get();
|
mWait2TimeRead = hdr->wait_2_time_read.get();
|
||||||
|
@ -142,19 +142,19 @@ void nn::hac::XciHeader::fromBytes(const byte_t* data, size_t len)
|
||||||
mWait2TimeWrite = hdr->wait_2_time_write.get();
|
mWait2TimeWrite = hdr->wait_2_time_write.get();
|
||||||
mFwMode = hdr->fw_mode.get();
|
mFwMode = hdr->fw_mode.get();
|
||||||
mUppVersion = hdr->upp_version.get();
|
mUppVersion = hdr->upp_version.get();
|
||||||
memcpy(mUppHash, hdr->upp_hash, xci::kUppHashLen);
|
memcpy(mUppHash, hdr->upp_hash, gc::kUppHashLen);
|
||||||
mUppId = hdr->upp_id.get();
|
mUppId = hdr->upp_id.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const fnd::Vec<byte_t>& nn::hac::XciHeader::getBytes() const
|
const fnd::Vec<byte_t>& nn::hac::GameCardHeader::getBytes() const
|
||||||
{
|
{
|
||||||
return mRawBinary;
|
return mRawBinary;
|
||||||
}
|
}
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
void nn::hac::XciHeader::clear()
|
void nn::hac::GameCardHeader::clear()
|
||||||
{
|
{
|
||||||
mRomAreaStartPage = 0;
|
mRomAreaStartPage = 0;
|
||||||
mBackupAreaStartPage = 0;
|
mBackupAreaStartPage = 0;
|
||||||
|
@ -183,297 +183,297 @@ void nn::hac::XciHeader::clear()
|
||||||
mWait2TimeWrite = 0;
|
mWait2TimeWrite = 0;
|
||||||
mFwMode = 0;
|
mFwMode = 0;
|
||||||
mUppVersion = 0;
|
mUppVersion = 0;
|
||||||
memset(mUppHash, 0, xci::kUppHashLen);
|
memset(mUppHash, 0, gc::kUppHashLen);
|
||||||
mUppId = 0;
|
mUppId = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nn::hac::XciHeader::getRomAreaStartPage() const
|
uint32_t nn::hac::GameCardHeader::getRomAreaStartPage() const
|
||||||
{
|
{
|
||||||
return mRomAreaStartPage;
|
return mRomAreaStartPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::XciHeader::setRomAreaStartPage(uint32_t startPage)
|
void nn::hac::GameCardHeader::setRomAreaStartPage(uint32_t startPage)
|
||||||
{
|
{
|
||||||
mRomAreaStartPage = startPage;
|
mRomAreaStartPage = startPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nn::hac::XciHeader::getBackupAreaStartPage() const
|
uint32_t nn::hac::GameCardHeader::getBackupAreaStartPage() const
|
||||||
{
|
{
|
||||||
return mBackupAreaStartPage;
|
return mBackupAreaStartPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::XciHeader::setBackupAreaStartPage(uint32_t startPage)
|
void nn::hac::GameCardHeader::setBackupAreaStartPage(uint32_t startPage)
|
||||||
{
|
{
|
||||||
mBackupAreaStartPage = startPage;
|
mBackupAreaStartPage = startPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
byte_t nn::hac::XciHeader::getKekIndex() const
|
byte_t nn::hac::GameCardHeader::getKekIndex() const
|
||||||
{
|
{
|
||||||
return mKekIndex;
|
return mKekIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::XciHeader::setKekIndex(byte_t kekIndex)
|
void nn::hac::GameCardHeader::setKekIndex(byte_t kekIndex)
|
||||||
{
|
{
|
||||||
mKekIndex = kekIndex;
|
mKekIndex = kekIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
byte_t nn::hac::XciHeader::getTitleKeyDecIndex() const
|
byte_t nn::hac::GameCardHeader::getTitleKeyDecIndex() const
|
||||||
{
|
{
|
||||||
return mTitleKeyDecIndex;
|
return mTitleKeyDecIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::XciHeader::setTitleKeyDecIndex(byte_t index)
|
void nn::hac::GameCardHeader::setTitleKeyDecIndex(byte_t index)
|
||||||
{
|
{
|
||||||
mTitleKeyDecIndex = index;
|
mTitleKeyDecIndex = index;
|
||||||
}
|
}
|
||||||
|
|
||||||
byte_t nn::hac::XciHeader::getRomSizeType() const
|
byte_t nn::hac::GameCardHeader::getRomSizeType() const
|
||||||
{
|
{
|
||||||
return mRomSize;
|
return mRomSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::XciHeader::setRomSizeType(byte_t romSizeType)
|
void nn::hac::GameCardHeader::setRomSizeType(byte_t romSizeType)
|
||||||
{
|
{
|
||||||
mRomSize = romSizeType;
|
mRomSize = romSizeType;
|
||||||
}
|
}
|
||||||
|
|
||||||
byte_t nn::hac::XciHeader::getCardHeaderVersion() const
|
byte_t nn::hac::GameCardHeader::getCardHeaderVersion() const
|
||||||
{
|
{
|
||||||
return mCardHeaderVersion;
|
return mCardHeaderVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::XciHeader::setCardHeaderVersion(byte_t version)
|
void nn::hac::GameCardHeader::setCardHeaderVersion(byte_t version)
|
||||||
{
|
{
|
||||||
mCardHeaderVersion = version;
|
mCardHeaderVersion = version;
|
||||||
}
|
}
|
||||||
|
|
||||||
byte_t nn::hac::XciHeader::getFlags() const
|
byte_t nn::hac::GameCardHeader::getFlags() const
|
||||||
{
|
{
|
||||||
return mFlags;
|
return mFlags;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::XciHeader::setFlags(byte_t flags)
|
void nn::hac::GameCardHeader::setFlags(byte_t flags)
|
||||||
{
|
{
|
||||||
mFlags = flags;
|
mFlags = flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t nn::hac::XciHeader::getPackageId() const
|
uint64_t nn::hac::GameCardHeader::getPackageId() const
|
||||||
{
|
{
|
||||||
return mPackageId;
|
return mPackageId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::XciHeader::setPackageId(uint64_t id)
|
void nn::hac::GameCardHeader::setPackageId(uint64_t id)
|
||||||
{
|
{
|
||||||
mPackageId = id;
|
mPackageId = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nn::hac::XciHeader::getValidDataEndPage() const
|
uint32_t nn::hac::GameCardHeader::getValidDataEndPage() const
|
||||||
{
|
{
|
||||||
return mValidDataEndPage;
|
return mValidDataEndPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::XciHeader::setValidDataEndPage(uint32_t page)
|
void nn::hac::GameCardHeader::setValidDataEndPage(uint32_t page)
|
||||||
{
|
{
|
||||||
mValidDataEndPage = page;
|
mValidDataEndPage = page;
|
||||||
}
|
}
|
||||||
|
|
||||||
const fnd::aes::sAesIvCtr& nn::hac::XciHeader::getAesCbcIv() const
|
const fnd::aes::sAesIvCtr& nn::hac::GameCardHeader::getAesCbcIv() const
|
||||||
{
|
{
|
||||||
return mAesCbcIv;
|
return mAesCbcIv;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::XciHeader::setAesCbcIv(const fnd::aes::sAesIvCtr& iv)
|
void nn::hac::GameCardHeader::setAesCbcIv(const fnd::aes::sAesIvCtr& iv)
|
||||||
{
|
{
|
||||||
mAesCbcIv = iv;
|
mAesCbcIv = iv;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t nn::hac::XciHeader::getPartitionFsAddress() const
|
uint64_t nn::hac::GameCardHeader::getPartitionFsAddress() const
|
||||||
{
|
{
|
||||||
return mPartitionFsHeaderAddress;
|
return mPartitionFsHeaderAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::XciHeader::setPartitionFsAddress(uint64_t address)
|
void nn::hac::GameCardHeader::setPartitionFsAddress(uint64_t address)
|
||||||
{
|
{
|
||||||
mPartitionFsHeaderAddress = address;
|
mPartitionFsHeaderAddress = address;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t nn::hac::XciHeader::getPartitionFsSize() const
|
uint64_t nn::hac::GameCardHeader::getPartitionFsSize() const
|
||||||
{
|
{
|
||||||
return mPartitionFsHeaderSize;
|
return mPartitionFsHeaderSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::XciHeader::setPartitionFsSize(uint64_t size)
|
void nn::hac::GameCardHeader::setPartitionFsSize(uint64_t size)
|
||||||
{
|
{
|
||||||
mPartitionFsHeaderSize = size;
|
mPartitionFsHeaderSize = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
const fnd::sha::sSha256Hash& nn::hac::XciHeader::getPartitionFsHash() const
|
const fnd::sha::sSha256Hash& nn::hac::GameCardHeader::getPartitionFsHash() const
|
||||||
{
|
{
|
||||||
return mPartitionFsHeaderHash;
|
return mPartitionFsHeaderHash;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::XciHeader::setPartitionFsHash(const fnd::sha::sSha256Hash& hash)
|
void nn::hac::GameCardHeader::setPartitionFsHash(const fnd::sha::sSha256Hash& hash)
|
||||||
{
|
{
|
||||||
mPartitionFsHeaderHash = hash;
|
mPartitionFsHeaderHash = hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
const fnd::sha::sSha256Hash& nn::hac::XciHeader::getInitialDataHash() const
|
const fnd::sha::sSha256Hash& nn::hac::GameCardHeader::getInitialDataHash() const
|
||||||
{
|
{
|
||||||
return mInitialDataHash;
|
return mInitialDataHash;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::XciHeader::setInitialDataHash(const fnd::sha::sSha256Hash& hash)
|
void nn::hac::GameCardHeader::setInitialDataHash(const fnd::sha::sSha256Hash& hash)
|
||||||
{
|
{
|
||||||
mInitialDataHash = hash;
|
mInitialDataHash = hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nn::hac::XciHeader::getSelSec() const
|
uint32_t nn::hac::GameCardHeader::getSelSec() const
|
||||||
{
|
{
|
||||||
return mSelSec;
|
return mSelSec;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::XciHeader::setSelSec(uint32_t sel_sec)
|
void nn::hac::GameCardHeader::setSelSec(uint32_t sel_sec)
|
||||||
{
|
{
|
||||||
mSelSec = sel_sec;
|
mSelSec = sel_sec;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nn::hac::XciHeader::getSelT1Key() const
|
uint32_t nn::hac::GameCardHeader::getSelT1Key() const
|
||||||
{
|
{
|
||||||
return mSelT1Key;
|
return mSelT1Key;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::XciHeader::setSelT1Key(uint32_t sel_t1_key)
|
void nn::hac::GameCardHeader::setSelT1Key(uint32_t sel_t1_key)
|
||||||
{
|
{
|
||||||
mSelT1Key = sel_t1_key;
|
mSelT1Key = sel_t1_key;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nn::hac::XciHeader::getSelKey() const
|
uint32_t nn::hac::GameCardHeader::getSelKey() const
|
||||||
{
|
{
|
||||||
return mSelKey;
|
return mSelKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::XciHeader::setSelKey(uint32_t sel_key)
|
void nn::hac::GameCardHeader::setSelKey(uint32_t sel_key)
|
||||||
{
|
{
|
||||||
mSelKey = sel_key;
|
mSelKey = sel_key;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nn::hac::XciHeader::getLimAreaPage() const
|
uint32_t nn::hac::GameCardHeader::getLimAreaPage() const
|
||||||
{
|
{
|
||||||
return mLimAreaPage;
|
return mLimAreaPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::XciHeader::setLimAreaPage(uint32_t page)
|
void nn::hac::GameCardHeader::setLimAreaPage(uint32_t page)
|
||||||
{
|
{
|
||||||
mLimAreaPage = page;
|
mLimAreaPage = page;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint32_t nn::hac::XciHeader::getFwVerMajor() const
|
uint32_t nn::hac::GameCardHeader::getFwVerMajor() const
|
||||||
{
|
{
|
||||||
return mFwVersion[xci::FWVER_MAJOR];
|
return mFwVersion[gc::FWVER_MAJOR];
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::XciHeader::setFwVerMajor(uint32_t ver)
|
void nn::hac::GameCardHeader::setFwVerMajor(uint32_t ver)
|
||||||
{
|
{
|
||||||
mFwVersion[xci::FWVER_MAJOR] = ver;
|
mFwVersion[gc::FWVER_MAJOR] = ver;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nn::hac::XciHeader::getFwVerMinor() const
|
uint32_t nn::hac::GameCardHeader::getFwVerMinor() const
|
||||||
{
|
{
|
||||||
return mFwVersion[xci::FWVER_MINOR];
|
return mFwVersion[gc::FWVER_MINOR];
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::XciHeader::setFwVerMinor(uint32_t ver)
|
void nn::hac::GameCardHeader::setFwVerMinor(uint32_t ver)
|
||||||
{
|
{
|
||||||
mFwVersion[xci::FWVER_MINOR] = ver;
|
mFwVersion[gc::FWVER_MINOR] = ver;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nn::hac::XciHeader::getAccCtrl1() const
|
uint32_t nn::hac::GameCardHeader::getAccCtrl1() const
|
||||||
{
|
{
|
||||||
return mAccCtrl1;
|
return mAccCtrl1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::XciHeader::setAccCtrl1(uint32_t acc_ctrl_1)
|
void nn::hac::GameCardHeader::setAccCtrl1(uint32_t acc_ctrl_1)
|
||||||
{
|
{
|
||||||
mAccCtrl1 = acc_ctrl_1;
|
mAccCtrl1 = acc_ctrl_1;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nn::hac::XciHeader::getWait1TimeRead() const
|
uint32_t nn::hac::GameCardHeader::getWait1TimeRead() const
|
||||||
{
|
{
|
||||||
return mWait1TimeRead;
|
return mWait1TimeRead;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::XciHeader::setWait1TimeRead(uint32_t seconds)
|
void nn::hac::GameCardHeader::setWait1TimeRead(uint32_t seconds)
|
||||||
{
|
{
|
||||||
mWait1TimeRead = seconds;
|
mWait1TimeRead = seconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nn::hac::XciHeader::getWait2TimeRead() const
|
uint32_t nn::hac::GameCardHeader::getWait2TimeRead() const
|
||||||
{
|
{
|
||||||
return mWait2TimeRead;
|
return mWait2TimeRead;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::XciHeader::setWait2TimeRead(uint32_t seconds)
|
void nn::hac::GameCardHeader::setWait2TimeRead(uint32_t seconds)
|
||||||
{
|
{
|
||||||
mWait2TimeRead = seconds;
|
mWait2TimeRead = seconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nn::hac::XciHeader::getWait1TimeWrite() const
|
uint32_t nn::hac::GameCardHeader::getWait1TimeWrite() const
|
||||||
{
|
{
|
||||||
return mWait1TimeWrite;
|
return mWait1TimeWrite;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::XciHeader::setWait1TimeWrite(uint32_t seconds)
|
void nn::hac::GameCardHeader::setWait1TimeWrite(uint32_t seconds)
|
||||||
{
|
{
|
||||||
mWait1TimeWrite = seconds;
|
mWait1TimeWrite = seconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nn::hac::XciHeader::getWait2TimeWrite() const
|
uint32_t nn::hac::GameCardHeader::getWait2TimeWrite() const
|
||||||
{
|
{
|
||||||
return mWait2TimeWrite;
|
return mWait2TimeWrite;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::XciHeader::setWait2TimeWrite(uint32_t seconds)
|
void nn::hac::GameCardHeader::setWait2TimeWrite(uint32_t seconds)
|
||||||
{
|
{
|
||||||
mWait2TimeWrite = seconds;
|
mWait2TimeWrite = seconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nn::hac::XciHeader::getFwMode() const
|
uint32_t nn::hac::GameCardHeader::getFwMode() const
|
||||||
{
|
{
|
||||||
return mFwMode;
|
return mFwMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::XciHeader::setFwMode(uint32_t fw_mode)
|
void nn::hac::GameCardHeader::setFwMode(uint32_t fw_mode)
|
||||||
{
|
{
|
||||||
mFwMode = fw_mode;
|
mFwMode = fw_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nn::hac::XciHeader::getUppVersion() const
|
uint32_t nn::hac::GameCardHeader::getUppVersion() const
|
||||||
{
|
{
|
||||||
return mUppVersion;
|
return mUppVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::XciHeader::setUppVersion(uint32_t version)
|
void nn::hac::GameCardHeader::setUppVersion(uint32_t version)
|
||||||
{
|
{
|
||||||
mUppVersion = version;
|
mUppVersion = version;
|
||||||
}
|
}
|
||||||
|
|
||||||
const byte_t* nn::hac::XciHeader::getUppHash() const
|
const byte_t* nn::hac::GameCardHeader::getUppHash() const
|
||||||
{
|
{
|
||||||
return mUppHash;
|
return mUppHash;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::XciHeader::setUppHash(const byte_t* hash)
|
void nn::hac::GameCardHeader::setUppHash(const byte_t* hash)
|
||||||
{
|
{
|
||||||
memcpy(mUppHash, hash, xci::kUppHashLen);
|
memcpy(mUppHash, hash, gc::kUppHashLen);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t nn::hac::XciHeader::getUppId() const
|
uint64_t nn::hac::GameCardHeader::getUppId() const
|
||||||
{
|
{
|
||||||
return mUppId;
|
return mUppId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::XciHeader::setUppId(uint64_t id)
|
void nn::hac::GameCardHeader::setUppId(uint64_t id)
|
||||||
{
|
{
|
||||||
mUppId = id;
|
mUppId = id;
|
||||||
}
|
}
|
22
lib/libhac/source/GameCardUtils.cpp
Normal file
22
lib/libhac/source/GameCardUtils.cpp
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
#include <nn/hac/GameCardUtils.h>
|
||||||
|
|
||||||
|
void nn::hac::GameCardUtils::getXciHeaderAesIv(const nn::hac::sGcHeader* hdr, byte_t* iv)
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < 16; i++)
|
||||||
|
{
|
||||||
|
iv[15-i] = hdr->aescbc_iv.iv[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::GameCardUtils::decryptXciHeader(const byte_t* src, byte_t* dst, const byte_t* key)
|
||||||
|
{
|
||||||
|
byte_t iv[fnd::aes::kAesBlockSize];
|
||||||
|
|
||||||
|
getXciHeaderAesIv((const nn::hac::sGcHeader*)src, iv);
|
||||||
|
|
||||||
|
// copy plain
|
||||||
|
memcpy(dst, src, nn::hac::gc::kHeaderEncOffset);
|
||||||
|
|
||||||
|
// decrypt encrypted data
|
||||||
|
fnd::aes::AesCbcDecrypt(src + nn::hac::gc::kHeaderEncOffset, nn::hac::gc::kHeaderEncSize, key, iv, dst + nn::hac::gc::kHeaderEncOffset);
|
||||||
|
}
|
|
@ -1,231 +1,231 @@
|
||||||
#include <nn/hac/KernelCapabilityBinary.h>
|
#include <nn/hac/KernelCapabilityControl.h>
|
||||||
|
|
||||||
nn::hac::KernelCapabilityBinary::KernelCapabilityBinary()
|
nn::hac::KernelCapabilityControl::KernelCapabilityControl()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
nn::hac::KernelCapabilityBinary::KernelCapabilityBinary(const KernelCapabilityBinary & other)
|
nn::hac::KernelCapabilityControl::KernelCapabilityControl(const KernelCapabilityControl & other)
|
||||||
{
|
{
|
||||||
*this = other;
|
*this = other;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::KernelCapabilityBinary::operator=(const KernelCapabilityBinary & other)
|
void nn::hac::KernelCapabilityControl::operator=(const KernelCapabilityControl & other)
|
||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
mRawBinary = other.mRawBinary;
|
mRawBinary = other.mRawBinary;
|
||||||
mThreadInfo = other.mThreadInfo;
|
mThreadInfo = other.mThreadInfo;
|
||||||
mSystemCalls = other.mSystemCalls;
|
mSystemCalls = other.mSystemCalls;
|
||||||
mMemoryMap = other.mMemoryMap;
|
mMemoryMap = other.mMemoryMap;
|
||||||
mInterupts = other.mInterupts;
|
mInterupts = other.mInterupts;
|
||||||
mMiscParams = other.mMiscParams;
|
mMiscParams = other.mMiscParams;
|
||||||
mKernelVersion = other.mKernelVersion;
|
mKernelVersion = other.mKernelVersion;
|
||||||
mHandleTableSize = other.mHandleTableSize;
|
mHandleTableSize = other.mHandleTableSize;
|
||||||
mMiscFlags = other.mMiscFlags;
|
mMiscFlags = other.mMiscFlags;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nn::hac::KernelCapabilityBinary::operator==(const KernelCapabilityBinary & other) const
|
bool nn::hac::KernelCapabilityControl::operator==(const KernelCapabilityControl & other) const
|
||||||
{
|
{
|
||||||
return (mThreadInfo == other.mThreadInfo) \
|
return (mThreadInfo == other.mThreadInfo) \
|
||||||
&& (mSystemCalls == other.mSystemCalls) \
|
&& (mSystemCalls == other.mSystemCalls) \
|
||||||
&& (mMemoryMap == other.mMemoryMap) \
|
&& (mMemoryMap == other.mMemoryMap) \
|
||||||
&& (mInterupts == other.mInterupts) \
|
&& (mInterupts == other.mInterupts) \
|
||||||
&& (mMiscParams == other.mMiscParams) \
|
&& (mMiscParams == other.mMiscParams) \
|
||||||
&& (mKernelVersion == other.mKernelVersion) \
|
&& (mKernelVersion == other.mKernelVersion) \
|
||||||
&& (mHandleTableSize == other.mHandleTableSize) \
|
&& (mHandleTableSize == other.mHandleTableSize) \
|
||||||
&& (mMiscFlags == other.mMiscFlags);
|
&& (mMiscFlags == other.mMiscFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nn::hac::KernelCapabilityBinary::operator!=(const KernelCapabilityBinary & other) const
|
bool nn::hac::KernelCapabilityControl::operator!=(const KernelCapabilityControl & other) const
|
||||||
{
|
{
|
||||||
return !(*this == other);
|
return !(*this == other);
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::KernelCapabilityBinary::toBytes()
|
void nn::hac::KernelCapabilityControl::toBytes()
|
||||||
{
|
{
|
||||||
fnd::List<KernelCapabilityEntry> caps;
|
fnd::List<KernelCapabilityEntry> caps;
|
||||||
|
|
||||||
// get kernel capabiliteis
|
// get kernel capabiliteis
|
||||||
mThreadInfo.exportKernelCapabilityList(caps);
|
mThreadInfo.exportKernelCapabilityList(caps);
|
||||||
mSystemCalls.exportKernelCapabilityList(caps);
|
mSystemCalls.exportKernelCapabilityList(caps);
|
||||||
mMemoryMap.exportKernelCapabilityList(caps);
|
mMemoryMap.exportKernelCapabilityList(caps);
|
||||||
mInterupts.exportKernelCapabilityList(caps);
|
mInterupts.exportKernelCapabilityList(caps);
|
||||||
mMiscParams.exportKernelCapabilityList(caps);
|
mMiscParams.exportKernelCapabilityList(caps);
|
||||||
mKernelVersion.exportKernelCapabilityList(caps);
|
mKernelVersion.exportKernelCapabilityList(caps);
|
||||||
mHandleTableSize.exportKernelCapabilityList(caps);
|
mHandleTableSize.exportKernelCapabilityList(caps);
|
||||||
mMiscFlags.exportKernelCapabilityList(caps);
|
mMiscFlags.exportKernelCapabilityList(caps);
|
||||||
|
|
||||||
// allocate memory
|
// allocate memory
|
||||||
mRawBinary.alloc(caps.size() * sizeof(uint32_t));
|
mRawBinary.alloc(caps.size() * sizeof(uint32_t));
|
||||||
|
|
||||||
// write to binary
|
// write to binary
|
||||||
uint32_t* raw_caps = (uint32_t*)mRawBinary.data();
|
uint32_t* raw_caps = (uint32_t*)mRawBinary.data();
|
||||||
for (size_t i = 0; i < caps.size(); i++)
|
for (size_t i = 0; i < caps.size(); i++)
|
||||||
{
|
{
|
||||||
raw_caps[i] = le_word(caps[i].getCap());
|
raw_caps[i] = le_word(caps[i].getCap());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::KernelCapabilityBinary::fromBytes(const byte_t * data, size_t len)
|
void nn::hac::KernelCapabilityControl::fromBytes(const byte_t * data, size_t len)
|
||||||
{
|
{
|
||||||
if ((len % sizeof(uint32_t)) != 0)
|
if ((len % sizeof(uint32_t)) != 0)
|
||||||
{
|
{
|
||||||
throw fnd::Exception(kModuleName, "KernelCapabilityEntry list must be aligned to 4 bytes");
|
throw fnd::Exception(kModuleName, "KernelCapabilityEntry list must be aligned to 4 bytes");
|
||||||
}
|
}
|
||||||
|
|
||||||
// save copy of KernelCapabilityBinary
|
// save copy of KernelCapabilityControl
|
||||||
mRawBinary.alloc(len);
|
mRawBinary.alloc(len);
|
||||||
memcpy(mRawBinary.data(), data, len);
|
memcpy(mRawBinary.data(), data, len);
|
||||||
|
|
||||||
fnd::List<KernelCapabilityEntry> threadInfoCaps;
|
fnd::List<KernelCapabilityEntry> threadInfoCaps;
|
||||||
fnd::List<KernelCapabilityEntry> systemCallCaps;
|
fnd::List<KernelCapabilityEntry> systemCallCaps;
|
||||||
fnd::List<KernelCapabilityEntry> memoryMapCaps;
|
fnd::List<KernelCapabilityEntry> memoryMapCaps;
|
||||||
fnd::List<KernelCapabilityEntry> interuptCaps;
|
fnd::List<KernelCapabilityEntry> interuptCaps;
|
||||||
fnd::List<KernelCapabilityEntry> miscParamCaps;
|
fnd::List<KernelCapabilityEntry> miscParamCaps;
|
||||||
fnd::List<KernelCapabilityEntry> kernelVersionCaps;
|
fnd::List<KernelCapabilityEntry> kernelVersionCaps;
|
||||||
fnd::List<KernelCapabilityEntry> handleTableSizeCaps;
|
fnd::List<KernelCapabilityEntry> handleTableSizeCaps;
|
||||||
fnd::List<KernelCapabilityEntry> miscFlagsCaps;
|
fnd::List<KernelCapabilityEntry> miscFlagsCaps;
|
||||||
|
|
||||||
const uint32_t* raw_caps = (const uint32_t*)mRawBinary.data();
|
const uint32_t* raw_caps = (const uint32_t*)mRawBinary.data();
|
||||||
size_t cap_num = mRawBinary.size() / sizeof(uint32_t);
|
size_t cap_num = mRawBinary.size() / sizeof(uint32_t);
|
||||||
KernelCapabilityEntry cap;
|
KernelCapabilityEntry cap;
|
||||||
for (size_t i = 0; i < cap_num; i++)
|
for (size_t i = 0; i < cap_num; i++)
|
||||||
{
|
{
|
||||||
cap.setCap(le_word(raw_caps[i]));
|
cap.setCap(le_word(raw_caps[i]));
|
||||||
switch (cap.getType())
|
switch (cap.getType())
|
||||||
{
|
{
|
||||||
case (kc::KC_THREAD_INFO) :
|
case (kc::KC_THREAD_INFO) :
|
||||||
threadInfoCaps.addElement(cap);
|
threadInfoCaps.addElement(cap);
|
||||||
break;
|
break;
|
||||||
case (kc::KC_ENABLE_SYSTEM_CALLS):
|
case (kc::KC_ENABLE_SYSTEM_CALLS):
|
||||||
systemCallCaps.addElement(cap);
|
systemCallCaps.addElement(cap);
|
||||||
break;
|
break;
|
||||||
case (kc::KC_MEMORY_MAP):
|
case (kc::KC_MEMORY_MAP):
|
||||||
case (kc::KC_IO_MEMORY_MAP):
|
case (kc::KC_IO_MEMORY_MAP):
|
||||||
memoryMapCaps.addElement(cap);
|
memoryMapCaps.addElement(cap);
|
||||||
break;
|
break;
|
||||||
case (kc::KC_ENABLE_INTERUPTS):
|
case (kc::KC_ENABLE_INTERUPTS):
|
||||||
interuptCaps.addElement(cap);
|
interuptCaps.addElement(cap);
|
||||||
break;
|
break;
|
||||||
case (kc::KC_MISC_PARAMS):
|
case (kc::KC_MISC_PARAMS):
|
||||||
miscParamCaps.addElement(cap);
|
miscParamCaps.addElement(cap);
|
||||||
break;
|
break;
|
||||||
case (kc::KC_KERNEL_VERSION):
|
case (kc::KC_KERNEL_VERSION):
|
||||||
kernelVersionCaps.addElement(cap);
|
kernelVersionCaps.addElement(cap);
|
||||||
break;
|
break;
|
||||||
case (kc::KC_HANDLE_TABLE_SIZE):
|
case (kc::KC_HANDLE_TABLE_SIZE):
|
||||||
handleTableSizeCaps.addElement(cap);
|
handleTableSizeCaps.addElement(cap);
|
||||||
break;
|
break;
|
||||||
case (kc::KC_MISC_FLAGS):
|
case (kc::KC_MISC_FLAGS):
|
||||||
miscFlagsCaps.addElement(cap);
|
miscFlagsCaps.addElement(cap);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw fnd::Exception(kModuleName, "Unsupported kernel capability type");
|
throw fnd::Exception(kModuleName, "Unsupported kernel capability type");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mThreadInfo.importKernelCapabilityList(threadInfoCaps);
|
mThreadInfo.importKernelCapabilityList(threadInfoCaps);
|
||||||
mSystemCalls.importKernelCapabilityList(systemCallCaps);
|
mSystemCalls.importKernelCapabilityList(systemCallCaps);
|
||||||
mMemoryMap.importKernelCapabilityList(memoryMapCaps);
|
mMemoryMap.importKernelCapabilityList(memoryMapCaps);
|
||||||
mInterupts.importKernelCapabilityList(interuptCaps);
|
mInterupts.importKernelCapabilityList(interuptCaps);
|
||||||
mMiscParams.importKernelCapabilityList(miscParamCaps);
|
mMiscParams.importKernelCapabilityList(miscParamCaps);
|
||||||
mKernelVersion.importKernelCapabilityList(kernelVersionCaps);
|
mKernelVersion.importKernelCapabilityList(kernelVersionCaps);
|
||||||
mHandleTableSize.importKernelCapabilityList(handleTableSizeCaps);
|
mHandleTableSize.importKernelCapabilityList(handleTableSizeCaps);
|
||||||
mMiscFlags.importKernelCapabilityList(miscFlagsCaps);
|
mMiscFlags.importKernelCapabilityList(miscFlagsCaps);
|
||||||
}
|
}
|
||||||
|
|
||||||
const fnd::Vec<byte_t>& nn::hac::KernelCapabilityBinary::getBytes() const
|
const fnd::Vec<byte_t>& nn::hac::KernelCapabilityControl::getBytes() const
|
||||||
{
|
{
|
||||||
return mRawBinary;
|
return mRawBinary;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::KernelCapabilityBinary::clear()
|
void nn::hac::KernelCapabilityControl::clear()
|
||||||
{
|
{
|
||||||
mRawBinary.clear();
|
mRawBinary.clear();
|
||||||
mThreadInfo.clear();
|
mThreadInfo.clear();
|
||||||
mSystemCalls.clear();
|
mSystemCalls.clear();
|
||||||
mMemoryMap.clear();
|
mMemoryMap.clear();
|
||||||
mInterupts.clear();
|
mInterupts.clear();
|
||||||
mMiscParams.clear();
|
mMiscParams.clear();
|
||||||
mKernelVersion.clear();
|
mKernelVersion.clear();
|
||||||
mHandleTableSize.clear();
|
mHandleTableSize.clear();
|
||||||
mMiscFlags.clear();
|
mMiscFlags.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
const nn::hac::ThreadInfoHandler & nn::hac::KernelCapabilityBinary::getThreadInfo() const
|
const nn::hac::ThreadInfoHandler & nn::hac::KernelCapabilityControl::getThreadInfo() const
|
||||||
{
|
{
|
||||||
return mThreadInfo;
|
return mThreadInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
nn::hac::ThreadInfoHandler & nn::hac::KernelCapabilityBinary::getThreadInfo()
|
nn::hac::ThreadInfoHandler & nn::hac::KernelCapabilityControl::getThreadInfo()
|
||||||
{
|
{
|
||||||
return mThreadInfo;
|
return mThreadInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
const nn::hac::SystemCallHandler & nn::hac::KernelCapabilityBinary::getSystemCalls() const
|
const nn::hac::SystemCallHandler & nn::hac::KernelCapabilityControl::getSystemCalls() const
|
||||||
{
|
{
|
||||||
return mSystemCalls;
|
return mSystemCalls;
|
||||||
}
|
}
|
||||||
|
|
||||||
nn::hac::SystemCallHandler & nn::hac::KernelCapabilityBinary::getSystemCalls()
|
nn::hac::SystemCallHandler & nn::hac::KernelCapabilityControl::getSystemCalls()
|
||||||
{
|
{
|
||||||
return mSystemCalls;
|
return mSystemCalls;
|
||||||
}
|
}
|
||||||
|
|
||||||
const nn::hac::MemoryMappingHandler & nn::hac::KernelCapabilityBinary::getMemoryMaps() const
|
const nn::hac::MemoryMappingHandler & nn::hac::KernelCapabilityControl::getMemoryMaps() const
|
||||||
{
|
{
|
||||||
return mMemoryMap;
|
return mMemoryMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
nn::hac::MemoryMappingHandler & nn::hac::KernelCapabilityBinary::getMemoryMaps()
|
nn::hac::MemoryMappingHandler & nn::hac::KernelCapabilityControl::getMemoryMaps()
|
||||||
{
|
{
|
||||||
return mMemoryMap;
|
return mMemoryMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
const nn::hac::InteruptHandler & nn::hac::KernelCapabilityBinary::getInterupts() const
|
const nn::hac::InteruptHandler & nn::hac::KernelCapabilityControl::getInterupts() const
|
||||||
{
|
{
|
||||||
return mInterupts;
|
return mInterupts;
|
||||||
}
|
}
|
||||||
|
|
||||||
nn::hac::InteruptHandler & nn::hac::KernelCapabilityBinary::getInterupts()
|
nn::hac::InteruptHandler & nn::hac::KernelCapabilityControl::getInterupts()
|
||||||
{
|
{
|
||||||
return mInterupts;
|
return mInterupts;
|
||||||
}
|
}
|
||||||
|
|
||||||
const nn::hac::MiscParamsHandler & nn::hac::KernelCapabilityBinary::getMiscParams() const
|
const nn::hac::MiscParamsHandler & nn::hac::KernelCapabilityControl::getMiscParams() const
|
||||||
{
|
{
|
||||||
return mMiscParams;
|
return mMiscParams;
|
||||||
}
|
}
|
||||||
|
|
||||||
nn::hac::MiscParamsHandler & nn::hac::KernelCapabilityBinary::getMiscParams()
|
nn::hac::MiscParamsHandler & nn::hac::KernelCapabilityControl::getMiscParams()
|
||||||
{
|
{
|
||||||
return mMiscParams;
|
return mMiscParams;
|
||||||
}
|
}
|
||||||
|
|
||||||
const nn::hac::KernelVersionHandler & nn::hac::KernelCapabilityBinary::getKernelVersion() const
|
const nn::hac::KernelVersionHandler & nn::hac::KernelCapabilityControl::getKernelVersion() const
|
||||||
{
|
{
|
||||||
return mKernelVersion;
|
return mKernelVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
nn::hac::KernelVersionHandler & nn::hac::KernelCapabilityBinary::getKernelVersion()
|
nn::hac::KernelVersionHandler & nn::hac::KernelCapabilityControl::getKernelVersion()
|
||||||
{
|
{
|
||||||
return mKernelVersion;
|
return mKernelVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
const nn::hac::HandleTableSizeHandler & nn::hac::KernelCapabilityBinary::getHandleTableSize() const
|
const nn::hac::HandleTableSizeHandler & nn::hac::KernelCapabilityControl::getHandleTableSize() const
|
||||||
{
|
{
|
||||||
return mHandleTableSize;
|
return mHandleTableSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
nn::hac::HandleTableSizeHandler & nn::hac::KernelCapabilityBinary::getHandleTableSize()
|
nn::hac::HandleTableSizeHandler & nn::hac::KernelCapabilityControl::getHandleTableSize()
|
||||||
{
|
{
|
||||||
return mHandleTableSize;
|
return mHandleTableSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
const nn::hac::MiscFlagsHandler & nn::hac::KernelCapabilityBinary::getMiscFlags() const
|
const nn::hac::MiscFlagsHandler & nn::hac::KernelCapabilityControl::getMiscFlags() const
|
||||||
{
|
{
|
||||||
return mMiscFlags;
|
return mMiscFlags;
|
||||||
}
|
}
|
||||||
|
|
||||||
nn::hac::MiscFlagsHandler & nn::hac::KernelCapabilityBinary::getMiscFlags()
|
nn::hac::MiscFlagsHandler & nn::hac::KernelCapabilityControl::getMiscFlags()
|
||||||
{
|
{
|
||||||
return mMiscFlags;
|
return mMiscFlags;
|
||||||
}
|
}
|
|
@ -1,295 +1,295 @@
|
||||||
#include <nn/hac/MetaBinary.h>
|
#include <nn/hac/Meta.h>
|
||||||
|
|
||||||
#include <fnd/SimpleTextOutput.h>
|
#include <fnd/SimpleTextOutput.h>
|
||||||
|
|
||||||
nn::hac::MetaBinary::MetaBinary()
|
nn::hac::Meta::Meta()
|
||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
nn::hac::MetaBinary::MetaBinary(const MetaBinary & other) :
|
nn::hac::Meta::Meta(const Meta & other) :
|
||||||
MetaBinary()
|
Meta()
|
||||||
{
|
{
|
||||||
*this = other;
|
*this = other;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::MetaBinary::operator=(const MetaBinary & other)
|
void nn::hac::Meta::operator=(const Meta & other)
|
||||||
{
|
{
|
||||||
mRawBinary = other.mRawBinary;
|
mRawBinary = other.mRawBinary;
|
||||||
mInstructionType = other.mInstructionType;
|
mInstructionType = other.mInstructionType;
|
||||||
mProcAddressSpaceType = other.mProcAddressSpaceType;
|
mProcAddressSpaceType = other.mProcAddressSpaceType;
|
||||||
mMainThreadPriority = other.mMainThreadPriority;
|
mMainThreadPriority = other.mMainThreadPriority;
|
||||||
mMainThreadCpuId = other.mMainThreadCpuId;
|
mMainThreadCpuId = other.mMainThreadCpuId;
|
||||||
mVersion = other.mVersion;
|
mVersion = other.mVersion;
|
||||||
mMainThreadStackSize = other.mMainThreadStackSize;
|
mMainThreadStackSize = other.mMainThreadStackSize;
|
||||||
mName = other.mName;
|
mName = other.mName;
|
||||||
mProductCode = other.mProductCode;
|
mProductCode = other.mProductCode;
|
||||||
mAci = other.mAci;
|
mAci = other.mAci;
|
||||||
mAcid = other.mAcid;
|
mAcid = other.mAcid;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nn::hac::MetaBinary::operator==(const MetaBinary & other) const
|
bool nn::hac::Meta::operator==(const Meta & other) const
|
||||||
{
|
{
|
||||||
return (mInstructionType == other.mInstructionType) \
|
return (mInstructionType == other.mInstructionType) \
|
||||||
&& (mProcAddressSpaceType == other.mProcAddressSpaceType) \
|
&& (mProcAddressSpaceType == other.mProcAddressSpaceType) \
|
||||||
&& (mMainThreadPriority == other.mMainThreadPriority) \
|
&& (mMainThreadPriority == other.mMainThreadPriority) \
|
||||||
&& (mMainThreadCpuId == other.mMainThreadCpuId) \
|
&& (mMainThreadCpuId == other.mMainThreadCpuId) \
|
||||||
&& (mVersion == other.mVersion) \
|
&& (mVersion == other.mVersion) \
|
||||||
&& (mMainThreadStackSize == other.mMainThreadStackSize) \
|
&& (mMainThreadStackSize == other.mMainThreadStackSize) \
|
||||||
&& (mName == other.mName) \
|
&& (mName == other.mName) \
|
||||||
&& (mProductCode == other.mProductCode) \
|
&& (mProductCode == other.mProductCode) \
|
||||||
&& (mAci == other.mAci) \
|
&& (mAci == other.mAci) \
|
||||||
&& (mAcid == other.mAcid);
|
&& (mAcid == other.mAcid);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nn::hac::MetaBinary::operator!=(const MetaBinary & other) const
|
bool nn::hac::Meta::operator!=(const Meta & other) const
|
||||||
{
|
{
|
||||||
return !(*this == other);
|
return !(*this == other);
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::MetaBinary::toBytes()
|
void nn::hac::Meta::toBytes()
|
||||||
{
|
{
|
||||||
if (mAcid.getBytes().size() == 0)
|
if (mAcid.getBytes().size() == 0)
|
||||||
mAcid.toBytes();
|
mAcid.toBytes();
|
||||||
|
|
||||||
if (mAci.getBytes().size() == 0)
|
if (mAci.getBytes().size() == 0)
|
||||||
mAci.toBytes();
|
mAci.toBytes();
|
||||||
|
|
||||||
|
|
||||||
// determine section layout
|
// determine section layout
|
||||||
struct sLayout {
|
struct sLayout {
|
||||||
uint32_t offset, size;
|
uint32_t offset, size;
|
||||||
} acid, aci;
|
} acid, aci;
|
||||||
|
|
||||||
acid.offset = (uint32_t)align(sizeof(sMetaHeader), meta::kSectionAlignSize);
|
acid.offset = (uint32_t)align(sizeof(sMetaHeader), meta::kSectionAlignSize);
|
||||||
acid.size = (uint32_t)mAcid.getBytes().size();
|
acid.size = (uint32_t)mAcid.getBytes().size();
|
||||||
aci.offset = (uint32_t)(acid.offset + align(acid.size, meta::kSectionAlignSize));
|
aci.offset = (uint32_t)(acid.offset + align(acid.size, meta::kSectionAlignSize));
|
||||||
aci.size = (uint32_t)mAci.getBytes().size();
|
aci.size = (uint32_t)mAci.getBytes().size();
|
||||||
|
|
||||||
|
|
||||||
// get total size
|
// get total size
|
||||||
size_t total_size = _MAX(_MAX(acid.offset + acid.size, aci.offset + aci.size), align(sizeof(sMetaHeader), meta::kSectionAlignSize));
|
size_t total_size = _MAX(_MAX(acid.offset + acid.size, aci.offset + aci.size), align(sizeof(sMetaHeader), meta::kSectionAlignSize));
|
||||||
|
|
||||||
mRawBinary.alloc(total_size);
|
mRawBinary.alloc(total_size);
|
||||||
sMetaHeader* hdr = (sMetaHeader*)mRawBinary.data();
|
sMetaHeader* hdr = (sMetaHeader*)mRawBinary.data();
|
||||||
|
|
||||||
// set type
|
// set type
|
||||||
hdr->st_magic = meta::kMetaStructMagic;
|
hdr->st_magic = meta::kMetaStructMagic;
|
||||||
|
|
||||||
// set variables
|
// set variables
|
||||||
byte_t flag = ((byte_t)(mInstructionType & 1) | (byte_t)((mProcAddressSpaceType & 3) << 1)) & 0xf;
|
byte_t flag = ((byte_t)(mInstructionType & 1) | (byte_t)((mProcAddressSpaceType & 3) << 1)) & 0xf;
|
||||||
hdr->flags = flag;
|
hdr->flags = flag;
|
||||||
hdr->main_thread_priority = mMainThreadPriority;
|
hdr->main_thread_priority = mMainThreadPriority;
|
||||||
hdr->main_thread_cpu_id = mMainThreadCpuId;
|
hdr->main_thread_cpu_id = mMainThreadCpuId;
|
||||||
hdr->version = mVersion;
|
hdr->version = mVersion;
|
||||||
hdr->main_thread_stack_size = mMainThreadStackSize;
|
hdr->main_thread_stack_size = mMainThreadStackSize;
|
||||||
strncpy(hdr->name, mName.c_str(), meta::kNameMaxLen);
|
strncpy(hdr->name, mName.c_str(), meta::kNameMaxLen);
|
||||||
strncpy(hdr->product_code, mProductCode.c_str(), meta::kProductCodeMaxLen);
|
strncpy(hdr->product_code, mProductCode.c_str(), meta::kProductCodeMaxLen);
|
||||||
|
|
||||||
// set offset/size
|
// set offset/size
|
||||||
hdr->aci.offset = aci.offset;
|
hdr->aci.offset = aci.offset;
|
||||||
hdr->aci.size = aci.size;
|
hdr->aci.size = aci.size;
|
||||||
hdr->acid.offset = acid.offset;
|
hdr->acid.offset = acid.offset;
|
||||||
hdr->acid.size = acid.size;
|
hdr->acid.size = acid.size;
|
||||||
|
|
||||||
// write aci & acid
|
// write aci & acid
|
||||||
if (mAci.getBytes().size() > 0)
|
if (mAci.getBytes().size() > 0)
|
||||||
{
|
{
|
||||||
memcpy(mRawBinary.data() + aci.offset, mAci.getBytes().data(), mAci.getBytes().size());
|
memcpy(mRawBinary.data() + aci.offset, mAci.getBytes().data(), mAci.getBytes().size());
|
||||||
}
|
}
|
||||||
if (mAcid.getBytes().size() > 0)
|
if (mAcid.getBytes().size() > 0)
|
||||||
{
|
{
|
||||||
memcpy(mRawBinary.data() + acid.offset, mAcid.getBytes().data(), mAcid.getBytes().size());
|
memcpy(mRawBinary.data() + acid.offset, mAcid.getBytes().data(), mAcid.getBytes().size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::MetaBinary::fromBytes(const byte_t* data, size_t len)
|
void nn::hac::Meta::fromBytes(const byte_t* data, size_t len)
|
||||||
{
|
{
|
||||||
// check size
|
// check size
|
||||||
if (len < sizeof(sMetaHeader))
|
if (len < sizeof(sMetaHeader))
|
||||||
{
|
{
|
||||||
throw fnd::Exception(kModuleName, "META binary is too small");
|
throw fnd::Exception(kModuleName, "META binary is too small");
|
||||||
}
|
}
|
||||||
|
|
||||||
// clear variables
|
// clear variables
|
||||||
clear();
|
clear();
|
||||||
|
|
||||||
// save a copy of the header
|
// save a copy of the header
|
||||||
sMetaHeader hdr;
|
sMetaHeader hdr;
|
||||||
memcpy((void*)&hdr, data, sizeof(sMetaHeader));
|
memcpy((void*)&hdr, data, sizeof(sMetaHeader));
|
||||||
|
|
||||||
// check magic
|
// check magic
|
||||||
if (hdr.st_magic.get() != meta::kMetaStructMagic)
|
if (hdr.st_magic.get() != meta::kMetaStructMagic)
|
||||||
{
|
{
|
||||||
throw fnd::Exception(kModuleName, "META header corrupt (unrecognised struct signature)");
|
throw fnd::Exception(kModuleName, "META header corrupt (unrecognised struct signature)");
|
||||||
}
|
}
|
||||||
|
|
||||||
// save variables
|
// save variables
|
||||||
byte_t flag = hdr.flags & 0xf;
|
byte_t flag = hdr.flags & 0xf;
|
||||||
mInstructionType = (meta::InstructionType)(flag & 1);
|
mInstructionType = (meta::InstructionType)(flag & 1);
|
||||||
mProcAddressSpaceType = (meta::ProcAddrSpaceType)((flag >> 1) & 3);
|
mProcAddressSpaceType = (meta::ProcAddrSpaceType)((flag >> 1) & 3);
|
||||||
mMainThreadPriority = hdr.main_thread_priority;
|
mMainThreadPriority = hdr.main_thread_priority;
|
||||||
mMainThreadCpuId = hdr.main_thread_cpu_id;
|
mMainThreadCpuId = hdr.main_thread_cpu_id;
|
||||||
mVersion = hdr.version.get();
|
mVersion = hdr.version.get();
|
||||||
mMainThreadStackSize = hdr.main_thread_stack_size.get();
|
mMainThreadStackSize = hdr.main_thread_stack_size.get();
|
||||||
mName = std::string(hdr.name, _MIN(strlen(hdr.name), meta::kNameMaxLen));
|
mName = std::string(hdr.name, _MIN(strlen(hdr.name), meta::kNameMaxLen));
|
||||||
mProductCode = std::string(hdr.product_code, _MIN(strlen(hdr.product_code), meta::kProductCodeMaxLen));
|
mProductCode = std::string(hdr.product_code, _MIN(strlen(hdr.product_code), meta::kProductCodeMaxLen));
|
||||||
|
|
||||||
// total size
|
// total size
|
||||||
size_t total_size = _MAX(_MAX(hdr.acid.offset.get() + hdr.acid.size.get(), hdr.aci.offset.get() + hdr.aci.size.get()), sizeof(sMetaHeader));
|
size_t total_size = _MAX(_MAX(hdr.acid.offset.get() + hdr.acid.size.get(), hdr.aci.offset.get() + hdr.aci.size.get()), sizeof(sMetaHeader));
|
||||||
|
|
||||||
// check size
|
// check size
|
||||||
if (total_size > len)
|
if (total_size > len)
|
||||||
{
|
{
|
||||||
throw fnd::Exception(kModuleName, "META binary too small");
|
throw fnd::Exception(kModuleName, "META binary too small");
|
||||||
}
|
}
|
||||||
|
|
||||||
// save local copy
|
// save local copy
|
||||||
mRawBinary.alloc(total_size);
|
mRawBinary.alloc(total_size);
|
||||||
memcpy(mRawBinary.data(), data, mRawBinary.size());
|
memcpy(mRawBinary.data(), data, mRawBinary.size());
|
||||||
|
|
||||||
// import Aci/Acid
|
// import Aci/Acid
|
||||||
if (hdr.aci.size.get())
|
if (hdr.aci.size.get())
|
||||||
{
|
{
|
||||||
mAci.fromBytes(mRawBinary.data() + hdr.aci.offset.get(), hdr.aci.size.get());
|
mAci.fromBytes(mRawBinary.data() + hdr.aci.offset.get(), hdr.aci.size.get());
|
||||||
}
|
}
|
||||||
if (hdr.acid.size.get())
|
if (hdr.acid.size.get())
|
||||||
{
|
{
|
||||||
mAcid.fromBytes(mRawBinary.data() + hdr.acid.offset.get(), hdr.acid.size.get());
|
mAcid.fromBytes(mRawBinary.data() + hdr.acid.offset.get(), hdr.acid.size.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const fnd::Vec<byte_t>& nn::hac::MetaBinary::getBytes() const
|
const fnd::Vec<byte_t>& nn::hac::Meta::getBytes() const
|
||||||
{
|
{
|
||||||
return mRawBinary;
|
return mRawBinary;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::MetaBinary::clear()
|
void nn::hac::Meta::clear()
|
||||||
{
|
{
|
||||||
mRawBinary.clear();
|
mRawBinary.clear();
|
||||||
mInstructionType = meta::INSTR_64BIT;
|
mInstructionType = meta::INSTR_64BIT;
|
||||||
mProcAddressSpaceType = meta::ADDR_SPACE_64BIT;
|
mProcAddressSpaceType = meta::ADDR_SPACE_64BIT;
|
||||||
mMainThreadPriority = 0;
|
mMainThreadPriority = 0;
|
||||||
mMainThreadCpuId = 0;
|
mMainThreadCpuId = 0;
|
||||||
mVersion = 0;
|
mVersion = 0;
|
||||||
mMainThreadStackSize = 0;
|
mMainThreadStackSize = 0;
|
||||||
mName.clear();
|
mName.clear();
|
||||||
mProductCode.clear();
|
mProductCode.clear();
|
||||||
mAci.clear();
|
mAci.clear();
|
||||||
mAcid.clear();
|
mAcid.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
nn::hac::meta::InstructionType nn::hac::MetaBinary::getInstructionType() const
|
nn::hac::meta::InstructionType nn::hac::Meta::getInstructionType() const
|
||||||
{
|
{
|
||||||
return mInstructionType;
|
return mInstructionType;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::MetaBinary::setInstructionType(meta::InstructionType type)
|
void nn::hac::Meta::setInstructionType(meta::InstructionType type)
|
||||||
{
|
{
|
||||||
mInstructionType = type;
|
mInstructionType = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
nn::hac::meta::ProcAddrSpaceType nn::hac::MetaBinary::getProcAddressSpaceType() const
|
nn::hac::meta::ProcAddrSpaceType nn::hac::Meta::getProcAddressSpaceType() const
|
||||||
{
|
{
|
||||||
return mProcAddressSpaceType;
|
return mProcAddressSpaceType;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::MetaBinary::setProcAddressSpaceType(meta::ProcAddrSpaceType type)
|
void nn::hac::Meta::setProcAddressSpaceType(meta::ProcAddrSpaceType type)
|
||||||
{
|
{
|
||||||
mProcAddressSpaceType = type;
|
mProcAddressSpaceType = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
byte_t nn::hac::MetaBinary::getMainThreadPriority() const
|
byte_t nn::hac::Meta::getMainThreadPriority() const
|
||||||
{
|
{
|
||||||
return mMainThreadPriority;
|
return mMainThreadPriority;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::MetaBinary::setMainThreadPriority(byte_t priority)
|
void nn::hac::Meta::setMainThreadPriority(byte_t priority)
|
||||||
{
|
{
|
||||||
if (priority > meta::kMaxPriority)
|
if (priority > meta::kMaxPriority)
|
||||||
{
|
{
|
||||||
throw fnd::Exception(kModuleName, "Illegal main thread priority (range 0-63)");
|
throw fnd::Exception(kModuleName, "Illegal main thread priority (range 0-63)");
|
||||||
}
|
}
|
||||||
|
|
||||||
mMainThreadPriority = priority;
|
mMainThreadPriority = priority;
|
||||||
}
|
}
|
||||||
|
|
||||||
byte_t nn::hac::MetaBinary::getMainThreadCpuId() const
|
byte_t nn::hac::Meta::getMainThreadCpuId() const
|
||||||
{
|
{
|
||||||
return mMainThreadCpuId;
|
return mMainThreadCpuId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::MetaBinary::setMainThreadCpuId(byte_t core_num)
|
void nn::hac::Meta::setMainThreadCpuId(byte_t core_num)
|
||||||
{
|
{
|
||||||
mMainThreadCpuId = core_num;
|
mMainThreadCpuId = core_num;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nn::hac::MetaBinary::getVersion() const
|
uint32_t nn::hac::Meta::getVersion() const
|
||||||
{
|
{
|
||||||
return mVersion;
|
return mVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::MetaBinary::setVersion(uint32_t version)
|
void nn::hac::Meta::setVersion(uint32_t version)
|
||||||
{
|
{
|
||||||
mVersion = version;
|
mVersion = version;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nn::hac::MetaBinary::getMainThreadStackSize() const
|
uint32_t nn::hac::Meta::getMainThreadStackSize() const
|
||||||
{
|
{
|
||||||
return mMainThreadStackSize;
|
return mMainThreadStackSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::MetaBinary::setMainThreadStackSize(uint32_t size)
|
void nn::hac::Meta::setMainThreadStackSize(uint32_t size)
|
||||||
{
|
{
|
||||||
mMainThreadStackSize = size;
|
mMainThreadStackSize = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string & nn::hac::MetaBinary::getName() const
|
const std::string & nn::hac::Meta::getName() const
|
||||||
{
|
{
|
||||||
return mName;
|
return mName;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::MetaBinary::setName(const std::string & name)
|
void nn::hac::Meta::setName(const std::string & name)
|
||||||
{
|
{
|
||||||
if (name.length() > meta::kNameMaxLen)
|
if (name.length() > meta::kNameMaxLen)
|
||||||
{
|
{
|
||||||
throw fnd::Exception(kModuleName, "Name is too long");
|
throw fnd::Exception(kModuleName, "Name is too long");
|
||||||
}
|
}
|
||||||
|
|
||||||
mName = name;
|
mName = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string & nn::hac::MetaBinary::getProductCode() const
|
const std::string & nn::hac::Meta::getProductCode() const
|
||||||
{
|
{
|
||||||
return mProductCode;
|
return mProductCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::MetaBinary::setProductCode(const std::string & product_code)
|
void nn::hac::Meta::setProductCode(const std::string & product_code)
|
||||||
{
|
{
|
||||||
if (product_code.length() > meta::kProductCodeMaxLen)
|
if (product_code.length() > meta::kProductCodeMaxLen)
|
||||||
{
|
{
|
||||||
throw fnd::Exception(kModuleName, "Product Code is too long");
|
throw fnd::Exception(kModuleName, "Product Code is too long");
|
||||||
}
|
}
|
||||||
|
|
||||||
mProductCode = product_code;
|
mProductCode = product_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
const nn::hac::AccessControlInfoBinary & nn::hac::MetaBinary::getAci() const
|
const nn::hac::AccessControlInfo & nn::hac::Meta::getAci() const
|
||||||
{
|
{
|
||||||
return mAci;
|
return mAci;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::MetaBinary::setAci(const AccessControlInfoBinary & aci)
|
void nn::hac::Meta::setAci(const AccessControlInfo & aci)
|
||||||
{
|
{
|
||||||
mAci = aci;
|
mAci = aci;
|
||||||
}
|
}
|
||||||
|
|
||||||
const nn::hac::AccessControlInfoDescBinary & nn::hac::MetaBinary::getAcid() const
|
const nn::hac::AccessControlInfoDesc & nn::hac::Meta::getAcid() const
|
||||||
{
|
{
|
||||||
return mAcid;
|
return mAcid;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::MetaBinary::setAcid(const AccessControlInfoDescBinary & acid)
|
void nn::hac::Meta::setAcid(const AccessControlInfoDesc & acid)
|
||||||
{
|
{
|
||||||
mAcid = acid;
|
mAcid = acid;
|
||||||
}
|
}
|
|
@ -1,327 +0,0 @@
|
||||||
#include <nn/hac/NcaHeader.h>
|
|
||||||
|
|
||||||
nn::hac::NcaHeader::NcaHeader()
|
|
||||||
{
|
|
||||||
clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
nn::hac::NcaHeader::NcaHeader(const NcaHeader & other)
|
|
||||||
{
|
|
||||||
*this = other;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool nn::hac::NcaHeader::operator==(const NcaHeader & other) const
|
|
||||||
{
|
|
||||||
return (mDistributionType == other.mDistributionType) \
|
|
||||||
&& (mContentType == other.mContentType) \
|
|
||||||
&& (mKeyGeneration == other.mKeyGeneration) \
|
|
||||||
&& (mKaekIndex == other.mKaekIndex) \
|
|
||||||
&& (mContentSize == other.mContentSize) \
|
|
||||||
&& (mProgramId == other.mProgramId) \
|
|
||||||
&& (mContentIndex == other.mContentIndex) \
|
|
||||||
&& (mSdkAddonVersion == other.mSdkAddonVersion) \
|
|
||||||
&& (mPartitions == other.mPartitions) \
|
|
||||||
&& (mEncAesKeys == other.mEncAesKeys);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool nn::hac::NcaHeader::operator!=(const NcaHeader & other) const
|
|
||||||
{
|
|
||||||
return !(*this == other);
|
|
||||||
}
|
|
||||||
|
|
||||||
void nn::hac::NcaHeader::operator=(const NcaHeader & other)
|
|
||||||
{
|
|
||||||
if (other.getBytes().size())
|
|
||||||
{
|
|
||||||
fromBytes(other.getBytes().data(), other.getBytes().size());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mRawBinary.clear();
|
|
||||||
mDistributionType = other.mDistributionType;
|
|
||||||
mContentType = other.mContentType;
|
|
||||||
mKeyGeneration = other.mKeyGeneration;
|
|
||||||
mKaekIndex = other.mKaekIndex;
|
|
||||||
mContentSize = other.mContentSize;
|
|
||||||
mProgramId = other.mProgramId;
|
|
||||||
mContentIndex = other.mContentIndex;
|
|
||||||
mSdkAddonVersion = other.mSdkAddonVersion;
|
|
||||||
mPartitions = other.mPartitions;
|
|
||||||
mEncAesKeys = other.mEncAesKeys;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void nn::hac::NcaHeader::toBytes()
|
|
||||||
{
|
|
||||||
mRawBinary.alloc(sizeof(sNcaHeader));
|
|
||||||
sNcaHeader* hdr = (sNcaHeader*)mRawBinary.data();
|
|
||||||
|
|
||||||
|
|
||||||
switch(mFormatVersion)
|
|
||||||
{
|
|
||||||
case (NCA2_FORMAT):
|
|
||||||
hdr->st_magic = nca::kNca2StructMagic;
|
|
||||||
break;
|
|
||||||
case (NCA3_FORMAT):
|
|
||||||
hdr->st_magic = nca::kNca3StructMagic;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw fnd::Exception(kModuleName, "Unsupported format version");
|
|
||||||
}
|
|
||||||
hdr->distribution_type = mDistributionType;
|
|
||||||
hdr->content_type = mContentType;
|
|
||||||
if (mKeyGeneration > 2)
|
|
||||||
{
|
|
||||||
hdr->key_generation = 2;
|
|
||||||
hdr->key_generation_2 = mKeyGeneration;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
hdr->key_generation = mKeyGeneration;
|
|
||||||
hdr->key_generation_2 = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
hdr->key_area_encryption_key_index = mKaekIndex;
|
|
||||||
hdr->content_size = mContentSize;
|
|
||||||
hdr->program_id = mProgramId;
|
|
||||||
hdr->content_index = mContentIndex;
|
|
||||||
hdr->sdk_addon_version = mSdkAddonVersion;
|
|
||||||
memcpy(hdr->rights_id, mRightsId, nca::kRightsIdLen);
|
|
||||||
|
|
||||||
// TODO: properly reconstruct NCA layout? atm in hands of user
|
|
||||||
for (size_t i = 0; i < mPartitions.size(); i++)
|
|
||||||
{
|
|
||||||
// determine partition index
|
|
||||||
byte_t idx = mPartitions[i].index;
|
|
||||||
|
|
||||||
if (mPartitions[i].index >= nca::kPartitionNum || hdr->partition[idx].enabled) continue;
|
|
||||||
|
|
||||||
hdr->partition[idx].start = sizeToBlockNum(mPartitions[i].offset);
|
|
||||||
hdr->partition[idx].end = (sizeToBlockNum(mPartitions[i].offset) + sizeToBlockNum(mPartitions[i].size));
|
|
||||||
hdr->partition[idx].enabled = true;
|
|
||||||
hdr->partition_hash[idx] = mPartitions[i].hash;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (size_t i = 0; i < nca::kAesKeyNum; i++)
|
|
||||||
{
|
|
||||||
hdr->enc_aes_key[i] = mEncAesKeys[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void nn::hac::NcaHeader::fromBytes(const byte_t * data, size_t len)
|
|
||||||
{
|
|
||||||
if (len < sizeof(sNcaHeader))
|
|
||||||
{
|
|
||||||
throw fnd::Exception(kModuleName, "NCA header size is too small");
|
|
||||||
}
|
|
||||||
|
|
||||||
clear();
|
|
||||||
|
|
||||||
mRawBinary.alloc(sizeof(sNcaHeader));
|
|
||||||
memcpy(mRawBinary.data(), data, sizeof(sNcaHeader));
|
|
||||||
|
|
||||||
sNcaHeader* hdr = (sNcaHeader*)mRawBinary.data();
|
|
||||||
|
|
||||||
switch(hdr->st_magic.get())
|
|
||||||
{
|
|
||||||
case (nca::kNca2StructMagic) :
|
|
||||||
mFormatVersion = NCA2_FORMAT;
|
|
||||||
break;
|
|
||||||
case (nca::kNca3StructMagic) :
|
|
||||||
mFormatVersion = NCA3_FORMAT;
|
|
||||||
break;
|
|
||||||
throw fnd::Exception(kModuleName, "NCA header corrupt");
|
|
||||||
}
|
|
||||||
|
|
||||||
mDistributionType = (nca::DistributionType)hdr->distribution_type;
|
|
||||||
mContentType = (nca::ContentType)hdr->content_type;
|
|
||||||
mKeyGeneration = _MAX(hdr->key_generation, hdr->key_generation_2);
|
|
||||||
mKaekIndex = hdr->key_area_encryption_key_index;
|
|
||||||
mContentSize = *hdr->content_size;
|
|
||||||
mProgramId = *hdr->program_id;
|
|
||||||
mContentIndex = *hdr->content_index;
|
|
||||||
mSdkAddonVersion = *hdr->sdk_addon_version;
|
|
||||||
memcpy(mRightsId, hdr->rights_id, nca::kRightsIdLen);
|
|
||||||
|
|
||||||
for (size_t i = 0; i < nca::kPartitionNum; i++)
|
|
||||||
{
|
|
||||||
// skip sections that don't exist
|
|
||||||
if (hdr->partition[i].enabled == 0) continue;
|
|
||||||
|
|
||||||
// add high level struct
|
|
||||||
mPartitions.addElement({(byte_t)i, blockNumToSize(hdr->partition[i].start.get()), blockNumToSize(hdr->partition[i].end.get() - hdr->partition[i].start.get()), hdr->partition_hash[i] });
|
|
||||||
}
|
|
||||||
|
|
||||||
for (size_t i = 0; i < nca::kAesKeyNum; i++)
|
|
||||||
{
|
|
||||||
mEncAesKeys.addElement(hdr->enc_aes_key[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const fnd::Vec<byte_t>& nn::hac::NcaHeader::getBytes() const
|
|
||||||
{
|
|
||||||
return mRawBinary;
|
|
||||||
}
|
|
||||||
|
|
||||||
void nn::hac::NcaHeader::clear()
|
|
||||||
{
|
|
||||||
mFormatVersion = NCA3_FORMAT;
|
|
||||||
mDistributionType = nca::DIST_DOWNLOAD;
|
|
||||||
mContentType = nca::TYPE_PROGRAM;
|
|
||||||
mKeyGeneration = 0;
|
|
||||||
mKaekIndex = 0;
|
|
||||||
mContentSize = 0;
|
|
||||||
mProgramId = 0;
|
|
||||||
mContentIndex = 0;
|
|
||||||
mSdkAddonVersion = 0;
|
|
||||||
|
|
||||||
mPartitions.clear();
|
|
||||||
mEncAesKeys.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
nn::hac::NcaHeader::FormatVersion nn::hac::NcaHeader::getFormatVersion() const
|
|
||||||
{
|
|
||||||
return mFormatVersion;
|
|
||||||
}
|
|
||||||
|
|
||||||
void nn::hac::NcaHeader::setFormatVersion(FormatVersion version)
|
|
||||||
{
|
|
||||||
mFormatVersion = version;
|
|
||||||
}
|
|
||||||
|
|
||||||
nn::hac::nca::DistributionType nn::hac::NcaHeader::getDistributionType() const
|
|
||||||
{
|
|
||||||
return mDistributionType;
|
|
||||||
}
|
|
||||||
|
|
||||||
void nn::hac::NcaHeader::setDistributionType(nca::DistributionType type)
|
|
||||||
{
|
|
||||||
mDistributionType = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
nn::hac::nca::ContentType nn::hac::NcaHeader::getContentType() const
|
|
||||||
{
|
|
||||||
return mContentType;
|
|
||||||
}
|
|
||||||
|
|
||||||
void nn::hac::NcaHeader::setContentType(nca::ContentType type)
|
|
||||||
{
|
|
||||||
mContentType = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
byte_t nn::hac::NcaHeader::getKeyGeneration() const
|
|
||||||
{
|
|
||||||
return mKeyGeneration;
|
|
||||||
}
|
|
||||||
|
|
||||||
void nn::hac::NcaHeader::setKeyGeneration(byte_t gen)
|
|
||||||
{
|
|
||||||
mKeyGeneration = gen;
|
|
||||||
}
|
|
||||||
|
|
||||||
byte_t nn::hac::NcaHeader::getKaekIndex() const
|
|
||||||
{
|
|
||||||
return mKaekIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
void nn::hac::NcaHeader::setKaekIndex(byte_t index)
|
|
||||||
{
|
|
||||||
mKaekIndex = index;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64_t nn::hac::NcaHeader::getContentSize() const
|
|
||||||
{
|
|
||||||
return mContentSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
void nn::hac::NcaHeader::setContentSize(uint64_t size)
|
|
||||||
{
|
|
||||||
mContentSize = size;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64_t nn::hac::NcaHeader::getProgramId() const
|
|
||||||
{
|
|
||||||
return mProgramId;
|
|
||||||
}
|
|
||||||
|
|
||||||
void nn::hac::NcaHeader::setProgramId(uint64_t program_id)
|
|
||||||
{
|
|
||||||
mProgramId = program_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t nn::hac::NcaHeader::getContentIndex() const
|
|
||||||
{
|
|
||||||
return mContentIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
void nn::hac::NcaHeader::setContentIndex(uint32_t index)
|
|
||||||
{
|
|
||||||
mContentIndex = index;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t nn::hac::NcaHeader::getSdkAddonVersion() const
|
|
||||||
{
|
|
||||||
return mSdkAddonVersion;
|
|
||||||
}
|
|
||||||
|
|
||||||
void nn::hac::NcaHeader::setSdkAddonVersion(uint32_t version)
|
|
||||||
{
|
|
||||||
mSdkAddonVersion = version;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool nn::hac::NcaHeader::hasRightsId() const
|
|
||||||
{
|
|
||||||
bool rightsIdIsSet = false;
|
|
||||||
|
|
||||||
for (size_t i = 0; i < nca::kRightsIdLen; i++)
|
|
||||||
{
|
|
||||||
if (mRightsId[i] != 0)
|
|
||||||
rightsIdIsSet = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return rightsIdIsSet;
|
|
||||||
}
|
|
||||||
|
|
||||||
const byte_t* nn::hac::NcaHeader::getRightsId() const
|
|
||||||
{
|
|
||||||
return mRightsId;
|
|
||||||
}
|
|
||||||
|
|
||||||
void nn::hac::NcaHeader::setRightsId(const byte_t* rights_id)
|
|
||||||
{
|
|
||||||
memcpy(mRightsId, rights_id, nca::kRightsIdLen);
|
|
||||||
}
|
|
||||||
|
|
||||||
const fnd::List<nn::hac::NcaHeader::sPartition>& nn::hac::NcaHeader::getPartitions() const
|
|
||||||
{
|
|
||||||
return mPartitions;
|
|
||||||
}
|
|
||||||
|
|
||||||
void nn::hac::NcaHeader::setPartitions(const fnd::List<nn::hac::NcaHeader::sPartition>& partitions)
|
|
||||||
{
|
|
||||||
mPartitions = partitions;
|
|
||||||
if (mPartitions.size() >= nca::kPartitionNum)
|
|
||||||
{
|
|
||||||
throw fnd::Exception(kModuleName, "Too many NCA partitions");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const fnd::List<fnd::aes::sAes128Key>& nn::hac::NcaHeader::getEncAesKeys() const
|
|
||||||
{
|
|
||||||
return mEncAesKeys;
|
|
||||||
}
|
|
||||||
|
|
||||||
void nn::hac::NcaHeader::setEncAesKeys(const fnd::List<fnd::aes::sAes128Key>& keys)
|
|
||||||
{
|
|
||||||
mEncAesKeys = keys;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64_t nn::hac::NcaHeader::blockNumToSize(uint32_t block_num) const
|
|
||||||
{
|
|
||||||
return block_num*nca::kSectorSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t nn::hac::NcaHeader::sizeToBlockNum(uint64_t real_size) const
|
|
||||||
{
|
|
||||||
return (uint32_t)(align(real_size, nca::kSectorSize) / nca::kSectorSize);
|
|
||||||
}
|
|
|
@ -1,16 +1,16 @@
|
||||||
#include <nn/hac/PfsHeader.h>
|
#include <nn/hac/PartitionFsHeader.h>
|
||||||
|
|
||||||
nn::hac::PfsHeader::PfsHeader()
|
nn::hac::PartitionFsHeader::PartitionFsHeader()
|
||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
nn::hac::PfsHeader::PfsHeader(const PfsHeader & other)
|
nn::hac::PartitionFsHeader::PartitionFsHeader(const PartitionFsHeader & other)
|
||||||
{
|
{
|
||||||
*this = other;
|
*this = other;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::PfsHeader::operator=(const PfsHeader & other)
|
void nn::hac::PartitionFsHeader::operator=(const PartitionFsHeader & other)
|
||||||
{
|
{
|
||||||
if (other.getBytes().size())
|
if (other.getBytes().size())
|
||||||
{
|
{
|
||||||
|
@ -24,24 +24,24 @@ void nn::hac::PfsHeader::operator=(const PfsHeader & other)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nn::hac::PfsHeader::operator==(const PfsHeader & other) const
|
bool nn::hac::PartitionFsHeader::operator==(const PartitionFsHeader & other) const
|
||||||
{
|
{
|
||||||
return (mFsType == other.mFsType) \
|
return (mFsType == other.mFsType) \
|
||||||
&& (mFileList == other.mFileList);
|
&& (mFileList == other.mFileList);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nn::hac::PfsHeader::operator!=(const PfsHeader & other) const
|
bool nn::hac::PartitionFsHeader::operator!=(const PartitionFsHeader & other) const
|
||||||
{
|
{
|
||||||
return !(*this == other);
|
return !(*this == other);
|
||||||
}
|
}
|
||||||
|
|
||||||
const fnd::Vec<byte_t>& nn::hac::PfsHeader::getBytes() const
|
const fnd::Vec<byte_t>& nn::hac::PartitionFsHeader::getBytes() const
|
||||||
{
|
{
|
||||||
return mRawBinary;
|
return mRawBinary;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void nn::hac::PfsHeader::toBytes()
|
void nn::hac::PartitionFsHeader::toBytes()
|
||||||
{
|
{
|
||||||
// calculate name table size
|
// calculate name table size
|
||||||
size_t name_table_size = 0;
|
size_t name_table_size = 0;
|
||||||
|
@ -113,7 +113,7 @@ void nn::hac::PfsHeader::toBytes()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::PfsHeader::fromBytes(const byte_t* data, size_t len)
|
void nn::hac::PartitionFsHeader::fromBytes(const byte_t* data, size_t len)
|
||||||
{
|
{
|
||||||
// check input length meets minimum size
|
// check input length meets minimum size
|
||||||
if (len < sizeof(sPfsHeader))
|
if (len < sizeof(sPfsHeader))
|
||||||
|
@ -195,39 +195,39 @@ void nn::hac::PfsHeader::fromBytes(const byte_t* data, size_t len)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::PfsHeader::clear()
|
void nn::hac::PartitionFsHeader::clear()
|
||||||
{
|
{
|
||||||
mRawBinary.clear();
|
mRawBinary.clear();
|
||||||
mFsType = TYPE_PFS0;
|
mFsType = TYPE_PFS0;
|
||||||
mFileList.clear();
|
mFileList.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
nn::hac::PfsHeader::FsType nn::hac::PfsHeader::getFsType() const
|
nn::hac::PartitionFsHeader::FsType nn::hac::PartitionFsHeader::getFsType() const
|
||||||
{
|
{
|
||||||
return mFsType;
|
return mFsType;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::PfsHeader::setFsType(FsType type)
|
void nn::hac::PartitionFsHeader::setFsType(FsType type)
|
||||||
{
|
{
|
||||||
mFsType = type;
|
mFsType = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
const fnd::List<nn::hac::PfsHeader::sFile>& nn::hac::PfsHeader::getFileList() const
|
const fnd::List<nn::hac::PartitionFsHeader::sFile>& nn::hac::PartitionFsHeader::getFileList() const
|
||||||
{
|
{
|
||||||
return mFileList;
|
return mFileList;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::PfsHeader::addFile(const std::string & name, size_t size)
|
void nn::hac::PartitionFsHeader::addFile(const std::string & name, size_t size)
|
||||||
{
|
{
|
||||||
mFileList.addElement({ name, 0, size, 0 });
|
mFileList.addElement({ name, 0, size, 0 });
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::PfsHeader::addFile(const std::string & name, size_t size, size_t hash_protected_size, const fnd::sha::sSha256Hash& hash)
|
void nn::hac::PartitionFsHeader::addFile(const std::string & name, size_t size, size_t hash_protected_size, const fnd::sha::sSha256Hash& hash)
|
||||||
{
|
{
|
||||||
mFileList.addElement({ name, 0, size, hash_protected_size, hash });
|
mFileList.addElement({ name, 0, size, hash_protected_size, hash });
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t nn::hac::PfsHeader::getFileEntrySize(FsType fs_type)
|
size_t nn::hac::PartitionFsHeader::getFileEntrySize(FsType fs_type)
|
||||||
{
|
{
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
switch(fs_type)
|
switch(fs_type)
|
||||||
|
@ -244,7 +244,7 @@ size_t nn::hac::PfsHeader::getFileEntrySize(FsType fs_type)
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::PfsHeader::calculateOffsets(size_t data_offset)
|
void nn::hac::PartitionFsHeader::calculateOffsets(size_t data_offset)
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < mFileList.size(); i++)
|
for (size_t i = 0; i < mFileList.size(); i++)
|
||||||
{
|
{
|
99
lib/libhac/source/PatchMetaExtendedHeader.cpp
Normal file
99
lib/libhac/source/PatchMetaExtendedHeader.cpp
Normal file
|
@ -0,0 +1,99 @@
|
||||||
|
#include <nn/hac/PatchMetaExtendedHeader.h>
|
||||||
|
|
||||||
|
nn::hac::PatchMetaExtendedHeader::PatchMetaExtendedHeader()
|
||||||
|
{
|
||||||
|
clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
nn::hac::PatchMetaExtendedHeader::PatchMetaExtendedHeader(const PatchMetaExtendedHeader& other)
|
||||||
|
{
|
||||||
|
*this = other;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::PatchMetaExtendedHeader::operator=(const PatchMetaExtendedHeader& other)
|
||||||
|
{
|
||||||
|
clear();
|
||||||
|
mRawBinary = other.mRawBinary;
|
||||||
|
mApplicationId = other.mApplicationId;
|
||||||
|
mRequiredSystemVersion = other.mRequiredSystemVersion;
|
||||||
|
mExtendedDataSize = other.mExtendedDataSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool nn::hac::PatchMetaExtendedHeader::operator==(const PatchMetaExtendedHeader& other) const
|
||||||
|
{
|
||||||
|
return (mApplicationId == other.mApplicationId) \
|
||||||
|
&& (mRequiredSystemVersion == other.mRequiredSystemVersion) \
|
||||||
|
&& (mExtendedDataSize == other.mExtendedDataSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool nn::hac::PatchMetaExtendedHeader::operator!=(const PatchMetaExtendedHeader& other) const
|
||||||
|
{
|
||||||
|
return !(*this == other);
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::PatchMetaExtendedHeader::toBytes()
|
||||||
|
{
|
||||||
|
mRawBinary.alloc(sizeof(sPatchMetaExtendedHeader));
|
||||||
|
sPatchMetaExtendedHeader* info = (sPatchMetaExtendedHeader*)mRawBinary.data();
|
||||||
|
|
||||||
|
info->application_id = mApplicationId;
|
||||||
|
info->required_system_version = mRequiredSystemVersion;
|
||||||
|
info->extended_data_size = mExtendedDataSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::PatchMetaExtendedHeader::fromBytes(const byte_t* bytes, size_t len)
|
||||||
|
{
|
||||||
|
if (len < sizeof(sPatchMetaExtendedHeader))
|
||||||
|
{
|
||||||
|
throw fnd::Exception(kModuleName, "PatchMetaExtendedHeader too small");
|
||||||
|
}
|
||||||
|
|
||||||
|
const sPatchMetaExtendedHeader* info = (const sPatchMetaExtendedHeader*)bytes;
|
||||||
|
|
||||||
|
mApplicationId = info->application_id.get();
|
||||||
|
mRequiredSystemVersion = info->required_system_version.get();
|
||||||
|
mExtendedDataSize = info->extended_data_size.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
const fnd::Vec<byte_t>& nn::hac::PatchMetaExtendedHeader::getBytes() const
|
||||||
|
{
|
||||||
|
return mRawBinary;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::PatchMetaExtendedHeader::clear()
|
||||||
|
{
|
||||||
|
mRawBinary.clear();
|
||||||
|
mApplicationId = 0;
|
||||||
|
mRequiredSystemVersion = 0;
|
||||||
|
mExtendedDataSize = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t nn::hac::PatchMetaExtendedHeader::getApplicationId() const
|
||||||
|
{
|
||||||
|
return mApplicationId;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::PatchMetaExtendedHeader::setApplicationId(uint64_t application_id)
|
||||||
|
{
|
||||||
|
mApplicationId = application_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t nn::hac::PatchMetaExtendedHeader::getRequiredSystemVersion() const
|
||||||
|
{
|
||||||
|
return mRequiredSystemVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::PatchMetaExtendedHeader::setRequiredSystemVersion(uint32_t sys_ver)
|
||||||
|
{
|
||||||
|
mRequiredSystemVersion = sys_ver;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t nn::hac::PatchMetaExtendedHeader::getExtendedDataSize() const
|
||||||
|
{
|
||||||
|
return mExtendedDataSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nn::hac::PatchMetaExtendedHeader::setExtendedDataSize(uint32_t size)
|
||||||
|
{
|
||||||
|
mExtendedDataSize = size;
|
||||||
|
}
|
|
@ -1,79 +1,79 @@
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <nn/hac/ServiceAccessControlBinary.h>
|
#include <nn/hac/ServiceAccessControl.h>
|
||||||
|
|
||||||
nn::hac::ServiceAccessControlBinary::ServiceAccessControlBinary()
|
nn::hac::ServiceAccessControl::ServiceAccessControl()
|
||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
nn::hac::ServiceAccessControlBinary::ServiceAccessControlBinary(const ServiceAccessControlBinary & other)
|
nn::hac::ServiceAccessControl::ServiceAccessControl(const ServiceAccessControl & other)
|
||||||
{
|
{
|
||||||
*this = other;
|
*this = other;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ServiceAccessControlBinary::operator=(const ServiceAccessControlBinary & other)
|
void nn::hac::ServiceAccessControl::operator=(const ServiceAccessControl & other)
|
||||||
{
|
{
|
||||||
mRawBinary = other.mRawBinary;
|
mRawBinary = other.mRawBinary;
|
||||||
mServices = other.mServices;
|
mServices = other.mServices;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nn::hac::ServiceAccessControlBinary::operator==(const ServiceAccessControlBinary & other) const
|
bool nn::hac::ServiceAccessControl::operator==(const ServiceAccessControl & other) const
|
||||||
{
|
{
|
||||||
return (mServices == other.mServices);
|
return (mServices == other.mServices);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nn::hac::ServiceAccessControlBinary::operator!=(const ServiceAccessControlBinary & other) const
|
bool nn::hac::ServiceAccessControl::operator!=(const ServiceAccessControl & other) const
|
||||||
{
|
{
|
||||||
return !(*this == other);
|
return !(*this == other);
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ServiceAccessControlBinary::toBytes()
|
void nn::hac::ServiceAccessControl::toBytes()
|
||||||
{
|
{
|
||||||
size_t totalSize = 0;
|
size_t totalSize = 0;
|
||||||
for (size_t i = 0; i < mServices.size(); i++)
|
for (size_t i = 0; i < mServices.size(); i++)
|
||||||
{
|
{
|
||||||
mServices[i].toBytes();
|
mServices[i].toBytes();
|
||||||
totalSize += mServices[i].getBytes().size();
|
totalSize += mServices[i].getBytes().size();
|
||||||
}
|
}
|
||||||
|
|
||||||
mRawBinary.alloc(totalSize);
|
mRawBinary.alloc(totalSize);
|
||||||
for (size_t i = 0, pos = 0; i < mServices.size(); pos += mServices[i].getBytes().size(), i++)
|
for (size_t i = 0, pos = 0; i < mServices.size(); pos += mServices[i].getBytes().size(), i++)
|
||||||
{
|
{
|
||||||
memcpy((mRawBinary.data() + pos), mServices[i].getBytes().data(), mServices[i].getBytes().size());
|
memcpy((mRawBinary.data() + pos), mServices[i].getBytes().data(), mServices[i].getBytes().size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ServiceAccessControlBinary::fromBytes(const byte_t* data, size_t len)
|
void nn::hac::ServiceAccessControl::fromBytes(const byte_t* data, size_t len)
|
||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
mRawBinary.alloc(len);
|
mRawBinary.alloc(len);
|
||||||
memcpy(mRawBinary.data(), data, mRawBinary.size());
|
memcpy(mRawBinary.data(), data, mRawBinary.size());
|
||||||
|
|
||||||
ServiceAccessControlEntry sac;
|
ServiceAccessControlEntry sac;
|
||||||
for (size_t pos = 0; pos < len; pos += mServices.atBack().getBytes().size())
|
for (size_t pos = 0; pos < len; pos += mServices.atBack().getBytes().size())
|
||||||
{
|
{
|
||||||
sac.fromBytes((const byte_t*)(mRawBinary.data() + pos), len - pos);
|
sac.fromBytes((const byte_t*)(mRawBinary.data() + pos), len - pos);
|
||||||
mServices.addElement(sac);
|
mServices.addElement(sac);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const fnd::Vec<byte_t>& nn::hac::ServiceAccessControlBinary::getBytes() const
|
const fnd::Vec<byte_t>& nn::hac::ServiceAccessControl::getBytes() const
|
||||||
{
|
{
|
||||||
return mRawBinary;
|
return mRawBinary;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ServiceAccessControlBinary::clear()
|
void nn::hac::ServiceAccessControl::clear()
|
||||||
{
|
{
|
||||||
mRawBinary.clear();
|
mRawBinary.clear();
|
||||||
mServices.clear();
|
mServices.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
const fnd::List<nn::hac::ServiceAccessControlEntry>& nn::hac::ServiceAccessControlBinary::getServiceList() const
|
const fnd::List<nn::hac::ServiceAccessControlEntry>& nn::hac::ServiceAccessControl::getServiceList() const
|
||||||
{
|
{
|
||||||
return mServices;
|
return mServices;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nn::hac::ServiceAccessControlBinary::addService(const ServiceAccessControlEntry& service)
|
void nn::hac::ServiceAccessControl::setServiceList(const fnd::List<ServiceAccessControlEntry>& list)
|
||||||
{
|
{
|
||||||
mServices.addElement(service);
|
mServices = list;
|
||||||
}
|
}
|
|
@ -1,22 +0,0 @@
|
||||||
#include <nn/hac/XciUtils.h>
|
|
||||||
|
|
||||||
void nn::hac::XciUtils::getXciHeaderAesIv(const nn::hac::sXciHeader* hdr, byte_t* iv)
|
|
||||||
{
|
|
||||||
for (size_t i = 0; i < 16; i++)
|
|
||||||
{
|
|
||||||
iv[15-i] = hdr->aescbc_iv.iv[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void nn::hac::XciUtils::decryptXciHeader(const byte_t* src, byte_t* dst, const byte_t* key)
|
|
||||||
{
|
|
||||||
byte_t iv[fnd::aes::kAesBlockSize];
|
|
||||||
|
|
||||||
getXciHeaderAesIv((const nn::hac::sXciHeader*)src, iv);
|
|
||||||
|
|
||||||
// copy plain
|
|
||||||
memcpy(dst, src, nn::hac::xci::kHeaderEncOffset);
|
|
||||||
|
|
||||||
// decrypt encrypted data
|
|
||||||
fnd::aes::AesCbcDecrypt(src + nn::hac::xci::kHeaderEncOffset, nn::hac::xci::kHeaderEncSize, key, iv, dst + nn::hac::xci::kHeaderEncOffset);
|
|
||||||
}
|
|
|
@ -1,67 +1,67 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <fnd/ISerialisable.h>
|
#include <fnd/IByteModel.h>
|
||||||
#include <nn/pki/cert.h>
|
#include <nn/pki/cert.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
{
|
{
|
||||||
namespace pki
|
namespace pki
|
||||||
{
|
{
|
||||||
class CertificateBody
|
class CertificateBody
|
||||||
: public fnd::ISerialisable
|
: public fnd::IByteModel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CertificateBody();
|
CertificateBody();
|
||||||
CertificateBody(const CertificateBody& other);
|
CertificateBody(const CertificateBody& other);
|
||||||
|
|
||||||
void operator=(const CertificateBody& other);
|
void operator=(const CertificateBody& other);
|
||||||
bool operator==(const CertificateBody& other) const;
|
bool operator==(const CertificateBody& other) const;
|
||||||
bool operator!=(const CertificateBody& other) const;
|
bool operator!=(const CertificateBody& other) const;
|
||||||
|
|
||||||
// export/import binary
|
// IByteModel
|
||||||
void toBytes();
|
void toBytes();
|
||||||
void fromBytes(const byte_t* src, size_t size);
|
void fromBytes(const byte_t* src, size_t size);
|
||||||
const fnd::Vec<byte_t>& getBytes() const;
|
const fnd::Vec<byte_t>& getBytes() const;
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
const std::string& getIssuer() const;
|
const std::string& getIssuer() const;
|
||||||
void setIssuer(const std::string& issuer);
|
void setIssuer(const std::string& issuer);
|
||||||
|
|
||||||
pki::cert::PublicKeyType getPublicKeyType() const;
|
pki::cert::PublicKeyType getPublicKeyType() const;
|
||||||
void setPublicKeyType(cert::PublicKeyType type);
|
void setPublicKeyType(cert::PublicKeyType type);
|
||||||
|
|
||||||
const std::string& getSubject() const;
|
const std::string& getSubject() const;
|
||||||
void setSubject(const std::string& subject);
|
void setSubject(const std::string& subject);
|
||||||
|
|
||||||
uint32_t getCertId() const;
|
uint32_t getCertId() const;
|
||||||
void setCertId(uint32_t id);
|
void setCertId(uint32_t id);
|
||||||
|
|
||||||
const fnd::rsa::sRsa4096Key& getRsa4098PublicKey() const;
|
const fnd::rsa::sRsa4096Key& getRsa4098PublicKey() const;
|
||||||
void setRsa4098PublicKey(const fnd::rsa::sRsa4096Key& key);
|
void setRsa4098PublicKey(const fnd::rsa::sRsa4096Key& key);
|
||||||
|
|
||||||
const fnd::rsa::sRsa2048Key& getRsa2048PublicKey() const;
|
const fnd::rsa::sRsa2048Key& getRsa2048PublicKey() const;
|
||||||
void setRsa2048PublicKey(const fnd::rsa::sRsa2048Key& key);
|
void setRsa2048PublicKey(const fnd::rsa::sRsa2048Key& key);
|
||||||
|
|
||||||
const fnd::ecdsa::sEcdsa240Point& getEcdsa240PublicKey() const;
|
const fnd::ecdsa::sEcdsa240Point& getEcdsa240PublicKey() const;
|
||||||
void setEcdsa240PublicKey(const fnd::ecdsa::sEcdsa240Point& key);
|
void setEcdsa240PublicKey(const fnd::ecdsa::sEcdsa240Point& key);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const std::string kModuleName = "CERTIFICATE_BODY";
|
const std::string kModuleName = "CERTIFICATE_BODY";
|
||||||
|
|
||||||
// raw binary
|
// raw binary
|
||||||
fnd::Vec<byte_t> mRawBinary;
|
fnd::Vec<byte_t> mRawBinary;
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
std::string mIssuer;
|
std::string mIssuer;
|
||||||
std::string mSubject;
|
std::string mSubject;
|
||||||
uint32_t mCertId;
|
uint32_t mCertId;
|
||||||
cert::PublicKeyType mPublicKeyType;
|
cert::PublicKeyType mPublicKeyType;
|
||||||
|
|
||||||
fnd::rsa::sRsa4096Key mRsa4096PublicKey;
|
fnd::rsa::sRsa4096Key mRsa4096PublicKey;
|
||||||
fnd::rsa::sRsa2048Key mRsa2048PublicKey;
|
fnd::rsa::sRsa2048Key mRsa2048PublicKey;
|
||||||
fnd::ecdsa::sEcdsa240Point mEcdsa240PublicKey;
|
fnd::ecdsa::sEcdsa240Point mEcdsa240PublicKey;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,51 +1,51 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <fnd/ISerialisable.h>
|
#include <fnd/IByteModel.h>
|
||||||
#include <nn/pki/sign.h>
|
#include <nn/pki/sign.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
{
|
{
|
||||||
namespace pki
|
namespace pki
|
||||||
{
|
{
|
||||||
class SignatureBlock
|
class SignatureBlock
|
||||||
: public fnd::ISerialisable
|
: public fnd::IByteModel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SignatureBlock();
|
SignatureBlock();
|
||||||
SignatureBlock(const SignatureBlock& other);
|
SignatureBlock(const SignatureBlock& other);
|
||||||
|
|
||||||
void operator=(const SignatureBlock& other);
|
void operator=(const SignatureBlock& other);
|
||||||
bool operator==(const SignatureBlock& other) const;
|
bool operator==(const SignatureBlock& other) const;
|
||||||
bool operator!=(const SignatureBlock& other) const;
|
bool operator!=(const SignatureBlock& other) const;
|
||||||
|
|
||||||
// export/import binary
|
// IByteModel
|
||||||
void toBytes();
|
void toBytes();
|
||||||
void fromBytes(const byte_t* src, size_t size);
|
void fromBytes(const byte_t* src, size_t size);
|
||||||
const fnd::Vec<byte_t>& getBytes() const;
|
const fnd::Vec<byte_t>& getBytes() const;
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
pki::sign::SignatureId getSignType() const;
|
pki::sign::SignatureId getSignType() const;
|
||||||
void setSignType(pki::sign::SignatureId type);
|
void setSignType(pki::sign::SignatureId type);
|
||||||
|
|
||||||
bool isLittleEndian() const;
|
bool isLittleEndian() const;
|
||||||
void setLittleEndian(bool isLE);
|
void setLittleEndian(bool isLE);
|
||||||
|
|
||||||
const fnd::Vec<byte_t>& getSignature() const;
|
const fnd::Vec<byte_t>& getSignature() const;
|
||||||
void setSignature(const fnd::Vec<byte_t>& signature);
|
void setSignature(const fnd::Vec<byte_t>& signature);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const std::string kModuleName = "SIGNATURE_BLOCK";
|
const std::string kModuleName = "SIGNATURE_BLOCK";
|
||||||
|
|
||||||
// raw binary
|
// raw binary
|
||||||
fnd::Vec<byte_t> mRawBinary;
|
fnd::Vec<byte_t> mRawBinary;
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
pki::sign::SignatureId mSignType;
|
pki::sign::SignatureId mSignType;
|
||||||
bool mIsLittleEndian;
|
bool mIsLittleEndian;
|
||||||
fnd::Vec<byte_t> mSignature;
|
fnd::Vec<byte_t> mSignature;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,139 +1,139 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <fnd/ISerialisable.h>
|
#include <fnd/IByteModel.h>
|
||||||
#include <nn/pki/SignatureBlock.h>
|
#include <nn/pki/SignatureBlock.h>
|
||||||
|
|
||||||
namespace nn
|
namespace nn
|
||||||
{
|
{
|
||||||
namespace pki
|
namespace pki
|
||||||
{
|
{
|
||||||
template <class T>
|
template <class T>
|
||||||
class SignedData
|
class SignedData
|
||||||
: public fnd::ISerialisable
|
: public fnd::IByteModel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SignedData();
|
SignedData();
|
||||||
SignedData(const SignedData& other);
|
SignedData(const SignedData& other);
|
||||||
|
|
||||||
void operator=(const SignedData& other);
|
void operator=(const SignedData& other);
|
||||||
bool operator==(const SignedData& other) const;
|
bool operator==(const SignedData& other) const;
|
||||||
bool operator!=(const SignedData& other) const;
|
bool operator!=(const SignedData& other) const;
|
||||||
|
|
||||||
// export/import
|
// export/import
|
||||||
void toBytes();
|
void toBytes();
|
||||||
void fromBytes(const byte_t* src, size_t size);
|
void fromBytes(const byte_t* src, size_t size);
|
||||||
const fnd::Vec<byte_t>& getBytes() const;
|
const fnd::Vec<byte_t>& getBytes() const;
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
const pki::SignatureBlock& getSignature() const;
|
const pki::SignatureBlock& getSignature() const;
|
||||||
void setSignature(const SignatureBlock& signature);
|
void setSignature(const SignatureBlock& signature);
|
||||||
|
|
||||||
const T& getBody() const;
|
const T& getBody() const;
|
||||||
void setBody(const T& body);
|
void setBody(const T& body);
|
||||||
private:
|
private:
|
||||||
const std::string kModuleName = "SIGNED_DATA";
|
const std::string kModuleName = "SIGNED_DATA";
|
||||||
|
|
||||||
// raw binary
|
// raw binary
|
||||||
fnd::Vec<byte_t> mRawBinary;
|
fnd::Vec<byte_t> mRawBinary;
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
SignatureBlock mSignature;
|
SignatureBlock mSignature;
|
||||||
T mBody;
|
T mBody;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
inline SignedData<T>::SignedData()
|
inline SignedData<T>::SignedData()
|
||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
inline SignedData<T>::SignedData(const SignedData& other)
|
inline SignedData<T>::SignedData(const SignedData& other)
|
||||||
{
|
{
|
||||||
*this = other;
|
*this = other;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
inline void SignedData<T>::operator=(const SignedData& other)
|
inline void SignedData<T>::operator=(const SignedData& other)
|
||||||
{
|
{
|
||||||
mRawBinary = other.mRawBinary;
|
mRawBinary = other.mRawBinary;
|
||||||
mSignature = other.mSignature;
|
mSignature = other.mSignature;
|
||||||
mBody = other.mBody;
|
mBody = other.mBody;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
inline bool SignedData<T>::operator==(const SignedData& other) const
|
inline bool SignedData<T>::operator==(const SignedData& other) const
|
||||||
{
|
{
|
||||||
return (mSignature == other.mSignature) \
|
return (mSignature == other.mSignature) \
|
||||||
&& (mBody == other.mBody);
|
&& (mBody == other.mBody);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
inline bool SignedData<T>::operator!=(const SignedData& other) const
|
inline bool SignedData<T>::operator!=(const SignedData& other) const
|
||||||
{
|
{
|
||||||
return !(*this == other);
|
return !(*this == other);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
inline void SignedData<T>::toBytes()
|
inline void SignedData<T>::toBytes()
|
||||||
{
|
{
|
||||||
mSignature.toBytes();
|
mSignature.toBytes();
|
||||||
mBody.toBytes();
|
mBody.toBytes();
|
||||||
|
|
||||||
mRawBinary.alloc(mSignature.getBytes().size() + mBody.getBytes().size());
|
mRawBinary.alloc(mSignature.getBytes().size() + mBody.getBytes().size());
|
||||||
|
|
||||||
memcpy(mRawBinary.data(), mSignature.getBytes().data(), mSignature.getBytes().size());
|
memcpy(mRawBinary.data(), mSignature.getBytes().data(), mSignature.getBytes().size());
|
||||||
memcpy(mRawBinary.data() + mSignature.getBytes().size(), mBody.getBytes().data(), mBody.getBytes().size());
|
memcpy(mRawBinary.data() + mSignature.getBytes().size(), mBody.getBytes().data(), mBody.getBytes().size());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
inline void SignedData<T>::fromBytes(const byte_t* src, size_t size)
|
inline void SignedData<T>::fromBytes(const byte_t* src, size_t size)
|
||||||
{
|
{
|
||||||
mSignature.fromBytes(src, size);
|
mSignature.fromBytes(src, size);
|
||||||
mBody.fromBytes(src + mSignature.getBytes().size(), size - mSignature.getBytes().size());
|
mBody.fromBytes(src + mSignature.getBytes().size(), size - mSignature.getBytes().size());
|
||||||
|
|
||||||
mRawBinary.alloc(mSignature.getBytes().size() + mBody.getBytes().size());
|
mRawBinary.alloc(mSignature.getBytes().size() + mBody.getBytes().size());
|
||||||
memcpy(mRawBinary.data(), src, mRawBinary.size());
|
memcpy(mRawBinary.data(), src, mRawBinary.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
inline const fnd::Vec<byte_t>& SignedData<T>::getBytes() const
|
inline const fnd::Vec<byte_t>& SignedData<T>::getBytes() const
|
||||||
{
|
{
|
||||||
return mRawBinary;
|
return mRawBinary;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
inline void SignedData<T>::clear()
|
inline void SignedData<T>::clear()
|
||||||
{
|
{
|
||||||
mRawBinary.clear();
|
mRawBinary.clear();
|
||||||
mSignature.clear();
|
mSignature.clear();
|
||||||
mBody.clear();
|
mBody.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
inline const pki::SignatureBlock& SignedData<T>::getSignature() const
|
inline const pki::SignatureBlock& SignedData<T>::getSignature() const
|
||||||
{
|
{
|
||||||
return mSignature;
|
return mSignature;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
inline void SignedData<T>::setSignature(const SignatureBlock& signature)
|
inline void SignedData<T>::setSignature(const SignatureBlock& signature)
|
||||||
{
|
{
|
||||||
mSignature = signature;
|
mSignature = signature;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
inline const T& SignedData<T>::getBody() const
|
inline const T& SignedData<T>::getBody() const
|
||||||
{
|
{
|
||||||
return mBody;
|
return mBody;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
inline void SignedData<T>::setBody(const T& body)
|
inline void SignedData<T>::setBody(const T& body)
|
||||||
{
|
{
|
||||||
mBody = body;
|
mBody = body;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,74 +1,74 @@
|
||||||
# Nintendo Switch Tool (NSTool) ![DeviceTag](https://img.shields.io/badge/Device-SWITCH-e60012.svg)
|
# Nintendo Switch Tool (NSTool) ![DeviceTag](https://img.shields.io/badge/Device-SWITCH-e60012.svg)
|
||||||
General purpose reading/extraction tool for Nintendo Switch file formats.
|
General purpose reading/extraction tool for Nintendo Switch file formats.
|
||||||
|
|
||||||
## Supported File Formats
|
## Supported File Formats
|
||||||
* Meta (.npdm)
|
* Meta (.npdm)
|
||||||
* PartitionFS (and HashedPartitionFS) (includes raw .nsp)
|
* PartitionFS (and HashedPartitionFS) (includes raw .nsp)
|
||||||
* RomFS
|
* RomFS
|
||||||
* GameCard Image (.xci)
|
* GameCard Image (.xci)
|
||||||
* Nintendo Content Archive (.nca)
|
* Nintendo Content Archive (.nca)
|
||||||
* Content Metadata (.cnmt)
|
* Content Metadata (.cnmt)
|
||||||
* Nintendo Software Object (.nso)
|
* Nintendo Software Object (.nso)
|
||||||
* Nintendo Relocatable Software Object (.nro)
|
* Nintendo Relocatable Software Object (.nro)
|
||||||
* Nintendo Application Control Property (.nacp)
|
* Nintendo Application Control Property (.nacp)
|
||||||
* ES Ticket (v2 only) (.tik)
|
* ES Ticket (v2 only) (.tik)
|
||||||
* PKI Certificate (.cert)
|
* PKI Certificate (.cert)
|
||||||
|
|
||||||
# Usage
|
# Usage
|
||||||
```
|
```
|
||||||
Usage: nstool [options... ] <file>
|
Usage: nstool [options... ] <file>
|
||||||
|
|
||||||
General Options:
|
General Options:
|
||||||
-d, --dev Use devkit keyset.
|
-d, --dev Use devkit keyset.
|
||||||
-k, --keyset Specify keyset file.
|
-k, --keyset Specify keyset file.
|
||||||
-t, --type Specify input file type. [xci, pfs, romfs, nca, meta, cnmt, nso, nro, nacp, aset, cert, tik]
|
-t, --type Specify input file type. [xci, pfs, romfs, nca, meta, cnmt, nso, nro, nacp, aset, cert, tik]
|
||||||
-y, --verify Verify file.
|
-y, --verify Verify file.
|
||||||
|
|
||||||
Output Options:
|
Output Options:
|
||||||
--showkeys Show keys generated.
|
--showkeys Show keys generated.
|
||||||
--showlayout Show layout metadata.
|
--showlayout Show layout metadata.
|
||||||
-v, --verbose Verbose output.
|
-v, --verbose Verbose output.
|
||||||
|
|
||||||
XCI (GameCard Image)
|
XCI (GameCard Image)
|
||||||
nstool [--listfs] [--update <dir> --logo <dir> --normal <dir> --secure <dir>] <.xci file>
|
nstool [--listfs] [--update <dir> --logo <dir> --normal <dir> --secure <dir>] <.xci file>
|
||||||
--listfs Print file system in embedded partitions.
|
--listfs Print file system in embedded partitions.
|
||||||
--update Extract "update" partition to directory.
|
--update Extract "update" partition to directory.
|
||||||
--logo Extract "logo" partition to directory.
|
--logo Extract "logo" partition to directory.
|
||||||
--normal Extract "normal" partition to directory.
|
--normal Extract "normal" partition to directory.
|
||||||
--secure Extract "secure" partition to directory.
|
--secure Extract "secure" partition to directory.
|
||||||
|
|
||||||
PFS0/HFS0 (PartitionFs), RomFs, NSP (Ninendo Submission Package)
|
PFS0/HFS0 (PartitionFs), RomFs, NSP (Ninendo Submission Package)
|
||||||
nstool [--listfs] [--fsdir <dir>] <file>
|
nstool [--listfs] [--fsdir <dir>] <file>
|
||||||
--listfs Print file system.
|
--listfs Print file system.
|
||||||
--fsdir Extract file system to directory.
|
--fsdir Extract file system to directory.
|
||||||
|
|
||||||
NCA (Nintendo Content Archive)
|
NCA (Nintendo Content Archive)
|
||||||
nstool [--listfs] [--bodykey <key> --titlekey <key>] [--part0 <dir> ...] <.nca file>
|
nstool [--listfs] [--bodykey <key> --titlekey <key>] [--part0 <dir> ...] <.nca file>
|
||||||
--listfs Print file system in embedded partitions.
|
--listfs Print file system in embedded partitions.
|
||||||
--titlekey Specify title key extracted from ticket.
|
--titlekey Specify title key extracted from ticket.
|
||||||
--bodykey Specify body encryption key.
|
--bodykey Specify body encryption key.
|
||||||
--tik Specify ticket to source title key.
|
--tik Specify ticket to source title key.
|
||||||
--cert Specify certificate chain to verify ticket.
|
--cert Specify certificate chain to verify ticket.
|
||||||
--part0 Extract "partition 0" to directory.
|
--part0 Extract "partition 0" to directory.
|
||||||
--part1 Extract "partition 1" to directory.
|
--part1 Extract "partition 1" to directory.
|
||||||
--part2 Extract "partition 2" to directory.
|
--part2 Extract "partition 2" to directory.
|
||||||
--part3 Extract "partition 3" to directory.
|
--part3 Extract "partition 3" to directory.
|
||||||
|
|
||||||
NSO (Nintendo Software Object), NRO (Nintendo Relocatable Object)
|
NSO (Nintendo Software Object), NRO (Nintendo Relocatable Object)
|
||||||
nstool [--listapi --listsym] [--insttype <inst. type>] <file>
|
nstool [--listapi --listsym] [--insttype <inst. type>] <file>
|
||||||
--listapi Print SDK API List.
|
--listapi Print SDK API List.
|
||||||
--listsym Print Code Symbols.
|
--listsym Print Code Symbols.
|
||||||
--insttype Specify instruction type [64bit|32bit] (64bit is assumed).
|
--insttype Specify instruction type [64bit|32bit] (64bit is assumed).
|
||||||
|
|
||||||
ASET (Homebrew Asset Blob)
|
ASET (Homebrew Asset Blob)
|
||||||
nstool [--listfs] [--icon <file> --nacp <file> --fsdir <dir>] <file>
|
nstool [--listfs] [--icon <file> --nacp <file> --fsdir <dir>] <file>
|
||||||
--listfs Print filesystem in embedded RomFS partition.
|
--listfs Print filesystem in embedded RomFS partition.
|
||||||
--icon Extract icon partition to file.
|
--icon Extract icon partition to file.
|
||||||
--nacp Extract NACP partition to file.
|
--nacp Extract NACP partition to file.
|
||||||
--fsdir Extract RomFS partition to directory.
|
--fsdir Extract RomFS partition to directory.
|
||||||
```
|
```
|
||||||
|
|
||||||
# External Keys
|
# External Keys
|
||||||
NSTool doesn't embed any keys that are copyright protected. However keys can be imported via various keyset files.
|
NSTool doesn't embed any keys that are copyright protected. However keys can be imported via various keyset files.
|
||||||
|
|
||||||
See [SWITCH_KEYS.md](/SWITCH_KEYS.md) for more info.
|
See [SWITCH_KEYS.md](/SWITCH_KEYS.md) for more info.
|
||||||
|
|
|
@ -1,226 +1,226 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<ItemGroup Label="ProjectConfigurations">
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
<ProjectConfiguration Include="Debug|Win32">
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
<Configuration>Debug</Configuration>
|
<Configuration>Debug</Configuration>
|
||||||
<Platform>Win32</Platform>
|
<Platform>Win32</Platform>
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
<ProjectConfiguration Include="Release|Win32">
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
<Configuration>Release</Configuration>
|
<Configuration>Release</Configuration>
|
||||||
<Platform>Win32</Platform>
|
<Platform>Win32</Platform>
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
<ProjectConfiguration Include="Debug|x64">
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
<Configuration>Debug</Configuration>
|
<Configuration>Debug</Configuration>
|
||||||
<Platform>x64</Platform>
|
<Platform>x64</Platform>
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
<ProjectConfiguration Include="Release|x64">
|
<ProjectConfiguration Include="Release|x64">
|
||||||
<Configuration>Release</Configuration>
|
<Configuration>Release</Configuration>
|
||||||
<Platform>x64</Platform>
|
<Platform>x64</Platform>
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<PropertyGroup Label="Globals">
|
<PropertyGroup Label="Globals">
|
||||||
<VCProjectVersion>15.0</VCProjectVersion>
|
<VCProjectVersion>15.0</VCProjectVersion>
|
||||||
<ProjectGuid>{AF09FA96-4463-417D-8FE6-526063F41349}</ProjectGuid>
|
<ProjectGuid>{AF09FA96-4463-417D-8FE6-526063F41349}</ProjectGuid>
|
||||||
<Keyword>Win32Proj</Keyword>
|
<Keyword>Win32Proj</Keyword>
|
||||||
<RootNamespace>nstool</RootNamespace>
|
<RootNamespace>nstool</RootNamespace>
|
||||||
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
|
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Label="Shared">
|
<ImportGroup Label="Shared">
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<LinkIncremental>true</LinkIncremental>
|
<LinkIncremental>true</LinkIncremental>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<LinkIncremental>true</LinkIncremental>
|
<LinkIncremental>true</LinkIncremental>
|
||||||
</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>
|
<LinkIncremental>false</LinkIncremental>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
<AdditionalIncludeDirectories>..\..\lib\libpki\include;..\..\lib\libes\include;..\..\lib\libfnd\include;..\..\lib\libhac\include;..\..\lib\libhac-hb\include</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\..\lib\libpki\include;..\..\lib\libes\include;..\..\lib\libfnd\include;..\..\lib\libhac\include;..\..\lib\libhac-hb\include</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
<AdditionalIncludeDirectories>..\..\lib\libpki\include;..\..\lib\libes\include;..\..\lib\libfnd\include;..\..\lib\libhac\include;..\..\lib\libhac-hb\include</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\..\lib\libpki\include;..\..\lib\libes\include;..\..\lib\libfnd\include;..\..\lib\libhac\include;..\..\lib\libhac-hb\include</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>MaxSpeed</Optimization>
|
<Optimization>MaxSpeed</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
<AdditionalIncludeDirectories>..\..\lib\libpki\include;..\..\lib\libes\include;..\..\lib\libfnd\include;..\..\lib\libhac\include;..\..\lib\libhac-hb\include</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\..\lib\libpki\include;..\..\lib\libes\include;..\..\lib\libfnd\include;..\..\lib\libhac\include;..\..\lib\libhac-hb\include</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>MaxSpeed</Optimization>
|
<Optimization>MaxSpeed</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
<AdditionalIncludeDirectories>..\..\lib\libpki\include;..\..\lib\libes\include;..\..\lib\libfnd\include;..\..\lib\libhac\include;..\..\lib\libhac-hb\include</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\..\lib\libpki\include;..\..\lib\libes\include;..\..\lib\libfnd\include;..\..\lib\libhac\include;..\..\lib\libhac-hb\include</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\lib\libpolarssl\libpolarssl.vcxproj">
|
<ProjectReference Include="..\..\lib\libpolarssl\libpolarssl.vcxproj">
|
||||||
<Project>{394EFC16-BD3A-4538-B33D-7BA1EDB8DAC1}</Project>
|
<Project>{394EFC16-BD3A-4538-B33D-7BA1EDB8DAC1}</Project>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\..\lib\liblz4\liblz4.vcxproj">
|
<ProjectReference Include="..\..\lib\liblz4\liblz4.vcxproj">
|
||||||
<Project>{AB0C3362-63AB-480A-ADBC-2EF7D859778B}</Project>
|
<Project>{AB0C3362-63AB-480A-ADBC-2EF7D859778B}</Project>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\..\lib\libes\libes.vcxproj">
|
<ProjectReference Include="..\..\lib\libes\libes.vcxproj">
|
||||||
<Project>{7be99936-0d40-410d-944b-4513c2eff8dc}</Project>
|
<Project>{7be99936-0d40-410d-944b-4513c2eff8dc}</Project>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\..\lib\libfnd\libfnd.vcxproj">
|
<ProjectReference Include="..\..\lib\libfnd\libfnd.vcxproj">
|
||||||
<Project>{4d27edb9-5110-44fe-8ce2-d46c5ad3c55b}</Project>
|
<Project>{4d27edb9-5110-44fe-8ce2-d46c5ad3c55b}</Project>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\..\lib\libhac-hb\libhac-hb.vcxproj">
|
<ProjectReference Include="..\..\lib\libhac-hb\libhac-hb.vcxproj">
|
||||||
<Project>{738cb4fc-cd9e-4b81-a04b-deadbfa71c63}</Project>
|
<Project>{738cb4fc-cd9e-4b81-a04b-deadbfa71c63}</Project>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\..\lib\libhac\libhac.vcxproj">
|
<ProjectReference Include="..\..\lib\libhac\libhac.vcxproj">
|
||||||
<Project>{91ba9e79-8242-4f7d-b997-0dfec95ea22b}</Project>
|
<Project>{91ba9e79-8242-4f7d-b997-0dfec95ea22b}</Project>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\..\lib\libpki\libpki.vcxproj">
|
<ProjectReference Include="..\..\lib\libpki\libpki.vcxproj">
|
||||||
<Project>{b9113734-6e84-44ff-8cf7-58199aa815c5}</Project>
|
<Project>{b9113734-6e84-44ff-8cf7-58199aa815c5}</Project>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="makefile" />
|
<None Include="makefile" />
|
||||||
<None Include="README.md" />
|
<None Include="README.md" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="source\AssetProcess.h" />
|
<ClInclude Include="source\AssetProcess.h" />
|
||||||
<ClInclude Include="source\CnmtProcess.h" />
|
<ClInclude Include="source\CnmtProcess.h" />
|
||||||
<ClInclude Include="source\common.h" />
|
<ClInclude Include="source\common.h" />
|
||||||
<ClInclude Include="source\ElfSymbolParser.h" />
|
<ClInclude Include="source\ElfSymbolParser.h" />
|
||||||
<ClInclude Include="source\EsTikProcess.h" />
|
<ClInclude Include="source\EsTikProcess.h" />
|
||||||
<ClInclude Include="source\KeyConfiguration.h" />
|
<ClInclude Include="source\KeyConfiguration.h" />
|
||||||
<ClInclude Include="source\MetaProcess.h" />
|
<ClInclude Include="source\MetaProcess.h" />
|
||||||
<ClInclude Include="source\NacpProcess.h" />
|
<ClInclude Include="source\NacpProcess.h" />
|
||||||
<ClInclude Include="source\NcaProcess.h" />
|
<ClInclude Include="source\NcaProcess.h" />
|
||||||
<ClInclude Include="source\NroProcess.h" />
|
<ClInclude Include="source\NroProcess.h" />
|
||||||
<ClInclude Include="source\NsoProcess.h" />
|
<ClInclude Include="source\NsoProcess.h" />
|
||||||
<ClInclude Include="source\PfsProcess.h" />
|
<ClInclude Include="source\PfsProcess.h" />
|
||||||
<ClInclude Include="source\PkiCertProcess.h" />
|
<ClInclude Include="source\PkiCertProcess.h" />
|
||||||
<ClInclude Include="source\PkiValidator.h" />
|
<ClInclude Include="source\PkiValidator.h" />
|
||||||
<ClInclude Include="source\RoMetadataProcess.h" />
|
<ClInclude Include="source\RoMetadataProcess.h" />
|
||||||
<ClInclude Include="source\RomfsProcess.h" />
|
<ClInclude Include="source\RomfsProcess.h" />
|
||||||
<ClInclude Include="source\SdkApiString.h" />
|
<ClInclude Include="source\SdkApiString.h" />
|
||||||
<ClInclude Include="source\UserSettings.h" />
|
<ClInclude Include="source\UserSettings.h" />
|
||||||
<ClInclude Include="source\version.h" />
|
<ClInclude Include="source\version.h" />
|
||||||
<ClInclude Include="source\XciProcess.h" />
|
<ClInclude Include="source\GameCardProcess.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="source\AssetProcess.cpp" />
|
<ClCompile Include="source\AssetProcess.cpp" />
|
||||||
<ClCompile Include="source\CnmtProcess.cpp" />
|
<ClCompile Include="source\CnmtProcess.cpp" />
|
||||||
<ClCompile Include="source\ElfSymbolParser.cpp" />
|
<ClCompile Include="source\ElfSymbolParser.cpp" />
|
||||||
<ClCompile Include="source\EsTikProcess.cpp" />
|
<ClCompile Include="source\EsTikProcess.cpp" />
|
||||||
<ClCompile Include="source\KeyConfiguration.cpp" />
|
<ClCompile Include="source\KeyConfiguration.cpp" />
|
||||||
<ClCompile Include="source\main.cpp" />
|
<ClCompile Include="source\main.cpp" />
|
||||||
<ClCompile Include="source\MetaProcess.cpp" />
|
<ClCompile Include="source\MetaProcess.cpp" />
|
||||||
<ClCompile Include="source\NacpProcess.cpp" />
|
<ClCompile Include="source\NacpProcess.cpp" />
|
||||||
<ClCompile Include="source\NcaProcess.cpp" />
|
<ClCompile Include="source\NcaProcess.cpp" />
|
||||||
<ClCompile Include="source\NroProcess.cpp" />
|
<ClCompile Include="source\NroProcess.cpp" />
|
||||||
<ClCompile Include="source\NsoProcess.cpp" />
|
<ClCompile Include="source\NsoProcess.cpp" />
|
||||||
<ClCompile Include="source\PfsProcess.cpp" />
|
<ClCompile Include="source\PfsProcess.cpp" />
|
||||||
<ClCompile Include="source\PkiCertProcess.cpp" />
|
<ClCompile Include="source\PkiCertProcess.cpp" />
|
||||||
<ClCompile Include="source\PkiValidator.cpp" />
|
<ClCompile Include="source\PkiValidator.cpp" />
|
||||||
<ClCompile Include="source\RoMetadataProcess.cpp" />
|
<ClCompile Include="source\RoMetadataProcess.cpp" />
|
||||||
<ClCompile Include="source\RomfsProcess.cpp" />
|
<ClCompile Include="source\RomfsProcess.cpp" />
|
||||||
<ClCompile Include="source\SdkApiString.cpp" />
|
<ClCompile Include="source\SdkApiString.cpp" />
|
||||||
<ClCompile Include="source\UserSettings.cpp" />
|
<ClCompile Include="source\UserSettings.cpp" />
|
||||||
<ClCompile Include="source\XciProcess.cpp" />
|
<ClCompile Include="source\GameCardProcess.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -1,142 +1,142 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Filter Include="Source Files">
|
<Filter Include="Source Files">
|
||||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter Include="Header Files">
|
<Filter Include="Header Files">
|
||||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
|
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter Include="Resource Files">
|
<Filter Include="Resource Files">
|
||||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||||
</Filter>
|
</Filter>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="makefile" />
|
<None Include="makefile" />
|
||||||
<None Include="README.md" />
|
<None Include="README.md" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="source\AssetProcess.h">
|
<ClInclude Include="source\AssetProcess.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="source\CnmtProcess.h">
|
<ClInclude Include="source\CnmtProcess.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="source\common.h">
|
<ClInclude Include="source\common.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="source\ElfSymbolParser.h">
|
<ClInclude Include="source\ElfSymbolParser.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="source\EsTikProcess.h">
|
<ClInclude Include="source\EsTikProcess.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="source\KeyConfiguration.h">
|
<ClInclude Include="source\KeyConfiguration.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="source\MetaProcess.h">
|
<ClInclude Include="source\MetaProcess.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="source\NacpProcess.h">
|
<ClInclude Include="source\NacpProcess.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="source\NcaProcess.h">
|
<ClInclude Include="source\NcaProcess.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="source\NroProcess.h">
|
<ClInclude Include="source\NroProcess.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="source\NsoProcess.h">
|
<ClInclude Include="source\NsoProcess.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="source\PfsProcess.h">
|
<ClInclude Include="source\PfsProcess.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="source\PkiCertProcess.h">
|
<ClInclude Include="source\PkiCertProcess.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="source\PkiValidator.h">
|
<ClInclude Include="source\PkiValidator.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="source\RoMetadataProcess.h">
|
<ClInclude Include="source\RoMetadataProcess.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="source\RomfsProcess.h">
|
<ClInclude Include="source\RomfsProcess.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="source\SdkApiString.h">
|
<ClInclude Include="source\SdkApiString.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="source\UserSettings.h">
|
<ClInclude Include="source\UserSettings.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="source\version.h">
|
<ClInclude Include="source\version.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="source\XciProcess.h">
|
<ClInclude Include="source\GameCardProcess.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="source\AssetProcess.cpp">
|
<ClCompile Include="source\AssetProcess.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\CnmtProcess.cpp">
|
<ClCompile Include="source\CnmtProcess.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\ElfSymbolParser.cpp">
|
<ClCompile Include="source\ElfSymbolParser.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\EsTikProcess.cpp">
|
<ClCompile Include="source\EsTikProcess.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\KeyConfiguration.cpp">
|
<ClCompile Include="source\KeyConfiguration.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\main.cpp">
|
<ClCompile Include="source\main.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\MetaProcess.cpp">
|
<ClCompile Include="source\MetaProcess.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\NacpProcess.cpp">
|
<ClCompile Include="source\NacpProcess.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\NcaProcess.cpp">
|
<ClCompile Include="source\NcaProcess.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\NroProcess.cpp">
|
<ClCompile Include="source\NroProcess.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\NsoProcess.cpp">
|
<ClCompile Include="source\NsoProcess.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\PfsProcess.cpp">
|
<ClCompile Include="source\PfsProcess.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\PkiCertProcess.cpp">
|
<ClCompile Include="source\PkiCertProcess.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\PkiValidator.cpp">
|
<ClCompile Include="source\PkiValidator.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\RoMetadataProcess.cpp">
|
<ClCompile Include="source\RoMetadataProcess.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\RomfsProcess.cpp">
|
<ClCompile Include="source\RomfsProcess.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\SdkApiString.cpp">
|
<ClCompile Include="source\SdkApiString.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\UserSettings.cpp">
|
<ClCompile Include="source\UserSettings.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\XciProcess.cpp">
|
<ClCompile Include="source\GameCardProcess.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -1,249 +1,249 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <fnd/SimpleTextOutput.h>
|
#include <fnd/SimpleTextOutput.h>
|
||||||
#include <fnd/OffsetAdjustedIFile.h>
|
#include <fnd/OffsetAdjustedIFile.h>
|
||||||
#include "CnmtProcess.h"
|
#include "CnmtProcess.h"
|
||||||
|
|
||||||
CnmtProcess::CnmtProcess() :
|
CnmtProcess::CnmtProcess() :
|
||||||
mFile(),
|
mFile(),
|
||||||
mCliOutputMode(_BIT(OUTPUT_BASIC)),
|
mCliOutputMode(_BIT(OUTPUT_BASIC)),
|
||||||
mVerify(false)
|
mVerify(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void CnmtProcess::process()
|
void CnmtProcess::process()
|
||||||
{
|
{
|
||||||
importCnmt();
|
importCnmt();
|
||||||
|
|
||||||
if (_HAS_BIT(mCliOutputMode, OUTPUT_BASIC))
|
if (_HAS_BIT(mCliOutputMode, OUTPUT_BASIC))
|
||||||
displayCnmt();
|
displayCnmt();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CnmtProcess::setInputFile(const fnd::SharedPtr<fnd::IFile>& file)
|
void CnmtProcess::setInputFile(const fnd::SharedPtr<fnd::IFile>& file)
|
||||||
{
|
{
|
||||||
mFile = file;
|
mFile = file;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CnmtProcess::setCliOutputMode(CliOutputMode type)
|
void CnmtProcess::setCliOutputMode(CliOutputMode type)
|
||||||
{
|
{
|
||||||
mCliOutputMode = type;
|
mCliOutputMode = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CnmtProcess::setVerifyMode(bool verify)
|
void CnmtProcess::setVerifyMode(bool verify)
|
||||||
{
|
{
|
||||||
mVerify = verify;
|
mVerify = verify;
|
||||||
}
|
}
|
||||||
|
|
||||||
const nn::hac::ContentMetaBinary& CnmtProcess::getContentMetaBinary() const
|
const nn::hac::ContentMeta& CnmtProcess::getContentMeta() const
|
||||||
{
|
{
|
||||||
return mCnmt;
|
return mCnmt;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CnmtProcess::importCnmt()
|
void CnmtProcess::importCnmt()
|
||||||
{
|
{
|
||||||
fnd::Vec<byte_t> scratch;
|
fnd::Vec<byte_t> scratch;
|
||||||
|
|
||||||
if (*mFile == nullptr)
|
if (*mFile == nullptr)
|
||||||
{
|
{
|
||||||
throw fnd::Exception(kModuleName, "No file reader set.");
|
throw fnd::Exception(kModuleName, "No file reader set.");
|
||||||
}
|
}
|
||||||
|
|
||||||
scratch.alloc((*mFile)->size());
|
scratch.alloc((*mFile)->size());
|
||||||
(*mFile)->read(scratch.data(), 0, scratch.size());
|
(*mFile)->read(scratch.data(), 0, scratch.size());
|
||||||
|
|
||||||
mCnmt.fromBytes(scratch.data(), scratch.size());
|
mCnmt.fromBytes(scratch.data(), scratch.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CnmtProcess::displayCnmt()
|
void CnmtProcess::displayCnmt()
|
||||||
{
|
{
|
||||||
#define _SPLIT_VER(ver) (uint32_t)((ver>>26) & 0x3f) << "." << (uint32_t)((ver>>20) & 0x3f) << "." << (uint32_t)((ver>>16) & 0xf) << "." << (uint32_t)(ver & 0xffff)
|
#define _SPLIT_VER(ver) (uint32_t)((ver>>26) & 0x3f) << "." << (uint32_t)((ver>>20) & 0x3f) << "." << (uint32_t)((ver>>16) & 0xf) << "." << (uint32_t)(ver & 0xffff)
|
||||||
|
|
||||||
std::cout << "[ContentMeta]" << std::endl;
|
std::cout << "[ContentMeta]" << std::endl;
|
||||||
std::cout << " TitleId: 0x" << std::hex << std::setw(16) << std::setfill('0') << mCnmt.getTitleId() << std::endl;
|
std::cout << " TitleId: 0x" << std::hex << std::setw(16) << std::setfill('0') << mCnmt.getTitleId() << std::endl;
|
||||||
std::cout << " Version: v" << std::dec << mCnmt.getTitleVersion() << " (" << _SPLIT_VER(mCnmt.getTitleVersion()) << ")"<< std::endl;
|
std::cout << " Version: v" << std::dec << mCnmt.getTitleVersion() << " (" << _SPLIT_VER(mCnmt.getTitleVersion()) << ")"<< std::endl;
|
||||||
std::cout << " Type: " << getContentMetaTypeStr(mCnmt.getType()) << " (" << std::dec << mCnmt.getType() << ")" << std::endl;
|
std::cout << " Type: " << getContentMetaTypeStr(mCnmt.getContentMetaType()) << " (" << std::dec << mCnmt.getContentMetaType() << ")" << std::endl;
|
||||||
std::cout << " Attributes: 0x" << std::hex << (uint32_t)mCnmt.getAttributes() << std::endl;
|
std::cout << " Attributes: 0x" << std::hex << (uint32_t)mCnmt.getAttributes() << std::endl;
|
||||||
std::cout << " IncludesExFatDriver: " << getBoolStr(_HAS_BIT(mCnmt.getAttributes(), nn::hac::cnmt::ATTRIBUTE_INCLUDES_EX_FAT_DRIVER)) << std::endl;
|
std::cout << " IncludesExFatDriver: " << getBoolStr(_HAS_BIT(mCnmt.getAttributes(), nn::hac::cnmt::ATTRIBUTE_INCLUDES_EX_FAT_DRIVER)) << std::endl;
|
||||||
std::cout << " Rebootless: " << getBoolStr(_HAS_BIT(mCnmt.getAttributes(), nn::hac::cnmt::ATTRIBUTE_REBOOTLESS)) << std::endl;
|
std::cout << " Rebootless: " << getBoolStr(_HAS_BIT(mCnmt.getAttributes(), nn::hac::cnmt::ATTRIBUTE_REBOOTLESS)) << std::endl;
|
||||||
std::cout << " RequiredDownloadSystemVersion: v" << mCnmt.getRequiredDownloadSystemVersion() << " (" << _SPLIT_VER(mCnmt.getRequiredDownloadSystemVersion()) << ")"<< std::endl;
|
std::cout << " RequiredDownloadSystemVersion: v" << mCnmt.getRequiredDownloadSystemVersion() << " (" << _SPLIT_VER(mCnmt.getRequiredDownloadSystemVersion()) << ")"<< std::endl;
|
||||||
switch(mCnmt.getType())
|
switch(mCnmt.getContentMetaType())
|
||||||
{
|
{
|
||||||
case (nn::hac::cnmt::METATYPE_APPLICATION):
|
case (nn::hac::cnmt::METATYPE_APPLICATION):
|
||||||
std::cout << " ApplicationExtendedHeader:" << std::endl;
|
std::cout << " ApplicationExtendedHeader:" << std::endl;
|
||||||
std::cout << " RequiredSystemVersion: v" << std::dec << mCnmt.getApplicationMetaExtendedHeader().required_system_version << " (" << _SPLIT_VER(mCnmt.getApplicationMetaExtendedHeader().required_system_version) << ")"<< std::endl;
|
std::cout << " RequiredSystemVersion: v" << std::dec << mCnmt.getApplicationMetaExtendedHeader().getRequiredSystemVersion() << " (" << _SPLIT_VER(mCnmt.getApplicationMetaExtendedHeader().getRequiredSystemVersion()) << ")"<< std::endl;
|
||||||
std::cout << " PatchId: 0x" << std::hex << std::setw(16) << std::setfill('0') << mCnmt.getApplicationMetaExtendedHeader().patch_id << std::endl;
|
std::cout << " PatchId: 0x" << std::hex << std::setw(16) << std::setfill('0') << mCnmt.getApplicationMetaExtendedHeader().getPatchId() << std::endl;
|
||||||
break;
|
break;
|
||||||
case (nn::hac::cnmt::METATYPE_PATCH):
|
case (nn::hac::cnmt::METATYPE_PATCH):
|
||||||
std::cout << " PatchMetaExtendedHeader:" << std::endl;
|
std::cout << " PatchMetaExtendedHeader:" << std::endl;
|
||||||
std::cout << " RequiredSystemVersion: v" << std::dec << mCnmt.getPatchMetaExtendedHeader().required_system_version << " (" << _SPLIT_VER(mCnmt.getPatchMetaExtendedHeader().required_system_version) << ")"<< std::endl;
|
std::cout << " RequiredSystemVersion: v" << std::dec << mCnmt.getPatchMetaExtendedHeader().getRequiredSystemVersion() << " (" << _SPLIT_VER(mCnmt.getPatchMetaExtendedHeader().getRequiredSystemVersion()) << ")"<< std::endl;
|
||||||
std::cout << " ApplicationId: 0x" << std::hex << std::setw(16) << std::setfill('0') << mCnmt.getPatchMetaExtendedHeader().application_id << std::endl;
|
std::cout << " ApplicationId: 0x" << std::hex << std::setw(16) << std::setfill('0') << mCnmt.getPatchMetaExtendedHeader().getApplicationId() << std::endl;
|
||||||
break;
|
break;
|
||||||
case (nn::hac::cnmt::METATYPE_ADD_ON_CONTENT):
|
case (nn::hac::cnmt::METATYPE_ADD_ON_CONTENT):
|
||||||
std::cout << " AddOnContentMetaExtendedHeader:" << std::endl;
|
std::cout << " AddOnContentMetaExtendedHeader:" << std::endl;
|
||||||
std::cout << " RequiredApplicationVersion: v" << std::dec << mCnmt.getAddOnContentMetaExtendedHeader().required_application_version << " (" << _SPLIT_VER(mCnmt.getAddOnContentMetaExtendedHeader().required_application_version) << ")" << std::endl;
|
std::cout << " RequiredApplicationVersion: v" << std::dec << mCnmt.getAddOnContentMetaExtendedHeader().getRequiredApplicationVersion() << " (" << _SPLIT_VER(mCnmt.getAddOnContentMetaExtendedHeader().getRequiredApplicationVersion()) << ")" << std::endl;
|
||||||
std::cout << " ApplicationId: 0x" << std::hex << std::setw(16) << std::setfill('0') << mCnmt.getAddOnContentMetaExtendedHeader().application_id << std::endl;
|
std::cout << " ApplicationId: 0x" << std::hex << std::setw(16) << std::setfill('0') << mCnmt.getAddOnContentMetaExtendedHeader().getApplicationId() << std::endl;
|
||||||
break;
|
break;
|
||||||
case (nn::hac::cnmt::METATYPE_DELTA):
|
case (nn::hac::cnmt::METATYPE_DELTA):
|
||||||
std::cout << " DeltaMetaExtendedHeader:" << std::endl;
|
std::cout << " DeltaMetaExtendedHeader:" << std::endl;
|
||||||
std::cout << " ApplicationId: 0x" << std::hex << std::setw(16) << std::setfill('0') << mCnmt.getDeltaMetaExtendedHeader().application_id << std::endl;
|
std::cout << " ApplicationId: 0x" << std::hex << std::setw(16) << std::setfill('0') << mCnmt.getDeltaMetaExtendedHeader().getApplicationId() << std::endl;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (mCnmt.getContentInfo().size() > 0)
|
if (mCnmt.getContentInfo().size() > 0)
|
||||||
{
|
{
|
||||||
printf(" ContentInfo:\n");
|
printf(" ContentInfo:\n");
|
||||||
for (size_t i = 0; i < mCnmt.getContentInfo().size(); i++)
|
for (size_t i = 0; i < mCnmt.getContentInfo().size(); i++)
|
||||||
{
|
{
|
||||||
const nn::hac::ContentMetaBinary::ContentInfo& info = mCnmt.getContentInfo()[i];
|
const nn::hac::ContentInfo& info = mCnmt.getContentInfo()[i];
|
||||||
std::cout << " " << std::dec << i << std::endl;
|
std::cout << " " << std::dec << i << std::endl;
|
||||||
std::cout << " Type: " << getContentTypeStr(info.type) << " (" << std::dec << info.type << ")" << std::endl;
|
std::cout << " Type: " << getContentTypeStr(info.getContentType()) << " (" << std::dec << info.getContentType() << ")" << std::endl;
|
||||||
std::cout << " Id: " << fnd::SimpleTextOutput::arrayToString(info.nca_id, nn::hac::cnmt::kContentIdLen, false, "") << std::endl;
|
std::cout << " Id: " << fnd::SimpleTextOutput::arrayToString(info.getContentId().data, nn::hac::cnmt::kContentIdLen, false, "") << std::endl;
|
||||||
std::cout << " Size: 0x" << std::hex << info.size << std::endl;
|
std::cout << " Size: 0x" << std::hex << info.getContentSize() << std::endl;
|
||||||
std::cout << " Hash: " << fnd::SimpleTextOutput::arrayToString(info.hash.bytes, sizeof(info.hash), false, "") << std::endl;
|
std::cout << " Hash: " << fnd::SimpleTextOutput::arrayToString(info.getContentHash().bytes, sizeof(info.getContentHash()), false, "") << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mCnmt.getContentMetaInfo().size() > 0)
|
if (mCnmt.getContentMetaInfo().size() > 0)
|
||||||
{
|
{
|
||||||
std::cout << " ContentMetaInfo:" << std::endl;
|
std::cout << " ContentMetaInfo:" << std::endl;
|
||||||
for (size_t i = 0; i < mCnmt.getContentMetaInfo().size(); i++)
|
for (size_t i = 0; i < mCnmt.getContentMetaInfo().size(); i++)
|
||||||
{
|
{
|
||||||
const nn::hac::ContentMetaBinary::ContentMetaInfo& info = mCnmt.getContentMetaInfo()[i];
|
const nn::hac::ContentMetaInfo& info = mCnmt.getContentMetaInfo()[i];
|
||||||
std::cout << " " << std::dec << i << std::endl;
|
std::cout << " " << std::dec << i << std::endl;
|
||||||
std::cout << " Id: 0x" << std::hex << std::setw(16) << std::setfill('0') << info.id << std::endl;
|
std::cout << " Id: 0x" << std::hex << std::setw(16) << std::setfill('0') << info.getTitleId() << std::endl;
|
||||||
std::cout << " Version: v" << std::dec << info.version << " (" << _SPLIT_VER(info.version) << ")"<< std::endl;
|
std::cout << " Version: v" << std::dec << info.getTitleVersion() << " (" << _SPLIT_VER(info.getTitleVersion()) << ")"<< std::endl;
|
||||||
std::cout << " Type: " << getContentMetaTypeStr(info.type) << " (" << std::dec << info.type << ")" << std::endl;
|
std::cout << " Type: " << getContentMetaTypeStr(info.getContentMetaType()) << " (" << std::dec << info.getContentMetaType() << ")" << std::endl;
|
||||||
std::cout << " Attributes: 0x" << std::hex << (uint32_t)info.attributes << std::endl;
|
std::cout << " Attributes: 0x" << std::hex << (uint32_t)info.getAttributes() << std::endl;
|
||||||
std::cout << " IncludesExFatDriver: " << getBoolStr(_HAS_BIT(info.attributes, nn::hac::cnmt::ATTRIBUTE_INCLUDES_EX_FAT_DRIVER)) << std::endl;
|
std::cout << " IncludesExFatDriver: " << getBoolStr(_HAS_BIT(info.getAttributes(), nn::hac::cnmt::ATTRIBUTE_INCLUDES_EX_FAT_DRIVER)) << std::endl;
|
||||||
std::cout << " Rebootless: " << getBoolStr(_HAS_BIT(info.attributes, nn::hac::cnmt::ATTRIBUTE_REBOOTLESS)) << std::endl;
|
std::cout << " Rebootless: " << getBoolStr(_HAS_BIT(info.getAttributes(), nn::hac::cnmt::ATTRIBUTE_REBOOTLESS)) << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << " Digest: " << fnd::SimpleTextOutput::arrayToString(mCnmt.getDigest().data, nn::hac::cnmt::kDigestLen, false, "") << std::endl;
|
std::cout << " Digest: " << fnd::SimpleTextOutput::arrayToString(mCnmt.getDigest().data, nn::hac::cnmt::kDigestLen, false, "") << std::endl;
|
||||||
|
|
||||||
#undef _SPLIT_VER
|
#undef _SPLIT_VER
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* CnmtProcess::getBoolStr(bool state) const
|
const char* CnmtProcess::getBoolStr(bool state) const
|
||||||
{
|
{
|
||||||
return state? "TRUE" : "FALSE";
|
return state? "TRUE" : "FALSE";
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* CnmtProcess::getContentTypeStr(nn::hac::cnmt::ContentType type) const
|
const char* CnmtProcess::getContentTypeStr(nn::hac::cnmt::ContentType type) const
|
||||||
{
|
{
|
||||||
const char* str = nullptr;
|
const char* str = nullptr;
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case (nn::hac::cnmt::TYPE_META):
|
case (nn::hac::cnmt::TYPE_META):
|
||||||
str = "Meta";
|
str = "Meta";
|
||||||
break;
|
break;
|
||||||
case (nn::hac::cnmt::TYPE_PROGRAM):
|
case (nn::hac::cnmt::TYPE_PROGRAM):
|
||||||
str = "Program";
|
str = "Program";
|
||||||
break;
|
break;
|
||||||
case (nn::hac::cnmt::TYPE_DATA):
|
case (nn::hac::cnmt::TYPE_DATA):
|
||||||
str = "Data";
|
str = "Data";
|
||||||
break;
|
break;
|
||||||
case (nn::hac::cnmt::TYPE_CONTROL):
|
case (nn::hac::cnmt::TYPE_CONTROL):
|
||||||
str = "Control";
|
str = "Control";
|
||||||
break;
|
break;
|
||||||
case (nn::hac::cnmt::TYPE_HTML_DOCUMENT):
|
case (nn::hac::cnmt::TYPE_HTML_DOCUMENT):
|
||||||
str = "HtmlDocument";
|
str = "HtmlDocument";
|
||||||
break;
|
break;
|
||||||
case (nn::hac::cnmt::TYPE_LEGAL_INFORMATION):
|
case (nn::hac::cnmt::TYPE_LEGAL_INFORMATION):
|
||||||
str = "LegalInformation";
|
str = "LegalInformation";
|
||||||
break;
|
break;
|
||||||
case (nn::hac::cnmt::TYPE_DELTA_FRAGMENT):
|
case (nn::hac::cnmt::TYPE_DELTA_FRAGMENT):
|
||||||
str = "DeltaFragment";
|
str = "DeltaFragment";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
str = "Unknown";
|
str = "Unknown";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* CnmtProcess::getContentMetaTypeStr(nn::hac::cnmt::ContentMetaType type) const
|
const char* CnmtProcess::getContentMetaTypeStr(nn::hac::cnmt::ContentMetaType type) const
|
||||||
{
|
{
|
||||||
const char* str = nullptr;
|
const char* str = nullptr;
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case (nn::hac::cnmt::METATYPE_SYSTEM_PROGRAM):
|
case (nn::hac::cnmt::METATYPE_SYSTEM_PROGRAM):
|
||||||
str = "SystemProgram";
|
str = "SystemProgram";
|
||||||
break;
|
break;
|
||||||
case (nn::hac::cnmt::METATYPE_SYSTEM_DATA):
|
case (nn::hac::cnmt::METATYPE_SYSTEM_DATA):
|
||||||
str = "SystemData";
|
str = "SystemData";
|
||||||
break;
|
break;
|
||||||
case (nn::hac::cnmt::METATYPE_SYSTEM_UPDATE):
|
case (nn::hac::cnmt::METATYPE_SYSTEM_UPDATE):
|
||||||
str = "SystemUpdate";
|
str = "SystemUpdate";
|
||||||
break;
|
break;
|
||||||
case (nn::hac::cnmt::METATYPE_BOOT_IMAGE_PACKAGE):
|
case (nn::hac::cnmt::METATYPE_BOOT_IMAGE_PACKAGE):
|
||||||
str = "BootImagePackage";
|
str = "BootImagePackage";
|
||||||
break;
|
break;
|
||||||
case (nn::hac::cnmt::METATYPE_BOOT_IMAGE_PACKAGE_SAFE):
|
case (nn::hac::cnmt::METATYPE_BOOT_IMAGE_PACKAGE_SAFE):
|
||||||
str = "BootImagePackageSafe";
|
str = "BootImagePackageSafe";
|
||||||
break;
|
break;
|
||||||
case (nn::hac::cnmt::METATYPE_APPLICATION):
|
case (nn::hac::cnmt::METATYPE_APPLICATION):
|
||||||
str = "Application";
|
str = "Application";
|
||||||
break;
|
break;
|
||||||
case (nn::hac::cnmt::METATYPE_PATCH):
|
case (nn::hac::cnmt::METATYPE_PATCH):
|
||||||
str = "Patch";
|
str = "Patch";
|
||||||
break;
|
break;
|
||||||
case (nn::hac::cnmt::METATYPE_ADD_ON_CONTENT):
|
case (nn::hac::cnmt::METATYPE_ADD_ON_CONTENT):
|
||||||
str = "AddOnContent";
|
str = "AddOnContent";
|
||||||
break;
|
break;
|
||||||
case (nn::hac::cnmt::METATYPE_DELTA):
|
case (nn::hac::cnmt::METATYPE_DELTA):
|
||||||
str = "Delta";
|
str = "Delta";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
str = "Unknown";
|
str = "Unknown";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* CnmtProcess::getUpdateTypeStr(nn::hac::cnmt::UpdateType type) const
|
const char* CnmtProcess::getUpdateTypeStr(nn::hac::cnmt::UpdateType type) const
|
||||||
{
|
{
|
||||||
const char* str = nullptr;
|
const char* str = nullptr;
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case (nn::hac::cnmt::UPDATETYPE_APPLY_AS_DELTA):
|
case (nn::hac::cnmt::UPDATETYPE_APPLY_AS_DELTA):
|
||||||
str = "ApplyAsDelta";
|
str = "ApplyAsDelta";
|
||||||
break;
|
break;
|
||||||
case (nn::hac::cnmt::UPDATETYPE_OVERWRITE):
|
case (nn::hac::cnmt::UPDATETYPE_OVERWRITE):
|
||||||
str = "Overwrite";
|
str = "Overwrite";
|
||||||
break;
|
break;
|
||||||
case (nn::hac::cnmt::UPDATETYPE_CREATE):
|
case (nn::hac::cnmt::UPDATETYPE_CREATE):
|
||||||
str = "Create";
|
str = "Create";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
str = "Unknown";
|
str = "Unknown";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* CnmtProcess::getContentMetaAttrStr(nn::hac::cnmt::ContentMetaAttribute attr) const
|
const char* CnmtProcess::getContentMetaAttrStr(nn::hac::cnmt::ContentMetaAttribute attr) const
|
||||||
{
|
{
|
||||||
const char* str = nullptr;
|
const char* str = nullptr;
|
||||||
|
|
||||||
switch (attr)
|
switch (attr)
|
||||||
{
|
{
|
||||||
case (nn::hac::cnmt::ATTRIBUTE_INCLUDES_EX_FAT_DRIVER):
|
case (nn::hac::cnmt::ATTRIBUTE_INCLUDES_EX_FAT_DRIVER):
|
||||||
str = "IncludesExFatDriver";
|
str = "IncludesExFatDriver";
|
||||||
break;
|
break;
|
||||||
case (nn::hac::cnmt::ATTRIBUTE_REBOOTLESS):
|
case (nn::hac::cnmt::ATTRIBUTE_REBOOTLESS):
|
||||||
str = "Rebootless";
|
str = "Rebootless";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
str = "Unknown";
|
str = "Unknown";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,40 +1,40 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <fnd/IFile.h>
|
#include <fnd/IFile.h>
|
||||||
#include <fnd/SharedPtr.h>
|
#include <fnd/SharedPtr.h>
|
||||||
#include <nn/hac/ContentMetaBinary.h>
|
#include <nn/hac/ContentMeta.h>
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
class CnmtProcess
|
class CnmtProcess
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CnmtProcess();
|
CnmtProcess();
|
||||||
|
|
||||||
void process();
|
void process();
|
||||||
|
|
||||||
void setInputFile(const fnd::SharedPtr<fnd::IFile>& file);
|
void setInputFile(const fnd::SharedPtr<fnd::IFile>& file);
|
||||||
void setCliOutputMode(CliOutputMode type);
|
void setCliOutputMode(CliOutputMode type);
|
||||||
void setVerifyMode(bool verify);
|
void setVerifyMode(bool verify);
|
||||||
|
|
||||||
const nn::hac::ContentMetaBinary& getContentMetaBinary() const;
|
const nn::hac::ContentMeta& getContentMeta() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const std::string kModuleName = "CnmtProcess";
|
const std::string kModuleName = "CnmtProcess";
|
||||||
|
|
||||||
fnd::SharedPtr<fnd::IFile> mFile;
|
fnd::SharedPtr<fnd::IFile> mFile;
|
||||||
CliOutputMode mCliOutputMode;
|
CliOutputMode mCliOutputMode;
|
||||||
bool mVerify;
|
bool mVerify;
|
||||||
|
|
||||||
nn::hac::ContentMetaBinary mCnmt;
|
nn::hac::ContentMeta mCnmt;
|
||||||
|
|
||||||
void importCnmt();
|
void importCnmt();
|
||||||
void displayCnmt();
|
void displayCnmt();
|
||||||
|
|
||||||
const char* getBoolStr(bool state) const;
|
const char* getBoolStr(bool state) const;
|
||||||
const char* getContentTypeStr(nn::hac::cnmt::ContentType type) const;
|
const char* getContentTypeStr(nn::hac::cnmt::ContentType type) const;
|
||||||
const char* getContentMetaTypeStr(nn::hac::cnmt::ContentMetaType type) const;
|
const char* getContentMetaTypeStr(nn::hac::cnmt::ContentMetaType type) const;
|
||||||
const char* getUpdateTypeStr(nn::hac::cnmt::UpdateType type) const;
|
const char* getUpdateTypeStr(nn::hac::cnmt::UpdateType type) const;
|
||||||
const char* getContentMetaAttrStr(nn::hac::cnmt::ContentMetaAttribute attr) const;
|
const char* getContentMetaAttrStr(nn::hac::cnmt::ContentMetaAttribute attr) const;
|
||||||
};
|
};
|
|
@ -2,10 +2,10 @@
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <fnd/SimpleTextOutput.h>
|
#include <fnd/SimpleTextOutput.h>
|
||||||
#include <fnd/OffsetAdjustedIFile.h>
|
#include <fnd/OffsetAdjustedIFile.h>
|
||||||
#include <nn/hac/XciUtils.h>
|
#include <nn/hac/GameCardUtils.h>
|
||||||
#include "XciProcess.h"
|
#include "GameCardProcess.h"
|
||||||
|
|
||||||
XciProcess::XciProcess() :
|
GameCardProcess::GameCardProcess() :
|
||||||
mFile(),
|
mFile(),
|
||||||
mCliOutputMode(_BIT(OUTPUT_BASIC)),
|
mCliOutputMode(_BIT(OUTPUT_BASIC)),
|
||||||
mVerify(false),
|
mVerify(false),
|
||||||
|
@ -15,7 +15,7 @@ XciProcess::XciProcess() :
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void XciProcess::process()
|
void GameCardProcess::process()
|
||||||
{
|
{
|
||||||
importHeader();
|
importHeader();
|
||||||
|
|
||||||
|
@ -34,37 +34,37 @@ void XciProcess::process()
|
||||||
processPartitionPfs();
|
processPartitionPfs();
|
||||||
}
|
}
|
||||||
|
|
||||||
void XciProcess::setInputFile(const fnd::SharedPtr<fnd::IFile>& file)
|
void GameCardProcess::setInputFile(const fnd::SharedPtr<fnd::IFile>& file)
|
||||||
{
|
{
|
||||||
mFile = file;
|
mFile = file;
|
||||||
}
|
}
|
||||||
|
|
||||||
void XciProcess::setKeyCfg(const KeyConfiguration& keycfg)
|
void GameCardProcess::setKeyCfg(const KeyConfiguration& keycfg)
|
||||||
{
|
{
|
||||||
mKeyCfg = keycfg;
|
mKeyCfg = keycfg;
|
||||||
}
|
}
|
||||||
|
|
||||||
void XciProcess::setCliOutputMode(CliOutputMode type)
|
void GameCardProcess::setCliOutputMode(CliOutputMode type)
|
||||||
{
|
{
|
||||||
mCliOutputMode = type;
|
mCliOutputMode = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
void XciProcess::setVerifyMode(bool verify)
|
void GameCardProcess::setVerifyMode(bool verify)
|
||||||
{
|
{
|
||||||
mVerify = verify;
|
mVerify = verify;
|
||||||
}
|
}
|
||||||
|
|
||||||
void XciProcess::setPartitionForExtract(const std::string& partition_name, const std::string& extract_path)
|
void GameCardProcess::setPartitionForExtract(const std::string& partition_name, const std::string& extract_path)
|
||||||
{
|
{
|
||||||
mExtractInfo.addElement({partition_name, extract_path});
|
mExtractInfo.addElement({partition_name, extract_path});
|
||||||
}
|
}
|
||||||
|
|
||||||
void XciProcess::setListFs(bool list_fs)
|
void GameCardProcess::setListFs(bool list_fs)
|
||||||
{
|
{
|
||||||
mListFs = list_fs;
|
mListFs = list_fs;
|
||||||
}
|
}
|
||||||
|
|
||||||
void XciProcess::importHeader()
|
void GameCardProcess::importHeader()
|
||||||
{
|
{
|
||||||
fnd::Vec<byte_t> scratch;
|
fnd::Vec<byte_t> scratch;
|
||||||
|
|
||||||
|
@ -74,22 +74,22 @@ void XciProcess::importHeader()
|
||||||
}
|
}
|
||||||
|
|
||||||
// read header page
|
// read header page
|
||||||
(*mFile)->read((byte_t*)&mHdrPage, 0, sizeof(nn::hac::sXciHeaderPage));
|
(*mFile)->read((byte_t*)&mHdrPage, 0, sizeof(nn::hac::sGcHeaderPage));
|
||||||
|
|
||||||
// allocate memory for and decrypt sXciHeader
|
// allocate memory for and decrypt sXciHeader
|
||||||
scratch.alloc(sizeof(nn::hac::sXciHeader));
|
scratch.alloc(sizeof(nn::hac::sGcHeader));
|
||||||
|
|
||||||
fnd::aes::sAes128Key header_key;
|
fnd::aes::sAes128Key header_key;
|
||||||
mKeyCfg.getXciHeaderKey(header_key);
|
mKeyCfg.getXciHeaderKey(header_key);
|
||||||
nn::hac::XciUtils::decryptXciHeader((const byte_t*)&mHdrPage.header, scratch.data(), header_key.key);
|
nn::hac::GameCardUtils::decryptXciHeader((const byte_t*)&mHdrPage.header, scratch.data(), header_key.key);
|
||||||
|
|
||||||
// deserialise header
|
// deserialise header
|
||||||
mHdr.fromBytes(scratch.data(), scratch.size());
|
mHdr.fromBytes(scratch.data(), scratch.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
void XciProcess::displayHeader()
|
void GameCardProcess::displayHeader()
|
||||||
{
|
{
|
||||||
std::cout << "[XCI Header]" << std::endl;
|
std::cout << "[GameCard Header]" << std::endl;
|
||||||
std::cout << " CardHeaderVersion: " << std::dec << (uint32_t)mHdr.getCardHeaderVersion() << std::endl;
|
std::cout << " CardHeaderVersion: " << std::dec << (uint32_t)mHdr.getCardHeaderVersion() << std::endl;
|
||||||
std::cout << " RomSize: " << getRomSizeStr(mHdr.getRomSizeType());
|
std::cout << " RomSize: " << getRomSizeStr(mHdr.getRomSizeType());
|
||||||
if (_HAS_BIT(mCliOutputMode, OUTPUT_EXTENDED))
|
if (_HAS_BIT(mCliOutputMode, OUTPUT_EXTENDED))
|
||||||
|
@ -128,22 +128,22 @@ void XciProcess::displayHeader()
|
||||||
{
|
{
|
||||||
std::cout << " RomAreaStartPage: 0x" << std::hex << mHdr.getRomAreaStartPage();
|
std::cout << " RomAreaStartPage: 0x" << std::hex << mHdr.getRomAreaStartPage();
|
||||||
if (mHdr.getRomAreaStartPage() != (uint32_t)(-1))
|
if (mHdr.getRomAreaStartPage() != (uint32_t)(-1))
|
||||||
std::cout << " (0x" << std::hex << nn::hac::XciUtils::blockToAddr(mHdr.getRomAreaStartPage()) << ")";
|
std::cout << " (0x" << std::hex << nn::hac::GameCardUtils::blockToAddr(mHdr.getRomAreaStartPage()) << ")";
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
|
|
||||||
std::cout << " BackupAreaStartPage: 0x" << std::hex << mHdr.getBackupAreaStartPage();
|
std::cout << " BackupAreaStartPage: 0x" << std::hex << mHdr.getBackupAreaStartPage();
|
||||||
if (mHdr.getBackupAreaStartPage() != (uint32_t)(-1))
|
if (mHdr.getBackupAreaStartPage() != (uint32_t)(-1))
|
||||||
std::cout << " (0x" << std::hex << nn::hac::XciUtils::blockToAddr(mHdr.getBackupAreaStartPage()) << ")";
|
std::cout << " (0x" << std::hex << nn::hac::GameCardUtils::blockToAddr(mHdr.getBackupAreaStartPage()) << ")";
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
|
|
||||||
std::cout << " ValidDataEndPage: 0x" << std::hex << mHdr.getValidDataEndPage();
|
std::cout << " ValidDataEndPage: 0x" << std::hex << mHdr.getValidDataEndPage();
|
||||||
if (mHdr.getValidDataEndPage() != (uint32_t)(-1))
|
if (mHdr.getValidDataEndPage() != (uint32_t)(-1))
|
||||||
std::cout << " (0x" << std::hex << nn::hac::XciUtils::blockToAddr(mHdr.getValidDataEndPage()) << ")";
|
std::cout << " (0x" << std::hex << nn::hac::GameCardUtils::blockToAddr(mHdr.getValidDataEndPage()) << ")";
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
|
|
||||||
std::cout << " LimArea: 0x" << std::hex << mHdr.getLimAreaPage();
|
std::cout << " LimArea: 0x" << std::hex << mHdr.getLimAreaPage();
|
||||||
if (mHdr.getLimAreaPage() != (uint32_t)(-1))
|
if (mHdr.getLimAreaPage() != (uint32_t)(-1))
|
||||||
std::cout << " (0x" << std::hex << nn::hac::XciUtils::blockToAddr(mHdr.getLimAreaPage()) << ")";
|
std::cout << " (0x" << std::hex << nn::hac::GameCardUtils::blockToAddr(mHdr.getLimAreaPage()) << ")";
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
|
|
||||||
std::cout << " PartitionFs Header:" << std::endl;
|
std::cout << " PartitionFs Header:" << std::endl;
|
||||||
|
@ -160,7 +160,7 @@ void XciProcess::displayHeader()
|
||||||
|
|
||||||
if (mHdr.getFwVerMinor() != 0)
|
if (mHdr.getFwVerMinor() != 0)
|
||||||
{
|
{
|
||||||
std::cout << "[XCI Extended Header]" << std::endl;
|
std::cout << "[GameCard Extended Header]" << std::endl;
|
||||||
std::cout << " FwVersion: v" << std::dec << mHdr.getFwVerMajor() << "." << mHdr.getFwVerMinor() << std::endl;
|
std::cout << " FwVersion: v" << std::dec << mHdr.getFwVerMajor() << "." << mHdr.getFwVerMinor() << std::endl;
|
||||||
std::cout << " AccCtrl1: 0x" << std::hex << mHdr.getAccCtrl1() << std::endl;
|
std::cout << " AccCtrl1: 0x" << std::hex << mHdr.getAccCtrl1() << std::endl;
|
||||||
std::cout << " CardClockRate: " << getCardClockRate(mHdr.getAccCtrl1()) << std::endl;
|
std::cout << " CardClockRate: " << getCardClockRate(mHdr.getAccCtrl1()) << std::endl;
|
||||||
|
@ -178,7 +178,7 @@ void XciProcess::displayHeader()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool XciProcess::validateRegionOfFile(size_t offset, size_t len, const byte_t* test_hash)
|
bool GameCardProcess::validateRegionOfFile(size_t offset, size_t len, const byte_t* test_hash)
|
||||||
{
|
{
|
||||||
fnd::Vec<byte_t> scratch;
|
fnd::Vec<byte_t> scratch;
|
||||||
fnd::sha::sSha256Hash calc_hash;
|
fnd::sha::sSha256Hash calc_hash;
|
||||||
|
@ -188,23 +188,23 @@ bool XciProcess::validateRegionOfFile(size_t offset, size_t len, const byte_t* t
|
||||||
return calc_hash.compare(test_hash);
|
return calc_hash.compare(test_hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
void XciProcess::validateXciSignature()
|
void GameCardProcess::validateXciSignature()
|
||||||
{
|
{
|
||||||
fnd::rsa::sRsa2048Key header_sign_key;
|
fnd::rsa::sRsa2048Key header_sign_key;
|
||||||
fnd::sha::sSha256Hash calc_hash;
|
fnd::sha::sSha256Hash calc_hash;
|
||||||
fnd::sha::Sha256((byte_t*)&mHdrPage.header, sizeof(nn::hac::sXciHeader), calc_hash.bytes);
|
fnd::sha::Sha256((byte_t*)&mHdrPage.header, sizeof(nn::hac::sGcHeader), calc_hash.bytes);
|
||||||
mKeyCfg.getXciHeaderSignKey(header_sign_key);
|
mKeyCfg.getXciHeaderSignKey(header_sign_key);
|
||||||
if (fnd::rsa::pkcs::rsaVerify(header_sign_key, fnd::sha::HASH_SHA256, calc_hash.bytes, mHdrPage.signature) != 0)
|
if (fnd::rsa::pkcs::rsaVerify(header_sign_key, fnd::sha::HASH_SHA256, calc_hash.bytes, mHdrPage.signature) != 0)
|
||||||
{
|
{
|
||||||
std::cout << "[WARNING] XCI Header Signature: FAIL" << std::endl;
|
std::cout << "[WARNING] GameCard Header Signature: FAIL" << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void XciProcess::processRootPfs()
|
void GameCardProcess::processRootPfs()
|
||||||
{
|
{
|
||||||
if (mVerify && validateRegionOfFile(mHdr.getPartitionFsAddress(), mHdr.getPartitionFsSize(), mHdr.getPartitionFsHash().bytes) == false)
|
if (mVerify && validateRegionOfFile(mHdr.getPartitionFsAddress(), mHdr.getPartitionFsSize(), mHdr.getPartitionFsHash().bytes) == false)
|
||||||
{
|
{
|
||||||
std::cout << "[WARNING] XCI Root HFS0: FAIL (bad hash)" << std::endl;
|
std::cout << "[WARNING] GameCard Root HFS0: FAIL (bad hash)" << std::endl;
|
||||||
}
|
}
|
||||||
mRootPfs.setInputFile(new fnd::OffsetAdjustedIFile(mFile, mHdr.getPartitionFsAddress(), mHdr.getPartitionFsSize()));
|
mRootPfs.setInputFile(new fnd::OffsetAdjustedIFile(mFile, mHdr.getPartitionFsAddress(), mHdr.getPartitionFsSize()));
|
||||||
mRootPfs.setListFs(mListFs);
|
mRootPfs.setListFs(mListFs);
|
||||||
|
@ -214,15 +214,15 @@ void XciProcess::processRootPfs()
|
||||||
mRootPfs.process();
|
mRootPfs.process();
|
||||||
}
|
}
|
||||||
|
|
||||||
void XciProcess::processPartitionPfs()
|
void GameCardProcess::processPartitionPfs()
|
||||||
{
|
{
|
||||||
const fnd::List<nn::hac::PfsHeader::sFile>& rootPartitions = mRootPfs.getPfsHeader().getFileList();
|
const fnd::List<nn::hac::PartitionFsHeader::sFile>& rootPartitions = mRootPfs.getPfsHeader().getFileList();
|
||||||
for (size_t i = 0; i < rootPartitions.size(); i++)
|
for (size_t i = 0; i < rootPartitions.size(); i++)
|
||||||
{
|
{
|
||||||
// this must be validated here because only the size of the root partiton header is known at verification time
|
// this must be validated here because only the size of the root partiton header is known at verification time
|
||||||
if (mVerify && validateRegionOfFile(mHdr.getPartitionFsAddress() + rootPartitions[i].offset, rootPartitions[i].hash_protected_size, rootPartitions[i].hash.bytes) == false)
|
if (mVerify && validateRegionOfFile(mHdr.getPartitionFsAddress() + rootPartitions[i].offset, rootPartitions[i].hash_protected_size, rootPartitions[i].hash.bytes) == false)
|
||||||
{
|
{
|
||||||
std::cout << "[WARNING] XCI " << rootPartitions[i].name << " Partition HFS0: FAIL (bad hash)" << std::endl;
|
std::cout << "[WARNING] GameCard " << rootPartitions[i].name << " Partition HFS0: FAIL (bad hash)" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
PfsProcess tmp;
|
PfsProcess tmp;
|
||||||
|
@ -238,28 +238,28 @@ void XciProcess::processPartitionPfs()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* XciProcess::getRomSizeStr(byte_t rom_size) const
|
const char* GameCardProcess::getRomSizeStr(byte_t rom_size) const
|
||||||
{
|
{
|
||||||
const char* str = nullptr;
|
const char* str = nullptr;
|
||||||
|
|
||||||
switch (rom_size)
|
switch (rom_size)
|
||||||
{
|
{
|
||||||
case (nn::hac::xci::ROM_SIZE_1GB):
|
case (nn::hac::gc::ROM_SIZE_1GB):
|
||||||
str = "1GB";
|
str = "1GB";
|
||||||
break;
|
break;
|
||||||
case (nn::hac::xci::ROM_SIZE_2GB):
|
case (nn::hac::gc::ROM_SIZE_2GB):
|
||||||
str = "2GB";
|
str = "2GB";
|
||||||
break;
|
break;
|
||||||
case (nn::hac::xci::ROM_SIZE_4GB):
|
case (nn::hac::gc::ROM_SIZE_4GB):
|
||||||
str = "4GB";
|
str = "4GB";
|
||||||
break;
|
break;
|
||||||
case (nn::hac::xci::ROM_SIZE_8GB):
|
case (nn::hac::gc::ROM_SIZE_8GB):
|
||||||
str = "8GB";
|
str = "8GB";
|
||||||
break;
|
break;
|
||||||
case (nn::hac::xci::ROM_SIZE_16GB):
|
case (nn::hac::gc::ROM_SIZE_16GB):
|
||||||
str = "16GB";
|
str = "16GB";
|
||||||
break;
|
break;
|
||||||
case (nn::hac::xci::ROM_SIZE_32GB):
|
case (nn::hac::gc::ROM_SIZE_32GB):
|
||||||
str = "32GB";
|
str = "32GB";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -270,19 +270,19 @@ const char* XciProcess::getRomSizeStr(byte_t rom_size) const
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* XciProcess::getHeaderFlagStr(byte_t flag) const
|
const char* GameCardProcess::getHeaderFlagStr(byte_t flag) const
|
||||||
{
|
{
|
||||||
const char* str = nullptr;
|
const char* str = nullptr;
|
||||||
|
|
||||||
switch (flag)
|
switch (flag)
|
||||||
{
|
{
|
||||||
case (nn::hac::xci::FLAG_AUTOBOOT):
|
case (nn::hac::gc::FLAG_AUTOBOOT):
|
||||||
str = "AutoBoot";
|
str = "AutoBoot";
|
||||||
break;
|
break;
|
||||||
case (nn::hac::xci::FLAG_HISTORY_ERASE):
|
case (nn::hac::gc::FLAG_HISTORY_ERASE):
|
||||||
str = "HistoryErase";
|
str = "HistoryErase";
|
||||||
break;
|
break;
|
||||||
case (nn::hac::xci::FLAG_REPAIR_TOOL):
|
case (nn::hac::gc::FLAG_REPAIR_TOOL):
|
||||||
str = "RepairTool";
|
str = "RepairTool";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -294,16 +294,16 @@ const char* XciProcess::getHeaderFlagStr(byte_t flag) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const char* XciProcess::getCardClockRate(uint32_t acc_ctrl_1) const
|
const char* GameCardProcess::getCardClockRate(uint32_t acc_ctrl_1) const
|
||||||
{
|
{
|
||||||
const char* str = nullptr;
|
const char* str = nullptr;
|
||||||
|
|
||||||
switch (acc_ctrl_1)
|
switch (acc_ctrl_1)
|
||||||
{
|
{
|
||||||
case (nn::hac::xci::CLOCK_RATE_25):
|
case (nn::hac::gc::CLOCK_RATE_25):
|
||||||
str = "20 MHz";
|
str = "20 MHz";
|
||||||
break;
|
break;
|
||||||
case (nn::hac::xci::CLOCK_RATE_50):
|
case (nn::hac::gc::CLOCK_RATE_50):
|
||||||
str = "50 MHz";
|
str = "50 MHz";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
|
@ -4,16 +4,16 @@
|
||||||
#include <fnd/IFile.h>
|
#include <fnd/IFile.h>
|
||||||
#include <fnd/SharedPtr.h>
|
#include <fnd/SharedPtr.h>
|
||||||
#include <fnd/List.h>
|
#include <fnd/List.h>
|
||||||
#include <nn/hac/XciHeader.h>
|
#include <nn/hac/GameCardHeader.h>
|
||||||
#include "KeyConfiguration.h"
|
#include "KeyConfiguration.h"
|
||||||
#include "PfsProcess.h"
|
#include "PfsProcess.h"
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
class XciProcess
|
class GameCardProcess
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
XciProcess();
|
GameCardProcess();
|
||||||
|
|
||||||
void process();
|
void process();
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ public:
|
||||||
void setListFs(bool list_fs);
|
void setListFs(bool list_fs);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const std::string kModuleName = "XciProcess";
|
const std::string kModuleName = "GameCardProcess";
|
||||||
const std::string kXciMountPointName = "gamecard:/";
|
const std::string kXciMountPointName = "gamecard:/";
|
||||||
|
|
||||||
fnd::SharedPtr<fnd::IFile> mFile;
|
fnd::SharedPtr<fnd::IFile> mFile;
|
||||||
|
@ -55,8 +55,8 @@ private:
|
||||||
|
|
||||||
bool mListFs;
|
bool mListFs;
|
||||||
|
|
||||||
nn::hac::sXciHeaderPage mHdrPage;
|
nn::hac::sGcHeaderPage mHdrPage;
|
||||||
nn::hac::XciHeader mHdr;
|
nn::hac::GameCardHeader mHdr;
|
||||||
PfsProcess mRootPfs;
|
PfsProcess mRootPfs;
|
||||||
fnd::List<sExtractInfo> mExtractInfo;
|
fnd::List<sExtractInfo> mExtractInfo;
|
||||||
|
|
|
@ -1,376 +1,376 @@
|
||||||
#include "KeyConfiguration.h"
|
#include "KeyConfiguration.h"
|
||||||
#include <fnd/ResourceFileReader.h>
|
#include <fnd/ResourceFileReader.h>
|
||||||
#include <fnd/SimpleTextOutput.h>
|
#include <fnd/SimpleTextOutput.h>
|
||||||
#include <nn/hac/AesKeygen.h>
|
#include <nn/hac/AesKeygen.h>
|
||||||
#include <nn/hac/NcaUtils.h>
|
#include <nn/hac/ContentArchiveUtils.h>
|
||||||
|
|
||||||
KeyConfiguration::KeyConfiguration()
|
KeyConfiguration::KeyConfiguration()
|
||||||
{
|
{
|
||||||
clearGeneralKeyConfiguration();
|
clearGeneralKeyConfiguration();
|
||||||
clearNcaExternalKeys();
|
clearNcaExternalKeys();
|
||||||
}
|
}
|
||||||
|
|
||||||
KeyConfiguration::KeyConfiguration(const KeyConfiguration& other)
|
KeyConfiguration::KeyConfiguration(const KeyConfiguration& other)
|
||||||
{
|
{
|
||||||
*this = other;
|
*this = other;
|
||||||
}
|
}
|
||||||
|
|
||||||
void KeyConfiguration::operator=(const KeyConfiguration& other)
|
void KeyConfiguration::operator=(const KeyConfiguration& other)
|
||||||
{
|
{
|
||||||
mAcidSignKey = other.mAcidSignKey;
|
mAcidSignKey = other.mAcidSignKey;
|
||||||
mPkg2SignKey = other.mPkg2SignKey;
|
mPkg2SignKey = other.mPkg2SignKey;
|
||||||
mNcaHeader0SignKey = other.mNcaHeader0SignKey;
|
mContentArchiveHeader0SignKey = other.mContentArchiveHeader0SignKey;
|
||||||
mXciHeaderSignKey = other.mXciHeaderSignKey;
|
mXciHeaderSignKey = other.mXciHeaderSignKey;
|
||||||
|
|
||||||
mNcaHeaderKey = other.mNcaHeaderKey;
|
mContentArchiveHeaderKey = other.mContentArchiveHeaderKey;
|
||||||
mXciHeaderKey = other.mXciHeaderKey;
|
mXciHeaderKey = other.mXciHeaderKey;
|
||||||
|
|
||||||
for (size_t i = 0; i < kMasterKeyNum; i++)
|
for (size_t i = 0; i < kMasterKeyNum; i++)
|
||||||
{
|
{
|
||||||
mPkg2Key[i] = other.mPkg2Key[i];
|
mPkg2Key[i] = other.mPkg2Key[i];
|
||||||
mPkg1Key[i] = other.mPkg1Key[i];
|
mPkg1Key[i] = other.mPkg1Key[i];
|
||||||
mNcaKeyAreaEncryptionKey[0][i] = other.mNcaKeyAreaEncryptionKey[0][i];
|
mNcaKeyAreaEncryptionKey[0][i] = other.mNcaKeyAreaEncryptionKey[0][i];
|
||||||
mNcaKeyAreaEncryptionKey[1][i] = other.mNcaKeyAreaEncryptionKey[1][i];
|
mNcaKeyAreaEncryptionKey[1][i] = other.mNcaKeyAreaEncryptionKey[1][i];
|
||||||
mNcaKeyAreaEncryptionKey[2][i] = other.mNcaKeyAreaEncryptionKey[2][i];
|
mNcaKeyAreaEncryptionKey[2][i] = other.mNcaKeyAreaEncryptionKey[2][i];
|
||||||
mNcaKeyAreaEncryptionKeyHw[0][i] = other.mNcaKeyAreaEncryptionKeyHw[0][i];
|
mNcaKeyAreaEncryptionKeyHw[0][i] = other.mNcaKeyAreaEncryptionKeyHw[0][i];
|
||||||
mNcaKeyAreaEncryptionKeyHw[1][i] = other.mNcaKeyAreaEncryptionKeyHw[1][i];
|
mNcaKeyAreaEncryptionKeyHw[1][i] = other.mNcaKeyAreaEncryptionKeyHw[1][i];
|
||||||
mNcaKeyAreaEncryptionKeyHw[2][i] = other.mNcaKeyAreaEncryptionKeyHw[2][i];
|
mNcaKeyAreaEncryptionKeyHw[2][i] = other.mNcaKeyAreaEncryptionKeyHw[2][i];
|
||||||
mETicketCommonKey[i] = other.mETicketCommonKey[i];
|
mETicketCommonKey[i] = other.mETicketCommonKey[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
mPkiRootKeyList = other.mPkiRootKeyList;
|
mPkiRootKeyList = other.mPkiRootKeyList;
|
||||||
|
|
||||||
mNcaExternalContentKeyList = other.mNcaExternalContentKeyList;
|
mNcaExternalContentKeyList = other.mNcaExternalContentKeyList;
|
||||||
}
|
}
|
||||||
|
|
||||||
void KeyConfiguration::importHactoolGenericKeyfile(const std::string& path)
|
void KeyConfiguration::importHactoolGenericKeyfile(const std::string& path)
|
||||||
{
|
{
|
||||||
clearGeneralKeyConfiguration();
|
clearGeneralKeyConfiguration();
|
||||||
|
|
||||||
fnd::ResourceFileReader res;
|
fnd::ResourceFileReader res;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
res.processFile(path);
|
res.processFile(path);
|
||||||
}
|
}
|
||||||
catch (const fnd::Exception&)
|
catch (const fnd::Exception&)
|
||||||
{
|
{
|
||||||
throw fnd::Exception(kModuleName, "Failed to open key file: " + path);
|
throw fnd::Exception(kModuleName, "Failed to open key file: " + path);
|
||||||
}
|
}
|
||||||
|
|
||||||
// internally used sources
|
// internally used sources
|
||||||
fnd::aes::sAes128Key master_key[kMasterKeyNum] = { kNullAesKey };
|
fnd::aes::sAes128Key master_key[kMasterKeyNum] = { kNullAesKey };
|
||||||
fnd::aes::sAes128Key package2_key_source = kNullAesKey;
|
fnd::aes::sAes128Key package2_key_source = kNullAesKey;
|
||||||
fnd::aes::sAes128Key ticket_titlekek_source = kNullAesKey;
|
fnd::aes::sAes128Key ticket_titlekek_source = kNullAesKey;
|
||||||
fnd::aes::sAes128Key key_area_key_source[kNcaKeakNum] = { kNullAesKey, kNullAesKey, kNullAesKey };
|
fnd::aes::sAes128Key key_area_key_source[kNcaKeakNum] = { kNullAesKey, kNullAesKey, kNullAesKey };
|
||||||
fnd::aes::sAes128Key aes_kek_generation_source = kNullAesKey;
|
fnd::aes::sAes128Key aes_kek_generation_source = kNullAesKey;
|
||||||
fnd::aes::sAes128Key aes_key_generation_source = kNullAesKey;
|
fnd::aes::sAes128Key aes_key_generation_source = kNullAesKey;
|
||||||
fnd::aes::sAes128Key nca_header_kek_source = kNullAesKey;
|
fnd::aes::sAes128Key nca_header_kek_source = kNullAesKey;
|
||||||
fnd::aes::sAesXts128Key nca_header_key_source = kNullAesXtsKey;
|
fnd::aes::sAesXts128Key nca_header_key_source = kNullAesXtsKey;
|
||||||
fnd::rsa::sRsa4096Key pki_root_sign_key = kNullRsa4096Key;
|
fnd::rsa::sRsa4096Key pki_root_sign_key = kNullRsa4096Key;
|
||||||
|
|
||||||
#define _CONCAT_2_STRINGS(str1, str2) ((str1) + "_" + (str2))
|
#define _CONCAT_2_STRINGS(str1, str2) ((str1) + "_" + (str2))
|
||||||
#define _CONCAT_3_STRINGS(str1, str2, str3) _CONCAT_2_STRINGS(_CONCAT_2_STRINGS(str1, str2), str3)
|
#define _CONCAT_3_STRINGS(str1, str2, str3) _CONCAT_2_STRINGS(_CONCAT_2_STRINGS(str1, str2), str3)
|
||||||
|
|
||||||
std::string key,val;
|
std::string key,val;
|
||||||
fnd::Vec<byte_t> dec_array;
|
fnd::Vec<byte_t> dec_array;
|
||||||
|
|
||||||
#define _SAVE_KEYDATA(key_name, array, len) \
|
#define _SAVE_KEYDATA(key_name, array, len) \
|
||||||
key = (key_name); \
|
key = (key_name); \
|
||||||
val = res[key]; \
|
val = res[key]; \
|
||||||
if (val.empty() == false) { \
|
if (val.empty() == false) { \
|
||||||
fnd::SimpleTextOutput::stringToArray(val, dec_array); \
|
fnd::SimpleTextOutput::stringToArray(val, dec_array); \
|
||||||
if (dec_array.size() != len) \
|
if (dec_array.size() != len) \
|
||||||
throw fnd::Exception(kModuleName, "Key: \"" + key_name + "\" has incorrect length"); \
|
throw fnd::Exception(kModuleName, "Key: \"" + key_name + "\" has incorrect length"); \
|
||||||
memcpy(array, dec_array.data(), len); \
|
memcpy(array, dec_array.data(), len); \
|
||||||
}
|
}
|
||||||
|
|
||||||
for (size_t nameidx = 0; nameidx < kNameVariantNum; nameidx++)
|
for (size_t nameidx = 0; nameidx < kNameVariantNum; nameidx++)
|
||||||
{
|
{
|
||||||
// import sources
|
// import sources
|
||||||
_SAVE_KEYDATA(_CONCAT_3_STRINGS(kPkg2Base[nameidx], kKeyStr, kSourceStr), package2_key_source.key, 0x10);
|
_SAVE_KEYDATA(_CONCAT_3_STRINGS(kPkg2Base[nameidx], kKeyStr, kSourceStr), package2_key_source.key, 0x10);
|
||||||
_SAVE_KEYDATA(_CONCAT_2_STRINGS(kTicketCommonKeyBase[nameidx], kSourceStr), ticket_titlekek_source.key, 0x10);
|
_SAVE_KEYDATA(_CONCAT_2_STRINGS(kTicketCommonKeyBase[nameidx], kSourceStr), ticket_titlekek_source.key, 0x10);
|
||||||
_SAVE_KEYDATA(_CONCAT_3_STRINGS(kNcaKeyAreaEncKeyBase[nameidx], kNcaKeyAreaKeyIndexStr[0], kSourceStr), key_area_key_source[0].key, 0x10);
|
_SAVE_KEYDATA(_CONCAT_3_STRINGS(kNcaKeyAreaEncKeyBase[nameidx], kNcaKeyAreaKeyIndexStr[0], kSourceStr), key_area_key_source[0].key, 0x10);
|
||||||
_SAVE_KEYDATA(_CONCAT_3_STRINGS(kNcaKeyAreaEncKeyBase[nameidx], kNcaKeyAreaKeyIndexStr[1], kSourceStr), key_area_key_source[1].key, 0x10);
|
_SAVE_KEYDATA(_CONCAT_3_STRINGS(kNcaKeyAreaEncKeyBase[nameidx], kNcaKeyAreaKeyIndexStr[1], kSourceStr), key_area_key_source[1].key, 0x10);
|
||||||
_SAVE_KEYDATA(_CONCAT_3_STRINGS(kNcaKeyAreaEncKeyBase[nameidx], kNcaKeyAreaKeyIndexStr[2], kSourceStr), key_area_key_source[2].key, 0x10);
|
_SAVE_KEYDATA(_CONCAT_3_STRINGS(kNcaKeyAreaEncKeyBase[nameidx], kNcaKeyAreaKeyIndexStr[2], kSourceStr), key_area_key_source[2].key, 0x10);
|
||||||
_SAVE_KEYDATA(_CONCAT_2_STRINGS(kKekGenBase[nameidx], kSourceStr), aes_kek_generation_source.key, 0x10);
|
_SAVE_KEYDATA(_CONCAT_2_STRINGS(kKekGenBase[nameidx], kSourceStr), aes_kek_generation_source.key, 0x10);
|
||||||
_SAVE_KEYDATA(_CONCAT_2_STRINGS(kKeyGenBase[nameidx], kSourceStr), aes_key_generation_source.key, 0x10);
|
_SAVE_KEYDATA(_CONCAT_2_STRINGS(kKeyGenBase[nameidx], kSourceStr), aes_key_generation_source.key, 0x10);
|
||||||
_SAVE_KEYDATA(_CONCAT_3_STRINGS(kXciHeaderBase[nameidx], kKekStr, kSourceStr), nca_header_kek_source.key, 0x10);
|
_SAVE_KEYDATA(_CONCAT_3_STRINGS(kXciHeaderBase[nameidx], kKekStr, kSourceStr), nca_header_kek_source.key, 0x10);
|
||||||
_SAVE_KEYDATA(_CONCAT_3_STRINGS(kXciHeaderBase[nameidx], kKeyStr, kSourceStr), nca_header_key_source.key, 0x20);
|
_SAVE_KEYDATA(_CONCAT_3_STRINGS(kXciHeaderBase[nameidx], kKeyStr, kSourceStr), nca_header_key_source.key, 0x20);
|
||||||
|
|
||||||
// Store Key Variants/Derivatives
|
// Store Key Variants/Derivatives
|
||||||
for (size_t mkeyidx = 0; mkeyidx < kMasterKeyNum; mkeyidx++)
|
for (size_t mkeyidx = 0; mkeyidx < kMasterKeyNum; mkeyidx++)
|
||||||
{
|
{
|
||||||
|
|
||||||
_SAVE_KEYDATA(_CONCAT_3_STRINGS(kMasterBase[nameidx], kKeyStr, kKeyIndex[mkeyidx]), master_key[mkeyidx].key, 0x10);
|
_SAVE_KEYDATA(_CONCAT_3_STRINGS(kMasterBase[nameidx], kKeyStr, kKeyIndex[mkeyidx]), master_key[mkeyidx].key, 0x10);
|
||||||
_SAVE_KEYDATA(_CONCAT_3_STRINGS(kPkg1Base[nameidx], kKeyStr, kKeyIndex[mkeyidx]), mPkg1Key[mkeyidx].key, 0x10);
|
_SAVE_KEYDATA(_CONCAT_3_STRINGS(kPkg1Base[nameidx], kKeyStr, kKeyIndex[mkeyidx]), mPkg1Key[mkeyidx].key, 0x10);
|
||||||
_SAVE_KEYDATA(_CONCAT_3_STRINGS(kPkg2Base[nameidx], kKeyStr, kKeyIndex[mkeyidx]), mPkg2Key[mkeyidx].key, 0x10);
|
_SAVE_KEYDATA(_CONCAT_3_STRINGS(kPkg2Base[nameidx], kKeyStr, kKeyIndex[mkeyidx]), mPkg2Key[mkeyidx].key, 0x10);
|
||||||
_SAVE_KEYDATA(_CONCAT_2_STRINGS(kTicketCommonKeyBase[nameidx], kKeyIndex[mkeyidx]), mETicketCommonKey[mkeyidx].key, 0x10);
|
_SAVE_KEYDATA(_CONCAT_2_STRINGS(kTicketCommonKeyBase[nameidx], kKeyIndex[mkeyidx]), mETicketCommonKey[mkeyidx].key, 0x10);
|
||||||
_SAVE_KEYDATA(_CONCAT_3_STRINGS(kNcaKeyAreaEncKeyBase[nameidx], kNcaKeyAreaKeyIndexStr[0], kKeyIndex[mkeyidx]), mNcaKeyAreaEncryptionKey[0][mkeyidx].key, 0x10);
|
_SAVE_KEYDATA(_CONCAT_3_STRINGS(kNcaKeyAreaEncKeyBase[nameidx], kNcaKeyAreaKeyIndexStr[0], kKeyIndex[mkeyidx]), mNcaKeyAreaEncryptionKey[0][mkeyidx].key, 0x10);
|
||||||
_SAVE_KEYDATA(_CONCAT_3_STRINGS(kNcaKeyAreaEncKeyBase[nameidx], kNcaKeyAreaKeyIndexStr[1], kKeyIndex[mkeyidx]), mNcaKeyAreaEncryptionKey[1][mkeyidx].key, 0x10);
|
_SAVE_KEYDATA(_CONCAT_3_STRINGS(kNcaKeyAreaEncKeyBase[nameidx], kNcaKeyAreaKeyIndexStr[1], kKeyIndex[mkeyidx]), mNcaKeyAreaEncryptionKey[1][mkeyidx].key, 0x10);
|
||||||
_SAVE_KEYDATA(_CONCAT_3_STRINGS(kNcaKeyAreaEncKeyBase[nameidx], kNcaKeyAreaKeyIndexStr[2], kKeyIndex[mkeyidx]), mNcaKeyAreaEncryptionKey[2][mkeyidx].key, 0x10);
|
_SAVE_KEYDATA(_CONCAT_3_STRINGS(kNcaKeyAreaEncKeyBase[nameidx], kNcaKeyAreaKeyIndexStr[2], kKeyIndex[mkeyidx]), mNcaKeyAreaEncryptionKey[2][mkeyidx].key, 0x10);
|
||||||
_SAVE_KEYDATA(_CONCAT_3_STRINGS(kNcaKeyAreaEncKeyHwBase[nameidx], kNcaKeyAreaKeyIndexStr[0], kKeyIndex[mkeyidx]), mNcaKeyAreaEncryptionKeyHw[0][mkeyidx].key, 0x10);
|
_SAVE_KEYDATA(_CONCAT_3_STRINGS(kNcaKeyAreaEncKeyHwBase[nameidx], kNcaKeyAreaKeyIndexStr[0], kKeyIndex[mkeyidx]), mNcaKeyAreaEncryptionKeyHw[0][mkeyidx].key, 0x10);
|
||||||
_SAVE_KEYDATA(_CONCAT_3_STRINGS(kNcaKeyAreaEncKeyHwBase[nameidx], kNcaKeyAreaKeyIndexStr[1], kKeyIndex[mkeyidx]), mNcaKeyAreaEncryptionKeyHw[1][mkeyidx].key, 0x10);
|
_SAVE_KEYDATA(_CONCAT_3_STRINGS(kNcaKeyAreaEncKeyHwBase[nameidx], kNcaKeyAreaKeyIndexStr[1], kKeyIndex[mkeyidx]), mNcaKeyAreaEncryptionKeyHw[1][mkeyidx].key, 0x10);
|
||||||
_SAVE_KEYDATA(_CONCAT_3_STRINGS(kNcaKeyAreaEncKeyHwBase[nameidx], kNcaKeyAreaKeyIndexStr[2], kKeyIndex[mkeyidx]), mNcaKeyAreaEncryptionKeyHw[2][mkeyidx].key, 0x10);
|
_SAVE_KEYDATA(_CONCAT_3_STRINGS(kNcaKeyAreaEncKeyHwBase[nameidx], kNcaKeyAreaKeyIndexStr[2], kKeyIndex[mkeyidx]), mNcaKeyAreaEncryptionKeyHw[2][mkeyidx].key, 0x10);
|
||||||
}
|
}
|
||||||
|
|
||||||
// store nca header key
|
// store nca header key
|
||||||
_SAVE_KEYDATA(_CONCAT_2_STRINGS(kNcaHeaderBase[nameidx], kKeyStr), mNcaHeaderKey.key[0], 0x20);
|
_SAVE_KEYDATA(_CONCAT_2_STRINGS(kContentArchiveHeaderBase[nameidx], kKeyStr), mContentArchiveHeaderKey.key[0], 0x20);
|
||||||
|
|
||||||
// store xci header key
|
// store xci header key
|
||||||
_SAVE_KEYDATA(_CONCAT_2_STRINGS(kXciHeaderBase[nameidx], kKeyStr), mXciHeaderKey.key, 0x10);
|
_SAVE_KEYDATA(_CONCAT_2_STRINGS(kXciHeaderBase[nameidx], kKeyStr), mXciHeaderKey.key, 0x10);
|
||||||
|
|
||||||
// store rsa keys
|
// store rsa keys
|
||||||
_SAVE_KEYDATA(_CONCAT_2_STRINGS(kNcaHeaderBase[nameidx], kRsaKeyPrivate), mNcaHeader0SignKey.priv_exponent, fnd::rsa::kRsa2048Size);
|
_SAVE_KEYDATA(_CONCAT_2_STRINGS(kContentArchiveHeaderBase[nameidx], kRsaKeyPrivate), mContentArchiveHeader0SignKey.priv_exponent, fnd::rsa::kRsa2048Size);
|
||||||
_SAVE_KEYDATA(_CONCAT_2_STRINGS(kNcaHeaderBase[nameidx], kRsaKeyModulus), mNcaHeader0SignKey.modulus, fnd::rsa::kRsa2048Size);
|
_SAVE_KEYDATA(_CONCAT_2_STRINGS(kContentArchiveHeaderBase[nameidx], kRsaKeyModulus), mContentArchiveHeader0SignKey.modulus, fnd::rsa::kRsa2048Size);
|
||||||
|
|
||||||
_SAVE_KEYDATA(_CONCAT_2_STRINGS(kXciHeaderBase[nameidx], kRsaKeyPrivate), mXciHeaderSignKey.priv_exponent, fnd::rsa::kRsa2048Size);
|
_SAVE_KEYDATA(_CONCAT_2_STRINGS(kXciHeaderBase[nameidx], kRsaKeyPrivate), mXciHeaderSignKey.priv_exponent, fnd::rsa::kRsa2048Size);
|
||||||
_SAVE_KEYDATA(_CONCAT_2_STRINGS(kXciHeaderBase[nameidx], kRsaKeyModulus), mXciHeaderSignKey.modulus, fnd::rsa::kRsa2048Size);
|
_SAVE_KEYDATA(_CONCAT_2_STRINGS(kXciHeaderBase[nameidx], kRsaKeyModulus), mXciHeaderSignKey.modulus, fnd::rsa::kRsa2048Size);
|
||||||
|
|
||||||
_SAVE_KEYDATA(_CONCAT_2_STRINGS(kAcidBase[nameidx], kRsaKeyPrivate), mAcidSignKey.priv_exponent, fnd::rsa::kRsa2048Size);
|
_SAVE_KEYDATA(_CONCAT_2_STRINGS(kAcidBase[nameidx], kRsaKeyPrivate), mAcidSignKey.priv_exponent, fnd::rsa::kRsa2048Size);
|
||||||
_SAVE_KEYDATA(_CONCAT_2_STRINGS(kAcidBase[nameidx], kRsaKeyModulus), mAcidSignKey.modulus, fnd::rsa::kRsa2048Size);
|
_SAVE_KEYDATA(_CONCAT_2_STRINGS(kAcidBase[nameidx], kRsaKeyModulus), mAcidSignKey.modulus, fnd::rsa::kRsa2048Size);
|
||||||
|
|
||||||
_SAVE_KEYDATA(_CONCAT_2_STRINGS(kPkg2Base[nameidx], kRsaKeyPrivate), mPkg2SignKey.priv_exponent, fnd::rsa::kRsa2048Size);
|
_SAVE_KEYDATA(_CONCAT_2_STRINGS(kPkg2Base[nameidx], kRsaKeyPrivate), mPkg2SignKey.priv_exponent, fnd::rsa::kRsa2048Size);
|
||||||
_SAVE_KEYDATA(_CONCAT_2_STRINGS(kPkg2Base[nameidx], kRsaKeyModulus), mPkg2SignKey.modulus, fnd::rsa::kRsa2048Size);
|
_SAVE_KEYDATA(_CONCAT_2_STRINGS(kPkg2Base[nameidx], kRsaKeyModulus), mPkg2SignKey.modulus, fnd::rsa::kRsa2048Size);
|
||||||
|
|
||||||
_SAVE_KEYDATA(_CONCAT_2_STRINGS(kPkiRootBase[nameidx], kRsaKeyPrivate), pki_root_sign_key.priv_exponent, fnd::rsa::kRsa4096Size);
|
_SAVE_KEYDATA(_CONCAT_2_STRINGS(kPkiRootBase[nameidx], kRsaKeyPrivate), pki_root_sign_key.priv_exponent, fnd::rsa::kRsa4096Size);
|
||||||
_SAVE_KEYDATA(_CONCAT_2_STRINGS(kPkiRootBase[nameidx], kRsaKeyModulus), pki_root_sign_key.modulus, fnd::rsa::kRsa4096Size);
|
_SAVE_KEYDATA(_CONCAT_2_STRINGS(kPkiRootBase[nameidx], kRsaKeyModulus), pki_root_sign_key.modulus, fnd::rsa::kRsa4096Size);
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef _SAVE_KEYDATA
|
#undef _SAVE_KEYDATA
|
||||||
#undef _CONCAT_3_STRINGS
|
#undef _CONCAT_3_STRINGS
|
||||||
#undef _CONCAT_2_STRINGS
|
#undef _CONCAT_2_STRINGS
|
||||||
|
|
||||||
// Derive keys
|
// Derive keys
|
||||||
for (size_t i = 0; i < kMasterKeyNum; i++)
|
for (size_t i = 0; i < kMasterKeyNum; i++)
|
||||||
{
|
{
|
||||||
if (master_key[i] != kNullAesKey)
|
if (master_key[i] != kNullAesKey)
|
||||||
{
|
{
|
||||||
if (aes_kek_generation_source != kNullAesKey && aes_key_generation_source != kNullAesKey)
|
if (aes_kek_generation_source != kNullAesKey && aes_key_generation_source != kNullAesKey)
|
||||||
{
|
{
|
||||||
if (i == 0 && nca_header_kek_source != kNullAesKey && nca_header_key_source != kNullAesXtsKey)
|
if (i == 0 && nca_header_kek_source != kNullAesKey && nca_header_key_source != kNullAesXtsKey)
|
||||||
{
|
{
|
||||||
if (mNcaHeaderKey == kNullAesXtsKey)
|
if (mContentArchiveHeaderKey == kNullAesXtsKey)
|
||||||
{
|
{
|
||||||
fnd::aes::sAes128Key nca_header_kek;
|
fnd::aes::sAes128Key nca_header_kek;
|
||||||
nn::hac::AesKeygen::generateKey(nca_header_kek.key, aes_kek_generation_source.key, nca_header_kek_source.key, aes_key_generation_source.key, master_key[i].key);
|
nn::hac::AesKeygen::generateKey(nca_header_kek.key, aes_kek_generation_source.key, nca_header_kek_source.key, aes_key_generation_source.key, master_key[i].key);
|
||||||
nn::hac::AesKeygen::generateKey(mNcaHeaderKey.key[0], nca_header_key_source.key[0], nca_header_kek.key);
|
nn::hac::AesKeygen::generateKey(mContentArchiveHeaderKey.key[0], nca_header_key_source.key[0], nca_header_kek.key);
|
||||||
nn::hac::AesKeygen::generateKey(mNcaHeaderKey.key[1], nca_header_key_source.key[1], nca_header_kek.key);
|
nn::hac::AesKeygen::generateKey(mContentArchiveHeaderKey.key[1], nca_header_key_source.key[1], nca_header_kek.key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (size_t j = 0; j < nn::hac::nca::kKeyAreaEncryptionKeyNum; j++)
|
for (size_t j = 0; j < nn::hac::nca::kKeyAreaEncryptionKeyNum; j++)
|
||||||
{
|
{
|
||||||
if (key_area_key_source[j] != kNullAesKey && mNcaKeyAreaEncryptionKey[j][i] == kNullAesKey)
|
if (key_area_key_source[j] != kNullAesKey && mNcaKeyAreaEncryptionKey[j][i] == kNullAesKey)
|
||||||
{
|
{
|
||||||
nn::hac::AesKeygen::generateKey(mNcaKeyAreaEncryptionKey[j][i].key, aes_kek_generation_source.key, key_area_key_source[j].key, aes_key_generation_source.key, master_key[i].key);
|
nn::hac::AesKeygen::generateKey(mNcaKeyAreaEncryptionKey[j][i].key, aes_kek_generation_source.key, key_area_key_source[j].key, aes_key_generation_source.key, master_key[i].key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ticket_titlekek_source != kNullAesKey && mETicketCommonKey[i] == kNullAesKey)
|
if (ticket_titlekek_source != kNullAesKey && mETicketCommonKey[i] == kNullAesKey)
|
||||||
{
|
{
|
||||||
nn::hac::AesKeygen::generateKey(mETicketCommonKey[i].key, ticket_titlekek_source.key, master_key[i].key);
|
nn::hac::AesKeygen::generateKey(mETicketCommonKey[i].key, ticket_titlekek_source.key, master_key[i].key);
|
||||||
}
|
}
|
||||||
if (package2_key_source != kNullAesKey && mPkg2Key[i] == kNullAesKey)
|
if (package2_key_source != kNullAesKey && mPkg2Key[i] == kNullAesKey)
|
||||||
{
|
{
|
||||||
nn::hac::AesKeygen::generateKey(mPkg2Key[i].key, package2_key_source.key, master_key[i].key);
|
nn::hac::AesKeygen::generateKey(mPkg2Key[i].key, package2_key_source.key, master_key[i].key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// populate pki root keys
|
// populate pki root keys
|
||||||
if (pki_root_sign_key != kNullRsa4096Key)
|
if (pki_root_sign_key != kNullRsa4096Key)
|
||||||
{
|
{
|
||||||
sPkiRootKey tmp;
|
sPkiRootKey tmp;
|
||||||
|
|
||||||
tmp.name = nn::pki::sign::kRootIssuerStr;
|
tmp.name = nn::pki::sign::kRootIssuerStr;
|
||||||
tmp.key_type = nn::pki::sign::SIGN_ALGO_RSA4096;
|
tmp.key_type = nn::pki::sign::SIGN_ALGO_RSA4096;
|
||||||
tmp.rsa4096_key = pki_root_sign_key;
|
tmp.rsa4096_key = pki_root_sign_key;
|
||||||
|
|
||||||
mPkiRootKeyList.addElement(tmp);
|
mPkiRootKeyList.addElement(tmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void KeyConfiguration::clearGeneralKeyConfiguration()
|
void KeyConfiguration::clearGeneralKeyConfiguration()
|
||||||
{
|
{
|
||||||
mAcidSignKey = kNullRsa2048Key;
|
mAcidSignKey = kNullRsa2048Key;
|
||||||
mPkg2SignKey = kNullRsa2048Key;
|
mPkg2SignKey = kNullRsa2048Key;
|
||||||
mNcaHeader0SignKey = kNullRsa2048Key;
|
mContentArchiveHeader0SignKey = kNullRsa2048Key;
|
||||||
mXciHeaderSignKey = kNullRsa2048Key;
|
mXciHeaderSignKey = kNullRsa2048Key;
|
||||||
mPkiRootKeyList.clear();
|
mPkiRootKeyList.clear();
|
||||||
|
|
||||||
mNcaHeaderKey = kNullAesXtsKey;
|
mContentArchiveHeaderKey = kNullAesXtsKey;
|
||||||
mXciHeaderKey = kNullAesKey;
|
mXciHeaderKey = kNullAesKey;
|
||||||
|
|
||||||
for (size_t i = 0; i < kMasterKeyNum; i++)
|
for (size_t i = 0; i < kMasterKeyNum; i++)
|
||||||
{
|
{
|
||||||
mPkg1Key[i] = kNullAesKey;
|
mPkg1Key[i] = kNullAesKey;
|
||||||
mPkg2Key[i] = kNullAesKey;
|
mPkg2Key[i] = kNullAesKey;
|
||||||
mETicketCommonKey[i] = kNullAesKey;
|
mETicketCommonKey[i] = kNullAesKey;
|
||||||
for (size_t j = 0; j < kNcaKeakNum; j++)
|
for (size_t j = 0; j < kNcaKeakNum; j++)
|
||||||
{
|
{
|
||||||
mNcaKeyAreaEncryptionKey[j][i] = kNullAesKey;
|
mNcaKeyAreaEncryptionKey[j][i] = kNullAesKey;
|
||||||
mNcaKeyAreaEncryptionKey[j][i] = kNullAesKey;
|
mNcaKeyAreaEncryptionKey[j][i] = kNullAesKey;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void KeyConfiguration::clearNcaExternalKeys()
|
void KeyConfiguration::clearNcaExternalKeys()
|
||||||
{
|
{
|
||||||
mNcaExternalContentKeyList.clear();
|
mNcaExternalContentKeyList.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool KeyConfiguration::getNcaHeaderKey(fnd::aes::sAesXts128Key& key) const
|
bool KeyConfiguration::getContentArchiveHeaderKey(fnd::aes::sAesXts128Key& key) const
|
||||||
{
|
{
|
||||||
return copyOutKeyResourceIfExists(mNcaHeaderKey, key, kNullAesXtsKey);
|
return copyOutKeyResourceIfExists(mContentArchiveHeaderKey, key, kNullAesXtsKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool KeyConfiguration::getNcaHeader0SignKey(fnd::rsa::sRsa2048Key& key) const
|
bool KeyConfiguration::getContentArchiveHeader0SignKey(fnd::rsa::sRsa2048Key& key) const
|
||||||
{
|
{
|
||||||
return copyOutKeyResourceIfExists(mNcaHeader0SignKey, key, kNullRsa2048Key);
|
return copyOutKeyResourceIfExists(mContentArchiveHeader0SignKey, key, kNullRsa2048Key);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool KeyConfiguration::getAcidSignKey(fnd::rsa::sRsa2048Key& key) const
|
bool KeyConfiguration::getAcidSignKey(fnd::rsa::sRsa2048Key& key) const
|
||||||
{
|
{
|
||||||
return copyOutKeyResourceIfExists(mAcidSignKey, key, kNullRsa2048Key);
|
return copyOutKeyResourceIfExists(mAcidSignKey, key, kNullRsa2048Key);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool KeyConfiguration::getNcaKeyAreaEncryptionKey(byte_t masterkey_index, byte_t keak_type, fnd::aes::sAes128Key& key) const
|
bool KeyConfiguration::getNcaKeyAreaEncryptionKey(byte_t masterkey_index, byte_t keak_type, fnd::aes::sAes128Key& key) const
|
||||||
{
|
{
|
||||||
if (keak_type >= kNcaKeakNum || masterkey_index >= kMasterKeyNum)
|
if (keak_type >= kNcaKeakNum || masterkey_index >= kMasterKeyNum)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return copyOutKeyResourceIfExists(mNcaKeyAreaEncryptionKey[keak_type][masterkey_index], key, kNullAesKey);
|
return copyOutKeyResourceIfExists(mNcaKeyAreaEncryptionKey[keak_type][masterkey_index], key, kNullAesKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool KeyConfiguration::getNcaKeyAreaEncryptionKeyHw(byte_t masterkey_index, byte_t keak_type, fnd::aes::sAes128Key& key) const
|
bool KeyConfiguration::getNcaKeyAreaEncryptionKeyHw(byte_t masterkey_index, byte_t keak_type, fnd::aes::sAes128Key& key) const
|
||||||
{
|
{
|
||||||
if (keak_type >= kNcaKeakNum || masterkey_index >= kMasterKeyNum)
|
if (keak_type >= kNcaKeakNum || masterkey_index >= kMasterKeyNum)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return copyOutKeyResourceIfExists(mNcaKeyAreaEncryptionKeyHw[keak_type][masterkey_index], key, kNullAesKey);
|
return copyOutKeyResourceIfExists(mNcaKeyAreaEncryptionKeyHw[keak_type][masterkey_index], key, kNullAesKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
void KeyConfiguration::addNcaExternalContentKey(const byte_t rights_id[nn::hac::nca::kRightsIdLen], const fnd::aes::sAes128Key& key)
|
void KeyConfiguration::addNcaExternalContentKey(const byte_t rights_id[nn::hac::nca::kRightsIdLen], const fnd::aes::sAes128Key& key)
|
||||||
{
|
{
|
||||||
sNcaExternalContentKey tmp;
|
sNcaExternalContentKey tmp;
|
||||||
memcpy(tmp.rights_id.data, rights_id, nn::hac::nca::kRightsIdLen);
|
memcpy(tmp.rights_id.data, rights_id, nn::hac::nca::kRightsIdLen);
|
||||||
tmp.key = key;
|
tmp.key = key;
|
||||||
|
|
||||||
if (mNcaExternalContentKeyList.hasElement(tmp))
|
if (mNcaExternalContentKeyList.hasElement(tmp))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mNcaExternalContentKeyList.addElement(tmp);
|
mNcaExternalContentKeyList.addElement(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool KeyConfiguration::getNcaExternalContentKey(const byte_t rights_id[nn::hac::nca::kRightsIdLen], fnd::aes::sAes128Key& key) const
|
bool KeyConfiguration::getNcaExternalContentKey(const byte_t rights_id[nn::hac::nca::kRightsIdLen], fnd::aes::sAes128Key& key) const
|
||||||
{
|
{
|
||||||
sRightsId id;
|
sRightsId id;
|
||||||
bool res_exists = false;
|
bool res_exists = false;
|
||||||
|
|
||||||
memcpy(id.data, rights_id, nn::hac::nca::kRightsIdLen);
|
memcpy(id.data, rights_id, nn::hac::nca::kRightsIdLen);
|
||||||
for (size_t i = 0; i < mNcaExternalContentKeyList.size(); i++)
|
for (size_t i = 0; i < mNcaExternalContentKeyList.size(); i++)
|
||||||
{
|
{
|
||||||
if (mNcaExternalContentKeyList[i].rights_id == id)
|
if (mNcaExternalContentKeyList[i].rights_id == id)
|
||||||
{
|
{
|
||||||
res_exists = true;
|
res_exists = true;
|
||||||
key = mNcaExternalContentKeyList[i].key;
|
key = mNcaExternalContentKeyList[i].key;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return res_exists;
|
return res_exists;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool KeyConfiguration::getPkg1Key(byte_t masterkey_index, fnd::aes::sAes128Key& key) const
|
bool KeyConfiguration::getPkg1Key(byte_t masterkey_index, fnd::aes::sAes128Key& key) const
|
||||||
{
|
{
|
||||||
if (masterkey_index >= kMasterKeyNum)
|
if (masterkey_index >= kMasterKeyNum)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return copyOutKeyResourceIfExists(mPkg1Key[masterkey_index], key, kNullAesKey);
|
return copyOutKeyResourceIfExists(mPkg1Key[masterkey_index], key, kNullAesKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool KeyConfiguration::getPkg2Key(byte_t masterkey_index, fnd::aes::sAes128Key& key) const
|
bool KeyConfiguration::getPkg2Key(byte_t masterkey_index, fnd::aes::sAes128Key& key) const
|
||||||
{
|
{
|
||||||
if (masterkey_index >= kMasterKeyNum)
|
if (masterkey_index >= kMasterKeyNum)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return copyOutKeyResourceIfExists(mPkg2Key[masterkey_index], key, kNullAesKey);
|
return copyOutKeyResourceIfExists(mPkg2Key[masterkey_index], key, kNullAesKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool KeyConfiguration::getPkg2SignKey(fnd::rsa::sRsa2048Key& key) const
|
bool KeyConfiguration::getPkg2SignKey(fnd::rsa::sRsa2048Key& key) const
|
||||||
{
|
{
|
||||||
return copyOutKeyResourceIfExists(mPkg2SignKey, key, kNullRsa2048Key);
|
return copyOutKeyResourceIfExists(mPkg2SignKey, key, kNullRsa2048Key);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool KeyConfiguration::getXciHeaderSignKey(fnd::rsa::sRsa2048Key& key) const
|
bool KeyConfiguration::getXciHeaderSignKey(fnd::rsa::sRsa2048Key& key) const
|
||||||
{
|
{
|
||||||
return copyOutKeyResourceIfExists(mXciHeaderSignKey, key, kNullRsa2048Key);
|
return copyOutKeyResourceIfExists(mXciHeaderSignKey, key, kNullRsa2048Key);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool KeyConfiguration::getXciHeaderKey(fnd::aes::sAes128Key& key) const
|
bool KeyConfiguration::getXciHeaderKey(fnd::aes::sAes128Key& key) const
|
||||||
{
|
{
|
||||||
return copyOutKeyResourceIfExists(mXciHeaderKey, key, kNullAesKey);
|
return copyOutKeyResourceIfExists(mXciHeaderKey, key, kNullAesKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool KeyConfiguration::getETicketCommonKey(byte_t masterkey_index, fnd::aes::sAes128Key& key) const
|
bool KeyConfiguration::getETicketCommonKey(byte_t masterkey_index, fnd::aes::sAes128Key& key) const
|
||||||
{
|
{
|
||||||
if (masterkey_index >= kMasterKeyNum)
|
if (masterkey_index >= kMasterKeyNum)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return copyOutKeyResourceIfExists(mETicketCommonKey[masterkey_index], key, kNullAesKey);
|
return copyOutKeyResourceIfExists(mETicketCommonKey[masterkey_index], key, kNullAesKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool KeyConfiguration::getPkiRootSignKey(const std::string& root_name, fnd::rsa::sRsa4096Key& key) const
|
bool KeyConfiguration::getPkiRootSignKey(const std::string& root_name, fnd::rsa::sRsa4096Key& key) const
|
||||||
{
|
{
|
||||||
bool res_exists = false;
|
bool res_exists = false;
|
||||||
for (size_t i = 0; i < mPkiRootKeyList.size(); i++)
|
for (size_t i = 0; i < mPkiRootKeyList.size(); i++)
|
||||||
{
|
{
|
||||||
if (root_name == mPkiRootKeyList[i].name && mPkiRootKeyList[i].key_type == nn::pki::sign::SIGN_ALGO_RSA4096)
|
if (root_name == mPkiRootKeyList[i].name && mPkiRootKeyList[i].key_type == nn::pki::sign::SIGN_ALGO_RSA4096)
|
||||||
{
|
{
|
||||||
res_exists = true;
|
res_exists = true;
|
||||||
key = mPkiRootKeyList[i].rsa4096_key;
|
key = mPkiRootKeyList[i].rsa4096_key;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return res_exists;
|
return res_exists;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool KeyConfiguration::getPkiRootSignKey(const std::string& root_name, fnd::rsa::sRsa2048Key& key) const
|
bool KeyConfiguration::getPkiRootSignKey(const std::string& root_name, fnd::rsa::sRsa2048Key& key) const
|
||||||
{
|
{
|
||||||
bool res_exists = false;
|
bool res_exists = false;
|
||||||
for (size_t i = 0; i < mPkiRootKeyList.size(); i++)
|
for (size_t i = 0; i < mPkiRootKeyList.size(); i++)
|
||||||
{
|
{
|
||||||
if (root_name == mPkiRootKeyList[i].name && mPkiRootKeyList[i].key_type == nn::pki::sign::SIGN_ALGO_RSA2048)
|
if (root_name == mPkiRootKeyList[i].name && mPkiRootKeyList[i].key_type == nn::pki::sign::SIGN_ALGO_RSA2048)
|
||||||
{
|
{
|
||||||
res_exists = true;
|
res_exists = true;
|
||||||
key = mPkiRootKeyList[i].rsa2048_key;
|
key = mPkiRootKeyList[i].rsa2048_key;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return res_exists;
|
return res_exists;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool KeyConfiguration::getPkiRootSignKey(const std::string& root_name, fnd::ecdsa::sEcdsa240Key& key) const
|
bool KeyConfiguration::getPkiRootSignKey(const std::string& root_name, fnd::ecdsa::sEcdsa240Key& key) const
|
||||||
{
|
{
|
||||||
bool res_exists = false;
|
bool res_exists = false;
|
||||||
for (size_t i = 0; i < mPkiRootKeyList.size(); i++)
|
for (size_t i = 0; i < mPkiRootKeyList.size(); i++)
|
||||||
{
|
{
|
||||||
if (root_name == mPkiRootKeyList[i].name && mPkiRootKeyList[i].key_type == nn::pki::sign::SIGN_ALGO_ECDSA240)
|
if (root_name == mPkiRootKeyList[i].name && mPkiRootKeyList[i].key_type == nn::pki::sign::SIGN_ALGO_ECDSA240)
|
||||||
{
|
{
|
||||||
res_exists = true;
|
res_exists = true;
|
||||||
key = mPkiRootKeyList[i].ecdsa240_key;
|
key = mPkiRootKeyList[i].ecdsa240_key;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return res_exists;
|
return res_exists;
|
||||||
}
|
}
|
|
@ -1,209 +1,209 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <fnd/aes.h>
|
#include <fnd/aes.h>
|
||||||
#include <fnd/rsa.h>
|
#include <fnd/rsa.h>
|
||||||
#include <fnd/ecdsa.h>
|
#include <fnd/ecdsa.h>
|
||||||
#include <nn/hac/nca.h>
|
#include <nn/hac/define/nca.h>
|
||||||
#include <nn/pki/SignedData.h>
|
#include <nn/pki/SignedData.h>
|
||||||
#include <nn/es/TicketBody_V2.h>
|
#include <nn/es/TicketBody_V2.h>
|
||||||
|
|
||||||
class KeyConfiguration
|
class KeyConfiguration
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
KeyConfiguration();
|
KeyConfiguration();
|
||||||
KeyConfiguration(const KeyConfiguration& other);
|
KeyConfiguration(const KeyConfiguration& other);
|
||||||
|
|
||||||
void operator=(const KeyConfiguration& other);
|
void operator=(const KeyConfiguration& other);
|
||||||
|
|
||||||
void importHactoolGenericKeyfile(const std::string& path);
|
void importHactoolGenericKeyfile(const std::string& path);
|
||||||
//void importHactoolTitleKeyfile(const std::string& path);
|
//void importHactoolTitleKeyfile(const std::string& path);
|
||||||
|
|
||||||
void clearGeneralKeyConfiguration();
|
void clearGeneralKeyConfiguration();
|
||||||
void clearNcaExternalKeys();
|
void clearNcaExternalKeys();
|
||||||
|
|
||||||
// nca keys
|
// nca keys
|
||||||
bool getNcaHeaderKey(fnd::aes::sAesXts128Key& key) const;
|
bool getContentArchiveHeaderKey(fnd::aes::sAesXts128Key& key) const;
|
||||||
bool getNcaHeader0SignKey(fnd::rsa::sRsa2048Key& key) const;
|
bool getContentArchiveHeader0SignKey(fnd::rsa::sRsa2048Key& key) const;
|
||||||
bool getAcidSignKey(fnd::rsa::sRsa2048Key& key) const;
|
bool getAcidSignKey(fnd::rsa::sRsa2048Key& key) const;
|
||||||
bool getNcaKeyAreaEncryptionKey(byte_t masterkey_index, byte_t keak_type, fnd::aes::sAes128Key& key) const;
|
bool getNcaKeyAreaEncryptionKey(byte_t masterkey_index, byte_t keak_type, fnd::aes::sAes128Key& key) const;
|
||||||
bool getNcaKeyAreaEncryptionKeyHw(byte_t masterkey_index, byte_t keak_type, fnd::aes::sAes128Key& key) const;
|
bool getNcaKeyAreaEncryptionKeyHw(byte_t masterkey_index, byte_t keak_type, fnd::aes::sAes128Key& key) const;
|
||||||
|
|
||||||
// external content keys
|
// external content keys
|
||||||
void addNcaExternalContentKey(const byte_t rights_id[nn::hac::nca::kRightsIdLen], const fnd::aes::sAes128Key& key);
|
void addNcaExternalContentKey(const byte_t rights_id[nn::hac::nca::kRightsIdLen], const fnd::aes::sAes128Key& key);
|
||||||
bool getNcaExternalContentKey(const byte_t rights_id[nn::hac::nca::kRightsIdLen], fnd::aes::sAes128Key& key) const;
|
bool getNcaExternalContentKey(const byte_t rights_id[nn::hac::nca::kRightsIdLen], fnd::aes::sAes128Key& key) const;
|
||||||
|
|
||||||
// pkg1/pkg2
|
// pkg1/pkg2
|
||||||
bool getPkg1Key(byte_t masterkey_index, fnd::aes::sAes128Key& key) const;
|
bool getPkg1Key(byte_t masterkey_index, fnd::aes::sAes128Key& key) const;
|
||||||
bool getPkg2Key(byte_t masterkey_index, fnd::aes::sAes128Key& key) const;
|
bool getPkg2Key(byte_t masterkey_index, fnd::aes::sAes128Key& key) const;
|
||||||
bool getPkg2SignKey(fnd::rsa::sRsa2048Key& key) const;
|
bool getPkg2SignKey(fnd::rsa::sRsa2048Key& key) const;
|
||||||
|
|
||||||
// xci keys
|
// xci keys
|
||||||
bool getXciHeaderSignKey(fnd::rsa::sRsa2048Key& key) const;
|
bool getXciHeaderSignKey(fnd::rsa::sRsa2048Key& key) const;
|
||||||
bool getXciHeaderKey(fnd::aes::sAes128Key& key) const;
|
bool getXciHeaderKey(fnd::aes::sAes128Key& key) const;
|
||||||
|
|
||||||
// ticket
|
// ticket
|
||||||
bool getETicketCommonKey(byte_t masterkey_index, fnd::aes::sAes128Key& key) const;
|
bool getETicketCommonKey(byte_t masterkey_index, fnd::aes::sAes128Key& key) const;
|
||||||
|
|
||||||
// pki
|
// pki
|
||||||
bool getPkiRootSignKey(const std::string& root_name, fnd::rsa::sRsa4096Key& key) const;
|
bool getPkiRootSignKey(const std::string& root_name, fnd::rsa::sRsa4096Key& key) const;
|
||||||
bool getPkiRootSignKey(const std::string& root_name, fnd::rsa::sRsa2048Key& key) const;
|
bool getPkiRootSignKey(const std::string& root_name, fnd::rsa::sRsa2048Key& key) const;
|
||||||
bool getPkiRootSignKey(const std::string& root_name, fnd::ecdsa::sEcdsa240Key& key) const;
|
bool getPkiRootSignKey(const std::string& root_name, fnd::ecdsa::sEcdsa240Key& key) const;
|
||||||
private:
|
private:
|
||||||
const std::string kModuleName = "KeyConfiguration";
|
const std::string kModuleName = "KeyConfiguration";
|
||||||
const fnd::aes::sAes128Key kNullAesKey = {{0}};
|
const fnd::aes::sAes128Key kNullAesKey = {{0}};
|
||||||
const fnd::aes::sAesXts128Key kNullAesXtsKey = {{{0}}};
|
const fnd::aes::sAesXts128Key kNullAesXtsKey = {{{0}}};
|
||||||
const fnd::rsa::sRsa4096Key kNullRsa4096Key = {{0}, {0}, {0}};
|
const fnd::rsa::sRsa4096Key kNullRsa4096Key = {{0}, {0}, {0}};
|
||||||
const fnd::rsa::sRsa2048Key kNullRsa2048Key = {{0}, {0}, {0}};
|
const fnd::rsa::sRsa2048Key kNullRsa2048Key = {{0}, {0}, {0}};
|
||||||
static const size_t kMasterKeyNum = 0x20;
|
static const size_t kMasterKeyNum = 0x20;
|
||||||
static const size_t kNcaKeakNum = nn::hac::nca::kKeyAreaEncryptionKeyNum;
|
static const size_t kNcaKeakNum = nn::hac::nca::kKeyAreaEncryptionKeyNum;
|
||||||
|
|
||||||
// keynames
|
// keynames
|
||||||
enum NameVariantIndex
|
enum NameVariantIndex
|
||||||
{
|
{
|
||||||
NNTOOLS,
|
NNTOOLS,
|
||||||
LEGACY_HACTOOL,
|
LEGACY_HACTOOL,
|
||||||
LEGACY_0
|
LEGACY_0
|
||||||
};
|
};
|
||||||
static const size_t kNameVariantNum = 3;
|
static const size_t kNameVariantNum = 3;
|
||||||
const std::string kMasterBase[kNameVariantNum] = { "master", "master", "master" };
|
const std::string kMasterBase[kNameVariantNum] = { "master", "master", "master" };
|
||||||
const std::string kPkg1Base[kNameVariantNum] = { "package1", "package1", "package1" };
|
const std::string kPkg1Base[kNameVariantNum] = { "package1", "package1", "package1" };
|
||||||
const std::string kPkg2Base[kNameVariantNum] = { "package2", "package2", "package2" };
|
const std::string kPkg2Base[kNameVariantNum] = { "package2", "package2", "package2" };
|
||||||
const std::string kXciHeaderBase[kNameVariantNum] = { "xci_header", "xci_header", "xci_header" };
|
const std::string kXciHeaderBase[kNameVariantNum] = { "xci_header", "xci_header", "xci_header" };
|
||||||
const std::string kNcaHeaderBase[kNameVariantNum] = { "nca_header", "header", "nca_header" };
|
const std::string kContentArchiveHeaderBase[kNameVariantNum] = { "nca_header", "header", "nca_header" };
|
||||||
const std::string kAcidBase[kNameVariantNum] = { "acid", "acid", "acid" };
|
const std::string kAcidBase[kNameVariantNum] = { "acid", "acid", "acid" };
|
||||||
const std::string kPkiRootBase[kNameVariantNum] = { "pki_root", "pki_root", "pki_root" };
|
const std::string kPkiRootBase[kNameVariantNum] = { "pki_root", "pki_root", "pki_root" };
|
||||||
const std::string kTicketCommonKeyBase[kNameVariantNum] = { "ticket_commonkey", "titlekek", "ticket_commonkey" };
|
const std::string kTicketCommonKeyBase[kNameVariantNum] = { "ticket_commonkey", "titlekek", "ticket_commonkey" };
|
||||||
const std::string kNcaKeyAreaEncKeyBase[kNameVariantNum] = { "nca_key_area_key", "key_area_key", "nca_body_keak" };
|
const std::string kNcaKeyAreaEncKeyBase[kNameVariantNum] = { "nca_key_area_key", "key_area_key", "nca_body_keak" };
|
||||||
const std::string kNcaKeyAreaEncKeyHwBase[kNameVariantNum] = { "nca_key_area_key_hw", "key_area_hw_key", "nca_key_area_key_hw" };
|
const std::string kNcaKeyAreaEncKeyHwBase[kNameVariantNum] = { "nca_key_area_key_hw", "key_area_hw_key", "nca_key_area_key_hw" };
|
||||||
const std::string kKekGenBase[kNameVariantNum] = { "aes_kek_generation", "aes_kek_generation", "aes_kek_generation" };
|
const std::string kKekGenBase[kNameVariantNum] = { "aes_kek_generation", "aes_kek_generation", "aes_kek_generation" };
|
||||||
const std::string kKeyGenBase[kNameVariantNum] = { "aes_key_generation", "aes_key_generation", "aes_key_generation" };
|
const std::string kKeyGenBase[kNameVariantNum] = { "aes_key_generation", "aes_key_generation", "aes_key_generation" };
|
||||||
|
|
||||||
// misc str
|
// misc str
|
||||||
const std::string kKeyStr = "key";
|
const std::string kKeyStr = "key";
|
||||||
const std::string kKekStr = "kek";
|
const std::string kKekStr = "kek";
|
||||||
const std::string kSourceStr = "source";
|
const std::string kSourceStr = "source";
|
||||||
const std::string kRsaKeyModulus = "sign_key_modulus";
|
const std::string kRsaKeyModulus = "sign_key_modulus";
|
||||||
const std::string kRsaKeyPrivate = "sign_key_private";
|
const std::string kRsaKeyPrivate = "sign_key_private";
|
||||||
const std::string kNcaKeyAreaKeyIndexStr[kNcaKeakNum] = { "application", "ocean", "system" };
|
const std::string kNcaKeyAreaKeyIndexStr[kNcaKeakNum] = { "application", "ocean", "system" };
|
||||||
const std::string kKeyIndex[kMasterKeyNum] = {"00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f"};
|
const std::string kKeyIndex[kMasterKeyNum] = {"00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f"};
|
||||||
|
|
||||||
struct sRightsId
|
struct sRightsId
|
||||||
{
|
{
|
||||||
byte_t data[nn::hac::nca::kRightsIdLen];
|
byte_t data[nn::hac::nca::kRightsIdLen];
|
||||||
|
|
||||||
void operator=(const sRightsId& other)
|
void operator=(const sRightsId& other)
|
||||||
{
|
{
|
||||||
memcpy(this->data, other.data, nn::hac::nca::kRightsIdLen);
|
memcpy(this->data, other.data, nn::hac::nca::kRightsIdLen);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator==(const sRightsId& other) const
|
bool operator==(const sRightsId& other) const
|
||||||
{
|
{
|
||||||
return memcmp(this->data, other.data, nn::hac::nca::kRightsIdLen) == 0;
|
return memcmp(this->data, other.data, nn::hac::nca::kRightsIdLen) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=(const sRightsId& other) const
|
bool operator!=(const sRightsId& other) const
|
||||||
{
|
{
|
||||||
return !(operator==(other));
|
return !(operator==(other));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sNcaExternalContentKey
|
struct sNcaExternalContentKey
|
||||||
{
|
{
|
||||||
sRightsId rights_id;
|
sRightsId rights_id;
|
||||||
fnd::aes::sAes128Key key;
|
fnd::aes::sAes128Key key;
|
||||||
|
|
||||||
void operator=(const sNcaExternalContentKey& other)
|
void operator=(const sNcaExternalContentKey& other)
|
||||||
{
|
{
|
||||||
rights_id = other.rights_id;
|
rights_id = other.rights_id;
|
||||||
key = other.key;
|
key = other.key;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator==(const sNcaExternalContentKey& other) const
|
bool operator==(const sNcaExternalContentKey& other) const
|
||||||
{
|
{
|
||||||
return (rights_id == other.rights_id) \
|
return (rights_id == other.rights_id) \
|
||||||
&& (key == other.key);
|
&& (key == other.key);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=(const sNcaExternalContentKey& other) const
|
bool operator!=(const sNcaExternalContentKey& other) const
|
||||||
{
|
{
|
||||||
return !(operator==(other));
|
return !(operator==(other));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sPkiRootKey
|
struct sPkiRootKey
|
||||||
{
|
{
|
||||||
std::string name;
|
std::string name;
|
||||||
nn::pki::sign::SignatureAlgo key_type;
|
nn::pki::sign::SignatureAlgo key_type;
|
||||||
fnd::rsa::sRsa4096Key rsa4096_key;
|
fnd::rsa::sRsa4096Key rsa4096_key;
|
||||||
fnd::rsa::sRsa2048Key rsa2048_key;
|
fnd::rsa::sRsa2048Key rsa2048_key;
|
||||||
fnd::ecdsa::sEcdsa240Key ecdsa240_key;
|
fnd::ecdsa::sEcdsa240Key ecdsa240_key;
|
||||||
|
|
||||||
void operator=(const sPkiRootKey& other)
|
void operator=(const sPkiRootKey& other)
|
||||||
{
|
{
|
||||||
name = other.name;
|
name = other.name;
|
||||||
key_type = other.key_type;
|
key_type = other.key_type;
|
||||||
rsa4096_key = other.rsa4096_key;
|
rsa4096_key = other.rsa4096_key;
|
||||||
rsa2048_key = other.rsa2048_key;
|
rsa2048_key = other.rsa2048_key;
|
||||||
ecdsa240_key = other.ecdsa240_key;
|
ecdsa240_key = other.ecdsa240_key;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator==(const sPkiRootKey& other) const
|
bool operator==(const sPkiRootKey& other) const
|
||||||
{
|
{
|
||||||
return (name == other.name) \
|
return (name == other.name) \
|
||||||
&& (key_type == other.key_type) \
|
&& (key_type == other.key_type) \
|
||||||
&& (rsa4096_key == other.rsa4096_key) \
|
&& (rsa4096_key == other.rsa4096_key) \
|
||||||
&& (rsa2048_key == other.rsa2048_key) \
|
&& (rsa2048_key == other.rsa2048_key) \
|
||||||
&& (ecdsa240_key == other.ecdsa240_key);
|
&& (ecdsa240_key == other.ecdsa240_key);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=(const sPkiRootKey& other) const
|
bool operator!=(const sPkiRootKey& other) const
|
||||||
{
|
{
|
||||||
return !(operator==(other));
|
return !(operator==(other));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* general key config */
|
/* general key config */
|
||||||
// acid
|
// acid
|
||||||
fnd::rsa::sRsa2048Key mAcidSignKey;
|
fnd::rsa::sRsa2048Key mAcidSignKey;
|
||||||
|
|
||||||
// pkg1 and pkg2
|
// pkg1 and pkg2
|
||||||
fnd::aes::sAes128Key mPkg1Key[kMasterKeyNum];
|
fnd::aes::sAes128Key mPkg1Key[kMasterKeyNum];
|
||||||
fnd::rsa::sRsa2048Key mPkg2SignKey;
|
fnd::rsa::sRsa2048Key mPkg2SignKey;
|
||||||
fnd::aes::sAes128Key mPkg2Key[kMasterKeyNum];
|
fnd::aes::sAes128Key mPkg2Key[kMasterKeyNum];
|
||||||
|
|
||||||
// nca
|
// nca
|
||||||
fnd::rsa::sRsa2048Key mNcaHeader0SignKey;
|
fnd::rsa::sRsa2048Key mContentArchiveHeader0SignKey;
|
||||||
fnd::aes::sAesXts128Key mNcaHeaderKey;
|
fnd::aes::sAesXts128Key mContentArchiveHeaderKey;
|
||||||
fnd::aes::sAes128Key mNcaKeyAreaEncryptionKey[kNcaKeakNum][kMasterKeyNum];
|
fnd::aes::sAes128Key mNcaKeyAreaEncryptionKey[kNcaKeakNum][kMasterKeyNum];
|
||||||
fnd::aes::sAes128Key mNcaKeyAreaEncryptionKeyHw[kNcaKeakNum][kMasterKeyNum];
|
fnd::aes::sAes128Key mNcaKeyAreaEncryptionKeyHw[kNcaKeakNum][kMasterKeyNum];
|
||||||
|
|
||||||
// xci
|
// xci
|
||||||
fnd::rsa::sRsa2048Key mXciHeaderSignKey;
|
fnd::rsa::sRsa2048Key mXciHeaderSignKey;
|
||||||
fnd::aes::sAes128Key mXciHeaderKey;
|
fnd::aes::sAes128Key mXciHeaderKey;
|
||||||
|
|
||||||
// ticket
|
// ticket
|
||||||
fnd::aes::sAes128Key mETicketCommonKey[kMasterKeyNum];
|
fnd::aes::sAes128Key mETicketCommonKey[kMasterKeyNum];
|
||||||
|
|
||||||
// pki
|
// pki
|
||||||
fnd::List<sPkiRootKey> mPkiRootKeyList;
|
fnd::List<sPkiRootKey> mPkiRootKeyList;
|
||||||
|
|
||||||
/* Nca External Keys */
|
/* Nca External Keys */
|
||||||
fnd::List<sNcaExternalContentKey> mNcaExternalContentKeyList;
|
fnd::List<sNcaExternalContentKey> mNcaExternalContentKeyList;
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
bool copyOutKeyResourceIfExists(const T& src, T& dst, const T& null_sample) const
|
bool copyOutKeyResourceIfExists(const T& src, T& dst, const T& null_sample) const
|
||||||
{
|
{
|
||||||
bool resource_exists = false;
|
bool resource_exists = false;
|
||||||
|
|
||||||
if (src != null_sample)
|
if (src != null_sample)
|
||||||
{
|
{
|
||||||
resource_exists = true;
|
resource_exists = true;
|
||||||
dst = src;
|
dst = src;
|
||||||
}
|
}
|
||||||
|
|
||||||
return resource_exists;
|
return resource_exists;
|
||||||
}
|
}
|
||||||
};
|
};
|
File diff suppressed because it is too large
Load diff
|
@ -1,56 +1,56 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <fnd/IFile.h>
|
#include <fnd/IFile.h>
|
||||||
#include <fnd/SharedPtr.h>
|
#include <fnd/SharedPtr.h>
|
||||||
#include <nn/hac/MetaBinary.h>
|
#include <nn/hac/Meta.h>
|
||||||
#include "KeyConfiguration.h"
|
#include "KeyConfiguration.h"
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
class MetaProcess
|
class MetaProcess
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MetaProcess();
|
MetaProcess();
|
||||||
|
|
||||||
void process();
|
void process();
|
||||||
|
|
||||||
void setInputFile(const fnd::SharedPtr<fnd::IFile>& file);
|
void setInputFile(const fnd::SharedPtr<fnd::IFile>& file);
|
||||||
void setKeyCfg(const KeyConfiguration& keycfg);
|
void setKeyCfg(const KeyConfiguration& keycfg);
|
||||||
void setCliOutputMode(CliOutputMode type);
|
void setCliOutputMode(CliOutputMode type);
|
||||||
void setVerifyMode(bool verify);
|
void setVerifyMode(bool verify);
|
||||||
|
|
||||||
const nn::hac::MetaBinary& getMetaBinary() const;
|
const nn::hac::Meta& getMeta() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const std::string kModuleName = "MetaProcess";
|
const std::string kModuleName = "MetaProcess";
|
||||||
|
|
||||||
fnd::SharedPtr<fnd::IFile> mFile;
|
fnd::SharedPtr<fnd::IFile> mFile;
|
||||||
KeyConfiguration mKeyCfg;
|
KeyConfiguration mKeyCfg;
|
||||||
CliOutputMode mCliOutputMode;
|
CliOutputMode mCliOutputMode;
|
||||||
bool mVerify;
|
bool mVerify;
|
||||||
|
|
||||||
nn::hac::MetaBinary mMeta;
|
nn::hac::Meta mMeta;
|
||||||
|
|
||||||
void importMeta();
|
void importMeta();
|
||||||
|
|
||||||
void validateAcidSignature(const nn::hac::AccessControlInfoDescBinary& acid);
|
void validateAcidSignature(const nn::hac::AccessControlInfoDesc& acid);
|
||||||
void validateAciFromAcid(const nn::hac::AccessControlInfoBinary& aci, const nn::hac::AccessControlInfoDescBinary& acid);
|
void validateAciFromAcid(const nn::hac::AccessControlInfo& aci, const nn::hac::AccessControlInfoDesc& acid);
|
||||||
|
|
||||||
void displayMetaHeader(const nn::hac::MetaBinary& hdr);
|
void displayMetaHeader(const nn::hac::Meta& hdr);
|
||||||
void displayAciHdr(const nn::hac::AccessControlInfoBinary& aci);
|
void displayAciHdr(const nn::hac::AccessControlInfo& aci);
|
||||||
void displayAciDescHdr(const nn::hac::AccessControlInfoDescBinary& aci);
|
void displayAciDescHdr(const nn::hac::AccessControlInfoDesc& aci);
|
||||||
void displayFac(const nn::hac::FileSystemAccessControlBinary& fac);
|
void displayFac(const nn::hac::FileSystemAccessControl& fac);
|
||||||
void displaySac(const nn::hac::ServiceAccessControlBinary& sac);
|
void displaySac(const nn::hac::ServiceAccessControl& sac);
|
||||||
void displayKernelCap(const nn::hac::KernelCapabilityBinary& kern);
|
void displayKernelCap(const nn::hac::KernelCapabilityControl& kern);
|
||||||
|
|
||||||
const char* getInstructionTypeStr(nn::hac::meta::InstructionType type) const;
|
const char* getInstructionTypeStr(nn::hac::meta::InstructionType type) const;
|
||||||
const char* getProcAddressSpaceTypeStr(nn::hac::meta::ProcAddrSpaceType type) const;
|
const char* getProcAddressSpaceTypeStr(nn::hac::meta::ProcAddrSpaceType type) const;
|
||||||
const char* getAcidFlagStr(nn::hac::aci::Flag flag) const;
|
const char* getAcidFlagStr(nn::hac::aci::Flag flag) const;
|
||||||
const char* getMiscFlagStr(nn::hac::MiscFlagsHandler::Flags flag) const;
|
const char* getMiscFlagStr(nn::hac::MiscFlagsHandler::Flags flag) const;
|
||||||
const char* getFsaRightStr(nn::hac::fac::FsAccessFlag flag) const;
|
const char* getFsaRightStr(nn::hac::fac::FsAccessFlag flag) const;
|
||||||
const char* getSaveDataOwnerAccessModeStr(nn::hac::fac::SaveDataOwnerIdAccessType type) const;
|
const char* getSaveDataOwnerAccessModeStr(nn::hac::fac::SaveDataOwnerIdAccessType type) const;
|
||||||
const char* getSystemCallStr(byte_t syscall_id) const;
|
const char* getSystemCallStr(byte_t syscall_id) const;
|
||||||
const char* getMemMapPermStr(nn::hac::MemoryMappingHandler::MemoryPerm type) const;
|
const char* getMemMapPermStr(nn::hac::MemoryMappingHandler::MemoryPerm type) const;
|
||||||
const char* getMemMapTypeStr(nn::hac::MemoryMappingHandler::MappingType type) const;
|
const char* getMemMapTypeStr(nn::hac::MemoryMappingHandler::MappingType type) const;
|
||||||
};
|
};
|
File diff suppressed because it is too large
Load diff
|
@ -1,53 +1,53 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <fnd/IFile.h>
|
#include <fnd/IFile.h>
|
||||||
#include <fnd/SharedPtr.h>
|
#include <fnd/SharedPtr.h>
|
||||||
#include <nn/hac/ApplicationControlPropertyBinary.h>
|
#include <nn/hac/ApplicationControlProperty.h>
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
class NacpProcess
|
class NacpProcess
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
NacpProcess();
|
NacpProcess();
|
||||||
|
|
||||||
void process();
|
void process();
|
||||||
|
|
||||||
void setInputFile(const fnd::SharedPtr<fnd::IFile>& file);
|
void setInputFile(const fnd::SharedPtr<fnd::IFile>& file);
|
||||||
void setCliOutputMode(CliOutputMode type);
|
void setCliOutputMode(CliOutputMode type);
|
||||||
void setVerifyMode(bool verify);
|
void setVerifyMode(bool verify);
|
||||||
|
|
||||||
const nn::hac::ApplicationControlPropertyBinary& getApplicationControlPropertyBinary() const;
|
const nn::hac::ApplicationControlProperty& getApplicationControlProperty() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const std::string kModuleName = "NacpProcess";
|
const std::string kModuleName = "NacpProcess";
|
||||||
|
|
||||||
fnd::SharedPtr<fnd::IFile> mFile;
|
fnd::SharedPtr<fnd::IFile> mFile;
|
||||||
CliOutputMode mCliOutputMode;
|
CliOutputMode mCliOutputMode;
|
||||||
bool mVerify;
|
bool mVerify;
|
||||||
|
|
||||||
nn::hac::ApplicationControlPropertyBinary mNacp;
|
nn::hac::ApplicationControlProperty mNacp;
|
||||||
|
|
||||||
void importNacp();
|
void importNacp();
|
||||||
void displayNacp();
|
void displayNacp();
|
||||||
const char* getLanguageStr(nn::hac::nacp::Language var) const;
|
const char* getLanguageStr(nn::hac::nacp::Language var) const;
|
||||||
const char* getStartupUserAccountStr(nn::hac::nacp::StartupUserAccount var) const;
|
const char* getStartupUserAccountStr(nn::hac::nacp::StartupUserAccount var) const;
|
||||||
const char* getTouchScreenUsageModeStr(nn::hac::nacp::TouchScreenUsageMode var) const;
|
const char* getTouchScreenUsageModeStr(nn::hac::nacp::TouchScreenUsageMode var) const;
|
||||||
const char* getAocRegistrationTypeStr(nn::hac::nacp::AocRegistrationType var) const;
|
const char* getAocRegistrationTypeStr(nn::hac::nacp::AocRegistrationType var) const;
|
||||||
const char* getAttributeFlagStr(nn::hac::nacp::AttributeFlag var) const;
|
const char* getAttributeFlagStr(nn::hac::nacp::AttributeFlag var) const;
|
||||||
const char* getParentalControlFlagStr(nn::hac::nacp::ParentalControlFlag var) const;
|
const char* getParentalControlFlagStr(nn::hac::nacp::ParentalControlFlag var) const;
|
||||||
const char* getScreenshotModeStr(nn::hac::nacp::ScreenshotMode var) const;
|
const char* getScreenshotModeStr(nn::hac::nacp::ScreenshotMode var) const;
|
||||||
const char* getVideoCaptureModeStr(nn::hac::nacp::VideoCaptureMode var) const;
|
const char* getVideoCaptureModeStr(nn::hac::nacp::VideoCaptureMode var) const;
|
||||||
const char* getDataLossConfirmationStr(nn::hac::nacp::DataLossConfirmation var) const;
|
const char* getDataLossConfirmationStr(nn::hac::nacp::DataLossConfirmation var) const;
|
||||||
const char* getPlayLogPolicyStr(nn::hac::nacp::PlayLogPolicy var) const;
|
const char* getPlayLogPolicyStr(nn::hac::nacp::PlayLogPolicy var) const;
|
||||||
const char* getOrganisationStr(nn::hac::nacp::Organisation var) const;
|
const char* getOrganisationStr(nn::hac::nacp::Organisation var) const;
|
||||||
const char* getLogoTypeStr(nn::hac::nacp::LogoType var) const;
|
const char* getLogoTypeStr(nn::hac::nacp::LogoType var) const;
|
||||||
const char* getLogoHandlingStr(nn::hac::nacp::LogoHandling var) const;
|
const char* getLogoHandlingStr(nn::hac::nacp::LogoHandling var) const;
|
||||||
const char* getRuntimeAocInstallModeStr(nn::hac::nacp::RuntimeAocInstallMode var) const;
|
const char* getRuntimeAocInstallModeStr(nn::hac::nacp::RuntimeAocInstallMode var) const;
|
||||||
const char* getCrashReportModeStr(nn::hac::nacp::CrashReportMode var) const;
|
const char* getCrashReportModeStr(nn::hac::nacp::CrashReportMode var) const;
|
||||||
const char* getHdcpStr(nn::hac::nacp::Hdcp var) const;
|
const char* getHdcpStr(nn::hac::nacp::Hdcp var) const;
|
||||||
const char* getPlayLogQueryCapabilityStr(nn::hac::nacp::PlayLogQueryCapability var) const;
|
const char* getPlayLogQueryCapabilityStr(nn::hac::nacp::PlayLogQueryCapability var) const;
|
||||||
const char* getRepairFlagStr(nn::hac::nacp::RepairFlag var) const;
|
const char* getRepairFlagStr(nn::hac::nacp::RepairFlag var) const;
|
||||||
std::string getSaveDataSizeStr(int64_t size) const;
|
std::string getSaveDataSizeStr(int64_t size) const;
|
||||||
};
|
};
|
File diff suppressed because it is too large
Load diff
|
@ -1,123 +1,123 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <fnd/types.h>
|
#include <fnd/types.h>
|
||||||
#include <fnd/IFile.h>
|
#include <fnd/IFile.h>
|
||||||
#include <fnd/SharedPtr.h>
|
#include <fnd/SharedPtr.h>
|
||||||
#include <fnd/LayeredIntegrityMetadata.h>
|
#include <fnd/LayeredIntegrityMetadata.h>
|
||||||
#include <nn/hac/NcaHeader.h>
|
#include <nn/hac/ContentArchiveHeader.h>
|
||||||
#include "KeyConfiguration.h"
|
#include "KeyConfiguration.h"
|
||||||
|
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
class NcaProcess
|
class NcaProcess
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
NcaProcess();
|
NcaProcess();
|
||||||
|
|
||||||
void process();
|
void process();
|
||||||
|
|
||||||
// generic
|
// generic
|
||||||
void setInputFile(const fnd::SharedPtr<fnd::IFile>& file);
|
void setInputFile(const fnd::SharedPtr<fnd::IFile>& file);
|
||||||
void setKeyCfg(const KeyConfiguration& keycfg);
|
void setKeyCfg(const KeyConfiguration& keycfg);
|
||||||
void setCliOutputMode(CliOutputMode type);
|
void setCliOutputMode(CliOutputMode type);
|
||||||
void setVerifyMode(bool verify);
|
void setVerifyMode(bool verify);
|
||||||
|
|
||||||
// nca specfic
|
// nca specfic
|
||||||
void setPartition0ExtractPath(const std::string& path);
|
void setPartition0ExtractPath(const std::string& path);
|
||||||
void setPartition1ExtractPath(const std::string& path);
|
void setPartition1ExtractPath(const std::string& path);
|
||||||
void setPartition2ExtractPath(const std::string& path);
|
void setPartition2ExtractPath(const std::string& path);
|
||||||
void setPartition3ExtractPath(const std::string& path);
|
void setPartition3ExtractPath(const std::string& path);
|
||||||
void setListFs(bool list_fs);
|
void setListFs(bool list_fs);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const std::string kModuleName = "NcaProcess";
|
const std::string kModuleName = "NcaProcess";
|
||||||
const std::string kNpdmExefsPath = "main.npdm";
|
const std::string kNpdmExefsPath = "main.npdm";
|
||||||
|
|
||||||
// user options
|
// user options
|
||||||
fnd::SharedPtr<fnd::IFile> mFile;
|
fnd::SharedPtr<fnd::IFile> mFile;
|
||||||
KeyConfiguration mKeyCfg;
|
KeyConfiguration mKeyCfg;
|
||||||
CliOutputMode mCliOutputMode;
|
CliOutputMode mCliOutputMode;
|
||||||
bool mVerify;
|
bool mVerify;
|
||||||
|
|
||||||
struct sExtract
|
struct sExtract
|
||||||
{
|
{
|
||||||
std::string path;
|
std::string path;
|
||||||
bool doExtract;
|
bool doExtract;
|
||||||
} mPartitionPath[nn::hac::nca::kPartitionNum];
|
} mPartitionPath[nn::hac::nca::kPartitionNum];
|
||||||
|
|
||||||
bool mListFs;
|
bool mListFs;
|
||||||
|
|
||||||
// data
|
// data
|
||||||
nn::hac::sNcaHeaderBlock mHdrBlock;
|
nn::hac::sContentArchiveHeaderBlock mHdrBlock;
|
||||||
fnd::sha::sSha256Hash mHdrHash;
|
fnd::sha::sSha256Hash mHdrHash;
|
||||||
nn::hac::NcaHeader mHdr;
|
nn::hac::ContentArchiveHeader mHdr;
|
||||||
|
|
||||||
// crypto
|
// crypto
|
||||||
struct sKeys
|
struct sKeys
|
||||||
{
|
{
|
||||||
struct sKeyAreaKey
|
struct sKeyAreaKey
|
||||||
{
|
{
|
||||||
byte_t index;
|
byte_t index;
|
||||||
bool decrypted;
|
bool decrypted;
|
||||||
fnd::aes::sAes128Key enc;
|
fnd::aes::sAes128Key enc;
|
||||||
fnd::aes::sAes128Key dec;
|
fnd::aes::sAes128Key dec;
|
||||||
|
|
||||||
void operator=(const sKeyAreaKey& other)
|
void operator=(const sKeyAreaKey& other)
|
||||||
{
|
{
|
||||||
index = other.index;
|
index = other.index;
|
||||||
decrypted = other.decrypted;
|
decrypted = other.decrypted;
|
||||||
enc = other.enc;
|
enc = other.enc;
|
||||||
dec = other.dec;
|
dec = other.dec;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator==(const sKeyAreaKey& other) const
|
bool operator==(const sKeyAreaKey& other) const
|
||||||
{
|
{
|
||||||
return (index == other.index) \
|
return (index == other.index) \
|
||||||
&& (decrypted == other.decrypted) \
|
&& (decrypted == other.decrypted) \
|
||||||
&& (enc == other.enc) \
|
&& (enc == other.enc) \
|
||||||
&& (dec == other.dec);
|
&& (dec == other.dec);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=(const sKeyAreaKey& other) const
|
bool operator!=(const sKeyAreaKey& other) const
|
||||||
{
|
{
|
||||||
return !(*this == other);
|
return !(*this == other);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
fnd::List<sKeyAreaKey> kak_list;
|
fnd::List<sKeyAreaKey> kak_list;
|
||||||
|
|
||||||
sOptional<fnd::aes::sAes128Key> aes_ctr;
|
sOptional<fnd::aes::sAes128Key> aes_ctr;
|
||||||
} mContentKey;
|
} mContentKey;
|
||||||
|
|
||||||
struct sPartitionInfo
|
struct sPartitionInfo
|
||||||
{
|
{
|
||||||
fnd::SharedPtr<fnd::IFile> reader;
|
fnd::SharedPtr<fnd::IFile> reader;
|
||||||
std::string fail_reason;
|
std::string fail_reason;
|
||||||
size_t offset;
|
size_t offset;
|
||||||
size_t size;
|
size_t size;
|
||||||
|
|
||||||
// meta data
|
// meta data
|
||||||
nn::hac::nca::FormatType format_type;
|
nn::hac::nca::FormatType format_type;
|
||||||
nn::hac::nca::HashType hash_type;
|
nn::hac::nca::HashType hash_type;
|
||||||
nn::hac::nca::EncryptionType enc_type;
|
nn::hac::nca::EncryptionType enc_type;
|
||||||
fnd::LayeredIntegrityMetadata layered_intergrity_metadata;
|
fnd::LayeredIntegrityMetadata layered_intergrity_metadata;
|
||||||
fnd::aes::sAesIvCtr aes_ctr;
|
fnd::aes::sAesIvCtr aes_ctr;
|
||||||
} mPartitions[nn::hac::nca::kPartitionNum];
|
} mPartitions[nn::hac::nca::kPartitionNum];
|
||||||
|
|
||||||
void importHeader();
|
void importHeader();
|
||||||
void generateNcaBodyEncryptionKeys();
|
void generateNcaBodyEncryptionKeys();
|
||||||
void generatePartitionConfiguration();
|
void generatePartitionConfiguration();
|
||||||
void validateNcaSignatures();
|
void validateNcaSignatures();
|
||||||
void displayHeader();
|
void displayHeader();
|
||||||
void processPartitions();
|
void processPartitions();
|
||||||
|
|
||||||
const char* getFormatVersionStr(nn::hac::NcaHeader::FormatVersion format_ver) const;
|
const char* getFormatVersionStr(byte_t format_ver) const;
|
||||||
const char* getDistributionTypeStr(nn::hac::nca::DistributionType dist_type) const;
|
const char* getDistributionTypeStr(nn::hac::nca::DistributionType dist_type) const;
|
||||||
const char* getContentTypeStr(nn::hac::nca::ContentType cont_type) const;
|
const char* getContentTypeStr(nn::hac::nca::ContentType cont_type) const;
|
||||||
const char* getEncryptionTypeStr(nn::hac::nca::EncryptionType enc_type) const;
|
const char* getEncryptionTypeStr(nn::hac::nca::EncryptionType enc_type) const;
|
||||||
const char* getHashTypeStr(nn::hac::nca::HashType hash_type) const;
|
const char* getHashTypeStr(nn::hac::nca::HashType hash_type) const;
|
||||||
const char* getFormatTypeStr(nn::hac::nca::FormatType format_type) const;
|
const char* getFormatTypeStr(nn::hac::nca::FormatType format_type) const;
|
||||||
const char* getKaekIndexStr(nn::hac::nca::KeyAreaEncryptionKeyIndex keak_index) const;
|
const char* getKaekIndexStr(nn::hac::nca::KeyAreaEncryptionKeyIndex keak_index) const;
|
||||||
const char* getContentTypeForMountStr(nn::hac::nca::ContentType cont_type) const;
|
const char* getContentTypeForMountStr(nn::hac::nca::ContentType cont_type) const;
|
||||||
const char* getProgramPartitionNameStr(size_t i) const;
|
const char* getProgramPartitionNameStr(size_t i) const;
|
||||||
};
|
};
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue