mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-13 22:54:24 -04:00
fusee_cpp: add logic for loading mtc overlays
This commit is contained in:
parent
4480e7a8a5
commit
3bcdd0c3c8
157 changed files with 2222 additions and 47 deletions
52
fusee_cpp/program/source/fusee_overlay_manager.cpp
Normal file
52
fusee_cpp/program/source/fusee_overlay_manager.cpp
Normal file
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <exosphere.hpp>
|
||||
#include "fusee_overlay_manager.hpp"
|
||||
#include "fusee_secondary_archive.hpp"
|
||||
#include "fusee_fatal.hpp"
|
||||
|
||||
namespace ams::nxboot {
|
||||
|
||||
namespace {
|
||||
|
||||
ALWAYS_INLINE void *GetOverlayDestination() {
|
||||
return reinterpret_cast<void *>(0x4002C000);
|
||||
}
|
||||
|
||||
void LoadMemoryTrainingOverlay(fs::FileHandle archive_file) {
|
||||
Result result;
|
||||
if (fuse::GetSocType() == fuse::SocType_Erista) {
|
||||
result = fs::ReadFile(archive_file, __builtin_offsetof(SecondaryArchive, ovl_mtc_erista), GetOverlayDestination(), sizeof(SecondaryArchive{}.ovl_mtc_erista));
|
||||
} else /* if (fuse::GetSocType() == fuse::SocType_Mariko) */ {
|
||||
result = fs::ReadFile(archive_file, __builtin_offsetof(SecondaryArchive, ovl_mtc_mariko), GetOverlayDestination(), sizeof(SecondaryArchive{}.ovl_mtc_mariko));
|
||||
}
|
||||
|
||||
if (R_FAILED(result)) {
|
||||
ShowFatalError("Failed to load MTC overlay: 0x%08" PRIx32 "\n", result.GetValue());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void LoadOverlay(fs::FileHandle archive_file, OverlayId ovl) {
|
||||
switch (ovl) {
|
||||
case OverlayId_MemoryTraining:
|
||||
LoadMemoryTrainingOverlay(archive_file);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue