Commit graph

6680 commits

Author SHA1 Message Date
Weiyi Wang 99136ec592 gl_rasterizer: correct supress_mipmap_for_cube logic
The previous version would break when the state changes from (cube=true,mipmap=false) -> (cube=true,mipmap=true)
2019-07-06 08:03:01 -04:00
fearlessTobi b3e819582e Fix compilation problems 2019-07-04 15:47:04 +02:00
Lioncash e88a9ace8d yuzu/CMakeLists: Disable implicit QString->QUrl conversions
Enforces the use of the proper URL resolution functions. e.g.

url = some_local_path_string;

should actually be:

url = QUrl::fromLocalPath(some_local_path_string);

etc.

This makes it harder to cause bugs when operating with both strings and
URLs at the same time.
2019-07-04 15:39:00 +02:00
Lioncash 3d2e6165d3 yuzu/CMakeLists: Disable unsafe overloads of QProcess' start() function
Other overloads of start() are considerably much safer to use if we ever
need this in the future and need to pass arguments to the program, given
it contains separate parameters for the program path and the arguments
themselves, whereas this unsafe overload contains both as a single
string.

Given the alternatives are much safer, we can disable this.
2019-07-04 15:39:00 +02:00
Lioncash 587b68ed17 yuzu/CMakeLists: Disable implicit type narrowing in connect() calls
Prevents hard-to-diagnose bugs from potentially occurring and requires
any type narrowing to be explicitly performed by our code.
2019-07-04 15:39:00 +02:00
Weiyi Wang cae913d3d5
Merge pull request #4760 from wwylele/csnd
Foundation for CSND
2019-06-30 23:24:27 -04:00
Léo Lam 70fe0d22de ncch_container: Fix code.bin replacement
Currently, having a replacement code.bin causes Citra to crash as it is
trying to load icon data from code.bin because of a typo. This commit
fixes that typo.
2019-06-30 11:48:28 +02:00
Weiyi Wang 0b4be6e53a
Merge pull request #4803 from FearlessTobi/port-2580
Port yuzu-emu/yuzu#2580: "kernel/vm_manager: Remove redundant Reset call in destructor "
2019-06-29 22:52:36 -04:00
bamsbamx 79b837afa7 kernel: Rename memory page table set function 2019-06-27 16:33:55 +02:00
bamsbamx ed095f3bff kernel: Nullability check for current_cpu when changing memory page table
This attempts to fix segfault in some tests where page table is set before initializing cpu core (intended behaviour? might be worth a check...)
see: src/tests/core/arm/arm_test_common.cpp
see: src/tests/core/arm/dyncom/arm_dyncom_vfp_tests.cpp
2019-06-26 11:51:42 +02:00
Weiyi Wang c81a96b0da
Merge pull request #4806 from FearlessTobi/port-2450
Port yuzu-emu/yuzu#2450: "CMakeLists: Explicitly specify -Wall for the non-MSVC case"
2019-06-25 21:25:37 -04:00
bamsbamx dbfd830695 kernel: Let the kernel handle all page table changes when switching processes
It will both change the page table in memory and notify the CPU about the change by itself. This way there is no need to call memory.SetCurrentPageTable() when kernel.setCurrentProcess() and the management is kept internally in the kernel
2019-06-26 00:39:11 +02:00
Pengfei Zhu 41f1963b9a
Merge pull request #4805 from FearlessTobi/port-2454
Port yuzu-emu/yuzu#2454 and yuzu-emu/yuzu#2460: Add build flags
2019-06-25 22:12:02 +08:00
Lioncash d4eb63999a CMakeLists: Explicitly specify -Wall for the non-MSVC case
Ensures that -Wall is always active as a compilation flag.
2019-06-24 17:51:15 +02:00
Lioncash 8e79188ca5 CMakeLists: Specify /volatile:iso for MSVC
By default, MSVC doesn't use standards-compliant volatile semantics.
This makes it behave in a standards-compliant manner, making
expectations more uniform across compilers.
2019-06-24 17:48:45 +02:00
Lioncash e860a0ae59 src/CMakeLists: Add /Zc:externConstexpr to the MSVC build flags
The C++ standard allows constexpr variables declared with the extern
keyword to have external linkage. Previously MSVC wasn't abiding by
this. This just makes the compiler more standards compliant during
builds.

Given we currently don't make use of anything that would break by this,
this is safe to enable.
2019-06-24 17:47:59 +02:00
Lioncash 7f053d0d45 src/CMakeLists: Vertically order compilation flags
Makes it much nicer to visually scan the options. This also starts the
flag descriptions from the same column for the same reason.
2019-06-24 17:46:54 +02:00
Lioncash 1f2e75ecea kernel/vm_manager: Remove redundant Reset call in destructor
This is performing more work than would otherwise be necessary during
VMManager's destruction. All we actually want to occur in this scenario
is for any allocated memory to be freed, which will happen automatically
as the VMManager instance goes out of scope.

Anything else being done is simply unnecessary work.
2019-06-24 17:21:13 +02:00
Weiyi Wang d483e556e3 gsp: remove unused GetFramebufferInfo 2019-06-23 14:25:28 -04:00
Weiyi Wang 8251de44cf GSP_GPU: move used_thread_ids into the class 2019-06-23 14:22:38 -04:00
bamsbamx ac9755306c cpu_core: Separate cpu_core and memory
This makes cpu_core and memory being completely independent components inside the system, having a simpler and more understandable initialization process
The thread which casues page table changes in memory will be responsible to notify the cpu_core too
2019-06-22 18:21:50 +02:00
Weiyi Wang bb776e25a9 pica: move global shader buffer state into Pica::State (#4796) 2019-06-20 00:39:08 +02:00
Tobias a11bc03d4a
Port yuzu-emu/yuzu#2253: "Migrate off directly modifying CMAKE_* compilation-related flags directly" (#4714)
* CMakeLists: Move compilation flags into the src directory

We generally shouldn't be hijacking CMAKE_CXX_FLAGS, etc as a means to
append flags to the targets, since this adds the compilation flags to
everything, including our externals, which can result in weird issues
and makes the build hierarchy fragile.

Instead, we want to just apply these compilation flags to our targets,
and let those managing external libraries to properly specify their
compilation flags.

This also results in us not getting as many warnings, as we don't raise
the warning level on every external target.

* CMakeLists: Move off of modifying CMAKE_*-related flags

Modifying CMAKE_* related flags directly applies those changes to every
single CMake target. This includes even the targets we have in the
externals directory.

So, if we ever increased our warning levels, or enabled particular ones,
or enabled any other compilation setting, then this would apply to
externals as well, which is often not desirable.

This makes our compilation flag setup less error prone by only applying
our settings to our targets and leaving the externals alone entirely.

This also means we don't end up clobbering any provided flags on the
command line either, allowing users to specifically use the flags they
want.
2019-06-18 12:12:32 +02:00
Pengfei Zhu 73bf92fb3a
Merge pull request #4792 from FearlessTobi/port-2515
Port yuzu-emu/yuzu#2515: "yuzu/configuration/configure_graphics: Eliminate type narrowing in a connect call"
2019-06-10 22:03:32 +08:00
Lioncash aa1b9a18c6 core/telemetry_session: Remove unnecessary web service nulling out in destructor
This will automatically occur when the backend instance goes out of
scope at the end of the destructor's execution.
2019-06-09 16:47:09 +02:00
Lioncash 0a82b00e35 core/telemetry_session: Remove usages of the global system accessor
Makes the dependency explicit in the TelemetrySession's interface
instead of making it a hidden dependency.

This also revealed a hidden issue with the way the telemetry session was
being initialized. It was attempting to retrieve the app loader and log
out title-specific information. However, this isn't always guaranteed to
be possible.

During the initialization phase, everything is being constructed. It
doesn't mean an actual title has been selected. This is what the Load()
function is for. This potentially results in dead code paths involving
the app loader. Instead, we explicitly add this information when we know
the app loader instance is available.
2019-06-09 16:34:46 +02:00
Lioncash 55ec0f5850 core/telemetry_session: Explicitly delete copy and move constructors
NonCopyable is misleading here. It also makes the class non-moveable as
well, so we can be explicit about this.
2019-06-09 16:26:15 +02:00
Lioncash 1eef771a10 yuzu/configuration/configure_graphics: Eliminate type narrowing in a connect call
A checkbox is able to be tri-state, giving it three possible activity
types, so in the connect call here, it would actually be truncating an
int into a bool.

Instead, we can just listen on the toggled() signal, which passes along
a bool, not an int.
2019-06-09 16:22:43 +02:00
Tobias 318095f9b9
Port yuzu-emu/yuzu#2249: "ipc_helpers: Allow pushing and popping floating-point values" (#4702)
Certain values that are passed through the IPC buffer are actually
floating point values, not solely integral values.
2019-06-09 16:03:22 +02:00
bunnei 56fc61a41f
Merge pull request #4783 from FearlessTobi/port-2517
Port yuzu-emu/yuzu#2517: "configure_hotkeys: Minor cleanup"
2019-06-08 00:12:34 -04:00
bunnei 23770848b4
Merge pull request #4789 from BreadFish64/opt_can_sub_rect
video_core: change "left + width" to "right" in CanSubRect
2019-06-08 00:12:08 -04:00
Tobias ef73de9386
Port yuzu-emu/yuzu#2511: "common/file_util: Minor cleanup" (#4782)
* common/file_util: Make IOFile's WriteString take a std::string_view

We don't need to force the usage of a std::string here, and can instead
use a std::string_view, which allows writing out other forms of strings
(e.g. C-style strings) without any unnecessary heap allocations.

* common/file_util: Remove unnecessary c_str() calls

The file stream open functions have supported std::string overloads
since C++11, so we don't need to use c_str() here. Same behavior, less
code.

* common/file_util: Make ReadFileToString and WriteStringToFile consistent

Makes the parameter ordering consistent, and also makes the filename
parameter a std::string. A std::string would be constructed anyways with
the previous code, as IOFile's only constructor with a filepath is one
taking a std::string.

We can also make WriteStringToFile's string parameter utilize a
std::string_view for the string, making use of our previous changes to
IOFile.

* common/file_util: Remove duplicated documentation comments

These are already present within the header, so they don't need to be
repeated in the cpp file.

* common/file_util: Make GetCurrentDir() return a std::optional

nullptr was being returned in the error case, which, at a glance may
seem perfectly OK... until you realize that std::string has the
invariant that it may not be constructed from a null pointer. This
means that if this error case was ever hit, then the application would
most likely crash from a thrown exception in std::string's constructor.

Instead, we can change the function to return an optional value,
indicating if a failure occurred.

* common/file_util: Remove unnecessary return at end of void StripTailDirSlashes()

While we're at it, also invert the conditional into a guard clause.
2019-06-08 00:23:57 +02:00
BreadFish64 aaf496dec7 video_core: change "left + width" to "right" in CanSubRect
the constructed rectangle from GetSubRect already has the right info
2019-06-04 17:03:31 -05:00
Lioncash 9fc3e4576b configure_hotkeys: Remove unnecessary Settings::Apply() call
Nothing from the hotkeys dialog relies on this call occurring, and is
already called from the dialog that calls applyConfiguration().
2019-06-01 23:12:59 +02:00
Lioncash 0a65f68b4a configure_hotkeys: Tidy up key sequence conflict error string
Avoids mentioning the user and formalizes the error itself.
2019-06-01 23:12:59 +02:00
Lioncash 640543f8e4 configure_hotkeys: Change critical error dialog into a warning dialog
critical() is intended for critical/fatal errors that threaten the
overall stability of an application. A user entering a conflicting key
sequence is neither of those.
2019-06-01 23:12:59 +02:00
Lioncash 79439fc556 input_common/sdl/sdl_impl: Silence sign conversion warnings
Makes the conversions explicit, as opposed to implicit.
2019-06-01 02:10:46 +02:00
Lioncash a1b26db389 common/math_util: Provide a template deduction guide for Common::Rectangle
Allows for things such as:

auto rect = Common::Rectangle{0, 0, 0, 0};

as opposed to being required to explicitly write out the underlying
type, such as:

auto rect = Common::Rectangle<int>{0, 0, 0, 0};

The only requirement for the deduction is that all constructor arguments
be the same type.
2019-06-01 02:10:36 +02:00
Lioncash 4b5cbcae21 sequence_dialog: Reorganize the constructor
The previous code was all "smushed" together wasn't really grouped
together that well.

This spaces things out and separates them by relation to one another,
making it easier to visually parse the individual sections of code that
make up the constructor.
2019-05-29 23:49:47 +02:00
Lioncash ec837cd16c sequence_dialog: Remove unnecessary horizontal specifier
QDialogButtonBoxes are horizontal by default.
2019-05-29 23:49:37 +02:00
Martin Pecánek 186ffc235f Check input profile name for duplicates in New/Rename (#4779)
* Check input profile name for duplicates in New/Rename

* DRY + separation of concerns

* simplify return branching

* make readonly function const
2019-05-24 15:28:59 -06:00
Aner Torre 4b0ce1b770 video_core: Fix fragment_shader compilation failure due to different type variable multiplication 2019-05-19 14:45:41 +02:00
Weiyi Wang 6848592044
Merge pull request #4744 from FearlessTobi/port-2376
Port yuzu-emu/yuzu#2376: "yuzu/configure_hotkey: Minor changes"
2019-05-18 08:33:37 -04:00
Lioncash 563e1622ca configure_dialog: Remove the Whats This? button from the dialog 2019-05-10 20:33:40 +02:00
Lioncash eeb8dca7b9 yuzu/hotkeys: Remove unnecessary constructor
The behavior of the Hotkey constructor is already accomplished via in-class member
initializers, so the constructor is superfluous here.
2019-05-10 20:30:50 +02:00
Lioncash 95b413a458 yuzu/compatdb: Remove unnecessary qualifiers
Keeps the code consistent in regards to how the buttons are referred to.
2019-05-10 20:30:32 +02:00
Lioncash c9cc378312 configure_hotkeys: Pass the dialog as a parent to SequenceDialog()
Without passing in a parent, this can result in focus being stolen from
the dialog in certain cases.

Example:

On Windows, if the logging window is left open, the logging Window will
potentially get focus over the hotkey dialog itself, since it brings all
open windows for the application into view. By specifying a parent, we
only bring windows for the parent into view (of which there are none,
aside from the hotkey dialog).
2019-05-07 16:31:43 +02:00
Lioncash 562e0114eb configure_hotkeys: Avoid dialog memory leak within Configure()
Without a parent, this dialog won't have its memory freed when it
happens to get destroyed.
2019-05-07 16:31:43 +02:00
Lioncash d7d1be509b configure_hotkeys: Mark member variables as const where applicable in Configure() 2019-05-07 16:31:43 +02:00
Lioncash 47176e19be configure_hotkeys: Make comparison check a little more self-documenting
This is checking if an index is valid or not and returning early if it
isn't.
2019-05-07 16:31:43 +02:00
Lioncash c33c27d646 configure_dialog: Amend constructor initializer list order
Avoids a -Wreorder compiler warning.
2019-05-07 16:31:43 +02:00
Lioncash 21cba77708 configure_hotkey: Remove unnecessary include
Avoids dumping all of the core settings machinery into whatever files
include this header. Nothing inside the header itself actually made use
of anything in settings.h anyways.
2019-05-07 16:30:12 +02:00
Lioncash 35281b4b3b configure_hotkey: Make IsUsedKey() a const member function
This doesn't actually modify instance state of the dialog, so this can
be made const.
2019-05-07 16:30:12 +02:00
Weiyi Wang 46b015befd
Merge pull request #4743 from FearlessTobi/port-2405
Port yuzu-emu/yuzu#2405: "CMakeLists: Define QT_USE_QSTRINGBUILDER for the Qt target"
2019-05-07 09:35:18 -04:00
Weiyi Wang 803e1fd5a0
Merge pull request #4747 from MerryMage/copyblock
memory: Re-order CopyBlock arguments to match other overload
2019-05-07 09:34:02 -04:00
Weiyi Wang 59879366a6
Merge pull request #4759 from B3n30/load_cia_ticket
FileSys: Load the ticket when the CIAContainer is loaded
2019-05-03 00:44:08 -04:00
liushuyu 8021361bb4
audio_core: dsp_hle: use better f32 to s16...
... conversion by clamping and clipping sample to [-1,1] and use
different masks for negative and positive samples
2019-05-01 15:58:26 -06:00
Tobias 623b0621ab
Port various minor changes from yuzu PRs (#4725)
* common/thread: Remove unused functions

Many of these functions are carried over from Dolphin (where they aren't
used anymore). Given these have no use (and we really shouldn't be
screwing around with OS-specific thread scheduler handling from the
emulator, these can be removed.

The function for setting the thread name is left, however, since it can
have debugging utility usages.

* input_common/sdl: Use a type alias to shorten declaration of GetPollers

Just makes the definitions a little bit more tidy.

* input_common/sdl: Correct return values within implementations of GetPollers()

In both cases, we weren't actually returning anything, which is
undefined behavior.

* yuzu/debugger/graphics_surface: Fill in missing surface format listings

Fills in the missing surface types that were marked as unknown. The
order corresponds with the TextureFormat enum within
video_core/texture.h.

We also don't need to all of these strings as translatable (only the
first string, as it's an English word).

* yuzu/debugger/graphics_surface: Clean up connection overload deduction

We can utilize qOverload with the signal connections to make the
function deducing a little less ugly.

* yuzu/debugger/graphics_surface: Tidy up SaveSurface

- Use QStringLiteral where applicable.

- Use const where applicable

- Remove unnecessary precondition check (we already assert the pixbuf
  being non null)

* yuzu/debugger/graphics_surface: Display error messages for file I/O errors

* core: Add missing override specifiers where applicable

Applies the override specifier where applicable. In the case of
destructors that are  defaulted in their definition, they can
simply be removed.

This also removes the unnecessary inclusions being done in audin_u and
audrec_u, given their close proximity.

* kernel/thread: Make parameter of GetWaitObjectIndex() const qualified

The pointed to member is never actually modified, so it can be made
const.

* kernel/thread: Avoid sign conversion within GetCommandBufferAddress()

Previously this was performing a u64 + int sign conversion. When dealing
with addresses, we should generally be keeping the arithmetic in the
same signedness type.

This also gets rid of the static lifetime of the constant, as there's no
need to make a trivial type like this potentially live for the entire
duration of the program.

* kernel/codeset: Make CodeSet's memory data member a regular std::vector

The use of a shared_ptr is an implementation detail of the VMManager
itself when mapping memory. Because of that, we shouldn't require all
users of the CodeSet to have to allocate the shared_ptr ahead of time.
It's intended that CodeSet simply pass in the required direct data, and
that the memory manager takes care of it from that point on.

This means we just do the shared pointer allocation in a single place,
when loading modules, as opposed to in each loader.

* kernel/wait_object: Make ShouldWait() take thread members by pointer-to-const

Given this is intended as a querying function, it doesn't make sense to
allow the implementer to modify the state of the given thread.
2019-05-01 14:28:49 +02:00
Lioncash 564032307d CMakeLists: Define QT_USE_QSTRINGBUILDER for the Qt target
This is a compile definition introduced in Qt 4.8 for reducing the total
potential number of strings created when performing string
concatenation. This allows for less memory churn.

This can be read about here:
https://blog.qt.io/blog/2011/06/13/string-concatenation-with-qstringbuilder/

For a change that isn't source-compatible, we only had one occurrence
that actually need to have its type clarified, which is pretty good, as
far as transitioning goes.
2019-05-01 14:26:13 +02:00
Pengfei Zhu e0a0bca13a
Merge pull request #4749 from zhaowenlan1779/webfix
web_service: Misc fixes
2019-05-01 17:00:17 +08:00
Pengfei Zhu 37861526ff
Merge pull request #4733 from zhaowenlan1779/ps
service/ps: Implement PS:EncryptDecryptAes
2019-04-29 21:39:53 +08:00
Weiyi Wang 64641cf958 CSND: handle command processing 2019-04-28 15:25:46 -04:00
B3n30 14ed702971 FileSys: Load the ticket when the CIAContainer is loaded 2019-04-28 21:21:28 +02:00
Tobias 7ea82e7941
Merge pull request #4736 from FearlessTobi/port-2356
Port yuzu-emu/yuzu#2356: "kernel/{server_port, server_session}: Return pairs instead of tuples from pair creation functions"
2019-04-27 00:07:13 +02:00
James Rowe 3f2c7eb471
Merge pull request #4738 from FearlessTobi/port-1020-new
Port yuzu-emu/yuzu#1020: "core: Namespace EmuWindow"
2019-04-26 08:58:09 -06:00
Ben f4da2de99a
Set accepted EULA version to max value (#4728)
* Set accepted EULA version to max value

CFG: write the max value of 0x7F7F to the default cfg savegame and
auto update on init

CECD: Actually read the EULA version from CFG
2019-04-23 23:18:27 +02:00
Ben 624271696e
HTTP_C: Implement SetClientCertContext, GetSSLError, BeginRequest, BeginRequestAsync (#4753)
* HTTP_C: Implement SetClientCertContext and GetSSLError; Stubbed BeginRequest and BeginRequestAsync

* HTTP_C: Move logs to beginning of function calls
2019-04-23 18:35:28 +02:00
Lioncash 6e22891761 core: Namespace EmuWindow
Gets the class out of the global namespace.
2019-04-21 14:16:16 +02:00
Lioncash 882f647760 kernel/wait_object: Make GetHighestPriorityReadyThread() a const member function
This doesn't actually modify internal state of a wait object, so it can
be const qualified.
2019-04-20 20:38:38 +02:00
Pengfei Zhu 536e4de499
Merge pull request #4700 from zhaowenlan1779/swkbd-2
applets/swkbd: Add callback support
2019-04-20 22:18:15 +08:00
zhupengfei 40ad54c5c7
citra_qt: Update the multiplayer dialogs when game list is repopulated
The multiplayer state object and dialogs hold a (modified) game list model, but it isn't updated when the actual game list changes. This updates the multiplayer dialogs with the new game list when it got repopulated.
2019-04-20 12:50:26 +08:00
zhupengfei 4a9ea65e49
core, citra_qt: Allow credentials update in multiplayer announce session
Allows updating the credentials of the announce session, thus allowing credentials changes to be reflected before citra restart. To avoid race conditions and web errors (you can only update the room that you created, i.e. changing credentials halfway will make it break), now you can only use the Citra Web Services settings when not hosting a public room.
2019-04-20 12:50:24 +08:00
zhupengfei d6b168d7ed
citra_qt/multiplayer: Disallow hosting rooms when preferred game is not selected
which can happen if the game list is empty, and would result in a 400 being returned from the server as the preferred_game field is empty.
2019-04-20 12:50:20 +08:00
zhupengfei 36051204cc core, web_service: Check for error when registering rooms
The `Register()` function can now handle error results and the error will be passed immediately to the Qt frontend, instead of being ignored silently and failing later with a "Room is not registered".
2019-04-20 12:50:14 +08:00
zhupengfei 81988d96fe
core/telemetry_session: Only create the backend when we really need it
The backend is not used until we decide to submit the testcase/telemetry, and creating it early prevents users from updating the credentials properly while the games are running.
2019-04-20 12:49:14 +08:00
MerryMage 065d3ce063 memory: Reorder parameters of CopyBlock to a more sensible order
* Also implement CopyBlock variants in terms of each other
2019-04-19 19:46:09 +01:00
Weiyi Wang 0ec45f694c
Merge pull request #3910 from wwylele/mipmap
gl_rasterizer: implement mipmap by forwarding PICA mipmap configuration
2019-04-17 14:10:42 -04:00
zhupengfei 0f65dac964
service/ps: Address review 2019-04-16 22:17:07 +08:00
Weiyi Wang 5f5e991884
Merge pull request #4734 from FearlessTobi/port-2391
Port yuzu-emu/yuzu#2391 and yuzu-emu/yuzu#2392: Changes to common
2019-04-16 09:48:52 -04:00
Lioncash 42535468c3 kernel/server_session: Return a std::pair from CreateSessionPair()
Keeps the return type consistent with the function name. While we're at
it, we can also reduce the amount of boilerplate involved with handling
these by using structured bindings.
2019-04-15 21:46:57 +02:00
Lioncash 1afc2c72d6 kernel/server_port: Return a std::pair from CreatePortPair()
Returns the same type that the function name describes.
2019-04-15 18:42:17 +02:00
Lioncash c4c644b285 kernel: Make handle type declarations constexpr
Some objects declare their handle type as const, while others declare it
as constexpr. This makes the const ones constexpr for consistency, and
prevent unexpected compilation errors if these happen to be attempted to be
used within a constexpr context.
2019-04-15 18:10:11 +02:00
Lioncash b8d43d4dfb common/swap: Improve codegen of the default swap fallbacks
Uses arithmetic that can be identified more trivially by compilers for
optimizations. e.g. Rather than shifting the halves of the value and
then swapping and combining them, we can swap them in place.

e.g. for the original swap32 code on x86-64, clang 8.0 would generate:

    mov     ecx, edi
    rol     cx, 8
    shl     ecx, 16
    shr     edi, 16
    rol     di, 8
    movzx   eax, di
    or      eax, ecx
    ret

while GCC 8.3 would generate the ideal:

    mov     eax, edi
    bswap   eax
    ret

now both generate the same optimal output.

MSVC used to generate the following with the old code:

    mov     eax, ecx
    rol     cx, 8
    shr     eax, 16
    rol     ax, 8
    movzx   ecx, cx
    movzx   eax, ax
    shl     ecx, 16
    or      eax, ecx
    ret     0

Now MSVC also generates a similar, but equally optimal result as clang/GCC:

    bswap   ecx
    mov     eax, ecx
    ret     0

====

In the swap64 case, for the original code, clang 8.0 would generate:

    mov     eax, edi
    bswap   eax
    shl     rax, 32
    shr     rdi, 32
    bswap   edi
    or      rax, rdi
    ret

(almost there, but still missing the mark)

while, again, GCC 8.3 would generate the more ideal:

    mov     rax, rdi
    bswap   rax
    ret

now clang also generates the optimal sequence for this fallback as well.

This is a case where MSVC unfortunately falls short, despite the new
code, this one still generates a doozy of an output.

    mov     r8, rcx
    mov     r9, rcx
    mov     rax, 71776119061217280
    mov     rdx, r8
    and     r9, rax
    and     edx, 65280
    mov     rax, rcx
    shr     rax, 16
    or      r9, rax
    mov     rax, rcx
    shr     r9, 16
    mov     rcx, 280375465082880
    and     rax, rcx
    mov     rcx, 1095216660480
    or      r9, rax
    mov     rax, r8
    and     rax, rcx
    shr     r9, 16
    or      r9, rax
    mov     rcx, r8
    mov     rax, r8
    shr     r9, 8
    shl     rax, 16
    and     ecx, 16711680
    or      rdx, rax
    mov     eax, -16777216
    and     rax, r8
    shl     rdx, 16
    or      rdx, rcx
    shl     rdx, 16
    or      rax, rdx
    shl     rax, 8
    or      rax, r9
    ret     0

which is pretty unfortunate.
2019-04-15 17:56:16 +02:00
Lioncash 686d067271 common/swap: Mark byte swapping free functions with [[nodiscard]] and noexcept
Allows the compiler to inform when the result of a swap function is
being ignored (which is 100% a bug in all usage scenarios). We also mark
them noexcept to allow other functions using them to be able to be
marked as noexcept and play nicely with things that potentially inspect
"nothrowability".
2019-04-15 17:56:09 +02:00
Lioncash 5664613640 common/swap: Simplify swap function ifdefs
Including every OS' own built-in byte swapping functions is kind of
undesirable, since it adds yet another build path to ensure compilation
succeeds on.

Given we only support clang, GCC, and MSVC for the time being, we can
utilize their built-in functions directly instead of going through the
OS's API functions.

This shrinks the overall code down to just

if (msvc)
  use msvc's functions
else if (clang or gcc)
  use clang/gcc's builtins
else
  use the slow path
2019-04-15 17:56:01 +02:00
Lioncash f108d3c6e6 common/swap: Remove 32-bit ARM path
We don't plan to support host 32-bit ARM execution environments, so this
is essentially dead code.
2019-04-15 17:55:55 +02:00
Lioncash aab503fe71 common/scope_exit: Replace std::move with std::forward in ScopeExit()
The template type here is actually a forwarding reference, not an rvalue
reference in this case, so it's more appropriate to use std::forward to
preserve the value category of the type being moved.
2019-04-15 17:55:44 +02:00
zhupengfei b34847d59e
service/ps: Implement PS:EncryptDecryptAES 2019-04-15 22:56:55 +08:00
Weiyi Wang 11754778bb
Merge pull request #4716 from wwylele/client-is-known
HLE/IPC: HLEContext can memorize the client thread and use it for SleepClientThread
2019-04-15 09:08:07 -04:00
Weiyi Wang e3b6bf93bc gl_rasterizer_cache: validate surface in mipmap/cubemap if the children is not validated yet 2019-04-15 09:07:36 -04:00
Weiyi Wang 4a206237be
Merge pull request #4726 from FearlessTobi/port-2312
Port yuzu-emu/yuzu#2312: "general: Use deducation guides for std::lock_guard and std::unique_lock"
2019-04-13 18:00:09 -04:00
Tobias e9c2b27c68
Merge pull request #4681 from FearlessTobi/port-2188-2190
Port yuzu-emu/yuzu#2188 and yuzu-emu/yuzu#2190: various minor code refactoring changes
2019-04-09 21:18:34 +02:00
zhupengfei d7fbc1ca2c
common/string_util: Move TextFromBuffer to string_util 2019-04-08 22:34:21 +08:00
zhupengfei 25be09c7a3
applets/swkbd: Address comments 2019-04-08 21:45:32 +08:00
zhupengfei 8078256a88 applets/swkbd: Add callback support 2019-04-08 21:45:29 +08:00
ReinUsesLisp c0ceecd7cd yuzu_cmd/config: Silent implicit cast warning
Also replaces (float) with static_cast<float>(...) for consistency.
2019-04-07 18:29:14 +02:00
Lioncash aba5dae557 service/service: Remove unncessary calls to c_str()
These can just be passed regularly, now that we use fmt instead of our
old logging system.

While we're at it, make the parameters to MakeFunctionString
std::string_views.
2019-04-07 18:27:14 +02:00
Lioncash b7518fc26c web_service: Remove unnecessary inclusions
Reduces the potential amount of rebuilding necessary if any headers
change. In particular, we were including a header from the core library
when we don't even link the core library to the web_service library, so
this also gets rid of an indirect dependency.
2019-04-07 18:27:14 +02:00
fearlessTobi e9bd34f7da Address remaining review comments 2019-04-07 17:00:28 +02:00
fearlessTobi 1517d2fef7 Address more reviews 2019-04-07 15:35:32 +02:00
fearlessTobi 781d4b787a Address first batch of review comments 2019-04-07 15:35:32 +02:00
fearlessTobi 041638ea4d applets: implement HLE mii selector applet 2019-04-07 15:35:29 +02:00
fearlessTobi f903d3161d ptm: move ptm_shared_extdata_id to header 2019-04-07 15:35:29 +02:00
Lioncash 21c71d21ae general: Use deducation guides for std::lock_guard and std::unique_lock
Since C++17, the introduction of deduction guides for locking facilities
means that we no longer need to hardcode the mutex type into the locks
themselves, making it easier to switch mutex types, should it ever be
necessary in the future.
2019-04-07 15:14:29 +02:00
Weiyi Wang d5bcb45b2a
Merge pull request #4723 from jroweboy/minorfix
Destroy the callback after the stream is destroyed to prevent crashes on close
2019-04-06 14:31:49 -04:00
Adityarup Laha ebba9f5a70
ConfigureInput::GetUsedKeyboardKeys(): Change index of home button to use NativeButton instead of magic number.
Fixes a bug where users can't bind anything to the B key.
Arises because this was not changed in #4537.
2019-04-06 10:41:28 +05:30
James Rowe f4d0bdd09a Destroy the callback after the stream is destroyed
Prevents a crash on close if the callback was running on a different
thread.
2019-04-05 14:16:55 -06:00
Weiyi Wang f565ea80f0 HLE/IPC: HLEContext can memorize the client thread and use it for SleepClientThread
This reduces the boilerplate that services have to write out the current thread explicitly. Using current thread instead of client thread is also semantically incorrect, and will be a problem when we implement multicore (at which time there will be multiple current threads)
2019-04-02 13:23:39 -04:00
Weiyi Wang daeba65fb4
Merge pull request #4710 from wwylele/why-instrusive-ptr
Kernel: replace boost::intrusive_ptr with std::shared_ptr
2019-04-02 11:06:13 -04:00
Weiyi Wang 8d2718a18f CAM: initialize states 2019-03-30 11:07:11 -04:00
Weiyi Wang 05058863b5 cleanup includes 2019-03-26 10:50:41 -04:00
Weiyi Wang 5f11c5f733 Kernel: replace boost::intrusive_ptr with std::shared_ptr 2019-03-24 14:32:11 -04:00
Weiyi Wang c1de8acfe5
Merge pull request #4689 from wwylele/server-leak
ServiceFrameworkBase: remove ownership to ServerPort
2019-03-24 14:29:41 -04:00
Weiyi Wang 21bda754b3
Merge pull request #4396 from FearlessTobi/open-delays
fs_user: Add a delay for each file open
2019-03-23 12:21:12 -04:00
fearlessTobi d755a15891 fix compilation problems 2019-03-23 12:43:03 +01:00
Weiyi Wang 9b07ff9681
Merge pull request #4683 from wwylele/misc-global-clean
Misc global instance reference cleaup
2019-03-22 22:28:50 -04:00
Lioncash bd4c04aec1 common/thread_queue_list: Remove unnecessary dependency on boost
We really don't need to pull in several headers of boost related
machinery just to perform the erase-remove idiom (particularly with
C++20 around the corner, which adds universal container std::erase and
std::erase_if, which we can just use instead).

With this, we don't need to link in anything boost-related into common.
2019-03-22 23:13:30 +01:00
Weiyi Wang 17c0e903db
Merge pull request #4694 from FearlessTobi/port-2210
Port commit from yuzu-emu/yuzu#2210: "common/bit_field: Make BitField trivially copyable"
2019-03-22 11:22:53 -04:00
Weiyi Wang 2138db3d7d
Merge pull request #4690 from wwylele/uds-deprecated
UDS: implement deprecated functions
2019-03-21 09:52:01 -04:00
Vamsi Krishna aedf5a84b0
Merge pull request #4671 from jroweboy/mic4
Microphone support
2019-03-20 23:12:38 +05:30
James Rowe b4d538468d Change resampling s16 -> u8 to respect aliasing rules 2019-03-20 09:31:03 -06:00
Lioncash bf4b0dd1f4 input_common/sdl_impl: Make lambda capture more specific in SDLState constructor
We don't need to universally capture by reference. We specifically just
need to capture the this pointer.
2019-03-19 23:55:38 +01:00
Lioncash ed31197402 input_common/sdl_impl: Remove unnecessary std::chrono::duration construction
Specifying the time unit itself is sufficient here.
2019-03-19 23:55:31 +01:00
Lioncash a5c087f5de input_common/sdl_impl: Remove unused variable in SDLState constructor 2019-03-19 23:55:23 +01:00
Weiyi Wang 1f233e4365
Merge pull request #4691 from liushuyu/oes_fix
video_core: renderer_opengl: gles color fix
2019-03-18 19:01:13 -04:00
Weiyi Wang 322f575ff5
Merge pull request #4697 from xperia64/getopt_fix
Fix getopt return type on systems where char is unsigned by default
2019-03-18 10:42:52 -04:00
James Rowe 9739e2b6fd Support signed 8bit pcm in cubeb input. Address review 2019-03-17 22:52:03 -06:00
Lioncash dbc3c8e9bb core/core: Remove the global telemetry accessor function
With all usages converted off of it, this function can be removed.
2019-03-17 23:17:57 +01:00
Lioncash 65572a0fb8 yuzu: Remove usage of the global telemetry accessor
In these cases the system object is nearby, and in the other, the
long-form of accessing the telemetry instance is already used, so we can
get rid of the use of the global accessor.
2019-03-17 23:17:57 +01:00
Lioncash d37a2fb9e6 yuzu-cmd/yuzu: Replace direct usage of the global system telemetry accessor in main()
We already have the system instance around, so we can use that instead
of the accessor.
2019-03-17 23:17:57 +01:00
Lioncash 6f251a6db2 core/core: Replace direct usage of the global system telemetry accessor from Shutdown()
The telemetry instance is actually a member of the class itself, so we
can access it directly instead of going through the global accessor.
2019-03-17 23:17:57 +01:00
Lioncash 592ec9b084 logging/backend: Make time_origin a class variable instead of a local static
Moves local global state into the Impl class itself and initializes it
at the creation of the instance instead of in the function.

This makes it nicer for weakly-ordered architectures, given the
CreateEntry() class won't need to have atomic loads executed for each
individual call to the CreateEntry class.
2019-03-17 23:17:57 +01:00
Lioncash 235fc348af logging/backend: Move CreateEntry into the Impl class
This function is only ever used within this source file and makes it
easier to remove static state in the following change.
2019-03-17 23:17:57 +01:00
Weiyi Wang 29c3d72940
Merge pull request #4678 from wwylele/mii-archive
archive_ncch: add open source mii archive
2019-03-17 15:54:28 -04:00
Lioncash c47c24bbd2 common/bit_field: Make BitField trivially copyable
This makes the class much more flexible and doesn't make performing
copies with classes that contain a bitfield member a pain.

Given BitField instances are only intended to be used within unions, the
fact the full storage value would be copied isn't a big concern (only
sizeof(union_type) would be copied anyways).

While we're at it, provide defaulted move constructors for consistency.
2019-03-16 04:10:03 +01:00
xperia64 fa0919915c Fix GLES version header on picky drivers 2019-03-15 23:32:29 +00:00
xperia64 224142a57e Fix getopt on systems where char is unsigned by default 2019-03-15 23:19:24 +00:00
Weiyi Wang 4696b13170
UDS: I was drunk 2019-03-15 00:35:39 -04:00
Weiyi Wang 1fbda5518e
Merge pull request #4684 from liushuyu/fix_freeze
frontend: qt: fix a freeze issue
2019-03-14 16:07:54 -04:00
Weiyi Wang fd7730e7c8
Merge pull request #4575 from BreadFish64/android6
android: add logging
2019-03-14 16:00:59 -04:00
liushuyu 71b0eab85c
video_core: renderer_opengl: addressed comments...
use indexing to make code more concise; use const bool instead of bool
2019-03-14 10:58:29 -06:00
Weiyi Wang a986e35795 UDS: Change reply command ID for two versions of ConnectToNetwork 2019-03-14 10:10:18 -04:00
liushuyu 476df9debf
video_core: renderer_opengl: addressed comments...
... removed incorrect comments and removed incorrect value calculations
2019-03-13 19:17:29 -06:00
Weiyi Wang 9c016ff3a3 Y2R: pass in MemorySystem from service 2019-03-13 10:23:58 -04:00
Weiyi Wang d6f3ac1f4e IR: pass in Core::Timing for ExtraHID 2019-03-13 10:23:58 -04:00
Weiyi Wang ea496507d5 DSP_DSP: use member system instead of global instance 2019-03-13 10:23:58 -04:00
liushuyu 164eb100eb video_core: renderer_opengl: addressed comments...
... removed redundant comments and removed incorrect value assignments
2019-03-12 22:56:11 -06:00
liushuyu 3983b12086
video_core: renderer_opengl: gles color fix 2019-03-12 22:28:54 -06:00
Weiyi Wang aaa599a849 UDS: duplicate DecryptBeaconData implementation for deprecated version
They are really identical in the NWM module code
2019-03-13 00:21:10 -04:00
Weiyi Wang 16fb6a2c8d UDS: implement ConnectToNetworkDeprecated and forward params to ConnectToNetwork 2019-03-13 00:03:51 -04:00