Skip to content

Commit

Permalink
Update Windows build instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
Exzap committed Sep 29, 2023
1 parent 6217276 commit 8a4abb8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 25 deletions.
20 changes: 10 additions & 10 deletions BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,19 @@
## 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

Expand Down Expand Up @@ -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`.

#### 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:
- make sure you have g++ installed in your system
- installation for Ubuntu and derivatives: `sudo apt install g++`
Expand Down
6 changes: 3 additions & 3 deletions CODING_STYLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Cemu comes with a `.clang-format` file which is supported by most IDEs for forma

## 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.

## When and where to put brackets
Expand Down Expand Up @@ -48,7 +48,7 @@ In UI related code you can use `formatWxString`, but be aware that number format

## 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
// std::filesystem::path <-> std::string (in precompiled.h)
std::string _pathToUtf8(const fs::path& path);
Expand All @@ -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.
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.
For big-endian types add the suffix `be`. Example: `uint32be`
Expand Down
13 changes: 1 addition & 12 deletions src/Cafe/OS/libs/coreinit/coreinit_Time.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,6 @@ namespace coreinit
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)
{
osLib_returnFromFunction64(hCPU, coreinit_getTimerTick());
Expand Down Expand Up @@ -371,14 +361,13 @@ namespace coreinit
void InitializeTimeAndCalendar()
{
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", "OSGetSystemTick", export_OSGetSystemTick);

cafeExportRegister("coreinit", OSTicksToCalendarTime, LogType::Placeholder);
cafeExportRegister("coreinit", OSCalendarTimeToTicks, LogType::Placeholder);

osLib_addFunction("coreinit", "OSGetSystemTime", export_OSGetSystemTime);

//timeTest();
}
Expand Down

0 comments on commit 8a4abb8

Please sign in to comment.