Commit graph

5811 commits

Author SHA1 Message Date
EverOddish
fce7afb8dc Added CMake option to enable/disable scripting support 2018-09-23 19:16:18 -04:00
Weiyi Wang
9668852c0d Service/AM: handle encrypted CIA 2018-09-23 13:05:55 -04:00
Weiyi Wang
df77491938 FileSys/cia: add ticket parsing 2018-09-23 13:05:55 -04:00
Weiyi Wang
b70e2bce58 HW/AES: add common key loading and selecting 2018-09-23 13:00:07 -04:00
Pengfei Zhu
6b538a49ac
Merge pull request #4246 from FearlessTobi/port-1346
Port yuzu-emu/yuzu#1346: "svc_wrap: Convert the PARAM macro into a function"
2018-09-23 13:10:11 +08:00
Weiyi Wang
20e42592ff
Merge pull request #4249 from FearlessTobi/port-760
Port yuzu-emu/yuzu#760: "file_util: Use an enum class for GetUserPath()"
2018-09-22 23:42:59 -04:00
Weiyi Wang
e087cb9a28 string_util: unify UTF8<->UTF16 conversion to codecvt 2018-09-22 17:23:48 -04:00
James Rowe
ded7e1f7c3
Merge pull request #4245 from wwylele/thread-cleanup
Common/Thread cleanup
2018-09-22 14:27:06 -06:00
Weiyi Wang
5b66c41686
Merge pull request #4251 from FearlessTobi/port-1309
Port yuzu-emu/yuzu#1309: "service: Use nested namespace specifiers where applicable"
2018-09-22 16:15:48 -04:00
James Rowe
3f4a7f8f58 Input: Remove global variables from SDL Input
Changes the interface as well to remove any unique methods that
frontends needed to call such as StartJoystickEventHandler by
conditionally starting the polling thread only if the frontend hasn't
started it already. Additionally, moves all global state into a single
SDLState class in order to guarantee that the destructors are called in
the proper order
2018-09-22 14:13:50 -06:00
Weiyi Wang
1123580738 archive_ncch: add open source country list archive 2018-09-22 16:11:57 -04:00
James Rowe
bfcc712132 Input: Copy current SDL.h/cpp files to impl
This should make reviewing much easier as you can then see what changed
happened between the old file and the new one
2018-09-22 14:11:15 -06:00
Lioncash
d2cd4a464d svc_wrap: Convert the PARAM macro into a function
This can just be a regular function, getting rid of the need to also
explicitly undef the define at the end of the file. Given FuncReturn()
was already converted into a function, it's #undef can also be removed.
2018-09-22 21:20:22 +02:00
Lioncash
b3221c3180 file_util: Use an enum class for GetUserPath()
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.
2018-09-22 21:18:56 +02:00
Weiyi Wang
e1765e7c5c 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-09-22 13:03:59 -04:00
Weiyi Wang
7db46da4fc
Merge pull request #4247 from FearlessTobi/port-1314
Port yuzu-emu/yuzu#1314: "audio_core/time_stretch: Silence truncation warnings in Process()"
2018-09-22 12:02:51 -04:00
Lioncash
46da908a00 service: Use nested namespace specifiers where applicable
There were a few places where nested namespace specifiers weren't being
used where they could be within the service code. This amends that to
make the namespacing a tiny bit more compact.
2018-09-22 16:14:10 +02:00
Lioncash
bcb1aaf05c cubeb_sink: Get rid of variable shadowing within CubebSink's constructor
The parameter of the lambda was shadowing the variable that was being
assigned to.
2018-09-22 12:55:40 +02:00
Lioncash
553bdb2ae4 audio_core/time_stretch: Silence truncation warnings in Process()
The SoundTouch API only accepts uint amount of samples.
2018-09-22 12:52:13 +02:00
Weiyi Wang
16b22128bf 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-09-22 00:45:50 -04:00
Weiyi Wang
1855fb3d88 common/thread: remove YieldCPU()
simply use the standard library yield()
2018-09-22 00:32:19 -04:00
Weiyi Wang
1e9d60cab6 common/thread: remove unnecessary macro for thread_local
we have bumped compiler version really high that all of them support this
2018-09-22 00:30:56 -04:00
Weiyi Wang
41d53cee1f nwm/uds_data: specify endianness for enum 2018-09-22 00:28:44 -04:00
Weiyi Wang
e0336403ee nwm/uds_connection: specify endiannes for enum 2018-09-22 00:28:44 -04:00
Weiyi Wang
16b36b6025 service/cro: specify endianness for enum 2018-09-22 00:28:44 -04:00
Weiyi Wang
18e94897c4 hle/swkbd: specify endianness for enum and other members 2018-09-22 00:28:44 -04:00
Weiyi Wang
39feb0610b filesys/archive_selfncch: specify endiannes for enum 2018-09-22 00:28:44 -04:00
Weiyi Wang
9564b4b292 filesys/archive_ncch: specify endianness for enum
NCCHArchivePath::media_type is unchanged because its underlying type is unclear
2018-09-22 00:28:44 -04:00
Weiyi Wang
2badaf43b0 common/swap: add swap template for enum 2018-09-22 00:28:44 -04:00
Lioncash
03908116ae game_list: Handle plurals within setFilterResult() better
Qt provides an overload of tr() that operates on quantities in relation
to pluralization. This also allows the translation to adapt based on the
target language rules better.

For example, the previous code would result in an incorrect translation
for the French language (which doesn't use the pluralized version of
"result" in the case of a total of zero. While in English it's
correct to use the pluralized version of "result", that is, "results"

---

For example:

English: "0 results"

French: "0 résultat" (uses the singular form)

In French, the noun being counted is singular if the quantity is 0 or 1.
In English, on the other hand, if the noun being counted has a quantity
of 0 or N > 1, then the noun is pluralized.

---

For another example in a language that has different counting methods
than the above, consider English and Irish. Irish has a special form of
of a grammatical number called a dual. Which alters how a word is
written when N of something is 2. This won't appear in this case with a
direct number "2", but it would change if we ever used "Two" to refer to
two of something. For example:

English: "Zero results"

Irish: "Toradh ar bith"

English: "One result"

Irish: "Toradh amháin"

English: "Two results"

Irish: "Dhá thorthaí" <- Dual case

Which is an important distinction to make between singular and plural,
because in other situations, "two" on its own would be written as "dó"
in Irish. There's also a few other cases where the order the words are
placed *and* whether or not the plural or singular variant of the word
is used *and* whether or not the word is placed after or between a set
of numbers can vary. Counting in Irish also differs depending on whether or not
you're counting things (like above) or counting people, in which case an
entirely different set of numbers are used.

It's not important for this case, but it's provided as an example as to why one
should never assume the placement of values in text will be like that of
English or other languages. Some languages have very different ways to
represent counting, and breaking up the translated string like this
isn't advisable because it makes it extremely difficult to get right
depending on what language a translator is translating text into due to
the ambiguity of the strings being presented for translation.

In this case a translator would see three fragmented strings on
Transifex (and not necessarily grouped beside one another, but even
then, it would still be annoying to decipher):

- "of"
- "result"
- "results"

There is no way a translator is going to know what those sets of words
are actually used for unless they look at the code to see what is being
done with them (which they shouldn't have to do).
2018-09-21 17:45:14 -05:00
Lioncash
333b6a556a gl_stream_buffer: Fix use of bitwise OR instead of logical OR in Map()
This was very likely intended to be a logical OR based off the
conditioning and testing of inversion in one case.

Even if this was intentional, this is the kind of non-obvious thing one
should be clarifying with a comment.
2018-09-21 17:20:42 -05:00
Weiyi Wang
d1a576eb14
Merge pull request #4113 from namkazt/soc_recv_from
fix soc service - RecvFrom - SendTo
2018-09-21 12:33:23 -04:00
Weiyi Wang
e9ed1c98da
Merge pull request #4114 from namkazt/soc_recv_from_other
Implement soc - RecvFromOther
2018-09-21 12:33:12 -04:00
Weiyi Wang
59982c5479
Merge pull request #4221 from FearlessTobi/port-1238
Port #1238 from yuzu: "common/logging: Minor changes"
2018-09-21 12:32:53 -04:00
fearlessTobi
3ee9f669c1 Address review comments 2018-09-21 16:39:10 +02:00
Lioncash
1cf3ef15b9 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-21 16:26:21 +02:00
Merry
bb9e92c77c
Merge pull request #4194 from MerryMage/audiofifo
audio_core: Simplify sink interface
2018-09-21 13:30:51 +01:00
zhupengfei
31dc9003c5
citra_qt/configuration: Add Play Coins setting 2018-09-20 22:42:39 +08:00
James Rowe
687e3e74ca
Merge pull request #3959 from zhaowenlan1779/semi-reset
service/apt: Implement soft reset & CloseApplication
2018-09-19 21:02:59 -06:00
MerryMage
c9c7097769 ring_buffer: Fix Push 2018-09-19 07:14:36 +01:00
Weiyi Wang
697bc1a9c7 loader, cfg: choose region based on language if multiple regions available 2018-09-18 10:26:31 -04:00
Lioncash
5ddd382a9b kernel/svc: Do nothing if svcOutputDebugString's length is <= 0
While likely very uncommon, this sanitizes the input and does nothing in
the event of the length being equal to or less than zero, avoiding
constructing a std::string when there's no need to. It also avoids an
out-of-memory scenario, as a negative value would wrap around to its
equivalent unsigned representation in std::string's constructor.

e.g. If someone was silly and a length of -1 was specified, this would
make a string with a length of 0xFFFFFFFFFFFFFFFF on a 64-bit platform,
which will obviously eventually fail due to the allocation being way too
large.
2018-09-17 19:52:53 -04:00
Weiyi Wang
f3d59556ef web_backend: protect jwt cache with a mutex 2018-09-17 14:28:58 -04:00
Pengfei Zhu
dc863724ac
Merge pull request #4231 from CaptV0rt3x/port-1336
Port #1336 from yuzu
2018-09-17 22:37:40 +08:00
Pengfei Zhu
9a1446886c
Merge pull request #4223 from FearlessTobi/port-1301
Port #1301 from yuzu: "game_list: Resolve variable shadowing within LoadCompatibilityList()"
2018-09-17 22:25:04 +08:00
CaptV0rt3x
48fafaba3e Antialias game list compatibility pixmaps 2018-09-17 19:00:28 +05:30
Lioncash
ca3d9d659e kernel/thread: Include thread-related enums within the kernel namespace
Previously, these were sitting outside of the Kernel namespace, which
doesn't really make sense, given they're related to the Thread class
which is within the Kernel namespace.
2018-09-15 17:16:20 +02:00
Lioncash
5dfa7b74b5 thread: Convert ThreadStatus into an enum class
Makes the thread status strongly typed, so implicit conversions can't
happen. It also makes it easier to catch mistakes at compile time.
2018-09-15 17:02:44 +02:00
Lioncash
d864d9bf03 game_list: Resolve variable shadowing within LoadCompatibilityList()
"value" is already a used variable name within the outermost ranged-for
loop, so this variable was shadowing the outer one. This isn't a bug,
but it will get rid of a -Wshadow warning.
2018-09-15 15:54:20 +02:00
Lioncash
52f12e303a game_list: Use QJsonValueRef() within LoadCompatibilityList()
This way, we aren't constructing unnecessary QJsonValue instances.
2018-09-15 15:53:36 +02:00
Lioncash
93bd630d40 audio_core/sink_details: Change std::string parameter into std::string_view
The given string is only ever used for lookup and comparison, so we can
just utilize a non-owning view to string data here
2018-09-15 15:48:24 +02:00
Lioncash
83c32b8d22 common/logging/filter: Replace C-style case with C++ static_cast 2018-09-15 15:43:00 +02:00
Lioncash
787fff9a64 common/logging/filter: Make constructor explicit
Implicit conversions aren't desirable here.
2018-09-15 15:41:51 +02:00
zhupengfei
9bd8edb3b6
citra_qt: add Camera tab to "System" category 2018-09-15 14:19:45 +08:00
Weiyi Wang
6767f4562b
Merge pull request #4187 from spycrab/qt_config_sidebar
Qt/Configure: Use sidebar to divide tabs into smaller groups
2018-09-14 16:45:45 -04:00
zhupengfei
458f8d103b
service/ptm: Add Get/SetPlayCoins functions 2018-09-14 22:28:38 +08:00
Weiyi Wang
77c1f647cb web_service: stop using std::future + callback style async 2018-09-13 16:14:34 -04:00
Valentin Vanelslande
dce26367a2
ipc: fix typo 2018-09-13 11:51:08 -05:00
Weiyi Wang
0a4d338ffa
Merge pull request #4138 from FearlessTobi/change-web-links
web_service: Unify links for web service endpoints
2018-09-12 16:31:59 -04:00
fearlessTobi
b82bf1ccdb Change variable name to web_api_url 2018-09-12 19:07:06 +02:00
Valentin Vanelslande
093987eaa7
Fix #4203 2018-09-11 22:45:12 -05:00
EverOddish
04dd91be82 Initial support for scripting (#4016)
* 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
2018-09-11 22:00:12 +02:00
NarcolepticK
0d15b99bfc service/cecd: Corrected cecd:s function table 2018-09-11 14:39:48 -04:00
spycrab
d63a63cff0 Qt/Configure: Use sidebar to divide tabs into smaller groups 2018-09-11 16:02:39 +02:00
B3n30
0238cf52b7 SDLJoystick: Addressed review comments 2018-09-11 14:50:41 +02:00
NarcolepticK
105bcc95c0 service/cecd: Add hmac handling 2018-09-10 19:53:23 -04:00
NarcolepticK
192a0f3b92 service/cecd: Update handling of /outbox/boxinfo and /outbox/obindex 2018-09-10 04:21:24 -04:00
Weiyi Wang
9df1461cec
Merge pull request #4192 from valentinvanelslande/thread
svc: change unknown to thread in CreateThread
2018-09-09 18:41:51 -04:00
MerryMage
a6cf2e1f9d cubeb_sink: Improve logging 2018-09-09 08:37:34 +01:00
MerryMage
675ffc1024 dsp_interface: Move volume control to audio thread
We also clamp the linear volume value to [0.0, 1.0].
Do nothing if linear volume is 1.0.
2018-09-08 22:24:51 +01:00
MerryMage
eed55a813e time_stretch: Simplify audio stretcher 2018-09-08 22:09:26 +01:00
MerryMage
f34711219a audio_core: Simplify sink interface 2018-09-08 22:09:26 +01:00
MerryMage
761ef78408 common: Implement a ring buffer 2018-09-08 22:09:26 +01:00
Ben
17978cf758
Joystick hotplug support (#4141)
* use SDL_PollEvent instead of SDL_JoystickUpdate

Register hot plugged controller by GUID if they were configured in a previous session

* Move SDL_PollEvent into its own thread

* Don't store SDLJoystick pointer in Input Device; Get pointer on each GetStatus call

* Fix that joystick_list gets cleared after SDL_Quit

* Add VirtualJoystick for InputDevices thats never nullptr

* fixup! Add VirtualJoystick for InputDevices thats never nullptr

* fixup! fixup! Add VirtualJoystick for InputDevices thats never nullptr

* Remove SDL_GameController, make SDL_Joystick* unique_ptr

* fixup! Remove SDL_GameController, make SDL_Joystick* unique_ptr

* Adressed feedback; fixed handling of same guid reconnects

* fixup! Adressed feedback; fixed handling of same guid reconnects

* merge the two joystick_lists into one

* make SDLJoystick a member of VirtualJoystick

* fixup! make SDLJoystick a member of VirtualJoystick

* fixup! make SDLJoystick a member of VirtualJoystick

* fixup! fixup! make SDLJoystick a member of VirtualJoystick
2018-09-08 19:01:30 +02:00
Valentin Vanelslande
5c4da2d218
svc: change unknown to thread in CreateThread 2018-09-08 07:40:24 -05:00
tgsm
5d142e2114 citra: fix SDL logging 2018-09-08 02:51:33 -04:00
zhupengfei
a3625b544f
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-09-08 11:26:10 +08:00
NarcolepticK
648cecf1aa service/cecd: Utilize CryptoPP::Base64Encoder for message id 2018-09-07 23:09:14 -04:00
zhupengfei
ad6b140cb0
service/apt: Implement soft reset & CloseApplication 2018-09-08 11:05:23 +08:00
Pengfei Zhu
0d2c027a9d
Merge pull request #4191 from valentinvanelslande/minor-fix
room_member: RakNet -> ENet
2018-09-08 10:05:33 +08:00
Valentin Vanelslande
c29c66000e
room_member: RakNet -> ENet 2018-09-07 20:17:24 -05:00
Valentin Vanelslande
fc876e727a
room_member: fix 3 typos 2018-09-07 20:12:52 -05:00
NarcolepticK
ff1beca74a service/cecd: Fixed enum item naming style 2018-09-07 19:36:33 -04:00
Weiyi Wang
7d8f115185 Prefix all size_t with std::
done automatically by executing regex replace `([^:0-9a-zA-Z_])size_t([^0-9a-zA-Z_])` -> `$1std::size_t$2`
2018-09-06 16:03:28 -04:00
Merry
eca98eeb3e
Merge pull request #4143 from zhaowenlan1779/shared-font-text-fix
core, citra_qt: unify status of system archives and shared fonts
2018-09-06 20:51:32 +01:00
NarcolepticK
69b3217394 service/cecd: Addressed comments, code cleanup 2018-09-06 15:50:27 -04:00
NarcolepticK
c89759f597 service/cecd: Corrected eventlog.dat creation 2018-09-06 15:50:27 -04:00
NarcolepticK
c185c35bc2 service/cecd: Clang format fixup 2018-09-06 15:50:27 -04:00
NarcolepticK
dd7234a6d0 service/cecd: Migrate Common::StringFromFormat(...) to fmt::format(...) 2018-09-06 15:50:27 -04:00
NarcolepticK
25e7209d5c service/cecd: Updated function names 2018-09-06 15:50:27 -04:00
NarcolepticK
7a8477d106 service/cecd: Implement mboxlist handling 2018-09-06 15:50:27 -04:00
NarcolepticK
0e8398b51c service/cecd: Update header checks and increased debug logging 2018-09-06 15:50:27 -04:00
NarcolepticK
71204e525f service/cecd: Corrected behaviour, started checking and updating file headers 2018-09-06 15:50:27 -04:00
NarcolepticK
d88ad61da4 service/cecd: Output icon to MBoxData.001 and title to MBoxData.010 2018-09-06 15:50:27 -04:00
NarcolepticK
010fbd8614 service/cecd: Update default values for in/out box info header 2018-09-06 15:50:27 -04:00
NarcolepticK
d99585aa53 service/cecd: Add MBox directory check to OpenAndRead and OpenAndWrite and added a CreateAndPopulateMBoxDirectory function 2018-09-06 15:50:27 -04:00
NarcolepticK
30bbea3f4e service/cecd: Add initial files to archive after it is formatted 2018-09-06 15:50:27 -04:00
NarcolepticK
e27c1bd1f5 service/cecd: Addressed comment about PopEnum 2018-09-06 15:50:27 -04:00
NarcolepticK
413f1651b7 service/cecd: Implement basic file handling functions. 2018-09-06 15:50:26 -04:00
NarcolepticK
2ee395d7de service/cecd: Implement functions 2018-09-06 15:50:26 -04:00