Replace `exit_delete_all_threads_and_wait()` with two separate operations:
- `process_exit()` blocks until all guest threads have exited (host-only)
- `request_process_exit()` fires the registered callback and returns immediately, safe to call from guest threads.
Threads are now SDL_DetachThread'd at creation. `thread_deleted_cond` on `KernelState` is used for join semantics in `process_exit()`.
Remove `shutting_down` from sync primitives; `exit_delete()` wakes blocked threads via `update_status(run)`, which all `status_cond` predicates already check.
`process_exit_callback` carries an `optional<AppLaunchRequest>` so `LoadExec` relaunches flow through the same path as normal exits. `AppLaunchRequest`/`AppLaunchReason` extracted to `emuenv/app_launch_request.h` so kernel can include it without a circular dependency.
After this, further simplification to `ThreadStatus` will be done in https://github.com/Vita3K/Vita3K/pull/3922.
Fix bugs
* gui/disassembly_dialog: fix bug. Can't enter addresses >= 0x80000000
* utils/vc_runtime_checker: fix almost impossible AV in vc_runtime_checker
* util/net_utils: fix warning and error in parseHeaders function
* patch: fix almost impossible bug, also drop unused var
* modules/SceAvPlayer: fix error (wrong mutex)
* kernel: more correct value of export variable __sce_libcparam (NID:0xDF084DFA)
* interface.cpp/get_contents_path (Looks like mistype in duplicate search)
Needs recheck of refactoring. I found something strange, but I'm not sure if it's intended or not.
* renderer::vulkan/VKContext::VKContext (Looks like mistype in variable name)
* spirv_recompiler/create_fragment_inputs (Variable anonimous is always false here. It's not static and reinit every loop iteration)
* renderer/transfer: fix strange (and maybe never run) code if pixel format is unknown
* renderer/vulkan/replacement: fix some type to type converson
Refactoring and enhancements
* codec/atrac9: better error logs
* util/fs_utils: Function read_data which read file to vector. Also use it if possible
* util/log: custom formatter for Ptr<> type (it simplifies logging)
* util/tracy: set tracy_module_id variable static
* util/warning.h : header to cross-platform disable warnings
* renderer/transfer: fix strange (and maybe never run) code if pixel format is unknown
* nids: typo fix
* modules/module_parent: remove link to nids.inc from header
* modules/module_parent: move macro to other such macros in bridge.h
* kernel: refactoring use get_thread instead of lock_and_find
* mem/ptr: set type Ptr<T> trivial (trivially copiable, movable and so on)
Fix warnings:
* some retype in BitmapAllocator (mem-tests are OK)
* typecasts
* remove unused variables and fields
* push_back->emplace_back
* rename duplicate variables (usually in nested loops)
* drop excessive brackets
* remove some unused includes
* set 'static' for functions if possible
* gui:home_screen/draw_home_screen: same values around ? operator.
* convert declare SCE_*_ERROR_* to enums
* bracket initialisation instead of memset
* other compiler warnings
Improvements
* lang: a bit more verbose error on wrong lang xml
Bugfixes
* kernel/sync_primitives: fix theoretically possible AV
* modules/SceAudio: a bit more correct sceAudioOutSetConfig
* fix wrong objects initialisation ({0} -> {})
Warning fixes
* clang warning: Macro argument should be enclosed in parentheses
[bugprone-macro-parentheses]
* modules: set unsigned type for Sce*ErrorCode enums
* clang warning: variable might be not be initialized
* clang warning: Function returns by const value. Consider returning by non-const value instead.
* clang warning: Prefer transparent functors [modernize-use-transparent-functors]
Refactoring
* io/device: move functions implementation from .h to .cpp file
* vita3k: fix fs::path usage
* clang warning: 'if' statement is unnecessary; deleting null pointer has no effect
* vita3k: use structured bindings and references in for-each-loops
* vita3k: simplify container operations, extract frequent operations to utility functions
* clang⚠️ 'contains' member function can be used
* kernel/sync_primitives: refactoring. drop unused parameter of handle_timeout
* vita3k: drop unused function parameters
* vita3k: fix typecasts
use static_cast instead of reinterpret casts if possible
use correct constants (1/1.0/1.0f)
correct variable types to minimise typecasts
use explicit typecasts (not everywhere)
replace c-style typecasts to c++ style typecasts (not everywhere)
* clang warning: remove redundant typecasts
* clang warning: Cast drops const qualifier
Optimisation
* vita3k: remove unused includes
* clang warning: Constness of returning variable prevents automatic move
[performance-no-automatic-move]
* clang warning: String concatenation results in allocation of unnecessary temporary strings
[performance-inefficient-string-concatenation]
* vita3k: use std::move
* vita3k: optimization. push_back -> emplace_back
* vita3k: fix datatypes to avoid unnesessary conversions
* clang warning: remove unneeded string->c_str->string conversion
* clang warning: The parameter is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]
* clang warning: 'find' called with a string literal consisting of a single character
[performance-faster-string-find]
* clang warning: Result of a postfix operator is discarded, consider replacing it with a prefix operator
* clang warning: Pass value parameters by const reference
Code cleanup
* io/io: remove once used variables
* net/posixsocket: remove struct keyword
* vita3k: use raw string literals to avoid excessive escaping
* vita3k: refactoring. replace Ptr<> to pointer in Sce functions
* vita3k: drop unused variables and incorrect comments
* clang warning: readability-inconsistent-declaration-parameter-name
* clang warning: Extra ';' after member function definition
* clang warning: Possible misuse of comma operator (, is used instead of ;)
* clang warning: Algorithm accepting an iterator and a count can be used
* clang warning: Declaration and assignment can be joined
* clang warning: Type trait can be simplified using a template alias or a variable template
* vita3k: cleanup class methods
remove unimplemented (and obviously not used) methods
move deleted methods to public
change empty body to =default
remove auto constructors
set member default values
"package" is a reserved CMake target name when CPack is used. Since
OpenSSL enables CPack in their project and it will be implemented in the
emulator in the future, this commit changes its name to "packages" to
avoid conflicts with CPack.
Since most code inside host library doesn't really have to do with the
emulated PS Vita environment but rather with handling the different
package formats used in the console, this commit moves the code from
the host library into its own dedicated library. In summary:
- Moved package code into its own library and edited function calls
to accomodate the change
- Edited some function interfaces in order not to cause a dependency
hell due to cross-referenced types in headers that depended in
one another and edited function calls and resource access to accomodate
the change
- copy_directories() and copy_path() from `vita3k/interface.cpp` have
been modified and moved to io library due to being used in package
library and others. Keeping them as they were before causes dependency
hell
- All functions whose interface has been changed now have a Doxygen
comment block explaining the new interface
- host has been declared as an INTERFACE CMake library to fix linking
issues on Windows due to the fact that it doesn't compile C++ source
files anymore