Compare commits

..

38 Commits

Author SHA1 Message Date
Lioncash
cc47a6a9c2 service: Remove unused class variables
Prevents some warnings from occurring.
2021-05-05 01:32:28 -04:00
bunnei
403cf6be69 Merge pull request #6281 from lioncash/shadow-field
service: Resolve cases of member field shadowing
2021-05-04 19:51:08 -07:00
Lioncash
9e726a9250 service: Resolve cases of member field shadowing
Now all that remains is for kernel code to be 'shadow-free' and then
-Wshadow can be turned into an error.
2021-05-04 04:38:38 -04:00
bunnei
df51eb9bde Merge pull request #6278 from lioncash/misc-shadow
core: Resolve misc straggler cases of variable shadowing
2021-05-03 16:04:28 -07:00
bunnei
898aa5fb66 Merge pull request #6275 from german77/mousefocus
input_common: Release mouse buttons on out of focus
2021-05-03 12:50:19 -07:00
Lioncash
ebb64d5bf4 core: Resolve misc cases of variable shadowing
Resolves shadowing warnings that aren't in a particularly large
subsection of core. Brings us closer to turning -Wshadow into an error.

All that remains now is for cases in the kernel (left untouched for now
since a big change by bunnei is pending), and a few left over in the
service code (will be tackled next).
2021-05-03 01:19:13 -04:00
Morph
707ed72a3c Merge pull request #6277 from german77/touchsetting2
hid: Fix touch not initializing properly if disabled
2021-05-02 23:25:10 -04:00
german77
08d5bd36d8 hid: Fix touch not initializing properly if disabled 2021-05-02 21:27:15 -05:00
german77
6e81473574 input_common: Release mouse buttons on out of focus 2021-05-02 19:08:33 -05:00
bunnei
c17a59b58e Merge pull request #6269 from lioncash/file-shadow
file_sys: Resolve cases of variable shadowing
2021-05-02 15:12:07 -07:00
Morph
0d2d0844a5 Merge pull request #6263 from Kewlan/folder-swap-expand-state
game_list: Fix dir move up/down expand state
2021-05-02 07:43:45 -04:00
bunnei
01a57d4c8d Merge pull request #6265 from Morph1984/snap-save-fix
service: filesystem: Return proper error codes for CreateFile
2021-05-02 00:45:18 -07:00
Lioncash
1da72c7792 file_sys: Resolve cases of variable shadowing
Brings us closer to enabling -Wshadow as an error in the core code.
2021-05-02 02:59:57 -04:00
bunnei
54dc22285b Merge pull request #6245 from lat9nq/boost-only-config
cmake: Only config Boost during find_package
2021-05-01 22:21:05 -07:00
bunnei
03b3c5800b Merge pull request #6261 from Kewlan/game-list-filter-fix
game_list: Update filter results when removing directories
2021-05-01 09:14:10 -07:00
Morph
07934f0e87 Merge pull request #6264 from german77/touchsetting
hid: Disable touch if setting is not enabled
2021-05-01 11:28:28 -04:00
Morph
72b22fd433 service: filesystem: Return proper error codes for CreateFile
This improves the accuracy of CreateFile by returning the correct error codes on certain conditions (parent directory does not exist, path already exists).

This fixes saving and the loading of existing saves in New Pokemon Snap
2021-05-01 09:33:00 -04:00
german77
1ed1dd3c89 Disable touch if setting is not enabled 2021-04-30 19:28:21 -05:00
bunnei
fa3ffff8de Merge pull request #6257 from Morph1984/fix-use-after-free-webapplet
applets/web: Fix a use-after-free when passing in the URL string
2021-04-30 14:48:32 -07:00
bunnei
aab57b7975 Merge pull request #6243 from german77/GCresetOrigin
input_common: Reset GC sticks center by measuring multiple packets
2021-04-30 12:02:05 -07:00
Kewlan
497ccfaedc game_list: Fix dir move up/down expand state 2021-04-30 12:18:38 +02:00
bunnei
922b0d9933 Merge pull request #6226 from german77/sevensix
hid: Implement SevenSixAxis and ConsoleSixAxisSensor
2021-04-29 22:06:57 -07:00
bunnei
bea6fca9a1 Merge pull request #6258 from Morph1984/config-conv
yuzu: config: Silence narrowing conversion warning on MSVC
2021-04-29 21:49:05 -07:00
Kewlan
fc84822266 game_list: Update filter results when removing directories 2021-04-30 00:05:23 +02:00
Morph
29a06ad393 yuzu: config: Silence narrowing conversion warning on MSVC 2021-04-28 22:42:56 -04:00
Ameer J
e1a196cfd7 Merge pull request #6259 from Morph1984/main-conv
yuzu: main: Silence type conversion warning on MSVC
2021-04-28 20:54:05 -04:00
Morph
0af182baa2 applets/web: Fix a use-after-free when passing in the URL string
The URL string was being deleted before being used, leading to a use-after-free occurring when it is used afterwards.

Fix this by taking the string by const ref to extend its lifetime, ensuring it doesn't get deleted before use.
2021-04-28 12:34:28 -04:00
Morph
d95605cd24 yuzu: main: Silence type conversion warning on MSVC 2021-04-28 12:22:41 -04:00
bunnei
b096ec68cd Merge pull request #6250 from lioncash/loader-shadow
loader: Resolve instances of variable shadowing
2021-04-27 19:40:46 -07:00
Lioncash
724c19a307 loader: Resolve instances of variable shadowing
Eliminates variable shadowing cases across all the loaders to bring us
closer to enabling variable shadowing as an error in core.
2021-04-27 12:48:15 -04:00
german77
cfdec68d5a address comments 2021-04-26 22:07:16 -05:00
german77
729545a946 input_common: Reset GC sticks center by measuring multiple packets 2021-04-26 18:34:00 -05:00
bunnei
cd80471c90 Merge pull request #6246 from lioncash/shadow
service: Eliminate cases of member variable shadowing
2021-04-26 16:19:49 -07:00
bunnei
dec5680934 Merge pull request #6236 from Morph1984/swkbd-button-hint-scaling
applets/swkbd: Fix software keyboard button hint scaling
2021-04-26 14:40:37 -07:00
Lioncash
dcb91ca4a4 service: Eliminate cases of member shadowing
Resolves a few localized instances of member variable shadowing. Brings
us a little closer to turning shadowing warnings into errors.
2021-04-26 09:39:49 -04:00
lat9nq
697a2c0018 cmake: Only config Boost during find_package
Without the CONFIG option, find_package will perform Module search. On
at least Linux Mint 20 (I'm unable to reproduce this on CentOS and Arch
Linux), my guess is that this causes CMake to find "dirty" modules that
modify the configuration state despite the Boost version being too
low/absent.

Use CONFIG to put CMake into pure Config mode and avoid Module search.
2021-04-25 21:02:39 -04:00
Its-Rei
c413cafdac applets/swkbd: Fix software keyboard button hint scaling
Fixes the scaling of the button hints using background images. Now they scale like the rest of the elements.
2021-04-24 13:47:33 -04:00
german77
c19ad21ae8 hid: Implement SevenSixAxis and ConsoleSixAxisSensor 2021-04-23 22:12:41 -05:00
167 changed files with 966 additions and 646 deletions

View File

@@ -202,7 +202,7 @@ macro(yuzu_find_packages)
endmacro()
if (NOT YUZU_USE_BUNDLED_BOOST)
find_package(Boost 1.73.0 COMPONENTS context headers QUIET)
find_package(Boost 1.73.0 CONFIG COMPONENTS context headers QUIET)
endif()
if (Boost_FOUND)
set(Boost_LIBRARIES Boost::boost)
@@ -224,7 +224,7 @@ elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR YUZU_USE_BUNDLED_BOOST)
download_bundled_external("boost/" ${Boost_EXT_NAME} "")
set(Boost_USE_DEBUG_RUNTIME FALSE)
set(Boost_USE_STATIC_LIBS ON)
find_package(Boost 1.75.0 REQUIRED COMPONENTS context headers PATHS ${Boost_PATH} NO_DEFAULT_PATH)
find_package(Boost 1.75.0 CONFIG REQUIRED COMPONENTS context headers PATHS ${Boost_PATH} NO_DEFAULT_PATH)
# Manually set the include dirs since the find_package sets it incorrectly
set(Boost_INCLUDE_DIRS ${Boost_PATH}/include CACHE PATH "Path to Boost headers" FORCE)
include_directories(SYSTEM "${Boost_INCLUDE_DIRS}")

Binary file not shown.

Before

Width:  |  Height:  |  Size: 741 B

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 767 B

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 781 B

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 791 B

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 726 B

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 502 B

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 694 B

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 699 B

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 626 B

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 676 B

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 645 B

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 664 B

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 281 B

After

Width:  |  Height:  |  Size: 936 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 274 B

After

Width:  |  Height:  |  Size: 894 B

View File

@@ -515,45 +515,35 @@ QDialog#QtSoftwareKeyboardDialog QPushButton#button_backspace_num:pressed {
QDialog#QtSoftwareKeyboardDialog QPushButton#button_backspace,
QDialog#QtSoftwareKeyboardDialog QPushButton#button_backspace_shift,
QDialog#QtSoftwareKeyboardDialog QPushButton#button_backspace_num {
background-position: right top;
background-repeat: no-repeat;
background-origin: content;
background-image: url(:/overlay/osk_button_B.png);
image: url(:/overlay/osk_button_B.png);
image-position: right;
qproperty-icon: url(:/overlay/osk_button_backspace.png);
qproperty-iconSize: 36px;
}
QDialog#QtSoftwareKeyboardDialog QPushButton#button_space,
QDialog#QtSoftwareKeyboardDialog QPushButton#button_space_shift {
background-position: right top;
background-repeat: no-repeat;
background-origin: content;
background-image: url(:/overlay/osk_button_Y.png);
image: url(:/overlay/osk_button_Y.png);
image-position: right;
}
QDialog#QtSoftwareKeyboardDialog QPushButton#button_ok,
QDialog#QtSoftwareKeyboardDialog QPushButton#button_ok_shift,
QDialog#QtSoftwareKeyboardDialog QPushButton#button_ok_num {
background-position: right top;
background-repeat: no-repeat;
background-origin: content;
background-image: url(:/overlay/osk_button_plus.png);
image: url(:/overlay/osk_button_plus.png);
image-position: right;
}
QDialog#QtSoftwareKeyboardDialog QPushButton#button_shift {
background-position: left top;
background-repeat: no-repeat;
background-origin: content;
background-image: url(:/overlay/osk_button_shift_lock_off.png);
image: url(:/overlay/osk_button_shift_lock_off.png);
image-position: left;
qproperty-icon: url(:/overlay/osk_button_shift.png);
qproperty-iconSize: 36px;
}
QDialog#QtSoftwareKeyboardDialog QPushButton#button_shift_shift {
background-position: left top;
background-repeat: no-repeat;
background-origin: content;
background-image: url(:/overlay/osk_button_shift_lock_off.png);
image: url(:/overlay/osk_button_shift_lock_off.png);
image-position: left;
qproperty-icon: url(:/overlay/osk_button_shift_on.png);
qproperty-iconSize: 36px;
}
@@ -645,16 +635,16 @@ QDialog#QtSoftwareKeyboardDialog QPushButton#button_return:disabled {
QDialog#QtSoftwareKeyboardDialog QPushButton#button_ok:disabled,
QDialog#QtSoftwareKeyboardDialog QPushButton#button_ok_shift:disabled,
QDialog#QtSoftwareKeyboardDialog QPushButton#button_ok_num:disabled {
background-image: url(:/overlay/osk_button_plus_disabled.png);
image: url(:/overlay/osk_button_plus_disabled.png);
}
QDialog#QtSoftwareKeyboardDialog QPushButton#button_backspace:disabled,
QDialog#QtSoftwareKeyboardDialog QPushButton#button_backspace_shift:disabled,
QDialog#QtSoftwareKeyboardDialog QPushButton#button_backspace_num:disabled {
background-image: url(:/overlay/osk_button_B_disabled.png);
image: url(:/overlay/osk_button_B_disabled.png);
}
QDialog#QtSoftwareKeyboardDialog QPushButton#button_space:disabled,
QDialog#QtSoftwareKeyboardDialog QPushButton#button_space_shift:disabled {
background-image: url(:/overlay/osk_button_Y_disabled.png);
image: url(:/overlay/osk_button_Y_disabled.png);
}

View File

@@ -1805,46 +1805,36 @@ QDialog#QtSoftwareKeyboardDialog QPushButton#button_backspace_num:pressed {
QDialog#QtSoftwareKeyboardDialog QPushButton#button_backspace,
QDialog#QtSoftwareKeyboardDialog QPushButton#button_backspace_shift,
QDialog#QtSoftwareKeyboardDialog QPushButton#button_backspace_num {
background-position: right top;
background-repeat: no-repeat;
background-origin: content;
background-image: url(:/overlay/osk_button_B_dark.png);
image: url(:/overlay/osk_button_B_dark.png);
image-position: right;
qproperty-icon: url(:/overlay/osk_button_backspace_dark.png);
qproperty-iconSize: 36px;
}
QDialog#QtSoftwareKeyboardDialog QPushButton#button_space,
QDialog#QtSoftwareKeyboardDialog QPushButton#button_space_shift {
background-position: right top;
background-repeat: no-repeat;
background-origin: content;
background-image: url(:/overlay/osk_button_Y_dark.png);
image: url(:/overlay/osk_button_Y_dark.png);
image-position: right;
}
QDialog#QtSoftwareKeyboardDialog QPushButton#button_ok,
QDialog#QtSoftwareKeyboardDialog QPushButton#button_ok_shift,
QDialog#QtSoftwareKeyboardDialog QPushButton#button_ok_num {
color: rgba(44, 44, 44, 1);
background-position: right top;
background-repeat: no-repeat;
background-origin: content;
background-image: url(:/overlay/osk_button_plus_dark.png);
image: url(:/overlay/osk_button_plus_dark.png);
image-position: right;
}
QDialog#QtSoftwareKeyboardDialog QPushButton#button_shift {
background-position: left top;
background-repeat: no-repeat;
background-origin: content;
background-image: url(:/overlay/osk_button_shift_lock_off.png);
image: url(:/overlay/osk_button_shift_lock_off.png);
image-position: left;
qproperty-icon: url(:/overlay/osk_button_shift_dark.png);
qproperty-iconSize: 36px;
}
QDialog#QtSoftwareKeyboardDialog QPushButton#button_shift_shift {
background-position: left top;
background-repeat: no-repeat;
background-origin: content;
background-image: url(:/overlay/osk_button_shift_lock_off.png);
image: url(:/overlay/osk_button_shift_lock_off.png);
image-position: left;
qproperty-icon: url(:/overlay/osk_button_shift_on_dark.png);
qproperty-iconSize: 36px;
}
@@ -1936,18 +1926,18 @@ QDialog#QtSoftwareKeyboardDialog QPushButton#button_return:disabled {
QDialog#QtSoftwareKeyboardDialog QPushButton#button_ok:disabled,
QDialog#QtSoftwareKeyboardDialog QPushButton#button_ok_shift:disabled,
QDialog#QtSoftwareKeyboardDialog QPushButton#button_ok_num:disabled {
background-image: url(:/overlay/osk_button_plus_dark_disabled.png);
image: url(:/overlay/osk_button_plus_dark_disabled.png);
}
QDialog#QtSoftwareKeyboardDialog QPushButton#button_backspace:disabled,
QDialog#QtSoftwareKeyboardDialog QPushButton#button_backspace_shift:disabled,
QDialog#QtSoftwareKeyboardDialog QPushButton#button_backspace_num:disabled {
background-image: url(:/overlay/osk_button_B_dark_disabled.png);
image: url(:/overlay/osk_button_B_dark_disabled.png);
}
QDialog#QtSoftwareKeyboardDialog QPushButton#button_space:disabled,
QDialog#QtSoftwareKeyboardDialog QPushButton#button_space_shift:disabled {
background-image: url(:/overlay/osk_button_Y_dark_disabled.png);
image: url(:/overlay/osk_button_Y_dark_disabled.png);
}
QDialog#QtSoftwareKeyboardDialog QFrame,

View File

@@ -2740,46 +2740,36 @@ QDialog#QtSoftwareKeyboardDialog QPushButton#button_backspace_num:pressed {
QDialog#QtSoftwareKeyboardDialog QPushButton#button_backspace,
QDialog#QtSoftwareKeyboardDialog QPushButton#button_backspace_shift,
QDialog#QtSoftwareKeyboardDialog QPushButton#button_backspace_num {
background-position: right top;
background-repeat: no-repeat;
background-origin: content;
background-image: url(:/overlay/osk_button_B_dark.png);
image: url(:/overlay/osk_button_B_dark.png);
image-position: right;
qproperty-icon: url(:/overlay/osk_button_backspace_dark.png);
qproperty-iconSize: 36px;
}
QDialog#QtSoftwareKeyboardDialog QPushButton#button_space,
QDialog#QtSoftwareKeyboardDialog QPushButton#button_space_shift {
background-position: right top;
background-repeat: no-repeat;
background-origin: content;
background-image: url(:/overlay/osk_button_Y_dark.png);
image: url(:/overlay/osk_button_Y_dark.png);
image-position: right;
}
QDialog#QtSoftwareKeyboardDialog QPushButton#button_ok,
QDialog#QtSoftwareKeyboardDialog QPushButton#button_ok_shift,
QDialog#QtSoftwareKeyboardDialog QPushButton#button_ok_num {
color: rgba(44, 44, 44, 1);
background-position: right top;
background-repeat: no-repeat;
background-origin: content;
background-image: url(:/overlay/osk_button_plus_dark.png);
image: url(:/overlay/osk_button_plus_dark.png);
image-position: right;
}
QDialog#QtSoftwareKeyboardDialog QPushButton#button_shift {
background-position: left top;
background-repeat: no-repeat;
background-origin: content;
background-image: url(:/overlay/osk_button_shift_lock_off.png);
image: url(:/overlay/osk_button_shift_lock_off.png);
image-position: left;
qproperty-icon: url(:/overlay/osk_button_shift_dark.png);
qproperty-iconSize: 36px;
}
QDialog#QtSoftwareKeyboardDialog QPushButton#button_shift_shift {
background-position: left top;
background-repeat: no-repeat;
background-origin: content;
background-image: url(:/overlay/osk_button_shift_lock_off.png);
image: url(:/overlay/osk_button_shift_lock_off.png);
image-position: left;
qproperty-icon: url(:/overlay/osk_button_shift_on_dark.png);
qproperty-iconSize: 36px;
}
@@ -2871,16 +2861,16 @@ QDialog#QtSoftwareKeyboardDialog QPushButton#button_return:disabled {
QDialog#QtSoftwareKeyboardDialog QPushButton#button_ok:disabled,
QDialog#QtSoftwareKeyboardDialog QPushButton#button_ok_shift:disabled,
QDialog#QtSoftwareKeyboardDialog QPushButton#button_ok_num:disabled {
background-image: url(:/overlay/osk_button_plus_dark_disabled.png);
image: url(:/overlay/osk_button_plus_dark_disabled.png);
}
QDialog#QtSoftwareKeyboardDialog QPushButton#button_backspace:disabled,
QDialog#QtSoftwareKeyboardDialog QPushButton#button_backspace_shift:disabled,
QDialog#QtSoftwareKeyboardDialog QPushButton#button_backspace_num:disabled {
background-image: url(:/overlay/osk_button_B_dark_disabled.png);
image: url(:/overlay/osk_button_B_dark_disabled.png);
}
QDialog#QtSoftwareKeyboardDialog QPushButton#button_space:disabled,
QDialog#QtSoftwareKeyboardDialog QPushButton#button_space_shift:disabled {
background-image: url(:/overlay/osk_button_Y_dark_disabled.png);
image: url(:/overlay/osk_button_Y_dark_disabled.png);
}

View File

@@ -393,6 +393,8 @@ add_library(core STATIC
hle/service/hid/xcd.cpp
hle/service/hid/xcd.h
hle/service/hid/errors.h
hle/service/hid/controllers/console_sixaxis.cpp
hle/service/hid/controllers/console_sixaxis.h
hle/service/hid/controllers/controller_base.cpp
hle/service/hid/controllers/controller_base.h
hle/service/hid/controllers/debug_pad.cpp

View File

@@ -198,13 +198,13 @@ void ARM_Dynarmic_32::Step() {
jit->Step();
}
ARM_Dynarmic_32::ARM_Dynarmic_32(System& system, CPUInterrupts& interrupt_handlers,
bool uses_wall_clock, ExclusiveMonitor& exclusive_monitor,
std::size_t core_index)
: ARM_Interface{system, interrupt_handlers, uses_wall_clock},
ARM_Dynarmic_32::ARM_Dynarmic_32(System& system_, CPUInterrupts& interrupt_handlers_,
bool uses_wall_clock_, ExclusiveMonitor& exclusive_monitor_,
std::size_t core_index_)
: ARM_Interface{system_, interrupt_handlers_, uses_wall_clock_},
cb(std::make_unique<DynarmicCallbacks32>(*this)),
cp15(std::make_shared<DynarmicCP15>(*this)), core_index{core_index},
exclusive_monitor{dynamic_cast<DynarmicExclusiveMonitor&>(exclusive_monitor)},
cp15(std::make_shared<DynarmicCP15>(*this)), core_index{core_index_},
exclusive_monitor{dynamic_cast<DynarmicExclusiveMonitor&>(exclusive_monitor_)},
jit(MakeJit(nullptr)) {}
ARM_Dynarmic_32::~ARM_Dynarmic_32() = default;

View File

@@ -29,8 +29,8 @@ class System;
class ARM_Dynarmic_32 final : public ARM_Interface {
public:
ARM_Dynarmic_32(System& system, CPUInterrupts& interrupt_handlers, bool uses_wall_clock,
ExclusiveMonitor& exclusive_monitor, std::size_t core_index);
ARM_Dynarmic_32(System& system_, CPUInterrupts& interrupt_handlers_, bool uses_wall_clock_,
ExclusiveMonitor& exclusive_monitor_, std::size_t core_index_);
~ARM_Dynarmic_32() override;
void SetPC(u64 pc) override;

View File

@@ -238,12 +238,12 @@ void ARM_Dynarmic_64::Step() {
cb->InterpreterFallback(jit->GetPC(), 1);
}
ARM_Dynarmic_64::ARM_Dynarmic_64(System& system, CPUInterrupts& interrupt_handlers,
bool uses_wall_clock, ExclusiveMonitor& exclusive_monitor,
std::size_t core_index)
: ARM_Interface{system, interrupt_handlers, uses_wall_clock},
cb(std::make_unique<DynarmicCallbacks64>(*this)), core_index{core_index},
exclusive_monitor{dynamic_cast<DynarmicExclusiveMonitor&>(exclusive_monitor)},
ARM_Dynarmic_64::ARM_Dynarmic_64(System& system_, CPUInterrupts& interrupt_handlers_,
bool uses_wall_clock_, ExclusiveMonitor& exclusive_monitor_,
std::size_t core_index_)
: ARM_Interface{system_, interrupt_handlers_, uses_wall_clock_},
cb(std::make_unique<DynarmicCallbacks64>(*this)), core_index{core_index_},
exclusive_monitor{dynamic_cast<DynarmicExclusiveMonitor&>(exclusive_monitor_)},
jit(MakeJit(nullptr, 48)) {}
ARM_Dynarmic_64::~ARM_Dynarmic_64() = default;

View File

@@ -26,8 +26,8 @@ class System;
class ARM_Dynarmic_64 final : public ARM_Interface {
public:
ARM_Dynarmic_64(System& system, CPUInterrupts& interrupt_handlers, bool uses_wall_clock,
ExclusiveMonitor& exclusive_monitor, std::size_t core_index);
ARM_Dynarmic_64(System& system_, CPUInterrupts& interrupt_handlers_, bool uses_wall_clock_,
ExclusiveMonitor& exclusive_monitor_, std::size_t core_index_);
~ARM_Dynarmic_64() override;
void SetPC(u64 pc) override;

View File

@@ -94,12 +94,11 @@ CallbackOrAccessOneWord DynarmicCP15::CompileGetOneWord(bool two, unsigned opc1,
CallbackOrAccessTwoWords DynarmicCP15::CompileGetTwoWords(bool two, unsigned opc, CoprocReg CRm) {
if (!two && opc == 0 && CRm == CoprocReg::C14) {
// CNTPCT
const auto callback = static_cast<u64 (*)(Dynarmic::A32::Jit*, void*, u32, u32)>(
[](Dynarmic::A32::Jit*, void* arg, u32, u32) -> u64 {
ARM_Dynarmic_32& parent = *(ARM_Dynarmic_32*)arg;
return parent.system.CoreTiming().GetClockTicks();
});
return Dynarmic::A32::Coprocessor::Callback{callback, (void*)&parent};
const auto callback = [](Dynarmic::A32::Jit*, void* arg, u32, u32) -> u64 {
const auto& parent_arg = *static_cast<ARM_Dynarmic_32*>(arg);
return parent_arg.system.CoreTiming().GetClockTicks();
};
return Callback{callback, &parent};
}
LOG_CRITICAL(Core_ARM, "CP15: mrrc{} p15, {}, <Rt>, <Rt2>, {}", two ? "2" : "", opc, CRm);

View File

@@ -133,8 +133,8 @@ void CoreTiming::UnscheduleEvent(const std::shared_ptr<EventType>& event_type,
}
}
void CoreTiming::AddTicks(u64 ticks) {
this->ticks += ticks;
void CoreTiming::AddTicks(u64 ticks_to_add) {
ticks += ticks_to_add;
downcount -= static_cast<s64>(ticks);
}

View File

@@ -102,7 +102,7 @@ public:
/// We only permit one event of each type in the queue at a time.
void RemoveEvent(const std::shared_ptr<EventType>& event_type);
void AddTicks(u64 ticks);
void AddTicks(u64 ticks_to_add);
void ResetTicks();

View File

@@ -35,13 +35,13 @@ public:
CpuManager& operator=(CpuManager&&) = delete;
/// Sets if emulation is multicore or single core, must be set before Initialize
void SetMulticore(bool is_multicore) {
this->is_multicore = is_multicore;
void SetMulticore(bool is_multi) {
is_multicore = is_multi;
}
/// Sets if emulation is using an asynchronous GPU.
void SetAsyncGpu(bool is_async_gpu) {
this->is_async_gpu = is_async_gpu;
void SetAsyncGpu(bool is_async) {
is_async_gpu = is_async;
}
void Initialize();

View File

@@ -176,26 +176,30 @@ u64 XCI::GetProgramTitleID() const {
u32 XCI::GetSystemUpdateVersion() {
const auto update = GetPartition(XCIPartition::Update);
if (update == nullptr)
if (update == nullptr) {
return 0;
}
for (const auto& file : update->GetFiles()) {
NCA nca{file, nullptr, 0};
for (const auto& update_file : update->GetFiles()) {
NCA nca{update_file, nullptr, 0};
if (nca.GetStatus() != Loader::ResultStatus::Success)
if (nca.GetStatus() != Loader::ResultStatus::Success) {
continue;
}
if (nca.GetType() == NCAContentType::Meta && nca.GetTitleId() == 0x0100000000000816) {
const auto dir = nca.GetSubdirectories()[0];
const auto cnmt = dir->GetFile("SystemUpdate_0100000000000816.cnmt");
if (cnmt == nullptr)
if (cnmt == nullptr) {
continue;
}
CNMT cnmt_data{cnmt};
const auto metas = cnmt_data.GetMetaRecords();
if (metas.empty())
if (metas.empty()) {
continue;
}
return metas[0].title_version;
}
@@ -262,8 +266,8 @@ VirtualDir XCI::ConcatenatedPseudoDirectory() {
if (part == nullptr)
continue;
for (const auto& file : part->GetFiles())
out->AddFile(file);
for (const auto& part_file : part->GetFiles())
out->AddFile(part_file);
}
return out;
@@ -283,12 +287,12 @@ Loader::ResultStatus XCI::AddNCAFromPartition(XCIPartition part) {
return Loader::ResultStatus::ErrorXCIMissingPartition;
}
for (const VirtualFile& file : partition->GetFiles()) {
if (file->GetExtension() != "nca") {
for (const VirtualFile& partition_file : partition->GetFiles()) {
if (partition_file->GetExtension() != "nca") {
continue;
}
auto nca = std::make_shared<NCA>(file, nullptr, 0);
auto nca = std::make_shared<NCA>(partition_file, nullptr, 0);
if (nca->IsUpdate()) {
continue;
}

View File

@@ -5,6 +5,7 @@
#include <algorithm>
#include <cstring>
#include <optional>
#include <ranges>
#include <utility>
#include "common/logging/log.h"
@@ -136,12 +137,11 @@ NCA::NCA(VirtualFile file_, VirtualFile bktr_base_romfs_, u64 bktr_base_ivfc_off
return;
}
has_rights_id = std::any_of(header.rights_id.begin(), header.rights_id.end(),
[](char c) { return c != '\0'; });
has_rights_id = std::ranges::any_of(header.rights_id, [](char c) { return c != '\0'; });
const std::vector<NCASectionHeader> sections = ReadSectionHeaders();
is_update = std::any_of(sections.begin(), sections.end(), [](const NCASectionHeader& header) {
return header.raw.header.crypto_type == NCASectionCryptoType::BKTR;
is_update = std::ranges::any_of(sections, [](const NCASectionHeader& nca_header) {
return nca_header.raw.header.crypto_type == NCASectionCryptoType::BKTR;
});
if (!ReadSections(sections, bktr_base_ivfc_offset)) {
@@ -202,8 +202,9 @@ bool NCA::HandlePotentialHeaderDecryption() {
std::vector<NCASectionHeader> NCA::ReadSectionHeaders() const {
const std::ptrdiff_t number_sections =
std::count_if(std::begin(header.section_tables), std::end(header.section_tables),
[](NCASectionTableEntry entry) { return entry.media_offset > 0; });
std::ranges::count_if(header.section_tables, [](const NCASectionTableEntry& entry) {
return entry.media_offset > 0;
});
std::vector<NCASectionHeader> sections(number_sections);
const auto length_sections = SECTION_HEADER_SIZE * number_sections;
@@ -312,11 +313,11 @@ bool NCA::ReadRomFSSection(const NCASectionHeader& section, const NCASectionTabl
}
std::vector<RelocationBucket> relocation_buckets(relocation_buckets_raw.size());
std::transform(relocation_buckets_raw.begin(), relocation_buckets_raw.end(),
relocation_buckets.begin(), &ConvertRelocationBucketRaw);
std::ranges::transform(relocation_buckets_raw, relocation_buckets.begin(),
&ConvertRelocationBucketRaw);
std::vector<SubsectionBucket> subsection_buckets(subsection_buckets_raw.size());
std::transform(subsection_buckets_raw.begin(), subsection_buckets_raw.end(),
subsection_buckets.begin(), &ConvertSubsectionBucketRaw);
std::ranges::transform(subsection_buckets_raw, subsection_buckets.begin(),
&ConvertSubsectionBucketRaw);
u32 ctr_low;
std::memcpy(&ctr_low, section.raw.section_ctr.data(), sizeof(ctr_low));

View File

@@ -9,6 +9,7 @@
namespace FileSys {
constexpr ResultCode ERROR_PATH_NOT_FOUND{ErrorModule::FS, 1};
constexpr ResultCode ERROR_PATH_ALREADY_EXISTS{ErrorModule::FS, 2};
constexpr ResultCode ERROR_ENTITY_NOT_FOUND{ErrorModule::FS, 1002};
constexpr ResultCode ERROR_SD_CARD_NOT_FOUND{ErrorModule::FS, 2001};
constexpr ResultCode ERROR_OUT_OF_BOUNDS{ErrorModule::FS, 3005};

View File

@@ -126,16 +126,17 @@ static u64 romfs_get_hash_table_count(u64 num_entries) {
return count;
}
void RomFSBuildContext::VisitDirectory(VirtualDir root_romfs, VirtualDir ext,
void RomFSBuildContext::VisitDirectory(VirtualDir root_romfs, VirtualDir ext_dir,
std::shared_ptr<RomFSBuildDirectoryContext> parent) {
std::vector<std::shared_ptr<RomFSBuildDirectoryContext>> child_dirs;
VirtualDir dir;
if (parent->path_len == 0)
if (parent->path_len == 0) {
dir = root_romfs;
else
} else {
dir = root_romfs->GetDirectoryRelative(parent->path);
}
const auto entries = dir->GetEntries();
@@ -147,8 +148,9 @@ void RomFSBuildContext::VisitDirectory(VirtualDir root_romfs, VirtualDir ext,
child->path_len = child->cur_path_ofs + static_cast<u32>(kv.first.size());
child->path = parent->path + "/" + kv.first;
if (ext != nullptr && ext->GetFileRelative(child->path + ".stub") != nullptr)
if (ext_dir != nullptr && ext_dir->GetFileRelative(child->path + ".stub") != nullptr) {
continue;
}
// Sanity check on path_len
ASSERT(child->path_len < FS_MAX_PATH);
@@ -163,21 +165,20 @@ void RomFSBuildContext::VisitDirectory(VirtualDir root_romfs, VirtualDir ext,
child->path_len = child->cur_path_ofs + static_cast<u32>(kv.first.size());
child->path = parent->path + "/" + kv.first;
if (ext != nullptr && ext->GetFileRelative(child->path + ".stub") != nullptr)
if (ext_dir != nullptr && ext_dir->GetFileRelative(child->path + ".stub") != nullptr) {
continue;
}
// Sanity check on path_len
ASSERT(child->path_len < FS_MAX_PATH);
child->source = root_romfs->GetFileRelative(child->path);
if (ext != nullptr) {
const auto ips = ext->GetFileRelative(child->path + ".ips");
if (ips != nullptr) {
auto patched = PatchIPS(child->source, ips);
if (patched != nullptr)
if (ext_dir != nullptr) {
if (const auto ips = ext_dir->GetFileRelative(child->path + ".ips")) {
if (auto patched = PatchIPS(child->source, ips)) {
child->source = std::move(patched);
}
}
}
@@ -188,7 +189,7 @@ void RomFSBuildContext::VisitDirectory(VirtualDir root_romfs, VirtualDir ext,
}
for (auto& child : child_dirs) {
this->VisitDirectory(root_romfs, ext, child);
this->VisitDirectory(root_romfs, ext_dir, child);
}
}

View File

@@ -59,7 +59,7 @@ private:
u64 file_hash_table_size = 0;
u64 file_partition_size = 0;
void VisitDirectory(VirtualDir filesys, VirtualDir ext,
void VisitDirectory(VirtualDir filesys, VirtualDir ext_dir,
std::shared_ptr<RomFSBuildDirectoryContext> parent);
bool AddDirectory(std::shared_ptr<RomFSBuildDirectoryContext> parent_dir_ctx,

View File

@@ -83,11 +83,14 @@ BKTR::~BKTR() = default;
std::size_t BKTR::Read(u8* data, std::size_t length, std::size_t offset) const {
// Read out of bounds.
if (offset >= relocation.size)
if (offset >= relocation.size) {
return 0;
const auto relocation = GetRelocationEntry(offset);
const auto section_offset = offset - relocation.address_patch + relocation.address_source;
const auto bktr_read = relocation.from_patch;
}
const auto relocation_entry = GetRelocationEntry(offset);
const auto section_offset =
offset - relocation_entry.address_patch + relocation_entry.address_source;
const auto bktr_read = relocation_entry.from_patch;
const auto next_relocation = GetNextRelocationEntry(offset);
@@ -106,15 +109,16 @@ std::size_t BKTR::Read(u8* data, std::size_t length, std::size_t offset) const {
return bktr_romfs->Read(data, length, section_offset);
}
const auto subsection = GetSubsectionEntry(section_offset);
const auto subsection_entry = GetSubsectionEntry(section_offset);
Core::Crypto::AESCipher<Core::Crypto::Key128> cipher(key, Core::Crypto::Mode::CTR);
// Calculate AES IV
std::array<u8, 16> iv{};
auto subsection_ctr = subsection.ctr;
auto subsection_ctr = subsection_entry.ctr;
auto offset_iv = section_offset + base_offset;
for (std::size_t i = 0; i < section_ctr.size(); ++i)
for (std::size_t i = 0; i < section_ctr.size(); ++i) {
iv[i] = section_ctr[0x8 - i - 1];
}
offset_iv >>= 4;
for (std::size_t i = 0; i < sizeof(u64); ++i) {
iv[0xF - i] = static_cast<u8>(offset_iv & 0xFF);

View File

@@ -281,14 +281,14 @@ NcaID PlaceholderCache::Generate() {
return out;
}
VirtualFile RegisteredCache::OpenFileOrDirectoryConcat(const VirtualDir& dir,
VirtualFile RegisteredCache::OpenFileOrDirectoryConcat(const VirtualDir& open_dir,
std::string_view path) const {
const auto file = dir->GetFileRelative(path);
const auto file = open_dir->GetFileRelative(path);
if (file != nullptr) {
return file;
}
const auto nca_dir = dir->GetDirectoryRelative(path);
const auto nca_dir = open_dir->GetDirectoryRelative(path);
if (nca_dir == nullptr) {
return nullptr;
}
@@ -431,13 +431,15 @@ void RegisteredCache::ProcessFiles(const std::vector<NcaID>& ids) {
}
void RegisteredCache::AccumulateYuzuMeta() {
const auto dir = this->dir->GetSubdirectory("yuzu_meta");
if (dir == nullptr)
const auto meta_dir = dir->GetSubdirectory("yuzu_meta");
if (meta_dir == nullptr) {
return;
}
for (const auto& file : dir->GetFiles()) {
if (file->GetExtension() != "cnmt")
for (const auto& file : meta_dir->GetFiles()) {
if (file->GetExtension() != "cnmt") {
continue;
}
CNMT cnmt(file);
yuzu_meta.insert_or_assign(cnmt.GetTitleID(), std::move(cnmt));
@@ -445,8 +447,10 @@ void RegisteredCache::AccumulateYuzuMeta() {
}
void RegisteredCache::Refresh() {
if (dir == nullptr)
if (dir == nullptr) {
return;
}
const auto ids = AccumulateFiles();
ProcessFiles(ids);
AccumulateYuzuMeta();
@@ -566,7 +570,7 @@ InstallResult RegisteredCache::InstallEntry(const NSP& nsp, bool overwrite_if_ex
}
const auto meta_id_raw = (*meta_iter)->GetName().substr(0, 32);
const auto meta_id = Common::HexStringToArray<16>(meta_id_raw);
const auto meta_id_data = Common::HexStringToArray<16>(meta_id_raw);
if ((*meta_iter)->GetSubdirectories().empty()) {
LOG_ERROR(Loader,
@@ -591,7 +595,7 @@ InstallResult RegisteredCache::InstallEntry(const NSP& nsp, bool overwrite_if_ex
const auto result = RemoveExistingEntry(title_id);
// Install Metadata File
const auto res = RawInstallNCA(**meta_iter, copy, overwrite_if_exists, meta_id);
const auto res = RawInstallNCA(**meta_iter, copy, overwrite_if_exists, meta_id_data);
if (res != InstallResult::Success) {
return res;
}
@@ -741,15 +745,15 @@ InstallResult RegisteredCache::RawInstallNCA(const NCA& nca, const VfsCopyFuncti
bool RegisteredCache::RawInstallYuzuMeta(const CNMT& cnmt) {
// Reasoning behind this method can be found in the comment for InstallEntry, NCA overload.
const auto dir = this->dir->CreateDirectoryRelative("yuzu_meta");
const auto meta_dir = dir->CreateDirectoryRelative("yuzu_meta");
const auto filename = GetCNMTName(cnmt.GetType(), cnmt.GetTitleID());
if (dir->GetFile(filename) == nullptr) {
auto out = dir->CreateFile(filename);
if (meta_dir->GetFile(filename) == nullptr) {
auto out = meta_dir->CreateFile(filename);
const auto buffer = cnmt.Serialize();
out->Resize(buffer.size());
out->WriteBytes(buffer);
} else {
auto out = dir->GetFile(filename);
auto out = meta_dir->GetFile(filename);
CNMT old_cnmt(out);
// Returns true on change
if (old_cnmt.UnionRecords(cnmt)) {

View File

@@ -182,7 +182,7 @@ private:
void AccumulateYuzuMeta();
std::optional<NcaID> GetNcaIDFromMetadata(u64 title_id, ContentRecordType type) const;
VirtualFile GetFileAtID(NcaID id) const;
VirtualFile OpenFileOrDirectoryConcat(const VirtualDir& dir, std::string_view path) const;
VirtualFile OpenFileOrDirectoryConcat(const VirtualDir& open_dir, std::string_view path) const;
InstallResult RawInstallNCA(const NCA& nca, const VfsCopyFunction& copy,
bool overwrite_if_exists, std::optional<NcaID> override_id = {});
bool RawInstallYuzuMeta(const CNMT& cnmt);

View File

@@ -33,8 +33,8 @@ RomFSFactory::RomFSFactory(Loader::AppLoader& app_loader, ContentProvider& provi
RomFSFactory::~RomFSFactory() = default;
void RomFSFactory::SetPackedUpdate(VirtualFile update_raw) {
this->update_raw = std::move(update_raw);
void RomFSFactory::SetPackedUpdate(VirtualFile update_raw_file) {
update_raw = std::move(update_raw_file);
}
ResultVal<VirtualFile> RomFSFactory::OpenCurrentProcess(u64 current_process_title_id) const {

View File

@@ -40,7 +40,7 @@ public:
Service::FileSystem::FileSystemController& controller);
~RomFSFactory();
void SetPackedUpdate(VirtualFile update_raw);
void SetPackedUpdate(VirtualFile update_raw_file);
[[nodiscard]] ResultVal<VirtualFile> OpenCurrentProcess(u64 current_process_title_id) const;
[[nodiscard]] ResultVal<VirtualFile> OpenPatchedRomFS(u64 title_id,
ContentRecordType type) const;

View File

@@ -170,26 +170,30 @@ std::string SaveDataFactory::GetFullPath(Core::System& system, SaveDataSpaceId s
SaveDataSize SaveDataFactory::ReadSaveDataSize(SaveDataType type, u64 title_id,
u128 user_id) const {
const auto path = GetFullPath(system, SaveDataSpaceId::NandUser, type, title_id, user_id, 0);
const auto dir = GetOrCreateDirectoryRelative(this->dir, path);
const auto relative_dir = GetOrCreateDirectoryRelative(dir, path);
const auto size_file = dir->GetFile(SAVE_DATA_SIZE_FILENAME);
if (size_file == nullptr || size_file->GetSize() < sizeof(SaveDataSize))
const auto size_file = relative_dir->GetFile(SAVE_DATA_SIZE_FILENAME);
if (size_file == nullptr || size_file->GetSize() < sizeof(SaveDataSize)) {
return {0, 0};
}
SaveDataSize out;
if (size_file->ReadObject(&out) != sizeof(SaveDataSize))
if (size_file->ReadObject(&out) != sizeof(SaveDataSize)) {
return {0, 0};
}
return out;
}
void SaveDataFactory::WriteSaveDataSize(SaveDataType type, u64 title_id, u128 user_id,
SaveDataSize new_value) const {
const auto path = GetFullPath(system, SaveDataSpaceId::NandUser, type, title_id, user_id, 0);
const auto dir = GetOrCreateDirectoryRelative(this->dir, path);
const auto relative_dir = GetOrCreateDirectoryRelative(dir, path);
const auto size_file = dir->CreateFile(SAVE_DATA_SIZE_FILENAME);
if (size_file == nullptr)
const auto size_file = relative_dir->CreateFile(SAVE_DATA_SIZE_FILENAME);
if (size_file == nullptr) {
return;
}
size_file->Resize(sizeof(SaveDataSize));
size_file->WriteObject(new_value);

View File

@@ -232,15 +232,15 @@ void NSP::SetTicketKeys(const std::vector<VirtualFile>& files) {
void NSP::InitializeExeFSAndRomFS(const std::vector<VirtualFile>& files) {
exefs = pfs;
const auto romfs_iter = std::find_if(files.begin(), files.end(), [](const VirtualFile& file) {
return file->GetName().rfind(".romfs") != std::string::npos;
const auto iter = std::find_if(files.begin(), files.end(), [](const VirtualFile& entry) {
return entry->GetName().rfind(".romfs") != std::string::npos;
});
if (romfs_iter == files.end()) {
if (iter == files.end()) {
return;
}
romfs = *romfs_iter;
romfs = *iter;
}
void NSP::ReadNCAs(const std::vector<VirtualFile>& files) {

View File

@@ -136,7 +136,7 @@ std::size_t ConcatenatedVfsFile::Write(const u8* data, std::size_t length, std::
return 0;
}
bool ConcatenatedVfsFile::Rename(std::string_view name) {
bool ConcatenatedVfsFile::Rename(std::string_view new_name) {
return false;
}

View File

@@ -36,7 +36,7 @@ public:
bool IsReadable() const override;
std::size_t Read(u8* data, std::size_t length, std::size_t offset) const override;
std::size_t Write(const u8* data, std::size_t length, std::size_t offset) override;
bool Rename(std::string_view name) override;
bool Rename(std::string_view new_name) override;
private:
// Maps starting offset to file -- more efficient.

View File

@@ -45,12 +45,12 @@ VirtualDir LayeredVfsDirectory::GetDirectoryRelative(std::string_view path) cons
return MakeLayeredDirectory(std::move(out));
}
VirtualFile LayeredVfsDirectory::GetFile(std::string_view name) const {
return GetFileRelative(name);
VirtualFile LayeredVfsDirectory::GetFile(std::string_view file_name) const {
return GetFileRelative(file_name);
}
VirtualDir LayeredVfsDirectory::GetSubdirectory(std::string_view name) const {
return GetDirectoryRelative(name);
VirtualDir LayeredVfsDirectory::GetSubdirectory(std::string_view subdir_name) const {
return GetDirectoryRelative(subdir_name);
}
std::string LayeredVfsDirectory::GetFullPath() const {
@@ -105,24 +105,24 @@ VirtualDir LayeredVfsDirectory::GetParentDirectory() const {
return dirs[0]->GetParentDirectory();
}
VirtualDir LayeredVfsDirectory::CreateSubdirectory(std::string_view name) {
VirtualDir LayeredVfsDirectory::CreateSubdirectory(std::string_view subdir_name) {
return nullptr;
}
VirtualFile LayeredVfsDirectory::CreateFile(std::string_view name) {
VirtualFile LayeredVfsDirectory::CreateFile(std::string_view file_name) {
return nullptr;
}
bool LayeredVfsDirectory::DeleteSubdirectory(std::string_view name) {
bool LayeredVfsDirectory::DeleteSubdirectory(std::string_view subdir_name) {
return false;
}
bool LayeredVfsDirectory::DeleteFile(std::string_view name) {
bool LayeredVfsDirectory::DeleteFile(std::string_view file_name) {
return false;
}
bool LayeredVfsDirectory::Rename(std::string_view name_) {
name = name_;
bool LayeredVfsDirectory::Rename(std::string_view new_name) {
name = new_name;
return true;
}

View File

@@ -23,8 +23,8 @@ public:
VirtualFile GetFileRelative(std::string_view path) const override;
VirtualDir GetDirectoryRelative(std::string_view path) const override;
VirtualFile GetFile(std::string_view name) const override;
VirtualDir GetSubdirectory(std::string_view name) const override;
VirtualFile GetFile(std::string_view file_name) const override;
VirtualDir GetSubdirectory(std::string_view subdir_name) const override;
std::string GetFullPath() const override;
std::vector<VirtualFile> GetFiles() const override;
@@ -33,11 +33,11 @@ public:
bool IsReadable() const override;
std::string GetName() const override;
VirtualDir GetParentDirectory() const override;
VirtualDir CreateSubdirectory(std::string_view name) override;
VirtualFile CreateFile(std::string_view name) override;
bool DeleteSubdirectory(std::string_view name) override;
bool DeleteFile(std::string_view name) override;
bool Rename(std::string_view name) override;
VirtualDir CreateSubdirectory(std::string_view subdir_name) override;
VirtualFile CreateFile(std::string_view file_name) override;
bool DeleteSubdirectory(std::string_view subdir_name) override;
bool DeleteFile(std::string_view file_name) override;
bool Rename(std::string_view new_name) override;
private:
std::vector<VirtualDir> dirs;

View File

@@ -84,8 +84,8 @@ std::size_t OffsetVfsFile::WriteBytes(const std::vector<u8>& data, std::size_t r
return file->Write(data.data(), TrimToFit(data.size(), r_offset), offset + r_offset);
}
bool OffsetVfsFile::Rename(std::string_view name) {
return file->Rename(name);
bool OffsetVfsFile::Rename(std::string_view new_name) {
return file->Rename(new_name);
}
std::size_t OffsetVfsFile::GetOffset() const {

View File

@@ -35,7 +35,7 @@ public:
bool WriteByte(u8 data, std::size_t offset) override;
std::size_t WriteBytes(const std::vector<u8>& data, std::size_t offset) override;
bool Rename(std::string_view name) override;
bool Rename(std::string_view new_name) override;
std::size_t GetOffset() const;

View File

@@ -358,16 +358,16 @@ RealVfsDirectory::RealVfsDirectory(RealVfsFilesystem& base_, const std::string&
RealVfsDirectory::~RealVfsDirectory() = default;
VirtualFile RealVfsDirectory::GetFileRelative(std::string_view path) const {
const auto full_path = FS::SanitizePath(this->path + DIR_SEP + std::string(path));
VirtualFile RealVfsDirectory::GetFileRelative(std::string_view relative_path) const {
const auto full_path = FS::SanitizePath(path + DIR_SEP + std::string(relative_path));
if (!FS::Exists(full_path) || FS::IsDirectory(full_path)) {
return nullptr;
}
return base.OpenFile(full_path, perms);
}
VirtualDir RealVfsDirectory::GetDirectoryRelative(std::string_view path) const {
const auto full_path = FS::SanitizePath(this->path + DIR_SEP + std::string(path));
VirtualDir RealVfsDirectory::GetDirectoryRelative(std::string_view relative_path) const {
const auto full_path = FS::SanitizePath(path + DIR_SEP + std::string(relative_path));
if (!FS::Exists(full_path) || !FS::IsDirectory(full_path)) {
return nullptr;
}
@@ -382,13 +382,13 @@ VirtualDir RealVfsDirectory::GetSubdirectory(std::string_view name) const {
return GetDirectoryRelative(name);
}
VirtualFile RealVfsDirectory::CreateFileRelative(std::string_view path) {
const auto full_path = FS::SanitizePath(this->path + DIR_SEP + std::string(path));
VirtualFile RealVfsDirectory::CreateFileRelative(std::string_view relative_path) {
const auto full_path = FS::SanitizePath(path + DIR_SEP + std::string(relative_path));
return base.CreateFile(full_path, perms);
}
VirtualDir RealVfsDirectory::CreateDirectoryRelative(std::string_view path) {
const auto full_path = FS::SanitizePath(this->path + DIR_SEP + std::string(path));
VirtualDir RealVfsDirectory::CreateDirectoryRelative(std::string_view relative_path) {
const auto full_path = FS::SanitizePath(path + DIR_SEP + std::string(relative_path));
return base.CreateDirectory(full_path, perms);
}

View File

@@ -79,12 +79,12 @@ class RealVfsDirectory : public VfsDirectory {
public:
~RealVfsDirectory() override;
VirtualFile GetFileRelative(std::string_view path) const override;
VirtualDir GetDirectoryRelative(std::string_view path) const override;
VirtualFile GetFileRelative(std::string_view relative_path) const override;
VirtualDir GetDirectoryRelative(std::string_view relative_path) const override;
VirtualFile GetFile(std::string_view name) const override;
VirtualDir GetSubdirectory(std::string_view name) const override;
VirtualFile CreateFileRelative(std::string_view path) override;
VirtualDir CreateDirectoryRelative(std::string_view path) override;
VirtualFile CreateFileRelative(std::string_view relative_path) override;
VirtualDir CreateDirectoryRelative(std::string_view relative_path) override;
bool DeleteSubdirectoryRecursive(std::string_view name) override;
std::vector<VirtualFile> GetFiles() const override;
std::vector<VirtualDir> GetSubdirectories() const override;

View File

@@ -103,12 +103,12 @@ static bool FindAndRemoveVectorElement(std::vector<T>& vec, std::string_view nam
return true;
}
bool VectorVfsDirectory::DeleteSubdirectory(std::string_view name) {
return FindAndRemoveVectorElement(dirs, name);
bool VectorVfsDirectory::DeleteSubdirectory(std::string_view subdir_name) {
return FindAndRemoveVectorElement(dirs, subdir_name);
}
bool VectorVfsDirectory::DeleteFile(std::string_view name) {
return FindAndRemoveVectorElement(files, name);
bool VectorVfsDirectory::DeleteFile(std::string_view file_name) {
return FindAndRemoveVectorElement(files, file_name);
}
bool VectorVfsDirectory::Rename(std::string_view name_) {
@@ -116,11 +116,11 @@ bool VectorVfsDirectory::Rename(std::string_view name_) {
return true;
}
VirtualDir VectorVfsDirectory::CreateSubdirectory(std::string_view name) {
VirtualDir VectorVfsDirectory::CreateSubdirectory(std::string_view subdir_name) {
return nullptr;
}
VirtualFile VectorVfsDirectory::CreateFile(std::string_view name) {
VirtualFile VectorVfsDirectory::CreateFile(std::string_view file_name) {
return nullptr;
}

View File

@@ -112,11 +112,11 @@ public:
bool IsReadable() const override;
std::string GetName() const override;
VirtualDir GetParentDirectory() const override;
bool DeleteSubdirectory(std::string_view name) override;
bool DeleteFile(std::string_view name) override;
bool DeleteSubdirectory(std::string_view subdir_name) override;
bool DeleteFile(std::string_view file_name) override;
bool Rename(std::string_view name) override;
VirtualDir CreateSubdirectory(std::string_view name) override;
VirtualFile CreateFile(std::string_view name) override;
VirtualDir CreateSubdirectory(std::string_view subdir_name) override;
VirtualFile CreateFile(std::string_view file_name) override;
virtual void AddFile(VirtualFile file);
virtual void AddDirectory(VirtualDir dir);

View File

@@ -12,7 +12,7 @@ WebBrowserApplet::~WebBrowserApplet() = default;
DefaultWebBrowserApplet::~DefaultWebBrowserApplet() = default;
void DefaultWebBrowserApplet::OpenLocalWebPage(
std::string_view local_url, std::function<void()> extract_romfs_callback,
const std::string& local_url, std::function<void()> extract_romfs_callback,
std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback) const {
LOG_WARNING(Service_AM, "(STUBBED) called, backend requested to open local web page at {}",
local_url);
@@ -21,7 +21,7 @@ void DefaultWebBrowserApplet::OpenLocalWebPage(
}
void DefaultWebBrowserApplet::OpenExternalWebPage(
std::string_view external_url,
const std::string& external_url,
std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback) const {
LOG_WARNING(Service_AM, "(STUBBED) called, backend requested to open external web page at {}",
external_url);

View File

@@ -16,11 +16,11 @@ public:
virtual ~WebBrowserApplet();
virtual void OpenLocalWebPage(
std::string_view local_url, std::function<void()> extract_romfs_callback,
const std::string& local_url, std::function<void()> extract_romfs_callback,
std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback) const = 0;
virtual void OpenExternalWebPage(
std::string_view external_url,
const std::string& external_url,
std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback) const = 0;
};
@@ -28,11 +28,12 @@ class DefaultWebBrowserApplet final : public WebBrowserApplet {
public:
~DefaultWebBrowserApplet() override;
void OpenLocalWebPage(std::string_view local_url, std::function<void()> extract_romfs_callback,
void OpenLocalWebPage(const std::string& local_url,
std::function<void()> extract_romfs_callback,
std::function<void(Service::AM::Applets::WebExitReason, std::string)>
callback) const override;
void OpenExternalWebPage(std::string_view external_url,
void OpenExternalWebPage(const std::string& external_url,
std::function<void(Service::AM::Applets::WebExitReason, std::string)>
callback) const override;
};

View File

@@ -11,6 +11,7 @@
#include <utility>
#include "common/logging/log.h"
#include "common/param_package.h"
#include "common/quaternion.h"
#include "common/vector_math.h"
namespace Input {
@@ -143,9 +144,10 @@ using VibrationDevice = InputDevice<u8>;
/**
* A motion status is an object that returns a tuple of accelerometer state vector,
* gyroscope state vector, rotation state vector and orientation state matrix.
* gyroscope state vector, rotation state vector, orientation state matrix and quaterion state
* vector.
*
* For both vectors:
* For both 3D vectors:
* x+ is the same direction as RIGHT on D-pad.
* y+ is normal to the touch screen, pointing outward.
* z+ is the same direction as UP on D-pad.
@@ -164,9 +166,13 @@ using VibrationDevice = InputDevice<u8>;
* x vector
* y vector
* z vector
*
* For quaternion state vector
* xyz vector
* w float
*/
using MotionStatus = std::tuple<Common::Vec3<float>, Common::Vec3<float>, Common::Vec3<float>,
std::array<Common::Vec3f, 3>>;
std::array<Common::Vec3f, 3>, Common::Quaternion<f32>>;
/**
* A motion device is an input device that returns a motion status object

View File

@@ -36,6 +36,10 @@ std::shared_ptr<TransferMemory> TransferMemory::Create(KernelCore& kernel,
return transfer_memory;
}
u8* TransferMemory::GetPointer() {
return memory.GetPointer(base_address);
}
const u8* TransferMemory::GetPointer() const {
return memory.GetPointer(base_address);
}

View File

@@ -56,6 +56,9 @@ public:
return HANDLE_TYPE;
}
/// Gets a pointer to the backing block of this instance.
u8* GetPointer();
/// Gets a pointer to the backing block of this instance.
const u8* GetPointer() const;

View File

@@ -6,9 +6,10 @@
namespace Service::Account {
ACC_AA::ACC_AA(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> profile_manager,
Core::System& system)
: Module::Interface(std::move(module), std::move(profile_manager), system, "acc:aa") {
ACC_AA::ACC_AA(std::shared_ptr<Module> module_, std::shared_ptr<ProfileManager> profile_manager_,
Core::System& system_)
: Interface(std::move(module_), std::move(profile_manager_), system_, "acc:aa") {
// clang-format off
static const FunctionInfo functions[] = {
{0, nullptr, "EnsureCacheAsync"},
{1, nullptr, "LoadCache"},
@@ -16,6 +17,7 @@ ACC_AA::ACC_AA(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> p
{50, nullptr, "RegisterNotificationTokenAsync"}, // 1.0.0 - 6.2.0
{51, nullptr, "UnregisterNotificationTokenAsync"}, // 1.0.0 - 6.2.0
};
// clang-format on
RegisterHandlers(functions);
}

View File

@@ -10,8 +10,8 @@ namespace Service::Account {
class ACC_AA final : public Module::Interface {
public:
explicit ACC_AA(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> profile_manager,
Core::System& system);
explicit ACC_AA(std::shared_ptr<Module> module_,
std::shared_ptr<ProfileManager> profile_manager_, Core::System& system_);
~ACC_AA() override;
};

View File

@@ -6,9 +6,9 @@
namespace Service::Account {
ACC_SU::ACC_SU(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> profile_manager,
Core::System& system)
: Module::Interface(std::move(module), std::move(profile_manager), system, "acc:su") {
ACC_SU::ACC_SU(std::shared_ptr<Module> module_, std::shared_ptr<ProfileManager> profile_manager_,
Core::System& system_)
: Interface(std::move(module_), std::move(profile_manager_), system_, "acc:su") {
// clang-format off
static const FunctionInfo functions[] = {
{0, &ACC_SU::GetUserCount, "GetUserCount"},

View File

@@ -10,8 +10,8 @@ namespace Service::Account {
class ACC_SU final : public Module::Interface {
public:
explicit ACC_SU(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> profile_manager,
Core::System& system);
explicit ACC_SU(std::shared_ptr<Module> module_,
std::shared_ptr<ProfileManager> profile_manager_, Core::System& system_);
~ACC_SU() override;
};

View File

@@ -6,9 +6,9 @@
namespace Service::Account {
ACC_U0::ACC_U0(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> profile_manager,
Core::System& system)
: Module::Interface(std::move(module), std::move(profile_manager), system, "acc:u0") {
ACC_U0::ACC_U0(std::shared_ptr<Module> module_, std::shared_ptr<ProfileManager> profile_manager_,
Core::System& system_)
: Interface(std::move(module_), std::move(profile_manager_), system_, "acc:u0") {
// clang-format off
static const FunctionInfo functions[] = {
{0, &ACC_U0::GetUserCount, "GetUserCount"},

View File

@@ -10,8 +10,8 @@ namespace Service::Account {
class ACC_U0 final : public Module::Interface {
public:
explicit ACC_U0(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> profile_manager,
Core::System& system);
explicit ACC_U0(std::shared_ptr<Module> module_,
std::shared_ptr<ProfileManager> profile_manager_, Core::System& system_);
~ACC_U0() override;
};

View File

@@ -6,9 +6,9 @@
namespace Service::Account {
ACC_U1::ACC_U1(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> profile_manager,
Core::System& system)
: Module::Interface(std::move(module), std::move(profile_manager), system, "acc:u1") {
ACC_U1::ACC_U1(std::shared_ptr<Module> module_, std::shared_ptr<ProfileManager> profile_manager_,
Core::System& system_)
: Interface(std::move(module_), std::move(profile_manager_), system_, "acc:u1") {
// clang-format off
static const FunctionInfo functions[] = {
{0, &ACC_U1::GetUserCount, "GetUserCount"},

View File

@@ -10,8 +10,8 @@ namespace Service::Account {
class ACC_U1 final : public Module::Interface {
public:
explicit ACC_U1(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> profile_manager,
Core::System& system);
explicit ACC_U1(std::shared_ptr<Module> module_,
std::shared_ptr<ProfileManager> profile_manager_, Core::System& system_);
~ACC_U1() override;
};

View File

@@ -158,11 +158,11 @@ void Error::Execute() {
break;
case ErrorAppletMode::ShowSystemError:
case ErrorAppletMode::ShowApplicationError: {
const auto system = mode == ErrorAppletMode::ShowSystemError;
const auto is_system = mode == ErrorAppletMode::ShowSystemError;
const auto& main_text =
system ? args->system_error.main_text : args->application_error.main_text;
is_system ? args->system_error.main_text : args->application_error.main_text;
const auto& detail_text =
system ? args->system_error.detail_text : args->application_error.detail_text;
is_system ? args->system_error.detail_text : args->application_error.detail_text;
const auto main_text_string =
Common::StringFromFixedZeroTerminatedBuffer(main_text.data(), main_text.size());

View File

@@ -96,7 +96,7 @@ void Auth::Execute() {
switch (type) {
case AuthAppletType::ShowParentalAuthentication: {
const auto callback = [this](bool successful) { AuthFinished(successful); };
const auto callback = [this](bool is_successful) { AuthFinished(is_successful); };
if (arg0 == 1 && arg1 == 0 && arg2 == 1) {
// ShowAuthenticatorForConfiguration

View File

@@ -241,7 +241,7 @@ void SoftwareKeyboard::InitializeForeground() {
InitializeFrontendKeyboard();
}
void SoftwareKeyboard::InitializeBackground(LibraryAppletMode applet_mode) {
void SoftwareKeyboard::InitializeBackground(LibraryAppletMode library_applet_mode) {
LOG_INFO(Service_AM, "Initializing Inline Software Keyboard Applet.");
is_background = true;
@@ -256,9 +256,9 @@ void SoftwareKeyboard::InitializeBackground(LibraryAppletMode applet_mode) {
swkbd_inline_initialize_arg.size());
if (swkbd_initialize_arg.library_applet_mode_flag) {
ASSERT(applet_mode == LibraryAppletMode::Background);
ASSERT(library_applet_mode == LibraryAppletMode::Background);
} else {
ASSERT(applet_mode == LibraryAppletMode::BackgroundIndirectDisplay);
ASSERT(library_applet_mode == LibraryAppletMode::BackgroundIndirectDisplay);
}
}

View File

@@ -57,7 +57,7 @@ private:
void InitializeForeground();
/// Initializes the inline software keyboard.
void InitializeBackground(LibraryAppletMode applet_mode);
void InitializeBackground(LibraryAppletMode library_applet_mode);
/// Processes the text check sent by the application.
void ProcessTextCheck();

View File

@@ -69,13 +69,12 @@ private:
bool complete{false};
ResultCode status{RESULT_SUCCESS};
WebAppletVersion web_applet_version;
WebExitReason web_exit_reason;
WebArgHeader web_arg_header;
WebAppletVersion web_applet_version{};
WebArgHeader web_arg_header{};
WebArgInputTLVMap web_arg_input_tlv_map;
u64 title_id;
FileSys::ContentRecordType nca_type;
u64 title_id{};
FileSys::ContentRecordType nca_type{};
std::string offline_cache_dir;
std::string offline_document;
FileSys::VirtualFile offline_romfs;

View File

@@ -27,9 +27,10 @@ namespace Service::Audio {
class IAudioRenderer final : public ServiceFramework<IAudioRenderer> {
public:
explicit IAudioRenderer(Core::System& system, AudioCommon::AudioRendererParameter audren_params,
explicit IAudioRenderer(Core::System& system_,
const AudioCommon::AudioRendererParameter& audren_params,
const std::size_t instance_number)
: ServiceFramework{system, "IAudioRenderer"} {
: ServiceFramework{system_, "IAudioRenderer"} {
// clang-format off
static const FunctionInfo functions[] = {
{0, &IAudioRenderer::GetSampleRate, "GetSampleRate"},

View File

@@ -415,9 +415,9 @@ std::optional<std::vector<u8>> Boxcat::GetLaunchParameter(TitleIDVersion title)
if (Settings::values.bcat_boxcat_local) {
LOG_INFO(Service_BCAT, "Boxcat using local data by override, skipping download.");
} else {
Boxcat::Client client{path, title.title_id, title.build_id};
Client launch_client{path, title.title_id, title.build_id};
const auto res = client.DownloadLaunchParam();
const auto res = launch_client.DownloadLaunchParam();
if (res != DownloadResult::Success) {
LOG_ERROR(Service_BCAT, "Boxcat synchronization failed with error '{}'!", res);

View File

@@ -6,9 +6,9 @@
namespace Service::BCAT {
BCAT::BCAT(Core::System& system, std::shared_ptr<Module> module,
FileSystem::FileSystemController& fsc, const char* name)
: Interface(system, std::move(module), fsc, name) {
BCAT::BCAT(Core::System& system_, std::shared_ptr<Module> module_,
FileSystem::FileSystemController& fsc_, const char* name_)
: Interface(system_, std::move(module_), fsc_, name_) {
// clang-format off
static const FunctionInfo functions[] = {
{0, &BCAT::CreateBcatService, "CreateBcatService"},

View File

@@ -14,8 +14,8 @@ namespace Service::BCAT {
class BCAT final : public Module::Interface {
public:
explicit BCAT(Core::System& system, std::shared_ptr<Module> module,
FileSystem::FileSystemController& fsc, const char* name);
explicit BCAT(Core::System& system_, std::shared_ptr<Module> module_,
FileSystem::FileSystemController& fsc_, const char* name_);
~BCAT() override;
};

View File

@@ -174,9 +174,9 @@ private:
};
std::shared_ptr<IDeliveryCacheProgressService> CreateProgressService(SyncType type) {
auto& backend{progress.at(static_cast<std::size_t>(type))};
return std::make_shared<IDeliveryCacheProgressService>(system, backend.GetEvent(),
backend.GetImpl());
auto& progress_backend{GetProgressBackend(type)};
return std::make_shared<IDeliveryCacheProgressService>(system, progress_backend.GetEvent(),
progress_backend.GetImpl());
}
void RequestSyncDeliveryCache(Kernel::HLERequestContext& ctx) {
@@ -184,7 +184,7 @@ private:
backend.Synchronize({system.CurrentProcess()->GetTitleID(),
GetCurrentBuildID(system.GetCurrentProcessBuildID())},
progress.at(static_cast<std::size_t>(SyncType::Normal)));
GetProgressBackend(SyncType::Normal));
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
@@ -201,8 +201,7 @@ private:
backend.SynchronizeDirectory({system.CurrentProcess()->GetTitleID(),
GetCurrentBuildID(system.GetCurrentProcessBuildID())},
name,
progress.at(static_cast<std::size_t>(SyncType::Directory)));
name, GetProgressBackend(SyncType::Directory));
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
@@ -265,9 +264,16 @@ private:
rb.Push(RESULT_SUCCESS);
}
Backend& backend;
ProgressServiceBackend& GetProgressBackend(SyncType type) {
return progress.at(static_cast<size_t>(type));
}
std::array<ProgressServiceBackend, static_cast<std::size_t>(SyncType::Count)> progress;
const ProgressServiceBackend& GetProgressBackend(SyncType type) const {
return progress.at(static_cast<size_t>(type));
}
Backend& backend;
std::array<ProgressServiceBackend, static_cast<size_t>(SyncType::Count)> progress;
};
void Module::Interface::CreateBcatService(Kernel::HLERequestContext& ctx) {

View File

@@ -55,10 +55,15 @@ std::string VfsDirectoryServiceWrapper::GetName() const {
ResultCode VfsDirectoryServiceWrapper::CreateFile(const std::string& path_, u64 size) const {
std::string path(Common::FS::SanitizePath(path_));
auto dir = GetDirectoryRelativeWrapped(backing, Common::FS::GetParentPath(path));
// dir can be nullptr if path contains subdirectories, create those prior to creating the file.
if (dir == nullptr) {
dir = backing->CreateSubdirectory(Common::FS::GetParentPath(path));
return FileSys::ERROR_PATH_NOT_FOUND;
}
const auto entry_type = GetEntryType(path);
if (entry_type.Code() == RESULT_SUCCESS) {
return FileSys::ERROR_PATH_ALREADY_EXISTS;
}
auto file = dir->CreateFile(Common::FS::GetFilename(path));
if (file == nullptr) {
// TODO(DarkLordZach): Find a better error code for this

View File

@@ -337,13 +337,14 @@ public:
const auto file_buffer = ctx.ReadBuffer();
const std::string name = Common::StringFromBuffer(file_buffer);
const u64 mode = rp.Pop<u64>();
const u32 size = rp.Pop<u32>();
const u64 file_mode = rp.Pop<u64>();
const u32 file_size = rp.Pop<u32>();
LOG_DEBUG(Service_FS, "called. file={}, mode=0x{:X}, size=0x{:08X}", name, mode, size);
LOG_DEBUG(Service_FS, "called. file={}, mode=0x{:X}, size=0x{:08X}", name, file_mode,
file_size);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(backend.CreateFile(name, size));
rb.Push(backend.CreateFile(name, file_size));
}
void DeleteFile(Kernel::HLERequestContext& ctx) {
@@ -935,8 +936,8 @@ void FSP_SRV::ReadSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute(
void FSP_SRV::OpenDataStorageByCurrentProcess(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_FS, "called");
auto romfs = fsc.OpenRomFSCurrentProcess();
if (romfs.Failed()) {
auto current_romfs = fsc.OpenRomFSCurrentProcess();
if (current_romfs.Failed()) {
// TODO (bunnei): Find the right error code to use here
LOG_CRITICAL(Service_FS, "no file system interface available!");
IPC::ResponseBuilder rb{ctx, 2};
@@ -944,7 +945,7 @@ void FSP_SRV::OpenDataStorageByCurrentProcess(Kernel::HLERequestContext& ctx) {
return;
}
auto storage = std::make_shared<IStorage>(system, std::move(romfs.Unwrap()));
auto storage = std::make_shared<IStorage>(system, std::move(current_romfs.Unwrap()));
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
@@ -1010,10 +1011,10 @@ void FSP_SRV::OpenDataStorageWithProgramIndex(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_FS, "called, program_index={}", program_index);
auto romfs = fsc.OpenPatchedRomFSWithProgramIndex(
auto patched_romfs = fsc.OpenPatchedRomFSWithProgramIndex(
system.CurrentProcess()->GetTitleID(), program_index, FileSys::ContentRecordType::Program);
if (romfs.Failed()) {
if (patched_romfs.Failed()) {
// TODO: Find the right error code to use here
LOG_ERROR(Service_FS, "could not open storage with program_index={}", program_index);
@@ -1022,7 +1023,7 @@ void FSP_SRV::OpenDataStorageWithProgramIndex(Kernel::HLERequestContext& ctx) {
return;
}
auto storage = std::make_shared<IStorage>(system, std::move(romfs.Unwrap()));
auto storage = std::make_shared<IStorage>(system, std::move(patched_romfs.Unwrap()));
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);

View File

@@ -12,7 +12,7 @@ namespace Service::GRC {
class GRC final : public ServiceFramework<GRC> {
public:
explicit GRC(Core::System& system) : ServiceFramework{system, "grc:c"} {
explicit GRC(Core::System& system_) : ServiceFramework{system_, "grc:c"} {
// clang-format off
static const FunctionInfo functions[] = {
{1, nullptr, "OpenContinuousRecorder"},

View File

@@ -0,0 +1,90 @@
// Copyright 2021 yuzu Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "common/settings.h"
#include "core/core_timing.h"
#include "core/hle/service/hid/controllers/console_sixaxis.h"
namespace Service::HID {
constexpr std::size_t SHARED_MEMORY_OFFSET = 0x3C200;
Controller_ConsoleSixAxis::Controller_ConsoleSixAxis(Core::System& system_)
: ControllerBase{system_} {}
Controller_ConsoleSixAxis::~Controller_ConsoleSixAxis() = default;
void Controller_ConsoleSixAxis::OnInit() {}
void Controller_ConsoleSixAxis::OnRelease() {}
void Controller_ConsoleSixAxis::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8* data,
std::size_t size) {
seven_six_axis.header.timestamp = core_timing.GetCPUTicks();
seven_six_axis.header.total_entry_count = 17;
if (!IsControllerActivated() || !is_transfer_memory_set) {
seven_six_axis.header.entry_count = 0;
seven_six_axis.header.last_entry_index = 0;
return;
}
seven_six_axis.header.entry_count = 16;
const auto& last_entry =
seven_six_axis.sevensixaxis_states[seven_six_axis.header.last_entry_index];
seven_six_axis.header.last_entry_index = (seven_six_axis.header.last_entry_index + 1) % 17;
auto& cur_entry = seven_six_axis.sevensixaxis_states[seven_six_axis.header.last_entry_index];
cur_entry.sampling_number = last_entry.sampling_number + 1;
cur_entry.sampling_number2 = cur_entry.sampling_number;
// Try to read sixaxis sensor states
MotionDevice motion_device{};
const auto& device = motions[0];
if (device) {
std::tie(motion_device.accel, motion_device.gyro, motion_device.rotation,
motion_device.orientation, motion_device.quaternion) = device->GetStatus();
console_six_axis.is_seven_six_axis_sensor_at_rest = motion_device.gyro.Length2() < 0.0001f;
}
cur_entry.accel = motion_device.accel;
// Zero gyro values as they just mess up with the camera
// Note: Probably a correct sensivity setting must be set
cur_entry.gyro = {};
cur_entry.quaternion = {
{
motion_device.quaternion.xyz.y,
motion_device.quaternion.xyz.x,
-motion_device.quaternion.w,
},
-motion_device.quaternion.xyz.z,
};
console_six_axis.sampling_number++;
// TODO(German77): Find the purpose of those values
console_six_axis.verticalization_error = 0.0f;
console_six_axis.gyro_bias = {0.0f, 0.0f, 0.0f};
// Update console six axis shared memory
std::memcpy(data + SHARED_MEMORY_OFFSET, &console_six_axis, sizeof(console_six_axis));
// Update seven six axis transfer memory
std::memcpy(transfer_memory, &seven_six_axis, sizeof(seven_six_axis));
}
void Controller_ConsoleSixAxis::OnLoadInputDevices() {
const auto player = Settings::values.players.GetValue()[0];
std::transform(player.motions.begin() + Settings::NativeMotion::MOTION_HID_BEGIN,
player.motions.begin() + Settings::NativeMotion::MOTION_HID_END, motions.begin(),
Input::CreateDevice<Input::MotionDevice>);
}
void Controller_ConsoleSixAxis::SetTransferMemoryPointer(u8* t_mem) {
is_transfer_memory_set = true;
transfer_memory = t_mem;
}
void Controller_ConsoleSixAxis::ResetTimestamp() {
auto& cur_entry = seven_six_axis.sevensixaxis_states[seven_six_axis.header.last_entry_index];
cur_entry.sampling_number = 0;
cur_entry.sampling_number2 = 0;
}
} // namespace Service::HID

View File

@@ -0,0 +1,80 @@
// Copyright 2021 yuzu Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#pragma once
#include <array>
#include "common/bit_field.h"
#include "common/common_types.h"
#include "common/quaternion.h"
#include "core/frontend/input.h"
#include "core/hle/service/hid/controllers/controller_base.h"
namespace Service::HID {
class Controller_ConsoleSixAxis final : public ControllerBase {
public:
explicit Controller_ConsoleSixAxis(Core::System& system_);
~Controller_ConsoleSixAxis() override;
// Called when the controller is initialized
void OnInit() override;
// When the controller is released
void OnRelease() override;
// When the controller is requesting an update for the shared memory
void OnUpdate(const Core::Timing::CoreTiming& core_timing, u8* data, size_t size) override;
// Called when input devices should be loaded
void OnLoadInputDevices() override;
// Called on InitializeSevenSixAxisSensor
void SetTransferMemoryPointer(u8* t_mem);
// Called on ResetSevenSixAxisSensorTimestamp
void ResetTimestamp();
private:
struct SevenSixAxisState {
INSERT_PADDING_WORDS(4); // unused
s64_le sampling_number{};
s64_le sampling_number2{};
u64 unknown{};
Common::Vec3f accel{};
Common::Vec3f gyro{};
Common::Quaternion<f32> quaternion{};
};
static_assert(sizeof(SevenSixAxisState) == 0x50, "SevenSixAxisState is an invalid size");
struct SevenSixAxisMemory {
CommonHeader header{};
std::array<SevenSixAxisState, 0x21> sevensixaxis_states{};
};
static_assert(sizeof(SevenSixAxisMemory) == 0xA70, "SevenSixAxisMemory is an invalid size");
struct ConsoleSharedMemory {
u64_le sampling_number{};
bool is_seven_six_axis_sensor_at_rest{};
f32 verticalization_error{};
Common::Vec3f gyro_bias{};
};
static_assert(sizeof(ConsoleSharedMemory) == 0x20, "ConsoleSharedMemory is an invalid size");
struct MotionDevice {
Common::Vec3f accel;
Common::Vec3f gyro;
Common::Vec3f rotation;
std::array<Common::Vec3f, 3> orientation;
Common::Quaternion<f32> quaternion;
};
using MotionArray =
std::array<std::unique_ptr<Input::MotionDevice>, Settings::NativeMotion::NUM_MOTIONS_HID>;
MotionArray motions;
u8* transfer_memory = nullptr;
bool is_transfer_memory_set = false;
ConsoleSharedMemory console_six_axis{};
SevenSixAxisMemory seven_six_axis{};
};
} // namespace Service::HID

View File

@@ -14,7 +14,7 @@ constexpr s32 HID_JOYSTICK_MAX = 0x7fff;
[[maybe_unused]] constexpr s32 HID_JOYSTICK_MIN = -0x7fff;
enum class JoystickId : std::size_t { Joystick_Left, Joystick_Right };
Controller_DebugPad::Controller_DebugPad(Core::System& system) : ControllerBase(system) {}
Controller_DebugPad::Controller_DebugPad(Core::System& system_) : ControllerBase{system_} {}
Controller_DebugPad::~Controller_DebugPad() = default;
void Controller_DebugPad::OnInit() {}

View File

@@ -16,7 +16,7 @@
namespace Service::HID {
class Controller_DebugPad final : public ControllerBase {
public:
explicit Controller_DebugPad(Core::System& system);
explicit Controller_DebugPad(Core::System& system_);
~Controller_DebugPad() override;
// Called when the controller is initialized

View File

@@ -15,7 +15,7 @@ constexpr std::size_t SHARED_MEMORY_OFFSET = 0x3BA00;
constexpr f32 angle_threshold = 0.08f;
constexpr f32 pinch_threshold = 100.0f;
Controller_Gesture::Controller_Gesture(Core::System& system) : ControllerBase(system) {}
Controller_Gesture::Controller_Gesture(Core::System& system_) : ControllerBase{system_} {}
Controller_Gesture::~Controller_Gesture() = default;
void Controller_Gesture::OnInit() {
@@ -129,6 +129,10 @@ void Controller_Gesture::OnLoadInputDevices() {
}
std::optional<std::size_t> Controller_Gesture::GetUnusedFingerID() const {
// Dont assign any touch input to a point if disabled
if (!Settings::values.touchscreen.enabled) {
return std::nullopt;
}
std::size_t first_free_id = 0;
while (first_free_id < MAX_POINTS) {
if (!fingers[first_free_id].pressed) {

View File

@@ -14,7 +14,7 @@
namespace Service::HID {
class Controller_Gesture final : public ControllerBase {
public:
explicit Controller_Gesture(Core::System& system);
explicit Controller_Gesture(Core::System& system_);
~Controller_Gesture() override;
// Called when the controller is initialized

View File

@@ -12,7 +12,7 @@ namespace Service::HID {
constexpr std::size_t SHARED_MEMORY_OFFSET = 0x3800;
constexpr u8 KEYS_PER_BYTE = 8;
Controller_Keyboard::Controller_Keyboard(Core::System& system) : ControllerBase(system) {}
Controller_Keyboard::Controller_Keyboard(Core::System& system_) : ControllerBase{system_} {}
Controller_Keyboard::~Controller_Keyboard() = default;
void Controller_Keyboard::OnInit() {}

View File

@@ -16,7 +16,7 @@
namespace Service::HID {
class Controller_Keyboard final : public ControllerBase {
public:
explicit Controller_Keyboard(Core::System& system);
explicit Controller_Keyboard(Core::System& system_);
~Controller_Keyboard() override;
// Called when the controller is initialized

View File

@@ -11,7 +11,7 @@
namespace Service::HID {
constexpr std::size_t SHARED_MEMORY_OFFSET = 0x3400;
Controller_Mouse::Controller_Mouse(Core::System& system) : ControllerBase(system) {}
Controller_Mouse::Controller_Mouse(Core::System& system_) : ControllerBase{system_} {}
Controller_Mouse::~Controller_Mouse() = default;
void Controller_Mouse::OnInit() {}

View File

@@ -15,7 +15,7 @@
namespace Service::HID {
class Controller_Mouse final : public ControllerBase {
public:
explicit Controller_Mouse(Core::System& system);
explicit Controller_Mouse(Core::System& system_);
~Controller_Mouse() override;
// Called when the controller is initialized

View File

@@ -147,7 +147,7 @@ bool Controller_NPad::IsDeviceHandleValid(const DeviceHandle& device_handle) {
device_handle.device_index < DeviceIndex::MaxDeviceIndex;
}
Controller_NPad::Controller_NPad(Core::System& system) : ControllerBase(system) {
Controller_NPad::Controller_NPad(Core::System& system_) : ControllerBase{system_} {
latest_vibration_values.fill({DEFAULT_VIBRATION_VALUE, DEFAULT_VIBRATION_VALUE});
}
@@ -654,8 +654,8 @@ void Controller_NPad::OnMotionUpdate(const Core::Timing::CoreTiming& core_timing
const auto& device = motions[i][e];
if (device) {
std::tie(motion_devices[e].accel, motion_devices[e].gyro,
motion_devices[e].rotation, motion_devices[e].orientation) =
device->GetStatus();
motion_devices[e].rotation, motion_devices[e].orientation,
motion_devices[e].quaternion) = device->GetStatus();
sixaxis_at_rest = sixaxis_at_rest && motion_devices[e].gyro.Length2() < 0.0001f;
}
}

View File

@@ -8,6 +8,7 @@
#include <atomic>
#include "common/bit_field.h"
#include "common/common_types.h"
#include "common/quaternion.h"
#include "common/settings.h"
#include "core/frontend/input.h"
#include "core/hle/kernel/object.h"
@@ -25,7 +26,7 @@ constexpr u32 NPAD_UNKNOWN = 16; // TODO(ogniK): What is this?
class Controller_NPad final : public ControllerBase {
public:
explicit Controller_NPad(Core::System& system);
explicit Controller_NPad(Core::System& system_);
~Controller_NPad() override;
// Called when the controller is initialized
@@ -467,6 +468,7 @@ private:
Common::Vec3f gyro;
Common::Vec3f rotation;
std::array<Common::Vec3f, 3> orientation;
Common::Quaternion<f32> quaternion;
};
struct NfcXcdHandle {

View File

@@ -9,7 +9,7 @@
namespace Service::HID {
Controller_Stubbed::Controller_Stubbed(Core::System& system) : ControllerBase(system) {}
Controller_Stubbed::Controller_Stubbed(Core::System& system_) : ControllerBase{system_} {}
Controller_Stubbed::~Controller_Stubbed() = default;
void Controller_Stubbed::OnInit() {}

View File

@@ -10,7 +10,7 @@
namespace Service::HID {
class Controller_Stubbed final : public ControllerBase {
public:
explicit Controller_Stubbed(Core::System& system);
explicit Controller_Stubbed(Core::System& system_);
~Controller_Stubbed() override;
// Called when the controller is initialized

View File

@@ -15,7 +15,7 @@
namespace Service::HID {
constexpr std::size_t SHARED_MEMORY_OFFSET = 0x400;
Controller_Touchscreen::Controller_Touchscreen(Core::System& system) : ControllerBase(system) {}
Controller_Touchscreen::Controller_Touchscreen(Core::System& system_) : ControllerBase{system_} {}
Controller_Touchscreen::~Controller_Touchscreen() = default;
void Controller_Touchscreen::OnInit() {
@@ -105,6 +105,10 @@ void Controller_Touchscreen::OnLoadInputDevices() {
}
std::optional<std::size_t> Controller_Touchscreen::GetUnusedFingerID() const {
// Dont assign any touch input to a finger if disabled
if (!Settings::values.touchscreen.enabled) {
return std::nullopt;
}
std::size_t first_free_id = 0;
while (first_free_id < MAX_FINGERS) {
if (!fingers[first_free_id].pressed) {

View File

@@ -14,7 +14,7 @@
namespace Service::HID {
class Controller_Touchscreen final : public ControllerBase {
public:
explicit Controller_Touchscreen(Core::System& system);
explicit Controller_Touchscreen(Core::System& system_);
~Controller_Touchscreen() override;
// Called when the controller is initialized

View File

@@ -10,7 +10,7 @@
namespace Service::HID {
constexpr std::size_t SHARED_MEMORY_OFFSET = 0x3C00;
Controller_XPad::Controller_XPad(Core::System& system) : ControllerBase(system) {}
Controller_XPad::Controller_XPad(Core::System& system_) : ControllerBase{system_} {}
Controller_XPad::~Controller_XPad() = default;
void Controller_XPad::OnInit() {}

View File

@@ -13,7 +13,7 @@
namespace Service::HID {
class Controller_XPad final : public ControllerBase {
public:
explicit Controller_XPad(Core::System& system);
explicit Controller_XPad(Core::System& system_);
~Controller_XPad() override;
// Called when the controller is initialized

View File

@@ -26,6 +26,7 @@
#include "core/hle/service/hid/xcd.h"
#include "core/hle/service/service.h"
#include "core/hle/service/hid/controllers/console_sixaxis.h"
#include "core/hle/service/hid/controllers/controller_base.h"
#include "core/hle/service/hid/controllers/debug_pad.h"
#include "core/hle/service/hid/controllers/gesture.h"
@@ -67,7 +68,7 @@ IAppletResource::IAppletResource(Core::System& system_)
MakeController<Controller_Stubbed>(HidController::UniquePad);
MakeController<Controller_NPad>(HidController::NPad);
MakeController<Controller_Gesture>(HidController::Gesture);
MakeController<Controller_Stubbed>(HidController::ConsoleSixAxisSensor);
MakeController<Controller_ConsoleSixAxis>(HidController::ConsoleSixAxisSensor);
// Homebrew doesn't try to activate some controllers, so we activate them by default
GetController<Controller_NPad>(HidController::NPad).ActivateController();
@@ -78,8 +79,6 @@ IAppletResource::IAppletResource(Core::System& system_)
GetController<Controller_Stubbed>(HidController::CaptureButton).SetCommonHeaderOffset(0x5000);
GetController<Controller_Stubbed>(HidController::InputDetector).SetCommonHeaderOffset(0x5200);
GetController<Controller_Stubbed>(HidController::UniquePad).SetCommonHeaderOffset(0x5A00);
GetController<Controller_Stubbed>(HidController::ConsoleSixAxisSensor)
.SetCommonHeaderOffset(0x3C200);
// Register update callbacks
pad_update_event = Core::Timing::CreateEvent(
@@ -1404,8 +1403,9 @@ void Hid::ActivateConsoleSixAxisSensor(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
const auto applet_resource_user_id{rp.Pop<u64>()};
LOG_WARNING(Service_HID, "(STUBBED) called, applet_resource_user_id={}",
applet_resource_user_id);
applet_resource->ActivateController(HidController::ConsoleSixAxisSensor);
LOG_WARNING(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
@@ -1455,8 +1455,9 @@ void Hid::ActivateSevenSixAxisSensor(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
const auto applet_resource_user_id{rp.Pop<u64>()};
LOG_WARNING(Service_HID, "(STUBBED) called, applet_resource_user_id={}",
applet_resource_user_id);
applet_resource->ActivateController(HidController::ConsoleSixAxisSensor);
LOG_WARNING(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
@@ -1518,8 +1519,15 @@ void Hid::InitializeSevenSixAxisSensor(Kernel::HLERequestContext& ctx) {
ASSERT_MSG(t_mem_1->GetSize() == 0x1000, "t_mem_1 has incorrect size");
ASSERT_MSG(t_mem_2->GetSize() == 0x7F000, "t_mem_2 has incorrect size");
// Activate console six axis controller
applet_resource->GetController<Controller_ConsoleSixAxis>(HidController::ConsoleSixAxisSensor)
.ActivateController();
applet_resource->GetController<Controller_ConsoleSixAxis>(HidController::ConsoleSixAxisSensor)
.SetTransferMemoryPointer(t_mem_1->GetPointer());
LOG_WARNING(Service_HID,
"(STUBBED) called, t_mem_1_handle=0x{:08X}, t_mem_2_handle=0x{:08X}, "
"called, t_mem_1_handle=0x{:08X}, t_mem_2_handle=0x{:08X}, "
"applet_resource_user_id={}",
t_mem_1_handle, t_mem_2_handle, applet_resource_user_id);
@@ -1542,8 +1550,10 @@ void Hid::ResetSevenSixAxisSensorTimestamp(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
const auto applet_resource_user_id{rp.Pop<u64>()};
LOG_WARNING(Service_HID, "(STUBBED) called, applet_resource_user_id={}",
applet_resource_user_id);
applet_resource->GetController<Controller_ConsoleSixAxis>(HidController::ConsoleSixAxisSensor)
.ResetTimestamp();
LOG_WARNING(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);

View File

@@ -312,7 +312,6 @@ private:
bool vr_mode_enabled = false;
float current_brightness = 1.0f;
float backlight_brightness = 1.0f;
float ambient_light_value = 0.0f;
float current_vr_brightness = 1.0f;
bool dimming = true;

View File

@@ -14,8 +14,8 @@
namespace Service::Nvidia::Devices {
nvdisp_disp0::nvdisp_disp0(Core::System& system, std::shared_ptr<nvmap> nvmap_dev)
: nvdevice(system), nvmap_dev(std::move(nvmap_dev)) {}
nvdisp_disp0::nvdisp_disp0(Core::System& system_, std::shared_ptr<nvmap> nvmap_dev_)
: nvdevice{system_}, nvmap_dev{std::move(nvmap_dev_)} {}
nvdisp_disp0 ::~nvdisp_disp0() = default;
NvResult nvdisp_disp0::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input,

View File

@@ -17,7 +17,7 @@ class nvmap;
class nvdisp_disp0 final : public nvdevice {
public:
explicit nvdisp_disp0(Core::System& system, std::shared_ptr<nvmap> nvmap_dev);
explicit nvdisp_disp0(Core::System& system_, std::shared_ptr<nvmap> nvmap_dev_);
~nvdisp_disp0() override;
NvResult Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input,

View File

@@ -17,8 +17,8 @@
namespace Service::Nvidia::Devices {
nvhost_as_gpu::nvhost_as_gpu(Core::System& system, std::shared_ptr<nvmap> nvmap_dev)
: nvdevice(system), nvmap_dev(std::move(nvmap_dev)) {}
nvhost_as_gpu::nvhost_as_gpu(Core::System& system_, std::shared_ptr<nvmap> nvmap_dev_)
: nvdevice{system_}, nvmap_dev{std::move(nvmap_dev_)} {}
nvhost_as_gpu::~nvhost_as_gpu() = default;
NvResult nvhost_as_gpu::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input,

View File

@@ -30,7 +30,7 @@ DECLARE_ENUM_FLAG_OPERATORS(AddressSpaceFlags);
class nvhost_as_gpu final : public nvdevice {
public:
explicit nvhost_as_gpu(Core::System& system, std::shared_ptr<nvmap> nvmap_dev);
explicit nvhost_as_gpu(Core::System& system_, std::shared_ptr<nvmap> nvmap_dev_);
~nvhost_as_gpu() override;
NvResult Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input,

View File

@@ -15,9 +15,10 @@
namespace Service::Nvidia::Devices {
nvhost_ctrl::nvhost_ctrl(Core::System& system, EventInterface& events_interface,
SyncpointManager& syncpoint_manager)
: nvdevice(system), events_interface{events_interface}, syncpoint_manager{syncpoint_manager} {}
nvhost_ctrl::nvhost_ctrl(Core::System& system_, EventInterface& events_interface_,
SyncpointManager& syncpoint_manager_)
: nvdevice{system_}, events_interface{events_interface_}, syncpoint_manager{
syncpoint_manager_} {}
nvhost_ctrl::~nvhost_ctrl() = default;
NvResult nvhost_ctrl::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input,

Some files were not shown because too many files have changed in this diff Show More