- GX2 utilizes TCL(.rpl) API for command submission instead of directly writing to an internal GPU fifo
- Submission & retire timestamps are correctly implemented as incremental counters
- Command buffering behaviour matches console
- Fixes race conditions on aarch64
This option still allows you to have proper stack traces for crashes or for the PPC debugger, but is a lot faster then the really slow interpreter (especially when loading into large games like BotW where there has to be a lot of asset decompressing). It makes memory access breakpoints much more brittle though, so it's not a perfect option.
Normal users should of course stick with using the recompiler.
Commit b089ae5b32 changed the PPCInterpreter struct that external plugins rely on to hook Cemu through e.g. the exported "osLib_registerHLEFunction". This commit moves some unused values down so that it keeps the same memory layout as before the PPC recompiler rework.
This reverts commit 372c314f06.
It broke formatting in an attempt to fix GCC builds.
Some other change (perhaps dependency updates) has resolved the issue.
We were using VK_EXT_DEPTH_CLIP_ENABLE but didn't actually request it.
Also fixed an assert when closing Cemu caused by incorrectly tracking the number of allocated pipelines
This allows a savy user, developer or modder to change the comment field of a logging breakpoint to include placeholders such as {r3} or {f3} to log the register values whenever that code is hit.
The result is treated as signed in most cases, but the calculation uses unsigned arithmetic.
As a concrete example where this matters, DS VC passes -1 (2^64-1) to OSWaitEventWithTimeout which internally causes an overflow. But only with unsigned arithmetic this will result in a large positive number that behaves like the intended infinite timeout. With signed arithmetic the result is negative and the events will timeout immediately.
- ErrEula doesn't disappear on its own anymore. The expected behavior is for the game to call Disappear once a button has been selected. This fixes issues where the dialog would softlock in some games
- Modernized code a bit
- Added a subtle fade in/out effect
- Fixes a bug where corrupted data would be returned when reading files from unhashed sections with non-block aligned offset or size
- Added hash checks for all reads where possible. This means that FST now can automatically catch corruptions when they are encountered while reading from the volume
The location of the shaderCache path is different for non-portable cases so let's not confuse the user by shipping with a precreated directory that isn't actually used
The logtype "APIErrors" previously was always enabled. This option is intended to help homebrew developers notice mistakes in how they use CafeOS API. But some commercial games trigger these a lot and cause log.txt bloat (e.g. seen in XCX). Thus this commit changes it so that it's off by default and instead can be toggled if desired.
Additionally in this commit:
- COS module logging options are no longer translatable (our debug logging is fundamentally English)
- Restructured the log menu and moved the logging options that are mainly of interest to Cemu devs into a separate submenu
- Full reimplementation of proc_ui.rpl with all 19 exports
- Foreground/Background messages now go to the coreinit system message queue as they should (instead of using a hack where proc_ui receives them directly)
- Add missing coreinit API needed by proc_ui: OSGetPFID(), OSGetUPID(), OSGetTitleID(), __OSCreateThreadType()
- Use big-endian types in OSMessage
- Flesh out the stubs for OSDriver_Register and OSDriver_Unregister a bit more since we need to call it from proc_ui. Similiar small tweaks to other coreinit API
- Stub sysapp SYSSwitchToEManual() and _SYSSwitchToEManual() in such a way that they will trigger the expected background/foreground transition, avoiding softlocks in games that call these functions
- Download manager now always uses Nintendo servers. Requires only a valid OTP and SEEPROM dump so you can use it in combination with a Pretendo setup even without a NNID
- Account drop down removed from download manager since it's not required
- Internally all our API requests now support overriding which service to use
- Drop support for act-url and ecs-url command line parameters. Usage of network_services.xml ("custom" option in the UI) is preferred
Fixes the issue where the friend service connection would always timeout on Pretendo servers
The individual changes are:
- Outgoing ping packets now use their own incrementing sequenceId (matches official NEX behavior)
- If the server sends us a ping packet with NEEDS_ACK, we now respond
- Misc smaller refactoring and code clean up
- Added PRUDP as a separate logging option
Fixes friend service connection periodically timing-out on Pretendo.
Seems that unlike Nintendo's servers, Pretendo doesn't set sessionId for PING ack packets.
Fixes error 106-0526 when opening course world on Super Mario Maker
Manually attaching Content-Length header for POST requests is undefined behavior on recent libcurl.
To detect the bad case some refactoring was necessary. In general we should try to move away from directly forwarding curl_easy_setopt() to the underlying instance as the behavior is diverging in modern libcurl. Much more refactoring work is required in the future to fix all of this.
Added ACPGetOlvAccesskey() which is used by Super Mario Maker
iosu acp, nn_acp and nn_save all cross talk with each other and are mostly legacy code. Modernized it a tiny bit and moved functions to where they should be. A larger refactor should be done in the future but for now this works ok
Lots of internal changes. On the surface this only fixes a crash in Mario & Sonic Rio 2016 (at least what I saw from my testing) but it may affect more games.
Summary of changes:
- Rewrite code to use newer cafeExportRegisterFunc
- Simplify code by merging namespaces and structs of the same types
- Correctly set ppc vtables for the virtual boss classes
- Fix some wrong function definitions and implement a little bit more of the boss API (mainly constructors and destructors)
This instruction is used by Injustice: Gods Among Us and Project Zero
Also improved robustness of rendering to be less prone to crashing when a game tries to draw with broken shaders
The optimization for colorbuffer resolution introduced in PR #706 is now enabled. This optimization changes the resolution of certain framebuffer textures, which may conflict with the texture resolution rules set by some graphic packs. As a result, if a graphic pack that specifies texture resolution rules is in use, the optimization will automatically be turned off to prevent any issues.
To circumvent this, graphic packs can now include the setting "colorbufferOptimizationAware = true" in their rules.txt. This setting indicates that the pack has been updated to handle the resolution changes introduced by the optimization. Cemu will allow the optimization to remain enabled if resolution packs have this flag set.
- Windows icons are stored as .ico files to %LOCALAPPDATA%/Cemu/icons/
- Long title names chosen as some games (NSMBU + NSLU) add trailing dots for their shortnames
- Long title names have their newlines replaced with spaces at parsing
- Linux shortcut paths are saved with UTF-8 encoding
- Game titles are copied and saved with UTF-8 encoding
"Intel legacy mode" was a special mode to workaround various Intel OpenGL driver limitations during the earlier years of Cemu. It's been unmaintained for years and no longer serves a purpose.
If we ever bring back compatibility with ancient Intel GPUs it should be done in a more structured way than a blunt yes/no flag.
Besides a general cleanup:
- Remove deprecated resource destruction queues
- Move functionality from renderer into Latte base classes to deduplicate code
Graphic packs can overwrite the format of a texture (e.g. for higher bitdepth to lessen banding) but the code for this wasn't correctly working anymore.
- Fixes overwrite format being ignored for texture views on Vulkan backend
- Fixes overwrite format not being used for texture views on OpenGL
Format aliasing is complicated enough as it is, even without overwrites, so this adds a new rule to make behavior more well defined: If two textures share memory but only one uses an overwrite format, then they are no longer synchronized and are considered separate textures.
Bonus fixes for OpenGL:
- Use fbo 0 instead of -1 as the default. This silences some warnings in debug output
- On OpenGL, bind new framebuffers on handle generation so they are considered created
- Use cafeExportRegister() instead of legacy export
- Submit as a single PM4 packet
- Add logging for the special case of the size parameter (not sure if this is used by any game?)
- Add some extra validation and logging which may be helpful to homebrew devs
This reverts commit 8f1cd4f925.
We received reports from users stuck with Vulkan drivers from 2019. (E.g. Kepler on Windows). So let's not unnecessarily increase the Vulkan requirement for now and postpone this to after the next stable release
If a title exists multiple times in the game folder in different formats, then prefer and use non-NUS format if one is available. This is so we match previous Cemu behavior where Cemu would pick non-NUS simply due the fact that NUS format wasn't supported yet.
- Print more detailed paths in confirmation dialogue
- Prefer the title right clicked by the user
- When sourcing titles from other .wua files, use the correct subpath
Fix include path
* Add '--title-id' launch option to launch titles by title id
* Add title id column to game list
* Add option to create game shortcuts
Co-authored-by: Exzap <13877693+Exzap@users.noreply.github.com>
- Initialize
- Download communities (self-made / favorites / officials)
- Upload communities (create subcommunity)
- Upload favorite status (Add/Delete favorite to a subcommunity)
Enough for support of Mario Kart 8 tournaments
* script changes - no arguments
* script changes with 2 arguments
* script changes with > 2 arguments
* script conversions with 1 argument - pt. 1
* script conversions with 1 argument - pt. 2
* script conversions with 1 argument - pt. 3
* script conversions with 1 argument - pt. 4
* script conversions with 1 argument - pt. 5
Pointer format hunting
* Fixed pointer format
* script conversions with 1 argument - final
* fixed conversion in non utf-8 file
* fixed conversion with capital letter
* actually fixed conversion with capital letter
* fixed another capital lettering issue
* Added conversions with LR removed
* removed LR from logs
* Converted logs that previously contained LR
* converted log that originally specified string length
* fixed log with commas in main text
* fixed multi-line log
* Fixed more logs with commas in main text
* Fixed unformatted pointer
* added conversion with float value
* converted lines with double parameters
* converted missed line
* corrected argument formatting
Co-authored-by: Crementif <26669564+Crementif@users.noreply.github.com>
* Fixed misspellings of "unhandled"
unhandeled -> unhandled
Co-authored-by: Crementif <26669564+Crementif@users.noreply.github.com>
---------
Co-authored-by: Crementif <26669564+Crementif@users.noreply.github.com>
When a thread was force-rescheduled (e.g. via OSYieldThread) the next time it resumed it would not reset the time slice duration (remainingCycles) back to ppcThreadQuantum. As a consequence threads were often immediately rescheduled and only on the next turn they would get their full time slice.
Aside from (very slightly) improving performance, this also fixes the OSDisableInterrupts warning spam in the log for TPHD.
* Implement GDB stub debugger
Can be enabled by using the "--enable-gdbstub" option (and the debugger GUI, although that's untested) which'll pause any game you launch at start-up. Will start at port 1337 although it'll eventually be user-editable. The code is a bit weirdly sorted and also just needs a general cleanup, so expect that eventually too. And uses egyptian braces but formatting was easier to do at the end, so that's also something to do.
It has been tested to work with IDA Pro, Clion and the standalone interface for now, but I plan on writing some instructions in the PR to follow for people who want to use this. Memory breakpoints aren't possible yet, only execution breakpoints.
This code was aimed to be decoupled from the existing debugger to be able to be ported to the Wii U for an equal debugging experience. That's also why it uses the Cafe OS's thread sleep and resuming functions whenever possible instead of using recompiler/interpreter controls.
* Add memory writing and floating point registers support
* Reformat code a bit
* Format code to adhere to Cemu's coding style
* Rework GDB Stub settings in GUI
* Small styling fixes
* Rework execution breakpoints
Should work better in some edge cases now. But this should also allow for adding access breakpoints since it's now more separated.
* Implement access breakpoints
* Fix some issues with breakpoints
* Fix includes for Linux
* Fix unnecessary include
* Tweaks for Linux compatibility
* Use std::thread instead of std::jthread to fix MacOS support
* Enable GDB read/write breakpoints on x86 only
* Fix compilation for GCC compilers at least
The thread type varies on some platforms, so supporting this is hell... but let's get it to compile on MacOS first.
* Disable them for MacOS due to lack of ptrace
---------
Co-authored-by: Exzap <13877693+Exzap@users.noreply.github.com>
By mistake we would read affected textures back after every single drawcall. As an optimization if the same texture gets drawn to multiple times we'll try to only read it back once at the end of the sequence.
SDL_GameControllerFromInstanceID does not increase internal ref counter.
Fixes a crash when removing an SDL controller that is in use by another profile
* Add en resource and change language selection for macos user that don't have US as their system region
* default to English if the system language is unavailable
std::unordered_set is implemented as a flat hashtable on libstdc++ which makes clearing expensive due to invoking memset on the entire table. To get the best performance across all platforms this replaces the unordered_set with a custom high-performance sparse bitset
- Controller profile filenames now encode unicode characters correctly
- Removed dependency on boost::filesystem. There is still an indirect dependency on it from another boost module it seems
- Refactored some code to use FileStream instead of ifstream/ofstream
On MacOS this fixes the framerate being too high due to discontinuities in the timer that drives the emulated vsync. It also fixes behavior of the GetTickCount() wrapper.
Removes the -DPUBLIC_RELEASE flag. Cemu's debug asserts are now only enabled if the build configuration is Debug. Similarly, on Windows the console is only shown for Debug builds.
Most people following the guide are currently not really developers and this was a fairly hidden option that's easily missed.
The disabled version will later change to be an actual custom cmake target instead of a preprocessor flag, but that'll require more code to be adjusted.
Not using the flag means that Cemu keeps some (performance-costing) debug checks in, alongside more logging and a debug logging console on Windows.
- Fixed an issue where the toolbar icons for the debugger were resized to 1x1
- On Windows we now load the PNG UI icons from the header-embedded pngs (`resource/embedded`) instead of via `cemu.rc` to match behavior of other platforms
* fixed building on macos, needs OBJC and OBJXX to be enabled
* changed to weak ordering due to string comparison not being strong ordering
* Use raw PNG bytes from "resource/embedded/resources.h" in all windows too
When a game tries to generate Miis without the FFL files being dumped (<mlc>/sys/title/0005001b/10056000/content/) it will cause it to create and use a texture with invalid parameters.
This workaround catches and replaces bad texture parameters to avoid crashing further down the line.
Resolves crashes in Sonic Lost World, Super Mario 3D World and probably a few others.
We had this workaround in pre-2.0 Cemu already but it was dropped during refactoring.
Refactored to pre-calculate the game list row colors at the beginning of the function. If the background color is almost white as it is on Windows, we'll use the previous bluish secondary color instead of grey-scale lightness adjustment.
about: Tech support does not belong here. You should only file an issue here if you think you have experienced an actual bug with Cemu or you are requesting a feature you believe would make Cemu better.
title: ''
labels: ''
assignees: ''
---
<!---
Please keep in mind Cemu is EXPERIMENTAL SOFTWARE.
Please read the FAQ:
https://cemu.info/faq.html/
THIS IS NOT A SUPPORT FORUM, FOR SUPPORT GO TO:
https://discord.com/invite/5psYsup/
If the FAQ does not answer your question, please go to:
https://discord.com/invite/5psYsup/
When submitting an issue, please check the following:
- You have read the above.
- You have provided the version (commit hash) of Cemu you are using.
- You have provided sufficient detail for the issue to be reproduced.
- You have provided system specs (if relevant).
- Please also provide:
- For any issues, a log file
- For crashes, a backtrace.
- For graphical issues, comparison screenshots with real hardware.
- For emulation inaccuracies, a test-case (if able).
about:If you are experiencing an issue with Cemu, and you need tech support, or if you have a general question, try asking in the official Cemu Discord linked here. Piracy is not allowed.
about:If you need technical support with Cemu or have other questions the best place to ask is on the official Cemu Discord linked here
If you discovered a bug you can report it here. Please make sure of the following first:
- That you are using the latest version of Cemu
- Only report something if you are sure it's a bug and not any technical issue on your end. For troubleshooting help see the [links page](https://github.com/cemu-project/Cemu#links)
- Problems specific to a single game should be reported on the [compatibility wiki](https://wiki.cemu.info/wiki/Main_Page) instead
- Verify that your problem isn't already mentioned on the [issue tracker](https://github.com/cemu-project/Cemu/issues)
Additionally, be aware that graphic packs can also causes issues. There is a separate issue tracker for graphic pack bugs over at the [graphic pack repository](https://github.com/cemu-project/cemu_graphic_packs)
- type:textarea
id:current_behavior
attributes:
label:Current Behavior
description:"What the bug is, in a brief description"
validations:
required:true
- type:textarea
id:expected_behavior
attributes:
label:Expected Behavior
description:"What did you expect to happen?"
validations:
required:true
- type:textarea
id:steps_to_reproduce
attributes:
label:Steps to Reproduce
description:"How to reproduce the issue"
validations:
required:true
- type:textarea
id:sys_info
attributes:
label:System Info (Optional)
description:"Your PC specifications. Usually only the operating system and graphics card is important. But feel free to add more info."
placeholder:|
Info
OS:Windows 10
GPU:NVIDIA GeForce RTX 4090
value:|
OS:
GPU:
- type:textarea
id:emulation_settings
attributes:
label:Emulation Settings (Optional)
description:|
Any non-default settings. You can leave this empty if you didn't change anything other than input settings.
validations:
required:false
- type:textarea
id:logs_files
attributes:
label:"Logs (Optional)"
description:|
"Attach `log.txt` from your Cemu folder (*File > Open Cemu folder*)".
While we appreciate suggestions, it is important to note that we are a very small team and there are already many more ideas than we could ever implement in the near future. Therefore, please only suggest something if you believe it is a great addition and the idea is reasonably unique.
*Avoid*to create suggestions for:
- Overly obvious features ("Game xyz does not work and should be fixed", "Wiimote support should be improved", "You should add an Android port", "Copy feature xyz from another emulator", "A button to pause/stop emulation")
- Niche features which are only interesting to a tiny percentage of users
- Large scale features ("Add a Metal backend for MacOS", "Add ARM support", "Add savestates")
Note that this doesn't mean we aren't interested in these ideas, but rather we likely have them planned anyway and it's mostly up to finding the time to implement them.
If you believe your idea is worthwhile even if it doesn't meet all the criteria above, you can still try suggesting it but we might close it.
- type:textarea
id:idea_suggestion
attributes:
label:Your suggestion
description:"Describe what your suggestion is in as much detail as possible"
- [Build Cemu using CMake](#build-cemu-using-cmake)
- [Updating Cemu and source code](#updating-cemu-and-source-code)
## Windows
Prerequisites:
- A recent version of Visual Studio 2022 (recommended but not required) with the following additional components:
- C++ CMake tools for Windows
- Windows 10/11 SDK
- git
- A recent version of Visual Studio 2022 with the following additional components:
- C++ CMake tools for Windows
- Windows 10/11 SDK
Instructions:
Instructions for Visual Studio 2022:
1. Run `git clone --recursive https://github.com/cemu-project/Cemu`
2. Launch `Cemu/generate_vs_solution.bat`.
- If you installed VS to a custom location or use VS 2019, you may need to manually change the path inside the .bat file
3. Wait until it's done, then open `Cemu/build/Cemu.sln` in Visual Studio
4. Then build the solution and once finished you can run and debug it, or build it and check the /bin folder for the final Cemu_release.exe.
2. Open the newly created Cemu directory in Visual Studio using the "Open a local folder" option
3. In the menu select Project -> Configure CMake. Wait until it is done, this may take a long time
4. You can now build, run and debug Cemu
You can also skip steps 3-5 and open the root folder of the cloned repo directly in Visual Studio (as a folder) and use the built-in cmake support but be warned that cmake support in VS can be a bit finicky.
Any other IDE should also work as long as it has CMake and MSVC support. CLion and Visual Studio Code have been confirmed to work.
## Linux
To compile Cemu, a recent enough compiler and STL with C++20 support is required! clang-12 or higher is what we recommend.
To compile Cemu, a recent enough compiler and STL with C++20 support is required! Clang-15 or higher is what we recommend.
* Add the following and try running the command again:
* `-DCMAKE_MAKE_PROGRAM=/usr/bin/ninja`
* Compiling failed during the boost-build dependency.
* It means you don't have a working/good standard library installation. Check the integrity of your system headers and making sure that C++ related packages are installed and intact.
* Compiling failed during rebuild after `git pull` with an error that mentions RPATH
* Add the following and try running the command again:
* `-DCMAKE_BUILD_WITH_INSTALL_RPATH=ON`
* Environment variable `VCPKG_FORCE_SYSTEM_BINARIES` must be set.
* Execute the folowing and then try running the command again:
* `export VCPKG_FORCE_SYSTEM_BINARIES=1`
* If you are getting a random error, read the [package-name-and-platform]-out.log and [package-name-and-platform]-err.log for the actual reason to see if you might be lacking the headers from a dependency.
If you are getting a different error than any of the errors listed above, you may either open an issue in this repo or try using [GCC](#gcc). Make sure your standard library and compilers are updated since Cemu uses a lot of modern features!
##### Building Errors
This section refers to running `cmake --build build`.
* `main.cpp.o: in function 'std::__cxx11::basic_string...`
* You likely are experiencing a clang-14 issue. This can only be fixed by either lowering the clang version or using GCC, see [GCC](#gcc).
* `fatal error: 'span' file not found`
* You're either missing `libstdc++` or are using a version that's too old. Install at least v10 with your package manager, eg `sudo apt install libstdc++-10-dev`. See [#644](https://github.com/cemu-project/Cemu/issues/644).
* `undefined libdecor_xx`
* You are likely experiencing an issue with sdl2 package that comes with vcpkg. Delete sdl2 from vcpkg.json in source file and recompile.
If you are getting a different error than any of the errors listed above, you may either open an issue in this repo or try using [GCC](#gcc). Make sure your standard library and compilers are updated since Cemu uses a lot of modern features!
## macOS
To compile Cemu, a recent enough compiler and STL with C++20 support is required! LLVM 13 and below
don't support the C++20 feature set required, so either install LLVM from Homebrew or make sure that
you have a recent enough version of Xcode. Xcode 15 is known to work. The OpenGL graphics API isn't
supported on macOS, so Vulkan must be used through the Molten-VK compatibility layer.
5. You should now have a Cemu executable file in the /bin folder, which you can run using `./bin/Cemu_release`.
#### Using GCC
While we use and test Cemu using clang, using GCC might work better with your distro (they should be fairly similar performance/issues wise and should only be considered if compilation is the issue).
You can use it by replacing the step 3 with the following:
- If step 3 gives you an error about not being able to find ninja, try appending `-DCMAKE_MAKE_PROGRAM=/usr/bin/ninja` to the command and running it again.
- If step 3 fails while compiling the boost-build dependency, it means you don't have a working/good standard library installation. Check the integrity of your system headers and making sure that C++ related packages are installed and intact.
- If step 3 gives a random error, read the `[package-name-and-platform]-out.log` and `[package-name-and-platform]-err.log` for the actual reason to see if you might be lacking the headers from a dependency.
- If step 3 is still failing or if you're not able to find the cause, please make an issue on our Github about it!
- If step 4 gives you an error that contains something like `main.cpp.o: in function 'std::__cxx11::basic_string...`, you likely are experiencing a clang-14 issue. This can only be fixed by either lowering the clang version or using GCC, see below.
- If step 4 gives you a different error, you could report it to this repo or try using GCC. Just make sure your standard library and compilers are updated since Cemu uses a lot of modern features!
- If step 4 gives you undefined libdecor_xx, you are likely experiencing an issue with sdl2 package that comes with vcpkg. Delete sdl2 from vcpkg.json in source file and recompile
- If step 3 gives you an error about not being able to find ninja, try appending `-DCMAKE_MAKE_PROGRAM=/usr/local/bin/ninja` to the command and running it again.
## Updating Cemu and source code
1. To update your Cemu local repository, use the command `git pull --recurse-submodules` (run this command on the Cemu root).
- This should update your local copy of Cemu and all of its dependencies.
2. Then, you can rebuild Cemu using the steps listed above, according to whether you use Linux or Windows.
If CMake complains about Cemu already being compiled or another similar error, try deleting the `CMakeCache.txt` file inside the `build` folder and retry building.
## CMake configure flags
Some flags can be passed during CMake configure to customise which features are enabled on build.
Example usage: `cmake -S . -B build -DCMAKE_BUILD_TYPE=release -DENABLE_SDL=ON -DENABLE_VULKAN=OFF`
This document describes the latest version of our coding-style guidelines. Since we did not use this style from the beginning, older code may not adhere to these guidelines. Nevertheless, use these rules even if the surrounding code does not match.
Cemu comes with a `.clang-format` file which is supported by most IDEs for formatting. Avoid auto-reformatting whole files, PRs with a lot of formatting changes are difficult to review.
## Names for variables, functions and classes
- Always prefix class member variables with `m_`
- Always prefix static class variables with `s_`
- For variable names: Camel case, starting with a lower case letter after the prefix. Examples: `m_option`, `s_audioVolume`
- For functions/class names: Use camel case starting with a capital letter. Examples: `MyClass`, `SetActive`
- Avoid underscores in variable names after the prefix. Use `m_myVariable` instead of `m_my_variable`
## About types
Cemu provides its own set of basic fixed-width types. They are:
`uint8`, `sint8`, `uint16`, `sint16`, `uint32`, `sint32`, `uint64`, `sint64`. Always use these types over something like `uint32_t`. Using `size_t` is also acceptable where suitable. Avoid C types like `int` or `long`. The only exception is when interacting with external libraries which expect these types as parameters.
## When and where to put brackets
Always put curly-brackets (`{ }`) on their own line. Example:
```
void FooBar()
{
if (m_hasFoo)
{
...
}
}
```
As an exception, you can put short lambdas onto the same line:
```
SomeFunc([]() { .... });
```
You can skip brackets for single-statement `if`. Example:
```
if (cond)
action();
```
## Printing
Avoid sprintf and similar C-style formatting API. Use `fmt::format()`.
In UI related code you can use `formatWxString`, but be aware that number formatting with this function will be locale dependent!
## Strings and encoding
We use UTF-8 encoded `std::string` where possible. Some conversions need special handling and we have helper functions for those:
```cpp
// std::filesystem::path <-> std::string (in precompiled.h)
std::string _pathToUtf8(const fs::path& path);
fs::path _utf8ToPath(std::string_view input);
// wxString <-> std::string
wxString wxString::FromUTF8(const std::string& s)
wxString to_wxString(std::string_view str); // in gui/helpers.h
std::string wxString::utf8_string();
```
## Logging
If you want to write to log.txt use `cemuLog_log()`. The log type parameter should be mostly self-explanatory. Use `LogType::Force` if you always want to log something. For example:
`cemuLog_log(LogType::Force, "The value is {}", 123);`
## HLE and endianness
A pretty large part of Cemu's code base are re-implementations of various Cafe OS modules (e.g. `coreinit.rpl`, `gx2.rpl`...). These generally run in the context of the emulated process, thus special care has to be taken to use types with the correct size and endianness when interacting with memory.
Keep in mind that the emulated Espresso CPU is 32bit big-endian, while the host architectures targeted by Cemu are 64bit little-endian!
To keep code simple and remove the need for manual endian-swapping, Cemu has templates and aliases of the basic types with explicit endian-ness.
For big-endian types add the suffix `be`. Example: `uint32be`
When you need to store a pointer in the guest's memory. Use `MEMPTR<T>`. It will automatically store any pointer as 32bit big-endian. The pointer you store must point to memory that is within the guest address space.
## HLE interfaces
The implementation for each HLE module is inside a namespace with a matching name. E.g. `coreinit.rpl` functions go into `coreinit` namespace.
To expose a new function as callable from within the emulated machine, use `cafeExportRegister` or `cafeExportRegisterFunc`. Here is a short example:
- [Cemu's Community Graphic Packs](https://github.com/ActualMandM/cemu_graphic_packs)
- [Cemu's Community Graphic Packs](https://github.com/cemu-project/cemu_graphic_packs)
## Download
You can download the latest Cemu releases from the [GitHub Releases](https://github.com/cemu-project/Cemu/releases/) or from [Cemu's website](https://cemu.info).
You can download the latest Cemu releases for Windows, Linux and Mac from the [GitHub Releases](https://github.com/cemu-project/Cemu/releases/). For Linux you can also find Cemu on [flathub](https://flathub.org/apps/info.cemu.Cemu).
Cemu is currently only available in a portable format so no installation is required besides extracting it in a safe place.
On Windows Cemu is currently only available in a portable format so no installation is required besides extracting it in a safe place.
See [Current State Of Linux builds](https://github.com/cemu-project/Cemu/issues/1) for information on using Cemu natively on Linux.
The native macOS build is currently purely experimental and should not be considered stable or ready for issue-free gameplay. There are also known issues with degraded performance due to the use of MoltenVK and Rosetta for ARM Macs. We appreciate your patience while we improve Cemu for macOS.
Pre-2.0 releases can be found on Cemu's [changelog page](https://cemu.info/changelog.html).
## Build Instructions
To compile Cemu yourself on Windows or Linux, view the [BUILD.md file](/BUILD.md).
To compile Cemu yourself on Windows, Linux or macOS, view [BUILD.md](/BUILD.md).
## Issues
@ -42,11 +43,12 @@ The old bug tracker can be found at [bugs.cemu.info](https://bugs.cemu.info) and
## Contributing
Pull requests are very welcome. For easier coordination you can visit the developer discussion channel on Discord: [https://discord.gg/5psYsup](https://discord.gg/5psYsup).
Pull requests are very welcome. For easier coordination you can visit the developer discussion channel on [Discord](https://discord.gg/5psYsup) or alternatively the [Matrix Server](https://matrix.to/#/#cemu:cemu.info).
Before submitting a pull request, please read and follow our code style guidelines listed in [CODING_STYLE.md](/CODING_STYLE.md).
If coding isn't your thing, testing games and making detailed bug reports or updating the (usually outdated) compatibility wiki is also appreciated!
Questions about Cemu's software architecture can also be answered on Discord. Alternative communication channels (like IRC) are being considered.
Questions about Cemu's software architecture can also be answered on Discord (or through the Matrix bridge).
## License
Cemu is licensed under [Mozilla Public License 2.0](/LICENSE.txt). Exempt from this are all files in the dependencies directory for which the licenses of the original code apply as well as some individual files in the src folder, as specified in those file headers respectively.