Commit graph

723 commits

Author SHA1 Message Date
Lioncash
0495ba5d91 file_util: Avoid sign-conversions in WriteArray() and ReadArray()
Prevents compiler warnings.
2018-08-08 15:45:31 +08:00
James Rowe
c35a251d86
Merge pull request #3985 from BreadFish64/fix-warnings
core: clean up warnings
2018-08-02 11:14:57 -06:00
James Rowe
14b0435df2
Merge pull request #3994 from FearlessTobi/replace-clamp-functions
Remove MathUtil::Clamp and replace it with its std:: counterpart
2018-08-02 11:08:07 -06:00
James Rowe
c771dd9813
Merge pull request #4021 from FearlessTobi/port-709
Port #709 from yuzu: "common/misc: Deduplicate code in GetLastErrorMsg()
2018-08-02 11:00:53 -06:00
BreadFish64
aa4b71d0ce update fmt to latest stable release
5.1.0
fixes a multitude of errors on MSVC
2018-08-01 14:10:24 -05:00
Merry
ba6eee71f5
Merge pull request #4024 from zhaowenlan1779/port-yuzu-745
Port yuzu-emu/yuzu#745 from yuzu
2018-08-01 15:02:40 +01:00
Lioncash
b92af5a858
param_package: Take std::string by value in string-based Set() function
Allows avoiding string copies by letting the strings be moved into the
function calls.
2018-08-01 17:21:11 +08:00
Merry
9af731793a
Merge pull request #4025 from zhaowenlan1779/port-yuzu-775
Port "string_util: Minor changes" from yuzu
2018-07-30 18:28:38 +01:00
Merry
ec76cd82b0
Merge pull request #4037 from zhaowenlan1779/port-yuzu-710
Port "common/common_funcs: Remove unused rotation functions" from yuzu
2018-07-30 18:28:11 +01:00
James Rowe
ecb3dc2fb8
Merge pull request #4038 from zhaowenlan1779/port-yuzu-711
Port "common/swap: Minor changes" from yuzu
2018-07-30 10:21:49 -06:00
James Rowe
8fd9f22657
Merge pull request #4030 from zhaowenlan1779/port-yuzu-743
Port "logging: Use std::string_view where applicable" from yuzu
2018-07-30 10:19:28 -06:00
Lioncash
1a0529a064 common/swap: Remove unnecessary const on return value of swap() 2018-07-30 21:30:15 +08:00
Lioncash
a2203e1566 common/swap: Use static_cast where applicable 2018-07-30 21:30:14 +08:00
Lioncash
5a66820c20 common/swap: Use using aliases where applicable 2018-07-30 21:30:13 +08:00
fearlessTobi
b0c35c54ca Fix travis MinGW build 2018-07-30 14:50:23 +02:00
Lioncash
b539745153 common/common_funcs: Remove unused rotation functions
These are unused and essentially don't provide much benefit either. If
we ever need rotation functions, these can be introduced in a way that
they don't sit in a common_* header and require a bunch of ifdefing to
simply be available
2018-07-30 20:08:59 +08:00
Ben
d5333c37de
Merge pull request #4033 from zhaowenlan1779/port-yuzu-764
Port "file_util: Minor changes to ScanDirectoryTree() and ForeachDirectoryEntry()" from yuzu
2018-07-30 13:51:21 +02:00
Merry
4acc4d87d6
Merge pull request #4032 from zhaowenlan1779/port-yuzu-758
Port "common: Remove synchronized_wrapper.h" from yuzu
2018-07-30 12:36:45 +01:00
Merry
c4c158c6b6
Merge pull request #4036 from zhaowenlan1779/port-yuzu-705
Port "file_util: return string by const reference for GetExeDirectory()" from yuzu
2018-07-30 12:10:35 +01:00
Lioncash
995d1cd785 string_util: Get rid of separate resize() in CPToUTF16(), UTF16ToUTF8(), CodeToUTF8() and UTF8ToUTF16()
There's no need to perform the resize separately here, since the
constructor allows presizing the buffer.

Also move the empty string check before the construction of the string
to make the early out more straightforward.
2018-07-30 18:18:15 +08:00
Lioncash
f34dde32d1 string_util: Use emplace_back() in SplitString() instead of push_back()
This is equivalent to doing:

push_back(std::string(""));

which is likely not to cause issues, assuming a decent std::string
implementation with small-string optimizations implemented in its
design, however it's still a little unnecessary to copy that buffer
regardless. Instead, we can use emplace_back() to directly construct the
empty string within the std::vector instance, eliminating any possible
overhead from the copy.
2018-07-30 18:18:14 +08:00
Lioncash
841bb4e5bd string_util: Remove unnecessary std::string instance in TabsToSpaces()
We can just use the variant of std::string's replace() function that can
replace an occurrence with N copies of the same character, eliminating
the need to allocate a std::string containing a buffer of spaces.
2018-07-30 18:18:12 +08:00
Lioncash
99b2a871a7 file_util: return string by const reference for GetExeDirectory()
This disallows modifying the internal string buffer (which shouldn't be
modified anyhow).
2018-07-30 16:55:55 +08:00
Weiyi Wang
77f4859059
Merge pull request #4026 from zhaowenlan1779/port-yuzu-765
Port "file_util: Remove goto usages from Copy()" from yuzu
2018-07-30 11:44:32 +03:00
Lioncash
df5069f8c0 file_util: Use a u64 to represent number of entries
This avoids a truncating cast on size. I doubt we'd ever traverse a
directory this large, however we also shouldn't truncate sizes away.
2018-07-30 16:19:03 +08:00
Lioncash
cc6cb45536 file_util: std::move FST entries in ScanDirectoryTree()
Avoids unnecessary copies when building up the FST entries.
2018-07-30 16:16:58 +08:00
Lioncash
1eb3d0c634 common: Remove synchronized_wrapper.h
This is entirely unused in the codebase.
2018-07-30 15:12:04 +08:00
Lioncash
1affca05c7 logging/filter: Use std::string_view in ParseFilterString()
Allows avoiding constructing std::string instances, since this only
reads an arbitrary sequence of characters.

We can also make ParseFilterRule() internal, since it doesn't depend on
any private instance state of Filter
2018-07-30 14:56:53 +08:00
Lioncash
798ebda049 logging/backend: Add missing standard includes
A few inclusions were being satisfied indirectly. To prevent breakages
in the future, include these directly.
2018-07-30 14:56:52 +08:00
Lioncash
765c7e711a logging/backend: Use std::string_view in RemoveBackend() and GetBackend()
These can just use a view to a string since its only comparing against
two names in both cases for matches. This avoids constructing
std::string instances where they aren't necessary.
2018-07-30 14:56:51 +08:00
Lioncash
8068f506c5 string_util: Remove AsciiToHex()
Easy TODO
2018-07-30 09:06:14 +08:00
Lioncash
d3a52e45e3 file_util: Remove goto usages from Copy()
We can just leverage std::unique_ptr to automatically close these for us
in error cases instead of jumping to the end of the function to call
fclose on them.
2018-07-30 08:48:58 +08:00
Lioncash
5b691d3fe0 param_package: Use std::unordered_map's insert_or_assign instead of map indexing
This avoids a redundant std::string construction if a key doesn't exist
in the map already.

e.g.

data[key] requires constructing a new default instance of the value in
the map (but this is wasteful, since we're already setting something
into the map over top of it).
2018-07-30 08:22:42 +08:00
Lioncash
290bfa1804 param_package: Get rid of file-static std::string construction
Avoids potential dynamic allocation occuring during program launch
2018-07-30 08:22:41 +08:00
Lioncash
3ad1ee65ad Port #709 from yuzu: "common/misc: Deduplicate code in GetLastErrorMsg()" 2018-07-29 16:28:58 +02:00
James Rowe
d79cb6373d
Merge pull request #3972 from zhaowenlan1779/common-timer
common/timer: use std::chrono, avoid platform-dependent code
2018-07-25 10:00:04 -06:00
zhupengfei
cc1f44f7bd
common/string_utils: replace boost::transform with std counterpart
Note: according to cppreference it is necessary to convert char to unsigned char when using std::tolower and std::toupper, otherwise the behaviour would be undefined.
2018-07-25 08:04:00 +08:00
fearlessTobi
7a3e126a4f Replace MathUtil::Clamp with its std counterpart 2018-07-24 19:08:17 +02:00
Weiyi Wang
87872aa369
Merge pull request #3976 from MerryMage/rm-code_block
common: CodeBlock is unused
2018-07-23 09:21:37 +03:00
MerryMage
eae523ae17 common: CodeBlock is unused 2018-07-22 21:04:29 +01:00
Weiyi Wang
29ddbe4e7b
Merge pull request #3973 from B3n30/MPSCQueue
remove polymorphism issue
2018-07-22 22:22:22 +03:00
zhupengfei
872e505cc6
common/timer: use std::chrono, avoid platform-dependent code
* core/timer: use even more std::chrono

* common/timer: convert GetLocalTimeSinceJan1970
2018-07-22 15:40:07 +08:00
B3n30
8480899d8b remove polymorphism issue 2018-07-21 16:16:21 +02:00
Lioncash
0a8563fb79 telemetry: Remove unnecessary Field constructor
We can just take the value parameter by value which allows both moving
into it, and copies at the same time, depending on the calling code.
2018-07-18 16:18:34 -04:00
Lioncash
3244042c4c telemetry: Make operator== and operator!= const member functions of Field
These operators don't modify internal class state, so they can be made
const member functions. While we're at it, drop the unnecessary inline
keywords. Member functions that are defined in the class declaration are
already inline by default.
2018-07-18 16:17:40 -04:00
Lioncash
faa62b0d1e telemetry: Default copy/move constructors and assignment operators
This provides the equivalent behavior, but without as much boilerplate.
While we're at it, explicitly default the move constructor, since we
have a move-assignment operator defined.
2018-07-18 16:15:58 -04:00
zhupengfei
18664c719e
frontend/applets: misc fixes
* Renamed applet to applets

* Added log classes Applet and Applet.SWKBD

* Fixes to get it compile
2018-06-30 08:01:49 +08:00
wwylele
0eab948728 reformat all files with clang-format 2018-06-29 16:56:12 +03:00
wwylele
7c5a76e58b log: replace all NGLOG with LOG 2018-06-29 14:18:07 +03:00
wwylele
fde415968e log: remove deprecated log macros 2018-06-29 14:02:29 +03:00
NarcolepticK
f831a08224 logging: Added NGLOG_GENERIC (needed for vm_manager) 2018-06-22 18:48:25 -04:00
zhupengfei
ddc97b15f4 common: Parse Nightly/Canary build version 2018-06-20 09:30:26 +08:00
Weiyi Wang
09982c3386
Merge pull request #3732 from ccawley2011/fix-arm
Fix compilation on ARM
2018-05-26 20:14:55 +03:00
James
29551c187a Add missing std::string import in text_formatter 2018-05-19 21:31:09 +10:00
Cameron Cawley
101d8964f1 common: Fix compilation on ARM 2018-05-13 11:34:45 +01:00
Daniel Lim Wee Soong
51398e0301 Logging: Add customizable logging backends and fmtlib based macros
* Change the logging backend to support multiple sinks through the
Backend Interface
* Add a new set of logging macros to use fmtlib instead.
* Qt: Compile as GUI application on windows to make the console hidden by
default. Add filter configuration and a button to open log location.
* SDL: Migrate to the new logging macros
2018-04-23 21:32:56 -06:00
wwylele
39fce60145 [quick-fix]file-util: fmtlib errors on FILE* type parameter. Explicitly cast it to void* 2018-04-06 13:35:37 +03:00
Weiyi Wang
a9544ca015
Merge pull request #3580 from daniellimws/common-fmt
common: Migrate logging macros
2018-04-06 12:38:08 +03:00
James Rowe
501717e9db Update fmtlib to fix msvc warnings
Additionally, when updating fmtlib, there was a change in fmtlib broke
how the old logging macro was overloaded, so this works around that by
just naming the fmtlib macro impl something different
2018-04-05 22:33:12 -06:00
Weiyi Wang
acb02d300c
Merge pull request #3518 from wwylele/hashable-struct
Common/Hash: abstract HashableStruct from GLShader::PicaShaderConfig
2018-04-05 14:39:12 +03:00
Merry
fff7227f86
Merge pull request #3579 from ccawley2011/architecture-defines
common: Clean up architecture-specific defines
2018-03-31 10:41:15 +01:00
Daniel Lim Wee Soong
0f4c9c9f47 file_util: Remove long long casting on buf.st_size in NGLOG statement 2018-03-27 23:31:08 +08:00
Daniel Lim Wee Soong
968569aa61 Replace format specifiers for all usages of ASSERT_MSG 2018-03-27 23:28:42 +08:00
Daniel Lim Wee Soong
59b8a1dbc2 assert: Undo removal of newline for string with __VA_ARGS__ 2018-03-27 10:01:10 +08:00
Daniel Lim Wee Soong
111da6db06 common: Migrate logging macros
Follow-up of #3533

Replace logging to use NGLOG instead of LOG

This is significantly larger than the previous ones.
2018-03-25 18:42:50 +08:00
James
9283053701 Move WebServices to use LibreSSL + cpp-httplib (#3501)
Move WebServices to use LibreSSL + cpp-httplib

Remove curl + openssl build dependencies
2018-03-24 13:19:35 -06:00
Merry
174e7e268a
Merge pull request #3533 from daniellimws/fmtlib-macros
Logging: Add fmtlib-based macros
2018-03-24 08:04:20 +00:00
Daniel Lim Wee Soong
11ce0f91ab Remove dependency chrono
Was included last time due to adding Entry into log.h

Now it is no longer needed but I forgot to remove it last time
2018-03-22 21:42:02 +08:00
Cameron Cawley
2520ad57a5 common: Use ARCHITECTURE_x86_64 instead of ARCHITECTURE_X64 2018-03-21 22:19:59 +00:00
Cameron Cawley
1afcaed1ff common: Use ARCHITECTURE_ARM instead of _M_ARM 2018-03-21 22:17:42 +00:00
Daniel Lim Wee Soong
4adbf29b0c Fix clang-format
Oops forgot to check...
2018-03-22 00:45:01 +08:00
Daniel Lim Wee Soong
e6ee1020e1 Replace ##__VA_ARGS__ with __VA_ARGS__ 2018-03-22 00:40:01 +08:00
Daniel Lim Wee Soong
c892cea029 Place FmtLogMessage's definition in backend.cpp
I decided to overload LogMessage because I don't see a reason to come up with a new function name just for this, but if you guys want me to overload FmtLogMessage instead I'm fine with that.
2018-03-21 23:36:45 +08:00
Daniel Lim Wee Soong
ceeb2810fe Add nullptr check to LogEntry
Also remove explicit comparison with nullptr to make code shorter.
2018-03-20 14:15:48 +08:00
Daniel Lim Wee Soong
2b4998a122 Add check if filter is not a nullptr
Fix segfault and pass tests
2018-03-17 22:55:57 +08:00
Cameron Cawley
8d1cab4892 CMake: Set EMU_ARCH_BITS in CMakeLists.txt 2018-03-16 13:29:36 +00:00
Daniel Lim Wee Soong
c4f98c1a2e Logging: Fix clang-format 2018-03-16 21:18:45 +08:00
Daniel Lim Wee Soong
b5532babab Merge remote-tracking branch 'citra/master' into fmtlib-macros 2018-03-16 20:50:52 +08:00
Daniel Lim Wee Soong
98e669cf00 Remove all edits not in the scope of this PR 2018-03-16 12:17:14 +08:00
Daniel Lim Wee Soong
373efd3158 Logging: Remove customizable logging backends
Separate code for customizing logging backends from this branch
2018-03-16 11:56:40 +08:00
Daniel Lim Wee Soong
eee388588e Logging: Fix fmt errors after rebasing with master
fmt was updated during the clang-format update, which breaks the previous implementation of FmtLogMessage

Changes were:
* Move definition of FmtLogMessage into log.h to use variadic templates as FMT_VARIADIC was removed

To supplement the change above:
* Move Entry and CreateEntry into log.h
* Add LogEntry in backend.cpp
2018-03-16 11:48:33 +08:00
James Rowe
ab4ba71f3e fixup! Prevent crashes on closing by waiting for the impl thread 2018-03-16 11:18:06 +08:00
James Rowe
87bc5266ef Logging: Various logging improvements
* Uses PopWait to reduce the amount of busy waiting if there aren't many
new logs
* Opens the log file as shared on windows, letting other programs read
the logs, but not write to them while citra is running
* Flushes the logs to disk if a log >= error arrives
2018-03-16 11:18:06 +08:00
James Rowe
9fdc89a456 SPSCQueue: Add PopWait
Adds a condition var to SPSCQueue so when a new log is pushed it will
wake the consumer thread that is calling PopWait. This only applies to
to queues with NeedSize=true
2018-03-16 11:18:06 +08:00
James Rowe
47f0185bcd fixup! move message 2018-03-16 11:18:06 +08:00
James Rowe
7b78425d6b Address review comments 2018-03-16 11:18:06 +08:00
James Rowe
0daac3020e Logging: Add customizable logging backends and fmtlib based macros
* Change the logging backend to support multiple sinks through the
Backend Interface
* Add a new set of logging macros to use fmtlib instead.
* Qt: Compile as GUI application on windows to make the console hidden by
default. Add filter configuration and a button to open log location.
* SDL: Migrate to the new logging macros
2018-03-16 11:18:06 +08:00
wwylele
9c785814e7 Common/Hash: static_assert on the type passed to HashableStruct 2018-03-15 02:27:21 +02:00
wwylele
30cc8c10cd
Common/Hash: abstract HashableStruct from GLShader::PicaShaderConfig 2018-03-14 00:12:40 +02:00
James Rowe
f61141e86a Update the entire application to use the new clang format style 2018-03-09 10:54:43 -07:00
wwylele
e004e9505e assert: do not crash on unimplemented code in debug build 2018-03-05 14:53:19 +02:00
Weiyi Wang
4befbddc34
Merge pull request #3281 from jroweboy/texcache-pt2
Texture Cache Rework
2018-03-05 11:57:25 +02:00
hubslave
13a6e091b7 Common: fix swap functions on Bitrig and OpenBSD
swap{16,32,64} are defined as macros on the two, but client code
tries to invoke them as Common::swap{16,32,64}, which naturally
doesn't work. This hack redefines the macros as inline functions
in the Common namespace: the bodies of the functions are the
same as the original macros, but relying on OS-specific
implementation details like this is of course brittle.
2018-02-22 23:29:43 +02:00
Weiyi Wang
3c03da12c8
Merge pull request #3069 from B3n30/announce_room_webservice
Announce room webservice
2018-02-08 18:46:10 +02:00
James Rowe
44d07574b1
Merge pull request #2882 from danzel/movie-squash
Movie (Game Inputs) recording and playback
2018-01-23 01:03:37 -07:00
Tobias
4247826358
Minor spelling fix 2018-01-21 14:08:13 +01:00
Yuri Kunde Schlesner
3a001c41bb Common: Use common swap.h macros in CityHash 2018-01-15 13:43:38 -08:00
Yuri Kunde Schlesner
3e456cd3fe Common: Fix 2 implicit conversion warnings in CityHash 2018-01-15 13:43:37 -08:00
Yuri Kunde Schlesner
712e6ee960 Common: Remove CityHash32 and CityHashCrc128 variants
In 64-bit systems, CityHash64 is always strictly better than CityHash32.
CityHashCrc128 requires SSE 4.2.
2018-01-15 13:43:37 -08:00
Yuri Kunde Schlesner
f081388afe Common: Adapt CityHash code to match our codebase better
- Use #pragma once instead of guards
- Move header typedefs to implementation file
- Enclose in Common namespace
2018-01-15 13:43:37 -08:00