Instead of using an unsigned int as a parameter and expecting a user to
always pass in the correct values, we can just convert the enum into an
enum class and use that type as the parameter type instead, which makes
the interface more type safe.
We also get rid of the bookkeeping "NUM_" element in the enum by just
using an unordered map. This function is generally low-frequency in
terms of calls (and I'd hope so, considering otherwise would mean we're
slamming the disk with IO all the time) so I'd consider this acceptable
in this case.
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.
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
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.
* Add ZeroMQ external submodule
* ZeroMQ libzmq building on macOS
* Added RPC namespace, settings and logging
* Added request queue handling and new classes
* Add C++ interface to ZeroMQ
* Added start of ZeroMQ RPC Server implementation.
* Request construction and callback request handling
* Read and write memory implementation
* Add ID to request format and send reply
* Add RPC setting to macOS UI
* Fixed initialization order bug and added exception handling
* Working read-write through Python
* Update CMakeLists for libzmq to resolve target name conflict on Windows
* Platform-specific CMake definitions for Windows/non-Windows
* Add comments
* Revert "Add RPC setting to macOS UI"
* Always run RPC server instead of configurable
* Add Python scripting example. Updated .gitignore
* Rename member variables to remove trailing underscore
* Finally got libzmq external project building on macOS
* Add missing dependency during libzmq build
* Adding more missing dependencies [skip ci]
* Only build what is required from libzmq
* Extra length checks on client input
* Call InvalidateCacheRange after memory write
* Revert MinGW change. Fix clang-format. Improve error handling in request/reply. Allow any length of data read/write in Python.
* Re-organized RPC static global state into a proper class. [skip ci]
* Make sure libzmq always builds in Release mode
* Renamed Request to Packet since Request and Reply are the same thing
* Moved request fulfillment out of Packet and into RPCServer
* Change request thread from sleep to condition variable
* Remove non-blocking polling from ZMQ server code. Receive now blocks and terminates properly without sleeping. This change significantly improves script speed.
* Move scripting files to dist/ instead of src/
* C++ code review changes for jroweboy [skip ci]
* Python code review changes for jroweboy [skip ci]
* Add docstrings and tests to citra.py [skip ci]
* Add host OS check for libzmq build
* Revert "Add host OS check for libzmq build"
* Fixed a hang when emulation is stopped and restarted due to improper destruction order of ZMQ objects [skip ci]
* Add scripting directory to archive packaging [skip ci]
* Specify C/CXX compiler variables on MinGW build
* Only specify compiler on Linux mingw
* Use gcc and g++ on Windows mingw
* Specify generator for mingw
* Don't specify toolchain on windows mingw
* Changed citra.py to support Python 3 instead of Python 2
* Fix bug where RPC wouldn't restart after Stop/Start emulation
* Added copyright to headers and reorganized includes and forward declarations
* 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)
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).
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.
* Change authentication system to JWT
* Address review comments
* Get rid of global variable, fix some documentations, fix a bug when verificating
* Refactor PostJson to avoid code duplication
* Rename jwt_token, add functionality to request a new JWT when getting a 401
* Take bools by value instead of const reference
* Send request again when JWT is invalid and use forward declarations
* Omit brackets
The minimum clang/GCC versions we support already support this. We can also
remove is_standard_layout(), as fread and fwrite only require the type to be
trivially copyable.
These functions include reloading udp client, testing communication and configuring calibration. I also added a function to common/thread.h to use WaitFor.
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
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.
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.
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.
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
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.
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.
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).
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.
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.
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.