Commit graph

423 commits

Author SHA1 Message Date
Merry
f55ed1cab0 core/loader: Return nullptr if file is nullptr 2022-09-25 19:31:35 +01:00
Kyle Kienapfel
14e9de6678 code: dodge PAGE_SIZE #define
Some header files, specifically for OSX and Musl libc define PAGE_SIZE to be a number
This is great except in yuzu we're using PAGE_SIZE as a variable

Specific example
`static constexpr u64 PAGE_SIZE = u64(1) << PAGE_BITS;`

PAGE_SIZE PAGE_BITS PAGE_MASK are all similar variables.
Simply deleted the underscores, and then added YUZU_ prefix

Might be worth noting that there are multiple uses in different classes/namespaces
This list may not be exhaustive

Core::Memory   12 bits (4096)
QueryCacheBase 12 bits
ShaderCache    14 bits (16384)
TextureCache   20 bits (1048576, or 1MB)

Fixes #8779
2022-08-19 16:08:40 -07:00
Liam
00299479ab core/loader: remove ELF loader 2022-08-01 17:19:23 -04:00
Liam
ebecdd3a74 general: fix compilation on MinGW GCC 12 2022-06-13 20:09:32 -04:00
Liam
3c313a43fd common: consolidate ELF structure definitions 2022-06-05 09:42:05 -04:00
Andrea Pappacoda
01cf05bc75
chore: add missing SPDX tags
Follow-up to 99ceb03a1c
2022-04-28 18:24:11 +02:00
Morph
99ceb03a1c general: Convert source file copyright comments over to SPDX
This formats all copyright comments according to SPDX formatting guidelines.
Additionally, this resolves the remaining GPLv2 only licensed files by relicensing them to GPLv2.0-or-later.
2022-04-23 05:55:32 -04:00
BytesGalore
e4e92cb75c
loader: log the type of mismatching file-extension 2022-03-03 06:45:13 +01:00
Lioncash
f785f73e92 general: Replace NonCopyable struct with equivalents 2022-02-02 13:17:12 -05:00
bunnei
7feac8ba46 core: loader: kip: Minimal changes to fix KIP loading.
- Allows us to boot KIP (kernal apps), useful for testing the kernel.
2021-12-17 23:08:51 -08:00
jam1garner
29559930e9 loader: Support loading subsdk{8,9} 2021-12-05 23:07:50 -05:00
ameerj
7c4b6aab2e core: Remove unused includes 2021-11-03 21:42:57 -04:00
Feng Chen
07073734ed
file_sys: Support load game collection (#6582)
Adds support for loading games with multiple programs embedded within such as the Dragon Quest 1+2+3 Collection
2021-07-20 01:10:05 -04:00
lat9nq
b91b76df4f general: Make most settings a BasicSetting
Creates a new BasicSettings class in common/settings, and forces setting
a default and label for each setting that uses it in common/settings.
Moves defaults and labels from both frontends into common settings.
Creates a helper function in each frontend to facillitate reading the
settings now with the new default and label properties.

Settings::Setting is also now a subclass of Settings::BasicSetting. Also
adds documentation for both Setting and BasicSetting.
2021-06-28 17:32:17 -04:00
Morph
065867e2c2
common: fs: Rework the Common Filesystem interface to make use of std::filesystem (#6270)
* common: fs: fs_types: Create filesystem types

Contains various filesystem types used by the Common::FS library

* common: fs: fs_util: Add std::string to std::u8string conversion utility

* common: fs: path_util: Add utlity functions for paths

Contains various utility functions for getting or manipulating filesystem paths used by the Common::FS library

* common: fs: file: Rewrite the IOFile implementation

* common: fs: Reimplement Common::FS library using std::filesystem

* common: fs: fs_paths: Add fs_paths to replace common_paths

* common: fs: path_util: Add the rest of the path functions

* common: Remove the previous Common::FS implementation

* general: Remove unused fs includes

* string_util: Remove unused function and include

* nvidia_flags: Migrate to the new Common::FS library

* settings: Migrate to the new Common::FS library

* logging: backend: Migrate to the new Common::FS library

* core: Migrate to the new Common::FS library

* perf_stats: Migrate to the new Common::FS library

* reporter: Migrate to the new Common::FS library

* telemetry_session: Migrate to the new Common::FS library

* key_manager: Migrate to the new Common::FS library

* bis_factory: Migrate to the new Common::FS library

* registered_cache: Migrate to the new Common::FS library

* xts_archive: Migrate to the new Common::FS library

* service: acc: Migrate to the new Common::FS library

* applets/profile: Migrate to the new Common::FS library

* applets/web: Migrate to the new Common::FS library

* service: filesystem: Migrate to the new Common::FS library

* loader: Migrate to the new Common::FS library

* gl_shader_disk_cache: Migrate to the new Common::FS library

* nsight_aftermath_tracker: Migrate to the new Common::FS library

* vulkan_library: Migrate to the new Common::FS library

* configure_debug: Migrate to the new Common::FS library

* game_list_worker: Migrate to the new Common::FS library

* config: Migrate to the new Common::FS library

* configure_filesystem: Migrate to the new Common::FS library

* configure_per_game_addons: Migrate to the new Common::FS library

* configure_profile_manager: Migrate to the new Common::FS library

* configure_ui: Migrate to the new Common::FS library

* input_profiles: Migrate to the new Common::FS library

* yuzu_cmd: config: Migrate to the new Common::FS library

* yuzu_cmd: Migrate to the new Common::FS library

* vfs_real: Migrate to the new Common::FS library

* vfs: Migrate to the new Common::FS library

* vfs_libzip: Migrate to the new Common::FS library

* service: bcat: Migrate to the new Common::FS library

* yuzu: main: Migrate to the new Common::FS library

* vfs_real: Delete the contents of an existing file in CreateFile

Current usages of CreateFile expect to delete the contents of an existing file, retain this behavior for now.

* input_profiles: Don't iterate the input profile dir if it does not exist

Silences an error produced in the log if the directory does not exist.

* game_list_worker: Skip parsing file if the returned VfsFile is nullptr

Prevents crashes in GetLoader when the virtual file is nullptr

* common: fs: Validate paths for path length

* service: filesystem: Open the mod load directory as read only
2021-05-25 19:32:56 -04:00
Lioncash
9a07ed53eb core: Make variable shadowing a compile-time error
Now that we have most of core free of shadowing, we can enable the
warning as an error to catch anything that may be remaining and also
eliminate this class of logic bug entirely.
2021-05-16 03:43:16 -04:00
bunnei
2a7eff57a8 hle: kernel: Rename Process to KProcess. 2021-05-05 16:40:52 -07:00
Lioncash
ebb64d5bf4 core: Resolve misc cases of variable shadowing
Resolves shadowing warnings that aren't in a particularly large
subsection of core. Brings us closer to turning -Wshadow into an error.

All that remains now is for cases in the kernel (left untouched for now
since a big change by bunnei is pending), and a few left over in the
service code (will be tackled next).
2021-05-03 01:19:13 -04:00
Lioncash
724c19a307 loader: Resolve instances of variable shadowing
Eliminates variable shadowing cases across all the loaders to bring us
closer to enabling variable shadowing as an error in core.
2021-04-27 12:48:15 -04:00
Morph
1c65b3ee53 program_metadata: Set a default resource size when a NPDM is not present
Sets a default size of 0x1FE00000 bytes (510 MiB) for the system_resource_size when a NPDM is not present.
2021-04-23 12:47:31 -04:00
bunnei
a4c6712a4b common: Move settings to common from core.
- Removes a dependency on core and input_common from common.
2021-04-14 16:24:03 -07:00
bunnei
93e20867b0 hle: kernel: Migrate PageHeap/PageTable to KPageHeap/KPageTable. 2021-02-18 16:16:25 -08:00
bunnei
1e55498110 hle: kernel: KThread: Reorganize thread priority defaults. 2021-01-28 21:42:25 -08:00
bunnei
c0d3aef28c core: hle: kernel: Rename Thread to KThread. 2021-01-28 21:42:25 -08:00
Lioncash
86592b274e main: Resolve error string not displaying
During the transition to make the error dialog translatable, I
accidentally got rid of the conversion to ResultStatus, which prevented
operator<< from being invoked during formatting.

This adds a function to directly retrieve the result status string
instead so that it displays again.
2021-01-03 13:18:04 -05:00
Lioncash
b1657b8c6b vfs: Use existing type aliases consistently
Makes use of the VirtualDir and VirtualFile aliases across the board
instead of having a few isolated places that don't use it.
2020-12-10 01:44:43 -05:00
Lioncash
5bc4eabe36 core: Eliminate remaining usages of the global system instance
Removes all remaining usages of the global system instance. After this,
migration can begin to migrate to being constructed and managed entirely
by the various frontends.
2020-11-27 11:40:45 -05:00
bunnei
5f75d97125 core: loader: Implement support for loading indexed programs. 2020-11-24 15:16:24 -08:00
Lioncash
6f8a06bac5 patch_manager: Remove usages of the global system instance
With this, only 19 usages of the global system instance remain within
the core library.

We're almost there.
2020-11-18 09:36:48 -05:00
bunnei
3d592972dc
Revert "core: Fix clang build" 2020-10-20 19:07:39 -07:00
Lioncash
be1954e04c core: Fix clang build
Recent changes to the build system that made more warnings be flagged as
errors caused building via clang to break.

Fixes #4795
2020-10-17 19:50:39 -04:00
Lioncash
39c8d18feb core/CMakeLists: Make some warnings errors
Makes our error coverage a little more consistent across the board by
applying it to Linux side of things as well. This also makes it more
consistent with the warning settings in other libraries in the project.

This also updates httplib to 0.7.9, as there are several warning
cleanups made that allow us to enable several warnings as errors.
2020-10-13 13:16:49 -04:00
Lioncash
ff45c39578 General: Make use of std::nullopt where applicable
Allows some implementations to avoid completely zeroing out the internal
buffer of the optional, and instead only set the validity byte within
the structure.

This also makes it consistent how we return empty optionals.
2020-09-22 17:32:33 -04:00
Lioncash
a62c1999c5 file_sys/romfs_factory: Eliminate usage of the global system accessor 2020-09-16 19:15:19 -04:00
Lioncash
aa8d6fc041 loader/nso: Remove unnecessary [[maybe_unused]] 2020-09-16 18:09:01 -04:00
Lioncash
113a3972a6 core/loader: Remove dependencies on the global system instance
Now all that remains is:

18 instances in file_sys code
14 instances in GDB stub code (this can be tossed wholesale)
4 instances in HLE code
2 instances in settings code.
2020-09-16 08:46:59 -04:00
Lioncash
c4ed791164 common/fileutil: Convert namespace to Common::FS
Migrates a remaining common file over to the Common namespace, making it
consistent with the rest of common files.

This also allows for high-traffic FS related code to alias the
filesystem function namespace as

namespace FS = Common::FS;

for more concise typing.
2020-08-16 06:52:40 -04:00
Lioncash
8e86fa7e60 common/concepts: Rename IsBaseOf to DerivedFrom
This makes it more inline with its currently unavailable standardized
analogue std::derived_from.

While we're at it, we can also make the template match the requirements
of the standardized variant as well.
2020-08-07 08:09:57 -04:00
David Marcec
a5af1161c9 Place in anonymous namespace 2020-08-03 21:31:28 +10:00
David Marcec
6cfff2c3f6 loader: Make IdentifyFile typesafe
Relies on #4465 for concept.h Common::IsBaseOf
2020-08-03 21:31:27 +10:00
bunnei
9c12aef2f8 loader: nro: Fix process initialization using ProgramMetadata default. 2020-04-20 18:19:45 -04:00
bunnei
68039addbc loader: elf: Fix process initialization using ProgramMetadata default. 2020-04-20 18:19:45 -04:00
Lioncash
441a2812ed loader/nso: Resolve moves not occurring in DecompressSegment
Given the std::vector was const, an automatic move out of the function
could not occur.

We can allow automatic return value optimizations to occur by making the
buffer non-const.
2020-04-17 19:26:50 -04:00
bunnei
bebfb05c1b loader: nso: Fix loader size and arguments. 2020-04-17 00:59:35 -04:00
bunnei
83761d5316 loader: elf/kip/nro: Updates for new VMM. 2020-04-17 00:59:35 -04:00
bunnei
4caff51710 core: memory: Move to Core::Memory namespace.
- helpful to disambiguate Kernel::Memory namespace.
2020-04-17 00:59:28 -04:00
bunnei
7aa0e4a7ca loader: nso: Fix loading of static objects to be properly sized and aligned. 2020-04-17 00:59:27 -04:00
bunnei
6fc485a607 core: loader: Remove check for 32-bit. 2020-03-02 21:43:15 -05:00
Michael Scire
5a7eecc3ad loader: provide default arguments (zero byte) to NSOs
Certain newer unity games (Terraria, Pokemon Mystery Dungeon) require
that the argument region be populated. Failure to do so results in
an integer underflow in argument count, and eventually an unmapped
read at 0x800000000. Providing this default fixes this.

Note that the behavior of official software is as yet unverified,
arguments-wise.
2020-01-22 20:14:06 -08:00
Markus Wick
7e94e544f4 core/loaders: Simplify PhysicalMemory usage.
It is currently a std::vector, however we might want to replace it with a more fancy allocator.
So we can't use the C++ iterators any more.
2020-01-18 08:29:19 +01:00