Commit graph

884 commits

Author SHA1 Message Date
Tobias
eb15711ee6
Backport review comment from citra-emu/citra#4418
Original reason:
As Windows multi-byte character codec is unspecified while we always assume std::string uses UTF-8 in our code base, this can output gibberish when the string contains non-ASCII characters. ::OutputDebugStringW combined with Common::UTF8ToUTF16W is preferred here.
2018-12-07 16:21:18 +01:00
bunnei
24dfb43ac6
Merge pull request #1773 from lioncash/thread
common/thread: Minor cleanup
2018-11-23 08:52:05 -08:00
Lioncash
1bf5a337a5 common/thread: Drop Hungarian notation on SetCurrentThreadName's parameter
This is inconsistent with our coding style.
2018-11-22 00:40:26 -05:00
Zach Hilman
820d81b9a5 scheduler: Add explanations for YieldWith and WithoutLoadBalancing 2018-11-22 00:33:53 -05:00
Lioncash
93f7677402 common/thread: Make Barrier's 'count' member non-const
While admirable as a means to ensure immutability, this has the
unfortunate downside of making the class non-movable. std::move cannot
actually perform a move operation if the provided operand has const data
members (std::move acts as an operation to "slide" resources out of an
object instance). Given Barrier contains move-only types such as
std::mutex, this can lead to confusing error messages if an object ever
contained a Barrier instance and said object was attempted to be moved.
2018-11-21 21:47:08 -05:00
Lioncash
756e773096 common/thread: Initialize class member variables where applicable
Simplifies the constructor interfaces for Barrier and Event classes.
2018-11-21 21:45:01 -05:00
Lioncash
02602afd10 common/thread: Group non-member functions together
Keeps the non-member interface in one spot instead of split into two
places, making it nicer to locate functions.
2018-11-21 21:42:33 -05:00
Lioncash
d6583d68f6 common/thread: Remove SleepCurrentThread()
This is also unused and superceded by standard functionality. The
standard library provides std::this_thread::sleep_for(), which provides
a much more flexible interface, as different time units can be used with
it.
2018-11-21 21:40:11 -05:00
Lioncash
1d555fdd25 common/thread: Remove unused CurrentThreadId()
This is an old function that's no longer necessary. C++11 introduced
proper threading support to the language and a thread ID can be
retrieved via std::this_thread::get_id() if it's ever needed.
2018-11-21 21:37:11 -05:00
Lioncash
8b27e73bd7 common: Remove bit_set.h
This is an analog of BitSet from Dolphin that was introduced to allow
iterating over a set of bits. Given it's currently unused, and given
that std::bitset exists, we can remove this. If it's ever needed in the
future it can be brought back.
2018-11-21 21:30:10 -05:00
bunnei
8cdb48224d
Merge pull request #1758 from lioncash/rect
common/math_util: Minor cleanup
2018-11-21 08:05:39 -08:00
Lioncash
3533d33ff5 common: Remove dependency on xbyak
Xbyak is currently entirely unused. Rather than carting it along, remove
it and get rid of a dependency. If it's ever needed in the future, then
it can be re-added (and likely be more up to date at that point in
time).
2018-11-21 03:43:41 -05:00
Lioncash
45211a7a91 common/math_util: Simplify std::make_signed usages to std::make_signed_t
Gets rid of the need to use typename to access the ::type alias.
2018-11-21 02:08:18 -05:00
Lioncash
f11173f88c common/math_util: Make Rectangle's constructors constexpr
Allows objects that contain rectangle instances to be constexpr
constructible as well.
2018-11-21 02:08:18 -05:00
Lioncash
cc0801745a common/math_util: Remove unnecessary static from PI
const/constexpr variables have internal linkage by default.
2018-11-21 02:08:18 -05:00
Lioncash
74fd0aa2e8 common/math_util: Remove unused IntervalsIntersect() function
This hasn't been used since the project started, so we may as well get
rid of it to keep it from bit rotting.
2018-11-21 02:08:15 -05:00
Lioncash
9dcc229dfe common/assert: Add UNIMPLEMENTED_IF and UNIMPLEMENTED_IF_MSG for conditional assertions
Currently, there's no way to specify if an assertion should
conditionally occur due to unimplemented behavior. This is useful when
something is only partially implemented (e.g. due to ongoing RE work).
In particular, this would be useful within the graphics code.

The rationale behind this is it allows a dev to disable unimplemented
feature assertions (which can occur in an unrelated work area), while
still enabling regular assertions, which act as behavior guards for
conditions or states which must not occur. Previously, the only way a
dev could temporarily disable asserts, was to disable the regular
assertion macros, which has the downside of also disabling, well, the
regular assertions which hold more sanitizing value, as opposed to
unimplemented feature assertions.
2018-11-20 18:15:37 -05:00
Lioncash
aaec85df9e common/assert: Make the UNIMPLEMENTED macro properly assert
Currently, this was only performing a logging call, which doesn't
actually invoke any assertion behavior. This is unlike
UNIMPLEMENTED_MSG, which *does* assert.

This makes the expected behavior uniform across both macros.
2018-11-20 17:59:00 -05:00
Zach Hilman
409dcf0e0a svc: Implement yield types 0 and -1 2018-11-18 23:44:19 -05:00
Zach Hilman
e696ed1f4d am: Deglobalize software keyboard applet 2018-11-18 10:53:47 -05:00
Zach Hilman
c70529c1ec string_util: Implement buffer to UTF-16 string helper function
Needed as most all software keyboard functions use fixed-length UTF16 string buffers.
2018-11-18 10:53:47 -05:00
Weiyi Wang
786995a81e Common/Bitfield: store value as unsigned type
Storing signed type causes the following behaviour: extractValue can do overflow/negative left shift. Now it only relies on two implementation-defined behaviours (which are almost always defined as we want): unsigned->signed conversion and signed right shift
2018-11-16 15:49:57 +01:00
Lioncash
c7387e6504 string_util: Remove ArrayToString()
An old function from Dolphin. This is also unused, and pretty inflexible
when it comes to printing out different data types (for example, one
might not want to print out an array of u8s but a different type
instead. Given we use fmt, there's no need to keep this implementation
of the function around.
2018-11-13 18:14:11 -05:00
Lioncash
f1219e3a87 string_util: Remove TryParse()
This is an unused hold-over from Dolphin that was primarily used to
parse values out of the .ini files. Given we already have libraries that
do this for us, we don't need to keep this around.
2018-11-13 18:13:45 -05:00
Lioncash
9bc18eada8 string_util: Remove ThousandSeparate()
This is currently unused and doesn't really provide much value to keep
around either.
2018-11-13 14:04:26 -05:00
bunnei
e10483a878
Merge pull request #1441 from CarlKenner/DebuggerLog
logging: Add DebuggerBackend for logging to Visual Studio
2018-11-05 00:19:59 -05:00
fearlessTobi
585b6a6a50 compatdb: Use a seperate endpoint for testcase submission 2018-10-28 13:23:02 +01:00
Lioncash
f80b80b922
logging/backend: Add missing services to the log filters
Just a few overlooked services.
2018-10-23 22:35:59 -04:00
Lioncash
1291f3f820 common: Remove memory_util.cpp/.h
Everything from here is completely unused and also written with the
notion of supporting 32-bit architecture variants in mind. Given the
Switch itself is on a 64-bit architecture, we won't be supporting 32-bit
architectures. If we need specific allocation functions in the future,
it's likely more worthwhile to new functions for that purpose.
2018-10-23 12:21:34 -04:00
Weiyi Wang
2ff2732a78 only redefine 64 bit file operation for MSVC
MinGW provides POSIX functions
2018-10-23 15:11:18 +02:00
Zach Hilman
3b8c0f8885 service: Add skeleton for psm service
Seems to be the power controller. Listed in switchbrew under the category PTM services.
2018-10-20 18:01:07 -04:00
Lioncash
541e9624eb common: Add function for checking word alignment to alignment.h
This will be used in a following change to svcArbitrateLock() and
svcArbitrateUnlock()
2018-10-18 12:58:27 -04:00
Lioncash
d27f4a4928 common: Move Is4KBAligned() to alignment.h
Aligning on 4KB pages isn't a Switch-specific thing, so this can be
moved to common so it can be used with other things as well.
2018-10-18 12:57:02 -04:00
Lioncash
183a664405 web_backend: Make Client use the PImpl idiom
Like with TelemetryJson, we can make the implementation details private
and avoid the need to expose httplib to external libraries that need to
use the Client class.
2018-10-10 22:29:35 -04:00
bunnei
6b48ba5271
Merge pull request #1424 from DarkLordZach/ips-witch
ips_layer: Add support for IPSwitch executable patches
2018-10-08 12:30:33 -04:00
bunnei
6f420a40cf
Merge pull request #1453 from FearlessTobi/port-4311
Port citra-emu/citra#4311: "Remove "#" in the version number"
2018-10-06 23:12:58 -04:00
Carl Kenner
f5f6292810 logging: Add DebuggerBackend for logging to Visual Studio 2018-10-07 13:24:04 +10:30
fearlessTobi
8e6311bfd2 Remove "#" in the version number
So that people can stop using it in issue/pr comments and randomly link some other issue/pr unintentionally.
2018-10-06 15:51:37 +02:00
zhupengfei
690f326613 citra_qt/configuration: misc input tab improvements
* Added a context menu on the buttons including Clear & Restore Default

* Allow clearing (unsetting) inputs. Added a Clear All button

* Allow restoring a single input to default (instead of all)
2018-10-06 15:43:49 +02:00
bunnei
b8b90ce6e6
Merge pull request #1332 from FearlessTobi/port-web-backend
Port web_service from Citra
2018-10-06 02:43:09 -04:00
bunnei
fe292573de
Merge pull request #1442 from lioncash/format
text_formatter: Avoid unnecessary string temporary creation in PrintMessage()
2018-10-05 10:48:58 -04:00
Lioncash
6f16826260 text_formatter: Avoid unnecessary string temporary creation in PrintMessage()
operator+ for std::string creates an entirely new string, which is kind
of unnecessary here if we just want to append a null terminator to the
existing one.

Reduces the total amount of potential allocations that need to be done
in the logging path.
2018-10-04 23:55:53 -04:00
Zach Hilman
70bd2bb1d3 ips_layer: Deduplicate resource usage 2018-10-04 11:34:36 -04:00
Zach Hilman
f62227aa95 hex_util: Add HexVectorToString and HexStringToVector
Converts between bytes and strings when the size is not known at compile time.
2018-10-04 11:32:04 -04:00
Weiyi Wang
fdb35760a7 string_util: unify UTF8<->UTF16 conversion to codecvt 2018-10-02 16:10:34 +02:00
Weiyi Wang
bfe84f06f2 string_util: remove TString conversion for windows
First of all they are foundamentally broken. As our convention is that std::string is always UTF-8, these functions assume that the multi-byte character version of TString (std::string) from windows is also in UTF-8, which is almost always wrong. We are not going to build multi-byte character build, and even if we do, this dirty work should be handled by frontend framework early.
2018-10-02 16:10:20 +02:00
Weiyi Wang
a4595bb939 string_util: remove ShiftJIS/CP1252 conversion function
We always use unicode internally. Any dirty work of conversion with other codec should be handled by frontend framework (Qt). Further more, ShiftJIS/CP1252 are not special (they are not code set used by 3ds, or any guest/host dependencies we have), so there is no reason to specifically include them
2018-10-02 16:10:01 +02:00
fearlessTobi
e4daf4bee5 Review comments - part 5 2018-10-02 16:04:10 +02:00
fearlessTobi
b4ace6ec6f Address a bunch of review comments 2018-10-02 15:30:48 +02:00
fearlessTobi
4d139943f2 Port web_service from Citra 2018-10-02 15:30:48 +02:00
bunnei
7b81e1e525
Merge pull request #1365 from DarkLordZach/lfs
file_sys: Add support for LayeredFS mods
2018-09-25 16:59:44 -04:00
David
2513e086ab Stubbed IRS (#1349)
* Stubbed IRS

Currently we have no ideal way of implementing IRS. For the time being we should have the functions stubbed until we come up with a way to emulate IRS properly.

* Added IRS to logging backend

* Forward declared shared memory for irs
2018-09-23 22:33:29 -04:00
Weiyi Wang
e0ce07aa7d common/thread: remove YieldCPU()
simply use the standard library yield()
2018-09-22 23:27:42 +02:00
Zach Hilman
bd8db3f7f8 common_paths: Add Load and Dump dirs 2018-09-21 19:53:05 -04:00
Lioncash
ab6dfa4fa5
ring_buffer: Use std::atomic_size_t in a static assert
Avoids the need to repeat "std::" twice
2018-09-18 23:36:04 -04:00
Lioncash
c51f8563a6
ring_buffer: Use std::hardware_destructive_interference_size to determine alignment size for avoiding false sharing
MSVC 19.11 (A.K.A. VS 15.3)'s C++ standard library implements P0154R1
(http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0154r1.html)
which defines two new constants within the <new> header, std::hardware_destructive_interference_size
and std::hardware_constructive_interference_size.

std::hardware_destructive_interference_size defines the minimum
recommended offset between two concurrently-accessed objects to avoid
performance degradation due to contention introduced by the
implementation (with the lower-bound being at least alignof(max_align_t)).
In other words, the minimum offset between objects necessary to avoid
false-sharing.

std::hardware_constructive_interference_size on the other hand defines
the maximum recommended size of contiguous memory occupied by two
objects accessed wth temporal locality by concurrent threads (also
defined to be at least alignof(max_align_t)). In other words the maximum
size to promote true-sharing.

So we can simply use this facility to determine the ideal alignment
size. Unfortunately, only MSVC supports this right now, so we need to
enclose it within an ifdef for the time being.
2018-09-18 23:35:57 -04:00
fearlessTobi
63c2e32e20 Port #4182 from Citra: "Prefix all size_t with std::" 2018-09-15 15:21:06 +02:00
MerryMage
112351d557 common: Implement a ring buffer 2018-09-08 18:56:38 +01:00
CaptV0rt3x
e3af341d5b Better Title Bar Display 2018-09-07 11:54:51 +05:30
Lioncash
6ef84f1c4c common/logging: Amend documentation comments
Multi-line doc comments still need the '<' after the ///, otherwise it's
treated as a regular comment and makes the original doc comment broken
in viewers, IDEs, etc. While we're at it, also fix some typos in the
comments.
2018-09-04 10:49:08 -04:00
Lioncash
2949d9552c common/logging/filter: Replace C-style case with C++ static_cast 2018-09-04 10:44:36 -04:00
Lioncash
978f3a3282 common/logging/filter: Make constructor explicit
Implicit conversions aren't desirable here.
2018-09-04 10:43:31 -04:00
bunnei
2562fe4a16
Merge pull request #1170 from lioncash/ret
file_util: Correct return value in early exit of ReadFileToString()
2018-08-27 18:18:31 -04:00
Lioncash
c74b7ee204 file_util: Correct return value in early exit of ReadFileToString()
While still essentially being zero, we should be returning a numeric
value here, not a boolean typed value.
2018-08-24 02:20:02 -04:00
Zach Hilman
06487c2c8d hex_util: Replace logic_errors with LOG_CRITICAL
Makes it so malformed hex strings do not crash the entire program.
2018-08-23 14:44:51 -04:00
Lioncash
5a53d75313 logging/text_formatter: Use empty braces for initializing CONSOLE_SCREEN_BUFFER_INFO instance
The previous form of initializing done here is a C-ism, an empty set of
braces is sufficient for initializing (and doesn't potentially cause
missing brace warnings, given the first member of the struct is a COORD
struct).
2018-08-21 11:31:05 -04:00
Lioncash
36090521ce bit_field: Convert ToBool() into explicit operator bool
Gets rid of a TODO that is long overdue.
2018-08-21 06:39:45 -04:00
bunnei
b1d238bbb8
Merge pull request #1064 from lioncash/telemetry
common/telemetry: Migrate core-independent info gathering to common
2018-08-20 19:43:17 -04:00
Lioncash
b39cd70cd4 common: Namespace hex_util.h/.cpp
It's in the common code, so it should be under the Common namespace like
everything else.
2018-08-15 23:24:00 -04:00
bunnei
c594ec3417
Merge pull request #1005 from DarkLordZach/registered-fmt
file_sys: Add support for registration format
2018-08-15 23:11:58 -04:00
bunnei
f009ed63f3
Merge pull request #1063 from lioncash/inline
common/xbyak_abi: Mark defined functions in header as inline
2018-08-14 22:40:23 -04:00
bunnei
ad7815a28d
Merge pull request #1054 from zhaowenlan1779/misc-fixup
common/misc: use windows.h
2018-08-14 21:47:28 -04:00
Lioncash
60f476cd8f common/telemetry: Migrate core-independent info gathering to common
Previously core itself was the library containing the code to gather
common information (build info, CPU info, and OS info), however all of
this isn't core-dependent and can be moved to the common code and use
the common interfaces. We can then just call those functions from the
core instead.

This will allow replacing our CPU detection with Xbyak's which has
better detection facilities than ours. It also keeps more
architecture-dependent code in common instead of core.
2018-08-14 18:57:46 -04:00
Lioncash
6d549abb4e common/xbyak_abi: Mark defined functions in header as inline
Avoids potential One Definition Rule violations when these are used in
the future.
2018-08-14 18:29:56 -04:00
Lioncash
0ce0905380 common/xbyak: Use nested namespace specifiers where applicable 2018-08-14 18:27:27 -04:00
Lioncash
11895d54af common: Remove unused old breakpoint source files
These currently aren't used and contain commented out source code that
corresponds to Dolphin's JIT. Given our CPU code is organized quite
differently, we shouldn't be keeping this around (at the moment it just
adds to compile times marginally).
2018-08-14 18:14:01 -04:00
Lioncash
bc7bfd96f0 logging/backend: Use const reference to refer to log filter
The filter is returned via const reference, so this was making a
pointless copy of the entire filter every time a message was being
pushed into the logger instance.
2018-08-13 21:44:55 -04:00
Zhu PengFei
59d18ef55b
common/misc: use windows.h
linux-mingw does not really like this.
2018-08-14 04:28:24 +08:00
Lioncash
11470f331a thread_queue_list: Make contains() and get_first() const member functions
These don't directly modify the contained data.
2018-08-12 12:54:14 -04:00
Lioncash
55c73e10a7 thread_queue_list: Convert typedef to a type alias 2018-08-12 12:47:11 -04:00
Zach Hilman
167bfddafa file_sys: Comply to style guidelines 2018-08-11 22:50:48 -04:00
Zach Hilman
b70a831608 file_util: Add getter for NAND registration directory 2018-08-11 22:50:08 -04:00
Zach Hilman
10aac376d1 common: Move hex string processing to separate file 2018-08-11 22:50:08 -04:00
bunnei
a91bb7080d
Merge pull request #989 from lioncash/log
common/logging: Add missing service log categories
2018-08-09 19:30:14 -04:00
bunnei
96ef22d3d0
Merge pull request #897 from DarkLordZach/vfs-accuracy-2
vfs: Add VfsFilesystem and fix RealVfs* implementations
2018-08-09 19:22:06 -04:00
bunnei
5c908c0373
Merge pull request #988 from lioncash/color
common/color: Minor cleanup
2018-08-09 00:37:32 -04:00
Zach Hilman
2b6128fe0b file_util: Use enum instead of bool for specifing path behavior 2018-08-08 21:18:45 -04:00
Zach Hilman
3f82dad1e4 file_util: Add platform-specific slash option to SanitizePath 2018-08-08 21:18:45 -04:00
Lioncash
6e90f0bf6a common/logging: Add missing service log categories
These weren't added when the services were introduced.
2018-08-08 16:46:28 -04:00
Lioncash
5a9c00ea04 common/color: Remove unnecessary const qualifiers on return types
These are just superfluous and not necessesary
2018-08-08 16:17:41 -04:00
Lioncash
76197a4be9 common/color: Get rid of undefined behavior
Gets rid of type punning via reinterpret_cast within functions. Instead,
we use memcpy to transfer the contents across types.
2018-08-08 16:14:37 -04:00
Lioncash
cc9d7bbf01 vector_math: Use variable template version of is_signed in Vec classes
Same behavior, less code
2018-08-08 15:53:42 -04:00
bunnei
d224eb7c39
Merge pull request #966 from lioncash/modernize
common: Convert type traits templates over to variable template versions where applicable
2018-08-08 15:28:34 -04:00
bunnei
507e6ae100
Merge pull request #968 from lioncash/vec
vector_math: Minor cleanups
2018-08-08 12:00:13 -04:00
Lioncash
766c1a2d50 vector_math: Remove unimplemented function prototypes 2018-08-07 21:33:48 -04:00
Lioncash
5c323d96e0 vector_math: Make functions constexpr where applicable 2018-08-07 21:32:05 -04:00
Lioncash
4e3bc37791 vector_math: Convert typedefs to type aliases 2018-08-07 21:15:10 -04:00
Lioncash
a7d6efc520 common: Convert type traits templates over to variable template versions where applicable
Uses the C++17 inline variable variants
2018-08-07 19:34:47 -04:00
Lioncash
0735a0c8a1 file_util: Avoid sign-conversions in WriteArray() and ReadArray()
Prevents compiler warnings.
2018-08-07 13:51:37 -04:00
Lioncash
45bc449ff9 service: Add usb services
Adds basic skeleton for the usb services based off the information provided by Switch Brew.
2018-08-07 03:14:03 -04:00