1
0
mirror of https://github.com/cathery/sys-con.git synced 2024-11-16 14:09:51 +00:00

Formatting

This commit is contained in:
cathery 2020-04-22 03:55:27 +03:00
parent fb578f6987
commit f0a91bb5e6
9 changed files with 52 additions and 50 deletions

View File

@ -1,4 +1,8 @@
{
"C_Cpp.dimInactiveRegions": true,
"C_Cpp.clang_format_fallbackStyle": "Visual Studio",
"C_Cpp.clang_format_style": "{BasedOnStyle: LLVM, UseTab: Never, IndentWidth: 4, BreakBeforeBraces: Allman, AllowShortIfStatementsOnASingleLine: false, IndentCaseLabels: true, ColumnLimit: 0, NamespaceIndentation: All, AccessModifierOffset: -4, AlignConsecutiveMacros: true, PointerAlignment: Right, IndentPPDirectives: BeforeHash, SortIncludes: false}",
"editor.formatOnSave": true,
"files.associations": {
"array": "cpp",
"*.tcc": "cpp",
@ -56,5 +60,4 @@
"mutex": "cpp",
"shared_mutex": "cpp"
},
"C_Cpp.dimInactiveRegions": true
}

View File

@ -172,11 +172,11 @@ namespace syscon::config
return ini_parse(path, ParseConfigLine, NULL);
}
void ConfigChangedCheckThreadFunc(void *arg)
{
WriteToLog("Starting config check thread!");
do {
do
{
if (R_SUCCEEDED(waitSingle(filecheckTimerWaiter, UINT64_MAX)))
{
if (config::CheckForFileChanges())
@ -187,7 +187,7 @@ namespace syscon::config
}
} while (is_config_changed_check_thread_running);
}
}
} // namespace
void LoadGlobalConfig(const GlobalConfig &config)
{
@ -327,4 +327,4 @@ namespace syscon::config
g_config_changed_check_thread.CancelSynchronization();
g_config_changed_check_thread.Join();
}
}
} // namespace syscon::config

View File

@ -16,9 +16,7 @@ namespace syscon::config
{
};
inline GlobalConfig globalConfig
{
};
inline GlobalConfig globalConfig{};
void LoadGlobalConfig(const GlobalConfig &config);
void LoadAllConfigs();
@ -29,4 +27,4 @@ namespace syscon::config
Result Enable();
void Disable();
};
}; // namespace syscon::config

View File

@ -15,7 +15,7 @@ namespace syscon::controllers
std::vector<std::unique_ptr<SwitchVirtualGamepadHandler>> controllerHandlers;
bool UseAbstractedPad;
ams::os::Mutex controllerMutex;
}
} // namespace
bool IsAtControllerLimit()
{
@ -78,4 +78,4 @@ namespace syscon::controllers
{
Reset();
}
}
} // namespace syscon::controllers

View File

@ -17,4 +17,4 @@ namespace syscon::controllers
void Initialize();
void Reset();
void Exit();
}
} // namespace syscon::controllers

View File

@ -41,14 +41,15 @@ extern "C"
namespace ams
{
ncm::ProgramId CurrentProgramId = {0x690000000000000D};
namespace result { bool CallFatalOnResultAssertion = true; }
namespace result
{
bool CallFatalOnResultAssertion = true;
}
} // namespace ams
extern "C" void __appInit(void)
{
ams::sm::DoWithSession([]
{
ams::sm::DoWithSession([] {
//Initialize system firmware version
R_ABORT_UNLESS(setsysInitialize());
SetSysFirmwareVersion fw;

View File

@ -21,7 +21,8 @@ namespace syscon::psc
void PscThreadFunc(void *arg)
{
do {
do
{
if (R_SUCCEEDED(waitSingle(pscModuleWaiter, UINT64_MAX)))
{
PscPmState pscState;
@ -46,7 +47,7 @@ namespace syscon::psc
}
} while (is_psc_thread_running);
}
}
} // namespace
Result Initialize()
{
R_TRY(pscmGetPmModule(&pscModule, PscPmModuleId(126), dependencies, sizeof(dependencies) / sizeof(uint16_t), true));
@ -66,4 +67,4 @@ namespace syscon::psc
g_psc_thread.CancelSynchronization();
g_psc_thread.Join();
}
};
}; // namespace syscon::psc

View File

@ -17,7 +17,6 @@ namespace syscon::usb
constexpr u8 CatchAllEventIndex = 2;
constexpr u8 SonyEventIndex = 0;
constexpr size_t MaxUsbHsInterfacesSize = 16;
ams::os::Mutex usbMutex;
@ -42,7 +41,8 @@ namespace syscon::usb
void UsbEventThreadFunc(void *arg)
{
do {
do
{
if (R_SUCCEEDED(eventWait(&g_usbCatchAllEvent, UINT64_MAX)))
{
WriteToLog("Catch-all event went off");
@ -70,7 +70,8 @@ namespace syscon::usb
void UsbSonyEventThreadFunc(void *arg)
{
do {
do
{
if (R_SUCCEEDED(eventWait(&g_usbSonyEvent, UINT64_MAX)))
{
WriteToLog("Sony event went off");
@ -79,12 +80,10 @@ namespace syscon::usb
if (!controllers::IsAtControllerLimit())
{
s32 total_entries;
if ((QueryVendorProduct(VENDOR_SONY, PRODUCT_DUALSHOCK3) != 0)
&& (total_entries = QueryInterfaces(USB_CLASS_HID, 0, 0)) != 0)
if ((QueryVendorProduct(VENDOR_SONY, PRODUCT_DUALSHOCK3) != 0) && (total_entries = QueryInterfaces(USB_CLASS_HID, 0, 0)) != 0)
WriteToLog("Initializing Dualshock 3 controller: 0x%x", controllers::Insert(std::make_unique<Dualshock3Controller>(std::make_unique<SwitchUSBDevice>(interfaces, total_entries))));
else if ((QueryVendorProduct(VENDOR_SONY, PRODUCT_DUALSHOCK4_1X) != 0 || QueryVendorProduct(VENDOR_SONY, PRODUCT_DUALSHOCK4_2X) != 0)
&& (total_entries = QueryInterfaces(USB_CLASS_HID, 0, 0)) != 0)
else if ((QueryVendorProduct(VENDOR_SONY, PRODUCT_DUALSHOCK4_1X) != 0 || QueryVendorProduct(VENDOR_SONY, PRODUCT_DUALSHOCK4_2X) != 0) && (total_entries = QueryInterfaces(USB_CLASS_HID, 0, 0)) != 0)
WriteToLog("Initializing Dualshock 4 controller: 0x%x", controllers::Insert(std::make_unique<Dualshock4Controller>(std::make_unique<SwitchUSBDevice>(interfaces, total_entries))));
}
}
@ -93,7 +92,8 @@ namespace syscon::usb
void UsbInterfaceChangeThreadFunc(void *arg)
{
do {
do
{
if (R_SUCCEEDED(eventWait(usbHsGetInterfaceStateChangeEvent(), UINT64_MAX)))
{
s32 total_entries;
@ -179,8 +179,7 @@ namespace syscon::usb
};
return usbHsCreateInterfaceAvailableEvent(&g_usbSonyEvent, true, SonyEventIndex, &filter);
}
}
} // namespace
void Initialize()
{
@ -236,4 +235,4 @@ namespace syscon::usb
usbHsDestroyInterfaceAvailableEvent(&g_usbCatchAllEvent, CatchAllEventIndex);
usbHsDestroyInterfaceAvailableEvent(&g_usbSonyEvent, SonyEventIndex);
}
}
} // namespace syscon::usb

View File

@ -1,7 +1,7 @@
#pragma once
namespace syscon::usb {
namespace syscon::usb
{
void Initialize();
void Exit();
@ -10,4 +10,4 @@ namespace syscon::usb {
Result CreateUsbEvents();
void DestroyUsbEvents();
}
} // namespace syscon::usb