mirror of
https://github.com/SSimco/Cemu.git
synced 2024-11-23 21:39:39 +00:00
Update Windows build instructions
This commit is contained in:
parent
6217276681
commit
8a4abb8bbb
20
BUILD.md
20
BUILD.md
@ -3,20 +3,19 @@
|
|||||||
## Windows
|
## Windows
|
||||||
|
|
||||||
Prerequisites:
|
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
|
- 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`
|
1. Run `git clone --recursive https://github.com/cemu-project/Cemu`
|
||||||
2. Launch `Cemu/generate_vs_solution.bat`.
|
2. Open the newly created Cemu directory in Visual Studio using the "Open a local folder" option
|
||||||
- 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. In the menu select Project -> Configure CMake. Wait until it is done, this may take a long time
|
||||||
3. Wait until it's done, then open `Cemu/build/Cemu.sln` in Visual Studio.
|
4. You can now build, run and debug Cemu
|
||||||
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.
|
|
||||||
|
|
||||||
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
|
## Linux
|
||||||
|
|
||||||
@ -46,7 +45,8 @@ To compile Cemu, a recent enough compiler and STL with C++20 support is required
|
|||||||
5. You should now have a Cemu executable file in the /bin folder, which you can run using `./bin/Cemu_release`.
|
5. You should now have a Cemu executable file in the /bin folder, which you can run using `./bin/Cemu_release`.
|
||||||
|
|
||||||
#### Using GCC
|
#### 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).
|
While we build 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 GCC by doing the following:
|
You can use GCC by doing the following:
|
||||||
- make sure you have g++ installed in your system
|
- make sure you have g++ installed in your system
|
||||||
- installation for Ubuntu and derivatives: `sudo apt install g++`
|
- installation for Ubuntu and derivatives: `sudo apt install g++`
|
||||||
|
@ -15,7 +15,7 @@ Cemu comes with a `.clang-format` file which is supported by most IDEs for forma
|
|||||||
|
|
||||||
## About types
|
## About types
|
||||||
|
|
||||||
Cemu provides it's own set of basic fixed-width types. They are:
|
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.
|
`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
|
## When and where to put brackets
|
||||||
@ -48,7 +48,7 @@ In UI related code you can use `formatWxString`, but be aware that number format
|
|||||||
|
|
||||||
## Strings and encoding
|
## Strings and encoding
|
||||||
|
|
||||||
We use UTF-8 encoded `std::string` where possible. Some conversations need special handling and we have helper functions for those:
|
We use UTF-8 encoded `std::string` where possible. Some conversions need special handling and we have helper functions for those:
|
||||||
```cpp
|
```cpp
|
||||||
// std::filesystem::path <-> std::string (in precompiled.h)
|
// std::filesystem::path <-> std::string (in precompiled.h)
|
||||||
std::string _pathToUtf8(const fs::path& path);
|
std::string _pathToUtf8(const fs::path& path);
|
||||||
@ -69,7 +69,7 @@ If you want to write to log.txt use `cemuLog_log()`. The log type parameter shou
|
|||||||
|
|
||||||
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.
|
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 litte-endian!
|
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.
|
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`
|
For big-endian types add the suffix `be`. Example: `uint32be`
|
||||||
|
@ -28,16 +28,6 @@ namespace coreinit
|
|||||||
osLib_returnFromFunction64(hCPU, osTime);
|
osLib_returnFromFunction64(hCPU, osTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64 coreinit_getTimeBase_dummy()
|
|
||||||
{
|
|
||||||
return __rdtsc();
|
|
||||||
}
|
|
||||||
|
|
||||||
void export_OSGetSystemTimeDummy(PPCInterpreter_t* hCPU)
|
|
||||||
{
|
|
||||||
osLib_returnFromFunction64(hCPU, coreinit_getTimeBase_dummy());
|
|
||||||
}
|
|
||||||
|
|
||||||
void export_OSGetSystemTime(PPCInterpreter_t* hCPU)
|
void export_OSGetSystemTime(PPCInterpreter_t* hCPU)
|
||||||
{
|
{
|
||||||
osLib_returnFromFunction64(hCPU, coreinit_getTimerTick());
|
osLib_returnFromFunction64(hCPU, coreinit_getTimerTick());
|
||||||
@ -371,14 +361,13 @@ namespace coreinit
|
|||||||
void InitializeTimeAndCalendar()
|
void InitializeTimeAndCalendar()
|
||||||
{
|
{
|
||||||
osLib_addFunction("coreinit", "OSGetTime", export_OSGetTime);
|
osLib_addFunction("coreinit", "OSGetTime", export_OSGetTime);
|
||||||
osLib_addFunction("coreinit", "OSGetSystemTime", export_OSGetSystemTimeDummy);
|
osLib_addFunction("coreinit", "OSGetSystemTime", export_OSGetSystemTime);
|
||||||
osLib_addFunction("coreinit", "OSGetTick", export_OSGetTick);
|
osLib_addFunction("coreinit", "OSGetTick", export_OSGetTick);
|
||||||
osLib_addFunction("coreinit", "OSGetSystemTick", export_OSGetSystemTick);
|
osLib_addFunction("coreinit", "OSGetSystemTick", export_OSGetSystemTick);
|
||||||
|
|
||||||
cafeExportRegister("coreinit", OSTicksToCalendarTime, LogType::Placeholder);
|
cafeExportRegister("coreinit", OSTicksToCalendarTime, LogType::Placeholder);
|
||||||
cafeExportRegister("coreinit", OSCalendarTimeToTicks, LogType::Placeholder);
|
cafeExportRegister("coreinit", OSCalendarTimeToTicks, LogType::Placeholder);
|
||||||
|
|
||||||
osLib_addFunction("coreinit", "OSGetSystemTime", export_OSGetSystemTime);
|
|
||||||
|
|
||||||
//timeTest();
|
//timeTest();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user