This is used by svcControlProcessMemory and maps memory as Locked/AliasCode pair.
Also fixed a bug where map didn't apply specified permissions to the alias memory
There is no external use of PhysicalToVirtualAddress any more, so it there is no need to have a generic function that handles all physical regions. Also, the previous APT change makes it possible that linear heap has some regions mapped to old and new VAddr regions at the same time, so we need to check both region and mark cached for the mapped one. RasterizerMarkRegionCached would skip the unmapped one in its loop
* Kernel: reimplement memory management on physical FCRAM
* Kernel/Process: Unmap does not care the source memory permission
What game usually does is after mapping the memory, they reprotect the source memory as no permission to avoid modification there
* Kernel/SharedMemory: zero initialize new-allocated memory
* Process/Thread: zero new TLS entry
* Kernel: fix a bug where code segments memory usage are accumulated twice
It is added to both misc and heap (done inside HeapAlloc), which results a doubled number reported by svcGetProcessInfo. While we are on it, we just merge the three number misc, heap and linear heap usage together, as there is no where they are distinguished.
Question: is TLS page also added to this number?
* Kernel/SharedMemory: add more object info on mapping error
* Process: lower log level; SharedMemory: store phys offset
* VMManager: add helper function to retrieve backing block list for a range
Processes can keep some Thread/Timer object alive while the manager is already destructed, resulting use-after-free in Thread::Stop and Timer::dtor. To resolve this, the manager objects should be destructed after all related object destructed.
Fixes a bug where quiting citra causes crash while the game is using a Timer.
Fix a warning where class definition and forward declaration mismatch. CodeSet is a kernel object and have ctor/dtor/private members like others, so in convention it should be a class
To obtain the data, the LLEd mii selector of system version 11.8.0 was used.
In AppletManager::GlanceParameter, the following code was added to write the returned buffer data to a file:
if (parameter.buffer.size() == 132) {
std::u16string name(10, '\0');
std::memcpy(name.data(), parameter.buffer.data() + 0x26, 10 * sizeof(u16));
name = std::u16string(name.data());
FileUtil::IOFile file{fmt::format("{}.mii", Common::UTF16ToUTF8(name)), "wb"};
file.WriteBytes(parameter.buffer.data(), parameter.buffer.size());
}
Then "xxd -i" was used on the file to convert it to a hex array.
* FileSys/DelayGenerator: add missing #include and virtual dtor
Added the needed include so that it won't cause error if another file includes this without including the depended files
Deleting a virtual class via base type without virtual dtor is UB, which happens inFileBackend.
* FileSys/DelayGenerator: move function definition into cpp file/n/nTo avoid generating vtable in all units that includes the header file
* filesys/delay_generator: rearrange #include
* Initial implementation
* Various fixes and new features
* Address some review comments
* Fixes
* Address more comments
* Use g_hle_lock
* Add more state checking, remove unneeded include
* Minor changes
Now that all external dependencies are hidden, we can remove
json-headers from the publically linked libraries, as the use of this
library is now completely hidden from external users of the web_service
library. We can also make the web_services library private as well,
considering it's not a requirement. If a library needs to link in
web_service, it should be done explicitly -- not via indirect linking.
Two functional change:
QueryProcessMemory uses the process passed from handle instead current_process
Thread::Stop() uses TLS from owner_process instead of current_process
This should be using the process instance retrieved within the function,
and not g_current_process, otherwise this is potentially comparing
iterators from unrelated vma_map instances (which is undefined
behavior).
The real console can't launch an Application directly from within another Application so it has to go through the Home Menu. We do not have such limitation and can directly launch the requested title.
* Core: pass down Core::System reference to all services
This has to be done at once due to unified interface used by HLE/LLE switcher
* apt: eliminate Core::System::GetInstance
* gpu_gsp: eliminate Core::System::GetInstance in service
* hid: eliminate Core::System::GetInstance
* nwm: eliminate Core::System::GetInstance
* err_f: eliminate Core::System::GetInstance
These functions are pretty much identical to BeginImportProgram and EndImportProgram.
We don't need to do anything special in EndImportProgramWithoutCommit and CommitImportPrograms because we don't need to implement the two-phase title installation that the 3DS uses to prevent corruption of the title.db.
FS subfiles are created with File::OpenSubFile, they have a start offset that must be added to all read/write operations.
The implementation in this commit is done using a new FileBackend that wraps the FS::File along with the start offset.
Frame advancing is a commonly used TAS feature which basically means running the game frame by frame. TASers use this feature to press exact buttons at the exact frames. This commit added frame advancing to the framelimiter and two actions to the Movie menu. The default hotkey is `\` for advancing frames, and `Ctrl+A` for toggling frame advancing. The `Advance Frame` hotkey would automatically enable frame advancing if not already enabled.
boost::static_pointer_cast for boost::intrusive_ptr (what SharedPtr is),
takes its parameter by const reference. Given that, it means that this
std::move doesn't actually do anything other than obscure what the
function's actual behavior is, so we can remove this. To clarify, this
would only do something if the parameter was either taking its argument
by value, by non-const ref, or by rvalue-reference.
This adds a clock init time field to the CTM header. The clock settings would be overridden when playing a movie. And when recording a movie, if the clock is set to System Time, it would be set to fixed init time at the current moment as well. In this way this keeps consistency with the RNG even if the user does just no setting.
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.
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.
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.
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.
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.
* 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
Given these functions aren't intended to be used frequently, there's no
need to keep the std::string instances allocated for the whole lifetime
of the program. It's just a waste of memory.
Despite being covered by a global mutex, we should still ensure that the
class handles its reference counts properly. This avoids potential
shenanigans when it comes to data races.
Given this is the root object that drives quite a bit of the kernel
object hierarchy, ensuring we always have the correct behavior (and no
races) is a good thing.
Shared fonts is no different from any other system archives, and there is not really any point to make a separate status for it. This also fixes the incorrect error message that was introduced when I made the UI text improvements.
* Add setting to switch between a fixed start time and the system time
Add clock settings to SDL
Make clock configureable in qt
Add a SharedPage handler class
Init shared_page_handler for tests
Rather than having to type out the full std::map type signature, we can
just use a straightforward alias. While we're at it, rename
GetBreakpointList to GetBreakpointMap, which makes the name more
accurate. We can also get rid of unnecessary u64 static_casts, since
VAddr is an alias for a u64.
…class
Makes the global a member of the RendererBase class. We also change this
to be a reference. Passing any form of null pointer to these functions
is incorrect entirely, especially given the code itself assumes that the
pointer would always be in a valid state.
This also makes it easier to follow the lifecycle of instances being
used, as we explicitly interact the renderer with the rasterizer, rather
than it just operating on a global pointer.
* kernel/event: Make data members private
Instead we can simply provide accessors to the required data instead of
giving external read/write access to the variables directly.
* fix compile error
* client_port: Make all data members private
These members don't need to be entirely exposed, we can instead expose
an API to operate on them without directly needing to mutate them
We can also guard against overflow/API misuse this way as well, given
active_sessions is an unsigned value.
* make the condition an assert
Using member variables for referencing the segments array increases the
size of the class in memory for little benefit. The same behavior can be
achieved through the use of accessors that just return the relevant
segment.
General moving to keep kernel object types separate from the direct
kernel code. Also essentially a preliminary cleanup before eliminating
global kernel state in the kernel code.
- Can be used in either DynCom or Dynarmic mode
- Added support for threads
- Proper support for FPU registers
- Fix for NibbleToHex conversion that used to produce false error codes
- Fix for clang-format failing under Windows
* NWM_UDS: use sizeof(<var being used>) instead of hard-coded type
Intend to fix#4090.
` node_map.node.second` type was changed to `u16` in #3985. However the type change wasn't reflected here. Should have used variable name instead to automatically do type change
* NWM_UDS: ... and also the node.first one
* NWM_UDS: ... and here
* Network: bump version because we changed UDS packet layout
* Update nwm_uds.cpp
Avoids using a u32 to compare against a range of size_t, which can be a
source of warnings. While we're at it, compress a std::tie into a
structured binding.
Gets rid of the need to hardcode the type in multiple places. This will
now be deduced automatically, based off the elements in the container
being provided to the algorithm.