Compare commits
3 Commits
android-19
...
android-19
Author | SHA1 | Date | |
---|---|---|---|
d789f0f99c | |||
f3f1b70728 | |||
fca2beb76d |
@ -33,6 +33,7 @@ stages:
|
|||||||
cache: 'true'
|
cache: 'true'
|
||||||
version: $(DisplayVersion)
|
version: $(DisplayVersion)
|
||||||
- stage: build_win
|
- stage: build_win
|
||||||
|
dependsOn: format
|
||||||
displayName: 'build-windows'
|
displayName: 'build-windows'
|
||||||
jobs:
|
jobs:
|
||||||
- job: build
|
- job: build
|
||||||
|
@ -1,13 +1,7 @@
|
|||||||
| Pull Request | Commit | Title | Author | Merged? |
|
| Pull Request | Commit | Title | Author | Merged? |
|
||||||
|----|----|----|----|----|
|
|----|----|----|----|----|
|
||||||
| [12579](https://github.com/yuzu-emu/yuzu-android//pull/12579) | [`93ef41f03`](https://github.com/yuzu-emu/yuzu-android//pull/12579/files) | Core: Implement Device Mapping & GPU SMMU | [FernandoS27](https://github.com/FernandoS27/) | Yes |
|
| [12579](https://github.com/yuzu-emu/yuzu-android//pull/12579) | [`66ae60a9e`](https://github.com/yuzu-emu/yuzu-android//pull/12579/files) | Core: Implement Device Mapping & GPU SMMU | [FernandoS27](https://github.com/FernandoS27/) | Yes |
|
||||||
| [12644](https://github.com/yuzu-emu/yuzu-android//pull/12644) | [`2044a289f`](https://github.com/yuzu-emu/yuzu-android//pull/12644/files) | shader_recompiler: fix Offset operand usage for non-OpImage*Gather | [liamwhite](https://github.com/liamwhite/) | Yes |
|
| [12644](https://github.com/yuzu-emu/yuzu-android//pull/12644) | [`2044a289f`](https://github.com/yuzu-emu/yuzu-android//pull/12644/files) | shader_recompiler: fix Offset operand usage for non-OpImage*Gather | [liamwhite](https://github.com/liamwhite/) | Yes |
|
||||||
| [12660](https://github.com/yuzu-emu/yuzu-android//pull/12660) | [`2cacb9d48`](https://github.com/yuzu-emu/yuzu-android//pull/12660/files) | service: hid: Fully implement abstract vibration | [german77](https://github.com/german77/) | Yes |
|
|
||||||
| [12678](https://github.com/yuzu-emu/yuzu-android//pull/12678) | [`7f5adf898`](https://github.com/yuzu-emu/yuzu-android//pull/12678/files) | service: set: Implement stubbed functions | [german77](https://github.com/german77/) | Yes |
|
|
||||||
| [12683](https://github.com/yuzu-emu/yuzu-android//pull/12683) | [`c661b9586`](https://github.com/yuzu-emu/yuzu-android//pull/12683/files) | service: nfc: Create backup when none exist | [german77](https://github.com/german77/) | Yes |
|
|
||||||
| [12687](https://github.com/yuzu-emu/yuzu-android//pull/12687) | [`0b0e9ef18`](https://github.com/yuzu-emu/yuzu-android//pull/12687/files) | core: hid: Disable special features before disconnecting the controllers | [german77](https://github.com/german77/) | Yes |
|
|
||||||
| [12688](https://github.com/yuzu-emu/yuzu-android//pull/12688) | [`e9eb017aa`](https://github.com/yuzu-emu/yuzu-android//pull/12688/files) | renderer_vulkan: recreate swapchain when frame size changes | [liamwhite](https://github.com/liamwhite/) | Yes |
|
|
||||||
| [12701](https://github.com/yuzu-emu/yuzu-android//pull/12701) | [`e4bbb24dc`](https://github.com/yuzu-emu/yuzu-android//pull/12701/files) | vi: check layer state before opening or closing | [liamwhite](https://github.com/liamwhite/) | Yes |
|
|
||||||
|
|
||||||
|
|
||||||
End of merge log. You can find the original README.md below the break.
|
End of merge log. You can find the original README.md below the break.
|
||||||
|
@ -49,6 +49,7 @@ import org.yuzu.yuzu_emu.utils.ForegroundService
|
|||||||
import org.yuzu.yuzu_emu.utils.InputHandler
|
import org.yuzu.yuzu_emu.utils.InputHandler
|
||||||
import org.yuzu.yuzu_emu.utils.Log
|
import org.yuzu.yuzu_emu.utils.Log
|
||||||
import org.yuzu.yuzu_emu.utils.MemoryUtil
|
import org.yuzu.yuzu_emu.utils.MemoryUtil
|
||||||
|
import org.yuzu.yuzu_emu.utils.NativeConfig
|
||||||
import org.yuzu.yuzu_emu.utils.NfcReader
|
import org.yuzu.yuzu_emu.utils.NfcReader
|
||||||
import org.yuzu.yuzu_emu.utils.ThemeHelper
|
import org.yuzu.yuzu_emu.utils.ThemeHelper
|
||||||
import java.text.NumberFormat
|
import java.text.NumberFormat
|
||||||
@ -170,6 +171,11 @@ class EmulationActivity : AppCompatActivity(), SensorEventListener {
|
|||||||
stopMotionSensorListener()
|
stopMotionSensorListener()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onStop() {
|
||||||
|
super.onStop()
|
||||||
|
NativeConfig.saveGlobalConfig()
|
||||||
|
}
|
||||||
|
|
||||||
override fun onUserLeaveHint() {
|
override fun onUserLeaveHint() {
|
||||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S) {
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S) {
|
||||||
if (BooleanSetting.PICTURE_IN_PICTURE.getBoolean() && !isInPictureInPictureMode) {
|
if (BooleanSetting.PICTURE_IN_PICTURE.getBoolean() && !isInPictureInPictureMode) {
|
||||||
|
@ -554,7 +554,6 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
|
|||||||
findItem(R.id.menu_touchscreen).isChecked = BooleanSetting.TOUCHSCREEN.getBoolean()
|
findItem(R.id.menu_touchscreen).isChecked = BooleanSetting.TOUCHSCREEN.getBoolean()
|
||||||
}
|
}
|
||||||
|
|
||||||
popup.setOnDismissListener { NativeConfig.saveGlobalConfig() }
|
|
||||||
popup.setOnMenuItemClickListener {
|
popup.setOnMenuItemClickListener {
|
||||||
when (it.itemId) {
|
when (it.itemId) {
|
||||||
R.id.menu_toggle_fps -> {
|
R.id.menu_toggle_fps -> {
|
||||||
@ -721,9 +720,7 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
|
|||||||
MaterialAlertDialogBuilder(requireContext())
|
MaterialAlertDialogBuilder(requireContext())
|
||||||
.setTitle(R.string.emulation_control_adjust)
|
.setTitle(R.string.emulation_control_adjust)
|
||||||
.setView(adjustBinding.root)
|
.setView(adjustBinding.root)
|
||||||
.setPositiveButton(android.R.string.ok) { _: DialogInterface?, _: Int ->
|
.setPositiveButton(android.R.string.ok, null)
|
||||||
NativeConfig.saveGlobalConfig()
|
|
||||||
}
|
|
||||||
.setNeutralButton(R.string.slider_default) { _: DialogInterface?, _: Int ->
|
.setNeutralButton(R.string.slider_default) { _: DialogInterface?, _: Int ->
|
||||||
setControlScale(50)
|
setControlScale(50)
|
||||||
setControlOpacity(100)
|
setControlOpacity(100)
|
||||||
|
@ -104,7 +104,7 @@ object FileUtil {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reference: https://stackoverflow.com/questions/42186820/documentfile-is-very-slow
|
* Reference: https://stackoverflow.com/questions/42186820/documentfile-is-very-slow
|
||||||
* This function will be faster than DocumentFile.listFiles
|
* This function will be faster than DoucmentFile.listFiles
|
||||||
* @param uri Directory uri.
|
* @param uri Directory uri.
|
||||||
* @return CheapDocument lists.
|
* @return CheapDocument lists.
|
||||||
*/
|
*/
|
||||||
|
@ -21,7 +21,7 @@ void AndroidConfig::ReloadAllValues() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AndroidConfig::SaveAllValues() {
|
void AndroidConfig::SaveAllValues() {
|
||||||
SaveValues();
|
Save();
|
||||||
SaveAndroidValues();
|
SaveAndroidValues();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -205,7 +205,7 @@ jboolean Java_org_yuzu_yuzu_1emu_utils_NativeConfig_getIsRuntimeModifiable(JNIEn
|
|||||||
jstring jkey) {
|
jstring jkey) {
|
||||||
auto setting = getSetting<std::string>(env, jkey);
|
auto setting = getSetting<std::string>(env, jkey);
|
||||||
if (setting != nullptr) {
|
if (setting != nullptr) {
|
||||||
return setting->RuntimeModifiable();
|
return setting->RuntimeModfiable();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
<item>@string/language_dutch</item>
|
<item>@string/language_dutch</item>
|
||||||
<item>@string/language_english</item>
|
<item>@string/language_english</item>
|
||||||
<item>@string/language_french</item>
|
<item>@string/language_french</item>
|
||||||
<item>@string/language_german</item>
|
<item>@string/langauge_german</item>
|
||||||
<item>@string/language_italian</item>
|
<item>@string/language_italian</item>
|
||||||
<item>@string/language_japanese</item>
|
<item>@string/language_japanese</item>
|
||||||
<item>@string/language_korean</item>
|
<item>@string/language_korean</item>
|
||||||
|
@ -410,7 +410,7 @@
|
|||||||
<string name="language_japanese" translatable="false">日本語</string>
|
<string name="language_japanese" translatable="false">日本語</string>
|
||||||
<string name="language_english" translatable="false">English</string>
|
<string name="language_english" translatable="false">English</string>
|
||||||
<string name="language_french" translatable="false">Français</string>
|
<string name="language_french" translatable="false">Français</string>
|
||||||
<string name="language_german" translatable="false">Deutsch</string>
|
<string name="langauge_german" translatable="false">Deutsch</string>
|
||||||
<string name="language_italian" translatable="false">Italiano</string>
|
<string name="language_italian" translatable="false">Italiano</string>
|
||||||
<string name="language_spanish" translatable="false">Español</string>
|
<string name="language_spanish" translatable="false">Español</string>
|
||||||
<string name="language_chinese" translatable="false">简体中文</string>
|
<string name="language_chinese" translatable="false">简体中文</string>
|
||||||
|
@ -11,7 +11,7 @@ ADSP::ADSP(Core::System& system, Sink::Sink& sink) {
|
|||||||
opus_decoder = std::make_unique<OpusDecoder::OpusDecoder>(system);
|
opus_decoder = std::make_unique<OpusDecoder::OpusDecoder>(system);
|
||||||
opus_decoder->Send(Direction::DSP, OpusDecoder::Message::Start);
|
opus_decoder->Send(Direction::DSP, OpusDecoder::Message::Start);
|
||||||
if (opus_decoder->Receive(Direction::Host) != OpusDecoder::Message::StartOK) {
|
if (opus_decoder->Receive(Direction::Host) != OpusDecoder::Message::StartOK) {
|
||||||
LOG_ERROR(Service_Audio, "OpusDecoder failed to initialize.");
|
LOG_ERROR(Service_Audio, "OpusDeocder failed to initialize.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ void CommandGenerator::GenerateDataSourceCommand(VoiceInfo& voice_info,
|
|||||||
const VoiceState& voice_state, const s8 channel) {
|
const VoiceState& voice_state, const s8 channel) {
|
||||||
if (voice_info.mix_id == UnusedMixId) {
|
if (voice_info.mix_id == UnusedMixId) {
|
||||||
if (voice_info.splitter_id != UnusedSplitterId) {
|
if (voice_info.splitter_id != UnusedSplitterId) {
|
||||||
auto destination{splitter_context.GetDestinationData(voice_info.splitter_id, 0)};
|
auto destination{splitter_context.GetDesintationData(voice_info.splitter_id, 0)};
|
||||||
u32 dest_id{0};
|
u32 dest_id{0};
|
||||||
while (destination != nullptr) {
|
while (destination != nullptr) {
|
||||||
if (destination->IsConfigured()) {
|
if (destination->IsConfigured()) {
|
||||||
@ -55,7 +55,7 @@ void CommandGenerator::GenerateDataSourceCommand(VoiceInfo& voice_info,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
dest_id++;
|
dest_id++;
|
||||||
destination = splitter_context.GetDestinationData(voice_info.splitter_id, dest_id);
|
destination = splitter_context.GetDesintationData(voice_info.splitter_id, dest_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -234,7 +234,7 @@ void CommandGenerator::GenerateVoiceCommand(VoiceInfo& voice_info) {
|
|||||||
if (voice_info.mix_id == UnusedMixId) {
|
if (voice_info.mix_id == UnusedMixId) {
|
||||||
if (voice_info.splitter_id != UnusedSplitterId) {
|
if (voice_info.splitter_id != UnusedSplitterId) {
|
||||||
auto i{channel};
|
auto i{channel};
|
||||||
auto destination{splitter_context.GetDestinationData(voice_info.splitter_id, i)};
|
auto destination{splitter_context.GetDesintationData(voice_info.splitter_id, i)};
|
||||||
while (destination != nullptr) {
|
while (destination != nullptr) {
|
||||||
if (destination->IsConfigured()) {
|
if (destination->IsConfigured()) {
|
||||||
const auto mix_id{destination->GetMixId()};
|
const auto mix_id{destination->GetMixId()};
|
||||||
@ -249,7 +249,7 @@ void CommandGenerator::GenerateVoiceCommand(VoiceInfo& voice_info) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
i += voice_info.channel_count;
|
i += voice_info.channel_count;
|
||||||
destination = splitter_context.GetDestinationData(voice_info.splitter_id, i);
|
destination = splitter_context.GetDesintationData(voice_info.splitter_id, i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -591,7 +591,7 @@ void CommandGenerator::GenerateMixCommands(MixInfo& mix_info) {
|
|||||||
if (mix_info.dst_splitter_id != UnusedSplitterId) {
|
if (mix_info.dst_splitter_id != UnusedSplitterId) {
|
||||||
s16 dest_id{0};
|
s16 dest_id{0};
|
||||||
auto destination{
|
auto destination{
|
||||||
splitter_context.GetDestinationData(mix_info.dst_splitter_id, dest_id)};
|
splitter_context.GetDesintationData(mix_info.dst_splitter_id, dest_id)};
|
||||||
while (destination != nullptr) {
|
while (destination != nullptr) {
|
||||||
if (destination->IsConfigured()) {
|
if (destination->IsConfigured()) {
|
||||||
auto splitter_mix_id{destination->GetMixId()};
|
auto splitter_mix_id{destination->GetMixId()};
|
||||||
@ -612,7 +612,7 @@ void CommandGenerator::GenerateMixCommands(MixInfo& mix_info) {
|
|||||||
}
|
}
|
||||||
dest_id++;
|
dest_id++;
|
||||||
destination =
|
destination =
|
||||||
splitter_context.GetDestinationData(mix_info.dst_splitter_id, dest_id);
|
splitter_context.GetDesintationData(mix_info.dst_splitter_id, dest_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -93,7 +93,7 @@ bool MixInfo::UpdateConnection(EdgeMatrix& edge_matrix, const InParameter& in_pa
|
|||||||
|
|
||||||
for (u32 i = 0; i < destination_count; i++) {
|
for (u32 i = 0; i < destination_count; i++) {
|
||||||
auto destination{
|
auto destination{
|
||||||
splitter_context.GetDestinationData(in_params.dest_splitter_id, i)};
|
splitter_context.GetDesintationData(in_params.dest_splitter_id, i)};
|
||||||
|
|
||||||
if (destination) {
|
if (destination) {
|
||||||
const auto destination_id{destination->GetMixId()};
|
const auto destination_id{destination->GetMixId()};
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
namespace AudioCore::Renderer {
|
namespace AudioCore::Renderer {
|
||||||
|
|
||||||
SplitterDestinationData* SplitterContext::GetDestinationData(const s32 splitter_id,
|
SplitterDestinationData* SplitterContext::GetDesintationData(const s32 splitter_id,
|
||||||
const s32 destination_id) {
|
const s32 destination_id) {
|
||||||
return splitter_infos[splitter_id].GetData(destination_id);
|
return splitter_infos[splitter_id].GetData(destination_id);
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ public:
|
|||||||
* @param destination_id - Destination index within the splitter.
|
* @param destination_id - Destination index within the splitter.
|
||||||
* @return Pointer to the found destination. May be nullptr.
|
* @return Pointer to the found destination. May be nullptr.
|
||||||
*/
|
*/
|
||||||
SplitterDestinationData* GetDestinationData(s32 splitter_id, s32 destination_id);
|
SplitterDestinationData* GetDesintationData(s32 splitter_id, s32 destination_id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a splitter from the given index.
|
* Get a splitter from the given index.
|
||||||
|
@ -35,7 +35,7 @@ bool BasicSetting::Save() const {
|
|||||||
return save;
|
return save;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BasicSetting::RuntimeModifiable() const {
|
bool BasicSetting::RuntimeModfiable() const {
|
||||||
return runtime_modifiable;
|
return runtime_modifiable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -186,7 +186,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* @returns true if the current setting can be changed while the guest is running.
|
* @returns true if the current setting can be changed while the guest is running.
|
||||||
*/
|
*/
|
||||||
[[nodiscard]] bool RuntimeModifiable() const;
|
[[nodiscard]] bool RuntimeModfiable() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns A unique number corresponding to the setting.
|
* @returns A unique number corresponding to the setting.
|
||||||
|
@ -716,23 +716,22 @@ add_library(core STATIC
|
|||||||
hle/service/server_manager.h
|
hle/service/server_manager.h
|
||||||
hle/service/service.cpp
|
hle/service/service.cpp
|
||||||
hle/service/service.h
|
hle/service/service.h
|
||||||
hle/service/set/setting_formats/appln_settings.cpp
|
hle/service/set/appln_settings.cpp
|
||||||
hle/service/set/setting_formats/appln_settings.h
|
hle/service/set/appln_settings.h
|
||||||
hle/service/set/setting_formats/device_settings.cpp
|
hle/service/set/device_settings.cpp
|
||||||
hle/service/set/setting_formats/device_settings.h
|
hle/service/set/device_settings.h
|
||||||
hle/service/set/setting_formats/system_settings.cpp
|
|
||||||
hle/service/set/setting_formats/system_settings.h
|
|
||||||
hle/service/set/setting_formats/private_settings.cpp
|
|
||||||
hle/service/set/setting_formats/private_settings.h
|
|
||||||
hle/service/set/factory_settings_server.cpp
|
hle/service/set/factory_settings_server.cpp
|
||||||
hle/service/set/factory_settings_server.h
|
hle/service/set/factory_settings_server.h
|
||||||
hle/service/set/firmware_debug_settings_server.cpp
|
hle/service/set/firmware_debug_settings_server.cpp
|
||||||
hle/service/set/firmware_debug_settings_server.h
|
hle/service/set/firmware_debug_settings_server.h
|
||||||
|
hle/service/set/private_settings.cpp
|
||||||
|
hle/service/set/private_settings.h
|
||||||
hle/service/set/settings.cpp
|
hle/service/set/settings.cpp
|
||||||
hle/service/set/settings.h
|
hle/service/set/settings.h
|
||||||
hle/service/set/settings_server.cpp
|
hle/service/set/settings_server.cpp
|
||||||
hle/service/set/settings_server.h
|
hle/service/set/settings_server.h
|
||||||
hle/service/set/settings_types.h
|
hle/service/set/system_settings.cpp
|
||||||
|
hle/service/set/system_settings.h
|
||||||
hle/service/set/system_settings_server.cpp
|
hle/service/set/system_settings_server.cpp
|
||||||
hle/service/set/system_settings_server.h
|
hle/service/set/system_settings_server.h
|
||||||
hle/service/sm/sm.cpp
|
hle/service/sm/sm.cpp
|
||||||
|
@ -28,10 +28,6 @@ class Memory;
|
|||||||
template <typename DTraits>
|
template <typename DTraits>
|
||||||
struct DeviceMemoryManagerAllocator;
|
struct DeviceMemoryManagerAllocator;
|
||||||
|
|
||||||
struct Asid {
|
|
||||||
size_t id;
|
|
||||||
};
|
|
||||||
|
|
||||||
template <typename Traits>
|
template <typename Traits>
|
||||||
class DeviceMemoryManager {
|
class DeviceMemoryManager {
|
||||||
using DeviceInterface = typename Traits::DeviceInterface;
|
using DeviceInterface = typename Traits::DeviceInterface;
|
||||||
@ -47,14 +43,15 @@ public:
|
|||||||
void AllocateFixed(DAddr start, size_t size);
|
void AllocateFixed(DAddr start, size_t size);
|
||||||
void Free(DAddr start, size_t size);
|
void Free(DAddr start, size_t size);
|
||||||
|
|
||||||
void Map(DAddr address, VAddr virtual_address, size_t size, Asid asid, bool track = false);
|
void Map(DAddr address, VAddr virtual_address, size_t size, size_t process_id,
|
||||||
|
bool track = false);
|
||||||
|
|
||||||
void Unmap(DAddr address, size_t size);
|
void Unmap(DAddr address, size_t size);
|
||||||
|
|
||||||
void TrackContinuityImpl(DAddr address, VAddr virtual_address, size_t size, Asid asid);
|
void TrackContinuityImpl(DAddr address, VAddr virtual_address, size_t size, size_t process_id);
|
||||||
void TrackContinuity(DAddr address, VAddr virtual_address, size_t size, Asid asid) {
|
void TrackContinuity(DAddr address, VAddr virtual_address, size_t size, size_t process_id) {
|
||||||
std::scoped_lock lk(mapping_guard);
|
std::scoped_lock lk(mapping_guard);
|
||||||
TrackContinuityImpl(address, virtual_address, size, asid);
|
TrackContinuityImpl(address, virtual_address, size, process_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write / Read
|
// Write / Read
|
||||||
@ -108,8 +105,8 @@ public:
|
|||||||
void WriteBlock(DAddr address, const void* src_pointer, size_t size);
|
void WriteBlock(DAddr address, const void* src_pointer, size_t size);
|
||||||
void WriteBlockUnsafe(DAddr address, const void* src_pointer, size_t size);
|
void WriteBlockUnsafe(DAddr address, const void* src_pointer, size_t size);
|
||||||
|
|
||||||
Asid RegisterProcess(Memory::Memory* memory);
|
size_t RegisterProcess(Memory::Memory* memory);
|
||||||
void UnregisterProcess(Asid id);
|
void UnregisterProcess(size_t id);
|
||||||
|
|
||||||
void UpdatePagesCachedCount(DAddr addr, size_t size, s32 delta);
|
void UpdatePagesCachedCount(DAddr addr, size_t size, s32 delta);
|
||||||
|
|
||||||
@ -166,17 +163,17 @@ private:
|
|||||||
static constexpr size_t guest_max_as_bits = 39;
|
static constexpr size_t guest_max_as_bits = 39;
|
||||||
static constexpr size_t guest_as_size = 1ULL << guest_max_as_bits;
|
static constexpr size_t guest_as_size = 1ULL << guest_max_as_bits;
|
||||||
static constexpr size_t guest_mask = guest_as_size - 1ULL;
|
static constexpr size_t guest_mask = guest_as_size - 1ULL;
|
||||||
static constexpr size_t asid_start_bit = guest_max_as_bits;
|
static constexpr size_t process_id_start_bit = guest_max_as_bits;
|
||||||
|
|
||||||
std::pair<Asid, VAddr> ExtractCPUBacking(size_t page_index) {
|
std::pair<size_t, VAddr> ExtractCPUBacking(size_t page_index) {
|
||||||
auto content = cpu_backing_address[page_index];
|
auto content = cpu_backing_address[page_index];
|
||||||
const VAddr address = content & guest_mask;
|
const VAddr address = content & guest_mask;
|
||||||
const Asid asid{static_cast<size_t>(content >> asid_start_bit)};
|
const size_t process_id = static_cast<size_t>(content >> process_id_start_bit);
|
||||||
return std::make_pair(asid, address);
|
return std::make_pair(process_id, address);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InsertCPUBacking(size_t page_index, VAddr address, Asid asid) {
|
void InsertCPUBacking(size_t page_index, VAddr address, size_t process_id) {
|
||||||
cpu_backing_address[page_index] = address | (asid.id << asid_start_bit);
|
cpu_backing_address[page_index] = address | (process_id << process_id_start_bit);
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::VirtualBuffer<VAddr> cpu_backing_address;
|
Common::VirtualBuffer<VAddr> cpu_backing_address;
|
||||||
|
@ -215,8 +215,8 @@ void DeviceMemoryManager<Traits>::Free(DAddr start, size_t size) {
|
|||||||
|
|
||||||
template <typename Traits>
|
template <typename Traits>
|
||||||
void DeviceMemoryManager<Traits>::Map(DAddr address, VAddr virtual_address, size_t size,
|
void DeviceMemoryManager<Traits>::Map(DAddr address, VAddr virtual_address, size_t size,
|
||||||
Asid asid, bool track) {
|
size_t process_id, bool track) {
|
||||||
Core::Memory::Memory* process_memory = registered_processes[asid.id];
|
Core::Memory::Memory* process_memory = registered_processes[process_id];
|
||||||
size_t start_page_d = address >> Memory::YUZU_PAGEBITS;
|
size_t start_page_d = address >> Memory::YUZU_PAGEBITS;
|
||||||
size_t num_pages = Common::AlignUp(size, Memory::YUZU_PAGESIZE) >> Memory::YUZU_PAGEBITS;
|
size_t num_pages = Common::AlignUp(size, Memory::YUZU_PAGESIZE) >> Memory::YUZU_PAGEBITS;
|
||||||
std::scoped_lock lk(mapping_guard);
|
std::scoped_lock lk(mapping_guard);
|
||||||
@ -229,7 +229,7 @@ void DeviceMemoryManager<Traits>::Map(DAddr address, VAddr virtual_address, size
|
|||||||
}
|
}
|
||||||
auto phys_addr = static_cast<u32>(GetRawPhysicalAddr(ptr) >> Memory::YUZU_PAGEBITS) + 1U;
|
auto phys_addr = static_cast<u32>(GetRawPhysicalAddr(ptr) >> Memory::YUZU_PAGEBITS) + 1U;
|
||||||
compressed_physical_ptr[start_page_d + i] = phys_addr;
|
compressed_physical_ptr[start_page_d + i] = phys_addr;
|
||||||
InsertCPUBacking(start_page_d + i, new_vaddress, asid);
|
InsertCPUBacking(start_page_d + i, new_vaddress, process_id);
|
||||||
const u32 base_dev = compressed_device_addr[phys_addr - 1U];
|
const u32 base_dev = compressed_device_addr[phys_addr - 1U];
|
||||||
const u32 new_dev = static_cast<u32>(start_page_d + i);
|
const u32 new_dev = static_cast<u32>(start_page_d + i);
|
||||||
if (base_dev == 0) [[likely]] {
|
if (base_dev == 0) [[likely]] {
|
||||||
@ -244,7 +244,7 @@ void DeviceMemoryManager<Traits>::Map(DAddr address, VAddr virtual_address, size
|
|||||||
impl->multi_dev_address.Register(new_dev, start_id);
|
impl->multi_dev_address.Register(new_dev, start_id);
|
||||||
}
|
}
|
||||||
if (track) {
|
if (track) {
|
||||||
TrackContinuityImpl(address, virtual_address, size, asid);
|
TrackContinuityImpl(address, virtual_address, size, process_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -277,8 +277,8 @@ void DeviceMemoryManager<Traits>::Unmap(DAddr address, size_t size) {
|
|||||||
}
|
}
|
||||||
template <typename Traits>
|
template <typename Traits>
|
||||||
void DeviceMemoryManager<Traits>::TrackContinuityImpl(DAddr address, VAddr virtual_address,
|
void DeviceMemoryManager<Traits>::TrackContinuityImpl(DAddr address, VAddr virtual_address,
|
||||||
size_t size, Asid asid) {
|
size_t size, size_t process_id) {
|
||||||
Core::Memory::Memory* process_memory = registered_processes[asid.id];
|
Core::Memory::Memory* process_memory = registered_processes[process_id];
|
||||||
size_t start_page_d = address >> Memory::YUZU_PAGEBITS;
|
size_t start_page_d = address >> Memory::YUZU_PAGEBITS;
|
||||||
size_t num_pages = Common::AlignUp(size, Memory::YUZU_PAGESIZE) >> Memory::YUZU_PAGEBITS;
|
size_t num_pages = Common::AlignUp(size, Memory::YUZU_PAGESIZE) >> Memory::YUZU_PAGEBITS;
|
||||||
uintptr_t last_ptr = 0;
|
uintptr_t last_ptr = 0;
|
||||||
@ -488,8 +488,8 @@ void DeviceMemoryManager<Traits>::WriteBlockUnsafe(DAddr address, const void* sr
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename Traits>
|
template <typename Traits>
|
||||||
Asid DeviceMemoryManager<Traits>::RegisterProcess(Memory::Memory* memory_device_inter) {
|
size_t DeviceMemoryManager<Traits>::RegisterProcess(Memory::Memory* memory_device_inter) {
|
||||||
size_t new_id{};
|
size_t new_id;
|
||||||
if (!id_pool.empty()) {
|
if (!id_pool.empty()) {
|
||||||
new_id = id_pool.front();
|
new_id = id_pool.front();
|
||||||
id_pool.pop_front();
|
id_pool.pop_front();
|
||||||
@ -498,23 +498,29 @@ Asid DeviceMemoryManager<Traits>::RegisterProcess(Memory::Memory* memory_device_
|
|||||||
registered_processes.emplace_back(memory_device_inter);
|
registered_processes.emplace_back(memory_device_inter);
|
||||||
new_id = registered_processes.size() - 1U;
|
new_id = registered_processes.size() - 1U;
|
||||||
}
|
}
|
||||||
return Asid{new_id};
|
return new_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Traits>
|
template <typename Traits>
|
||||||
void DeviceMemoryManager<Traits>::UnregisterProcess(Asid asid) {
|
void DeviceMemoryManager<Traits>::UnregisterProcess(size_t id) {
|
||||||
registered_processes[asid.id] = nullptr;
|
registered_processes[id] = nullptr;
|
||||||
id_pool.push_front(asid.id);
|
id_pool.push_front(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Traits>
|
template <typename Traits>
|
||||||
void DeviceMemoryManager<Traits>::UpdatePagesCachedCount(DAddr addr, size_t size, s32 delta) {
|
void DeviceMemoryManager<Traits>::UpdatePagesCachedCount(DAddr addr, size_t size, s32 delta) {
|
||||||
std::unique_lock<std::mutex> lk(counter_guard, std::defer_lock);
|
bool locked = false;
|
||||||
const auto Lock = [&] {
|
auto lock = [&] {
|
||||||
if (!lk) {
|
if (!locked) {
|
||||||
lk.lock();
|
counter_guard.lock();
|
||||||
|
locked = true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
SCOPE_EXIT({
|
||||||
|
if (locked) {
|
||||||
|
counter_guard.unlock();
|
||||||
|
}
|
||||||
|
});
|
||||||
u64 uncache_begin = 0;
|
u64 uncache_begin = 0;
|
||||||
u64 cache_begin = 0;
|
u64 cache_begin = 0;
|
||||||
u64 uncache_bytes = 0;
|
u64 uncache_bytes = 0;
|
||||||
@ -524,9 +530,9 @@ void DeviceMemoryManager<Traits>::UpdatePagesCachedCount(DAddr addr, size_t size
|
|||||||
std::atomic_thread_fence(std::memory_order_acquire);
|
std::atomic_thread_fence(std::memory_order_acquire);
|
||||||
const size_t page_end = Common::DivCeil(addr + size, Memory::YUZU_PAGESIZE);
|
const size_t page_end = Common::DivCeil(addr + size, Memory::YUZU_PAGESIZE);
|
||||||
size_t page = addr >> Memory::YUZU_PAGEBITS;
|
size_t page = addr >> Memory::YUZU_PAGEBITS;
|
||||||
auto [asid, base_vaddress] = ExtractCPUBacking(page);
|
auto [process_id, base_vaddress] = ExtractCPUBacking(page);
|
||||||
size_t vpage = base_vaddress >> Memory::YUZU_PAGEBITS;
|
size_t vpage = base_vaddress >> Memory::YUZU_PAGEBITS;
|
||||||
auto* memory_device_inter = registered_processes[asid.id];
|
auto* memory_device_inter = registered_processes[process_id];
|
||||||
for (; page != page_end; ++page) {
|
for (; page != page_end; ++page) {
|
||||||
std::atomic_uint8_t& count = cached_pages->at(page >> 3).Count(page);
|
std::atomic_uint8_t& count = cached_pages->at(page >> 3).Count(page);
|
||||||
|
|
||||||
@ -549,7 +555,7 @@ void DeviceMemoryManager<Traits>::UpdatePagesCachedCount(DAddr addr, size_t size
|
|||||||
}
|
}
|
||||||
uncache_bytes += Memory::YUZU_PAGESIZE;
|
uncache_bytes += Memory::YUZU_PAGESIZE;
|
||||||
} else if (uncache_bytes > 0) {
|
} else if (uncache_bytes > 0) {
|
||||||
Lock();
|
lock();
|
||||||
MarkRegionCaching(memory_device_inter, uncache_begin << Memory::YUZU_PAGEBITS,
|
MarkRegionCaching(memory_device_inter, uncache_begin << Memory::YUZU_PAGEBITS,
|
||||||
uncache_bytes, false);
|
uncache_bytes, false);
|
||||||
uncache_bytes = 0;
|
uncache_bytes = 0;
|
||||||
@ -560,7 +566,7 @@ void DeviceMemoryManager<Traits>::UpdatePagesCachedCount(DAddr addr, size_t size
|
|||||||
}
|
}
|
||||||
cache_bytes += Memory::YUZU_PAGESIZE;
|
cache_bytes += Memory::YUZU_PAGESIZE;
|
||||||
} else if (cache_bytes > 0) {
|
} else if (cache_bytes > 0) {
|
||||||
Lock();
|
lock();
|
||||||
MarkRegionCaching(memory_device_inter, cache_begin << Memory::YUZU_PAGEBITS, cache_bytes,
|
MarkRegionCaching(memory_device_inter, cache_begin << Memory::YUZU_PAGEBITS, cache_bytes,
|
||||||
true);
|
true);
|
||||||
cache_bytes = 0;
|
cache_bytes = 0;
|
||||||
@ -568,12 +574,12 @@ void DeviceMemoryManager<Traits>::UpdatePagesCachedCount(DAddr addr, size_t size
|
|||||||
vpage++;
|
vpage++;
|
||||||
}
|
}
|
||||||
if (uncache_bytes > 0) {
|
if (uncache_bytes > 0) {
|
||||||
Lock();
|
lock();
|
||||||
MarkRegionCaching(memory_device_inter, uncache_begin << Memory::YUZU_PAGEBITS, uncache_bytes,
|
MarkRegionCaching(memory_device_inter, uncache_begin << Memory::YUZU_PAGEBITS, uncache_bytes,
|
||||||
false);
|
false);
|
||||||
}
|
}
|
||||||
if (cache_bytes > 0) {
|
if (cache_bytes > 0) {
|
||||||
Lock();
|
lock();
|
||||||
MarkRegionCaching(memory_device_inter, cache_begin << Memory::YUZU_PAGEBITS, cache_bytes,
|
MarkRegionCaching(memory_device_inter, cache_begin << Memory::YUZU_PAGEBITS, cache_bytes,
|
||||||
true);
|
true);
|
||||||
}
|
}
|
||||||
|
@ -20,13 +20,12 @@ void LoopProcess(Core::System& system) {
|
|||||||
auto server_manager = std::make_unique<ServerManager>(system);
|
auto server_manager = std::make_unique<ServerManager>(system);
|
||||||
std::shared_ptr<ResourceManager> resource_manager = std::make_shared<ResourceManager>(system);
|
std::shared_ptr<ResourceManager> resource_manager = std::make_shared<ResourceManager>(system);
|
||||||
std::shared_ptr<HidFirmwareSettings> firmware_settings =
|
std::shared_ptr<HidFirmwareSettings> firmware_settings =
|
||||||
std::make_shared<HidFirmwareSettings>(system);
|
std::make_shared<HidFirmwareSettings>();
|
||||||
|
|
||||||
// TODO: Remove this hack when am is emulated properly.
|
// TODO: Remove this hack when am is emulated properly.
|
||||||
resource_manager->Initialize();
|
resource_manager->Initialize();
|
||||||
resource_manager->RegisterAppletResourceUserId(system.ApplicationProcess()->GetProcessId(),
|
resource_manager->RegisterAppletResourceUserId(system.ApplicationProcess()->GetProcessId(),
|
||||||
true);
|
true);
|
||||||
resource_manager->SetAruidValidForVibration(system.ApplicationProcess()->GetProcessId(), true);
|
|
||||||
|
|
||||||
server_manager->RegisterNamedService(
|
server_manager->RegisterNamedService(
|
||||||
"hid", std::make_shared<IHidServer>(system, resource_manager, firmware_settings));
|
"hid", std::make_shared<IHidServer>(system, resource_manager, firmware_settings));
|
||||||
|
@ -22,16 +22,12 @@
|
|||||||
#include "hid_core/resources/mouse/mouse.h"
|
#include "hid_core/resources/mouse/mouse.h"
|
||||||
#include "hid_core/resources/npad/npad.h"
|
#include "hid_core/resources/npad/npad.h"
|
||||||
#include "hid_core/resources/npad/npad_types.h"
|
#include "hid_core/resources/npad/npad_types.h"
|
||||||
#include "hid_core/resources/npad/npad_vibration.h"
|
|
||||||
#include "hid_core/resources/palma/palma.h"
|
#include "hid_core/resources/palma/palma.h"
|
||||||
#include "hid_core/resources/six_axis/console_six_axis.h"
|
#include "hid_core/resources/six_axis/console_six_axis.h"
|
||||||
#include "hid_core/resources/six_axis/seven_six_axis.h"
|
#include "hid_core/resources/six_axis/seven_six_axis.h"
|
||||||
#include "hid_core/resources/six_axis/six_axis.h"
|
#include "hid_core/resources/six_axis/six_axis.h"
|
||||||
#include "hid_core/resources/touch_screen/gesture.h"
|
#include "hid_core/resources/touch_screen/gesture.h"
|
||||||
#include "hid_core/resources/touch_screen/touch_screen.h"
|
#include "hid_core/resources/touch_screen/touch_screen.h"
|
||||||
#include "hid_core/resources/vibration/gc_vibration_device.h"
|
|
||||||
#include "hid_core/resources/vibration/n64_vibration_device.h"
|
|
||||||
#include "hid_core/resources/vibration/vibration_device.h"
|
|
||||||
|
|
||||||
namespace Service::HID {
|
namespace Service::HID {
|
||||||
|
|
||||||
@ -42,7 +38,7 @@ public:
|
|||||||
: ServiceFramework{system_, "IActiveVibrationDeviceList"}, resource_manager(resource) {
|
: ServiceFramework{system_, "IActiveVibrationDeviceList"}, resource_manager(resource) {
|
||||||
// clang-format off
|
// clang-format off
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{0, &IActiveVibrationDeviceList::ActivateVibrationDevice, "ActivateVibrationDevice"},
|
{0, &IActiveVibrationDeviceList::InitializeVibrationDevice, "InitializeVibrationDevice"},
|
||||||
};
|
};
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
@ -50,49 +46,22 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void ActivateVibrationDevice(HLERequestContext& ctx) {
|
void InitializeVibrationDevice(HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp{ctx};
|
IPC::RequestParser rp{ctx};
|
||||||
const auto vibration_device_handle{rp.PopRaw<Core::HID::VibrationDeviceHandle>()};
|
const auto vibration_device_handle{rp.PopRaw<Core::HID::VibrationDeviceHandle>()};
|
||||||
|
|
||||||
|
if (resource_manager != nullptr && resource_manager->GetNpad()) {
|
||||||
|
resource_manager->GetNpad()->InitializeVibrationDevice(vibration_device_handle);
|
||||||
|
}
|
||||||
|
|
||||||
LOG_DEBUG(Service_HID, "called, npad_type={}, npad_id={}, device_index={}",
|
LOG_DEBUG(Service_HID, "called, npad_type={}, npad_id={}, device_index={}",
|
||||||
vibration_device_handle.npad_type, vibration_device_handle.npad_id,
|
vibration_device_handle.npad_type, vibration_device_handle.npad_id,
|
||||||
vibration_device_handle.device_index);
|
vibration_device_handle.device_index);
|
||||||
|
|
||||||
const auto result = ActivateVibrationDeviceImpl(vibration_device_handle);
|
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(result);
|
rb.Push(ResultSuccess);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ActivateVibrationDeviceImpl(const Core::HID::VibrationDeviceHandle& handle) {
|
|
||||||
std::scoped_lock lock{mutex};
|
|
||||||
|
|
||||||
const Result is_valid = IsVibrationHandleValid(handle);
|
|
||||||
if (is_valid.IsError()) {
|
|
||||||
return is_valid;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (std::size_t i = 0; i < list_size; i++) {
|
|
||||||
if (handle.device_index == vibration_device_list[i].device_index &&
|
|
||||||
handle.npad_id == vibration_device_list[i].npad_id &&
|
|
||||||
handle.npad_type == vibration_device_list[i].npad_type) {
|
|
||||||
return ResultSuccess;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (list_size == vibration_device_list.size()) {
|
|
||||||
return ResultVibrationDeviceIndexOutOfRange;
|
|
||||||
}
|
|
||||||
const Result result = resource_manager->GetVibrationDevice(handle)->Activate();
|
|
||||||
if (result.IsError()) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
vibration_device_list[list_size++] = handle;
|
|
||||||
return ResultSuccess;
|
|
||||||
}
|
|
||||||
|
|
||||||
mutable std::mutex mutex;
|
|
||||||
std::size_t list_size{};
|
|
||||||
std::array<Core::HID::VibrationDeviceHandle, 0x100> vibration_device_list{};
|
|
||||||
std::shared_ptr<ResourceManager> resource_manager;
|
std::shared_ptr<ResourceManager> resource_manager;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -184,7 +153,7 @@ IHidServer::IHidServer(Core::System& system_, std::shared_ptr<ResourceManager> r
|
|||||||
{209, &IHidServer::BeginPermitVibrationSession, "BeginPermitVibrationSession"},
|
{209, &IHidServer::BeginPermitVibrationSession, "BeginPermitVibrationSession"},
|
||||||
{210, &IHidServer::EndPermitVibrationSession, "EndPermitVibrationSession"},
|
{210, &IHidServer::EndPermitVibrationSession, "EndPermitVibrationSession"},
|
||||||
{211, &IHidServer::IsVibrationDeviceMounted, "IsVibrationDeviceMounted"},
|
{211, &IHidServer::IsVibrationDeviceMounted, "IsVibrationDeviceMounted"},
|
||||||
{212, &IHidServer::SendVibrationValueInBool, "SendVibrationValueInBool"},
|
{212, nullptr, "SendVibrationValueInBool"},
|
||||||
{300, &IHidServer::ActivateConsoleSixAxisSensor, "ActivateConsoleSixAxisSensor"},
|
{300, &IHidServer::ActivateConsoleSixAxisSensor, "ActivateConsoleSixAxisSensor"},
|
||||||
{301, &IHidServer::StartConsoleSixAxisSensor, "StartConsoleSixAxisSensor"},
|
{301, &IHidServer::StartConsoleSixAxisSensor, "StartConsoleSixAxisSensor"},
|
||||||
{302, &IHidServer::StopConsoleSixAxisSensor, "StopConsoleSixAxisSensor"},
|
{302, &IHidServer::StopConsoleSixAxisSensor, "StopConsoleSixAxisSensor"},
|
||||||
@ -1523,13 +1492,59 @@ void IHidServer::ClearNpadCaptureButtonAssignment(HLERequestContext& ctx) {
|
|||||||
void IHidServer::GetVibrationDeviceInfo(HLERequestContext& ctx) {
|
void IHidServer::GetVibrationDeviceInfo(HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp{ctx};
|
IPC::RequestParser rp{ctx};
|
||||||
const auto vibration_device_handle{rp.PopRaw<Core::HID::VibrationDeviceHandle>()};
|
const auto vibration_device_handle{rp.PopRaw<Core::HID::VibrationDeviceHandle>()};
|
||||||
|
const auto controller = GetResourceManager()->GetNpad();
|
||||||
|
|
||||||
Core::HID::VibrationDeviceInfo vibration_device_info{};
|
Core::HID::VibrationDeviceInfo vibration_device_info;
|
||||||
const auto result = GetResourceManager()->GetVibrationDeviceInfo(vibration_device_info,
|
bool check_device_index = false;
|
||||||
vibration_device_handle);
|
|
||||||
|
switch (vibration_device_handle.npad_type) {
|
||||||
|
case Core::HID::NpadStyleIndex::Fullkey:
|
||||||
|
case Core::HID::NpadStyleIndex::Handheld:
|
||||||
|
case Core::HID::NpadStyleIndex::JoyconDual:
|
||||||
|
case Core::HID::NpadStyleIndex::JoyconLeft:
|
||||||
|
case Core::HID::NpadStyleIndex::JoyconRight:
|
||||||
|
vibration_device_info.type = Core::HID::VibrationDeviceType::LinearResonantActuator;
|
||||||
|
check_device_index = true;
|
||||||
|
break;
|
||||||
|
case Core::HID::NpadStyleIndex::GameCube:
|
||||||
|
vibration_device_info.type = Core::HID::VibrationDeviceType::GcErm;
|
||||||
|
break;
|
||||||
|
case Core::HID::NpadStyleIndex::N64:
|
||||||
|
vibration_device_info.type = Core::HID::VibrationDeviceType::N64;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
vibration_device_info.type = Core::HID::VibrationDeviceType::Unknown;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
vibration_device_info.position = Core::HID::VibrationDevicePosition::None;
|
||||||
|
if (check_device_index) {
|
||||||
|
switch (vibration_device_handle.device_index) {
|
||||||
|
case Core::HID::DeviceIndex::Left:
|
||||||
|
vibration_device_info.position = Core::HID::VibrationDevicePosition::Left;
|
||||||
|
break;
|
||||||
|
case Core::HID::DeviceIndex::Right:
|
||||||
|
vibration_device_info.position = Core::HID::VibrationDevicePosition::Right;
|
||||||
|
break;
|
||||||
|
case Core::HID::DeviceIndex::None:
|
||||||
|
default:
|
||||||
|
ASSERT_MSG(false, "DeviceIndex should never be None!");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG_DEBUG(Service_HID, "called, vibration_device_type={}, vibration_device_position={}",
|
||||||
|
vibration_device_info.type, vibration_device_info.position);
|
||||||
|
|
||||||
|
const auto result = IsVibrationHandleValid(vibration_device_handle);
|
||||||
|
if (result.IsError()) {
|
||||||
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
|
rb.Push(result);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 4};
|
IPC::ResponseBuilder rb{ctx, 4};
|
||||||
rb.Push(result);
|
rb.Push(ResultSuccess);
|
||||||
rb.PushRaw(vibration_device_info);
|
rb.PushRaw(vibration_device_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1545,16 +1560,16 @@ void IHidServer::SendVibrationValue(HLERequestContext& ctx) {
|
|||||||
|
|
||||||
const auto parameters{rp.PopRaw<Parameters>()};
|
const auto parameters{rp.PopRaw<Parameters>()};
|
||||||
|
|
||||||
|
GetResourceManager()->GetNpad()->VibrateController(parameters.applet_resource_user_id,
|
||||||
|
parameters.vibration_device_handle,
|
||||||
|
parameters.vibration_value);
|
||||||
|
|
||||||
LOG_DEBUG(Service_HID,
|
LOG_DEBUG(Service_HID,
|
||||||
"called, npad_type={}, npad_id={}, device_index={}, applet_resource_user_id={}",
|
"called, npad_type={}, npad_id={}, device_index={}, applet_resource_user_id={}",
|
||||||
parameters.vibration_device_handle.npad_type,
|
parameters.vibration_device_handle.npad_type,
|
||||||
parameters.vibration_device_handle.npad_id,
|
parameters.vibration_device_handle.npad_id,
|
||||||
parameters.vibration_device_handle.device_index, parameters.applet_resource_user_id);
|
parameters.vibration_device_handle.device_index, parameters.applet_resource_user_id);
|
||||||
|
|
||||||
GetResourceManager()->SendVibrationValue(parameters.applet_resource_user_id,
|
|
||||||
parameters.vibration_device_handle,
|
|
||||||
parameters.vibration_value);
|
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(ResultSuccess);
|
rb.Push(ResultSuccess);
|
||||||
}
|
}
|
||||||
@ -1576,28 +1591,10 @@ void IHidServer::GetActualVibrationValue(HLERequestContext& ctx) {
|
|||||||
parameters.vibration_device_handle.npad_id,
|
parameters.vibration_device_handle.npad_id,
|
||||||
parameters.vibration_device_handle.device_index, parameters.applet_resource_user_id);
|
parameters.vibration_device_handle.device_index, parameters.applet_resource_user_id);
|
||||||
|
|
||||||
bool has_active_aruid{};
|
|
||||||
NpadVibrationDevice* device{nullptr};
|
|
||||||
Core::HID::VibrationValue vibration_value{};
|
|
||||||
Result result = GetResourceManager()->IsVibrationAruidActive(parameters.applet_resource_user_id,
|
|
||||||
has_active_aruid);
|
|
||||||
|
|
||||||
if (result.IsSuccess() && has_active_aruid) {
|
|
||||||
result = IsVibrationHandleValid(parameters.vibration_device_handle);
|
|
||||||
}
|
|
||||||
if (result.IsSuccess() && has_active_aruid) {
|
|
||||||
device = GetResourceManager()->GetNSVibrationDevice(parameters.vibration_device_handle);
|
|
||||||
}
|
|
||||||
if (device != nullptr) {
|
|
||||||
result = device->GetActualVibrationValue(vibration_value);
|
|
||||||
}
|
|
||||||
if (result.IsError()) {
|
|
||||||
vibration_value = Core::HID::DEFAULT_VIBRATION_VALUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 6};
|
IPC::ResponseBuilder rb{ctx, 6};
|
||||||
rb.Push(ResultSuccess);
|
rb.Push(ResultSuccess);
|
||||||
rb.PushRaw(vibration_value);
|
rb.PushRaw(GetResourceManager()->GetNpad()->GetLastVibration(
|
||||||
|
parameters.applet_resource_user_id, parameters.vibration_device_handle));
|
||||||
}
|
}
|
||||||
|
|
||||||
void IHidServer::CreateActiveVibrationDeviceList(HLERequestContext& ctx) {
|
void IHidServer::CreateActiveVibrationDeviceList(HLERequestContext& ctx) {
|
||||||
@ -1612,27 +1609,25 @@ void IHidServer::PermitVibration(HLERequestContext& ctx) {
|
|||||||
IPC::RequestParser rp{ctx};
|
IPC::RequestParser rp{ctx};
|
||||||
const auto can_vibrate{rp.Pop<bool>()};
|
const auto can_vibrate{rp.Pop<bool>()};
|
||||||
|
|
||||||
|
// nnSDK saves this value as a float. Since it can only be 1.0f or 0.0f we simplify this value
|
||||||
|
// by converting it to a bool
|
||||||
|
Settings::values.vibration_enabled.SetValue(can_vibrate);
|
||||||
|
|
||||||
LOG_DEBUG(Service_HID, "called, can_vibrate={}", can_vibrate);
|
LOG_DEBUG(Service_HID, "called, can_vibrate={}", can_vibrate);
|
||||||
|
|
||||||
const auto result =
|
|
||||||
GetResourceManager()->GetNpad()->GetVibrationHandler()->SetVibrationMasterVolume(
|
|
||||||
can_vibrate ? 1.0f : 0.0f);
|
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(result);
|
rb.Push(ResultSuccess);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IHidServer::IsVibrationPermitted(HLERequestContext& ctx) {
|
void IHidServer::IsVibrationPermitted(HLERequestContext& ctx) {
|
||||||
LOG_DEBUG(Service_HID, "called");
|
LOG_DEBUG(Service_HID, "called");
|
||||||
|
|
||||||
f32 master_volume{};
|
// nnSDK checks if a float is greater than zero. We return the bool we stored earlier
|
||||||
const auto result =
|
const auto is_enabled = Settings::values.vibration_enabled.GetValue();
|
||||||
GetResourceManager()->GetNpad()->GetVibrationHandler()->GetVibrationMasterVolume(
|
|
||||||
master_volume);
|
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 3};
|
IPC::ResponseBuilder rb{ctx, 3};
|
||||||
rb.Push(result);
|
rb.Push(ResultSuccess);
|
||||||
rb.Push(master_volume > 0.0f);
|
rb.Push(is_enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IHidServer::SendVibrationValues(HLERequestContext& ctx) {
|
void IHidServer::SendVibrationValues(HLERequestContext& ctx) {
|
||||||
@ -1650,22 +1645,13 @@ void IHidServer::SendVibrationValues(HLERequestContext& ctx) {
|
|||||||
auto vibration_values = std::span(
|
auto vibration_values = std::span(
|
||||||
reinterpret_cast<const Core::HID::VibrationValue*>(vibration_data.data()), vibration_count);
|
reinterpret_cast<const Core::HID::VibrationValue*>(vibration_data.data()), vibration_count);
|
||||||
|
|
||||||
|
GetResourceManager()->GetNpad()->VibrateControllers(applet_resource_user_id,
|
||||||
|
vibration_device_handles, vibration_values);
|
||||||
|
|
||||||
LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id);
|
LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id);
|
||||||
|
|
||||||
Result result = ResultSuccess;
|
|
||||||
if (handle_count != vibration_count) {
|
|
||||||
result = ResultVibrationArraySizeMismatch;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (std::size_t i = 0; i < handle_count; i++) {
|
|
||||||
if (result.IsSuccess()) {
|
|
||||||
result = GetResourceManager()->SendVibrationValue(
|
|
||||||
applet_resource_user_id, vibration_device_handles[i], vibration_values[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(result);
|
rb.Push(ResultSuccess);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IHidServer::SendVibrationGcErmCommand(HLERequestContext& ctx) {
|
void IHidServer::SendVibrationGcErmCommand(HLERequestContext& ctx) {
|
||||||
@ -1680,6 +1666,43 @@ void IHidServer::SendVibrationGcErmCommand(HLERequestContext& ctx) {
|
|||||||
|
|
||||||
const auto parameters{rp.PopRaw<Parameters>()};
|
const auto parameters{rp.PopRaw<Parameters>()};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Note: This uses yuzu-specific behavior such that the StopHard command produces
|
||||||
|
* vibrations where freq_low == 0.0f and freq_high == 0.0f, as defined below,
|
||||||
|
* in order to differentiate between Stop and StopHard commands.
|
||||||
|
* This is done to reuse the controller vibration functions made for regular controllers.
|
||||||
|
*/
|
||||||
|
const auto vibration_value = [parameters] {
|
||||||
|
switch (parameters.gc_erm_command) {
|
||||||
|
case Core::HID::VibrationGcErmCommand::Stop:
|
||||||
|
return Core::HID::VibrationValue{
|
||||||
|
.low_amplitude = 0.0f,
|
||||||
|
.low_frequency = 160.0f,
|
||||||
|
.high_amplitude = 0.0f,
|
||||||
|
.high_frequency = 320.0f,
|
||||||
|
};
|
||||||
|
case Core::HID::VibrationGcErmCommand::Start:
|
||||||
|
return Core::HID::VibrationValue{
|
||||||
|
.low_amplitude = 1.0f,
|
||||||
|
.low_frequency = 160.0f,
|
||||||
|
.high_amplitude = 1.0f,
|
||||||
|
.high_frequency = 320.0f,
|
||||||
|
};
|
||||||
|
case Core::HID::VibrationGcErmCommand::StopHard:
|
||||||
|
return Core::HID::VibrationValue{
|
||||||
|
.low_amplitude = 0.0f,
|
||||||
|
.low_frequency = 0.0f,
|
||||||
|
.high_amplitude = 0.0f,
|
||||||
|
.high_frequency = 0.0f,
|
||||||
|
};
|
||||||
|
default:
|
||||||
|
return Core::HID::DEFAULT_VIBRATION_VALUE;
|
||||||
|
}
|
||||||
|
}();
|
||||||
|
|
||||||
|
GetResourceManager()->GetNpad()->VibrateController(
|
||||||
|
parameters.applet_resource_user_id, parameters.vibration_device_handle, vibration_value);
|
||||||
|
|
||||||
LOG_DEBUG(Service_HID,
|
LOG_DEBUG(Service_HID,
|
||||||
"called, npad_type={}, npad_id={}, device_index={}, applet_resource_user_id={}, "
|
"called, npad_type={}, npad_id={}, device_index={}, applet_resource_user_id={}, "
|
||||||
"gc_erm_command={}",
|
"gc_erm_command={}",
|
||||||
@ -1688,23 +1711,8 @@ void IHidServer::SendVibrationGcErmCommand(HLERequestContext& ctx) {
|
|||||||
parameters.vibration_device_handle.device_index, parameters.applet_resource_user_id,
|
parameters.vibration_device_handle.device_index, parameters.applet_resource_user_id,
|
||||||
parameters.gc_erm_command);
|
parameters.gc_erm_command);
|
||||||
|
|
||||||
bool has_active_aruid{};
|
|
||||||
NpadGcVibrationDevice* gc_device{nullptr};
|
|
||||||
Result result = GetResourceManager()->IsVibrationAruidActive(parameters.applet_resource_user_id,
|
|
||||||
has_active_aruid);
|
|
||||||
|
|
||||||
if (result.IsSuccess() && has_active_aruid) {
|
|
||||||
result = IsVibrationHandleValid(parameters.vibration_device_handle);
|
|
||||||
}
|
|
||||||
if (result.IsSuccess() && has_active_aruid) {
|
|
||||||
gc_device = GetResourceManager()->GetGcVibrationDevice(parameters.vibration_device_handle);
|
|
||||||
}
|
|
||||||
if (gc_device != nullptr) {
|
|
||||||
result = gc_device->SendVibrationGcErmCommand(parameters.gc_erm_command);
|
|
||||||
}
|
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(result);
|
rb.Push(ResultSuccess);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IHidServer::GetActualVibrationGcErmCommand(HLERequestContext& ctx) {
|
void IHidServer::GetActualVibrationGcErmCommand(HLERequestContext& ctx) {
|
||||||
@ -1717,31 +1725,33 @@ void IHidServer::GetActualVibrationGcErmCommand(HLERequestContext& ctx) {
|
|||||||
|
|
||||||
const auto parameters{rp.PopRaw<Parameters>()};
|
const auto parameters{rp.PopRaw<Parameters>()};
|
||||||
|
|
||||||
|
const auto last_vibration = GetResourceManager()->GetNpad()->GetLastVibration(
|
||||||
|
parameters.applet_resource_user_id, parameters.vibration_device_handle);
|
||||||
|
|
||||||
|
const auto gc_erm_command = [last_vibration] {
|
||||||
|
if (last_vibration.low_amplitude != 0.0f || last_vibration.high_amplitude != 0.0f) {
|
||||||
|
return Core::HID::VibrationGcErmCommand::Start;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Note: This uses yuzu-specific behavior such that the StopHard command produces
|
||||||
|
* vibrations where freq_low == 0.0f and freq_high == 0.0f, as defined in the HID function
|
||||||
|
* SendVibrationGcErmCommand, in order to differentiate between Stop and StopHard commands.
|
||||||
|
* This is done to reuse the controller vibration functions made for regular controllers.
|
||||||
|
*/
|
||||||
|
if (last_vibration.low_frequency == 0.0f && last_vibration.high_frequency == 0.0f) {
|
||||||
|
return Core::HID::VibrationGcErmCommand::StopHard;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Core::HID::VibrationGcErmCommand::Stop;
|
||||||
|
}();
|
||||||
|
|
||||||
LOG_DEBUG(Service_HID,
|
LOG_DEBUG(Service_HID,
|
||||||
"called, npad_type={}, npad_id={}, device_index={}, applet_resource_user_id={}",
|
"called, npad_type={}, npad_id={}, device_index={}, applet_resource_user_id={}",
|
||||||
parameters.vibration_device_handle.npad_type,
|
parameters.vibration_device_handle.npad_type,
|
||||||
parameters.vibration_device_handle.npad_id,
|
parameters.vibration_device_handle.npad_id,
|
||||||
parameters.vibration_device_handle.device_index, parameters.applet_resource_user_id);
|
parameters.vibration_device_handle.device_index, parameters.applet_resource_user_id);
|
||||||
|
|
||||||
bool has_active_aruid{};
|
|
||||||
NpadGcVibrationDevice* gc_device{nullptr};
|
|
||||||
Core::HID::VibrationGcErmCommand gc_erm_command{};
|
|
||||||
Result result = GetResourceManager()->IsVibrationAruidActive(parameters.applet_resource_user_id,
|
|
||||||
has_active_aruid);
|
|
||||||
|
|
||||||
if (result.IsSuccess() && has_active_aruid) {
|
|
||||||
result = IsVibrationHandleValid(parameters.vibration_device_handle);
|
|
||||||
}
|
|
||||||
if (result.IsSuccess() && has_active_aruid) {
|
|
||||||
gc_device = GetResourceManager()->GetGcVibrationDevice(parameters.vibration_device_handle);
|
|
||||||
}
|
|
||||||
if (gc_device != nullptr) {
|
|
||||||
result = gc_device->GetActualVibrationGcErmCommand(gc_erm_command);
|
|
||||||
}
|
|
||||||
if (result.IsError()) {
|
|
||||||
gc_erm_command = Core::HID::VibrationGcErmCommand::Stop;
|
|
||||||
}
|
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 4};
|
IPC::ResponseBuilder rb{ctx, 4};
|
||||||
rb.Push(ResultSuccess);
|
rb.Push(ResultSuccess);
|
||||||
rb.PushEnum(gc_erm_command);
|
rb.PushEnum(gc_erm_command);
|
||||||
@ -1751,24 +1761,21 @@ void IHidServer::BeginPermitVibrationSession(HLERequestContext& ctx) {
|
|||||||
IPC::RequestParser rp{ctx};
|
IPC::RequestParser rp{ctx};
|
||||||
const auto applet_resource_user_id{rp.Pop<u64>()};
|
const auto applet_resource_user_id{rp.Pop<u64>()};
|
||||||
|
|
||||||
|
GetResourceManager()->GetNpad()->SetPermitVibrationSession(true);
|
||||||
|
|
||||||
LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id);
|
LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id);
|
||||||
|
|
||||||
const auto result =
|
|
||||||
GetResourceManager()->GetNpad()->GetVibrationHandler()->BeginPermitVibrationSession(
|
|
||||||
applet_resource_user_id);
|
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(result);
|
rb.Push(ResultSuccess);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IHidServer::EndPermitVibrationSession(HLERequestContext& ctx) {
|
void IHidServer::EndPermitVibrationSession(HLERequestContext& ctx) {
|
||||||
|
GetResourceManager()->GetNpad()->SetPermitVibrationSession(false);
|
||||||
|
|
||||||
LOG_DEBUG(Service_HID, "called");
|
LOG_DEBUG(Service_HID, "called");
|
||||||
|
|
||||||
const auto result =
|
|
||||||
GetResourceManager()->GetNpad()->GetVibrationHandler()->EndPermitVibrationSession();
|
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(result);
|
rb.Push(ResultSuccess);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IHidServer::IsVibrationDeviceMounted(HLERequestContext& ctx) {
|
void IHidServer::IsVibrationDeviceMounted(HLERequestContext& ctx) {
|
||||||
@ -1788,61 +1795,10 @@ void IHidServer::IsVibrationDeviceMounted(HLERequestContext& ctx) {
|
|||||||
parameters.vibration_device_handle.npad_id,
|
parameters.vibration_device_handle.npad_id,
|
||||||
parameters.vibration_device_handle.device_index, parameters.applet_resource_user_id);
|
parameters.vibration_device_handle.device_index, parameters.applet_resource_user_id);
|
||||||
|
|
||||||
bool is_mounted{};
|
|
||||||
NpadVibrationBase* device{nullptr};
|
|
||||||
Result result = IsVibrationHandleValid(parameters.vibration_device_handle);
|
|
||||||
|
|
||||||
if (result.IsSuccess()) {
|
|
||||||
device = GetResourceManager()->GetVibrationDevice(parameters.vibration_device_handle);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (device != nullptr) {
|
|
||||||
is_mounted = device->IsVibrationMounted();
|
|
||||||
}
|
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 3};
|
IPC::ResponseBuilder rb{ctx, 3};
|
||||||
rb.Push(result);
|
rb.Push(ResultSuccess);
|
||||||
rb.Push(is_mounted);
|
rb.Push(GetResourceManager()->GetNpad()->IsVibrationDeviceMounted(
|
||||||
}
|
parameters.applet_resource_user_id, parameters.vibration_device_handle));
|
||||||
|
|
||||||
void IHidServer::SendVibrationValueInBool(HLERequestContext& ctx) {
|
|
||||||
IPC::RequestParser rp{ctx};
|
|
||||||
struct Parameters {
|
|
||||||
Core::HID::VibrationDeviceHandle vibration_device_handle;
|
|
||||||
INSERT_PADDING_WORDS_NOINIT(1);
|
|
||||||
u64 applet_resource_user_id;
|
|
||||||
bool is_vibrating;
|
|
||||||
};
|
|
||||||
static_assert(sizeof(Parameters) == 0x18, "Parameters has incorrect size.");
|
|
||||||
|
|
||||||
const auto parameters{rp.PopRaw<Parameters>()};
|
|
||||||
|
|
||||||
LOG_DEBUG(Service_HID,
|
|
||||||
"called, npad_type={}, npad_id={}, device_index={}, applet_resource_user_id={}, "
|
|
||||||
"is_vibrating={}",
|
|
||||||
parameters.vibration_device_handle.npad_type,
|
|
||||||
parameters.vibration_device_handle.npad_id,
|
|
||||||
parameters.vibration_device_handle.device_index, parameters.applet_resource_user_id,
|
|
||||||
parameters.is_vibrating);
|
|
||||||
|
|
||||||
bool has_active_aruid{};
|
|
||||||
NpadN64VibrationDevice* n64_device{nullptr};
|
|
||||||
Result result = GetResourceManager()->IsVibrationAruidActive(parameters.applet_resource_user_id,
|
|
||||||
has_active_aruid);
|
|
||||||
|
|
||||||
if (result.IsSuccess() && has_active_aruid) {
|
|
||||||
result = IsVibrationHandleValid(parameters.vibration_device_handle);
|
|
||||||
}
|
|
||||||
if (result.IsSuccess() && has_active_aruid) {
|
|
||||||
n64_device =
|
|
||||||
GetResourceManager()->GetN64VibrationDevice(parameters.vibration_device_handle);
|
|
||||||
}
|
|
||||||
if (n64_device != nullptr) {
|
|
||||||
result = n64_device->SendValueInBool(parameters.is_vibrating);
|
|
||||||
}
|
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
|
||||||
rb.Push(result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void IHidServer::ActivateConsoleSixAxisSensor(HLERequestContext& ctx) {
|
void IHidServer::ActivateConsoleSixAxisSensor(HLERequestContext& ctx) {
|
||||||
|
@ -97,7 +97,6 @@ private:
|
|||||||
void BeginPermitVibrationSession(HLERequestContext& ctx);
|
void BeginPermitVibrationSession(HLERequestContext& ctx);
|
||||||
void EndPermitVibrationSession(HLERequestContext& ctx);
|
void EndPermitVibrationSession(HLERequestContext& ctx);
|
||||||
void IsVibrationDeviceMounted(HLERequestContext& ctx);
|
void IsVibrationDeviceMounted(HLERequestContext& ctx);
|
||||||
void SendVibrationValueInBool(HLERequestContext& ctx);
|
|
||||||
void ActivateConsoleSixAxisSensor(HLERequestContext& ctx);
|
void ActivateConsoleSixAxisSensor(HLERequestContext& ctx);
|
||||||
void StartConsoleSixAxisSensor(HLERequestContext& ctx);
|
void StartConsoleSixAxisSensor(HLERequestContext& ctx);
|
||||||
void StopConsoleSixAxisSensor(HLERequestContext& ctx);
|
void StopConsoleSixAxisSensor(HLERequestContext& ctx);
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
#include "hid_core/resource_manager.h"
|
#include "hid_core/resource_manager.h"
|
||||||
#include "hid_core/resources/npad/npad.h"
|
#include "hid_core/resources/npad/npad.h"
|
||||||
#include "hid_core/resources/npad/npad_types.h"
|
#include "hid_core/resources/npad/npad_types.h"
|
||||||
#include "hid_core/resources/npad/npad_vibration.h"
|
|
||||||
#include "hid_core/resources/palma/palma.h"
|
#include "hid_core/resources/palma/palma.h"
|
||||||
#include "hid_core/resources/touch_screen/touch_screen.h"
|
#include "hid_core/resources/touch_screen/touch_screen.h"
|
||||||
|
|
||||||
@ -68,14 +67,14 @@ IHidSystemServer::IHidSystemServer(Core::System& system_, std::shared_ptr<Resour
|
|||||||
{501, &IHidSystemServer::RegisterAppletResourceUserId, "RegisterAppletResourceUserId"},
|
{501, &IHidSystemServer::RegisterAppletResourceUserId, "RegisterAppletResourceUserId"},
|
||||||
{502, &IHidSystemServer::UnregisterAppletResourceUserId, "UnregisterAppletResourceUserId"},
|
{502, &IHidSystemServer::UnregisterAppletResourceUserId, "UnregisterAppletResourceUserId"},
|
||||||
{503, &IHidSystemServer::EnableAppletToGetInput, "EnableAppletToGetInput"},
|
{503, &IHidSystemServer::EnableAppletToGetInput, "EnableAppletToGetInput"},
|
||||||
{504, &IHidSystemServer::SetAruidValidForVibration, "SetAruidValidForVibration"},
|
{504, nullptr, "SetAruidValidForVibration"},
|
||||||
{505, &IHidSystemServer::EnableAppletToGetSixAxisSensor, "EnableAppletToGetSixAxisSensor"},
|
{505, &IHidSystemServer::EnableAppletToGetSixAxisSensor, "EnableAppletToGetSixAxisSensor"},
|
||||||
{506, &IHidSystemServer::EnableAppletToGetPadInput, "EnableAppletToGetPadInput"},
|
{506, &IHidSystemServer::EnableAppletToGetPadInput, "EnableAppletToGetPadInput"},
|
||||||
{507, &IHidSystemServer::EnableAppletToGetTouchScreen, "EnableAppletToGetTouchScreen"},
|
{507, &IHidSystemServer::EnableAppletToGetTouchScreen, "EnableAppletToGetTouchScreen"},
|
||||||
{510, &IHidSystemServer::SetVibrationMasterVolume, "SetVibrationMasterVolume"},
|
{510, nullptr, "SetVibrationMasterVolume"},
|
||||||
{511, &IHidSystemServer::GetVibrationMasterVolume, "GetVibrationMasterVolume"},
|
{511, nullptr, "GetVibrationMasterVolume"},
|
||||||
{512, &IHidSystemServer::BeginPermitVibrationSession, "BeginPermitVibrationSession"},
|
{512, nullptr, "BeginPermitVibrationSession"},
|
||||||
{513, &IHidSystemServer::EndPermitVibrationSession, "EndPermitVibrationSession"},
|
{513, nullptr, "EndPermitVibrationSession"},
|
||||||
{514, nullptr, "Unknown514"},
|
{514, nullptr, "Unknown514"},
|
||||||
{520, nullptr, "EnableHandheldHids"},
|
{520, nullptr, "EnableHandheldHids"},
|
||||||
{521, nullptr, "DisableHandheldHids"},
|
{521, nullptr, "DisableHandheldHids"},
|
||||||
@ -157,7 +156,7 @@ IHidSystemServer::IHidSystemServer(Core::System& system_, std::shared_ptr<Resour
|
|||||||
{1152, nullptr, "SetTouchScreenDefaultConfiguration"},
|
{1152, nullptr, "SetTouchScreenDefaultConfiguration"},
|
||||||
{1153, &IHidSystemServer::GetTouchScreenDefaultConfiguration, "GetTouchScreenDefaultConfiguration"},
|
{1153, &IHidSystemServer::GetTouchScreenDefaultConfiguration, "GetTouchScreenDefaultConfiguration"},
|
||||||
{1154, nullptr, "IsFirmwareAvailableForNotification"},
|
{1154, nullptr, "IsFirmwareAvailableForNotification"},
|
||||||
{1155, &IHidSystemServer::SetForceHandheldStyleVibration, "SetForceHandheldStyleVibration"},
|
{1155, nullptr, "SetForceHandheldStyleVibration"},
|
||||||
{1156, nullptr, "SendConnectionTriggerWithoutTimeoutEvent"},
|
{1156, nullptr, "SendConnectionTriggerWithoutTimeoutEvent"},
|
||||||
{1157, nullptr, "CancelConnectionTrigger"},
|
{1157, nullptr, "CancelConnectionTrigger"},
|
||||||
{1200, nullptr, "IsButtonConfigSupported"},
|
{1200, nullptr, "IsButtonConfigSupported"},
|
||||||
@ -539,27 +538,6 @@ void IHidSystemServer::EnableAppletToGetInput(HLERequestContext& ctx) {
|
|||||||
rb.Push(ResultSuccess);
|
rb.Push(ResultSuccess);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IHidSystemServer::SetAruidValidForVibration(HLERequestContext& ctx) {
|
|
||||||
IPC::RequestParser rp{ctx};
|
|
||||||
struct Parameters {
|
|
||||||
bool is_enabled;
|
|
||||||
INSERT_PADDING_WORDS_NOINIT(1);
|
|
||||||
u64 applet_resource_user_id;
|
|
||||||
};
|
|
||||||
static_assert(sizeof(Parameters) == 0x10, "Parameters has incorrect size.");
|
|
||||||
|
|
||||||
const auto parameters{rp.PopRaw<Parameters>()};
|
|
||||||
|
|
||||||
LOG_INFO(Service_HID, "called, is_enabled={}, applet_resource_user_id={}",
|
|
||||||
parameters.is_enabled, parameters.applet_resource_user_id);
|
|
||||||
|
|
||||||
GetResourceManager()->SetAruidValidForVibration(parameters.applet_resource_user_id,
|
|
||||||
parameters.is_enabled);
|
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
|
||||||
rb.Push(ResultSuccess);
|
|
||||||
}
|
|
||||||
|
|
||||||
void IHidSystemServer::EnableAppletToGetSixAxisSensor(HLERequestContext& ctx) {
|
void IHidSystemServer::EnableAppletToGetSixAxisSensor(HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp{ctx};
|
IPC::RequestParser rp{ctx};
|
||||||
struct Parameters {
|
struct Parameters {
|
||||||
@ -623,57 +601,6 @@ void IHidSystemServer::EnableAppletToGetTouchScreen(HLERequestContext& ctx) {
|
|||||||
rb.Push(ResultSuccess);
|
rb.Push(ResultSuccess);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IHidSystemServer::SetVibrationMasterVolume(HLERequestContext& ctx) {
|
|
||||||
IPC::RequestParser rp{ctx};
|
|
||||||
const auto master_volume{rp.Pop<f32>()};
|
|
||||||
|
|
||||||
LOG_INFO(Service_HID, "called, volume={}", master_volume);
|
|
||||||
|
|
||||||
const auto result =
|
|
||||||
GetResourceManager()->GetNpad()->GetVibrationHandler()->SetVibrationMasterVolume(
|
|
||||||
master_volume);
|
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
|
||||||
rb.Push(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
void IHidSystemServer::GetVibrationMasterVolume(HLERequestContext& ctx) {
|
|
||||||
f32 master_volume{};
|
|
||||||
const auto result =
|
|
||||||
GetResourceManager()->GetNpad()->GetVibrationHandler()->GetVibrationMasterVolume(
|
|
||||||
master_volume);
|
|
||||||
|
|
||||||
LOG_INFO(Service_HID, "called, volume={}", master_volume);
|
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 3};
|
|
||||||
rb.Push(result);
|
|
||||||
rb.Push(master_volume);
|
|
||||||
}
|
|
||||||
|
|
||||||
void IHidSystemServer::BeginPermitVibrationSession(HLERequestContext& ctx) {
|
|
||||||
IPC::RequestParser rp{ctx};
|
|
||||||
const auto applet_resource_user_id{rp.Pop<u64>()};
|
|
||||||
|
|
||||||
LOG_INFO(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id);
|
|
||||||
|
|
||||||
const auto result =
|
|
||||||
GetResourceManager()->GetNpad()->GetVibrationHandler()->BeginPermitVibrationSession(
|
|
||||||
applet_resource_user_id);
|
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
|
||||||
rb.Push(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
void IHidSystemServer::EndPermitVibrationSession(HLERequestContext& ctx) {
|
|
||||||
LOG_INFO(Service_HID, "called");
|
|
||||||
|
|
||||||
const auto result =
|
|
||||||
GetResourceManager()->GetNpad()->GetVibrationHandler()->EndPermitVibrationSession();
|
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
|
||||||
rb.Push(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
void IHidSystemServer::IsJoyConAttachedOnAllRail(HLERequestContext& ctx) {
|
void IHidSystemServer::IsJoyConAttachedOnAllRail(HLERequestContext& ctx) {
|
||||||
const bool is_attached = true;
|
const bool is_attached = true;
|
||||||
|
|
||||||
@ -822,19 +749,6 @@ void IHidSystemServer::GetTouchScreenDefaultConfiguration(HLERequestContext& ctx
|
|||||||
rb.PushRaw(touchscreen_config);
|
rb.PushRaw(touchscreen_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IHidSystemServer::SetForceHandheldStyleVibration(HLERequestContext& ctx) {
|
|
||||||
IPC::RequestParser rp{ctx};
|
|
||||||
const auto is_forced{rp.Pop<bool>()};
|
|
||||||
|
|
||||||
LOG_INFO(Service_HID, "called, is_forced={}", is_forced);
|
|
||||||
|
|
||||||
GetResourceManager()->SetForceHandheldStyleVibration(is_forced);
|
|
||||||
GetResourceManager()->GetNpad()->UpdateHandheldAbstractState();
|
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
|
||||||
rb.Push(ResultSuccess);
|
|
||||||
}
|
|
||||||
|
|
||||||
void IHidSystemServer::IsUsingCustomButtonConfig(HLERequestContext& ctx) {
|
void IHidSystemServer::IsUsingCustomButtonConfig(HLERequestContext& ctx) {
|
||||||
const bool is_enabled = false;
|
const bool is_enabled = false;
|
||||||
|
|
||||||
|
@ -42,14 +42,9 @@ private:
|
|||||||
void RegisterAppletResourceUserId(HLERequestContext& ctx);
|
void RegisterAppletResourceUserId(HLERequestContext& ctx);
|
||||||
void UnregisterAppletResourceUserId(HLERequestContext& ctx);
|
void UnregisterAppletResourceUserId(HLERequestContext& ctx);
|
||||||
void EnableAppletToGetInput(HLERequestContext& ctx);
|
void EnableAppletToGetInput(HLERequestContext& ctx);
|
||||||
void SetAruidValidForVibration(HLERequestContext& ctx);
|
|
||||||
void EnableAppletToGetSixAxisSensor(HLERequestContext& ctx);
|
void EnableAppletToGetSixAxisSensor(HLERequestContext& ctx);
|
||||||
void EnableAppletToGetPadInput(HLERequestContext& ctx);
|
void EnableAppletToGetPadInput(HLERequestContext& ctx);
|
||||||
void EnableAppletToGetTouchScreen(HLERequestContext& ctx);
|
void EnableAppletToGetTouchScreen(HLERequestContext& ctx);
|
||||||
void SetVibrationMasterVolume(HLERequestContext& ctx);
|
|
||||||
void GetVibrationMasterVolume(HLERequestContext& ctx);
|
|
||||||
void BeginPermitVibrationSession(HLERequestContext& ctx);
|
|
||||||
void EndPermitVibrationSession(HLERequestContext& ctx);
|
|
||||||
void IsJoyConAttachedOnAllRail(HLERequestContext& ctx);
|
void IsJoyConAttachedOnAllRail(HLERequestContext& ctx);
|
||||||
void AcquireConnectionTriggerTimeoutEvent(HLERequestContext& ctx);
|
void AcquireConnectionTriggerTimeoutEvent(HLERequestContext& ctx);
|
||||||
void AcquireDeviceRegisteredEventForControllerSupport(HLERequestContext& ctx);
|
void AcquireDeviceRegisteredEventForControllerSupport(HLERequestContext& ctx);
|
||||||
@ -66,7 +61,6 @@ private:
|
|||||||
void FinalizeUsbFirmwareUpdate(HLERequestContext& ctx);
|
void FinalizeUsbFirmwareUpdate(HLERequestContext& ctx);
|
||||||
void InitializeUsbFirmwareUpdateWithoutMemory(HLERequestContext& ctx);
|
void InitializeUsbFirmwareUpdateWithoutMemory(HLERequestContext& ctx);
|
||||||
void GetTouchScreenDefaultConfiguration(HLERequestContext& ctx);
|
void GetTouchScreenDefaultConfiguration(HLERequestContext& ctx);
|
||||||
void SetForceHandheldStyleVibration(HLERequestContext& ctx);
|
|
||||||
void IsUsingCustomButtonConfig(HLERequestContext& ctx);
|
void IsUsingCustomButtonConfig(HLERequestContext& ctx);
|
||||||
|
|
||||||
std::shared_ptr<ResourceManager> GetResourceManager();
|
std::shared_ptr<ResourceManager> GetResourceManager();
|
||||||
|
@ -441,10 +441,7 @@ Result NfcDevice::Mount(NFP::ModelType model_type, NFP::MountTarget mount_target
|
|||||||
device_state = DeviceState::TagMounted;
|
device_state = DeviceState::TagMounted;
|
||||||
mount_target = mount_target_;
|
mount_target = mount_target_;
|
||||||
|
|
||||||
const bool create_backup =
|
if (!is_corrupted && mount_target != NFP::MountTarget::Rom) {
|
||||||
mount_target == NFP::MountTarget::All || mount_target == NFP::MountTarget::Ram ||
|
|
||||||
(mount_target == NFP::MountTarget::Rom && HasBackup(encrypted_tag_data.uuid).IsError());
|
|
||||||
if (!is_corrupted && create_backup) {
|
|
||||||
std::vector<u8> data(sizeof(NFP::EncryptedNTAG215File));
|
std::vector<u8> data(sizeof(NFP::EncryptedNTAG215File));
|
||||||
memcpy(data.data(), &encrypted_tag_data, sizeof(encrypted_tag_data));
|
memcpy(data.data(), &encrypted_tag_data, sizeof(encrypted_tag_data));
|
||||||
WriteBackupData(encrypted_tag_data.uuid, data);
|
WriteBackupData(encrypted_tag_data.uuid, data);
|
||||||
|
@ -16,8 +16,9 @@
|
|||||||
|
|
||||||
namespace Service::Nvidia::NvCore {
|
namespace Service::Nvidia::NvCore {
|
||||||
|
|
||||||
Session::Session(SessionId id_, Kernel::KProcess* process_, Core::Asid asid_)
|
Session::Session(size_t id_, Kernel::KProcess* process_, size_t smmu_id_)
|
||||||
: id{id_}, process{process_}, asid{asid_}, has_preallocated_area{}, mapper{}, is_active{} {}
|
: id{id_}, process{process_}, smmu_id{smmu_id_},
|
||||||
|
has_preallocated_area{}, mapper{}, is_active{} {}
|
||||||
|
|
||||||
Session::~Session() = default;
|
Session::~Session() = default;
|
||||||
|
|
||||||
@ -40,9 +41,7 @@ Container::Container(Tegra::Host1x::Host1x& host1x_) {
|
|||||||
|
|
||||||
Container::~Container() = default;
|
Container::~Container() = default;
|
||||||
|
|
||||||
SessionId Container::OpenSession(Kernel::KProcess* process) {
|
size_t Container::OpenSession(Kernel::KProcess* process) {
|
||||||
using namespace Common::Literals;
|
|
||||||
|
|
||||||
std::scoped_lock lk(impl->session_guard);
|
std::scoped_lock lk(impl->session_guard);
|
||||||
for (auto& session : impl->sessions) {
|
for (auto& session : impl->sessions) {
|
||||||
if (!session.is_active) {
|
if (!session.is_active) {
|
||||||
@ -55,14 +54,14 @@ SessionId Container::OpenSession(Kernel::KProcess* process) {
|
|||||||
size_t new_id{};
|
size_t new_id{};
|
||||||
auto* memory_interface = &process->GetMemory();
|
auto* memory_interface = &process->GetMemory();
|
||||||
auto& smmu = impl->host1x.MemoryManager();
|
auto& smmu = impl->host1x.MemoryManager();
|
||||||
auto asid = smmu.RegisterProcess(memory_interface);
|
auto smmu_id = smmu.RegisterProcess(memory_interface);
|
||||||
if (!impl->id_pool.empty()) {
|
if (!impl->id_pool.empty()) {
|
||||||
new_id = impl->id_pool.front();
|
new_id = impl->id_pool.front();
|
||||||
impl->id_pool.pop_front();
|
impl->id_pool.pop_front();
|
||||||
impl->sessions[new_id] = Session{SessionId{new_id}, process, asid};
|
impl->sessions[new_id] = Session{new_id, process, smmu_id};
|
||||||
} else {
|
} else {
|
||||||
new_id = impl->new_ids++;
|
new_id = impl->new_ids++;
|
||||||
impl->sessions.emplace_back(SessionId{new_id}, process, asid);
|
impl->sessions.emplace_back(new_id, process, smmu_id);
|
||||||
}
|
}
|
||||||
auto& session = impl->sessions[new_id];
|
auto& session = impl->sessions[new_id];
|
||||||
session.is_active = true;
|
session.is_active = true;
|
||||||
@ -81,7 +80,7 @@ SessionId Container::OpenSession(Kernel::KProcess* process) {
|
|||||||
cur_addr));
|
cur_addr));
|
||||||
auto svc_mem_info = mem_info.GetSvcMemoryInfo();
|
auto svc_mem_info = mem_info.GetSvcMemoryInfo();
|
||||||
|
|
||||||
// Check if this memory block is heap.
|
// check if this memory block is heap
|
||||||
if (svc_mem_info.state == Kernel::Svc::MemoryState::Normal) {
|
if (svc_mem_info.state == Kernel::Svc::MemoryState::Normal) {
|
||||||
if (svc_mem_info.size > region_size) {
|
if (svc_mem_info.size > region_size) {
|
||||||
region_size = svc_mem_info.size;
|
region_size = svc_mem_info.size;
|
||||||
@ -98,21 +97,21 @@ SessionId Container::OpenSession(Kernel::KProcess* process) {
|
|||||||
cur_addr = next_address;
|
cur_addr = next_address;
|
||||||
}
|
}
|
||||||
session.has_preallocated_area = false;
|
session.has_preallocated_area = false;
|
||||||
auto start_region = region_size >= 32_MiB ? smmu.Allocate(region_size) : 0;
|
auto start_region = (region_size >> 15) >= 1024 ? smmu.Allocate(region_size) : 0;
|
||||||
if (start_region != 0) {
|
if (start_region != 0) {
|
||||||
session.mapper = std::make_unique<HeapMapper>(region_start, start_region, region_size,
|
session.mapper = std::make_unique<HeapMapper>(region_start, start_region, region_size,
|
||||||
asid, impl->host1x);
|
smmu_id, impl->host1x);
|
||||||
smmu.TrackContinuity(start_region, region_start, region_size, asid);
|
smmu.TrackContinuity(start_region, region_start, region_size, smmu_id);
|
||||||
session.has_preallocated_area = true;
|
session.has_preallocated_area = true;
|
||||||
LOG_DEBUG(Debug, "Preallocation created!");
|
LOG_CRITICAL(Debug, "Preallocation created!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return SessionId{new_id};
|
return new_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Container::CloseSession(SessionId session_id) {
|
void Container::CloseSession(size_t id) {
|
||||||
std::scoped_lock lk(impl->session_guard);
|
std::scoped_lock lk(impl->session_guard);
|
||||||
auto& session = impl->sessions[session_id.id];
|
auto& session = impl->sessions[id];
|
||||||
auto& smmu = impl->host1x.MemoryManager();
|
auto& smmu = impl->host1x.MemoryManager();
|
||||||
if (session.has_preallocated_area) {
|
if (session.has_preallocated_area) {
|
||||||
const DAddr region_start = session.mapper->GetRegionStart();
|
const DAddr region_start = session.mapper->GetRegionStart();
|
||||||
@ -122,13 +121,13 @@ void Container::CloseSession(SessionId session_id) {
|
|||||||
session.has_preallocated_area = false;
|
session.has_preallocated_area = false;
|
||||||
}
|
}
|
||||||
session.is_active = false;
|
session.is_active = false;
|
||||||
smmu.UnregisterProcess(impl->sessions[session_id.id].asid);
|
smmu.UnregisterProcess(impl->sessions[id].smmu_id);
|
||||||
impl->id_pool.emplace_front(session_id.id);
|
impl->id_pool.emplace_front(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
Session* Container::GetSession(SessionId session_id) {
|
Session* Container::GetSession(size_t id) {
|
||||||
std::atomic_thread_fence(std::memory_order_acquire);
|
std::atomic_thread_fence(std::memory_order_acquire);
|
||||||
return &impl->sessions[session_id.id];
|
return &impl->sessions[id];
|
||||||
}
|
}
|
||||||
|
|
||||||
NvMap& Container::GetNvMapFile() {
|
NvMap& Container::GetNvMapFile() {
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
#include "core/device_memory_manager.h"
|
|
||||||
#include "core/hle/service/nvdrv/nvdata.h"
|
#include "core/hle/service/nvdrv/nvdata.h"
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
@ -27,12 +26,8 @@ class SyncpointManager;
|
|||||||
|
|
||||||
struct ContainerImpl;
|
struct ContainerImpl;
|
||||||
|
|
||||||
struct SessionId {
|
|
||||||
size_t id;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Session {
|
struct Session {
|
||||||
Session(SessionId id_, Kernel::KProcess* process_, Core::Asid asid_);
|
Session(size_t id_, Kernel::KProcess* process_, size_t smmu_id_);
|
||||||
~Session();
|
~Session();
|
||||||
|
|
||||||
Session(const Session&) = delete;
|
Session(const Session&) = delete;
|
||||||
@ -40,9 +35,9 @@ struct Session {
|
|||||||
Session(Session&&) = default;
|
Session(Session&&) = default;
|
||||||
Session& operator=(Session&&) = default;
|
Session& operator=(Session&&) = default;
|
||||||
|
|
||||||
SessionId id;
|
size_t id;
|
||||||
Kernel::KProcess* process;
|
Kernel::KProcess* process;
|
||||||
Core::Asid asid;
|
size_t smmu_id;
|
||||||
bool has_preallocated_area{};
|
bool has_preallocated_area{};
|
||||||
std::unique_ptr<HeapMapper> mapper{};
|
std::unique_ptr<HeapMapper> mapper{};
|
||||||
bool is_active{};
|
bool is_active{};
|
||||||
@ -53,10 +48,10 @@ public:
|
|||||||
explicit Container(Tegra::Host1x::Host1x& host1x);
|
explicit Container(Tegra::Host1x::Host1x& host1x);
|
||||||
~Container();
|
~Container();
|
||||||
|
|
||||||
SessionId OpenSession(Kernel::KProcess* process);
|
size_t OpenSession(Kernel::KProcess* process);
|
||||||
void CloseSession(SessionId id);
|
void CloseSession(size_t id);
|
||||||
|
|
||||||
Session* GetSession(SessionId id);
|
Session* GetSession(size_t id);
|
||||||
|
|
||||||
NvMap& GetNvMapFile();
|
NvMap& GetNvMapFile();
|
||||||
|
|
||||||
|
@ -109,9 +109,9 @@ struct HeapMapper::HeapMapperInternal {
|
|||||||
std::mutex guard;
|
std::mutex guard;
|
||||||
};
|
};
|
||||||
|
|
||||||
HeapMapper::HeapMapper(VAddr start_vaddress, DAddr start_daddress, size_t size, Core::Asid asid,
|
HeapMapper::HeapMapper(VAddr start_vaddress, DAddr start_daddress, size_t size, size_t smmu_id,
|
||||||
Tegra::Host1x::Host1x& host1x)
|
Tegra::Host1x::Host1x& host1x)
|
||||||
: m_vaddress{start_vaddress}, m_daddress{start_daddress}, m_size{size}, m_asid{asid} {
|
: m_vaddress{start_vaddress}, m_daddress{start_daddress}, m_size{size}, m_smmu_id{smmu_id} {
|
||||||
m_internal = std::make_unique<HeapMapperInternal>(host1x);
|
m_internal = std::make_unique<HeapMapperInternal>(host1x);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,7 +138,7 @@ DAddr HeapMapper::Map(VAddr start, size_t size) {
|
|||||||
const size_t offset = inter_addr - m_vaddress;
|
const size_t offset = inter_addr - m_vaddress;
|
||||||
const size_t sub_size = inter_addr_end - inter_addr;
|
const size_t sub_size = inter_addr_end - inter_addr;
|
||||||
m_internal->device_memory.Map(m_daddress + offset, m_vaddress + offset, sub_size,
|
m_internal->device_memory.Map(m_daddress + offset, m_vaddress + offset, sub_size,
|
||||||
m_asid);
|
m_smmu_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_internal->mapping_overlaps += std::make_pair(interval, 1);
|
m_internal->mapping_overlaps += std::make_pair(interval, 1);
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "core/device_memory_manager.h"
|
|
||||||
|
|
||||||
namespace Tegra::Host1x {
|
namespace Tegra::Host1x {
|
||||||
class Host1x;
|
class Host1x;
|
||||||
@ -16,7 +15,7 @@ namespace Service::Nvidia::NvCore {
|
|||||||
|
|
||||||
class HeapMapper {
|
class HeapMapper {
|
||||||
public:
|
public:
|
||||||
HeapMapper(VAddr start_vaddress, DAddr start_daddress, size_t size, Core::Asid asid,
|
HeapMapper(VAddr start_vaddress, DAddr start_daddress, size_t size, size_t smmu_id,
|
||||||
Tegra::Host1x::Host1x& host1x);
|
Tegra::Host1x::Host1x& host1x);
|
||||||
~HeapMapper();
|
~HeapMapper();
|
||||||
|
|
||||||
@ -42,7 +41,7 @@ private:
|
|||||||
VAddr m_vaddress;
|
VAddr m_vaddress;
|
||||||
DAddr m_daddress;
|
DAddr m_daddress;
|
||||||
size_t m_size;
|
size_t m_size;
|
||||||
Core::Asid m_asid;
|
size_t m_smmu_id;
|
||||||
std::unique_ptr<HeapMapperInternal> m_internal;
|
std::unique_ptr<HeapMapperInternal> m_internal;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -22,8 +22,7 @@ NvMap::Handle::Handle(u64 size_, Id id_)
|
|||||||
flags.raw = 0;
|
flags.raw = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult NvMap::Handle::Alloc(Flags pFlags, u32 pAlign, u8 pKind, u64 pAddress,
|
NvResult NvMap::Handle::Alloc(Flags pFlags, u32 pAlign, u8 pKind, u64 pAddress, size_t pSessionId) {
|
||||||
NvCore::SessionId pSessionId) {
|
|
||||||
std::scoped_lock lock(mutex);
|
std::scoped_lock lock(mutex);
|
||||||
// Handles cannot be allocated twice
|
// Handles cannot be allocated twice
|
||||||
if (allocated) {
|
if (allocated) {
|
||||||
@ -224,7 +223,7 @@ DAddr NvMap::PinHandle(NvMap::Handle::Id handle, bool low_area_pin) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handle_description->d_address = address;
|
handle_description->d_address = address;
|
||||||
smmu.Map(address, vaddress, map_size, session->asid, true);
|
smmu.Map(address, vaddress, map_size, session->smmu_id, true);
|
||||||
handle_description->in_heap = false;
|
handle_description->in_heap = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,6 @@
|
|||||||
|
|
||||||
#include "common/bit_field.h"
|
#include "common/bit_field.h"
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "core/hle/service/nvdrv/core/container.h"
|
|
||||||
#include "core/hle/service/nvdrv/nvdata.h"
|
#include "core/hle/service/nvdrv/nvdata.h"
|
||||||
|
|
||||||
namespace Tegra {
|
namespace Tegra {
|
||||||
@ -72,7 +71,7 @@ public:
|
|||||||
u8 kind{}; //!< Used for memory compression
|
u8 kind{}; //!< Used for memory compression
|
||||||
bool allocated{}; //!< If the handle has been allocated with `Alloc`
|
bool allocated{}; //!< If the handle has been allocated with `Alloc`
|
||||||
bool in_heap{};
|
bool in_heap{};
|
||||||
NvCore::SessionId session_id{};
|
size_t session_id{};
|
||||||
|
|
||||||
DAddr d_address{}; //!< The memory location in the device's AS that this handle corresponds
|
DAddr d_address{}; //!< The memory location in the device's AS that this handle corresponds
|
||||||
//!< to, this can also be in the nvdrv tmem
|
//!< to, this can also be in the nvdrv tmem
|
||||||
@ -84,7 +83,7 @@ public:
|
|||||||
* if a 0 address is passed
|
* if a 0 address is passed
|
||||||
*/
|
*/
|
||||||
[[nodiscard]] NvResult Alloc(Flags pFlags, u32 pAlign, u8 pKind, u64 pAddress,
|
[[nodiscard]] NvResult Alloc(Flags pFlags, u32 pAlign, u8 pKind, u64 pAddress,
|
||||||
NvCore::SessionId pSessionId);
|
size_t pSessionId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Increases the dupe counter of the handle for the given session
|
* @brief Increases the dupe counter of the handle for the given session
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "core/hle/service/nvdrv/core/container.h"
|
|
||||||
#include "core/hle/service/nvdrv/nvdata.h"
|
#include "core/hle/service/nvdrv/nvdata.h"
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
@ -63,7 +62,7 @@ public:
|
|||||||
* Called once a device is opened
|
* Called once a device is opened
|
||||||
* @param fd The device fd
|
* @param fd The device fd
|
||||||
*/
|
*/
|
||||||
virtual void OnOpen(NvCore::SessionId session_id, DeviceFD fd) = 0;
|
virtual void OnOpen(size_t session_id, DeviceFD fd) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called once a device is closed
|
* Called once a device is closed
|
||||||
|
@ -35,7 +35,7 @@ NvResult nvdisp_disp0::Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> in
|
|||||||
return NvResult::NotImplemented;
|
return NvResult::NotImplemented;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nvdisp_disp0::OnOpen(NvCore::SessionId session_id, DeviceFD fd) {}
|
void nvdisp_disp0::OnOpen(size_t session_id, DeviceFD fd) {}
|
||||||
void nvdisp_disp0::OnClose(DeviceFD fd) {}
|
void nvdisp_disp0::OnClose(DeviceFD fd) {}
|
||||||
|
|
||||||
void nvdisp_disp0::flip(u32 buffer_handle, u32 offset, android::PixelFormat format, u32 width,
|
void nvdisp_disp0::flip(u32 buffer_handle, u32 offset, android::PixelFormat format, u32 width,
|
||||||
|
@ -32,7 +32,7 @@ public:
|
|||||||
NvResult Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, std::span<u8> output,
|
NvResult Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, std::span<u8> output,
|
||||||
std::span<u8> inline_output) override;
|
std::span<u8> inline_output) override;
|
||||||
|
|
||||||
void OnOpen(NvCore::SessionId session_id, DeviceFD fd) override;
|
void OnOpen(size_t session_id, DeviceFD fd) override;
|
||||||
void OnClose(DeviceFD fd) override;
|
void OnClose(DeviceFD fd) override;
|
||||||
|
|
||||||
/// Performs a screen flip, drawing the buffer pointed to by the handle.
|
/// Performs a screen flip, drawing the buffer pointed to by the handle.
|
||||||
|
@ -86,7 +86,7 @@ NvResult nvhost_as_gpu::Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> i
|
|||||||
return NvResult::NotImplemented;
|
return NvResult::NotImplemented;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nvhost_as_gpu::OnOpen(NvCore::SessionId session_id, DeviceFD fd) {}
|
void nvhost_as_gpu::OnOpen(size_t session_id, DeviceFD fd) {}
|
||||||
void nvhost_as_gpu::OnClose(DeviceFD fd) {}
|
void nvhost_as_gpu::OnClose(DeviceFD fd) {}
|
||||||
|
|
||||||
NvResult nvhost_as_gpu::AllocAsEx(IoctlAllocAsEx& params) {
|
NvResult nvhost_as_gpu::AllocAsEx(IoctlAllocAsEx& params) {
|
||||||
|
@ -55,7 +55,7 @@ public:
|
|||||||
NvResult Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, std::span<u8> output,
|
NvResult Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, std::span<u8> output,
|
||||||
std::span<u8> inline_output) override;
|
std::span<u8> inline_output) override;
|
||||||
|
|
||||||
void OnOpen(NvCore::SessionId session_id, DeviceFD fd) override;
|
void OnOpen(size_t session_id, DeviceFD fd) override;
|
||||||
void OnClose(DeviceFD fd) override;
|
void OnClose(DeviceFD fd) override;
|
||||||
|
|
||||||
Kernel::KEvent* QueryEvent(u32 event_id) override;
|
Kernel::KEvent* QueryEvent(u32 event_id) override;
|
||||||
|
@ -76,7 +76,7 @@ NvResult nvhost_ctrl::Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> inp
|
|||||||
return NvResult::NotImplemented;
|
return NvResult::NotImplemented;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nvhost_ctrl::OnOpen(NvCore::SessionId session_id, DeviceFD fd) {}
|
void nvhost_ctrl::OnOpen(size_t session_id, DeviceFD fd) {}
|
||||||
|
|
||||||
void nvhost_ctrl::OnClose(DeviceFD fd) {}
|
void nvhost_ctrl::OnClose(DeviceFD fd) {}
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ public:
|
|||||||
NvResult Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, std::span<u8> output,
|
NvResult Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, std::span<u8> output,
|
||||||
std::span<u8> inline_output) override;
|
std::span<u8> inline_output) override;
|
||||||
|
|
||||||
void OnOpen(NvCore::SessionId session_id, DeviceFD fd) override;
|
void OnOpen(size_t session_id, DeviceFD fd) override;
|
||||||
void OnClose(DeviceFD fd) override;
|
void OnClose(DeviceFD fd) override;
|
||||||
|
|
||||||
Kernel::KEvent* QueryEvent(u32 event_id) override;
|
Kernel::KEvent* QueryEvent(u32 event_id) override;
|
||||||
|
@ -82,7 +82,7 @@ NvResult nvhost_ctrl_gpu::Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8>
|
|||||||
return NvResult::NotImplemented;
|
return NvResult::NotImplemented;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nvhost_ctrl_gpu::OnOpen(NvCore::SessionId session_id, DeviceFD fd) {}
|
void nvhost_ctrl_gpu::OnOpen(size_t session_id, DeviceFD fd) {}
|
||||||
void nvhost_ctrl_gpu::OnClose(DeviceFD fd) {}
|
void nvhost_ctrl_gpu::OnClose(DeviceFD fd) {}
|
||||||
|
|
||||||
NvResult nvhost_ctrl_gpu::GetCharacteristics1(IoctlCharacteristics& params) {
|
NvResult nvhost_ctrl_gpu::GetCharacteristics1(IoctlCharacteristics& params) {
|
||||||
|
@ -28,7 +28,7 @@ public:
|
|||||||
NvResult Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, std::span<u8> output,
|
NvResult Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, std::span<u8> output,
|
||||||
std::span<u8> inline_output) override;
|
std::span<u8> inline_output) override;
|
||||||
|
|
||||||
void OnOpen(NvCore::SessionId session_id, DeviceFD fd) override;
|
void OnOpen(size_t session_id, DeviceFD fd) override;
|
||||||
void OnClose(DeviceFD fd) override;
|
void OnClose(DeviceFD fd) override;
|
||||||
|
|
||||||
Kernel::KEvent* QueryEvent(u32 event_id) override;
|
Kernel::KEvent* QueryEvent(u32 event_id) override;
|
||||||
|
@ -120,7 +120,7 @@ NvResult nvhost_gpu::Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> inpu
|
|||||||
return NvResult::NotImplemented;
|
return NvResult::NotImplemented;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nvhost_gpu::OnOpen(NvCore::SessionId session_id, DeviceFD fd) {}
|
void nvhost_gpu::OnOpen(size_t session_id, DeviceFD fd) {}
|
||||||
void nvhost_gpu::OnClose(DeviceFD fd) {}
|
void nvhost_gpu::OnClose(DeviceFD fd) {}
|
||||||
|
|
||||||
NvResult nvhost_gpu::SetNVMAPfd(IoctlSetNvmapFD& params) {
|
NvResult nvhost_gpu::SetNVMAPfd(IoctlSetNvmapFD& params) {
|
||||||
|
@ -47,7 +47,7 @@ public:
|
|||||||
NvResult Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, std::span<u8> output,
|
NvResult Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, std::span<u8> output,
|
||||||
std::span<u8> inline_output) override;
|
std::span<u8> inline_output) override;
|
||||||
|
|
||||||
void OnOpen(NvCore::SessionId session_id, DeviceFD fd) override;
|
void OnOpen(size_t session_id, DeviceFD fd) override;
|
||||||
void OnClose(DeviceFD fd) override;
|
void OnClose(DeviceFD fd) override;
|
||||||
|
|
||||||
Kernel::KEvent* QueryEvent(u32 event_id) override;
|
Kernel::KEvent* QueryEvent(u32 event_id) override;
|
||||||
|
@ -68,7 +68,7 @@ NvResult nvhost_nvdec::Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> in
|
|||||||
return NvResult::NotImplemented;
|
return NvResult::NotImplemented;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nvhost_nvdec::OnOpen(NvCore::SessionId session_id, DeviceFD fd) {
|
void nvhost_nvdec::OnOpen(size_t session_id, DeviceFD fd) {
|
||||||
LOG_INFO(Service_NVDRV, "NVDEC video stream started");
|
LOG_INFO(Service_NVDRV, "NVDEC video stream started");
|
||||||
system.SetNVDECActive(true);
|
system.SetNVDECActive(true);
|
||||||
sessions[fd] = session_id;
|
sessions[fd] = session_id;
|
||||||
|
@ -20,7 +20,7 @@ public:
|
|||||||
NvResult Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, std::span<u8> output,
|
NvResult Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, std::span<u8> output,
|
||||||
std::span<u8> inline_output) override;
|
std::span<u8> inline_output) override;
|
||||||
|
|
||||||
void OnOpen(NvCore::SessionId session_id, DeviceFD fd) override;
|
void OnOpen(size_t session_id, DeviceFD fd) override;
|
||||||
void OnClose(DeviceFD fd) override;
|
void OnClose(DeviceFD fd) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -127,7 +127,7 @@ protected:
|
|||||||
NvCore::NvMap& nvmap;
|
NvCore::NvMap& nvmap;
|
||||||
NvCore::ChannelType channel_type;
|
NvCore::ChannelType channel_type;
|
||||||
std::array<u32, MaxSyncPoints> device_syncpoints{};
|
std::array<u32, MaxSyncPoints> device_syncpoints{};
|
||||||
std::unordered_map<DeviceFD, NvCore::SessionId> sessions;
|
std::unordered_map<DeviceFD, size_t> sessions;
|
||||||
};
|
};
|
||||||
}; // namespace Devices
|
}; // namespace Devices
|
||||||
} // namespace Service::Nvidia
|
} // namespace Service::Nvidia
|
||||||
|
@ -44,7 +44,7 @@ NvResult nvhost_nvjpg::Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> in
|
|||||||
return NvResult::NotImplemented;
|
return NvResult::NotImplemented;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nvhost_nvjpg::OnOpen(NvCore::SessionId session_id, DeviceFD fd) {}
|
void nvhost_nvjpg::OnOpen(size_t session_id, DeviceFD fd) {}
|
||||||
void nvhost_nvjpg::OnClose(DeviceFD fd) {}
|
void nvhost_nvjpg::OnClose(DeviceFD fd) {}
|
||||||
|
|
||||||
NvResult nvhost_nvjpg::SetNVMAPfd(IoctlSetNvmapFD& params) {
|
NvResult nvhost_nvjpg::SetNVMAPfd(IoctlSetNvmapFD& params) {
|
||||||
|
@ -22,7 +22,7 @@ public:
|
|||||||
NvResult Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, std::span<u8> output,
|
NvResult Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, std::span<u8> output,
|
||||||
std::span<u8> inline_output) override;
|
std::span<u8> inline_output) override;
|
||||||
|
|
||||||
void OnOpen(NvCore::SessionId session_id, DeviceFD fd) override;
|
void OnOpen(size_t session_id, DeviceFD fd) override;
|
||||||
void OnClose(DeviceFD fd) override;
|
void OnClose(DeviceFD fd) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -68,7 +68,7 @@ NvResult nvhost_vic::Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> inpu
|
|||||||
return NvResult::NotImplemented;
|
return NvResult::NotImplemented;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nvhost_vic::OnOpen(NvCore::SessionId session_id, DeviceFD fd) {
|
void nvhost_vic::OnOpen(size_t session_id, DeviceFD fd) {
|
||||||
sessions[fd] = session_id;
|
sessions[fd] = session_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,7 +78,10 @@ void nvhost_vic::OnClose(DeviceFD fd) {
|
|||||||
if (iter != host1x_file.fd_to_id.end()) {
|
if (iter != host1x_file.fd_to_id.end()) {
|
||||||
system.GPU().ClearCdmaInstance(iter->second);
|
system.GPU().ClearCdmaInstance(iter->second);
|
||||||
}
|
}
|
||||||
sessions.erase(fd);
|
auto it = sessions.find(fd);
|
||||||
|
if (it != sessions.end()) {
|
||||||
|
sessions.erase(it);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Service::Nvidia::Devices
|
} // namespace Service::Nvidia::Devices
|
||||||
|
@ -19,7 +19,7 @@ public:
|
|||||||
NvResult Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, std::span<u8> output,
|
NvResult Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, std::span<u8> output,
|
||||||
std::span<u8> inline_output) override;
|
std::span<u8> inline_output) override;
|
||||||
|
|
||||||
void OnOpen(NvCore::SessionId session_id, DeviceFD fd) override;
|
void OnOpen(size_t session_id, DeviceFD fd) override;
|
||||||
void OnClose(DeviceFD fd) override;
|
void OnClose(DeviceFD fd) override;
|
||||||
};
|
};
|
||||||
} // namespace Service::Nvidia::Devices
|
} // namespace Service::Nvidia::Devices
|
||||||
|
@ -67,7 +67,7 @@ NvResult nvmap::Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, st
|
|||||||
return NvResult::NotImplemented;
|
return NvResult::NotImplemented;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nvmap::OnOpen(NvCore::SessionId session_id, DeviceFD fd) {
|
void nvmap::OnOpen(size_t session_id, DeviceFD fd) {
|
||||||
sessions[fd] = session_id;
|
sessions[fd] = session_id;
|
||||||
}
|
}
|
||||||
void nvmap::OnClose(DeviceFD fd) {
|
void nvmap::OnClose(DeviceFD fd) {
|
||||||
|
@ -33,7 +33,7 @@ public:
|
|||||||
NvResult Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, std::span<u8> output,
|
NvResult Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, std::span<u8> output,
|
||||||
std::span<u8> inline_output) override;
|
std::span<u8> inline_output) override;
|
||||||
|
|
||||||
void OnOpen(NvCore::SessionId session_id, DeviceFD fd) override;
|
void OnOpen(size_t session_id, DeviceFD fd) override;
|
||||||
void OnClose(DeviceFD fd) override;
|
void OnClose(DeviceFD fd) override;
|
||||||
|
|
||||||
enum class HandleParameterType : u32_le {
|
enum class HandleParameterType : u32_le {
|
||||||
@ -115,7 +115,7 @@ private:
|
|||||||
|
|
||||||
NvCore::Container& container;
|
NvCore::Container& container;
|
||||||
NvCore::NvMap& file;
|
NvCore::NvMap& file;
|
||||||
std::unordered_map<DeviceFD, NvCore::SessionId> sessions;
|
std::unordered_map<DeviceFD, size_t> sessions;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Service::Nvidia::Devices
|
} // namespace Service::Nvidia::Devices
|
||||||
|
@ -52,15 +52,15 @@ void LoopProcess(Nvnflinger::Nvnflinger& nvnflinger, Core::System& system) {
|
|||||||
return std::make_shared<NVDRV>(system, module, "nvdrv:a");
|
return std::make_shared<NVDRV>(system, module, "nvdrv:a");
|
||||||
};
|
};
|
||||||
const auto NvdrvInterfaceFactoryForSysmodules = [&, module] {
|
const auto NvdrvInterfaceFactoryForSysmodules = [&, module] {
|
||||||
return std::make_shared<NVDRV>(system, module, "nvdrv:s");
|
return std::make_shared<NVDRV>(system, module, "nvdrv:a");
|
||||||
};
|
};
|
||||||
const auto NvdrvInterfaceFactoryForTesting = [&, module] {
|
const auto NvdrvInterfaceFactory = [&, module] {
|
||||||
return std::make_shared<NVDRV>(system, module, "nvdrv:t");
|
return std::make_shared<NVDRV>(system, module, "nvdrv:t");
|
||||||
};
|
};
|
||||||
server_manager->RegisterNamedService("nvdrv", NvdrvInterfaceFactoryForApplication);
|
server_manager->RegisterNamedService("nvdrv", NvdrvInterfaceFactoryForApplication);
|
||||||
server_manager->RegisterNamedService("nvdrv:a", NvdrvInterfaceFactoryForApplets);
|
server_manager->RegisterNamedService("nvdrv:a", NvdrvInterfaceFactoryForApplets);
|
||||||
server_manager->RegisterNamedService("nvdrv:s", NvdrvInterfaceFactoryForSysmodules);
|
server_manager->RegisterNamedService("nvdrv:s", NvdrvInterfaceFactoryForSysmodules);
|
||||||
server_manager->RegisterNamedService("nvdrv:t", NvdrvInterfaceFactoryForTesting);
|
server_manager->RegisterNamedService("nvdrv:t", NvdrvInterfaceFactory);
|
||||||
server_manager->RegisterNamedService("nvmemp", std::make_shared<NVMEMP>(system));
|
server_manager->RegisterNamedService("nvmemp", std::make_shared<NVMEMP>(system));
|
||||||
nvnflinger.SetNVDrvInstance(module);
|
nvnflinger.SetNVDrvInstance(module);
|
||||||
ServerManager::RunServer(std::move(server_manager));
|
ServerManager::RunServer(std::move(server_manager));
|
||||||
@ -122,7 +122,7 @@ NvResult Module::VerifyFD(DeviceFD fd) const {
|
|||||||
return NvResult::Success;
|
return NvResult::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
DeviceFD Module::Open(const std::string& device_name, NvCore::SessionId session_id) {
|
DeviceFD Module::Open(const std::string& device_name, size_t session_id) {
|
||||||
auto it = builders.find(device_name);
|
auto it = builders.find(device_name);
|
||||||
if (it == builders.end()) {
|
if (it == builders.end()) {
|
||||||
LOG_ERROR(Service_NVDRV, "Trying to open unknown device {}", device_name);
|
LOG_ERROR(Service_NVDRV, "Trying to open unknown device {}", device_name);
|
||||||
|
@ -77,7 +77,7 @@ public:
|
|||||||
NvResult VerifyFD(DeviceFD fd) const;
|
NvResult VerifyFD(DeviceFD fd) const;
|
||||||
|
|
||||||
/// Opens a device node and returns a file descriptor to it.
|
/// Opens a device node and returns a file descriptor to it.
|
||||||
DeviceFD Open(const std::string& device_name, NvCore::SessionId session_id);
|
DeviceFD Open(const std::string& device_name, size_t session_id);
|
||||||
|
|
||||||
/// Sends an ioctl command to the specified file descriptor.
|
/// Sends an ioctl command to the specified file descriptor.
|
||||||
NvResult Ioctl1(DeviceFD fd, Ioctl command, std::span<const u8> input, std::span<u8> output);
|
NvResult Ioctl1(DeviceFD fd, Ioctl command, std::span<const u8> input, std::span<u8> output);
|
||||||
|
@ -35,7 +35,7 @@ private:
|
|||||||
|
|
||||||
u64 pid{};
|
u64 pid{};
|
||||||
bool is_initialized{};
|
bool is_initialized{};
|
||||||
NvCore::SessionId session_id{};
|
size_t session_id{};
|
||||||
Common::ScratchBuffer<u8> output_buffer;
|
Common::ScratchBuffer<u8> output_buffer;
|
||||||
Common::ScratchBuffer<u8> inline_output_buffer;
|
Common::ScratchBuffer<u8> inline_output_buffer;
|
||||||
};
|
};
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "common/math_util.h"
|
#include "common/math_util.h"
|
||||||
#include "core/hle/service/nvdrv/core/container.h"
|
|
||||||
#include "core/hle/service/nvdrv/nvdata.h"
|
#include "core/hle/service/nvdrv/nvdata.h"
|
||||||
#include "core/hle/service/nvnflinger/nvnflinger.h"
|
#include "core/hle/service/nvnflinger/nvnflinger.h"
|
||||||
#include "core/hle/service/nvnflinger/ui/fence.h"
|
#include "core/hle/service/nvnflinger/ui/fence.h"
|
||||||
@ -56,7 +55,7 @@ private:
|
|||||||
u32 m_buffer_nvmap_handle = 0;
|
u32 m_buffer_nvmap_handle = 0;
|
||||||
SharedMemoryPoolLayout m_pool_layout = {};
|
SharedMemoryPoolLayout m_pool_layout = {};
|
||||||
Nvidia::DeviceFD m_nvmap_fd = {};
|
Nvidia::DeviceFD m_nvmap_fd = {};
|
||||||
Nvidia::NvCore::SessionId m_session_id = {};
|
size_t m_session_id = {};
|
||||||
std::unique_ptr<Kernel::KPageGroup> m_buffer_page_group;
|
std::unique_ptr<Kernel::KPageGroup> m_buffer_page_group;
|
||||||
|
|
||||||
std::mutex m_guard;
|
std::mutex m_guard;
|
||||||
|
@ -112,7 +112,9 @@ void Nvnflinger::ShutdownLayers() {
|
|||||||
{
|
{
|
||||||
const auto lock_guard = Lock();
|
const auto lock_guard = Lock();
|
||||||
for (auto& display : displays) {
|
for (auto& display : displays) {
|
||||||
display.Abandon();
|
for (size_t layer = 0; layer < display.GetNumLayers(); ++layer) {
|
||||||
|
display.GetLayer(layer).GetConsumer().Abandon();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
is_abandoned = true;
|
is_abandoned = true;
|
||||||
@ -124,7 +126,7 @@ void Nvnflinger::ShutdownLayers() {
|
|||||||
|
|
||||||
void Nvnflinger::SetNVDrvInstance(std::shared_ptr<Nvidia::Module> instance) {
|
void Nvnflinger::SetNVDrvInstance(std::shared_ptr<Nvidia::Module> instance) {
|
||||||
nvdrv = std::move(instance);
|
nvdrv = std::move(instance);
|
||||||
disp_fd = nvdrv->Open("/dev/nvdisp_disp0", {});
|
disp_fd = nvdrv->Open("/dev/nvdisp_disp0", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<u64> Nvnflinger::OpenDisplay(std::string_view name) {
|
std::optional<u64> Nvnflinger::OpenDisplay(std::string_view name) {
|
||||||
@ -174,28 +176,24 @@ void Nvnflinger::CreateLayerAtId(VI::Display& display, u64 layer_id) {
|
|||||||
display.CreateLayer(layer_id, buffer_id, nvdrv->container);
|
display.CreateLayer(layer_id, buffer_id, nvdrv->container);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Nvnflinger::OpenLayer(u64 layer_id) {
|
void Nvnflinger::OpenLayer(u64 layer_id) {
|
||||||
const auto lock_guard = Lock();
|
const auto lock_guard = Lock();
|
||||||
|
|
||||||
for (auto& display : displays) {
|
for (auto& display : displays) {
|
||||||
if (auto* layer = display.FindLayer(layer_id); layer) {
|
if (auto* layer = display.FindLayer(layer_id); layer) {
|
||||||
return layer->Open();
|
layer->Open();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
void Nvnflinger::CloseLayer(u64 layer_id) {
|
||||||
}
|
|
||||||
|
|
||||||
bool Nvnflinger::CloseLayer(u64 layer_id) {
|
|
||||||
const auto lock_guard = Lock();
|
const auto lock_guard = Lock();
|
||||||
|
|
||||||
for (auto& display : displays) {
|
for (auto& display : displays) {
|
||||||
if (auto* layer = display.FindLayer(layer_id); layer) {
|
if (auto* layer = display.FindLayer(layer_id); layer) {
|
||||||
return layer->Close();
|
layer->Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Nvnflinger::DestroyLayer(u64 layer_id) {
|
void Nvnflinger::DestroyLayer(u64 layer_id) {
|
||||||
|
@ -74,10 +74,10 @@ public:
|
|||||||
[[nodiscard]] std::optional<u64> CreateLayer(u64 display_id);
|
[[nodiscard]] std::optional<u64> CreateLayer(u64 display_id);
|
||||||
|
|
||||||
/// Opens a layer on all displays for the given layer ID.
|
/// Opens a layer on all displays for the given layer ID.
|
||||||
bool OpenLayer(u64 layer_id);
|
void OpenLayer(u64 layer_id);
|
||||||
|
|
||||||
/// Closes a layer on all displays for the given layer ID.
|
/// Closes a layer on all displays for the given layer ID.
|
||||||
bool CloseLayer(u64 layer_id);
|
void CloseLayer(u64 layer_id);
|
||||||
|
|
||||||
/// Destroys the given layer ID.
|
/// Destroys the given layer ID.
|
||||||
void DestroyLayer(u64 layer_id);
|
void DestroyLayer(u64 layer_id);
|
||||||
|
@ -1,16 +1,12 @@
|
|||||||
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#include "core/hle/service/set/setting_formats/appln_settings.h"
|
#include "core/hle/service/set/appln_settings.h"
|
||||||
|
|
||||||
namespace Service::Set {
|
namespace Service::Set {
|
||||||
|
|
||||||
ApplnSettings DefaultApplnSettings() {
|
ApplnSettings DefaultApplnSettings() {
|
||||||
ApplnSettings settings{};
|
return {};
|
||||||
|
|
||||||
settings.mii_author_id = Common::UUID::MakeDefault();
|
|
||||||
|
|
||||||
return settings;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Service::Set
|
} // namespace Service::Set
|
@ -7,23 +7,24 @@
|
|||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "common/uuid.h"
|
|
||||||
#include "core/hle/service/set/settings_types.h"
|
|
||||||
|
|
||||||
namespace Service::Set {
|
namespace Service::Set {
|
||||||
struct ApplnSettings {
|
struct ApplnSettings {
|
||||||
INSERT_PADDING_BYTES(0x10); // Reserved
|
std::array<u8, 0x10> reserved_000;
|
||||||
|
|
||||||
// nn::util::Uuid MiiAuthorId, copied from system settings 0x94B0
|
// nn::util::Uuid MiiAuthorId, copied from system settings 0x94B0
|
||||||
Common::UUID mii_author_id;
|
std::array<u8, 0x10> mii_author_id;
|
||||||
INSERT_PADDING_BYTES(0x30); // Reserved
|
|
||||||
|
std::array<u8, 0x30> reserved_020;
|
||||||
|
|
||||||
// nn::settings::system::ServiceDiscoveryControlSettings
|
// nn::settings::system::ServiceDiscoveryControlSettings
|
||||||
u32 service_discovery_control_settings;
|
std::array<u8, 0x4> service_discovery_control_settings;
|
||||||
INSERT_PADDING_BYTES(0x20); // Reserved
|
|
||||||
|
std::array<u8, 0x20> reserved_054;
|
||||||
|
|
||||||
bool in_repair_process_enable_flag;
|
bool in_repair_process_enable_flag;
|
||||||
INSERT_PADDING_BYTES(0x3);
|
|
||||||
|
std::array<u8, 0x3> pad_075;
|
||||||
};
|
};
|
||||||
static_assert(offsetof(ApplnSettings, mii_author_id) == 0x10);
|
static_assert(offsetof(ApplnSettings, mii_author_id) == 0x10);
|
||||||
static_assert(offsetof(ApplnSettings, service_discovery_control_settings) == 0x50);
|
static_assert(offsetof(ApplnSettings, service_discovery_control_settings) == 0x50);
|
@ -1,7 +1,7 @@
|
|||||||
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#include "core/hle/service/set/setting_formats/device_settings.h"
|
#include "core/hle/service/set/device_settings.h"
|
||||||
|
|
||||||
namespace Service::Set {
|
namespace Service::Set {
|
||||||
|
|
@ -7,12 +7,10 @@
|
|||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "common/vector_math.h"
|
|
||||||
#include "core/hle/service/set/settings_types.h"
|
|
||||||
|
|
||||||
namespace Service::Set {
|
namespace Service::Set {
|
||||||
struct DeviceSettings {
|
struct DeviceSettings {
|
||||||
INSERT_PADDING_BYTES(0x10); // Reserved
|
std::array<u8, 0x10> reserved_000;
|
||||||
|
|
||||||
// nn::settings::BatteryLot
|
// nn::settings::BatteryLot
|
||||||
std::array<u8, 0x18> ptm_battery_lot;
|
std::array<u8, 0x18> ptm_battery_lot;
|
||||||
@ -21,24 +19,26 @@ struct DeviceSettings {
|
|||||||
u8 ptm_battery_version;
|
u8 ptm_battery_version;
|
||||||
// nn::settings::system::PtmCycleCountReliability
|
// nn::settings::system::PtmCycleCountReliability
|
||||||
u32 ptm_cycle_count_reliability;
|
u32 ptm_cycle_count_reliability;
|
||||||
INSERT_PADDING_BYTES(0x48); // Reserved
|
|
||||||
|
std::array<u8, 0x48> reserved_048;
|
||||||
|
|
||||||
// nn::settings::system::AnalogStickUserCalibration L
|
// nn::settings::system::AnalogStickUserCalibration L
|
||||||
std::array<u8, 0x10> analog_user_stick_calibration_l;
|
std::array<u8, 0x10> analog_user_stick_calibration_l;
|
||||||
// nn::settings::system::AnalogStickUserCalibration R
|
// nn::settings::system::AnalogStickUserCalibration R
|
||||||
std::array<u8, 0x10> analog_user_stick_calibration_r;
|
std::array<u8, 0x10> analog_user_stick_calibration_r;
|
||||||
INSERT_PADDING_BYTES(0x20); // Reserved
|
|
||||||
|
std::array<u8, 0x20> reserved_0B0;
|
||||||
|
|
||||||
// nn::settings::system::ConsoleSixAxisSensorAccelerationBias
|
// nn::settings::system::ConsoleSixAxisSensorAccelerationBias
|
||||||
Common::Vec3<f32> console_six_axis_sensor_acceleration_bias;
|
std::array<u8, 0xC> console_six_axis_sensor_acceleration_bias;
|
||||||
// nn::settings::system::ConsoleSixAxisSensorAngularVelocityBias
|
// nn::settings::system::ConsoleSixAxisSensorAngularVelocityBias
|
||||||
Common::Vec3<f32> console_six_axis_sensor_angular_velocity_bias;
|
std::array<u8, 0xC> console_six_axis_sensor_angular_velocity_bias;
|
||||||
// nn::settings::system::ConsoleSixAxisSensorAccelerationGain
|
// nn::settings::system::ConsoleSixAxisSensorAccelerationGain
|
||||||
std::array<u8, 0x24> console_six_axis_sensor_acceleration_gain;
|
std::array<u8, 0x24> console_six_axis_sensor_acceleration_gain;
|
||||||
// nn::settings::system::ConsoleSixAxisSensorAngularVelocityGain
|
// nn::settings::system::ConsoleSixAxisSensorAngularVelocityGain
|
||||||
std::array<u8, 0x24> console_six_axis_sensor_angular_velocity_gain;
|
std::array<u8, 0x24> console_six_axis_sensor_angular_velocity_gain;
|
||||||
// nn::settings::system::ConsoleSixAxisSensorAngularVelocityTimeBias
|
// nn::settings::system::ConsoleSixAxisSensorAngularVelocityTimeBias
|
||||||
Common::Vec3<f32> console_six_axis_sensor_angular_velocity_time_bias;
|
std::array<u8, 0xC> console_six_axis_sensor_angular_velocity_time_bias;
|
||||||
// nn::settings::system::ConsoleSixAxisSensorAngularAcceleration
|
// nn::settings::system::ConsoleSixAxisSensorAngularAcceleration
|
||||||
std::array<u8, 0x24> console_six_axis_sensor_angular_acceleration;
|
std::array<u8, 0x24> console_six_axis_sensor_angular_acceleration;
|
||||||
};
|
};
|
@ -1,7 +1,7 @@
|
|||||||
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#include "core/hle/service/set/setting_formats/private_settings.h"
|
#include "core/hle/service/set/private_settings.h"
|
||||||
|
|
||||||
namespace Service::Set {
|
namespace Service::Set {
|
||||||
|
|
72
src/core/hle/service/set/private_settings.h
Normal file
72
src/core/hle/service/set/private_settings.h
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <array>
|
||||||
|
|
||||||
|
#include "common/bit_field.h"
|
||||||
|
#include "common/common_funcs.h"
|
||||||
|
#include "common/common_types.h"
|
||||||
|
#include "common/uuid.h"
|
||||||
|
#include "core/hle/service/time/clock_types.h"
|
||||||
|
|
||||||
|
namespace Service::Set {
|
||||||
|
|
||||||
|
/// This is nn::settings::system::InitialLaunchFlag
|
||||||
|
struct InitialLaunchFlag {
|
||||||
|
union {
|
||||||
|
u32 raw{};
|
||||||
|
|
||||||
|
BitField<0, 1, u32> InitialLaunchCompletionFlag;
|
||||||
|
BitField<8, 1, u32> InitialLaunchUserAdditionFlag;
|
||||||
|
BitField<16, 1, u32> InitialLaunchTimestampFlag;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
static_assert(sizeof(InitialLaunchFlag) == 4, "InitialLaunchFlag is an invalid size");
|
||||||
|
|
||||||
|
/// This is nn::settings::system::InitialLaunchSettings
|
||||||
|
struct InitialLaunchSettings {
|
||||||
|
InitialLaunchFlag flags;
|
||||||
|
INSERT_PADDING_BYTES(0x4);
|
||||||
|
Service::Time::Clock::SteadyClockTimePoint timestamp;
|
||||||
|
};
|
||||||
|
static_assert(sizeof(InitialLaunchSettings) == 0x20, "InitialLaunchSettings is incorrect size");
|
||||||
|
|
||||||
|
#pragma pack(push, 4)
|
||||||
|
struct InitialLaunchSettingsPacked {
|
||||||
|
InitialLaunchFlag flags;
|
||||||
|
Service::Time::Clock::SteadyClockTimePoint timestamp;
|
||||||
|
};
|
||||||
|
#pragma pack(pop)
|
||||||
|
static_assert(sizeof(InitialLaunchSettingsPacked) == 0x1C,
|
||||||
|
"InitialLaunchSettingsPacked is incorrect size");
|
||||||
|
|
||||||
|
struct PrivateSettings {
|
||||||
|
std::array<u8, 0x10> reserved_00;
|
||||||
|
|
||||||
|
// nn::settings::system::InitialLaunchSettings
|
||||||
|
InitialLaunchSettings initial_launch_settings;
|
||||||
|
|
||||||
|
std::array<u8, 0x20> reserved_30;
|
||||||
|
|
||||||
|
Common::UUID external_clock_source_id;
|
||||||
|
s64 shutdown_rtc_value;
|
||||||
|
s64 external_steady_clock_internal_offset;
|
||||||
|
|
||||||
|
std::array<u8, 0x60> reserved_70;
|
||||||
|
|
||||||
|
// nn::settings::system::PlatformRegion
|
||||||
|
std::array<u8, 0x4> platform_region;
|
||||||
|
|
||||||
|
std::array<u8, 0x4> reserved_D4;
|
||||||
|
};
|
||||||
|
static_assert(offsetof(PrivateSettings, initial_launch_settings) == 0x10);
|
||||||
|
static_assert(offsetof(PrivateSettings, external_clock_source_id) == 0x50);
|
||||||
|
static_assert(offsetof(PrivateSettings, reserved_70) == 0x70);
|
||||||
|
static_assert(offsetof(PrivateSettings, platform_region) == 0xD0);
|
||||||
|
static_assert(sizeof(PrivateSettings) == 0xD8, "PrivateSettings has the wrong size!");
|
||||||
|
|
||||||
|
PrivateSettings DefaultPrivateSettings();
|
||||||
|
|
||||||
|
} // namespace Service::Set
|
@ -1,39 +0,0 @@
|
|||||||
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <array>
|
|
||||||
|
|
||||||
#include "common/common_types.h"
|
|
||||||
#include "common/uuid.h"
|
|
||||||
#include "core/hle/service/set/settings_types.h"
|
|
||||||
#include "core/hle/service/time/clock_types.h"
|
|
||||||
|
|
||||||
namespace Service::Set {
|
|
||||||
|
|
||||||
struct PrivateSettings {
|
|
||||||
INSERT_PADDING_BYTES(0x10); // Reserved
|
|
||||||
|
|
||||||
InitialLaunchSettings initial_launch_settings;
|
|
||||||
INSERT_PADDING_BYTES(0x20); // Reserved
|
|
||||||
|
|
||||||
Common::UUID external_clock_source_id;
|
|
||||||
s64 shutdown_rtc_value;
|
|
||||||
s64 external_steady_clock_internal_offset;
|
|
||||||
INSERT_PADDING_BYTES(0x60); // Reserved
|
|
||||||
|
|
||||||
// nn::settings::system::PlatformRegion
|
|
||||||
s32 platform_region;
|
|
||||||
INSERT_PADDING_BYTES(0x4); // Reserved
|
|
||||||
};
|
|
||||||
static_assert(offsetof(PrivateSettings, initial_launch_settings) == 0x10);
|
|
||||||
static_assert(offsetof(PrivateSettings, external_clock_source_id) == 0x50);
|
|
||||||
static_assert(offsetof(PrivateSettings, shutdown_rtc_value) == 0x60);
|
|
||||||
static_assert(offsetof(PrivateSettings, external_steady_clock_internal_offset) == 0x68);
|
|
||||||
static_assert(offsetof(PrivateSettings, platform_region) == 0xD0);
|
|
||||||
static_assert(sizeof(PrivateSettings) == 0xD8, "PrivateSettings has the wrong size!");
|
|
||||||
|
|
||||||
PrivateSettings DefaultPrivateSettings();
|
|
||||||
|
|
||||||
} // namespace Service::Set
|
|
@ -4,13 +4,72 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "core/hle/service/service.h"
|
#include "core/hle/service/service.h"
|
||||||
#include "core/hle/service/set/settings_types.h"
|
#include "core/hle/service/set/system_settings.h"
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
class System;
|
class System;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Service::Set {
|
namespace Service::Set {
|
||||||
|
enum class KeyboardLayout : u64 {
|
||||||
|
Japanese = 0,
|
||||||
|
EnglishUs = 1,
|
||||||
|
EnglishUsInternational = 2,
|
||||||
|
EnglishUk = 3,
|
||||||
|
French = 4,
|
||||||
|
FrenchCa = 5,
|
||||||
|
Spanish = 6,
|
||||||
|
SpanishLatin = 7,
|
||||||
|
German = 8,
|
||||||
|
Italian = 9,
|
||||||
|
Portuguese = 10,
|
||||||
|
Russian = 11,
|
||||||
|
Korean = 12,
|
||||||
|
ChineseSimplified = 13,
|
||||||
|
ChineseTraditional = 14,
|
||||||
|
};
|
||||||
|
|
||||||
|
constexpr std::array<LanguageCode, 18> available_language_codes = {{
|
||||||
|
LanguageCode::JA,
|
||||||
|
LanguageCode::EN_US,
|
||||||
|
LanguageCode::FR,
|
||||||
|
LanguageCode::DE,
|
||||||
|
LanguageCode::IT,
|
||||||
|
LanguageCode::ES,
|
||||||
|
LanguageCode::ZH_CN,
|
||||||
|
LanguageCode::KO,
|
||||||
|
LanguageCode::NL,
|
||||||
|
LanguageCode::PT,
|
||||||
|
LanguageCode::RU,
|
||||||
|
LanguageCode::ZH_TW,
|
||||||
|
LanguageCode::EN_GB,
|
||||||
|
LanguageCode::FR_CA,
|
||||||
|
LanguageCode::ES_419,
|
||||||
|
LanguageCode::ZH_HANS,
|
||||||
|
LanguageCode::ZH_HANT,
|
||||||
|
LanguageCode::PT_BR,
|
||||||
|
}};
|
||||||
|
|
||||||
|
static constexpr std::array<std::pair<LanguageCode, KeyboardLayout>, 18> language_to_layout{{
|
||||||
|
{LanguageCode::JA, KeyboardLayout::Japanese},
|
||||||
|
{LanguageCode::EN_US, KeyboardLayout::EnglishUs},
|
||||||
|
{LanguageCode::FR, KeyboardLayout::French},
|
||||||
|
{LanguageCode::DE, KeyboardLayout::German},
|
||||||
|
{LanguageCode::IT, KeyboardLayout::Italian},
|
||||||
|
{LanguageCode::ES, KeyboardLayout::Spanish},
|
||||||
|
{LanguageCode::ZH_CN, KeyboardLayout::ChineseSimplified},
|
||||||
|
{LanguageCode::KO, KeyboardLayout::Korean},
|
||||||
|
{LanguageCode::NL, KeyboardLayout::EnglishUsInternational},
|
||||||
|
{LanguageCode::PT, KeyboardLayout::Portuguese},
|
||||||
|
{LanguageCode::RU, KeyboardLayout::Russian},
|
||||||
|
{LanguageCode::ZH_TW, KeyboardLayout::ChineseTraditional},
|
||||||
|
{LanguageCode::EN_GB, KeyboardLayout::EnglishUk},
|
||||||
|
{LanguageCode::FR_CA, KeyboardLayout::FrenchCa},
|
||||||
|
{LanguageCode::ES_419, KeyboardLayout::SpanishLatin},
|
||||||
|
{LanguageCode::ZH_HANS, KeyboardLayout::ChineseSimplified},
|
||||||
|
{LanguageCode::ZH_HANT, KeyboardLayout::ChineseTraditional},
|
||||||
|
{LanguageCode::PT_BR, KeyboardLayout::Portuguese},
|
||||||
|
}};
|
||||||
|
|
||||||
LanguageCode GetLanguageCodeFromIndex(std::size_t idx);
|
LanguageCode GetLanguageCodeFromIndex(std::size_t idx);
|
||||||
|
|
||||||
|
@ -1,451 +0,0 @@
|
|||||||
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
|
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <array>
|
|
||||||
|
|
||||||
#include "common/bit_field.h"
|
|
||||||
#include "common/common_funcs.h"
|
|
||||||
#include "common/common_types.h"
|
|
||||||
#include "common/uuid.h"
|
|
||||||
#include "core/hle/service/time/clock_types.h"
|
|
||||||
|
|
||||||
namespace Service::Set {
|
|
||||||
|
|
||||||
/// This is nn::settings::system::AudioOutputMode
|
|
||||||
enum class AudioOutputMode : u32 {
|
|
||||||
ch_1,
|
|
||||||
ch_2,
|
|
||||||
ch_5_1,
|
|
||||||
ch_7_1,
|
|
||||||
};
|
|
||||||
|
|
||||||
/// This is nn::settings::system::AudioOutputModeTarget
|
|
||||||
enum class AudioOutputModeTarget : u32 {
|
|
||||||
Hdmi,
|
|
||||||
Speaker,
|
|
||||||
Headphone,
|
|
||||||
};
|
|
||||||
|
|
||||||
/// This is nn::settings::system::AudioVolumeTarget
|
|
||||||
enum class AudioVolumeTarget : u32 {
|
|
||||||
Speaker,
|
|
||||||
Headphone,
|
|
||||||
};
|
|
||||||
|
|
||||||
/// This is nn::settings::system::ClockSourceId
|
|
||||||
enum class ClockSourceId : u32 {
|
|
||||||
NetworkSystemClock,
|
|
||||||
SteadyClock,
|
|
||||||
};
|
|
||||||
|
|
||||||
/// This is nn::settings::system::CmuMode
|
|
||||||
enum class CmuMode : u32 {
|
|
||||||
None,
|
|
||||||
ColorInvert,
|
|
||||||
HighContrast,
|
|
||||||
GrayScale,
|
|
||||||
};
|
|
||||||
|
|
||||||
/// This is nn::settings::system::ChineseTraditionalInputMethod
|
|
||||||
enum class ChineseTraditionalInputMethod : u32 {
|
|
||||||
Unknown0 = 0,
|
|
||||||
Unknown1 = 1,
|
|
||||||
Unknown2 = 2,
|
|
||||||
};
|
|
||||||
|
|
||||||
/// Indicates the current theme set by the system settings
|
|
||||||
enum class ColorSet : u32 {
|
|
||||||
BasicWhite = 0,
|
|
||||||
BasicBlack = 1,
|
|
||||||
};
|
|
||||||
|
|
||||||
/// This is nn::settings::system::ConsoleSleepPlan
|
|
||||||
enum class ConsoleSleepPlan : u32 {
|
|
||||||
Sleep1Hour,
|
|
||||||
Sleep2Hour,
|
|
||||||
Sleep3Hour,
|
|
||||||
Sleep6Hour,
|
|
||||||
Sleep12Hour,
|
|
||||||
Never,
|
|
||||||
};
|
|
||||||
|
|
||||||
/// This is nn::settings::system::ErrorReportSharePermission
|
|
||||||
enum class ErrorReportSharePermission : u32 {
|
|
||||||
NotConfirmed,
|
|
||||||
Granted,
|
|
||||||
Denied,
|
|
||||||
};
|
|
||||||
|
|
||||||
/// This is nn::settings::system::EulaVersionClockType
|
|
||||||
enum class EulaVersionClockType : u32 {
|
|
||||||
NetworkSystemClock,
|
|
||||||
SteadyClock,
|
|
||||||
};
|
|
||||||
|
|
||||||
/// This is nn::settings::factory::RegionCode
|
|
||||||
enum class FactoryRegionCode : u32 {
|
|
||||||
Japan,
|
|
||||||
Usa,
|
|
||||||
Europe,
|
|
||||||
Australia,
|
|
||||||
China,
|
|
||||||
Korea,
|
|
||||||
Taiwan,
|
|
||||||
};
|
|
||||||
|
|
||||||
/// This is nn::settings::system::FriendPresenceOverlayPermission
|
|
||||||
enum class FriendPresenceOverlayPermission : u8 {
|
|
||||||
NotConfirmed,
|
|
||||||
NoDisplay,
|
|
||||||
FavoriteFriends,
|
|
||||||
Friends,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class GetFirmwareVersionType {
|
|
||||||
Version1,
|
|
||||||
Version2,
|
|
||||||
};
|
|
||||||
|
|
||||||
/// This is nn::settings::system::HandheldSleepPlan
|
|
||||||
enum class HandheldSleepPlan : u32 {
|
|
||||||
Sleep1Min,
|
|
||||||
Sleep3Min,
|
|
||||||
Sleep5Min,
|
|
||||||
Sleep10Min,
|
|
||||||
Sleep30Min,
|
|
||||||
Never,
|
|
||||||
};
|
|
||||||
|
|
||||||
/// This is nn::settings::system::HdmiContentType
|
|
||||||
enum class HdmiContentType : u32 {
|
|
||||||
None,
|
|
||||||
Graphics,
|
|
||||||
Cinema,
|
|
||||||
Photo,
|
|
||||||
Game,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class KeyboardLayout : u32 {
|
|
||||||
Japanese = 0,
|
|
||||||
EnglishUs = 1,
|
|
||||||
EnglishUsInternational = 2,
|
|
||||||
EnglishUk = 3,
|
|
||||||
French = 4,
|
|
||||||
FrenchCa = 5,
|
|
||||||
Spanish = 6,
|
|
||||||
SpanishLatin = 7,
|
|
||||||
German = 8,
|
|
||||||
Italian = 9,
|
|
||||||
Portuguese = 10,
|
|
||||||
Russian = 11,
|
|
||||||
Korean = 12,
|
|
||||||
ChineseSimplified = 13,
|
|
||||||
ChineseTraditional = 14,
|
|
||||||
};
|
|
||||||
|
|
||||||
/// This is "nn::settings::LanguageCode", which is a NUL-terminated string stored in a u64.
|
|
||||||
enum class LanguageCode : u64 {
|
|
||||||
JA = 0x000000000000616A,
|
|
||||||
EN_US = 0x00000053552D6E65,
|
|
||||||
FR = 0x0000000000007266,
|
|
||||||
DE = 0x0000000000006564,
|
|
||||||
IT = 0x0000000000007469,
|
|
||||||
ES = 0x0000000000007365,
|
|
||||||
ZH_CN = 0x0000004E432D687A,
|
|
||||||
KO = 0x0000000000006F6B,
|
|
||||||
NL = 0x0000000000006C6E,
|
|
||||||
PT = 0x0000000000007470,
|
|
||||||
RU = 0x0000000000007572,
|
|
||||||
ZH_TW = 0x00000057542D687A,
|
|
||||||
EN_GB = 0x00000042472D6E65,
|
|
||||||
FR_CA = 0x00000041432D7266,
|
|
||||||
ES_419 = 0x00003931342D7365,
|
|
||||||
ZH_HANS = 0x00736E61482D687A,
|
|
||||||
ZH_HANT = 0x00746E61482D687A,
|
|
||||||
PT_BR = 0x00000052422D7470,
|
|
||||||
};
|
|
||||||
|
|
||||||
/// This is nn::settings::system::NotificationVolume
|
|
||||||
enum class NotificationVolume : u32 {
|
|
||||||
Mute,
|
|
||||||
Low,
|
|
||||||
High,
|
|
||||||
};
|
|
||||||
|
|
||||||
/// This is nn::settings::system::PrimaryAlbumStorage
|
|
||||||
enum class PrimaryAlbumStorage : u32 {
|
|
||||||
Nand,
|
|
||||||
SdCard,
|
|
||||||
};
|
|
||||||
|
|
||||||
/// Indicates the current console is a retail or kiosk unit
|
|
||||||
enum class QuestFlag : u8 {
|
|
||||||
Retail = 0,
|
|
||||||
Kiosk = 1,
|
|
||||||
};
|
|
||||||
|
|
||||||
/// This is nn::settings::system::RgbRange
|
|
||||||
enum class RgbRange : u32 {
|
|
||||||
Auto,
|
|
||||||
Full,
|
|
||||||
Limited,
|
|
||||||
};
|
|
||||||
|
|
||||||
/// This is nn::settings::system::RegionCode
|
|
||||||
enum class SystemRegionCode : u32 {
|
|
||||||
Japan,
|
|
||||||
Usa,
|
|
||||||
Europe,
|
|
||||||
Australia,
|
|
||||||
HongKongTaiwanKorea,
|
|
||||||
China,
|
|
||||||
};
|
|
||||||
|
|
||||||
/// This is nn::settings::system::TouchScreenMode
|
|
||||||
enum class TouchScreenMode : u32 {
|
|
||||||
Stylus,
|
|
||||||
Standard,
|
|
||||||
};
|
|
||||||
|
|
||||||
/// This is nn::settings::system::TvResolution
|
|
||||||
enum class TvResolution : u32 {
|
|
||||||
Auto,
|
|
||||||
Resolution1080p,
|
|
||||||
Resolution720p,
|
|
||||||
Resolution480p,
|
|
||||||
};
|
|
||||||
|
|
||||||
constexpr std::array<LanguageCode, 18> available_language_codes = {{
|
|
||||||
LanguageCode::JA,
|
|
||||||
LanguageCode::EN_US,
|
|
||||||
LanguageCode::FR,
|
|
||||||
LanguageCode::DE,
|
|
||||||
LanguageCode::IT,
|
|
||||||
LanguageCode::ES,
|
|
||||||
LanguageCode::ZH_CN,
|
|
||||||
LanguageCode::KO,
|
|
||||||
LanguageCode::NL,
|
|
||||||
LanguageCode::PT,
|
|
||||||
LanguageCode::RU,
|
|
||||||
LanguageCode::ZH_TW,
|
|
||||||
LanguageCode::EN_GB,
|
|
||||||
LanguageCode::FR_CA,
|
|
||||||
LanguageCode::ES_419,
|
|
||||||
LanguageCode::ZH_HANS,
|
|
||||||
LanguageCode::ZH_HANT,
|
|
||||||
LanguageCode::PT_BR,
|
|
||||||
}};
|
|
||||||
|
|
||||||
static constexpr std::array<std::pair<LanguageCode, KeyboardLayout>, 18> language_to_layout{{
|
|
||||||
{LanguageCode::JA, KeyboardLayout::Japanese},
|
|
||||||
{LanguageCode::EN_US, KeyboardLayout::EnglishUs},
|
|
||||||
{LanguageCode::FR, KeyboardLayout::French},
|
|
||||||
{LanguageCode::DE, KeyboardLayout::German},
|
|
||||||
{LanguageCode::IT, KeyboardLayout::Italian},
|
|
||||||
{LanguageCode::ES, KeyboardLayout::Spanish},
|
|
||||||
{LanguageCode::ZH_CN, KeyboardLayout::ChineseSimplified},
|
|
||||||
{LanguageCode::KO, KeyboardLayout::Korean},
|
|
||||||
{LanguageCode::NL, KeyboardLayout::EnglishUsInternational},
|
|
||||||
{LanguageCode::PT, KeyboardLayout::Portuguese},
|
|
||||||
{LanguageCode::RU, KeyboardLayout::Russian},
|
|
||||||
{LanguageCode::ZH_TW, KeyboardLayout::ChineseTraditional},
|
|
||||||
{LanguageCode::EN_GB, KeyboardLayout::EnglishUk},
|
|
||||||
{LanguageCode::FR_CA, KeyboardLayout::FrenchCa},
|
|
||||||
{LanguageCode::ES_419, KeyboardLayout::SpanishLatin},
|
|
||||||
{LanguageCode::ZH_HANS, KeyboardLayout::ChineseSimplified},
|
|
||||||
{LanguageCode::ZH_HANT, KeyboardLayout::ChineseTraditional},
|
|
||||||
{LanguageCode::PT_BR, KeyboardLayout::Portuguese},
|
|
||||||
}};
|
|
||||||
|
|
||||||
/// This is nn::settings::system::AccountNotificationFlag
|
|
||||||
struct AccountNotificationFlag {
|
|
||||||
union {
|
|
||||||
u32 raw{};
|
|
||||||
|
|
||||||
BitField<0, 1, u32> FriendOnlineFlag;
|
|
||||||
BitField<1, 1, u32> FriendRequestFlag;
|
|
||||||
BitField<8, 1, u32> CoralInvitationFlag;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
static_assert(sizeof(AccountNotificationFlag) == 4, "AccountNotificationFlag is an invalid size");
|
|
||||||
|
|
||||||
/// This is nn::settings::system::AccountSettings
|
|
||||||
struct AccountSettings {
|
|
||||||
u32 flags;
|
|
||||||
};
|
|
||||||
static_assert(sizeof(AccountSettings) == 4, "AccountSettings is an invalid size");
|
|
||||||
|
|
||||||
/// This is nn::settings::system::DataDeletionFlag
|
|
||||||
struct DataDeletionFlag {
|
|
||||||
union {
|
|
||||||
u32 raw{};
|
|
||||||
|
|
||||||
BitField<0, 1, u32> AutomaticDeletionFlag;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
static_assert(sizeof(DataDeletionFlag) == 4, "DataDeletionFlag is an invalid size");
|
|
||||||
|
|
||||||
/// This is nn::settings::system::InitialLaunchFlag
|
|
||||||
struct InitialLaunchFlag {
|
|
||||||
union {
|
|
||||||
u32 raw{};
|
|
||||||
|
|
||||||
BitField<0, 1, u32> InitialLaunchCompletionFlag;
|
|
||||||
BitField<8, 1, u32> InitialLaunchUserAdditionFlag;
|
|
||||||
BitField<16, 1, u32> InitialLaunchTimestampFlag;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
static_assert(sizeof(InitialLaunchFlag) == 4, "InitialLaunchFlag is an invalid size");
|
|
||||||
|
|
||||||
/// This is nn::settings::system::SleepFlag
|
|
||||||
struct SleepFlag {
|
|
||||||
union {
|
|
||||||
u32 raw{};
|
|
||||||
|
|
||||||
BitField<0, 1, u32> SleepsWhilePlayingMedia;
|
|
||||||
BitField<1, 1, u32> WakesAtPowerStateChange;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
static_assert(sizeof(SleepFlag) == 4, "TvFlag is an invalid size");
|
|
||||||
|
|
||||||
/// This is nn::settings::system::NotificationFlag
|
|
||||||
struct NotificationFlag {
|
|
||||||
union {
|
|
||||||
u32 raw{};
|
|
||||||
|
|
||||||
BitField<0, 1, u32> RingtoneFlag;
|
|
||||||
BitField<1, 1, u32> DownloadCompletionFlag;
|
|
||||||
BitField<8, 1, u32> EnablesNews;
|
|
||||||
BitField<9, 1, u32> IncomingLampFlag;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
static_assert(sizeof(NotificationFlag) == 4, "NotificationFlag is an invalid size");
|
|
||||||
|
|
||||||
/// This is nn::settings::system::TvFlag
|
|
||||||
struct TvFlag {
|
|
||||||
union {
|
|
||||||
u32 raw{};
|
|
||||||
|
|
||||||
BitField<0, 1, u32> Allows4k;
|
|
||||||
BitField<1, 1, u32> Allows3d;
|
|
||||||
BitField<2, 1, u32> AllowsCec;
|
|
||||||
BitField<3, 1, u32> PreventsScreenBurnIn;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
static_assert(sizeof(TvFlag) == 4, "TvFlag is an invalid size");
|
|
||||||
|
|
||||||
/// This is nn::settings::system::UserSelectorFlag
|
|
||||||
struct UserSelectorFlag {
|
|
||||||
union {
|
|
||||||
u32 raw{};
|
|
||||||
|
|
||||||
BitField<0, 1, u32> SkipIfSingleUser;
|
|
||||||
BitField<31, 1, u32> Unknown;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
static_assert(sizeof(UserSelectorFlag) == 4, "UserSelectorFlag is an invalid size");
|
|
||||||
|
|
||||||
/// This is nn::settings::system::AccountNotificationSettings
|
|
||||||
struct AccountNotificationSettings {
|
|
||||||
Common::UUID uid;
|
|
||||||
AccountNotificationFlag flags;
|
|
||||||
FriendPresenceOverlayPermission friend_presence_permission;
|
|
||||||
FriendPresenceOverlayPermission friend_invitation_permission;
|
|
||||||
INSERT_PADDING_BYTES(0x2);
|
|
||||||
};
|
|
||||||
static_assert(sizeof(AccountNotificationSettings) == 0x18,
|
|
||||||
"AccountNotificationSettings is an invalid size");
|
|
||||||
|
|
||||||
/// This is nn::settings::system::EulaVersion
|
|
||||||
struct EulaVersion {
|
|
||||||
u32 version;
|
|
||||||
SystemRegionCode region_code;
|
|
||||||
EulaVersionClockType clock_type;
|
|
||||||
INSERT_PADDING_BYTES(0x4);
|
|
||||||
s64 posix_time;
|
|
||||||
Time::Clock::SteadyClockTimePoint timestamp;
|
|
||||||
};
|
|
||||||
static_assert(sizeof(EulaVersion) == 0x30, "EulaVersion is incorrect size");
|
|
||||||
|
|
||||||
struct FirmwareVersionFormat {
|
|
||||||
u8 major;
|
|
||||||
u8 minor;
|
|
||||||
u8 micro;
|
|
||||||
INSERT_PADDING_BYTES(1);
|
|
||||||
u8 revision_major;
|
|
||||||
u8 revision_minor;
|
|
||||||
INSERT_PADDING_BYTES(2);
|
|
||||||
std::array<char, 0x20> platform;
|
|
||||||
std::array<u8, 0x40> version_hash;
|
|
||||||
std::array<char, 0x18> display_version;
|
|
||||||
std::array<char, 0x80> display_title;
|
|
||||||
};
|
|
||||||
static_assert(sizeof(FirmwareVersionFormat) == 0x100, "FirmwareVersionFormat is an invalid size");
|
|
||||||
|
|
||||||
/// This is nn::settings::system::HomeMenuScheme
|
|
||||||
struct HomeMenuScheme {
|
|
||||||
u32 main;
|
|
||||||
u32 back;
|
|
||||||
u32 sub;
|
|
||||||
u32 bezel;
|
|
||||||
u32 extra;
|
|
||||||
};
|
|
||||||
static_assert(sizeof(HomeMenuScheme) == 0x14, "HomeMenuScheme is incorrect size");
|
|
||||||
|
|
||||||
/// This is nn::settings::system::InitialLaunchSettings
|
|
||||||
struct InitialLaunchSettings {
|
|
||||||
InitialLaunchFlag flags;
|
|
||||||
INSERT_PADDING_BYTES(0x4);
|
|
||||||
Service::Time::Clock::SteadyClockTimePoint timestamp;
|
|
||||||
};
|
|
||||||
static_assert(sizeof(InitialLaunchSettings) == 0x20, "InitialLaunchSettings is incorrect size");
|
|
||||||
|
|
||||||
#pragma pack(push, 4)
|
|
||||||
struct InitialLaunchSettingsPacked {
|
|
||||||
InitialLaunchFlag flags;
|
|
||||||
Service::Time::Clock::SteadyClockTimePoint timestamp;
|
|
||||||
};
|
|
||||||
#pragma pack(pop)
|
|
||||||
static_assert(sizeof(InitialLaunchSettingsPacked) == 0x1C,
|
|
||||||
"InitialLaunchSettingsPacked is incorrect size");
|
|
||||||
|
|
||||||
/// This is nn::settings::system::NotificationTime
|
|
||||||
struct NotificationTime {
|
|
||||||
u32 hour;
|
|
||||||
u32 minute;
|
|
||||||
};
|
|
||||||
static_assert(sizeof(NotificationTime) == 0x8, "NotificationTime is an invalid size");
|
|
||||||
|
|
||||||
/// This is nn::settings::system::NotificationSettings
|
|
||||||
struct NotificationSettings {
|
|
||||||
NotificationFlag flags;
|
|
||||||
NotificationVolume volume;
|
|
||||||
NotificationTime start_time;
|
|
||||||
NotificationTime stop_time;
|
|
||||||
};
|
|
||||||
static_assert(sizeof(NotificationSettings) == 0x18, "NotificationSettings is an invalid size");
|
|
||||||
|
|
||||||
/// This is nn::settings::system::SleepSettings
|
|
||||||
struct SleepSettings {
|
|
||||||
SleepFlag flags;
|
|
||||||
HandheldSleepPlan handheld_sleep_plan;
|
|
||||||
ConsoleSleepPlan console_sleep_plan;
|
|
||||||
};
|
|
||||||
static_assert(sizeof(SleepSettings) == 0xc, "SleepSettings is incorrect size");
|
|
||||||
|
|
||||||
/// This is nn::settings::system::TvSettings
|
|
||||||
struct TvSettings {
|
|
||||||
TvFlag flags;
|
|
||||||
TvResolution tv_resolution;
|
|
||||||
HdmiContentType hdmi_content_type;
|
|
||||||
RgbRange rgb_range;
|
|
||||||
CmuMode cmu_mode;
|
|
||||||
u32 tv_underscan;
|
|
||||||
f32 tv_gama;
|
|
||||||
f32 contrast_ratio;
|
|
||||||
};
|
|
||||||
static_assert(sizeof(TvSettings) == 0x20, "TvSettings is an invalid size");
|
|
||||||
|
|
||||||
} // namespace Service::Set
|
|
@ -1,7 +1,7 @@
|
|||||||
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#include "core/hle/service/set/setting_formats/system_settings.h"
|
#include "core/hle/service/set/system_settings.h"
|
||||||
|
|
||||||
namespace Service::Set {
|
namespace Service::Set {
|
||||||
|
|
||||||
@ -11,8 +11,6 @@ SystemSettings DefaultSystemSettings() {
|
|||||||
settings.version = 0x140000;
|
settings.version = 0x140000;
|
||||||
settings.flags = 7;
|
settings.flags = 7;
|
||||||
|
|
||||||
settings.mii_author_id = Common::UUID::MakeDefault();
|
|
||||||
|
|
||||||
settings.color_set_id = ColorSet::BasicWhite;
|
settings.color_set_id = ColorSet::BasicWhite;
|
||||||
|
|
||||||
settings.notification_settings = {
|
settings.notification_settings = {
|
||||||
@ -47,10 +45,6 @@ SystemSettings DefaultSystemSettings() {
|
|||||||
settings.device_time_zone_location_name = {"UTC"};
|
settings.device_time_zone_location_name = {"UTC"};
|
||||||
settings.user_system_clock_automatic_correction_enabled = false;
|
settings.user_system_clock_automatic_correction_enabled = false;
|
||||||
|
|
||||||
settings.primary_album_storage = PrimaryAlbumStorage::SdCard;
|
|
||||||
settings.battery_percentage_flag = true;
|
|
||||||
settings.chinese_traditional_input_method = ChineseTraditionalInputMethod::Unknown0;
|
|
||||||
|
|
||||||
return settings;
|
return settings;
|
||||||
}
|
}
|
||||||
|
|
@ -8,14 +8,272 @@
|
|||||||
#include "common/bit_field.h"
|
#include "common/bit_field.h"
|
||||||
#include "common/common_funcs.h"
|
#include "common/common_funcs.h"
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "common/uuid.h"
|
#include "core/hle/service/set/private_settings.h"
|
||||||
#include "common/vector_math.h"
|
|
||||||
#include "core/hle/service/set/setting_formats/private_settings.h"
|
|
||||||
#include "core/hle/service/set/settings_types.h"
|
|
||||||
#include "core/hle/service/time/clock_types.h"
|
#include "core/hle/service/time/clock_types.h"
|
||||||
|
|
||||||
namespace Service::Set {
|
namespace Service::Set {
|
||||||
|
|
||||||
|
/// This is "nn::settings::LanguageCode", which is a NUL-terminated string stored in a u64.
|
||||||
|
enum class LanguageCode : u64 {
|
||||||
|
JA = 0x000000000000616A,
|
||||||
|
EN_US = 0x00000053552D6E65,
|
||||||
|
FR = 0x0000000000007266,
|
||||||
|
DE = 0x0000000000006564,
|
||||||
|
IT = 0x0000000000007469,
|
||||||
|
ES = 0x0000000000007365,
|
||||||
|
ZH_CN = 0x0000004E432D687A,
|
||||||
|
KO = 0x0000000000006F6B,
|
||||||
|
NL = 0x0000000000006C6E,
|
||||||
|
PT = 0x0000000000007470,
|
||||||
|
RU = 0x0000000000007572,
|
||||||
|
ZH_TW = 0x00000057542D687A,
|
||||||
|
EN_GB = 0x00000042472D6E65,
|
||||||
|
FR_CA = 0x00000041432D7266,
|
||||||
|
ES_419 = 0x00003931342D7365,
|
||||||
|
ZH_HANS = 0x00736E61482D687A,
|
||||||
|
ZH_HANT = 0x00746E61482D687A,
|
||||||
|
PT_BR = 0x00000052422D7470,
|
||||||
|
};
|
||||||
|
|
||||||
|
/// This is nn::settings::system::ErrorReportSharePermission
|
||||||
|
enum class ErrorReportSharePermission : u32 {
|
||||||
|
NotConfirmed,
|
||||||
|
Granted,
|
||||||
|
Denied,
|
||||||
|
};
|
||||||
|
|
||||||
|
/// This is nn::settings::system::ChineseTraditionalInputMethod
|
||||||
|
enum class ChineseTraditionalInputMethod : u32 {
|
||||||
|
Unknown0 = 0,
|
||||||
|
Unknown1 = 1,
|
||||||
|
Unknown2 = 2,
|
||||||
|
};
|
||||||
|
|
||||||
|
/// This is nn::settings::system::HomeMenuScheme
|
||||||
|
struct HomeMenuScheme {
|
||||||
|
u32 main;
|
||||||
|
u32 back;
|
||||||
|
u32 sub;
|
||||||
|
u32 bezel;
|
||||||
|
u32 extra;
|
||||||
|
};
|
||||||
|
static_assert(sizeof(HomeMenuScheme) == 0x14, "HomeMenuScheme is incorrect size");
|
||||||
|
|
||||||
|
/// Indicates the current theme set by the system settings
|
||||||
|
enum class ColorSet : u32 {
|
||||||
|
BasicWhite = 0,
|
||||||
|
BasicBlack = 1,
|
||||||
|
};
|
||||||
|
|
||||||
|
/// Indicates the current console is a retail or kiosk unit
|
||||||
|
enum class QuestFlag : u8 {
|
||||||
|
Retail = 0,
|
||||||
|
Kiosk = 1,
|
||||||
|
};
|
||||||
|
|
||||||
|
/// This is nn::settings::system::RegionCode
|
||||||
|
enum class RegionCode : u32 {
|
||||||
|
Japan,
|
||||||
|
Usa,
|
||||||
|
Europe,
|
||||||
|
Australia,
|
||||||
|
HongKongTaiwanKorea,
|
||||||
|
China,
|
||||||
|
};
|
||||||
|
|
||||||
|
/// This is nn::settings::system::AccountSettings
|
||||||
|
struct AccountSettings {
|
||||||
|
u32 flags;
|
||||||
|
};
|
||||||
|
static_assert(sizeof(AccountSettings) == 4, "AccountSettings is an invalid size");
|
||||||
|
|
||||||
|
/// This is nn::settings::system::NotificationVolume
|
||||||
|
enum class NotificationVolume : u32 {
|
||||||
|
Mute,
|
||||||
|
Low,
|
||||||
|
High,
|
||||||
|
};
|
||||||
|
|
||||||
|
/// This is nn::settings::system::NotificationFlag
|
||||||
|
struct NotificationFlag {
|
||||||
|
union {
|
||||||
|
u32 raw{};
|
||||||
|
|
||||||
|
BitField<0, 1, u32> RingtoneFlag;
|
||||||
|
BitField<1, 1, u32> DownloadCompletionFlag;
|
||||||
|
BitField<8, 1, u32> EnablesNews;
|
||||||
|
BitField<9, 1, u32> IncomingLampFlag;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
static_assert(sizeof(NotificationFlag) == 4, "NotificationFlag is an invalid size");
|
||||||
|
|
||||||
|
/// This is nn::settings::system::NotificationTime
|
||||||
|
struct NotificationTime {
|
||||||
|
u32 hour;
|
||||||
|
u32 minute;
|
||||||
|
};
|
||||||
|
static_assert(sizeof(NotificationTime) == 0x8, "NotificationTime is an invalid size");
|
||||||
|
|
||||||
|
/// This is nn::settings::system::NotificationSettings
|
||||||
|
struct NotificationSettings {
|
||||||
|
NotificationFlag flags;
|
||||||
|
NotificationVolume volume;
|
||||||
|
NotificationTime start_time;
|
||||||
|
NotificationTime stop_time;
|
||||||
|
};
|
||||||
|
static_assert(sizeof(NotificationSettings) == 0x18, "NotificationSettings is an invalid size");
|
||||||
|
|
||||||
|
/// This is nn::settings::system::AccountNotificationFlag
|
||||||
|
struct AccountNotificationFlag {
|
||||||
|
union {
|
||||||
|
u32 raw{};
|
||||||
|
|
||||||
|
BitField<0, 1, u32> FriendOnlineFlag;
|
||||||
|
BitField<1, 1, u32> FriendRequestFlag;
|
||||||
|
BitField<8, 1, u32> CoralInvitationFlag;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
static_assert(sizeof(AccountNotificationFlag) == 4, "AccountNotificationFlag is an invalid size");
|
||||||
|
|
||||||
|
/// This is nn::settings::system::FriendPresenceOverlayPermission
|
||||||
|
enum class FriendPresenceOverlayPermission : u8 {
|
||||||
|
NotConfirmed,
|
||||||
|
NoDisplay,
|
||||||
|
FavoriteFriends,
|
||||||
|
Friends,
|
||||||
|
};
|
||||||
|
|
||||||
|
/// This is nn::settings::system::AccountNotificationSettings
|
||||||
|
struct AccountNotificationSettings {
|
||||||
|
Common::UUID uid;
|
||||||
|
AccountNotificationFlag flags;
|
||||||
|
FriendPresenceOverlayPermission friend_presence_permission;
|
||||||
|
FriendPresenceOverlayPermission friend_invitation_permission;
|
||||||
|
INSERT_PADDING_BYTES(0x2);
|
||||||
|
};
|
||||||
|
static_assert(sizeof(AccountNotificationSettings) == 0x18,
|
||||||
|
"AccountNotificationSettings is an invalid size");
|
||||||
|
|
||||||
|
/// This is nn::settings::system::TvFlag
|
||||||
|
struct TvFlag {
|
||||||
|
union {
|
||||||
|
u32 raw{};
|
||||||
|
|
||||||
|
BitField<0, 1, u32> Allows4k;
|
||||||
|
BitField<1, 1, u32> Allows3d;
|
||||||
|
BitField<2, 1, u32> AllowsCec;
|
||||||
|
BitField<3, 1, u32> PreventsScreenBurnIn;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
static_assert(sizeof(TvFlag) == 4, "TvFlag is an invalid size");
|
||||||
|
|
||||||
|
/// This is nn::settings::system::TvResolution
|
||||||
|
enum class TvResolution : u32 {
|
||||||
|
Auto,
|
||||||
|
Resolution1080p,
|
||||||
|
Resolution720p,
|
||||||
|
Resolution480p,
|
||||||
|
};
|
||||||
|
|
||||||
|
/// This is nn::settings::system::HdmiContentType
|
||||||
|
enum class HdmiContentType : u32 {
|
||||||
|
None,
|
||||||
|
Graphics,
|
||||||
|
Cinema,
|
||||||
|
Photo,
|
||||||
|
Game,
|
||||||
|
};
|
||||||
|
|
||||||
|
/// This is nn::settings::system::RgbRange
|
||||||
|
enum class RgbRange : u32 {
|
||||||
|
Auto,
|
||||||
|
Full,
|
||||||
|
Limited,
|
||||||
|
};
|
||||||
|
|
||||||
|
/// This is nn::settings::system::CmuMode
|
||||||
|
enum class CmuMode : u32 {
|
||||||
|
None,
|
||||||
|
ColorInvert,
|
||||||
|
HighContrast,
|
||||||
|
GrayScale,
|
||||||
|
};
|
||||||
|
|
||||||
|
/// This is nn::settings::system::TvSettings
|
||||||
|
struct TvSettings {
|
||||||
|
TvFlag flags;
|
||||||
|
TvResolution tv_resolution;
|
||||||
|
HdmiContentType hdmi_content_type;
|
||||||
|
RgbRange rgb_range;
|
||||||
|
CmuMode cmu_mode;
|
||||||
|
u32 tv_underscan;
|
||||||
|
f32 tv_gama;
|
||||||
|
f32 contrast_ratio;
|
||||||
|
};
|
||||||
|
static_assert(sizeof(TvSettings) == 0x20, "TvSettings is an invalid size");
|
||||||
|
|
||||||
|
/// This is nn::settings::system::PrimaryAlbumStorage
|
||||||
|
enum class PrimaryAlbumStorage : u32 {
|
||||||
|
Nand,
|
||||||
|
SdCard,
|
||||||
|
};
|
||||||
|
|
||||||
|
/// This is nn::settings::system::HandheldSleepPlan
|
||||||
|
enum class HandheldSleepPlan : u32 {
|
||||||
|
Sleep1Min,
|
||||||
|
Sleep3Min,
|
||||||
|
Sleep5Min,
|
||||||
|
Sleep10Min,
|
||||||
|
Sleep30Min,
|
||||||
|
Never,
|
||||||
|
};
|
||||||
|
|
||||||
|
/// This is nn::settings::system::ConsoleSleepPlan
|
||||||
|
enum class ConsoleSleepPlan : u32 {
|
||||||
|
Sleep1Hour,
|
||||||
|
Sleep2Hour,
|
||||||
|
Sleep3Hour,
|
||||||
|
Sleep6Hour,
|
||||||
|
Sleep12Hour,
|
||||||
|
Never,
|
||||||
|
};
|
||||||
|
|
||||||
|
/// This is nn::settings::system::SleepFlag
|
||||||
|
struct SleepFlag {
|
||||||
|
union {
|
||||||
|
u32 raw{};
|
||||||
|
|
||||||
|
BitField<0, 1, u32> SleepsWhilePlayingMedia;
|
||||||
|
BitField<1, 1, u32> WakesAtPowerStateChange;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
static_assert(sizeof(SleepFlag) == 4, "TvFlag is an invalid size");
|
||||||
|
|
||||||
|
/// This is nn::settings::system::SleepSettings
|
||||||
|
struct SleepSettings {
|
||||||
|
SleepFlag flags;
|
||||||
|
HandheldSleepPlan handheld_sleep_plan;
|
||||||
|
ConsoleSleepPlan console_sleep_plan;
|
||||||
|
};
|
||||||
|
static_assert(sizeof(SleepSettings) == 0xc, "SleepSettings is incorrect size");
|
||||||
|
|
||||||
|
/// This is nn::settings::system::EulaVersionClockType
|
||||||
|
enum class EulaVersionClockType : u32 {
|
||||||
|
NetworkSystemClock,
|
||||||
|
SteadyClock,
|
||||||
|
};
|
||||||
|
|
||||||
|
/// This is nn::settings::system::EulaVersion
|
||||||
|
struct EulaVersion {
|
||||||
|
u32 version;
|
||||||
|
RegionCode region_code;
|
||||||
|
EulaVersionClockType clock_type;
|
||||||
|
INSERT_PADDING_BYTES(0x4);
|
||||||
|
s64 posix_time;
|
||||||
|
Time::Clock::SteadyClockTimePoint timestamp;
|
||||||
|
};
|
||||||
|
static_assert(sizeof(EulaVersion) == 0x30, "EulaVersion is incorrect size");
|
||||||
|
|
||||||
struct SystemSettings {
|
struct SystemSettings {
|
||||||
// 0/unwritten (1.0.0), 0x20000 (2.0.0), 0x30000 (3.0.0-3.0.1), 0x40001 (4.0.0-4.1.0), 0x50000
|
// 0/unwritten (1.0.0), 0x20000 (2.0.0), 0x30000 (3.0.0-3.0.1), 0x40001 (4.0.0-4.1.0), 0x50000
|
||||||
// (5.0.0-5.1.0), 0x60000 (6.0.0-6.2.0), 0x70000 (7.0.0), 0x80000 (8.0.0-8.1.1), 0x90000
|
// (5.0.0-5.1.0), 0x60000 (6.0.0-6.2.0), 0x70000 (7.0.0), 0x80000 (8.0.0-8.1.1), 0x90000
|
||||||
@ -25,16 +283,20 @@ struct SystemSettings {
|
|||||||
// 0/unwritten (1.0.0), 1 (6.0.0-8.1.0), 2 (8.1.1), 7 (9.0.0+).
|
// 0/unwritten (1.0.0), 1 (6.0.0-8.1.0), 2 (8.1.1), 7 (9.0.0+).
|
||||||
// if (flags & 2), defaults are written for AnalogStickUserCalibration
|
// if (flags & 2), defaults are written for AnalogStickUserCalibration
|
||||||
u32 flags;
|
u32 flags;
|
||||||
INSERT_PADDING_BYTES(0x8); // Reserved
|
|
||||||
|
|
||||||
|
std::array<u8, 0x8> reserved_00008;
|
||||||
|
|
||||||
|
// nn::settings::LanguageCode
|
||||||
LanguageCode language_code;
|
LanguageCode language_code;
|
||||||
INSERT_PADDING_BYTES(0x38); // Reserved
|
|
||||||
|
std::array<u8, 0x38> reserved_00018;
|
||||||
|
|
||||||
// nn::settings::system::NetworkSettings
|
// nn::settings::system::NetworkSettings
|
||||||
u32 network_setting_count;
|
u32 network_setting_count;
|
||||||
bool wireless_lan_enable_flag;
|
bool wireless_lan_enable_flag;
|
||||||
INSERT_PADDING_BYTES(0x3);
|
std::array<u8, 0x3> pad_00055;
|
||||||
INSERT_PADDING_BYTES(0x8); // Reserved
|
|
||||||
|
std::array<u8, 0x8> reserved_00058;
|
||||||
|
|
||||||
// nn::settings::system::NetworkSettings
|
// nn::settings::system::NetworkSettings
|
||||||
std::array<std::array<u8, 0x400>, 32> network_settings_1B0;
|
std::array<std::array<u8, 0x400>, 32> network_settings_1B0;
|
||||||
@ -42,142 +304,161 @@ struct SystemSettings {
|
|||||||
// nn::settings::system::BluetoothDevicesSettings
|
// nn::settings::system::BluetoothDevicesSettings
|
||||||
std::array<u8, 0x4> bluetooth_device_settings_count;
|
std::array<u8, 0x4> bluetooth_device_settings_count;
|
||||||
bool bluetooth_enable_flag;
|
bool bluetooth_enable_flag;
|
||||||
INSERT_PADDING_BYTES(0x3);
|
std::array<u8, 0x3> pad_08065;
|
||||||
bool bluetooth_afh_enable_flag;
|
bool bluetooth_afh_enable_flag;
|
||||||
INSERT_PADDING_BYTES(0x3);
|
std::array<u8, 0x3> pad_08069;
|
||||||
bool bluetooth_boost_enable_flag;
|
bool bluetooth_boost_enable_flag;
|
||||||
INSERT_PADDING_BYTES(0x3);
|
std::array<u8, 0x3> pad_0806D;
|
||||||
std::array<std::array<u8, 0x200>, 10> bluetooth_device_settings_first_10;
|
std::array<std::array<u8, 0x200>, 10> bluetooth_device_settings_first_10;
|
||||||
|
|
||||||
s32 ldn_channel;
|
s32 ldn_channel;
|
||||||
INSERT_PADDING_BYTES(0x3C); // Reserved
|
|
||||||
|
std::array<u8, 0x3C> reserved_09474;
|
||||||
|
|
||||||
// nn::util::Uuid MiiAuthorId
|
// nn::util::Uuid MiiAuthorId
|
||||||
Common::UUID mii_author_id;
|
std::array<u8, 0x10> mii_author_id;
|
||||||
|
|
||||||
INSERT_PADDING_BYTES(0x30); // Reserved
|
std::array<u8, 0x30> reserved_094C0;
|
||||||
|
|
||||||
// nn::settings::system::NxControllerSettings
|
// nn::settings::system::NxControllerSettings
|
||||||
u32 nx_controller_settings_count;
|
u32 nx_controller_settings_count;
|
||||||
|
|
||||||
INSERT_PADDING_BYTES(0xC); // Reserved
|
std::array<u8, 0xC> reserved_094F4;
|
||||||
|
|
||||||
// nn::settings::system::NxControllerSettings,
|
// nn::settings::system::NxControllerSettings,
|
||||||
// nn::settings::system::NxControllerLegacySettings on 13.0.0+
|
// nn::settings::system::NxControllerLegacySettings on 13.0.0+
|
||||||
std::array<std::array<u8, 0x40>, 10> nx_controller_legacy_settings;
|
std::array<std::array<u8, 0x40>, 10> nx_controller_legacy_settings;
|
||||||
INSERT_PADDING_BYTES(0x170); // Reserved
|
|
||||||
|
std::array<u8, 0x170> reserved_09780;
|
||||||
|
|
||||||
bool external_rtc_reset_flag;
|
bool external_rtc_reset_flag;
|
||||||
INSERT_PADDING_BYTES(0x3);
|
std::array<u8, 0x3> pad_098F1;
|
||||||
INSERT_PADDING_BYTES(0x3C); // Reserved
|
|
||||||
|
std::array<u8, 0x3C> reserved_098F4;
|
||||||
|
|
||||||
s32 push_notification_activity_mode_on_sleep;
|
s32 push_notification_activity_mode_on_sleep;
|
||||||
INSERT_PADDING_BYTES(0x3C); // Reserved
|
|
||||||
|
|
||||||
|
std::array<u8, 0x3C> reserved_09934;
|
||||||
|
|
||||||
|
// nn::settings::system::ErrorReportSharePermission
|
||||||
ErrorReportSharePermission error_report_share_permission;
|
ErrorReportSharePermission error_report_share_permission;
|
||||||
INSERT_PADDING_BYTES(0x3C); // Reserved
|
|
||||||
|
|
||||||
KeyboardLayout keyboard_layout;
|
std::array<u8, 0x3C> reserved_09974;
|
||||||
INSERT_PADDING_BYTES(0x3C); // Reserved
|
|
||||||
|
// nn::settings::KeyboardLayout
|
||||||
|
std::array<u8, 0x4> keyboard_layout;
|
||||||
|
|
||||||
|
std::array<u8, 0x3C> reserved_099B4;
|
||||||
|
|
||||||
bool web_inspector_flag;
|
bool web_inspector_flag;
|
||||||
INSERT_PADDING_BYTES(0x3);
|
std::array<u8, 0x3> pad_099F1;
|
||||||
|
|
||||||
// nn::settings::system::AllowedSslHost
|
// nn::settings::system::AllowedSslHost
|
||||||
u32 allowed_ssl_host_count;
|
u32 allowed_ssl_host_count;
|
||||||
|
|
||||||
bool memory_usage_rate_flag;
|
bool memory_usage_rate_flag;
|
||||||
INSERT_PADDING_BYTES(0x3);
|
std::array<u8, 0x3> pad_099F9;
|
||||||
INSERT_PADDING_BYTES(0x34); // Reserved
|
|
||||||
|
std::array<u8, 0x34> reserved_099FC;
|
||||||
|
|
||||||
// nn::settings::system::HostFsMountPoint
|
// nn::settings::system::HostFsMountPoint
|
||||||
std::array<u8, 0x100> host_fs_mount_point;
|
std::array<u8, 0x100> host_fs_mount_point;
|
||||||
|
|
||||||
// nn::settings::system::AllowedSslHost
|
// nn::settings::system::AllowedSslHost
|
||||||
std::array<std::array<u8, 0x100>, 8> allowed_ssl_hosts;
|
std::array<std::array<u8, 0x100>, 8> allowed_ssl_hosts;
|
||||||
INSERT_PADDING_BYTES(0x6C0); // Reserved
|
|
||||||
|
std::array<u8, 0x6C0> reserved_0A330;
|
||||||
|
|
||||||
// nn::settings::system::BlePairingSettings
|
// nn::settings::system::BlePairingSettings
|
||||||
u32 ble_pairing_settings_count;
|
u32 ble_pairing_settings_count;
|
||||||
INSERT_PADDING_BYTES(0xC); // Reserved
|
std::array<u8, 0xC> reserved_0A9F4;
|
||||||
std::array<std::array<u8, 0x80>, 10> ble_pairing_settings;
|
std::array<std::array<u8, 0x80>, 10> ble_pairing_settings;
|
||||||
|
|
||||||
// nn::settings::system::AccountOnlineStorageSettings
|
// nn::settings::system::AccountOnlineStorageSettings
|
||||||
u32 account_online_storage_settings_count;
|
u32 account_online_storage_settings_count;
|
||||||
INSERT_PADDING_BYTES(0xC); // Reserved
|
std::array<u8, 0xC> reserved_0AF04;
|
||||||
std::array<std::array<u8, 0x40>, 8> account_online_storage_settings;
|
std::array<std::array<u8, 0x40>, 8> account_online_storage_settings;
|
||||||
|
|
||||||
bool pctl_ready_flag;
|
bool pctl_ready_flag;
|
||||||
INSERT_PADDING_BYTES(0x3);
|
std::array<u8, 0x3> pad_0B111;
|
||||||
INSERT_PADDING_BYTES(0x3C); // Reserved
|
|
||||||
|
std::array<u8, 0x3C> reserved_0B114;
|
||||||
|
|
||||||
// nn::settings::system::ThemeId
|
// nn::settings::system::ThemeId
|
||||||
std::array<u8, 0x80> theme_id_type0;
|
std::array<u8, 0x80> theme_id_type0;
|
||||||
std::array<u8, 0x80> theme_id_type1;
|
std::array<u8, 0x80> theme_id_type1;
|
||||||
INSERT_PADDING_BYTES(0x100); // Reserved
|
|
||||||
|
|
||||||
|
std::array<u8, 0x100> reserved_0B250;
|
||||||
|
|
||||||
|
// nn::settings::ChineseTraditionalInputMethod
|
||||||
ChineseTraditionalInputMethod chinese_traditional_input_method;
|
ChineseTraditionalInputMethod chinese_traditional_input_method;
|
||||||
INSERT_PADDING_BYTES(0x3C); // Reserved
|
|
||||||
|
std::array<u8, 0x3C> reserved_0B354;
|
||||||
|
|
||||||
bool zoom_flag;
|
bool zoom_flag;
|
||||||
INSERT_PADDING_BYTES(0x3);
|
std::array<u8, 0x3> pad_0B391;
|
||||||
INSERT_PADDING_BYTES(0x3C); // Reserved
|
|
||||||
|
std::array<u8, 0x3C> reserved_0B394;
|
||||||
|
|
||||||
// nn::settings::system::ButtonConfigRegisteredSettings
|
// nn::settings::system::ButtonConfigRegisteredSettings
|
||||||
u32 button_config_registered_settings_count;
|
u32 button_config_registered_settings_count;
|
||||||
INSERT_PADDING_BYTES(0xC); // Reserved
|
std::array<u8, 0xC> reserved_0B3D4;
|
||||||
|
|
||||||
// nn::settings::system::ButtonConfigSettings
|
// nn::settings::system::ButtonConfigSettings
|
||||||
u32 button_config_settings_count;
|
u32 button_config_settings_count;
|
||||||
INSERT_PADDING_BYTES(0x4); // Reserved
|
std::array<u8, 0x4> reserved_0B3E4;
|
||||||
std::array<std::array<u8, 0x5A8>, 5> button_config_settings;
|
std::array<std::array<u8, 0x5A8>, 5> button_config_settings;
|
||||||
INSERT_PADDING_BYTES(0x13B0); // Reserved
|
std::array<u8, 0x13B0> reserved_0D030;
|
||||||
u32 button_config_settings_embedded_count;
|
u32 button_config_settings_embedded_count;
|
||||||
INSERT_PADDING_BYTES(0x4); // Reserved
|
std::array<u8, 0x4> reserved_0E3E4;
|
||||||
std::array<std::array<u8, 0x5A8>, 5> button_config_settings_embedded;
|
std::array<std::array<u8, 0x5A8>, 5> button_config_settings_embedded;
|
||||||
INSERT_PADDING_BYTES(0x13B0); // Reserved
|
std::array<u8, 0x13B0> reserved_10030;
|
||||||
u32 button_config_settings_left_count;
|
u32 button_config_settings_left_count;
|
||||||
INSERT_PADDING_BYTES(0x4); // Reserved
|
std::array<u8, 0x4> reserved_113E4;
|
||||||
std::array<std::array<u8, 0x5A8>, 5> button_config_settings_left;
|
std::array<std::array<u8, 0x5A8>, 5> button_config_settings_left;
|
||||||
INSERT_PADDING_BYTES(0x13B0); // Reserved
|
std::array<u8, 0x13B0> reserved_13030;
|
||||||
u32 button_config_settings_right_count;
|
u32 button_config_settings_right_count;
|
||||||
INSERT_PADDING_BYTES(0x4); // Reserved
|
std::array<u8, 0x4> reserved_143E4;
|
||||||
std::array<std::array<u8, 0x5A8>, 5> button_config_settings_right;
|
std::array<std::array<u8, 0x5A8>, 5> button_config_settings_right;
|
||||||
INSERT_PADDING_BYTES(0x73B0); // Reserved
|
std::array<u8, 0x73B0> reserved_16030;
|
||||||
// nn::settings::system::ButtonConfigRegisteredSettings
|
// nn::settings::system::ButtonConfigRegisteredSettings
|
||||||
std::array<u8, 0x5C8> button_config_registered_settings_embedded;
|
std::array<u8, 0x5C8> button_config_registered_settings_embedded;
|
||||||
std::array<std::array<u8, 0x5C8>, 10> button_config_registered_settings;
|
std::array<std::array<u8, 0x5C8>, 10> button_config_registered_settings;
|
||||||
INSERT_PADDING_BYTES(0x7FF8); // Reserved
|
|
||||||
|
std::array<u8, 0x7FF8> reserved_21378;
|
||||||
|
|
||||||
// nn::settings::system::ConsoleSixAxisSensorAccelerationBias
|
// nn::settings::system::ConsoleSixAxisSensorAccelerationBias
|
||||||
Common::Vec3<f32> console_six_axis_sensor_acceleration_bias;
|
std::array<u8, 0xC> console_six_axis_sensor_acceleration_bias;
|
||||||
// nn::settings::system::ConsoleSixAxisSensorAngularVelocityBias
|
// nn::settings::system::ConsoleSixAxisSensorAngularVelocityBias
|
||||||
Common::Vec3<f32> console_six_axis_sensor_angular_velocity_bias;
|
std::array<u8, 0xC> console_six_axis_sensor_angular_velocity_bias;
|
||||||
// nn::settings::system::ConsoleSixAxisSensorAccelerationGain
|
// nn::settings::system::ConsoleSixAxisSensorAccelerationGain
|
||||||
std::array<u8, 0x24> console_six_axis_sensor_acceleration_gain;
|
std::array<u8, 0x24> console_six_axis_sensor_acceleration_gain;
|
||||||
// nn::settings::system::ConsoleSixAxisSensorAngularVelocityGain
|
// nn::settings::system::ConsoleSixAxisSensorAngularVelocityGain
|
||||||
std::array<u8, 0x24> console_six_axis_sensor_angular_velocity_gain;
|
std::array<u8, 0x24> console_six_axis_sensor_angular_velocity_gain;
|
||||||
// nn::settings::system::ConsoleSixAxisSensorAngularVelocityTimeBias
|
// nn::settings::system::ConsoleSixAxisSensorAngularVelocityTimeBias
|
||||||
Common::Vec3<f32> console_six_axis_sensor_angular_velocity_time_bias;
|
std::array<u8, 0xC> console_six_axis_sensor_angular_velocity_time_bias;
|
||||||
// nn::settings::system::ConsoleSixAxisSensorAngularAcceleration
|
// nn::settings::system::ConsoleSixAxisSensorAngularAcceleration
|
||||||
std::array<u8, 0x24> console_six_axis_sensor_angular_velocity_acceleration;
|
std::array<u8, 0x24> console_six_axis_sensor_angular_velocity_acceleration;
|
||||||
INSERT_PADDING_BYTES(0x70); // Reserved
|
|
||||||
|
std::array<u8, 0x70> reserved_29400;
|
||||||
|
|
||||||
bool lock_screen_flag;
|
bool lock_screen_flag;
|
||||||
INSERT_PADDING_BYTES(0x3);
|
std::array<u8, 0x3> pad_29471;
|
||||||
INSERT_PADDING_BYTES(0x4); // Reserved
|
|
||||||
|
std::array<u8, 0x4> reserved_249274;
|
||||||
|
|
||||||
ColorSet color_set_id;
|
ColorSet color_set_id;
|
||||||
|
|
||||||
QuestFlag quest_flag;
|
QuestFlag quest_flag;
|
||||||
|
|
||||||
SystemRegionCode region_code;
|
// nn::settings::system::RegionCode
|
||||||
|
RegionCode region_code;
|
||||||
|
|
||||||
// Different to nn::settings::system::InitialLaunchSettings?
|
// Different to nn::settings::system::InitialLaunchSettings?
|
||||||
InitialLaunchSettingsPacked initial_launch_settings_packed;
|
InitialLaunchSettingsPacked initial_launch_settings_packed;
|
||||||
|
|
||||||
bool battery_percentage_flag;
|
bool battery_percentage_flag;
|
||||||
INSERT_PADDING_BYTES(0x3);
|
std::array<u8, 0x3> pad_294A1;
|
||||||
|
|
||||||
// BitFlagSet<32, nn::settings::system::AppletLaunchFlag>
|
// BitFlagSet<32, nn::settings::system::AppletLaunchFlag>
|
||||||
u32 applet_launch_flag;
|
u32 applet_launch_flag;
|
||||||
@ -188,26 +469,33 @@ struct SystemSettings {
|
|||||||
std::array<u8, 0x10> theme_key;
|
std::array<u8, 0x10> theme_key;
|
||||||
|
|
||||||
bool field_testing_flag;
|
bool field_testing_flag;
|
||||||
INSERT_PADDING_BYTES(0x3);
|
std::array<u8, 0x3> pad_294C1;
|
||||||
|
|
||||||
s32 panel_crc_mode;
|
s32 panel_crc_mode;
|
||||||
INSERT_PADDING_BYTES(0x28); // Reserved
|
|
||||||
|
std::array<u8, 0x28> reserved_294C8;
|
||||||
|
|
||||||
// nn::settings::system::BacklightSettings
|
// nn::settings::system::BacklightSettings
|
||||||
std::array<u8, 0x2C> backlight_settings_mixed_up;
|
std::array<u8, 0x2C> backlight_settings_mixed_up;
|
||||||
INSERT_PADDING_BYTES(0x64); // Reserved
|
|
||||||
|
|
||||||
|
std::array<u8, 0x64> reserved_2951C;
|
||||||
|
|
||||||
|
// nn::time::SystemClockContext
|
||||||
Service::Time::Clock::SystemClockContext user_system_clock_context;
|
Service::Time::Clock::SystemClockContext user_system_clock_context;
|
||||||
Service::Time::Clock::SystemClockContext network_system_clock_context;
|
Service::Time::Clock::SystemClockContext network_system_clock_context;
|
||||||
bool user_system_clock_automatic_correction_enabled;
|
bool user_system_clock_automatic_correction_enabled;
|
||||||
INSERT_PADDING_BYTES(0x3);
|
std::array<u8, 0x3> pad_295C1;
|
||||||
INSERT_PADDING_BYTES(0x4); // Reserved
|
std::array<u8, 0x4> reserved_295C4;
|
||||||
|
// nn::time::SteadyClockTimePoint
|
||||||
Service::Time::Clock::SteadyClockTimePoint
|
Service::Time::Clock::SteadyClockTimePoint
|
||||||
user_system_clock_automatic_correction_updated_time_point;
|
user_system_clock_automatic_correction_updated_time_point;
|
||||||
INSERT_PADDING_BYTES(0x10); // Reserved
|
|
||||||
|
|
||||||
|
std::array<u8, 0x10> reserved_295E0;
|
||||||
|
|
||||||
|
// nn::settings::system::AccountSettings
|
||||||
AccountSettings account_settings;
|
AccountSettings account_settings;
|
||||||
INSERT_PADDING_BYTES(0xFC); // Reserved
|
|
||||||
|
std::array<u8, 0xFC> reserved_295F4;
|
||||||
|
|
||||||
// nn::settings::system::AudioVolume
|
// nn::settings::system::AudioVolume
|
||||||
std::array<u8, 0x8> audio_volume_type0;
|
std::array<u8, 0x8> audio_volume_type0;
|
||||||
@ -217,42 +505,47 @@ struct SystemSettings {
|
|||||||
s32 audio_output_mode_type1;
|
s32 audio_output_mode_type1;
|
||||||
s32 audio_output_mode_type2;
|
s32 audio_output_mode_type2;
|
||||||
bool force_mute_on_headphone_removed;
|
bool force_mute_on_headphone_removed;
|
||||||
INSERT_PADDING_BYTES(0x3);
|
std::array<u8, 0x3> pad_2970D;
|
||||||
s32 headphone_volume_warning_count;
|
s32 headphone_volume_warning_count;
|
||||||
bool heaphone_volume_update_flag;
|
bool heaphone_volume_update_flag;
|
||||||
INSERT_PADDING_BYTES(0x3);
|
std::array<u8, 0x3> pad_29715;
|
||||||
// nn::settings::system::AudioVolume
|
// nn::settings::system::AudioVolume
|
||||||
std::array<u8, 0x8> audio_volume_type2;
|
std::array<u8, 0x8> audio_volume_type2;
|
||||||
// nn::settings::system::AudioOutputMode
|
// nn::settings::system::AudioOutputMode
|
||||||
s32 audio_output_mode_type3;
|
s32 audio_output_mode_type3;
|
||||||
s32 audio_output_mode_type4;
|
s32 audio_output_mode_type4;
|
||||||
bool hearing_protection_safeguard_flag;
|
bool hearing_protection_safeguard_flag;
|
||||||
INSERT_PADDING_BYTES(0x3);
|
std::array<u8, 0x3> pad_29729;
|
||||||
INSERT_PADDING_BYTES(0x4); // Reserved
|
std::array<u8, 0x4> reserved_2972C;
|
||||||
s64 hearing_protection_safeguard_remaining_time;
|
s64 hearing_protection_safeguard_remaining_time;
|
||||||
INSERT_PADDING_BYTES(0x38); // Reserved
|
std::array<u8, 0x38> reserved_29738;
|
||||||
|
|
||||||
bool console_information_upload_flag;
|
bool console_information_upload_flag;
|
||||||
INSERT_PADDING_BYTES(0x3);
|
std::array<u8, 0x3> pad_29771;
|
||||||
INSERT_PADDING_BYTES(0x3C); // Reserved
|
|
||||||
|
std::array<u8, 0x3C> reserved_29774;
|
||||||
|
|
||||||
bool automatic_application_download_flag;
|
bool automatic_application_download_flag;
|
||||||
INSERT_PADDING_BYTES(0x3);
|
std::array<u8, 0x3> pad_297B1;
|
||||||
INSERT_PADDING_BYTES(0x4); // Reserved
|
|
||||||
|
|
||||||
|
std::array<u8, 0x4> reserved_297B4;
|
||||||
|
|
||||||
|
// nn::settings::system::NotificationSettings
|
||||||
NotificationSettings notification_settings;
|
NotificationSettings notification_settings;
|
||||||
INSERT_PADDING_BYTES(0x60); // Reserved
|
|
||||||
|
std::array<u8, 0x60> reserved_297D0;
|
||||||
|
|
||||||
// nn::settings::system::AccountNotificationSettings
|
// nn::settings::system::AccountNotificationSettings
|
||||||
u32 account_notification_settings_count;
|
u32 account_notification_settings_count;
|
||||||
INSERT_PADDING_BYTES(0xC); // Reserved
|
std::array<u8, 0xC> reserved_29834;
|
||||||
std::array<AccountNotificationSettings, 8> account_notification_settings;
|
std::array<AccountNotificationSettings, 8> account_notification_settings;
|
||||||
INSERT_PADDING_BYTES(0x140); // Reserved
|
|
||||||
|
std::array<u8, 0x140> reserved_29900;
|
||||||
|
|
||||||
f32 vibration_master_volume;
|
f32 vibration_master_volume;
|
||||||
|
|
||||||
bool usb_full_key_enable_flag;
|
bool usb_full_key_enable_flag;
|
||||||
INSERT_PADDING_BYTES(0x3);
|
std::array<u8, 0x3> pad_29A45;
|
||||||
|
|
||||||
// nn::settings::system::AnalogStickUserCalibration
|
// nn::settings::system::AnalogStickUserCalibration
|
||||||
std::array<u8, 0x10> analog_stick_user_calibration_left;
|
std::array<u8, 0x10> analog_stick_user_calibration_left;
|
||||||
@ -260,68 +553,85 @@ struct SystemSettings {
|
|||||||
|
|
||||||
// nn::settings::system::TouchScreenMode
|
// nn::settings::system::TouchScreenMode
|
||||||
s32 touch_screen_mode;
|
s32 touch_screen_mode;
|
||||||
INSERT_PADDING_BYTES(0x14); // Reserved
|
|
||||||
|
|
||||||
|
std::array<u8, 0x14> reserved_29A6C;
|
||||||
|
|
||||||
|
// nn::settings::system::TvSettings
|
||||||
TvSettings tv_settings;
|
TvSettings tv_settings;
|
||||||
|
|
||||||
// nn::settings::system::Edid
|
// nn::settings::system::Edid
|
||||||
std::array<u8, 0x100> edid;
|
std::array<u8, 0x100> edid;
|
||||||
INSERT_PADDING_BYTES(0x2E0); // Reserved
|
|
||||||
|
std::array<u8, 0x2E0> reserved_29BA0;
|
||||||
|
|
||||||
// nn::settings::system::DataDeletionSettings
|
// nn::settings::system::DataDeletionSettings
|
||||||
std::array<u8, 0x8> data_deletion_settings;
|
std::array<u8, 0x8> data_deletion_settings;
|
||||||
INSERT_PADDING_BYTES(0x38); // Reserved
|
|
||||||
|
std::array<u8, 0x38> reserved_29E88;
|
||||||
|
|
||||||
// nn::ncm::ProgramId
|
// nn::ncm::ProgramId
|
||||||
std::array<u8, 0x8> initial_system_applet_program_id;
|
std::array<u8, 0x8> initial_system_applet_program_id;
|
||||||
std::array<u8, 0x8> overlay_disp_program_id;
|
std::array<u8, 0x8> overlay_disp_program_id;
|
||||||
INSERT_PADDING_BYTES(0x4); // Reserved
|
|
||||||
|
std::array<u8, 0x4> reserved_29ED0;
|
||||||
|
|
||||||
bool requires_run_repair_time_reviser;
|
bool requires_run_repair_time_reviser;
|
||||||
INSERT_PADDING_BYTES(0x6B); // Reserved
|
|
||||||
|
|
||||||
|
std::array<u8, 0x6B> reserved_29ED5;
|
||||||
|
|
||||||
|
// nn::time::LocationName
|
||||||
Service::Time::TimeZone::LocationName device_time_zone_location_name;
|
Service::Time::TimeZone::LocationName device_time_zone_location_name;
|
||||||
INSERT_PADDING_BYTES(0x4); // Reserved
|
std::array<u8, 0x4> reserved_29F64;
|
||||||
|
// nn::time::SteadyClockTimePoint
|
||||||
Service::Time::Clock::SteadyClockTimePoint device_time_zone_location_updated_time;
|
Service::Time::Clock::SteadyClockTimePoint device_time_zone_location_updated_time;
|
||||||
INSERT_PADDING_BYTES(0xC0); // Reserved
|
|
||||||
|
std::array<u8, 0xC0> reserved_29F80;
|
||||||
|
|
||||||
// nn::settings::system::PrimaryAlbumStorage
|
// nn::settings::system::PrimaryAlbumStorage
|
||||||
PrimaryAlbumStorage primary_album_storage;
|
PrimaryAlbumStorage primary_album_storage;
|
||||||
INSERT_PADDING_BYTES(0x3C); // Reserved
|
|
||||||
|
std::array<u8, 0x3C> reserved_2A044;
|
||||||
|
|
||||||
bool usb_30_enable_flag;
|
bool usb_30_enable_flag;
|
||||||
INSERT_PADDING_BYTES(0x3);
|
std::array<u8, 0x3> pad_2A081;
|
||||||
bool usb_30_host_enable_flag;
|
bool usb_30_host_enable_flag;
|
||||||
INSERT_PADDING_BYTES(0x3);
|
std::array<u8, 0x3> pad_2A085;
|
||||||
bool usb_30_device_enable_flag;
|
bool usb_30_device_enable_flag;
|
||||||
INSERT_PADDING_BYTES(0x3);
|
std::array<u8, 0x3> pad_2A089;
|
||||||
INSERT_PADDING_BYTES(0x34); // Reserved
|
|
||||||
|
std::array<u8, 0x34> reserved_2A08C;
|
||||||
|
|
||||||
bool nfc_enable_flag;
|
bool nfc_enable_flag;
|
||||||
INSERT_PADDING_BYTES(0x3);
|
std::array<u8, 0x3> pad_2A0C1;
|
||||||
INSERT_PADDING_BYTES(0x3C); // Reserved
|
|
||||||
|
std::array<u8, 0x3C> reserved_2A0C4;
|
||||||
|
|
||||||
// nn::settings::system::SleepSettings
|
// nn::settings::system::SleepSettings
|
||||||
SleepSettings sleep_settings;
|
SleepSettings sleep_settings;
|
||||||
INSERT_PADDING_BYTES(0x34); // Reserved
|
|
||||||
|
std::array<u8, 0x34> reserved_2A10C;
|
||||||
|
|
||||||
// nn::settings::system::EulaVersion
|
// nn::settings::system::EulaVersion
|
||||||
u32 eula_version_count;
|
u32 eula_version_count;
|
||||||
INSERT_PADDING_BYTES(0xC); // Reserved
|
std::array<u8, 0xC> reserved_2A144;
|
||||||
std::array<EulaVersion, 32> eula_versions;
|
std::array<EulaVersion, 32> eula_versions;
|
||||||
INSERT_PADDING_BYTES(0x200); // Reserved
|
|
||||||
|
std::array<u8, 0x200> reserved_2A750;
|
||||||
|
|
||||||
// nn::settings::system::DeviceNickName
|
// nn::settings::system::DeviceNickName
|
||||||
std::array<u8, 0x80> device_nick_name;
|
std::array<u8, 0x80> device_nick_name;
|
||||||
INSERT_PADDING_BYTES(0x80); // Reserved
|
|
||||||
|
std::array<u8, 0x80> reserved_2A9D0;
|
||||||
|
|
||||||
bool auto_update_enable_flag;
|
bool auto_update_enable_flag;
|
||||||
INSERT_PADDING_BYTES(0x3);
|
std::array<u8, 0x3> pad_2AA51;
|
||||||
INSERT_PADDING_BYTES(0x4C); // Reserved
|
|
||||||
|
std::array<u8, 0x4C> reserved_2AA54;
|
||||||
|
|
||||||
// nn::settings::system::BluetoothDevicesSettings
|
// nn::settings::system::BluetoothDevicesSettings
|
||||||
std::array<std::array<u8, 0x200>, 14> bluetooth_device_settings_last_14;
|
std::array<std::array<u8, 0x200>, 14> bluetooth_device_settings_last_14;
|
||||||
INSERT_PADDING_BYTES(0x2000); // Reserved
|
|
||||||
|
std::array<u8, 0x2000> reserved_2C6A0;
|
||||||
|
|
||||||
// nn::settings::system::NxControllerSettings
|
// nn::settings::system::NxControllerSettings
|
||||||
std::array<std::array<u8, 0x800>, 10> nx_controller_settings_data_from_offset_30;
|
std::array<std::array<u8, 0x800>, 10> nx_controller_settings_data_from_offset_30;
|
@ -97,8 +97,8 @@ ISystemSettingsServer::ISystemSettingsServer(Core::System& system_)
|
|||||||
{3, &ISystemSettingsServer::GetFirmwareVersion, "GetFirmwareVersion"},
|
{3, &ISystemSettingsServer::GetFirmwareVersion, "GetFirmwareVersion"},
|
||||||
{4, &ISystemSettingsServer::GetFirmwareVersion2, "GetFirmwareVersion2"},
|
{4, &ISystemSettingsServer::GetFirmwareVersion2, "GetFirmwareVersion2"},
|
||||||
{5, nullptr, "GetFirmwareVersionDigest"},
|
{5, nullptr, "GetFirmwareVersionDigest"},
|
||||||
{7, &ISystemSettingsServer::GetLockScreenFlag, "GetLockScreenFlag"},
|
{7, nullptr, "GetLockScreenFlag"},
|
||||||
{8, &ISystemSettingsServer::SetLockScreenFlag, "SetLockScreenFlag"},
|
{8, nullptr, "SetLockScreenFlag"},
|
||||||
{9, nullptr, "GetBacklightSettings"},
|
{9, nullptr, "GetBacklightSettings"},
|
||||||
{10, nullptr, "SetBacklightSettings"},
|
{10, nullptr, "SetBacklightSettings"},
|
||||||
{11, nullptr, "SetBluetoothDevicesSettings"},
|
{11, nullptr, "SetBluetoothDevicesSettings"},
|
||||||
@ -157,12 +157,12 @@ ISystemSettingsServer::ISystemSettingsServer(Core::System& system_)
|
|||||||
{66, nullptr, "SetUsb30EnableFlag"},
|
{66, nullptr, "SetUsb30EnableFlag"},
|
||||||
{67, nullptr, "GetBatteryLot"},
|
{67, nullptr, "GetBatteryLot"},
|
||||||
{68, nullptr, "GetSerialNumber"},
|
{68, nullptr, "GetSerialNumber"},
|
||||||
{69, &ISystemSettingsServer::GetNfcEnableFlag, "GetNfcEnableFlag"},
|
{69, nullptr, "GetNfcEnableFlag"},
|
||||||
{70, &ISystemSettingsServer::SetNfcEnableFlag, "SetNfcEnableFlag"},
|
{70, nullptr, "SetNfcEnableFlag"},
|
||||||
{71, &ISystemSettingsServer::GetSleepSettings, "GetSleepSettings"},
|
{71, &ISystemSettingsServer::GetSleepSettings, "GetSleepSettings"},
|
||||||
{72, &ISystemSettingsServer::SetSleepSettings, "SetSleepSettings"},
|
{72, &ISystemSettingsServer::SetSleepSettings, "SetSleepSettings"},
|
||||||
{73, &ISystemSettingsServer::GetWirelessLanEnableFlag, "GetWirelessLanEnableFlag"},
|
{73, nullptr, "GetWirelessLanEnableFlag"},
|
||||||
{74, &ISystemSettingsServer::SetWirelessLanEnableFlag, "SetWirelessLanEnableFlag"},
|
{74, nullptr, "SetWirelessLanEnableFlag"},
|
||||||
{75, &ISystemSettingsServer::GetInitialLaunchSettings, "GetInitialLaunchSettings"},
|
{75, &ISystemSettingsServer::GetInitialLaunchSettings, "GetInitialLaunchSettings"},
|
||||||
{76, &ISystemSettingsServer::SetInitialLaunchSettings, "SetInitialLaunchSettings"},
|
{76, &ISystemSettingsServer::SetInitialLaunchSettings, "SetInitialLaunchSettings"},
|
||||||
{77, &ISystemSettingsServer::GetDeviceNickName, "GetDeviceNickName"},
|
{77, &ISystemSettingsServer::GetDeviceNickName, "GetDeviceNickName"},
|
||||||
@ -176,8 +176,8 @@ ISystemSettingsServer::ISystemSettingsServer(Core::System& system_)
|
|||||||
{85, nullptr, "SetPtmBatteryLot"},
|
{85, nullptr, "SetPtmBatteryLot"},
|
||||||
{86, nullptr, "GetPtmFuelGaugeParameter"},
|
{86, nullptr, "GetPtmFuelGaugeParameter"},
|
||||||
{87, nullptr, "SetPtmFuelGaugeParameter"},
|
{87, nullptr, "SetPtmFuelGaugeParameter"},
|
||||||
{88, &ISystemSettingsServer::GetBluetoothEnableFlag, "GetBluetoothEnableFlag"},
|
{88, nullptr, "GetBluetoothEnableFlag"},
|
||||||
{89, &ISystemSettingsServer::SetBluetoothEnableFlag, "SetBluetoothEnableFlag"},
|
{89, nullptr, "SetBluetoothEnableFlag"},
|
||||||
{90, &ISystemSettingsServer::GetMiiAuthorId, "GetMiiAuthorId"},
|
{90, &ISystemSettingsServer::GetMiiAuthorId, "GetMiiAuthorId"},
|
||||||
{91, nullptr, "SetShutdownRtcValue"},
|
{91, nullptr, "SetShutdownRtcValue"},
|
||||||
{92, nullptr, "GetShutdownRtcValue"},
|
{92, nullptr, "GetShutdownRtcValue"},
|
||||||
@ -510,25 +510,6 @@ void ISystemSettingsServer::SetUserSystemClockContext(HLERequestContext& ctx) {
|
|||||||
rb.Push(res);
|
rb.Push(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ISystemSettingsServer::GetLockScreenFlag(HLERequestContext& ctx) {
|
|
||||||
LOG_INFO(Service_SET, "called, lock_screen_flag={}", m_system_settings.lock_screen_flag);
|
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 3};
|
|
||||||
rb.Push(ResultSuccess);
|
|
||||||
rb.Push(m_system_settings.lock_screen_flag);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ISystemSettingsServer::SetLockScreenFlag(HLERequestContext& ctx) {
|
|
||||||
IPC::RequestParser rp{ctx};
|
|
||||||
m_system_settings.lock_screen_flag = rp.Pop<bool>();
|
|
||||||
SetSaveNeeded();
|
|
||||||
|
|
||||||
LOG_INFO(Service_SET, "called, lock_screen_flag={}", m_system_settings.lock_screen_flag);
|
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
|
||||||
rb.Push(ResultSuccess);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ISystemSettingsServer::GetAccountSettings(HLERequestContext& ctx) {
|
void ISystemSettingsServer::GetAccountSettings(HLERequestContext& ctx) {
|
||||||
LOG_INFO(Service_SET, "called");
|
LOG_INFO(Service_SET, "called");
|
||||||
|
|
||||||
@ -550,7 +531,7 @@ void ISystemSettingsServer::SetAccountSettings(HLERequestContext& ctx) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ISystemSettingsServer::GetEulaVersions(HLERequestContext& ctx) {
|
void ISystemSettingsServer::GetEulaVersions(HLERequestContext& ctx) {
|
||||||
LOG_INFO(Service_SET, "called, elements={}", m_system_settings.eula_version_count);
|
LOG_INFO(Service_SET, "called");
|
||||||
|
|
||||||
ctx.WriteBuffer(m_system_settings.eula_versions);
|
ctx.WriteBuffer(m_system_settings.eula_versions);
|
||||||
|
|
||||||
@ -576,7 +557,7 @@ void ISystemSettingsServer::SetEulaVersions(HLERequestContext& ctx) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ISystemSettingsServer::GetColorSetId(HLERequestContext& ctx) {
|
void ISystemSettingsServer::GetColorSetId(HLERequestContext& ctx) {
|
||||||
LOG_DEBUG(Service_SET, "called, color_set=", m_system_settings.color_set_id);
|
LOG_DEBUG(Service_SET, "called");
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 3};
|
IPC::ResponseBuilder rb{ctx, 3};
|
||||||
rb.Push(ResultSuccess);
|
rb.Push(ResultSuccess);
|
||||||
@ -595,13 +576,7 @@ void ISystemSettingsServer::SetColorSetId(HLERequestContext& ctx) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ISystemSettingsServer::GetNotificationSettings(HLERequestContext& ctx) {
|
void ISystemSettingsServer::GetNotificationSettings(HLERequestContext& ctx) {
|
||||||
LOG_INFO(Service_SET, "called, flags={}, volume={}, head_time={}:{}, tailt_time={}:{}",
|
LOG_INFO(Service_SET, "called");
|
||||||
m_system_settings.notification_settings.flags.raw,
|
|
||||||
m_system_settings.notification_settings.volume,
|
|
||||||
m_system_settings.notification_settings.start_time.hour,
|
|
||||||
m_system_settings.notification_settings.start_time.minute,
|
|
||||||
m_system_settings.notification_settings.stop_time.hour,
|
|
||||||
m_system_settings.notification_settings.stop_time.minute);
|
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 8};
|
IPC::ResponseBuilder rb{ctx, 8};
|
||||||
rb.Push(ResultSuccess);
|
rb.Push(ResultSuccess);
|
||||||
@ -626,8 +601,7 @@ void ISystemSettingsServer::SetNotificationSettings(HLERequestContext& ctx) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ISystemSettingsServer::GetAccountNotificationSettings(HLERequestContext& ctx) {
|
void ISystemSettingsServer::GetAccountNotificationSettings(HLERequestContext& ctx) {
|
||||||
LOG_INFO(Service_SET, "called, elements={}",
|
LOG_INFO(Service_SET, "called");
|
||||||
m_system_settings.account_notification_settings_count);
|
|
||||||
|
|
||||||
ctx.WriteBuffer(m_system_settings.account_notification_settings);
|
ctx.WriteBuffer(m_system_settings.account_notification_settings);
|
||||||
|
|
||||||
@ -671,7 +645,6 @@ using Settings =
|
|||||||
static Settings GetSettings() {
|
static Settings GetSettings() {
|
||||||
Settings ret;
|
Settings ret;
|
||||||
|
|
||||||
// AM
|
|
||||||
ret["hbloader"]["applet_heap_size"] = ToBytes(u64{0x0});
|
ret["hbloader"]["applet_heap_size"] = ToBytes(u64{0x0});
|
||||||
ret["hbloader"]["applet_heap_reservation_size"] = ToBytes(u64{0x8600000});
|
ret["hbloader"]["applet_heap_reservation_size"] = ToBytes(u64{0x8600000});
|
||||||
|
|
||||||
@ -683,24 +656,6 @@ static Settings GetSettings() {
|
|||||||
ret["time"]["standard_steady_clock_test_offset_minutes"] = ToBytes(s32{0});
|
ret["time"]["standard_steady_clock_test_offset_minutes"] = ToBytes(s32{0});
|
||||||
ret["time"]["standard_user_clock_initial_year"] = ToBytes(s32{2023});
|
ret["time"]["standard_user_clock_initial_year"] = ToBytes(s32{2023});
|
||||||
|
|
||||||
// HID
|
|
||||||
ret["hid_debug"]["enables_debugpad"] = ToBytes(bool{true});
|
|
||||||
ret["hid_debug"]["manages_devices"] = ToBytes(bool{true});
|
|
||||||
ret["hid_debug"]["manages_touch_ic_i2c"] = ToBytes(bool{true});
|
|
||||||
ret["hid_debug"]["emulate_future_device"] = ToBytes(bool{false});
|
|
||||||
ret["hid_debug"]["emulate_mcu_hardware_error"] = ToBytes(bool{false});
|
|
||||||
ret["hid_debug"]["enables_rail"] = ToBytes(bool{true});
|
|
||||||
ret["hid_debug"]["emulate_firmware_update_failure"] = ToBytes(bool{false});
|
|
||||||
ret["hid_debug"]["failure_firmware_update"] = ToBytes(s32{0});
|
|
||||||
ret["hid_debug"]["ble_disabled"] = ToBytes(bool{false});
|
|
||||||
ret["hid_debug"]["dscale_disabled"] = ToBytes(bool{false});
|
|
||||||
ret["hid_debug"]["force_handheld"] = ToBytes(bool{true});
|
|
||||||
ret["hid_debug"]["disabled_features_per_id"] = std::vector<u8>(0xa8);
|
|
||||||
ret["hid_debug"]["touch_firmware_auto_update_disabled"] = ToBytes(bool{false});
|
|
||||||
|
|
||||||
// Settings
|
|
||||||
ret["settings_debug"]["is_debug_mode_enabled"] = ToBytes(bool{false});
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -753,15 +708,7 @@ void ISystemSettingsServer::GetSettingsItemValue(HLERequestContext& ctx) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ISystemSettingsServer::GetTvSettings(HLERequestContext& ctx) {
|
void ISystemSettingsServer::GetTvSettings(HLERequestContext& ctx) {
|
||||||
LOG_INFO(Service_SET,
|
LOG_INFO(Service_SET, "called");
|
||||||
"called, flags={}, cmu_mode={}, contrast_ratio={}, hdmi_content_type={}, "
|
|
||||||
"rgb_range={}, tv_gama={}, tv_resolution={}, tv_underscan={}",
|
|
||||||
m_system_settings.tv_settings.flags.raw, m_system_settings.tv_settings.cmu_mode,
|
|
||||||
m_system_settings.tv_settings.contrast_ratio,
|
|
||||||
m_system_settings.tv_settings.hdmi_content_type,
|
|
||||||
m_system_settings.tv_settings.rgb_range, m_system_settings.tv_settings.tv_gama,
|
|
||||||
m_system_settings.tv_settings.tv_resolution,
|
|
||||||
m_system_settings.tv_settings.tv_underscan);
|
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 10};
|
IPC::ResponseBuilder rb{ctx, 10};
|
||||||
rb.Push(ResultSuccess);
|
rb.Push(ResultSuccess);
|
||||||
@ -788,26 +735,23 @@ void ISystemSettingsServer::SetTvSettings(HLERequestContext& ctx) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ISystemSettingsServer::GetDebugModeFlag(HLERequestContext& ctx) {
|
void ISystemSettingsServer::GetDebugModeFlag(HLERequestContext& ctx) {
|
||||||
bool is_debug_mode_enabled = false;
|
LOG_DEBUG(Service_SET, "called");
|
||||||
GetSettingsItemValue<bool>(is_debug_mode_enabled, "settings_debug", "is_debug_mode_enabled");
|
|
||||||
|
|
||||||
LOG_DEBUG(Service_SET, "called, is_debug_mode_enabled={}", is_debug_mode_enabled);
|
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 3};
|
IPC::ResponseBuilder rb{ctx, 3};
|
||||||
rb.Push(ResultSuccess);
|
rb.Push(ResultSuccess);
|
||||||
rb.Push(is_debug_mode_enabled);
|
rb.Push<u32>(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ISystemSettingsServer::GetQuestFlag(HLERequestContext& ctx) {
|
void ISystemSettingsServer::GetQuestFlag(HLERequestContext& ctx) {
|
||||||
LOG_INFO(Service_SET, "called, quest_flag={}", m_system_settings.quest_flag);
|
LOG_WARNING(Service_SET, "(STUBBED) called");
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 3};
|
IPC::ResponseBuilder rb{ctx, 3};
|
||||||
rb.Push(ResultSuccess);
|
rb.Push(ResultSuccess);
|
||||||
rb.PushEnum(m_system_settings.quest_flag);
|
rb.PushEnum(QuestFlag::Retail);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ISystemSettingsServer::GetDeviceTimeZoneLocationName(HLERequestContext& ctx) {
|
void ISystemSettingsServer::GetDeviceTimeZoneLocationName(HLERequestContext& ctx) {
|
||||||
LOG_INFO(Service_SET, "called");
|
LOG_WARNING(Service_SET, "called");
|
||||||
|
|
||||||
Service::Time::TimeZone::LocationName name{};
|
Service::Time::TimeZone::LocationName name{};
|
||||||
auto res = GetDeviceTimeZoneLocationName(name);
|
auto res = GetDeviceTimeZoneLocationName(name);
|
||||||
@ -818,7 +762,7 @@ void ISystemSettingsServer::GetDeviceTimeZoneLocationName(HLERequestContext& ctx
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ISystemSettingsServer::SetDeviceTimeZoneLocationName(HLERequestContext& ctx) {
|
void ISystemSettingsServer::SetDeviceTimeZoneLocationName(HLERequestContext& ctx) {
|
||||||
LOG_INFO(Service_SET, "called");
|
LOG_WARNING(Service_SET, "called");
|
||||||
|
|
||||||
IPC::RequestParser rp{ctx};
|
IPC::RequestParser rp{ctx};
|
||||||
auto name{rp.PopRaw<Service::Time::TimeZone::LocationName>()};
|
auto name{rp.PopRaw<Service::Time::TimeZone::LocationName>()};
|
||||||
@ -831,7 +775,7 @@ void ISystemSettingsServer::SetDeviceTimeZoneLocationName(HLERequestContext& ctx
|
|||||||
|
|
||||||
void ISystemSettingsServer::SetRegionCode(HLERequestContext& ctx) {
|
void ISystemSettingsServer::SetRegionCode(HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp{ctx};
|
IPC::RequestParser rp{ctx};
|
||||||
m_system_settings.region_code = rp.PopEnum<SystemRegionCode>();
|
m_system_settings.region_code = rp.PopEnum<RegionCode>();
|
||||||
SetSaveNeeded();
|
SetSaveNeeded();
|
||||||
|
|
||||||
LOG_INFO(Service_SET, "called, region_code={}", m_system_settings.region_code);
|
LOG_INFO(Service_SET, "called, region_code={}", m_system_settings.region_code);
|
||||||
@ -888,38 +832,15 @@ void ISystemSettingsServer::SetUserSystemClockAutomaticCorrectionEnabled(HLERequ
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ISystemSettingsServer::GetPrimaryAlbumStorage(HLERequestContext& ctx) {
|
void ISystemSettingsServer::GetPrimaryAlbumStorage(HLERequestContext& ctx) {
|
||||||
LOG_INFO(Service_SET, "called, primary_album_storage={}",
|
LOG_WARNING(Service_SET, "(STUBBED) called");
|
||||||
m_system_settings.primary_album_storage);
|
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 3};
|
IPC::ResponseBuilder rb{ctx, 3};
|
||||||
rb.Push(ResultSuccess);
|
rb.Push(ResultSuccess);
|
||||||
rb.PushEnum(m_system_settings.primary_album_storage);
|
rb.PushEnum(PrimaryAlbumStorage::SdCard);
|
||||||
}
|
|
||||||
|
|
||||||
void ISystemSettingsServer::GetNfcEnableFlag(HLERequestContext& ctx) {
|
|
||||||
LOG_INFO(Service_SET, "called, nfc_enable_flag={}", m_system_settings.nfc_enable_flag);
|
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 3};
|
|
||||||
rb.Push(ResultSuccess);
|
|
||||||
rb.Push<u8>(m_system_settings.nfc_enable_flag);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ISystemSettingsServer::SetNfcEnableFlag(HLERequestContext& ctx) {
|
|
||||||
IPC::RequestParser rp{ctx};
|
|
||||||
m_system_settings.nfc_enable_flag = rp.Pop<bool>();
|
|
||||||
SetSaveNeeded();
|
|
||||||
|
|
||||||
LOG_INFO(Service_SET, "called, nfc_enable_flag={}", m_system_settings.nfc_enable_flag);
|
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
|
||||||
rb.Push(ResultSuccess);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ISystemSettingsServer::GetSleepSettings(HLERequestContext& ctx) {
|
void ISystemSettingsServer::GetSleepSettings(HLERequestContext& ctx) {
|
||||||
LOG_INFO(Service_SET, "called, flags={}, handheld_sleep_plan={}, console_sleep_plan={}",
|
LOG_INFO(Service_SET, "called");
|
||||||
m_system_settings.sleep_settings.flags.raw,
|
|
||||||
m_system_settings.sleep_settings.handheld_sleep_plan,
|
|
||||||
m_system_settings.sleep_settings.console_sleep_plan);
|
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 5};
|
IPC::ResponseBuilder rb{ctx, 5};
|
||||||
rb.Push(ResultSuccess);
|
rb.Push(ResultSuccess);
|
||||||
@ -940,32 +861,8 @@ void ISystemSettingsServer::SetSleepSettings(HLERequestContext& ctx) {
|
|||||||
rb.Push(ResultSuccess);
|
rb.Push(ResultSuccess);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ISystemSettingsServer::GetWirelessLanEnableFlag(HLERequestContext& ctx) {
|
|
||||||
LOG_INFO(Service_SET, "called, wireless_lan_enable_flag={}",
|
|
||||||
m_system_settings.wireless_lan_enable_flag);
|
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 3};
|
|
||||||
rb.Push(ResultSuccess);
|
|
||||||
rb.Push(m_system_settings.wireless_lan_enable_flag);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ISystemSettingsServer::SetWirelessLanEnableFlag(HLERequestContext& ctx) {
|
|
||||||
IPC::RequestParser rp{ctx};
|
|
||||||
m_system_settings.wireless_lan_enable_flag = rp.Pop<bool>();
|
|
||||||
SetSaveNeeded();
|
|
||||||
|
|
||||||
LOG_INFO(Service_SET, "called, wireless_lan_enable_flag={}",
|
|
||||||
m_system_settings.wireless_lan_enable_flag);
|
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
|
||||||
rb.Push(ResultSuccess);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ISystemSettingsServer::GetInitialLaunchSettings(HLERequestContext& ctx) {
|
void ISystemSettingsServer::GetInitialLaunchSettings(HLERequestContext& ctx) {
|
||||||
LOG_INFO(Service_SET, "called, flags={}, timestamp={}",
|
LOG_INFO(Service_SET, "called");
|
||||||
m_system_settings.initial_launch_settings_packed.flags.raw,
|
|
||||||
m_system_settings.initial_launch_settings_packed.timestamp.time_point);
|
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 10};
|
IPC::ResponseBuilder rb{ctx, 10};
|
||||||
rb.Push(ResultSuccess);
|
rb.Push(ResultSuccess);
|
||||||
rb.PushRaw(m_system_settings.initial_launch_settings_packed);
|
rb.PushRaw(m_system_settings.initial_launch_settings_packed);
|
||||||
@ -1016,51 +913,35 @@ void ISystemSettingsServer::GetProductModel(HLERequestContext& ctx) {
|
|||||||
rb.Push(product_model);
|
rb.Push(product_model);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ISystemSettingsServer::GetBluetoothEnableFlag(HLERequestContext& ctx) {
|
|
||||||
LOG_INFO(Service_SET, "called, bluetooth_enable_flag={}",
|
|
||||||
m_system_settings.bluetooth_enable_flag);
|
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 3};
|
|
||||||
rb.Push(ResultSuccess);
|
|
||||||
rb.Push<u8>(m_system_settings.bluetooth_enable_flag);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ISystemSettingsServer::SetBluetoothEnableFlag(HLERequestContext& ctx) {
|
|
||||||
IPC::RequestParser rp{ctx};
|
|
||||||
m_system_settings.bluetooth_enable_flag = rp.Pop<bool>();
|
|
||||||
SetSaveNeeded();
|
|
||||||
|
|
||||||
LOG_INFO(Service_SET, "called, bluetooth_enable_flag={}",
|
|
||||||
m_system_settings.bluetooth_enable_flag);
|
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
|
||||||
rb.Push(ResultSuccess);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ISystemSettingsServer::GetMiiAuthorId(HLERequestContext& ctx) {
|
void ISystemSettingsServer::GetMiiAuthorId(HLERequestContext& ctx) {
|
||||||
LOG_INFO(Service_SET, "called, author_id={}",
|
const auto author_id = Common::UUID::MakeDefault();
|
||||||
m_system_settings.mii_author_id.FormattedString());
|
|
||||||
|
LOG_WARNING(Service_SET, "(STUBBED) called, author_id={}", author_id.FormattedString());
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 6};
|
IPC::ResponseBuilder rb{ctx, 6};
|
||||||
rb.Push(ResultSuccess);
|
rb.Push(ResultSuccess);
|
||||||
rb.PushRaw(m_system_settings.mii_author_id);
|
rb.PushRaw(author_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ISystemSettingsServer::GetAutoUpdateEnableFlag(HLERequestContext& ctx) {
|
void ISystemSettingsServer::GetAutoUpdateEnableFlag(HLERequestContext& ctx) {
|
||||||
LOG_INFO(Service_SET, "called, auto_update_flag={}", m_system_settings.auto_update_enable_flag);
|
u8 auto_update_flag{};
|
||||||
|
|
||||||
|
LOG_WARNING(Service_SET, "(STUBBED) called, auto_update_flag={}", auto_update_flag);
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 3};
|
IPC::ResponseBuilder rb{ctx, 3};
|
||||||
rb.Push(ResultSuccess);
|
rb.Push(ResultSuccess);
|
||||||
rb.Push(m_system_settings.auto_update_enable_flag);
|
rb.Push(auto_update_flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ISystemSettingsServer::GetBatteryPercentageFlag(HLERequestContext& ctx) {
|
void ISystemSettingsServer::GetBatteryPercentageFlag(HLERequestContext& ctx) {
|
||||||
LOG_DEBUG(Service_SET, "called, battery_percentage_flag={}",
|
u8 battery_percentage_flag{1};
|
||||||
m_system_settings.battery_percentage_flag);
|
|
||||||
|
LOG_WARNING(Service_SET, "(STUBBED) called, battery_percentage_flag={}",
|
||||||
|
battery_percentage_flag);
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 3};
|
IPC::ResponseBuilder rb{ctx, 3};
|
||||||
rb.Push(ResultSuccess);
|
rb.Push(ResultSuccess);
|
||||||
rb.Push(m_system_settings.battery_percentage_flag);
|
rb.Push(battery_percentage_flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ISystemSettingsServer::SetExternalSteadyClockInternalOffset(HLERequestContext& ctx) {
|
void ISystemSettingsServer::SetExternalSteadyClockInternalOffset(HLERequestContext& ctx) {
|
||||||
@ -1087,12 +968,11 @@ void ISystemSettingsServer::GetExternalSteadyClockInternalOffset(HLERequestConte
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ISystemSettingsServer::GetErrorReportSharePermission(HLERequestContext& ctx) {
|
void ISystemSettingsServer::GetErrorReportSharePermission(HLERequestContext& ctx) {
|
||||||
LOG_INFO(Service_SET, "called, error_report_share_permission={}",
|
LOG_WARNING(Service_SET, "(STUBBED) called");
|
||||||
m_system_settings.error_report_share_permission);
|
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 3};
|
IPC::ResponseBuilder rb{ctx, 3};
|
||||||
rb.Push(ResultSuccess);
|
rb.Push(ResultSuccess);
|
||||||
rb.PushEnum(m_system_settings.error_report_share_permission);
|
rb.PushEnum(ErrorReportSharePermission::Denied);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ISystemSettingsServer::GetAppletLaunchFlags(HLERequestContext& ctx) {
|
void ISystemSettingsServer::GetAppletLaunchFlags(HLERequestContext& ctx) {
|
||||||
@ -1134,7 +1014,7 @@ void ISystemSettingsServer::GetKeyboardLayout(HLERequestContext& ctx) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ISystemSettingsServer::GetDeviceTimeZoneLocationUpdatedTime(HLERequestContext& ctx) {
|
void ISystemSettingsServer::GetDeviceTimeZoneLocationUpdatedTime(HLERequestContext& ctx) {
|
||||||
LOG_INFO(Service_SET, "called");
|
LOG_WARNING(Service_SET, "called.");
|
||||||
|
|
||||||
Service::Time::Clock::SteadyClockTimePoint time_point{};
|
Service::Time::Clock::SteadyClockTimePoint time_point{};
|
||||||
auto res = GetDeviceTimeZoneLocationUpdatedTime(time_point);
|
auto res = GetDeviceTimeZoneLocationUpdatedTime(time_point);
|
||||||
@ -1145,7 +1025,7 @@ void ISystemSettingsServer::GetDeviceTimeZoneLocationUpdatedTime(HLERequestConte
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ISystemSettingsServer::SetDeviceTimeZoneLocationUpdatedTime(HLERequestContext& ctx) {
|
void ISystemSettingsServer::SetDeviceTimeZoneLocationUpdatedTime(HLERequestContext& ctx) {
|
||||||
LOG_INFO(Service_SET, "called");
|
LOG_WARNING(Service_SET, "called.");
|
||||||
|
|
||||||
IPC::RequestParser rp{ctx};
|
IPC::RequestParser rp{ctx};
|
||||||
auto time_point{rp.PopRaw<Service::Time::Clock::SteadyClockTimePoint>()};
|
auto time_point{rp.PopRaw<Service::Time::Clock::SteadyClockTimePoint>()};
|
||||||
@ -1158,7 +1038,7 @@ void ISystemSettingsServer::SetDeviceTimeZoneLocationUpdatedTime(HLERequestConte
|
|||||||
|
|
||||||
void ISystemSettingsServer::GetUserSystemClockAutomaticCorrectionUpdatedTime(
|
void ISystemSettingsServer::GetUserSystemClockAutomaticCorrectionUpdatedTime(
|
||||||
HLERequestContext& ctx) {
|
HLERequestContext& ctx) {
|
||||||
LOG_INFO(Service_SET, "called");
|
LOG_WARNING(Service_SET, "called.");
|
||||||
|
|
||||||
Service::Time::Clock::SteadyClockTimePoint time_point{};
|
Service::Time::Clock::SteadyClockTimePoint time_point{};
|
||||||
auto res = GetUserSystemClockAutomaticCorrectionUpdatedTime(time_point);
|
auto res = GetUserSystemClockAutomaticCorrectionUpdatedTime(time_point);
|
||||||
@ -1170,7 +1050,7 @@ void ISystemSettingsServer::GetUserSystemClockAutomaticCorrectionUpdatedTime(
|
|||||||
|
|
||||||
void ISystemSettingsServer::SetUserSystemClockAutomaticCorrectionUpdatedTime(
|
void ISystemSettingsServer::SetUserSystemClockAutomaticCorrectionUpdatedTime(
|
||||||
HLERequestContext& ctx) {
|
HLERequestContext& ctx) {
|
||||||
LOG_INFO(Service_SET, "called");
|
LOG_WARNING(Service_SET, "called.");
|
||||||
|
|
||||||
IPC::RequestParser rp{ctx};
|
IPC::RequestParser rp{ctx};
|
||||||
auto time_point{rp.PopRaw<Service::Time::Clock::SteadyClockTimePoint>()};
|
auto time_point{rp.PopRaw<Service::Time::Clock::SteadyClockTimePoint>()};
|
||||||
@ -1182,12 +1062,11 @@ void ISystemSettingsServer::SetUserSystemClockAutomaticCorrectionUpdatedTime(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ISystemSettingsServer::GetChineseTraditionalInputMethod(HLERequestContext& ctx) {
|
void ISystemSettingsServer::GetChineseTraditionalInputMethod(HLERequestContext& ctx) {
|
||||||
LOG_INFO(Service_SET, "called, chinese_traditional_input_method={}",
|
LOG_WARNING(Service_SET, "(STUBBED) called");
|
||||||
m_system_settings.chinese_traditional_input_method);
|
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 3};
|
IPC::ResponseBuilder rb{ctx, 3};
|
||||||
rb.Push(ResultSuccess);
|
rb.Push(ResultSuccess);
|
||||||
rb.PushEnum(m_system_settings.chinese_traditional_input_method);
|
rb.PushEnum(ChineseTraditionalInputMethod::Unknown0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ISystemSettingsServer::GetHomeMenuScheme(HLERequestContext& ctx) {
|
void ISystemSettingsServer::GetHomeMenuScheme(HLERequestContext& ctx) {
|
||||||
@ -1215,11 +1094,11 @@ void ISystemSettingsServer::GetHomeMenuSchemeModel(HLERequestContext& ctx) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ISystemSettingsServer::GetFieldTestingFlag(HLERequestContext& ctx) {
|
void ISystemSettingsServer::GetFieldTestingFlag(HLERequestContext& ctx) {
|
||||||
LOG_INFO(Service_SET, "called, field_testing_flag={}", m_system_settings.field_testing_flag);
|
LOG_WARNING(Service_SET, "(STUBBED) called");
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 3};
|
IPC::ResponseBuilder rb{ctx, 3};
|
||||||
rb.Push(ResultSuccess);
|
rb.Push(ResultSuccess);
|
||||||
rb.Push(m_system_settings.field_testing_flag);
|
rb.Push<u8>(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ISystemSettingsServer::SetupSettings() {
|
void ISystemSettingsServer::SetupSettings() {
|
||||||
|
@ -12,11 +12,10 @@
|
|||||||
#include "common/uuid.h"
|
#include "common/uuid.h"
|
||||||
#include "core/hle/result.h"
|
#include "core/hle/result.h"
|
||||||
#include "core/hle/service/service.h"
|
#include "core/hle/service/service.h"
|
||||||
#include "core/hle/service/set/setting_formats/appln_settings.h"
|
#include "core/hle/service/set/appln_settings.h"
|
||||||
#include "core/hle/service/set/setting_formats/device_settings.h"
|
#include "core/hle/service/set/device_settings.h"
|
||||||
#include "core/hle/service/set/setting_formats/private_settings.h"
|
#include "core/hle/service/set/private_settings.h"
|
||||||
#include "core/hle/service/set/setting_formats/system_settings.h"
|
#include "core/hle/service/set/system_settings.h"
|
||||||
#include "core/hle/service/set/settings_types.h"
|
|
||||||
#include "core/hle/service/time/clock_types.h"
|
#include "core/hle/service/time/clock_types.h"
|
||||||
#include "core/hle/service/time/time_zone_types.h"
|
#include "core/hle/service/time/time_zone_types.h"
|
||||||
|
|
||||||
@ -25,6 +24,25 @@ class System;
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace Service::Set {
|
namespace Service::Set {
|
||||||
|
enum class GetFirmwareVersionType {
|
||||||
|
Version1,
|
||||||
|
Version2,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct FirmwareVersionFormat {
|
||||||
|
u8 major;
|
||||||
|
u8 minor;
|
||||||
|
u8 micro;
|
||||||
|
INSERT_PADDING_BYTES(1);
|
||||||
|
u8 revision_major;
|
||||||
|
u8 revision_minor;
|
||||||
|
INSERT_PADDING_BYTES(2);
|
||||||
|
std::array<char, 0x20> platform;
|
||||||
|
std::array<u8, 0x40> version_hash;
|
||||||
|
std::array<char, 0x18> display_version;
|
||||||
|
std::array<char, 0x80> display_title;
|
||||||
|
};
|
||||||
|
static_assert(sizeof(FirmwareVersionFormat) == 0x100, "FirmwareVersionFormat is an invalid size");
|
||||||
|
|
||||||
Result GetFirmwareVersionImpl(FirmwareVersionFormat& out_firmware, Core::System& system,
|
Result GetFirmwareVersionImpl(FirmwareVersionFormat& out_firmware, Core::System& system,
|
||||||
GetFirmwareVersionType type);
|
GetFirmwareVersionType type);
|
||||||
@ -37,18 +55,6 @@ public:
|
|||||||
Result GetSettingsItemValue(std::vector<u8>& out_value, const std::string& category,
|
Result GetSettingsItemValue(std::vector<u8>& out_value, const std::string& category,
|
||||||
const std::string& name);
|
const std::string& name);
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
Result GetSettingsItemValue(T& value, const std::string& category, const std::string& name) {
|
|
||||||
std::vector<u8> data;
|
|
||||||
const auto result = GetSettingsItemValue(data, category, name);
|
|
||||||
if (result.IsError()) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
ASSERT(data.size() >= sizeof(T));
|
|
||||||
std::memcpy(&value, data.data(), sizeof(T));
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
Result GetExternalSteadyClockSourceId(Common::UUID& out_id);
|
Result GetExternalSteadyClockSourceId(Common::UUID& out_id);
|
||||||
Result SetExternalSteadyClockSourceId(Common::UUID id);
|
Result SetExternalSteadyClockSourceId(Common::UUID id);
|
||||||
Result GetUserSystemClockContext(Service::Time::Clock::SystemClockContext& out_context);
|
Result GetUserSystemClockContext(Service::Time::Clock::SystemClockContext& out_context);
|
||||||
@ -74,8 +80,6 @@ private:
|
|||||||
void SetLanguageCode(HLERequestContext& ctx);
|
void SetLanguageCode(HLERequestContext& ctx);
|
||||||
void GetFirmwareVersion(HLERequestContext& ctx);
|
void GetFirmwareVersion(HLERequestContext& ctx);
|
||||||
void GetFirmwareVersion2(HLERequestContext& ctx);
|
void GetFirmwareVersion2(HLERequestContext& ctx);
|
||||||
void GetLockScreenFlag(HLERequestContext& ctx);
|
|
||||||
void SetLockScreenFlag(HLERequestContext& ctx);
|
|
||||||
void GetExternalSteadyClockSourceId(HLERequestContext& ctx);
|
void GetExternalSteadyClockSourceId(HLERequestContext& ctx);
|
||||||
void SetExternalSteadyClockSourceId(HLERequestContext& ctx);
|
void SetExternalSteadyClockSourceId(HLERequestContext& ctx);
|
||||||
void GetUserSystemClockContext(HLERequestContext& ctx);
|
void GetUserSystemClockContext(HLERequestContext& ctx);
|
||||||
@ -104,19 +108,13 @@ private:
|
|||||||
void IsUserSystemClockAutomaticCorrectionEnabled(HLERequestContext& ctx);
|
void IsUserSystemClockAutomaticCorrectionEnabled(HLERequestContext& ctx);
|
||||||
void SetUserSystemClockAutomaticCorrectionEnabled(HLERequestContext& ctx);
|
void SetUserSystemClockAutomaticCorrectionEnabled(HLERequestContext& ctx);
|
||||||
void GetPrimaryAlbumStorage(HLERequestContext& ctx);
|
void GetPrimaryAlbumStorage(HLERequestContext& ctx);
|
||||||
void GetNfcEnableFlag(HLERequestContext& ctx);
|
|
||||||
void SetNfcEnableFlag(HLERequestContext& ctx);
|
|
||||||
void GetSleepSettings(HLERequestContext& ctx);
|
void GetSleepSettings(HLERequestContext& ctx);
|
||||||
void SetSleepSettings(HLERequestContext& ctx);
|
void SetSleepSettings(HLERequestContext& ctx);
|
||||||
void GetWirelessLanEnableFlag(HLERequestContext& ctx);
|
|
||||||
void SetWirelessLanEnableFlag(HLERequestContext& ctx);
|
|
||||||
void GetInitialLaunchSettings(HLERequestContext& ctx);
|
void GetInitialLaunchSettings(HLERequestContext& ctx);
|
||||||
void SetInitialLaunchSettings(HLERequestContext& ctx);
|
void SetInitialLaunchSettings(HLERequestContext& ctx);
|
||||||
void GetDeviceNickName(HLERequestContext& ctx);
|
void GetDeviceNickName(HLERequestContext& ctx);
|
||||||
void SetDeviceNickName(HLERequestContext& ctx);
|
void SetDeviceNickName(HLERequestContext& ctx);
|
||||||
void GetProductModel(HLERequestContext& ctx);
|
void GetProductModel(HLERequestContext& ctx);
|
||||||
void GetBluetoothEnableFlag(HLERequestContext& ctx);
|
|
||||||
void SetBluetoothEnableFlag(HLERequestContext& ctx);
|
|
||||||
void GetMiiAuthorId(HLERequestContext& ctx);
|
void GetMiiAuthorId(HLERequestContext& ctx);
|
||||||
void GetAutoUpdateEnableFlag(HLERequestContext& ctx);
|
void GetAutoUpdateEnableFlag(HLERequestContext& ctx);
|
||||||
void GetBatteryPercentageFlag(HLERequestContext& ctx);
|
void GetBatteryPercentageFlag(HLERequestContext& ctx);
|
||||||
|
@ -91,10 +91,6 @@ void Display::CreateLayer(u64 layer_id, u32 binder_id,
|
|||||||
layers.emplace_back(std::make_unique<Layer>(layer_id, binder_id, *core, *producer,
|
layers.emplace_back(std::make_unique<Layer>(layer_id, binder_id, *core, *producer,
|
||||||
std::move(buffer_item_consumer)));
|
std::move(buffer_item_consumer)));
|
||||||
|
|
||||||
if (is_abandoned) {
|
|
||||||
this->FindLayer(layer_id)->GetConsumer().Abandon();
|
|
||||||
}
|
|
||||||
|
|
||||||
hos_binder_driver_server.RegisterProducer(std::move(producer));
|
hos_binder_driver_server.RegisterProducer(std::move(producer));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,13 +103,6 @@ void Display::DestroyLayer(u64 layer_id) {
|
|||||||
[layer_id](const auto& layer) { return layer->GetLayerId() == layer_id; });
|
[layer_id](const auto& layer) { return layer->GetLayerId() == layer_id; });
|
||||||
}
|
}
|
||||||
|
|
||||||
void Display::Abandon() {
|
|
||||||
for (auto& layer : layers) {
|
|
||||||
layer->GetConsumer().Abandon();
|
|
||||||
}
|
|
||||||
is_abandoned = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
Layer* Display::FindLayer(u64 layer_id) {
|
Layer* Display::FindLayer(u64 layer_id) {
|
||||||
const auto itr =
|
const auto itr =
|
||||||
std::find_if(layers.begin(), layers.end(), [layer_id](const std::unique_ptr<Layer>& layer) {
|
std::find_if(layers.begin(), layers.end(), [layer_id](const std::unique_ptr<Layer>& layer) {
|
||||||
|
@ -98,8 +98,6 @@ public:
|
|||||||
layers.clear();
|
layers.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Abandon();
|
|
||||||
|
|
||||||
/// Attempts to find a layer with the given ID.
|
/// Attempts to find a layer with the given ID.
|
||||||
///
|
///
|
||||||
/// @param layer_id The layer ID.
|
/// @param layer_id The layer ID.
|
||||||
@ -126,7 +124,6 @@ private:
|
|||||||
|
|
||||||
std::vector<std::unique_ptr<Layer>> layers;
|
std::vector<std::unique_ptr<Layer>> layers;
|
||||||
Kernel::KEvent* vsync_event{};
|
Kernel::KEvent* vsync_event{};
|
||||||
bool is_abandoned{};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Service::VI
|
} // namespace Service::VI
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <utility>
|
|
||||||
|
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
|
|
||||||
@ -76,12 +75,12 @@ public:
|
|||||||
return open;
|
return open;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Close() {
|
void Close() {
|
||||||
return std::exchange(open, false);
|
open = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Open() {
|
void Open() {
|
||||||
return !std::exchange(open, true);
|
open = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -719,12 +719,7 @@ private:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!nvnflinger.OpenLayer(layer_id)) {
|
nvnflinger.OpenLayer(layer_id);
|
||||||
LOG_WARNING(Service_VI, "Tried to open layer which was already open");
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
|
||||||
rb.Push(ResultOperationFailed);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
android::OutputParcel parcel;
|
android::OutputParcel parcel;
|
||||||
parcel.WriteInterface(NativeWindow{*buffer_queue_id});
|
parcel.WriteInterface(NativeWindow{*buffer_queue_id});
|
||||||
@ -742,12 +737,7 @@ private:
|
|||||||
|
|
||||||
LOG_DEBUG(Service_VI, "called. layer_id=0x{:016X}", layer_id);
|
LOG_DEBUG(Service_VI, "called. layer_id=0x{:016X}", layer_id);
|
||||||
|
|
||||||
if (!nvnflinger.CloseLayer(layer_id)) {
|
nvnflinger.CloseLayer(layer_id);
|
||||||
LOG_WARNING(Service_VI, "Tried to close layer which was not open");
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
|
||||||
rb.Push(ResultOperationFailed);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(ResultSuccess);
|
rb.Push(ResultSuccess);
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
#include <array>
|
#include <array>
|
||||||
#include "common/fs/fs.h"
|
#include "common/fs/fs.h"
|
||||||
#include "common/fs/path_util.h"
|
#include "common/fs/path_util.h"
|
||||||
#include "common/logging/log.h"
|
|
||||||
#include "common/settings.h"
|
#include "common/settings.h"
|
||||||
#include "common/settings_common.h"
|
#include "common/settings_common.h"
|
||||||
#include "common/settings_enums.h"
|
#include "common/settings_enums.h"
|
||||||
@ -59,19 +58,6 @@ void Config::Initialize(const std::optional<std::string> config_path) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Config::WriteToIni() const {
|
void Config::WriteToIni() const {
|
||||||
std::string config_type;
|
|
||||||
switch (type) {
|
|
||||||
case ConfigType::GlobalConfig:
|
|
||||||
config_type = "Global";
|
|
||||||
break;
|
|
||||||
case ConfigType::PerGameConfig:
|
|
||||||
config_type = "Game Specific";
|
|
||||||
break;
|
|
||||||
case ConfigType::InputProfile:
|
|
||||||
config_type = "Input Profile";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
LOG_INFO(Config, "Writing {} configuration to: {}", config_type, config_loc);
|
|
||||||
FILE* fp = nullptr;
|
FILE* fp = nullptr;
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
fp = _wfopen(Common::UTF8ToUTF16W(config_loc).data(), L"wb");
|
fp = _wfopen(Common::UTF8ToUTF16W(config_loc).data(), L"wb");
|
||||||
@ -131,10 +117,10 @@ void Config::ReadPlayerValues(const std::size_t player_index) {
|
|||||||
player_prefix.append("player_").append(ToString(player_index)).append("_");
|
player_prefix.append("player_").append(ToString(player_index)).append("_");
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto profile_name = ReadStringSetting(std::string(player_prefix).append("profile_name"));
|
|
||||||
|
|
||||||
auto& player = Settings::values.players.GetValue()[player_index];
|
auto& player = Settings::values.players.GetValue()[player_index];
|
||||||
if (IsCustomConfig()) {
|
if (IsCustomConfig()) {
|
||||||
|
const auto profile_name =
|
||||||
|
ReadStringSetting(std::string(player_prefix).append("profile_name"));
|
||||||
if (profile_name.empty()) {
|
if (profile_name.empty()) {
|
||||||
// Use the global input config
|
// Use the global input config
|
||||||
player = Settings::values.players.GetValue(true)[player_index];
|
player = Settings::values.players.GetValue(true)[player_index];
|
||||||
@ -153,10 +139,6 @@ void Config::ReadPlayerValues(const std::size_t player_index) {
|
|||||||
player.controller_type = controller;
|
player.controller_type = controller;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (global) {
|
|
||||||
auto& player_global = Settings::values.players.GetValue(true)[player_index];
|
|
||||||
player_global.profile_name = profile_name;
|
|
||||||
}
|
|
||||||
std::string connected_key = player_prefix;
|
std::string connected_key = player_prefix;
|
||||||
player.connected = ReadBooleanSetting(connected_key.append("connected"),
|
player.connected = ReadBooleanSetting(connected_key.append("connected"),
|
||||||
std::make_optional(player_index == 0));
|
std::make_optional(player_index == 0));
|
||||||
@ -430,11 +412,6 @@ void Config::SavePlayerValues(const std::size_t player_index) {
|
|||||||
std::make_optional(static_cast<u8>(Settings::ControllerType::ProController)));
|
std::make_optional(static_cast<u8>(Settings::ControllerType::ProController)));
|
||||||
|
|
||||||
if (!player_prefix.empty() || !Settings::IsConfiguringGlobal()) {
|
if (!player_prefix.empty() || !Settings::IsConfiguringGlobal()) {
|
||||||
if (global) {
|
|
||||||
const auto& player_global = Settings::values.players.GetValue(true)[player_index];
|
|
||||||
WriteStringSetting(std::string(player_prefix).append("profile_name"),
|
|
||||||
player_global.profile_name, std::make_optional(std::string("")));
|
|
||||||
}
|
|
||||||
WriteBooleanSetting(std::string(player_prefix).append("connected"), player.connected,
|
WriteBooleanSetting(std::string(player_prefix).append("connected"), player.connected,
|
||||||
std::make_optional(player_index == 0));
|
std::make_optional(player_index == 0));
|
||||||
WriteIntegerSetting(std::string(player_prefix).append("vibration_enabled"),
|
WriteIntegerSetting(std::string(player_prefix).append("vibration_enabled"),
|
||||||
@ -491,15 +468,12 @@ void Config::SaveMotionTouchValues() {
|
|||||||
|
|
||||||
void Config::SaveValues() {
|
void Config::SaveValues() {
|
||||||
if (global) {
|
if (global) {
|
||||||
LOG_DEBUG(Config, "Saving global generic configuration values");
|
|
||||||
SaveDataStorageValues();
|
SaveDataStorageValues();
|
||||||
SaveDebuggingValues();
|
SaveDebuggingValues();
|
||||||
SaveDisabledAddOnValues();
|
SaveDisabledAddOnValues();
|
||||||
SaveNetworkValues();
|
SaveNetworkValues();
|
||||||
SaveWebServiceValues();
|
SaveWebServiceValues();
|
||||||
SaveMiscellaneousValues();
|
SaveMiscellaneousValues();
|
||||||
} else {
|
|
||||||
LOG_DEBUG(Config, "Saving only generic configuration values");
|
|
||||||
}
|
}
|
||||||
SaveControlValues();
|
SaveControlValues();
|
||||||
SaveCoreValues();
|
SaveCoreValues();
|
||||||
@ -840,6 +814,10 @@ void Config::Reload() {
|
|||||||
SaveValues();
|
SaveValues();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Config::Save() {
|
||||||
|
SaveValues();
|
||||||
|
}
|
||||||
|
|
||||||
void Config::ClearControlPlayerValues() const {
|
void Config::ClearControlPlayerValues() const {
|
||||||
// If key is an empty string, all keys in the current group() are removed.
|
// If key is an empty string, all keys in the current group() are removed.
|
||||||
const char* section = Settings::TranslateCategory(Settings::Category::Controls);
|
const char* section = Settings::TranslateCategory(Settings::Category::Controls);
|
||||||
|
@ -51,6 +51,7 @@ protected:
|
|||||||
[[nodiscard]] bool IsCustomConfig() const;
|
[[nodiscard]] bool IsCustomConfig() const;
|
||||||
|
|
||||||
void Reload();
|
void Reload();
|
||||||
|
void Save();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Derived config classes must implement this so they can reload all platform-specific
|
* Derived config classes must implement this so they can reload all platform-specific
|
||||||
|
@ -110,7 +110,6 @@ void EmulatedController::ReloadFromSettings() {
|
|||||||
original_npad_type = npad_type;
|
original_npad_type = npad_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetPollingMode(EmulatedDeviceIndex::RightIndex, Common::Input::PollingMode::Active);
|
|
||||||
Disconnect();
|
Disconnect();
|
||||||
if (player.connected) {
|
if (player.connected) {
|
||||||
Connect();
|
Connect();
|
||||||
@ -145,8 +144,8 @@ void EmulatedController::ReloadColorsFromSettings() {
|
|||||||
|
|
||||||
void EmulatedController::LoadDevices() {
|
void EmulatedController::LoadDevices() {
|
||||||
// TODO(german77): Use more buttons to detect the correct device
|
// TODO(german77): Use more buttons to detect the correct device
|
||||||
const auto& left_joycon = button_params[Settings::NativeButton::DRight];
|
const auto left_joycon = button_params[Settings::NativeButton::DRight];
|
||||||
const auto& right_joycon = button_params[Settings::NativeButton::A];
|
const auto right_joycon = button_params[Settings::NativeButton::A];
|
||||||
|
|
||||||
// Triggers for GC controllers
|
// Triggers for GC controllers
|
||||||
trigger_params[LeftIndex] = button_params[Settings::NativeButton::ZL];
|
trigger_params[LeftIndex] = button_params[Settings::NativeButton::ZL];
|
||||||
@ -510,11 +509,11 @@ void EmulatedController::ReloadInput() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
turbo_button_state = 0;
|
turbo_button_state = 0;
|
||||||
is_initialized = true;
|
is_initalized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmulatedController::UnloadInput() {
|
void EmulatedController::UnloadInput() {
|
||||||
is_initialized = false;
|
is_initalized = false;
|
||||||
for (auto& button : button_devices) {
|
for (auto& button : button_devices) {
|
||||||
button.reset();
|
button.reset();
|
||||||
}
|
}
|
||||||
@ -1209,43 +1208,20 @@ void EmulatedController::SetNfc(const Common::Input::CallbackStatus& callback) {
|
|||||||
controller.nfc_state = controller.nfc_values;
|
controller.nfc_state = controller.nfc_values;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EmulatedController::SetVibration(bool should_vibrate) {
|
bool EmulatedController::SetVibration(std::size_t device_index, VibrationValue vibration) {
|
||||||
VibrationValue vibration_value = DEFAULT_VIBRATION_VALUE;
|
if (!is_initalized) {
|
||||||
if (should_vibrate) {
|
|
||||||
vibration_value.high_amplitude = 1.0f;
|
|
||||||
vibration_value.low_amplitude = 1.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
return SetVibration(DeviceIndex::Left, vibration_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool EmulatedController::SetVibration(u32 slot, Core::HID::VibrationGcErmCommand erm_command) {
|
|
||||||
VibrationValue vibration_value = DEFAULT_VIBRATION_VALUE;
|
|
||||||
if (erm_command == Core::HID::VibrationGcErmCommand::Start) {
|
|
||||||
vibration_value.high_amplitude = 1.0f;
|
|
||||||
vibration_value.low_amplitude = 1.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
return SetVibration(DeviceIndex::Left, vibration_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool EmulatedController::SetVibration(DeviceIndex device_index, const VibrationValue& vibration) {
|
|
||||||
if (!is_initialized) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (device_index >= DeviceIndex::MaxDeviceIndex) {
|
if (device_index >= output_devices.size()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const std::size_t index = static_cast<std::size_t>(device_index);
|
if (!output_devices[device_index]) {
|
||||||
if (!output_devices[index]) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const auto player_index = Service::HID::NpadIdTypeToIndex(npad_id_type);
|
const auto player_index = Service::HID::NpadIdTypeToIndex(npad_id_type);
|
||||||
const auto& player = Settings::values.players.GetValue()[player_index];
|
const auto& player = Settings::values.players.GetValue()[player_index];
|
||||||
const f32 strength = static_cast<f32>(player.vibration_strength) / 100.0f;
|
const f32 strength = static_cast<f32>(player.vibration_strength) / 100.0f;
|
||||||
|
|
||||||
last_vibration_value = vibration;
|
|
||||||
|
|
||||||
if (!player.vibration_enabled) {
|
if (!player.vibration_enabled) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1263,18 +1239,15 @@ bool EmulatedController::SetVibration(DeviceIndex device_index, const VibrationV
|
|||||||
.high_frequency = vibration.high_frequency,
|
.high_frequency = vibration.high_frequency,
|
||||||
.type = type,
|
.type = type,
|
||||||
};
|
};
|
||||||
return output_devices[index]->SetVibration(status) == Common::Input::DriverResult::Success;
|
return output_devices[device_index]->SetVibration(status) ==
|
||||||
}
|
Common::Input::DriverResult::Success;
|
||||||
|
|
||||||
VibrationValue EmulatedController::GetActualVibrationValue(DeviceIndex device_index) const {
|
|
||||||
return last_vibration_value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EmulatedController::IsVibrationEnabled(std::size_t device_index) {
|
bool EmulatedController::IsVibrationEnabled(std::size_t device_index) {
|
||||||
const auto player_index = Service::HID::NpadIdTypeToIndex(npad_id_type);
|
const auto player_index = Service::HID::NpadIdTypeToIndex(npad_id_type);
|
||||||
const auto& player = Settings::values.players.GetValue()[player_index];
|
const auto& player = Settings::values.players.GetValue()[player_index];
|
||||||
|
|
||||||
if (!is_initialized) {
|
if (!is_initalized) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1297,7 +1270,7 @@ Common::Input::DriverResult EmulatedController::SetPollingMode(
|
|||||||
EmulatedDeviceIndex device_index, Common::Input::PollingMode polling_mode) {
|
EmulatedDeviceIndex device_index, Common::Input::PollingMode polling_mode) {
|
||||||
LOG_INFO(Service_HID, "Set polling mode {}, device_index={}", polling_mode, device_index);
|
LOG_INFO(Service_HID, "Set polling mode {}, device_index={}", polling_mode, device_index);
|
||||||
|
|
||||||
if (!is_initialized) {
|
if (!is_initalized) {
|
||||||
return Common::Input::DriverResult::InvalidHandle;
|
return Common::Input::DriverResult::InvalidHandle;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1346,7 +1319,7 @@ bool EmulatedController::SetCameraFormat(
|
|||||||
Core::IrSensor::ImageTransferProcessorFormat camera_format) {
|
Core::IrSensor::ImageTransferProcessorFormat camera_format) {
|
||||||
LOG_INFO(Service_HID, "Set camera format {}", camera_format);
|
LOG_INFO(Service_HID, "Set camera format {}", camera_format);
|
||||||
|
|
||||||
if (!is_initialized) {
|
if (!is_initalized) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1374,7 +1347,7 @@ void EmulatedController::SetRingParam(Common::ParamPackage param) {
|
|||||||
|
|
||||||
bool EmulatedController::HasNfc() const {
|
bool EmulatedController::HasNfc() const {
|
||||||
|
|
||||||
if (!is_initialized) {
|
if (!is_initalized) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1415,7 +1388,7 @@ bool EmulatedController::RemoveNfcHandle() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool EmulatedController::StartNfcPolling() {
|
bool EmulatedController::StartNfcPolling() {
|
||||||
if (!is_initialized) {
|
if (!is_initalized) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1430,7 +1403,7 @@ bool EmulatedController::StartNfcPolling() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool EmulatedController::StopNfcPolling() {
|
bool EmulatedController::StopNfcPolling() {
|
||||||
if (!is_initialized) {
|
if (!is_initalized) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1445,7 +1418,7 @@ bool EmulatedController::StopNfcPolling() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool EmulatedController::ReadAmiiboData(std::vector<u8>& data) {
|
bool EmulatedController::ReadAmiiboData(std::vector<u8>& data) {
|
||||||
if (!is_initialized) {
|
if (!is_initalized) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1461,7 +1434,7 @@ bool EmulatedController::ReadAmiiboData(std::vector<u8>& data) {
|
|||||||
|
|
||||||
bool EmulatedController::ReadMifareData(const Common::Input::MifareRequest& request,
|
bool EmulatedController::ReadMifareData(const Common::Input::MifareRequest& request,
|
||||||
Common::Input::MifareRequest& out_data) {
|
Common::Input::MifareRequest& out_data) {
|
||||||
if (!is_initialized) {
|
if (!is_initalized) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1477,7 +1450,7 @@ bool EmulatedController::ReadMifareData(const Common::Input::MifareRequest& requ
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool EmulatedController::WriteMifareData(const Common::Input::MifareRequest& request) {
|
bool EmulatedController::WriteMifareData(const Common::Input::MifareRequest& request) {
|
||||||
if (!is_initialized) {
|
if (!is_initalized) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1492,7 +1465,7 @@ bool EmulatedController::WriteMifareData(const Common::Input::MifareRequest& req
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool EmulatedController::WriteNfc(const std::vector<u8>& data) {
|
bool EmulatedController::WriteNfc(const std::vector<u8>& data) {
|
||||||
if (!is_initialized) {
|
if (!is_initalized) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1507,7 +1480,7 @@ bool EmulatedController::WriteNfc(const std::vector<u8>& data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EmulatedController::SetLedPattern() {
|
void EmulatedController::SetLedPattern() {
|
||||||
if (!is_initialized) {
|
if (!is_initalized) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1535,8 +1508,8 @@ void EmulatedController::SetGyroscopeZeroDriftMode(GyroscopeZeroDriftMode mode)
|
|||||||
motion.emulated.SetGyroThreshold(motion.emulated.ThresholdLoose);
|
motion.emulated.SetGyroThreshold(motion.emulated.ThresholdLoose);
|
||||||
break;
|
break;
|
||||||
case GyroscopeZeroDriftMode::Tight:
|
case GyroscopeZeroDriftMode::Tight:
|
||||||
motion_sensitivity = motion.emulated.IsAtRestTight;
|
motion_sensitivity = motion.emulated.IsAtRestThight;
|
||||||
motion.emulated.SetGyroThreshold(motion.emulated.ThresholdTight);
|
motion.emulated.SetGyroThreshold(motion.emulated.ThresholdThight);
|
||||||
break;
|
break;
|
||||||
case GyroscopeZeroDriftMode::Standard:
|
case GyroscopeZeroDriftMode::Standard:
|
||||||
default:
|
default:
|
||||||
|
@ -355,28 +355,11 @@ public:
|
|||||||
/// Returns the latest ntag status from the controller
|
/// Returns the latest ntag status from the controller
|
||||||
const NfcState& GetNfc() const;
|
const NfcState& GetNfc() const;
|
||||||
|
|
||||||
/**
|
|
||||||
* Sends an on/off vibration to the left device
|
|
||||||
* @return true if vibration had no errors
|
|
||||||
*/
|
|
||||||
bool SetVibration(bool should_vibrate);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sends an GC vibration to the left device
|
|
||||||
* @return true if vibration had no errors
|
|
||||||
*/
|
|
||||||
bool SetVibration(u32 slot, Core::HID::VibrationGcErmCommand erm_command);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends a specific vibration to the output device
|
* Sends a specific vibration to the output device
|
||||||
* @return true if vibration had no errors
|
* @return true if vibration had no errors
|
||||||
*/
|
*/
|
||||||
bool SetVibration(DeviceIndex device_index, const VibrationValue& vibration);
|
bool SetVibration(std::size_t device_index, VibrationValue vibration);
|
||||||
|
|
||||||
/**
|
|
||||||
* @return The last sent vibration
|
|
||||||
*/
|
|
||||||
VibrationValue GetActualVibrationValue(DeviceIndex device_index) const;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends a small vibration to the output device
|
* Sends a small vibration to the output device
|
||||||
@ -576,12 +559,11 @@ private:
|
|||||||
NpadStyleTag supported_style_tag{NpadStyleSet::All};
|
NpadStyleTag supported_style_tag{NpadStyleSet::All};
|
||||||
bool is_connected{false};
|
bool is_connected{false};
|
||||||
bool is_configuring{false};
|
bool is_configuring{false};
|
||||||
bool is_initialized{false};
|
bool is_initalized{false};
|
||||||
bool system_buttons_enabled{true};
|
bool system_buttons_enabled{true};
|
||||||
f32 motion_sensitivity{Core::HID::MotionInput::IsAtRestStandard};
|
f32 motion_sensitivity{Core::HID::MotionInput::IsAtRestStandard};
|
||||||
u32 turbo_button_state{0};
|
u32 turbo_button_state{0};
|
||||||
std::size_t nfc_handles{0};
|
std::size_t nfc_handles{0};
|
||||||
VibrationValue last_vibration_value{DEFAULT_VIBRATION_VALUE};
|
|
||||||
|
|
||||||
// Temporary values to avoid doing changes while the controller is in configuring mode
|
// Temporary values to avoid doing changes while the controller is in configuring mode
|
||||||
NpadStyleIndex tmp_npad_type{NpadStyleIndex::None};
|
NpadStyleIndex tmp_npad_type{NpadStyleIndex::None};
|
||||||
|
@ -13,12 +13,12 @@ class MotionInput {
|
|||||||
public:
|
public:
|
||||||
static constexpr float ThresholdLoose = 0.01f;
|
static constexpr float ThresholdLoose = 0.01f;
|
||||||
static constexpr float ThresholdStandard = 0.007f;
|
static constexpr float ThresholdStandard = 0.007f;
|
||||||
static constexpr float ThresholdTight = 0.002f;
|
static constexpr float ThresholdThight = 0.002f;
|
||||||
|
|
||||||
static constexpr float IsAtRestRelaxed = 0.05f;
|
static constexpr float IsAtRestRelaxed = 0.05f;
|
||||||
static constexpr float IsAtRestLoose = 0.02f;
|
static constexpr float IsAtRestLoose = 0.02f;
|
||||||
static constexpr float IsAtRestStandard = 0.01f;
|
static constexpr float IsAtRestStandard = 0.01f;
|
||||||
static constexpr float IsAtRestTight = 0.005f;
|
static constexpr float IsAtRestThight = 0.005f;
|
||||||
|
|
||||||
static constexpr float GyroMaxValue = 5.0f;
|
static constexpr float GyroMaxValue = 5.0f;
|
||||||
static constexpr float AccelMaxValue = 7.0f;
|
static constexpr float AccelMaxValue = 7.0f;
|
||||||
|
@ -15,7 +15,7 @@ constexpr Result ResultVibrationNotInitialized{ErrorModule::HID, 121};
|
|||||||
constexpr Result ResultVibrationInvalidStyleIndex{ErrorModule::HID, 122};
|
constexpr Result ResultVibrationInvalidStyleIndex{ErrorModule::HID, 122};
|
||||||
constexpr Result ResultVibrationInvalidNpadId{ErrorModule::HID, 123};
|
constexpr Result ResultVibrationInvalidNpadId{ErrorModule::HID, 123};
|
||||||
constexpr Result ResultVibrationDeviceIndexOutOfRange{ErrorModule::HID, 124};
|
constexpr Result ResultVibrationDeviceIndexOutOfRange{ErrorModule::HID, 124};
|
||||||
constexpr Result ResultVibrationStrengthOutOfRange{ErrorModule::HID, 126};
|
constexpr Result ResultVibrationStrenghtOutOfRange{ErrorModule::HID, 126};
|
||||||
constexpr Result ResultVibrationArraySizeMismatch{ErrorModule::HID, 131};
|
constexpr Result ResultVibrationArraySizeMismatch{ErrorModule::HID, 131};
|
||||||
|
|
||||||
constexpr Result InvalidSixAxisFusionRange{ErrorModule::HID, 423};
|
constexpr Result InvalidSixAxisFusionRange{ErrorModule::HID, 423};
|
||||||
|
@ -106,8 +106,8 @@ enum class HandAnalysisMode : u32 {
|
|||||||
None,
|
None,
|
||||||
Silhouette,
|
Silhouette,
|
||||||
Image,
|
Image,
|
||||||
SilhouetteAndImage,
|
SilhoueteAndImage,
|
||||||
SilhouetteOnly,
|
SilhuetteOnly,
|
||||||
};
|
};
|
||||||
|
|
||||||
// This is nn::irsensor::IrSensorFunctionLevel
|
// This is nn::irsensor::IrSensorFunctionLevel
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
#include "core/hle/kernel/k_shared_memory.h"
|
#include "core/hle/kernel/k_shared_memory.h"
|
||||||
#include "core/hle/service/ipc_helpers.h"
|
#include "core/hle/service/ipc_helpers.h"
|
||||||
#include "hid_core/hid_core.h"
|
#include "hid_core/hid_core.h"
|
||||||
#include "hid_core/hid_util.h"
|
|
||||||
#include "hid_core/resource_manager.h"
|
#include "hid_core/resource_manager.h"
|
||||||
|
|
||||||
#include "hid_core/resources/applet_resource.h"
|
#include "hid_core/resources/applet_resource.h"
|
||||||
@ -28,10 +27,6 @@
|
|||||||
#include "hid_core/resources/touch_screen/gesture.h"
|
#include "hid_core/resources/touch_screen/gesture.h"
|
||||||
#include "hid_core/resources/touch_screen/touch_screen.h"
|
#include "hid_core/resources/touch_screen/touch_screen.h"
|
||||||
#include "hid_core/resources/unique_pad/unique_pad.h"
|
#include "hid_core/resources/unique_pad/unique_pad.h"
|
||||||
#include "hid_core/resources/vibration/gc_vibration_device.h"
|
|
||||||
#include "hid_core/resources/vibration/n64_vibration_device.h"
|
|
||||||
#include "hid_core/resources/vibration/vibration_base.h"
|
|
||||||
#include "hid_core/resources/vibration/vibration_device.h"
|
|
||||||
|
|
||||||
namespace Service::HID {
|
namespace Service::HID {
|
||||||
|
|
||||||
@ -57,7 +52,6 @@ void ResourceManager::Initialize() {
|
|||||||
|
|
||||||
system.HIDCore().ReloadInputDevices();
|
system.HIDCore().ReloadInputDevices();
|
||||||
|
|
||||||
handheld_config = std::make_shared<HandheldConfig>();
|
|
||||||
InitializeHidCommonSampler();
|
InitializeHidCommonSampler();
|
||||||
InitializeTouchScreenSampler();
|
InitializeTouchScreenSampler();
|
||||||
InitializeConsoleSixAxisSampler();
|
InitializeConsoleSixAxisSampler();
|
||||||
@ -180,7 +174,7 @@ void ResourceManager::InitializeHidCommonSampler() {
|
|||||||
debug_pad->SetAppletResource(applet_resource, &shared_mutex);
|
debug_pad->SetAppletResource(applet_resource, &shared_mutex);
|
||||||
digitizer->SetAppletResource(applet_resource, &shared_mutex);
|
digitizer->SetAppletResource(applet_resource, &shared_mutex);
|
||||||
keyboard->SetAppletResource(applet_resource, &shared_mutex);
|
keyboard->SetAppletResource(applet_resource, &shared_mutex);
|
||||||
npad->SetNpadExternals(applet_resource, &shared_mutex, handheld_config);
|
npad->SetNpadExternals(applet_resource, &shared_mutex);
|
||||||
six_axis->SetAppletResource(applet_resource, &shared_mutex);
|
six_axis->SetAppletResource(applet_resource, &shared_mutex);
|
||||||
mouse->SetAppletResource(applet_resource, &shared_mutex);
|
mouse->SetAppletResource(applet_resource, &shared_mutex);
|
||||||
debug_mouse->SetAppletResource(applet_resource, &shared_mutex);
|
debug_mouse->SetAppletResource(applet_resource, &shared_mutex);
|
||||||
@ -263,121 +257,6 @@ void ResourceManager::EnableTouchScreen(u64 aruid, bool is_enabled) {
|
|||||||
applet_resource->EnableTouchScreen(aruid, is_enabled);
|
applet_resource->EnableTouchScreen(aruid, is_enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
NpadVibrationBase* ResourceManager::GetVibrationDevice(
|
|
||||||
const Core::HID::VibrationDeviceHandle& handle) {
|
|
||||||
return npad->GetVibrationDevice(handle);
|
|
||||||
}
|
|
||||||
|
|
||||||
NpadN64VibrationDevice* ResourceManager::GetN64VibrationDevice(
|
|
||||||
const Core::HID::VibrationDeviceHandle& handle) {
|
|
||||||
return npad->GetN64VibrationDevice(handle);
|
|
||||||
}
|
|
||||||
|
|
||||||
NpadVibrationDevice* ResourceManager::GetNSVibrationDevice(
|
|
||||||
const Core::HID::VibrationDeviceHandle& handle) {
|
|
||||||
return npad->GetNSVibrationDevice(handle);
|
|
||||||
}
|
|
||||||
|
|
||||||
NpadGcVibrationDevice* ResourceManager::GetGcVibrationDevice(
|
|
||||||
const Core::HID::VibrationDeviceHandle& handle) {
|
|
||||||
return npad->GetGcVibrationDevice(handle);
|
|
||||||
}
|
|
||||||
|
|
||||||
Result ResourceManager::SetAruidValidForVibration(u64 aruid, bool is_enabled) {
|
|
||||||
std::scoped_lock lock{shared_mutex};
|
|
||||||
const bool has_changed = applet_resource->SetAruidValidForVibration(aruid, is_enabled);
|
|
||||||
|
|
||||||
if (has_changed) {
|
|
||||||
auto devices = npad->GetAllVibrationDevices();
|
|
||||||
for ([[maybe_unused]] auto* device : devices) {
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
auto* vibration_handler = npad->GetVibrationHandler();
|
|
||||||
if (aruid != vibration_handler->GetSessionAruid()) {
|
|
||||||
vibration_handler->EndPermitVibrationSession();
|
|
||||||
}
|
|
||||||
|
|
||||||
return ResultSuccess;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ResourceManager::SetForceHandheldStyleVibration(bool is_forced) {
|
|
||||||
handheld_config->is_force_handheld_style_vibration = is_forced;
|
|
||||||
}
|
|
||||||
|
|
||||||
Result ResourceManager::IsVibrationAruidActive(u64 aruid, bool& is_active) const {
|
|
||||||
std::scoped_lock lock{shared_mutex};
|
|
||||||
is_active = applet_resource->IsVibrationAruidActive(aruid);
|
|
||||||
return ResultSuccess;
|
|
||||||
}
|
|
||||||
|
|
||||||
Result ResourceManager::GetVibrationDeviceInfo(Core::HID::VibrationDeviceInfo& device_info,
|
|
||||||
const Core::HID::VibrationDeviceHandle& handle) {
|
|
||||||
bool check_device_index = false;
|
|
||||||
|
|
||||||
const Result is_valid = IsVibrationHandleValid(handle);
|
|
||||||
if (is_valid.IsError()) {
|
|
||||||
return is_valid;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (handle.npad_type) {
|
|
||||||
case Core::HID::NpadStyleIndex::Fullkey:
|
|
||||||
case Core::HID::NpadStyleIndex::Handheld:
|
|
||||||
case Core::HID::NpadStyleIndex::JoyconDual:
|
|
||||||
case Core::HID::NpadStyleIndex::JoyconLeft:
|
|
||||||
case Core::HID::NpadStyleIndex::JoyconRight:
|
|
||||||
device_info.type = Core::HID::VibrationDeviceType::LinearResonantActuator;
|
|
||||||
check_device_index = true;
|
|
||||||
break;
|
|
||||||
case Core::HID::NpadStyleIndex::GameCube:
|
|
||||||
device_info.type = Core::HID::VibrationDeviceType::GcErm;
|
|
||||||
break;
|
|
||||||
case Core::HID::NpadStyleIndex::N64:
|
|
||||||
device_info.type = Core::HID::VibrationDeviceType::N64;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
device_info.type = Core::HID::VibrationDeviceType::Unknown;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
device_info.position = Core::HID::VibrationDevicePosition::None;
|
|
||||||
if (check_device_index) {
|
|
||||||
switch (handle.device_index) {
|
|
||||||
case Core::HID::DeviceIndex::Left:
|
|
||||||
device_info.position = Core::HID::VibrationDevicePosition::Left;
|
|
||||||
break;
|
|
||||||
case Core::HID::DeviceIndex::Right:
|
|
||||||
device_info.position = Core::HID::VibrationDevicePosition::Right;
|
|
||||||
break;
|
|
||||||
case Core::HID::DeviceIndex::None:
|
|
||||||
default:
|
|
||||||
ASSERT_MSG(false, "DeviceIndex should never be None!");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ResultSuccess;
|
|
||||||
}
|
|
||||||
|
|
||||||
Result ResourceManager::SendVibrationValue(u64 aruid,
|
|
||||||
const Core::HID::VibrationDeviceHandle& handle,
|
|
||||||
const Core::HID::VibrationValue& value) {
|
|
||||||
bool has_active_aruid{};
|
|
||||||
NpadVibrationDevice* device{nullptr};
|
|
||||||
Result result = IsVibrationAruidActive(aruid, has_active_aruid);
|
|
||||||
|
|
||||||
if (result.IsSuccess() && has_active_aruid) {
|
|
||||||
result = IsVibrationHandleValid(handle);
|
|
||||||
}
|
|
||||||
if (result.IsSuccess() && has_active_aruid) {
|
|
||||||
device = GetNSVibrationDevice(handle);
|
|
||||||
}
|
|
||||||
if (device != nullptr) {
|
|
||||||
result = device->SendVibrationValue(value);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ResourceManager::UpdateControllers(std::chrono::nanoseconds ns_late) {
|
void ResourceManager::UpdateControllers(std::chrono::nanoseconds ns_late) {
|
||||||
auto& core_timing = system.CoreTiming();
|
auto& core_timing = system.CoreTiming();
|
||||||
debug_pad->OnUpdate(core_timing);
|
debug_pad->OnUpdate(core_timing);
|
||||||
|
@ -10,12 +10,6 @@ namespace Core {
|
|||||||
class System;
|
class System;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Core::HID {
|
|
||||||
struct VibrationDeviceHandle;
|
|
||||||
struct VibrationValue;
|
|
||||||
struct VibrationDeviceInfo;
|
|
||||||
} // namespace Core::HID
|
|
||||||
|
|
||||||
namespace Core::Timing {
|
namespace Core::Timing {
|
||||||
struct EventType;
|
struct EventType;
|
||||||
}
|
}
|
||||||
@ -43,11 +37,6 @@ class SixAxis;
|
|||||||
class SleepButton;
|
class SleepButton;
|
||||||
class TouchScreen;
|
class TouchScreen;
|
||||||
class UniquePad;
|
class UniquePad;
|
||||||
class NpadVibrationBase;
|
|
||||||
class NpadN64VibrationDevice;
|
|
||||||
class NpadGcVibrationDevice;
|
|
||||||
class NpadVibrationDevice;
|
|
||||||
struct HandheldConfig;
|
|
||||||
|
|
||||||
class ResourceManager {
|
class ResourceManager {
|
||||||
|
|
||||||
@ -90,18 +79,6 @@ public:
|
|||||||
void EnablePadInput(u64 aruid, bool is_enabled);
|
void EnablePadInput(u64 aruid, bool is_enabled);
|
||||||
void EnableTouchScreen(u64 aruid, bool is_enabled);
|
void EnableTouchScreen(u64 aruid, bool is_enabled);
|
||||||
|
|
||||||
NpadVibrationBase* GetVibrationDevice(const Core::HID::VibrationDeviceHandle& handle);
|
|
||||||
NpadN64VibrationDevice* GetN64VibrationDevice(const Core::HID::VibrationDeviceHandle& handle);
|
|
||||||
NpadVibrationDevice* GetNSVibrationDevice(const Core::HID::VibrationDeviceHandle& handle);
|
|
||||||
NpadGcVibrationDevice* GetGcVibrationDevice(const Core::HID::VibrationDeviceHandle& handle);
|
|
||||||
Result SetAruidValidForVibration(u64 aruid, bool is_enabled);
|
|
||||||
void SetForceHandheldStyleVibration(bool is_forced);
|
|
||||||
Result IsVibrationAruidActive(u64 aruid, bool& is_active) const;
|
|
||||||
Result GetVibrationDeviceInfo(Core::HID::VibrationDeviceInfo& device_info,
|
|
||||||
const Core::HID::VibrationDeviceHandle& handle);
|
|
||||||
Result SendVibrationValue(u64 aruid, const Core::HID::VibrationDeviceHandle& handle,
|
|
||||||
const Core::HID::VibrationValue& value);
|
|
||||||
|
|
||||||
void UpdateControllers(std::chrono::nanoseconds ns_late);
|
void UpdateControllers(std::chrono::nanoseconds ns_late);
|
||||||
void UpdateNpad(std::chrono::nanoseconds ns_late);
|
void UpdateNpad(std::chrono::nanoseconds ns_late);
|
||||||
void UpdateMouseKeyboard(std::chrono::nanoseconds ns_late);
|
void UpdateMouseKeyboard(std::chrono::nanoseconds ns_late);
|
||||||
@ -136,8 +113,6 @@ private:
|
|||||||
std::shared_ptr<TouchScreen> touch_screen = nullptr;
|
std::shared_ptr<TouchScreen> touch_screen = nullptr;
|
||||||
std::shared_ptr<UniquePad> unique_pad = nullptr;
|
std::shared_ptr<UniquePad> unique_pad = nullptr;
|
||||||
|
|
||||||
std::shared_ptr<HandheldConfig> handheld_config = nullptr;
|
|
||||||
|
|
||||||
// TODO: Create these resources
|
// TODO: Create these resources
|
||||||
// std::shared_ptr<AudioControl> audio_control = nullptr;
|
// std::shared_ptr<AudioControl> audio_control = nullptr;
|
||||||
// std::shared_ptr<ButtonConfig> button_config = nullptr;
|
// std::shared_ptr<ButtonConfig> button_config = nullptr;
|
||||||
|
@ -115,7 +115,7 @@ Result NpadAbstractIrSensorHandler::GetXcdHandleForNpadWithIrSensor(u64& handle)
|
|||||||
if (sensor_state < NpadIrSensorState::Available) {
|
if (sensor_state < NpadIrSensorState::Available) {
|
||||||
return ResultIrSensorIsNotReady;
|
return ResultIrSensorIsNotReady;
|
||||||
}
|
}
|
||||||
// handle = xcd_handle;
|
handle = xcd_handle;
|
||||||
return ResultSuccess;
|
return ResultSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,10 +7,6 @@
|
|||||||
#include "core/hle/result.h"
|
#include "core/hle/result.h"
|
||||||
#include "hid_core/hid_types.h"
|
#include "hid_core/hid_types.h"
|
||||||
|
|
||||||
namespace Core::HID {
|
|
||||||
class EmulatedController;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
class KEvent;
|
class KEvent;
|
||||||
class KReadableEvent;
|
class KReadableEvent;
|
||||||
@ -54,7 +50,7 @@ private:
|
|||||||
|
|
||||||
s32 ref_counter{};
|
s32 ref_counter{};
|
||||||
Kernel::KEvent* ir_sensor_event{nullptr};
|
Kernel::KEvent* ir_sensor_event{nullptr};
|
||||||
Core::HID::EmulatedController* xcd_handle{};
|
u64 xcd_handle{};
|
||||||
NpadIrSensorState sensor_state{};
|
NpadIrSensorState sensor_state{};
|
||||||
};
|
};
|
||||||
} // namespace Service::HID
|
} // namespace Service::HID
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
#include "hid_core/hid_core.h"
|
|
||||||
#include "hid_core/hid_result.h"
|
#include "hid_core/hid_result.h"
|
||||||
#include "hid_core/resources/abstracted_pad/abstract_pad.h"
|
#include "hid_core/resources/abstracted_pad/abstract_pad.h"
|
||||||
#include "hid_core/resources/applet_resource.h"
|
#include "hid_core/resources/applet_resource.h"
|
||||||
@ -17,7 +16,7 @@ void AbstractPad::SetExternals(AppletResourceHolder* applet_resource,
|
|||||||
CaptureButtonResource* capture_button_resource,
|
CaptureButtonResource* capture_button_resource,
|
||||||
HomeButtonResource* home_button_resource,
|
HomeButtonResource* home_button_resource,
|
||||||
SixAxisResource* sixaxis_resource, PalmaResource* palma_resource,
|
SixAxisResource* sixaxis_resource, PalmaResource* palma_resource,
|
||||||
NpadVibration* vibration, Core::HID::HIDCore* core) {
|
VibrationHandler* vibration) {
|
||||||
applet_resource_holder = applet_resource;
|
applet_resource_holder = applet_resource;
|
||||||
|
|
||||||
properties_handler.SetAppletResource(applet_resource_holder);
|
properties_handler.SetAppletResource(applet_resource_holder);
|
||||||
@ -36,14 +35,13 @@ void AbstractPad::SetExternals(AppletResourceHolder* applet_resource,
|
|||||||
mcu_handler.SetAbstractPadHolder(&abstract_pad_holder);
|
mcu_handler.SetAbstractPadHolder(&abstract_pad_holder);
|
||||||
mcu_handler.SetPropertiesHandler(&properties_handler);
|
mcu_handler.SetPropertiesHandler(&properties_handler);
|
||||||
|
|
||||||
|
std::array<NpadVibrationDevice*, 2> vibration_devices{&vibration_left, &vibration_right};
|
||||||
vibration_handler.SetAppletResource(applet_resource_holder);
|
vibration_handler.SetAppletResource(applet_resource_holder);
|
||||||
vibration_handler.SetAbstractPadHolder(&abstract_pad_holder);
|
vibration_handler.SetAbstractPadHolder(&abstract_pad_holder);
|
||||||
vibration_handler.SetPropertiesHandler(&properties_handler);
|
vibration_handler.SetPropertiesHandler(&properties_handler);
|
||||||
vibration_handler.SetN64Vibration(&vibration_n64);
|
vibration_handler.SetN64Vibration(&vibration_n64);
|
||||||
vibration_handler.SetVibration(&vibration_left, &vibration_right);
|
vibration_handler.SetVibration(vibration_devices);
|
||||||
vibration_handler.SetGcVibration(&vibration_gc);
|
vibration_handler.SetGcVibration(&vibration_gc);
|
||||||
vibration_handler.SetVibrationHandler(vibration);
|
|
||||||
vibration_handler.SetHidCore(core);
|
|
||||||
|
|
||||||
sixaxis_handler.SetAppletResource(applet_resource_holder);
|
sixaxis_handler.SetAppletResource(applet_resource_holder);
|
||||||
sixaxis_handler.SetAbstractPadHolder(&abstract_pad_holder);
|
sixaxis_handler.SetAbstractPadHolder(&abstract_pad_holder);
|
||||||
@ -241,6 +239,11 @@ NpadVibrationDevice* AbstractPad::GetVibrationDevice(Core::HID::DeviceIndex devi
|
|||||||
return &vibration_left;
|
return &vibration_left;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AbstractPad::GetLeftRightVibrationDevice(std::vector<NpadVibrationDevice*> list) {
|
||||||
|
list.emplace_back(&vibration_left);
|
||||||
|
list.emplace_back(&vibration_right);
|
||||||
|
}
|
||||||
|
|
||||||
NpadGcVibrationDevice* AbstractPad::GetGCVibrationDevice() {
|
NpadGcVibrationDevice* AbstractPad::GetGCVibrationDevice() {
|
||||||
return &vibration_gc;
|
return &vibration_gc;
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,7 @@ class AppletResource;
|
|||||||
class SixAxisResource;
|
class SixAxisResource;
|
||||||
class PalmaResource;
|
class PalmaResource;
|
||||||
class NPadResource;
|
class NPadResource;
|
||||||
|
class AbstractPad;
|
||||||
class NpadLastActiveHandler;
|
class NpadLastActiveHandler;
|
||||||
class NpadIrNfcHandler;
|
class NpadIrNfcHandler;
|
||||||
class UniquePads;
|
class UniquePads;
|
||||||
@ -43,6 +44,7 @@ class NpadGcVibration;
|
|||||||
|
|
||||||
class CaptureButtonResource;
|
class CaptureButtonResource;
|
||||||
class HomeButtonResource;
|
class HomeButtonResource;
|
||||||
|
class VibrationHandler;
|
||||||
|
|
||||||
struct HandheldConfig;
|
struct HandheldConfig;
|
||||||
|
|
||||||
@ -55,8 +57,7 @@ public:
|
|||||||
void SetExternals(AppletResourceHolder* applet_resource,
|
void SetExternals(AppletResourceHolder* applet_resource,
|
||||||
CaptureButtonResource* capture_button_resource,
|
CaptureButtonResource* capture_button_resource,
|
||||||
HomeButtonResource* home_button_resource, SixAxisResource* sixaxis_resource,
|
HomeButtonResource* home_button_resource, SixAxisResource* sixaxis_resource,
|
||||||
PalmaResource* palma_resource, NpadVibration* vibration,
|
PalmaResource* palma_resource, VibrationHandler* vibration);
|
||||||
Core::HID::HIDCore* core);
|
|
||||||
void SetNpadId(Core::HID::NpadIdType npad_id);
|
void SetNpadId(Core::HID::NpadIdType npad_id);
|
||||||
|
|
||||||
Result Activate();
|
Result Activate();
|
||||||
@ -77,6 +78,7 @@ public:
|
|||||||
|
|
||||||
NpadN64VibrationDevice* GetN64VibrationDevice();
|
NpadN64VibrationDevice* GetN64VibrationDevice();
|
||||||
NpadVibrationDevice* GetVibrationDevice(Core::HID::DeviceIndex device_index);
|
NpadVibrationDevice* GetVibrationDevice(Core::HID::DeviceIndex device_index);
|
||||||
|
void GetLeftRightVibrationDevice(std::vector<NpadVibrationDevice*> list);
|
||||||
NpadGcVibrationDevice* GetGCVibrationDevice();
|
NpadGcVibrationDevice* GetGCVibrationDevice();
|
||||||
|
|
||||||
Core::HID::NpadIdType GetLastActiveNpad();
|
Core::HID::NpadIdType GetLastActiveNpad();
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
#include "hid_core/frontend/emulated_controller.h"
|
|
||||||
#include "hid_core/hid_core.h"
|
|
||||||
#include "hid_core/hid_result.h"
|
#include "hid_core/hid_result.h"
|
||||||
#include "hid_core/hid_util.h"
|
#include "hid_core/hid_util.h"
|
||||||
#include "hid_core/resources/abstracted_pad/abstract_pad_holder.h"
|
#include "hid_core/resources/abstracted_pad/abstract_pad_holder.h"
|
||||||
@ -32,22 +30,14 @@ void NpadAbstractVibrationHandler::SetPropertiesHandler(NpadAbstractPropertiesHa
|
|||||||
properties_handler = handler;
|
properties_handler = handler;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NpadAbstractVibrationHandler::SetVibrationHandler(NpadVibration* handler) {
|
|
||||||
vibration_handler = handler;
|
|
||||||
}
|
|
||||||
|
|
||||||
void NpadAbstractVibrationHandler::SetHidCore(Core::HID::HIDCore* core) {
|
|
||||||
hid_core = core;
|
|
||||||
}
|
|
||||||
|
|
||||||
void NpadAbstractVibrationHandler::SetN64Vibration(NpadN64VibrationDevice* n64_device) {
|
void NpadAbstractVibrationHandler::SetN64Vibration(NpadN64VibrationDevice* n64_device) {
|
||||||
n64_vibration_device = n64_device;
|
n64_vibration_device = n64_device;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NpadAbstractVibrationHandler::SetVibration(NpadVibrationDevice* left_device,
|
void NpadAbstractVibrationHandler::SetVibration(std::span<NpadVibrationDevice*> device) {
|
||||||
NpadVibrationDevice* right_device) {
|
for (std::size_t i = 0; i < device.size() && i < vibration_device.size(); i++) {
|
||||||
left_vibration_device = left_device;
|
vibration_device[i] = device[i];
|
||||||
right_vibration_device = right_device;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void NpadAbstractVibrationHandler::SetGcVibration(NpadGcVibrationDevice* gc_device) {
|
void NpadAbstractVibrationHandler::SetGcVibration(NpadGcVibrationDevice* gc_device) {
|
||||||
@ -79,29 +69,5 @@ void NpadAbstractVibrationHandler::UpdateVibrationState() {
|
|||||||
if (!is_handheld_hid_enabled && is_force_handheld_style_vibration) {
|
if (!is_handheld_hid_enabled && is_force_handheld_style_vibration) {
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: This function isn't accurate. It's supposed to get 5 abstracted pads from the
|
|
||||||
// NpadAbstractPropertiesHandler but this handler isn't fully implemented yet
|
|
||||||
IAbstractedPad abstracted_pad{};
|
|
||||||
const auto npad_id = properties_handler->GetNpadId();
|
|
||||||
abstracted_pad.xcd_handle = hid_core->GetEmulatedController(npad_id);
|
|
||||||
abstracted_pad.internal_flags.is_connected.Assign(abstracted_pad.xcd_handle->IsConnected());
|
|
||||||
|
|
||||||
if (abstracted_pad.internal_flags.is_connected) {
|
|
||||||
left_vibration_device->Mount(abstracted_pad, Core::HID::DeviceIndex::Left,
|
|
||||||
vibration_handler);
|
|
||||||
right_vibration_device->Mount(abstracted_pad, Core::HID::DeviceIndex::Right,
|
|
||||||
vibration_handler);
|
|
||||||
gc_vibration_device->Mount(abstracted_pad, 0, vibration_handler);
|
|
||||||
gc_vibration_device->Mount(abstracted_pad, 0, vibration_handler);
|
|
||||||
n64_vibration_device->Mount(abstracted_pad, vibration_handler);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
left_vibration_device->Unmount();
|
|
||||||
right_vibration_device->Unmount();
|
|
||||||
gc_vibration_device->Unmount();
|
|
||||||
gc_vibration_device->Unmount();
|
|
||||||
n64_vibration_device->Unmount();
|
|
||||||
}
|
}
|
||||||
} // namespace Service::HID
|
} // namespace Service::HID
|
||||||
|
@ -9,10 +9,6 @@
|
|||||||
#include "core/hle/result.h"
|
#include "core/hle/result.h"
|
||||||
#include "hid_core/hid_types.h"
|
#include "hid_core/hid_types.h"
|
||||||
|
|
||||||
namespace Core::HID {
|
|
||||||
class HIDCore;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Service::HID {
|
namespace Service::HID {
|
||||||
struct AppletResourceHolder;
|
struct AppletResourceHolder;
|
||||||
class NpadAbstractedPadHolder;
|
class NpadAbstractedPadHolder;
|
||||||
@ -31,11 +27,9 @@ public:
|
|||||||
void SetAbstractPadHolder(NpadAbstractedPadHolder* holder);
|
void SetAbstractPadHolder(NpadAbstractedPadHolder* holder);
|
||||||
void SetAppletResource(AppletResourceHolder* applet_resource);
|
void SetAppletResource(AppletResourceHolder* applet_resource);
|
||||||
void SetPropertiesHandler(NpadAbstractPropertiesHandler* handler);
|
void SetPropertiesHandler(NpadAbstractPropertiesHandler* handler);
|
||||||
void SetVibrationHandler(NpadVibration* handler);
|
|
||||||
void SetHidCore(Core::HID::HIDCore* core);
|
|
||||||
|
|
||||||
void SetN64Vibration(NpadN64VibrationDevice* n64_device);
|
void SetN64Vibration(NpadN64VibrationDevice* n64_device);
|
||||||
void SetVibration(NpadVibrationDevice* left_device, NpadVibrationDevice* right_device);
|
void SetVibration(std::span<NpadVibrationDevice*> device);
|
||||||
void SetGcVibration(NpadGcVibrationDevice* gc_device);
|
void SetGcVibration(NpadGcVibrationDevice* gc_device);
|
||||||
|
|
||||||
Result IncrementRefCounter();
|
Result IncrementRefCounter();
|
||||||
@ -47,11 +41,9 @@ private:
|
|||||||
AppletResourceHolder* applet_resource_holder{nullptr};
|
AppletResourceHolder* applet_resource_holder{nullptr};
|
||||||
NpadAbstractedPadHolder* abstract_pad_holder{nullptr};
|
NpadAbstractedPadHolder* abstract_pad_holder{nullptr};
|
||||||
NpadAbstractPropertiesHandler* properties_handler{nullptr};
|
NpadAbstractPropertiesHandler* properties_handler{nullptr};
|
||||||
Core::HID::HIDCore* hid_core{nullptr};
|
|
||||||
|
|
||||||
NpadN64VibrationDevice* n64_vibration_device{nullptr};
|
NpadN64VibrationDevice* n64_vibration_device{nullptr};
|
||||||
NpadVibrationDevice* left_vibration_device{};
|
std::array<NpadVibrationDevice*, 2> vibration_device{};
|
||||||
NpadVibrationDevice* right_vibration_device{};
|
|
||||||
NpadGcVibrationDevice* gc_vibration_device{nullptr};
|
NpadGcVibrationDevice* gc_vibration_device{nullptr};
|
||||||
NpadVibration* vibration_handler{nullptr};
|
NpadVibration* vibration_handler{nullptr};
|
||||||
s32 ref_counter{};
|
s32 ref_counter{};
|
||||||
|
@ -200,25 +200,6 @@ void AppletResource::EnableInput(u64 aruid, bool is_enabled) {
|
|||||||
data[index].flag.enable_touchscreen.Assign(is_enabled);
|
data[index].flag.enable_touchscreen.Assign(is_enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AppletResource::SetAruidValidForVibration(u64 aruid, bool is_enabled) {
|
|
||||||
const u64 index = GetIndexFromAruid(aruid);
|
|
||||||
if (index >= AruidIndexMax) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!is_enabled && aruid == active_vibration_aruid) {
|
|
||||||
active_vibration_aruid = SystemAruid;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_enabled && aruid != active_vibration_aruid) {
|
|
||||||
active_vibration_aruid = aruid;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void AppletResource::EnableSixAxisSensor(u64 aruid, bool is_enabled) {
|
void AppletResource::EnableSixAxisSensor(u64 aruid, bool is_enabled) {
|
||||||
const u64 index = GetIndexFromAruid(aruid);
|
const u64 index = GetIndexFromAruid(aruid);
|
||||||
if (index >= AruidIndexMax) {
|
if (index >= AruidIndexMax) {
|
||||||
|
@ -101,7 +101,6 @@ public:
|
|||||||
Result DestroySevenSixAxisTransferMemory();
|
Result DestroySevenSixAxisTransferMemory();
|
||||||
|
|
||||||
void EnableInput(u64 aruid, bool is_enabled);
|
void EnableInput(u64 aruid, bool is_enabled);
|
||||||
bool SetAruidValidForVibration(u64 aruid, bool is_enabled);
|
|
||||||
void EnableSixAxisSensor(u64 aruid, bool is_enabled);
|
void EnableSixAxisSensor(u64 aruid, bool is_enabled);
|
||||||
void EnablePadInput(u64 aruid, bool is_enabled);
|
void EnablePadInput(u64 aruid, bool is_enabled);
|
||||||
void EnableTouchScreen(u64 aruid, bool is_enabled);
|
void EnableTouchScreen(u64 aruid, bool is_enabled);
|
||||||
|
@ -1,14 +1,11 @@
|
|||||||
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
#include "core/hle/service/set/system_settings_server.h"
|
|
||||||
#include "core/hle/service/sm/sm.h"
|
|
||||||
#include "hid_core/resources/hid_firmware_settings.h"
|
#include "hid_core/resources/hid_firmware_settings.h"
|
||||||
|
|
||||||
namespace Service::HID {
|
namespace Service::HID {
|
||||||
|
|
||||||
HidFirmwareSettings::HidFirmwareSettings(Core::System& system) {
|
HidFirmwareSettings::HidFirmwareSettings() {
|
||||||
m_set_sys = system.ServiceManager().GetService<Service::Set::ISystemSettingsServer>("set:sys");
|
|
||||||
LoadSettings(true);
|
LoadSettings(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -17,30 +14,26 @@ void HidFirmwareSettings::Reload() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void HidFirmwareSettings::LoadSettings(bool reload_config) {
|
void HidFirmwareSettings::LoadSettings(bool reload_config) {
|
||||||
if (is_initialized && !reload_config) {
|
if (is_initalized && !reload_config) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_set_sys->GetSettingsItemValue<bool>(is_debug_pad_enabled, "hid_debug", "enables_debugpad");
|
// TODO: Use nn::settings::fwdbg::GetSettingsItemValue to load config values
|
||||||
m_set_sys->GetSettingsItemValue<bool>(is_device_managed, "hid_debug", "manages_devices");
|
|
||||||
m_set_sys->GetSettingsItemValue<bool>(is_touch_i2c_managed, "hid_debug",
|
|
||||||
"manages_touch_ic_i2c");
|
|
||||||
m_set_sys->GetSettingsItemValue<bool>(is_future_devices_emulated, "hid_debug",
|
|
||||||
"emulate_future_device");
|
|
||||||
m_set_sys->GetSettingsItemValue<bool>(is_mcu_hardware_error_emulated, "hid_debug",
|
|
||||||
"emulate_mcu_hardware_error");
|
|
||||||
m_set_sys->GetSettingsItemValue<bool>(is_rail_enabled, "hid_debug", "enables_rail");
|
|
||||||
m_set_sys->GetSettingsItemValue<bool>(is_firmware_update_failure_emulated, "hid_debug",
|
|
||||||
"emulate_firmware_update_failure");
|
|
||||||
is_firmware_update_failure = {};
|
|
||||||
m_set_sys->GetSettingsItemValue<bool>(is_ble_disabled, "hid_debug", "ble_disabled");
|
|
||||||
m_set_sys->GetSettingsItemValue<bool>(is_dscale_disabled, "hid_debug", "dscale_disabled");
|
|
||||||
m_set_sys->GetSettingsItemValue<bool>(is_handheld_forced, "hid_debug", "force_handheld");
|
|
||||||
features_per_id_disabled = {};
|
|
||||||
m_set_sys->GetSettingsItemValue<bool>(is_touch_firmware_auto_update_disabled, "hid_debug",
|
|
||||||
"touch_firmware_auto_update_disabled");
|
|
||||||
|
|
||||||
is_initialized = true;
|
is_debug_pad_enabled = true;
|
||||||
|
is_device_managed = true;
|
||||||
|
is_touch_i2c_managed = is_device_managed;
|
||||||
|
is_future_devices_emulated = false;
|
||||||
|
is_mcu_hardware_error_emulated = false;
|
||||||
|
is_rail_enabled = true;
|
||||||
|
is_firmware_update_failure_emulated = false;
|
||||||
|
is_firmware_update_failure = {};
|
||||||
|
is_ble_disabled = false;
|
||||||
|
is_dscale_disabled = false;
|
||||||
|
is_handheld_forced = true;
|
||||||
|
features_per_id_disabled = {};
|
||||||
|
is_touch_firmware_auto_update_disabled = false;
|
||||||
|
is_initalized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HidFirmwareSettings::IsDebugPadEnabled() {
|
bool HidFirmwareSettings::IsDebugPadEnabled() {
|
||||||
|
@ -5,14 +5,6 @@
|
|||||||
|
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
|
|
||||||
namespace Core {
|
|
||||||
class System;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Service::Set {
|
|
||||||
class ISystemSettingsServer;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Service::HID {
|
namespace Service::HID {
|
||||||
|
|
||||||
/// Loads firmware config from nn::settings::fwdbg
|
/// Loads firmware config from nn::settings::fwdbg
|
||||||
@ -21,7 +13,7 @@ public:
|
|||||||
using FirmwareSetting = std::array<u8, 4>;
|
using FirmwareSetting = std::array<u8, 4>;
|
||||||
using FeaturesPerId = std::array<bool, 0xA8>;
|
using FeaturesPerId = std::array<bool, 0xA8>;
|
||||||
|
|
||||||
HidFirmwareSettings(Core::System& system);
|
HidFirmwareSettings();
|
||||||
|
|
||||||
void Reload();
|
void Reload();
|
||||||
void LoadSettings(bool reload_config);
|
void LoadSettings(bool reload_config);
|
||||||
@ -41,7 +33,7 @@ public:
|
|||||||
FeaturesPerId FeaturesDisabledPerId();
|
FeaturesPerId FeaturesDisabledPerId();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool is_initialized{};
|
bool is_initalized{};
|
||||||
|
|
||||||
// Debug settings
|
// Debug settings
|
||||||
bool is_debug_pad_enabled{};
|
bool is_debug_pad_enabled{};
|
||||||
@ -57,8 +49,6 @@ private:
|
|||||||
bool is_touch_firmware_auto_update_disabled{};
|
bool is_touch_firmware_auto_update_disabled{};
|
||||||
FirmwareSetting is_firmware_update_failure{};
|
FirmwareSetting is_firmware_update_failure{};
|
||||||
FeaturesPerId features_per_id_disabled{};
|
FeaturesPerId features_per_id_disabled{};
|
||||||
|
|
||||||
std::shared_ptr<Service::Set::ISystemSettingsServer> m_set_sys;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Service::HID
|
} // namespace Service::HID
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
#include "hid_core/hid_util.h"
|
#include "hid_core/hid_util.h"
|
||||||
#include "hid_core/resources/applet_resource.h"
|
#include "hid_core/resources/applet_resource.h"
|
||||||
#include "hid_core/resources/npad/npad.h"
|
#include "hid_core/resources/npad/npad.h"
|
||||||
#include "hid_core/resources/npad/npad_vibration.h"
|
|
||||||
#include "hid_core/resources/shared_memory_format.h"
|
#include "hid_core/resources/shared_memory_format.h"
|
||||||
|
|
||||||
namespace Service::HID {
|
namespace Service::HID {
|
||||||
@ -32,6 +31,10 @@ NPad::NPad(Core::HID::HIDCore& hid_core_, KernelHelpers::ServiceContext& service
|
|||||||
for (std::size_t i = 0; i < controller_data[aruid_index].size(); ++i) {
|
for (std::size_t i = 0; i < controller_data[aruid_index].size(); ++i) {
|
||||||
auto& controller = controller_data[aruid_index][i];
|
auto& controller = controller_data[aruid_index][i];
|
||||||
controller.device = hid_core.GetEmulatedControllerByIndex(i);
|
controller.device = hid_core.GetEmulatedControllerByIndex(i);
|
||||||
|
controller.vibration[Core::HID::EmulatedDeviceIndex::LeftIndex].latest_vibration_value =
|
||||||
|
Core::HID::DEFAULT_VIBRATION_VALUE;
|
||||||
|
controller.vibration[Core::HID::EmulatedDeviceIndex::RightIndex]
|
||||||
|
.latest_vibration_value = Core::HID::DEFAULT_VIBRATION_VALUE;
|
||||||
Core::HID::ControllerUpdateCallback engine_callback{
|
Core::HID::ControllerUpdateCallback engine_callback{
|
||||||
.on_change =
|
.on_change =
|
||||||
[this, i](Core::HID::ControllerTriggerType type) { ControllerUpdate(type, i); },
|
[this, i](Core::HID::ControllerTriggerType type) { ControllerUpdate(type, i); },
|
||||||
@ -40,10 +43,6 @@ NPad::NPad(Core::HID::HIDCore& hid_core_, KernelHelpers::ServiceContext& service
|
|||||||
controller.callback_key = controller.device->SetCallback(engine_callback);
|
controller.callback_key = controller.device->SetCallback(engine_callback);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (std::size_t i = 0; i < abstracted_pads.size(); ++i) {
|
|
||||||
abstracted_pads[i] = AbstractPad{};
|
|
||||||
abstracted_pads[i].SetNpadId(IndexToNpadIdType(i));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NPad::~NPad() {
|
NPad::~NPad() {
|
||||||
@ -360,7 +359,6 @@ void NPad::InitNewlyAddedController(u64 aruid, Core::HID::NpadIdType npad_id) {
|
|||||||
npad_resource.SignalStyleSetUpdateEvent(aruid, npad_id);
|
npad_resource.SignalStyleSetUpdateEvent(aruid, npad_id);
|
||||||
WriteEmptyEntry(controller.shared_memory);
|
WriteEmptyEntry(controller.shared_memory);
|
||||||
hid_core.SetLastActiveController(npad_id);
|
hid_core.SetLastActiveController(npad_id);
|
||||||
abstracted_pads[NpadIdTypeToIndex(npad_id)].Update();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void NPad::WriteEmptyEntry(NpadInternalState* npad) {
|
void NPad::WriteEmptyEntry(NpadInternalState* npad) {
|
||||||
@ -742,6 +740,171 @@ bool NPad::SetNpadMode(u64 aruid, Core::HID::NpadIdType& new_npad_id, Core::HID:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool NPad::VibrateControllerAtIndex(u64 aruid, Core::HID::NpadIdType npad_id,
|
||||||
|
std::size_t device_index,
|
||||||
|
const Core::HID::VibrationValue& vibration_value) {
|
||||||
|
auto& controller = GetControllerFromNpadIdType(aruid, npad_id);
|
||||||
|
if (!controller.device->IsConnected()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!controller.device->IsVibrationEnabled(device_index)) {
|
||||||
|
if (controller.vibration[device_index].latest_vibration_value.low_amplitude != 0.0f ||
|
||||||
|
controller.vibration[device_index].latest_vibration_value.high_amplitude != 0.0f) {
|
||||||
|
// Send an empty vibration to stop any vibrations.
|
||||||
|
Core::HID::VibrationValue vibration{0.0f, 160.0f, 0.0f, 320.0f};
|
||||||
|
controller.device->SetVibration(device_index, vibration);
|
||||||
|
// Then reset the vibration value to its default value.
|
||||||
|
controller.vibration[device_index].latest_vibration_value =
|
||||||
|
Core::HID::DEFAULT_VIBRATION_VALUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Settings::values.enable_accurate_vibrations.GetValue()) {
|
||||||
|
using std::chrono::duration_cast;
|
||||||
|
using std::chrono::milliseconds;
|
||||||
|
using std::chrono::steady_clock;
|
||||||
|
|
||||||
|
const auto now = steady_clock::now();
|
||||||
|
|
||||||
|
// Filter out non-zero vibrations that are within 15ms of each other.
|
||||||
|
if ((vibration_value.low_amplitude != 0.0f || vibration_value.high_amplitude != 0.0f) &&
|
||||||
|
duration_cast<milliseconds>(
|
||||||
|
now - controller.vibration[device_index].last_vibration_timepoint) <
|
||||||
|
milliseconds(15)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
controller.vibration[device_index].last_vibration_timepoint = now;
|
||||||
|
}
|
||||||
|
|
||||||
|
Core::HID::VibrationValue vibration{
|
||||||
|
vibration_value.low_amplitude, vibration_value.low_frequency,
|
||||||
|
vibration_value.high_amplitude, vibration_value.high_frequency};
|
||||||
|
return controller.device->SetVibration(device_index, vibration);
|
||||||
|
}
|
||||||
|
|
||||||
|
void NPad::VibrateController(u64 aruid,
|
||||||
|
const Core::HID::VibrationDeviceHandle& vibration_device_handle,
|
||||||
|
const Core::HID::VibrationValue& vibration_value) {
|
||||||
|
if (IsVibrationHandleValid(vibration_device_handle).IsError()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Settings::values.vibration_enabled.GetValue() && !permit_vibration_session_enabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto& controller = GetControllerFromHandle(aruid, vibration_device_handle);
|
||||||
|
const auto device_index = static_cast<std::size_t>(vibration_device_handle.device_index);
|
||||||
|
|
||||||
|
if (!controller.vibration[device_index].device_mounted || !controller.device->IsConnected()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (vibration_device_handle.device_index == Core::HID::DeviceIndex::None) {
|
||||||
|
ASSERT_MSG(false, "DeviceIndex should never be None!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Some games try to send mismatched parameters in the device handle, block these.
|
||||||
|
if ((controller.device->GetNpadStyleIndex() == Core::HID::NpadStyleIndex::JoyconLeft &&
|
||||||
|
(vibration_device_handle.npad_type == Core::HID::NpadStyleIndex::JoyconRight ||
|
||||||
|
vibration_device_handle.device_index == Core::HID::DeviceIndex::Right)) ||
|
||||||
|
(controller.device->GetNpadStyleIndex() == Core::HID::NpadStyleIndex::JoyconRight &&
|
||||||
|
(vibration_device_handle.npad_type == Core::HID::NpadStyleIndex::JoyconLeft ||
|
||||||
|
vibration_device_handle.device_index == Core::HID::DeviceIndex::Left))) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Filter out vibrations with equivalent values to reduce unnecessary state changes.
|
||||||
|
if (vibration_value.low_amplitude ==
|
||||||
|
controller.vibration[device_index].latest_vibration_value.low_amplitude &&
|
||||||
|
vibration_value.high_amplitude ==
|
||||||
|
controller.vibration[device_index].latest_vibration_value.high_amplitude) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (VibrateControllerAtIndex(aruid, controller.device->GetNpadIdType(), device_index,
|
||||||
|
vibration_value)) {
|
||||||
|
controller.vibration[device_index].latest_vibration_value = vibration_value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void NPad::VibrateControllers(
|
||||||
|
u64 aruid, std::span<const Core::HID::VibrationDeviceHandle> vibration_device_handles,
|
||||||
|
std::span<const Core::HID::VibrationValue> vibration_values) {
|
||||||
|
if (!Settings::values.vibration_enabled.GetValue() && !permit_vibration_session_enabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ASSERT_OR_EXECUTE_MSG(
|
||||||
|
vibration_device_handles.size() == vibration_values.size(), { return; },
|
||||||
|
"The amount of device handles does not match with the amount of vibration values,"
|
||||||
|
"this is undefined behavior!");
|
||||||
|
|
||||||
|
for (std::size_t i = 0; i < vibration_device_handles.size(); ++i) {
|
||||||
|
VibrateController(aruid, vibration_device_handles[i], vibration_values[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Core::HID::VibrationValue NPad::GetLastVibration(
|
||||||
|
u64 aruid, const Core::HID::VibrationDeviceHandle& vibration_device_handle) const {
|
||||||
|
if (IsVibrationHandleValid(vibration_device_handle).IsError()) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto& controller = GetControllerFromHandle(aruid, vibration_device_handle);
|
||||||
|
const auto device_index = static_cast<std::size_t>(vibration_device_handle.device_index);
|
||||||
|
return controller.vibration[device_index].latest_vibration_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
void NPad::InitializeVibrationDevice(
|
||||||
|
const Core::HID::VibrationDeviceHandle& vibration_device_handle) {
|
||||||
|
if (IsVibrationHandleValid(vibration_device_handle).IsError()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto aruid = applet_resource_holder.applet_resource->GetActiveAruid();
|
||||||
|
const auto npad_index = static_cast<Core::HID::NpadIdType>(vibration_device_handle.npad_id);
|
||||||
|
const auto device_index = static_cast<std::size_t>(vibration_device_handle.device_index);
|
||||||
|
|
||||||
|
if (aruid == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
InitializeVibrationDeviceAtIndex(aruid, npad_index, device_index);
|
||||||
|
}
|
||||||
|
|
||||||
|
void NPad::InitializeVibrationDeviceAtIndex(u64 aruid, Core::HID::NpadIdType npad_id,
|
||||||
|
std::size_t device_index) {
|
||||||
|
auto& controller = GetControllerFromNpadIdType(aruid, npad_id);
|
||||||
|
if (!Settings::values.vibration_enabled.GetValue()) {
|
||||||
|
controller.vibration[device_index].device_mounted = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
controller.vibration[device_index].device_mounted =
|
||||||
|
controller.device->IsVibrationEnabled(device_index);
|
||||||
|
}
|
||||||
|
|
||||||
|
void NPad::SetPermitVibrationSession(bool permit_vibration_session) {
|
||||||
|
permit_vibration_session_enabled = permit_vibration_session;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool NPad::IsVibrationDeviceMounted(
|
||||||
|
u64 aruid, const Core::HID::VibrationDeviceHandle& vibration_device_handle) const {
|
||||||
|
if (IsVibrationHandleValid(vibration_device_handle).IsError()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto& controller = GetControllerFromHandle(aruid, vibration_device_handle);
|
||||||
|
const auto device_index = static_cast<std::size_t>(vibration_device_handle.device_index);
|
||||||
|
return controller.vibration[device_index].device_mounted;
|
||||||
|
}
|
||||||
|
|
||||||
Result NPad::AcquireNpadStyleSetUpdateEventHandle(u64 aruid, Kernel::KReadableEvent** out_event,
|
Result NPad::AcquireNpadStyleSetUpdateEventHandle(u64 aruid, Kernel::KReadableEvent** out_event,
|
||||||
Core::HID::NpadIdType npad_id) {
|
Core::HID::NpadIdType npad_id) {
|
||||||
std::scoped_lock lock{mutex};
|
std::scoped_lock lock{mutex};
|
||||||
@ -773,6 +936,11 @@ Result NPad::DisconnectNpad(u64 aruid, Core::HID::NpadIdType npad_id) {
|
|||||||
|
|
||||||
LOG_DEBUG(Service_HID, "Npad disconnected {}", npad_id);
|
LOG_DEBUG(Service_HID, "Npad disconnected {}", npad_id);
|
||||||
auto& controller = GetControllerFromNpadIdType(aruid, npad_id);
|
auto& controller = GetControllerFromNpadIdType(aruid, npad_id);
|
||||||
|
for (std::size_t device_idx = 0; device_idx < controller.vibration.size(); ++device_idx) {
|
||||||
|
// Send an empty vibration to stop any vibrations.
|
||||||
|
VibrateControllerAtIndex(aruid, npad_id, device_idx, {});
|
||||||
|
controller.vibration[device_idx].device_mounted = false;
|
||||||
|
}
|
||||||
|
|
||||||
auto* shared_memory = controller.shared_memory;
|
auto* shared_memory = controller.shared_memory;
|
||||||
// Don't reset shared_memory->assignment_mode this value is persistent
|
// Don't reset shared_memory->assignment_mode this value is persistent
|
||||||
@ -1068,17 +1236,22 @@ void NPad::UnregisterAppletResourceUserId(u64 aruid) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void NPad::SetNpadExternals(std::shared_ptr<AppletResource> resource,
|
void NPad::SetNpadExternals(std::shared_ptr<AppletResource> resource,
|
||||||
std::recursive_mutex* shared_mutex,
|
std::recursive_mutex* shared_mutex) {
|
||||||
std::shared_ptr<HandheldConfig> handheld_config) {
|
|
||||||
applet_resource_holder.applet_resource = resource;
|
applet_resource_holder.applet_resource = resource;
|
||||||
applet_resource_holder.shared_mutex = shared_mutex;
|
applet_resource_holder.shared_mutex = shared_mutex;
|
||||||
applet_resource_holder.shared_npad_resource = &npad_resource;
|
applet_resource_holder.shared_npad_resource = &npad_resource;
|
||||||
applet_resource_holder.handheld_config = handheld_config;
|
|
||||||
|
|
||||||
for (auto& abstract_pad : abstracted_pads) {
|
|
||||||
abstract_pad.SetExternals(&applet_resource_holder, nullptr, nullptr, nullptr, nullptr,
|
|
||||||
&vibration_handler, &hid_core);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NPad::NpadControllerData& NPad::GetControllerFromHandle(
|
||||||
|
u64 aruid, const Core::HID::VibrationDeviceHandle& device_handle) {
|
||||||
|
const auto npad_id = static_cast<Core::HID::NpadIdType>(device_handle.npad_id);
|
||||||
|
return GetControllerFromNpadIdType(aruid, npad_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
const NPad::NpadControllerData& NPad::GetControllerFromHandle(
|
||||||
|
u64 aruid, const Core::HID::VibrationDeviceHandle& device_handle) const {
|
||||||
|
const auto npad_id = static_cast<Core::HID::NpadIdType>(device_handle.npad_id);
|
||||||
|
return GetControllerFromNpadIdType(aruid, npad_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
NPad::NpadControllerData& NPad::GetControllerFromHandle(
|
NPad::NpadControllerData& NPad::GetControllerFromHandle(
|
||||||
@ -1216,97 +1389,4 @@ Result NPad::GetLastActiveNpad(Core::HID::NpadIdType& out_npad_id) const {
|
|||||||
return ResultSuccess;
|
return ResultSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
NpadVibration* NPad::GetVibrationHandler() {
|
|
||||||
return &vibration_handler;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<NpadVibrationBase*> NPad::GetAllVibrationDevices() {
|
|
||||||
std::vector<NpadVibrationBase*> vibration_devices;
|
|
||||||
|
|
||||||
for (auto& abstract_pad : abstracted_pads) {
|
|
||||||
auto* left_device = abstract_pad.GetVibrationDevice(Core::HID::DeviceIndex::Left);
|
|
||||||
auto* right_device = abstract_pad.GetVibrationDevice(Core::HID::DeviceIndex::Right);
|
|
||||||
auto* n64_device = abstract_pad.GetGCVibrationDevice();
|
|
||||||
auto* gc_device = abstract_pad.GetGCVibrationDevice();
|
|
||||||
|
|
||||||
if (left_device != nullptr) {
|
|
||||||
vibration_devices.emplace_back(left_device);
|
|
||||||
}
|
|
||||||
if (right_device != nullptr) {
|
|
||||||
vibration_devices.emplace_back(right_device);
|
|
||||||
}
|
|
||||||
if (n64_device != nullptr) {
|
|
||||||
vibration_devices.emplace_back(n64_device);
|
|
||||||
}
|
|
||||||
if (gc_device != nullptr) {
|
|
||||||
vibration_devices.emplace_back(gc_device);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return vibration_devices;
|
|
||||||
}
|
|
||||||
|
|
||||||
NpadVibrationBase* NPad::GetVibrationDevice(const Core::HID::VibrationDeviceHandle& handle) {
|
|
||||||
if (IsVibrationHandleValid(handle).IsError()) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto npad_index = NpadIdTypeToIndex(static_cast<Core::HID::NpadIdType>(handle.npad_id));
|
|
||||||
const auto style_inde = static_cast<Core::HID::NpadStyleIndex>(handle.npad_type);
|
|
||||||
if (style_inde == Core::HID::NpadStyleIndex::GameCube) {
|
|
||||||
return abstracted_pads[npad_index].GetGCVibrationDevice();
|
|
||||||
}
|
|
||||||
if (style_inde == Core::HID::NpadStyleIndex::N64) {
|
|
||||||
return abstracted_pads[npad_index].GetN64VibrationDevice();
|
|
||||||
}
|
|
||||||
return abstracted_pads[npad_index].GetVibrationDevice(handle.device_index);
|
|
||||||
}
|
|
||||||
|
|
||||||
NpadN64VibrationDevice* NPad::GetN64VibrationDevice(
|
|
||||||
const Core::HID::VibrationDeviceHandle& handle) {
|
|
||||||
if (IsVibrationHandleValid(handle).IsError()) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto npad_index = NpadIdTypeToIndex(static_cast<Core::HID::NpadIdType>(handle.npad_id));
|
|
||||||
const auto style_inde = static_cast<Core::HID::NpadStyleIndex>(handle.npad_type);
|
|
||||||
if (style_inde != Core::HID::NpadStyleIndex::N64) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
return abstracted_pads[npad_index].GetN64VibrationDevice();
|
|
||||||
}
|
|
||||||
|
|
||||||
NpadVibrationDevice* NPad::GetNSVibrationDevice(const Core::HID::VibrationDeviceHandle& handle) {
|
|
||||||
if (IsVibrationHandleValid(handle).IsError()) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto npad_index = NpadIdTypeToIndex(static_cast<Core::HID::NpadIdType>(handle.npad_id));
|
|
||||||
const auto style_inde = static_cast<Core::HID::NpadStyleIndex>(handle.npad_type);
|
|
||||||
if (style_inde == Core::HID::NpadStyleIndex::GameCube ||
|
|
||||||
style_inde == Core::HID::NpadStyleIndex::N64) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
return abstracted_pads[npad_index].GetVibrationDevice(handle.device_index);
|
|
||||||
}
|
|
||||||
|
|
||||||
NpadGcVibrationDevice* NPad::GetGcVibrationDevice(const Core::HID::VibrationDeviceHandle& handle) {
|
|
||||||
if (IsVibrationHandleValid(handle).IsError()) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto npad_index = NpadIdTypeToIndex(static_cast<Core::HID::NpadIdType>(handle.npad_id));
|
|
||||||
const auto style_inde = static_cast<Core::HID::NpadStyleIndex>(handle.npad_type);
|
|
||||||
if (style_inde != Core::HID::NpadStyleIndex::GameCube) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
return abstracted_pads[npad_index].GetGCVibrationDevice();
|
|
||||||
}
|
|
||||||
|
|
||||||
void NPad::UpdateHandheldAbstractState() {
|
|
||||||
std::scoped_lock lock{mutex};
|
|
||||||
abstracted_pads[NpadIdTypeToIndex(Core::HID::NpadIdType::Handheld)].Update();
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Service::HID
|
} // namespace Service::HID
|
||||||
|
@ -10,15 +10,9 @@
|
|||||||
|
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "hid_core/hid_types.h"
|
#include "hid_core/hid_types.h"
|
||||||
#include "hid_core/resources/abstracted_pad/abstract_pad.h"
|
|
||||||
#include "hid_core/resources/controller_base.h"
|
#include "hid_core/resources/controller_base.h"
|
||||||
#include "hid_core/resources/npad/npad_resource.h"
|
#include "hid_core/resources/npad/npad_resource.h"
|
||||||
#include "hid_core/resources/npad/npad_types.h"
|
#include "hid_core/resources/npad/npad_types.h"
|
||||||
#include "hid_core/resources/npad/npad_vibration.h"
|
|
||||||
#include "hid_core/resources/vibration/gc_vibration_device.h"
|
|
||||||
#include "hid_core/resources/vibration/n64_vibration_device.h"
|
|
||||||
#include "hid_core/resources/vibration/vibration_base.h"
|
|
||||||
#include "hid_core/resources/vibration/vibration_device.h"
|
|
||||||
|
|
||||||
namespace Core::HID {
|
namespace Core::HID {
|
||||||
class EmulatedController;
|
class EmulatedController;
|
||||||
@ -38,7 +32,6 @@ union Result;
|
|||||||
|
|
||||||
namespace Service::HID {
|
namespace Service::HID {
|
||||||
class AppletResource;
|
class AppletResource;
|
||||||
struct HandheldConfig;
|
|
||||||
struct NpadInternalState;
|
struct NpadInternalState;
|
||||||
struct NpadSixAxisSensorLifo;
|
struct NpadSixAxisSensorLifo;
|
||||||
struct NpadSharedMemoryFormat;
|
struct NpadSharedMemoryFormat;
|
||||||
@ -75,6 +68,31 @@ public:
|
|||||||
bool SetNpadMode(u64 aruid, Core::HID::NpadIdType& new_npad_id, Core::HID::NpadIdType npad_id,
|
bool SetNpadMode(u64 aruid, Core::HID::NpadIdType& new_npad_id, Core::HID::NpadIdType npad_id,
|
||||||
NpadJoyDeviceType npad_device_type, NpadJoyAssignmentMode assignment_mode);
|
NpadJoyDeviceType npad_device_type, NpadJoyAssignmentMode assignment_mode);
|
||||||
|
|
||||||
|
bool VibrateControllerAtIndex(u64 aruid, Core::HID::NpadIdType npad_id,
|
||||||
|
std::size_t device_index,
|
||||||
|
const Core::HID::VibrationValue& vibration_value);
|
||||||
|
|
||||||
|
void VibrateController(u64 aruid,
|
||||||
|
const Core::HID::VibrationDeviceHandle& vibration_device_handle,
|
||||||
|
const Core::HID::VibrationValue& vibration_value);
|
||||||
|
|
||||||
|
void VibrateControllers(
|
||||||
|
u64 aruid, std::span<const Core::HID::VibrationDeviceHandle> vibration_device_handles,
|
||||||
|
std::span<const Core::HID::VibrationValue> vibration_values);
|
||||||
|
|
||||||
|
Core::HID::VibrationValue GetLastVibration(
|
||||||
|
u64 aruid, const Core::HID::VibrationDeviceHandle& vibration_device_handle) const;
|
||||||
|
|
||||||
|
void InitializeVibrationDevice(const Core::HID::VibrationDeviceHandle& vibration_device_handle);
|
||||||
|
|
||||||
|
void InitializeVibrationDeviceAtIndex(u64 aruid, Core::HID::NpadIdType npad_id,
|
||||||
|
std::size_t device_index);
|
||||||
|
|
||||||
|
void SetPermitVibrationSession(bool permit_vibration_session);
|
||||||
|
|
||||||
|
bool IsVibrationDeviceMounted(
|
||||||
|
u64 aruid, const Core::HID::VibrationDeviceHandle& vibration_device_handle) const;
|
||||||
|
|
||||||
Result AcquireNpadStyleSetUpdateEventHandle(u64 aruid, Kernel::KReadableEvent** out_event,
|
Result AcquireNpadStyleSetUpdateEventHandle(u64 aruid, Kernel::KReadableEvent** out_event,
|
||||||
Core::HID::NpadIdType npad_id);
|
Core::HID::NpadIdType npad_id);
|
||||||
|
|
||||||
@ -127,8 +145,7 @@ public:
|
|||||||
Result RegisterAppletResourceUserId(u64 aruid);
|
Result RegisterAppletResourceUserId(u64 aruid);
|
||||||
void UnregisterAppletResourceUserId(u64 aruid);
|
void UnregisterAppletResourceUserId(u64 aruid);
|
||||||
void SetNpadExternals(std::shared_ptr<AppletResource> resource,
|
void SetNpadExternals(std::shared_ptr<AppletResource> resource,
|
||||||
std::recursive_mutex* shared_mutex,
|
std::recursive_mutex* shared_mutex);
|
||||||
std::shared_ptr<HandheldConfig> handheld_config);
|
|
||||||
|
|
||||||
AppletDetailedUiType GetAppletDetailedUiType(Core::HID::NpadIdType npad_id);
|
AppletDetailedUiType GetAppletDetailedUiType(Core::HID::NpadIdType npad_id);
|
||||||
|
|
||||||
@ -144,20 +161,18 @@ public:
|
|||||||
|
|
||||||
Result GetLastActiveNpad(Core::HID::NpadIdType& out_npad_id) const;
|
Result GetLastActiveNpad(Core::HID::NpadIdType& out_npad_id) const;
|
||||||
|
|
||||||
NpadVibration* GetVibrationHandler();
|
|
||||||
std::vector<NpadVibrationBase*> GetAllVibrationDevices();
|
|
||||||
NpadVibrationBase* GetVibrationDevice(const Core::HID::VibrationDeviceHandle& handle);
|
|
||||||
NpadN64VibrationDevice* GetN64VibrationDevice(const Core::HID::VibrationDeviceHandle& handle);
|
|
||||||
NpadVibrationDevice* GetNSVibrationDevice(const Core::HID::VibrationDeviceHandle& handle);
|
|
||||||
NpadGcVibrationDevice* GetGcVibrationDevice(const Core::HID::VibrationDeviceHandle& handle);
|
|
||||||
|
|
||||||
void UpdateHandheldAbstractState();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
struct VibrationData {
|
||||||
|
bool device_mounted{};
|
||||||
|
Core::HID::VibrationValue latest_vibration_value{};
|
||||||
|
std::chrono::steady_clock::time_point last_vibration_timepoint{};
|
||||||
|
};
|
||||||
|
|
||||||
struct NpadControllerData {
|
struct NpadControllerData {
|
||||||
NpadInternalState* shared_memory = nullptr;
|
NpadInternalState* shared_memory = nullptr;
|
||||||
Core::HID::EmulatedController* device = nullptr;
|
Core::HID::EmulatedController* device = nullptr;
|
||||||
|
|
||||||
|
std::array<VibrationData, 2> vibration{};
|
||||||
bool is_connected{};
|
bool is_connected{};
|
||||||
|
|
||||||
// Dual joycons can have only one side connected
|
// Dual joycons can have only one side connected
|
||||||
@ -176,6 +191,10 @@ private:
|
|||||||
void RequestPadStateUpdate(u64 aruid, Core::HID::NpadIdType npad_id);
|
void RequestPadStateUpdate(u64 aruid, Core::HID::NpadIdType npad_id);
|
||||||
void WriteEmptyEntry(NpadInternalState* npad);
|
void WriteEmptyEntry(NpadInternalState* npad);
|
||||||
|
|
||||||
|
NpadControllerData& GetControllerFromHandle(
|
||||||
|
u64 aruid, const Core::HID::VibrationDeviceHandle& device_handle);
|
||||||
|
const NpadControllerData& GetControllerFromHandle(
|
||||||
|
u64 aruid, const Core::HID::VibrationDeviceHandle& device_handle) const;
|
||||||
NpadControllerData& GetControllerFromHandle(
|
NpadControllerData& GetControllerFromHandle(
|
||||||
u64 aruid, const Core::HID::SixAxisSensorHandle& device_handle);
|
u64 aruid, const Core::HID::SixAxisSensorHandle& device_handle);
|
||||||
const NpadControllerData& GetControllerFromHandle(
|
const NpadControllerData& GetControllerFromHandle(
|
||||||
@ -196,13 +215,11 @@ private:
|
|||||||
mutable std::mutex mutex;
|
mutable std::mutex mutex;
|
||||||
NPadResource npad_resource;
|
NPadResource npad_resource;
|
||||||
AppletResourceHolder applet_resource_holder{};
|
AppletResourceHolder applet_resource_holder{};
|
||||||
std::array<AbstractPad, MaxSupportedNpadIdTypes> abstracted_pads;
|
|
||||||
NpadVibration vibration_handler{};
|
|
||||||
|
|
||||||
Kernel::KEvent* input_event{nullptr};
|
Kernel::KEvent* input_event{nullptr};
|
||||||
std::mutex* input_mutex{nullptr};
|
std::mutex* input_mutex{nullptr};
|
||||||
|
|
||||||
std::atomic<u64> press_state{};
|
std::atomic<u64> press_state{};
|
||||||
|
bool permit_vibration_session_enabled;
|
||||||
std::array<std::array<NpadControllerData, MaxSupportedNpadIdTypes>, AruidIndexMax>
|
std::array<std::array<NpadControllerData, MaxSupportedNpadIdTypes>, AruidIndexMax>
|
||||||
controller_data{};
|
controller_data{};
|
||||||
};
|
};
|
||||||
|
@ -8,10 +8,6 @@
|
|||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "hid_core/hid_types.h"
|
#include "hid_core/hid_types.h"
|
||||||
|
|
||||||
namespace Core::HID {
|
|
||||||
class EmulatedController;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Service::HID {
|
namespace Service::HID {
|
||||||
static constexpr std::size_t MaxSupportedNpadIdTypes = 10;
|
static constexpr std::size_t MaxSupportedNpadIdTypes = 10;
|
||||||
static constexpr std::size_t StyleIndexCount = 7;
|
static constexpr std::size_t StyleIndexCount = 7;
|
||||||
@ -322,7 +318,7 @@ struct InternalFlags {
|
|||||||
BitField<1, 1, u32> is_connected;
|
BitField<1, 1, u32> is_connected;
|
||||||
BitField<2, 1, u32> is_battery_low_ovln_required;
|
BitField<2, 1, u32> is_battery_low_ovln_required;
|
||||||
BitField<3, 1, u32> is_battery_low_ovln_delay_required;
|
BitField<3, 1, u32> is_battery_low_ovln_delay_required;
|
||||||
BitField<4, 1, u32> is_sample_received;
|
BitField<4, 1, u32> is_sample_recieved;
|
||||||
BitField<5, 1, u32> is_virtual_input;
|
BitField<5, 1, u32> is_virtual_input;
|
||||||
BitField<6, 1, u32> is_wired;
|
BitField<6, 1, u32> is_wired;
|
||||||
BitField<8, 1, u32> use_center_clamp;
|
BitField<8, 1, u32> use_center_clamp;
|
||||||
@ -352,7 +348,7 @@ struct IAbstractedPad {
|
|||||||
u8 indicator;
|
u8 indicator;
|
||||||
std::vector<f32> virtual_six_axis_sensor_acceleration;
|
std::vector<f32> virtual_six_axis_sensor_acceleration;
|
||||||
std::vector<f32> virtual_six_axis_sensor_angle;
|
std::vector<f32> virtual_six_axis_sensor_angle;
|
||||||
Core::HID::EmulatedController* xcd_handle;
|
u64 xcd_handle;
|
||||||
u64 color;
|
u64 color;
|
||||||
};
|
};
|
||||||
} // namespace Service::HID
|
} // namespace Service::HID
|
||||||
|
@ -15,7 +15,7 @@ Result NpadVibration::Activate() {
|
|||||||
|
|
||||||
const f32 master_volume = 1.0f; // nn::settings::system::GetVibrationMasterVolume();
|
const f32 master_volume = 1.0f; // nn::settings::system::GetVibrationMasterVolume();
|
||||||
// if (master_volume < 0.0f || master_volume > 1.0f) {
|
// if (master_volume < 0.0f || master_volume > 1.0f) {
|
||||||
// return ResultVibrationStrengthOutOfRange;
|
// return ResultVibrationStrenghtOutOfRange;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
volume = master_volume;
|
volume = master_volume;
|
||||||
@ -30,7 +30,7 @@ Result NpadVibration::SetVibrationMasterVolume(f32 master_volume) {
|
|||||||
std::scoped_lock lock{mutex};
|
std::scoped_lock lock{mutex};
|
||||||
|
|
||||||
if (master_volume < 0.0f && master_volume > 1.0f) {
|
if (master_volume < 0.0f && master_volume > 1.0f) {
|
||||||
return ResultVibrationStrengthOutOfRange;
|
return ResultVibrationStrenghtOutOfRange;
|
||||||
}
|
}
|
||||||
|
|
||||||
volume = master_volume;
|
volume = master_volume;
|
||||||
@ -50,7 +50,7 @@ Result NpadVibration::GetVibrationMasterVolume(f32& out_volume) const {
|
|||||||
|
|
||||||
const f32 master_volume = 1.0f; // nn::settings::system::GetVibrationMasterVolume();
|
const f32 master_volume = 1.0f; // nn::settings::system::GetVibrationMasterVolume();
|
||||||
// if (master_volume < 0.0f || master_volume > 1.0f) {
|
// if (master_volume < 0.0f || master_volume > 1.0f) {
|
||||||
// return ResultVibrationStrengthOutOfRange;
|
// return ResultVibrationStrenghtOutOfRange;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
out_volume = master_volume;
|
out_volume = master_volume;
|
||||||
@ -69,7 +69,7 @@ Result NpadVibration::EndPermitVibrationSession() {
|
|||||||
|
|
||||||
const f32 master_volume = 1.0f; // nn::settings::system::GetVibrationMasterVolume();
|
const f32 master_volume = 1.0f; // nn::settings::system::GetVibrationMasterVolume();
|
||||||
// if (master_volume < 0.0f || master_volume > 1.0f) {
|
// if (master_volume < 0.0f || master_volume > 1.0f) {
|
||||||
// return ResultVibrationStrengthOutOfRange;
|
// return ResultVibrationStrenghtOutOfRange;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
volume = master_volume;
|
volume = master_volume;
|
||||||
@ -77,8 +77,4 @@ Result NpadVibration::EndPermitVibrationSession() {
|
|||||||
return ResultSuccess;
|
return ResultSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
u64 NpadVibration::GetSessionAruid() const {
|
|
||||||
return session_aruid;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Service::HID
|
} // namespace Service::HID
|
||||||
|
@ -25,8 +25,6 @@ public:
|
|||||||
Result BeginPermitVibrationSession(u64 aruid);
|
Result BeginPermitVibrationSession(u64 aruid);
|
||||||
Result EndPermitVibrationSession();
|
Result EndPermitVibrationSession();
|
||||||
|
|
||||||
u64 GetSessionAruid() const;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
f32 volume{};
|
f32 volume{};
|
||||||
u64 session_aruid{};
|
u64 session_aruid{};
|
||||||
|
@ -249,7 +249,7 @@ Result SixAxis::EnableSixAxisSensorUnalteredPassthrough(
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto& sixaxis = GetSixaxisState(sixaxis_handle);
|
auto& sixaxis = GetSixaxisState(sixaxis_handle);
|
||||||
sixaxis.unaltered_passthrough = is_enabled;
|
sixaxis.unaltered_passtrough = is_enabled;
|
||||||
return ResultSuccess;
|
return ResultSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -262,7 +262,7 @@ Result SixAxis::IsSixAxisSensorUnalteredPassthroughEnabled(
|
|||||||
}
|
}
|
||||||
|
|
||||||
const auto& sixaxis = GetSixaxisState(sixaxis_handle);
|
const auto& sixaxis = GetSixaxisState(sixaxis_handle);
|
||||||
is_enabled = sixaxis.unaltered_passthrough;
|
is_enabled = sixaxis.unaltered_passtrough;
|
||||||
return ResultSuccess;
|
return ResultSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ private:
|
|||||||
|
|
||||||
struct SixaxisParameters {
|
struct SixaxisParameters {
|
||||||
bool is_fusion_enabled{true};
|
bool is_fusion_enabled{true};
|
||||||
bool unaltered_passthrough{false};
|
bool unaltered_passtrough{false};
|
||||||
Core::HID::SixAxisSensorFusionParameters fusion{};
|
Core::HID::SixAxisSensorFusionParameters fusion{};
|
||||||
Core::HID::SixAxisSensorCalibrationParameter calibration{};
|
Core::HID::SixAxisSensorCalibrationParameter calibration{};
|
||||||
Core::HID::SixAxisSensorIcInformation ic_information{};
|
Core::HID::SixAxisSensorIcInformation ic_information{};
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user