Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
# Conflicts:
#	.github/ISSUE_TEMPLATE/bug_report.yaml
#	README.md
  • Loading branch information
ndeadly committed Oct 5, 2022
2 parents 2040e0d + 0d4f879 commit 132e3c5
Show file tree
Hide file tree
Showing 72 changed files with 1,412 additions and 950 deletions.
13 changes: 5 additions & 8 deletions .github/ISSUE_TEMPLATE/bug_report.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ body:
label: Switch Firmware Version
description: Which Nintendo Switch firmware (HOS) version are you running?
options:
- 14.1.1 (Latest)
- 14.1.2 (Latest)
- 14.1.1
- 14.1.0
- 14.0.0
- 13.2.1
Expand All @@ -24,8 +25,6 @@ body:
- 12.0.2
- 12.0.1
- 12.0.0
- 11.0.1
- 11.0.0
- Other (please specify in issue description)
validations:
required: true
Expand All @@ -45,9 +44,6 @@ body:
- 1.2.2
- 1.2.1
- 1.2.0
- 1.1.1
- 1.1.0
- 1.0.0
- Other (please specify in issue description)
validations:
required: true
Expand All @@ -57,7 +53,8 @@ body:
label: Mission Control Version
description: Which version of Mission Control are you using?
options:
- 0.7.0 (Latest)
- 0.7.1 (Latest)
- 0.7.0
- 0.6.4
- 0.6.3
- 0.6.2
Expand Down Expand Up @@ -98,4 +95,4 @@ body:
attributes:
label: Additional Context
description: Sometimes issues do not occur universally and may be caused by a factor unique to your setup. Add any additional contextual information about your environment here, eg. which other custom sysmodules are you running, are you booting sysnand or emummc, did you install Atmosphère or Mission Control as part of some unofficial third-party release/distribution etc
placeholder: Please provide any additional context here.
placeholder: Please provide any additional context here.
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ MC_MITM_TID := 010000000000bd00
GIT_BRANCH := $(shell git symbolic-ref --short HEAD | sed s/[^a-zA-Z0-9_-]/_/g)
GIT_HASH := $(shell git rev-parse --short HEAD)
GIT_TAG := $(shell git describe --tags `git rev-list --tags --max-count=1`)

VERSION := $(shell [[ $(GIT_TAG) =~ ^v([0-9]+).([0-9]+).([0-9]+) ]] && printf '0x%02X%02X%02X' $${BASH_REMATCH[1]} $${BASH_REMATCH[2]} $${BASH_REMATCH[3]})
BUILD_VERSION := $(GIT_TAG:v%=%)-$(GIT_BRANCH)-$(GIT_HASH)

TARGETS := mcmitm_version.cpp mc_mitm

all: $(TARGETS)

mcmitm_version.cpp: .git/HEAD .git/index
echo "namespace ams::mitm { const char *version_string = \"$(BUILD_VERSION)\"; const char *build_date = \"$$(date)\"; }" > mc_mitm/source/$@
echo "namespace ams::mitm { unsigned int mc_version = $(VERSION); const char *mc_build_name = \"$(BUILD_VERSION)\"; const char *mc_build_date = \"$$(date)\"; }" > mc_mitm/source/$@

mc_mitm:
$(MAKE) -C $@
Expand All @@ -24,6 +26,8 @@ clean:
dist: all
rm -rf dist



mkdir -p dist/atmosphere/contents/$(MC_MITM_TID)
cp mc_mitm/out/nintendo_nx_arm64_armv8a/release/mc_mitm.nsp dist/atmosphere/contents/$(MC_MITM_TID)/exefs.nsp
echo "btdrv" >> dist/atmosphere/contents/$(MC_MITM_TID)/mitm.lst
Expand Down
20 changes: 15 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Use controllers from other consoles natively on your Nintendo Switch via Bluetoo
Currently, the following controllers are supported. If you have a third-party variant of one of the below, or a Bluetooth controller that isn't listed, consider submitting an issue with the controller details, including vid/pid, to request support.

* __Nintendo Wii Remote + extensions (Nunchuck, Classic Controller, Classic Controller Pro, SNES Mini, TaTaCon (Taiko drum), MotionPlus)__
* __Nintendo Wii Balance Board (experimental)__
* __Nintendo WiiU Pro Controller__
* __Sony DualShock4 Controller__
* __Sony Dualsense Controller__
Expand Down Expand Up @@ -117,13 +118,20 @@ A template for the config .ini file will be installed to `/config/MissionControl

- `[general]`
These are general settings for mission control features.
- `enable_rumble` Enables/disables rumble support for unofficial controllers.
- `enable_motion` Enables/disables motion controls support.
- `enable_rumble` Enable/disable rumble support for unofficial controllers.
- `enable_motion` Enable/disable motion controls support.

- `[bluetooth]`
These settings can be used to spoof your switch bluetooth to appear as another device. This may be useful (in conjunction with a link key) if you want to use your controller across multiple devices without having to re-pair every time you switch. Note that changing these settings will invalidate your console information stored in any previously paired controllers and will require re-pairing.
- `host_name` Override the bluetooth host adapter name
- `host_address` Override the bluetooth host adapter address
- `host_name` Override the bluetooth host adapter name.
- `host_address` Override the bluetooth host adapter address.

- `[misc]`
These are miscellaneous controller-specific settings etc.
- `enable_dualshock4_lightbar` Enable/disable the coloured LED lightbar on Sony Dualshock4 controllers.
- `enable_dualsense_lightbar` Enable/disable the coloured LED lightbar on Sony Dualsense controllers.
- `enable_dualsense_player_leds` Enable/disable the white player indicator LEDs below the Dualsense touchpad.
- `dualsense_vibration_intensity` Set Dualsense vibration intensity, 12.5% per increment. Valid range [1-8] where 1=12.5%, 8=100%.

### Removal

Expand All @@ -145,6 +153,8 @@ Below is a list of features I am currently working on or would like to look into
* ~~Rumble support~~
* ~~Motion controls support~~
* Bluetooth LE support
* USB wired controllers
* UART MITM to allow button combos and other future features to apply to joycons in handheld mode
* Per-controller configurations
* Rumble on/off
* Motion controls on/off
Expand All @@ -167,7 +177,7 @@ Below is a list of features I am currently working on or would like to look into
* Tesla overlay
* Keyboard and mouse support
* Gamecube mode (analog trigger support)
* USB wired controllers
* Title-specific button bindings

### Known Issues and Limitations

Expand Down
2 changes: 1 addition & 1 deletion lib/Atmosphere-libs
Submodule Atmosphere-libs updated 61 files
+1 −1 config/templates/stratosphere.mk
+4 −0 libstratosphere/include/stratosphere/fs/fs_path.hpp
+2 −2 libstratosphere/include/stratosphere/fssrv/interface_adapters/fssrv_filesystem_interface_adapter.hpp
+16 −16 libstratosphere/include/stratosphere/fssrv/sf/fssrv_sf_ifilesystem.hpp
+7 −1 libstratosphere/include/stratosphere/fssystem/fssystem_aes_ctr_counter_extended_storage.hpp
+4 −4 libstratosphere/include/stratosphere/fssystem/fssystem_i_hash_256_generator.hpp
+3 −8 libstratosphere/include/stratosphere/fssystem/fssystem_integrity_verification_storage.hpp
+9 −3 libstratosphere/include/stratosphere/fssystem/fssystem_sha_hash_generator.hpp
+1 −0 libstratosphere/include/stratosphere/hos/hos_types.hpp
+3 −2 libstratosphere/include/stratosphere/ldr/ldr_types.hpp
+2 −0 libstratosphere/include/stratosphere/os.hpp
+6 −4 libstratosphere/include/stratosphere/os/os_memory_common.hpp
+31 −0 libstratosphere/include/stratosphere/os/os_process_code_memory_api.hpp
+28 −0 libstratosphere/include/stratosphere/os/os_process_memory_api.hpp
+1 −1 libstratosphere/source/fs/impl/fs_file_system_service_object_adapter.hpp
+1 −1 libstratosphere/source/fssrv/fssrv_filesystem_interface_adapter.cpp
+15 −8 libstratosphere/source/fssystem/fssystem_aes_ctr_counter_extended_storage.cpp
+8 −8 libstratosphere/source/fssystem/fssystem_aes_ctr_storage.cpp
+8 −8 libstratosphere/source/fssystem/fssystem_aes_xts_storage.cpp
+8 −8 libstratosphere/source/fssystem/fssystem_aes_xts_storage_external.cpp
+7 −5 libstratosphere/source/fssystem/fssystem_integrity_verification_storage.cpp
+4 −1 libstratosphere/source/os/impl/os_address_space_allocator.hpp
+1 −1 libstratosphere/source/os/impl/os_address_space_allocator_impl.os.horizon.hpp
+24 −16 libstratosphere/source/os/impl/os_aslr_space_manager_impl.os.horizon.hpp
+19 −7 libstratosphere/source/os/impl/os_aslr_space_manager_types.hpp
+4 −2 libstratosphere/source/os/impl/os_io_region_impl.os.horizon.cpp
+21 −17 libstratosphere/source/os/impl/os_multiple_wait_holder_base.hpp
+7 −7 libstratosphere/source/os/impl/os_multiple_wait_holder_impl.hpp
+8 −8 libstratosphere/source/os/impl/os_multiple_wait_holder_of_event.hpp
+4 −3 libstratosphere/source/os/impl/os_multiple_wait_holder_of_inter_process_event.hpp
+3 −2 libstratosphere/source/os/impl/os_multiple_wait_holder_of_interrupt_event.cpp
+2 −2 libstratosphere/source/os/impl/os_multiple_wait_holder_of_interrupt_event.hpp
+38 −31 libstratosphere/source/os/impl/os_multiple_wait_holder_of_message_queue.hpp
+5 −4 libstratosphere/source/os/impl/os_multiple_wait_holder_of_native_handle.hpp
+5 −5 libstratosphere/source/os/impl/os_multiple_wait_holder_of_semaphore.hpp
+5 −5 libstratosphere/source/os/impl/os_multiple_wait_holder_of_thread.hpp
+17 −16 libstratosphere/source/os/impl/os_multiple_wait_holder_of_timer_event.hpp
+124 −66 libstratosphere/source/os/impl/os_multiple_wait_impl.cpp
+23 −24 libstratosphere/source/os/impl/os_multiple_wait_impl.hpp
+6 −6 libstratosphere/source/os/impl/os_multiple_wait_object_list.hpp
+27 −0 libstratosphere/source/os/impl/os_process_code_memory_impl.hpp
+141 −0 libstratosphere/source/os/impl/os_process_code_memory_impl.os.horizon.cpp
+29 −0 libstratosphere/source/os/impl/os_process_memory_impl.hpp
+74 −0 libstratosphere/source/os/impl/os_process_memory_impl.os.horizon.cpp
+4 −2 libstratosphere/source/os/impl/os_shared_memory_impl.os.horizon.cpp
+1 −1 libstratosphere/source/os/impl/os_thread_manager.cpp
+1 −1 libstratosphere/source/os/impl/os_timer_event_helper.cpp
+1 −1 libstratosphere/source/os/impl/os_timer_event_helper.hpp
+4 −2 libstratosphere/source/os/impl/os_transfer_memory_impl.os.horizon.cpp
+1 −1 libstratosphere/source/os/os_event.cpp
+11 −11 libstratosphere/source/os/os_message_queue.cpp
+11 −11 libstratosphere/source/os/os_multiple_wait.cpp
+29 −0 libstratosphere/source/os/os_process_code_memory.cpp
+33 −0 libstratosphere/source/os/os_process_memory.cpp
+2 −2 libstratosphere/source/os/os_sdk_reply_and_receive.cpp
+3 −3 libstratosphere/source/os/os_semaphore.cpp
+8 −8 libstratosphere/source/os/os_timer_event.cpp
+2 −2 libvapours/include/vapours/ams/ams_api_version.h
+3 −1 libvapours/include/vapours/ams/ams_target_firmware.h
+1 −0 libvapours/include/vapours/results/os_results.hpp
+100 −10 libvapours/include/vapours/util/util_optional.hpp
10 changes: 8 additions & 2 deletions mc_mitm/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,11 @@
;host_address=04:20:69:04:20:69

[misc]
; Disable the LED lightbar on Sony Dualshock 4 and Dualsense controllers [default false]
;disable_sony_leds=false
; Enable the LED lightbar on Sony Dualshock 4 controllers [default true]
;enable_dualshock4_lightbar=false
; Enable the LED lightbar on Sony Dualsense controllers [default true]
;enable_dualsense_lightbar=false
; Enable the white player indicator LEDs below the Dualsense touchpad [default true]
;enable_dualsense_player_leds=false
; Set Dualsense vibration intensity, 12.5% per increment. Valid range [1-8] where 1=12.5%, 8=100% [default 4(50%)]
;dualsense_vibration_intensity=4
91 changes: 11 additions & 80 deletions mc_mitm/mc_mitm.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
{
"name": "mc.mitm",
"title_id": "0x010000000000bd00",
"title_id_range_min": "0x010000000000bd00",
"title_id_range_max": "0x010000000000bd00",
"program_id": "0x010000000000bd00",
"program_id_range_min": "0x010000000000bd00",
"program_id_range_max": "0x010000000000bd00",
"main_thread_stack_size": "0x1000",
"main_thread_priority": 42,
"default_cpu_id": 3,
"process_category": 1,
"version": "0",
"is_retail": true,
"pool_partition": 2,
"is_64_bit": true,
"signature_key_generation": 0,
"address_space_type": 3,
"system_resource_size": "0",
"optimize_memory_allocation": false,
"disable_device_address_space_merge": true,
"system_resource_size": "0",
"filesystem_access": {
"permissions": "0xFFFFFFFFFFFFFFFF"
},
Expand All @@ -27,15 +29,14 @@
"type": "kernel_flags",
"value": {
"highest_thread_priority": 63,
"lowest_thread_priority": 12,
"lowest_thread_priority": 4,
"lowest_cpu_id": 3,
"highest_cpu_id": 3
}
},
{
"type": "syscalls",
"value": {
"svcUnknown": "0x00",
"svcSetHeapSize": "0x01",
"svcSetMemoryPermission": "0x02",
"svcSetMemoryAttribute": "0x03",
Expand Down Expand Up @@ -77,92 +78,29 @@
"svcOutputDebugString": "0x27",
"svcReturnFromException": "0x28",
"svcGetInfo": "0x29",
"svcFlushEntireDataCache": "0x2a",
"svcFlushDataCache": "0x2b",
"svcMapPhysicalMemory": "0x2c",
"svcUnmapPhysicalMemory": "0x2d",
"svcGetFutureThreadInfo": "0x2e",
"svcGetLastThreadInfo": "0x2f",
"svcGetResourceLimitLimitValue": "0x30",
"svcGetResourceLimitCurrentValue": "0x31",
"svcSetThreadActivity": "0x32",
"svcGetThreadContext3": "0x33",
"svcWaitForAddress": "0x34",
"svcSignalToAddress": "0x35",
"svcUnknown": "0x36",
"svcUnknown": "0x37",
"svcUnknown": "0x38",
"svcUnknown": "0x39",
"svcUnknown": "0x3a",
"svcUnknown": "0x3b",
"svcDumpInfo": "0x3c",
"svcDumpInfoNew": "0x3d",
"svcUnknown": "0x3e",
"svcUnknown": "0x3f",
"svcSynchronizePreemptionState": "0x36",
"svcCreateSession": "0x40",
"svcAcceptSession": "0x41",
"svcReplyAndReceiveLight": "0x42",
"svcReplyAndReceive": "0x43",
"svcReplyAndReceiveWithUserBuffer": "0x44",
"svcCreateEvent": "0x45",
"svcUnknown": "0x46",
"svcUnknown": "0x47",
"svcMapPhysicalMemoryUnsafe": "0x48",
"svcUnmapPhysicalMemoryUnsafe": "0x49",
"svcSetUnsafeLimit": "0x4a",
"svcCreateCodeMemory": "0x4b",
"svcControlCodeMemory": "0x4c",
"svcSleepSystem": "0x4d",
"svcReadWriteRegister": "0x4e",
"svcSetProcessActivity": "0x4f",
"svcCreateSharedMemory": "0x50",
"svcMapTransferMemory": "0x51",
"svcUnmapTransferMemory": "0x52",
"svcCreateInterruptEvent": "0x53",
"svcQueryPhysicalAddress": "0x54",
"svcReadWriteRegister": "0x4E",
"svcQueryIoMapping": "0x55",
"svcCreateDeviceAddressSpace": "0x56",
"svcAttachDeviceAddressSpace": "0x57",
"svcDetachDeviceAddressSpace": "0x58",
"svcMapDeviceAddressSpaceByForce": "0x59",
"svcMapDeviceAddressSpaceAligned": "0x5a",
"svcMapDeviceAddressSpace": "0x5b",
"svcUnmapDeviceAddressSpace": "0x5c",
"svcInvalidateProcessDataCache": "0x5d",
"svcStoreProcessDataCache": "0x5e",
"svcFlushProcessDataCache": "0x5f",
"svcDebugActiveProcess": "0x60",
"svcBreakDebugProcess": "0x61",
"svcTerminateDebugProcess": "0x62",
"svcGetDebugEvent": "0x63",
"svcContinueDebugEvent": "0x64",
"svcGetProcessList": "0x65",
"svcGetThreadList": "0x66",
"svcGetDebugThreadContext": "0x67",
"svcSetDebugThreadContext": "0x68",
"svcQueryDebugProcessMemory": "0x69",
"svcReadDebugProcessMemory": "0x6a",
"svcWriteDebugProcessMemory": "0x6b",
"svcSetHardwareBreakPoint": "0x6c",
"svcGetDebugThreadParam": "0x6d",
"svcUnknown": "0x6e",
"svcGetSystemInfo": "0x6f",
"svcCreatePort": "0x70",
"svcManageNamedPort": "0x71",
"svcConnectToPort": "0x72",
"svcSetProcessMemoryPermission": "0x73",
"svcMapProcessMemory": "0x74",
"svcUnmapProcessMemory": "0x75",
"svcQueryProcessMemory": "0x76",
"svcMapProcessCodeMemory": "0x77",
"svcUnmapProcessCodeMemory": "0x78",
"svcCreateProcess": "0x79",
"svcStartProcess": "0x7a",
"svcTerminateProcess": "0x7b",
"svcGetProcessInfo": "0x7c",
"svcCreateResourceLimit": "0x7d",
"svcSetResourceLimitLimitValue": "0x7e",
"svcCallSecureMonitor": "0x7f"
"svcCallSecureMonitor": "0x7F"
}
},
{
Expand All @@ -172,13 +110,6 @@
{
"type": "handle_table_size",
"value": 128
},
{
"type": "debug_flags",
"value": {
"allow_debug": false,
"force_debug": true
}
}
]
}
4 changes: 2 additions & 2 deletions mc_mitm/source/async/async.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ namespace ams::async {

}

Result Initialize(void) {
Result Initialize() {
os::InitializeMessageQueue(&g_work_queue, g_message_buffer, MessageBufferSize);

for (unsigned int i = 0; i < ThreadCount; ++i) {
Expand All @@ -64,7 +64,7 @@ namespace ams::async {
return ams::ResultSuccess();
}

void Finalize(void) {
void Finalize() {
os::FinalizeMessageQueue(&g_work_queue);

for (unsigned int i = 0; i < ThreadCount; ++i) {
Expand Down
4 changes: 2 additions & 2 deletions mc_mitm/source/async/async.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ namespace ams::async {

using AsyncFunction = std::function<Result(void)>;

Result Initialize(void);
void Finalize(void);
Result Initialize();
void Finalize();

void QueueWork(AsyncFunction *function);

Expand Down
4 changes: 2 additions & 2 deletions mc_mitm/source/async/future_response.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ namespace ams {
return m_user_data;
}

void Wait(void) {
void Wait() {
os::WaitEvent(&m_ready_event);
}

bool TryWait(void) {
bool TryWait() {
return os::TryWaitEvent(&m_ready_event);
}

Expand Down
14 changes: 6 additions & 8 deletions mc_mitm/source/bluetooth_mitm/bluetooth/bluetooth_ble.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
*/
#include "bluetooth_ble.hpp"
#include "../btdrv_mitm_flags.hpp"
#include <mutex>
#include <cstring>

namespace ams::bluetooth::ble {

Expand All @@ -38,23 +36,23 @@ namespace ams::bluetooth::ble {
return g_init_event.TryWait();
}

void SignalInitialized(void) {
void SignalInitialized() {
g_init_event.Signal();
}

void WaitInitialized(void) {
void WaitInitialized() {
g_init_event.Wait();
}

os::SystemEvent *GetSystemEvent(void) {
os::SystemEvent *GetSystemEvent() {
return &g_system_event;
}

os::SystemEvent *GetForwardEvent(void) {
os::SystemEvent *GetForwardEvent() {
return &g_system_event_fwd;
}

os::SystemEvent *GetUserForwardEvent(void) {
os::SystemEvent *GetUserForwardEvent() {
return &g_system_event_user_fwd;
}

Expand All @@ -69,7 +67,7 @@ namespace ams::bluetooth::ble {
return ams::ResultSuccess();
}

void HandleEvent(void) {
void HandleEvent() {
{
std::scoped_lock lk(g_event_data_lock);
R_ABORT_UNLESS(btdrvGetBleManagedEventInfo(&g_event_info, sizeof(bluetooth::BleEventInfo), &g_current_event_type));
Expand Down
Loading

0 comments on commit 132e3c5

Please sign in to comment.