Commit graph

8664 commits

Author SHA1 Message Date
Lioncash a32ad7f1f2 soc_u: Prevent undefined behavior with CTRPollFD
This class is memcpy-ed and memcpy has the requirement that data passed
to it must be trivially copyable, otherwise the behavior is undefined.

This is trivial to resolve as BitField was made trivially copyable a
while ago, so this explicit copy assignment operator isn't necessary.
2020-05-01 22:30:10 -04:00
Pengfei Zhu 2476532f21
Merge pull request #5302 from lioncash/teak
CMakeLists: Specify EXCLUDE_FROM_ALL for teakra
2020-05-02 10:21:18 +08:00
Pengfei Zhu e212dc3a1f
Merge pull request #5297 from lioncash/missing
gl_rasterizer: Amend missing return value in branch in SetupGeometryShader()
2020-05-02 08:07:49 +08:00
Pengfei Zhu 70a43be714
Merge pull request #5306 from lioncash/view2
file-sys: Make use of std::string_view where applicable
2020-05-02 08:07:10 +08:00
Pengfei Zhu 8e7abecf7e
Merge pull request #5307 from lioncash/guard
file_sys/seed_db: Add missing include guard
2020-05-02 08:04:58 +08:00
Pengfei Zhu 5a008a74fa
Merge pull request #5304 from lioncash/layered
layered_fs: Mark functions as static where applicable
2020-05-02 08:02:35 +08:00
Pengfei Zhu 6907568034
Merge pull request #5309 from lioncash/dtor
applets: Make destructors virtual where applicable
2020-05-02 08:02:14 +08:00
Pengfei Zhu 59984df603
Merge pull request #5308 from lioncash/rsa
core/hw/rsa: Minor cleanup
2020-05-02 08:01:58 +08:00
Pengfei Zhu 4d7487bd34
Merge pull request #5298 from lioncash/unused
gl_rasterizer: Silence various compilation warnings
2020-05-01 23:34:36 +08:00
Pengfei Zhu 037c857bd6
Merge pull request #5303 from lioncash/namespace
service/ir: Remove erroneous forward declaration
2020-05-01 23:04:01 +08:00
Pengfei Zhu 017f0c469e
Merge pull request #5301 from lioncash/chunk
common: Remove chunk_file.h
2020-05-01 23:02:47 +08:00
Pengfei Zhu 6a0636d631
Merge pull request #5296 from lioncash/flatten
gl_rasterizer_cache: Flatten LoadCustomTexture()
2020-05-01 23:01:47 +08:00
Pengfei Zhu 2eacb11c53
Merge pull request #5292 from lioncash/alloc
gl_shader_manager: Eliminate variable shadowing
2020-05-01 22:57:55 +08:00
Pengfei Zhu 1bb9a71a01
Merge pull request #5291 from lioncash/trunc
renderer_opengl: Resolve compiler truncation warnings
2020-05-01 22:56:46 +08:00
Lioncash 89eeb64854 applets/swkbd: Make destructor virtual
Prevents undefined behavior when destroying a derived class through a
base class pointer.
2020-05-01 10:44:31 -04:00
Lioncash aeb6a037ed applets/mii_selector: Make destructor virtual
Prevents undefined behavior when destroying derived classes through a
base class pointer.
2020-05-01 10:42:57 -04:00
Lioncash 3ab0701192 core/hw/rsa: Make GetSignature() a const member function
This doesn't directly modify instance state, so it can be made const.
2020-05-01 10:17:43 -04:00
Ben fd1b254635
Merge pull request #5290 from lioncash/shader
gl_shader_gen: Minor interface cleanup
2020-05-01 16:16:25 +02:00
Lioncash c55e81b946 core/hw/rsa: Make operator bool explicit
Prevents error-prone implicit conversions to bool from occurring.
2020-05-01 10:14:50 -04:00
Lioncash 75bac1e514 core/hw/rsa: Take std::vector instances by value
Allows us to std::move them and allow calling code to eliminate copies
from occurring entirely.
2020-05-01 10:14:07 -04:00
Lioncash 98385b75d6 file_sys/seed_db: Add missing include guard
Prevents any potential inclusion errors from occurring.
2020-05-01 09:59:58 -04:00
Lioncash 10a32c94b6 title_metadata: Take std::vector by const reference in Load()
This isn't modified in the implementation, so this can be a const
reference to eliminate an unnecessary heap reallocation.
2020-05-01 09:53:44 -04:00
Lioncash 147073a5a0 file-sys: Make use of std::string_view where applicable
Same behavior, but makes the interface more flexible and allows
non-std::string instances to be used with it.
2020-05-01 09:49:36 -04:00
Lioncash 37a6ea72e5 layered_fs: Mark functions as static where applicable
Makes them internally linked and prevents potential
-Wmissing-declaration warnings.
2020-05-01 09:35:59 -04:00
Lioncash 9cff314abb service/ir: Remove erroneous forward declaration
This can be removed as it's not used. Even if it were however, it would
be an incorrect forward declaration, as ServiceManager exists within the
Service::SM namespace, not the top-level SM namespace.
2020-05-01 08:54:27 -04:00
Lioncash 7d5cad4093 CMakeLists: Specify EXCLUDE_FROM_ALL for teakra
Ensures that unused targets introduced in the add_subdirectory call
don't show up in IDE builds if they aren't used (which is the case for
teakra_c).
2020-05-01 08:31:58 -04:00
Lioncash 246cea229c common: Remove chunk_file.h
This is part of Dolphin's serialization code, which isn't used and
probably never will be, considering that savestates are implemented with
boost.
2020-05-01 08:23:59 -04:00
Lioncash 763778e6c0 gl_rasterizer: Make const on references consistent
Applies const to auto& instances that would actually resolve to a const
reference for readability and explicitness.
2020-05-01 06:19:20 -04:00
Lioncash 437453d32b gl_rasterizer: Amend missing return value in branch in SetupGeometryShader()
Previously undefined behavior was being invoked in the case that
geometry shaders weren't supported.
2020-05-01 06:10:32 -04:00
Lioncash 81768bf0c2 gl_rasterizer: Resolve truncation warnings 2020-05-01 06:08:20 -04:00
Lioncash df97021f55 gl_rasterizer: Make use of std::string_view in IsVendorAmd()
Same behavior, no heap allocation.

strings returned from glGetString() are guaranteed to be static strings,
so this is safe to do. They're also guaranteed to be null-terminated.
2020-05-01 05:57:25 -04:00
Lioncash de140a5870 gl_rasterizer: Default destructor in the cpp file 2020-05-01 05:53:40 -04:00
Lioncash ea08178dde gl_rasterizer: Remove unused emu_window variable in RasterizerOpenGL
Silences an unused private variable warning.
2020-05-01 05:52:48 -04:00
Lioncash 59a614a70f gl_rasterizer_cache: Remove unnecessary reference parameter in LoadCustomTexture()
This is only ever used in a self-referential manner, so we can make use
of the texture info member directly.
2020-05-01 05:42:35 -04:00
Lioncash e342f36e02 gl_rasterizer_cache: Flatten LoadCustomTexture()
Makes the control flow much nicer to follow, as we don't store to a
local before returning anymore.
2020-05-01 05:33:47 -04:00
Mat M 85d37c9994
gl_shader_disk: Make use of std::nullopt where applicable (#5293)
Some implementations can use the std::nullopt_t constructor of
std::optional to avoid needing to completely zero out the internal
buffer of the optional and instead only set the validity byte within it.

e.g. Consider the following function:

std::optional<std::vector<ShaderDiskCacheRaw>> fn() {
    return {};
}

With libc++ this will result in the following code generation on x86-64:

Fn():
  mov     rax, rdi
  vxorps  xmm0, xmm0, xmm0
  vmovups ymmword ptr [rdi], ymm0
  vzeroupper
  ret

With libstdc++, we also get the similar equivalent:

Fn():
  vpxor   xmm0, xmm0, xmm0
  mov     rax, rdi
  vmovdqu XMMWORD PTR [rdi], xmm0
  vmovdqu XMMWORD PTR [rdi+16], xmm0
  ret

If we change this function to return std::nullopt instead, then this
simplifies both the code gen from libc++ and libstdc++ down to:

Fn():
  mov     BYTE PTR [rdi+24], 0
  mov     rax, rdi
  ret

Given how little of a change is necessary to result in better code
generation, this is essentially a "free" very minor optimization.
2020-04-30 22:42:32 -05:00
Lioncash f20120e5a7 gl_shader_gen: Mark hash implementations as noexcept
These shouldn't throw at all, so we can mark the interface as such.
2020-04-30 22:57:36 -04:00
Lioncash ca4f7266c0 gl_shader_manager: Remove unused variable within LoadDiskCache() 2020-04-30 22:48:57 -04:00
Lioncash 138539c9a0 gl_shader_manager: Eliminate variable shadowing
Resolves a few -Wshadow warnings.
2020-04-30 22:46:58 -04:00
Lioncash 2d83b39532 gl_shader_manager: Avoid unnecessary std::vector copy in LoadDiskCache()
Same behavior, but without an unnecessary reallocation.
2020-04-30 22:43:03 -04:00
Lioncash e118cb1e0b renderer_opengl: Resolve compiler truncation warnings
Resolves numerous truncation warnings on MSVC.
2020-04-30 22:26:14 -04:00
Lioncash d23ffe9b42 gl_shader_gen: Mark PicaVSConfig reference parameter as const
This isn't mutated whatsoever, so this can be marked const.
2020-04-30 22:07:25 -04:00
Weiyi Wang 4a677e83fe
Merge pull request #5287 from vvanelslande/teakra
Update teakra
2020-04-30 12:48:23 -04:00
Valentin Vanelslande ce58151c21 Update teakra 2020-04-29 21:53:01 -05:00
Ben 64694b0f11
Merge pull request #5276 from B3n30/fix_travis_frozen_linux
fix travis-ci frozen mingw build
2020-04-29 22:43:04 +02:00
Pengfei Zhu c937876935
Merge pull request #5282 from FearlessTobi/free-bytes-fix
savedata_archive: Make GetFreeBytes return a more accurate value
2020-04-29 21:41:07 +08:00
FearlessTobi 7f8151b9b9 savedata_archive: Make GetFreeBytes return a more accurate value
Previously, we were returning a value that was way too big, causing an integer overflow in Fractured Souls.
According to wwylele, the biggest oberserved save size for 3DS is 1MB, so this new value should leave plenty of room, even if games use a bigger size.
2020-04-29 05:42:40 +02:00
Mat M 98fe5f82c5
memory: Make getter functions const qualified where applicable (#5251)
Many of these functions are capable of being used within const contexts,
so we can apply the const qualifier in some cases and add const based
overloads for others, which makes the interface a little bit more
flexible and const-correct.
2020-04-28 14:43:52 -05:00
Mat M 96832a2c82
core/memory: Make use of std::move in Entry::operator= (#5233)
* core/memory: Amend unusual return value of operator=

operator= usually returns a reference to this. Given there's no comment
explaining why void was used, this can be assumed to be an oversight.

* core/memory: Make use of std::move in Entry::operator=

Same behavior, minus the need for an atomic reference count increment
and decrement (since MemoryRef contains a std::shared_ptr).
2020-04-28 14:39:02 -05:00
Ben 9dc0f38ffd
Merge pull request #5241 from lioncash/pica
pica_state: Make use of std::array where applicable
2020-04-28 09:01:41 +02:00