mtp: support overriding vid/pid.

This commit is contained in:
ITotalJustice
2025-09-14 14:30:46 +01:00
parent 0706683690
commit 50e55f4fca
4 changed files with 10 additions and 3 deletions

View File

@@ -394,7 +394,7 @@ endif()
if (ENABLE_LIBHAZE) if (ENABLE_LIBHAZE)
FetchContent_Declare(libhaze FetchContent_Declare(libhaze
GIT_REPOSITORY https://github.com/ITotalJustice/libhaze.git GIT_REPOSITORY https://github.com/ITotalJustice/libhaze.git
GIT_TAG f0b2a14 GIT_TAG d60ba60
) )
FetchContent_MakeAvailable(libhaze) FetchContent_MakeAvailable(libhaze)

View File

@@ -338,6 +338,10 @@ public:
// todo: move this into it's own menu // todo: move this into it's own menu
option::OptionLong m_text_scroll_speed{"accessibility", "text_scroll_speed", 1}; // normal option::OptionLong m_text_scroll_speed{"accessibility", "text_scroll_speed", 1}; // normal
// mtp options.
option::OptionLong m_mtp_vid{"mtp", "vid", 0x057e}; // nintendo
option::OptionLong m_mtp_pid{"mtp", "pid", 0x201d}; // switch
std::shared_ptr<fs::FsNativeSd> m_fs{}; std::shared_ptr<fs::FsNativeSd> m_fs{};
audio::SongID m_background_music{}; audio::SongID m_background_music{};

View File

@@ -1427,7 +1427,7 @@ App::App(const char* argv0) {
// init fs for app use. // init fs for app use.
m_fs = std::make_shared<fs::FsNativeSd>(true); m_fs = std::make_shared<fs::FsNativeSd>(true);
auto cb = [](const mTCHAR *Section, const mTCHAR *Key, const mTCHAR *Value, void *UserData) -> int { static const auto cb = [](const mTCHAR *Section, const mTCHAR *Key, const mTCHAR *Value, void *UserData) -> int {
auto app = static_cast<App*>(UserData); auto app = static_cast<App*>(UserData);
if (!std::strcmp(Section, INI_SECTION)) { if (!std::strcmp(Section, INI_SECTION)) {
@@ -1478,6 +1478,9 @@ App::App(const char* argv0) {
else if (app->m_nsz_compress_ldm.LoadFrom(Key, Value)) {} else if (app->m_nsz_compress_ldm.LoadFrom(Key, Value)) {}
else if (app->m_nsz_compress_block.LoadFrom(Key, Value)) {} else if (app->m_nsz_compress_block.LoadFrom(Key, Value)) {}
else if (app->m_nsz_compress_block_exponent.LoadFrom(Key, Value)) {} else if (app->m_nsz_compress_block_exponent.LoadFrom(Key, Value)) {}
} else if (!std::strcmp(Section, "mtp")) {
if (app->m_mtp_vid.LoadFrom(Key, Value)) {}
else if (app->m_mtp_pid.LoadFrom(Key, Value)) {}
} }
return 1; return 1;

View File

@@ -579,7 +579,7 @@ bool Init() {
g_fs_entries.emplace_back(std::make_shared<FsInstallProxy>("install", "Install (NSP, XCI, NSZ, XCZ)")); g_fs_entries.emplace_back(std::make_shared<FsInstallProxy>("install", "Install (NSP, XCI, NSZ, XCZ)"));
g_should_exit = false; g_should_exit = false;
if (!::haze::Initialize(haze_callback, THREAD_PRIO, THREAD_CORE, g_fs_entries)) { if (!::haze::Initialize(haze_callback, THREAD_PRIO, THREAD_CORE, g_fs_entries, App::GetApp()->m_mtp_vid.Get(), App::GetApp()->m_mtp_pid.Get())) {
return false; return false;
} }