Merge remote-tracking branch 'origin/main' into gcc

This commit is contained in:
Tom Lally 2022-08-27 00:12:10 +01:00
commit c102097768
124 changed files with 360 additions and 1017 deletions

View file

@ -1,7 +1,7 @@
name: Build Cemu name: Build Cemu
on: on:
pull_request_target: pull_request:
paths-ignore: paths-ignore:
- "*.md" - "*.md"
types: types:
@ -26,9 +26,6 @@ env:
jobs: jobs:
build-ubuntu: build-ubuntu:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
env:
install_vulkan_folder: "$GITHUB_WORKSPACE/vulkan_sdk"
install_vulkan_version: "1.3.216.0"
steps: steps:
- name: "Checkout repo" - name: "Checkout repo"
uses: actions/checkout@v3 uses: actions/checkout@v3
@ -53,13 +50,9 @@ jobs:
run: | run: |
sudo apt update -qq sudo apt update -qq
sudo apt install -y ninja-build cmake libgtk-3-dev libsecret-1-dev libgcrypt20-dev libsystemd-dev freeglut3-dev clang-12 nasm sudo apt install -y ninja-build cmake libgtk-3-dev libsecret-1-dev libgcrypt20-dev libsystemd-dev freeglut3-dev clang-12 nasm
wget https://sdk.lunarg.com/sdk/download/${{ env.install_vulkan_version }}/linux/vulkansdk-linux-x86_64-${{ env.install_vulkan_version }}.tar.gz -q -O vulkansdk.tar.gz
mkdir -p "${{ env.install_vulkan_folder }}"
tar -xf vulkansdk.tar.gz --directory ${{ env.install_vulkan_folder }}
- name: "Bootstrap vcpkg" - name: "Bootstrap vcpkg"
run: | run: |
export VULKAN_SDK="${{ env.install_vulkan_folder }}/${{ env.install_vulkan_version }}/x86_64"
bash ./dependencies/vcpkg/bootstrap-vcpkg.sh bash ./dependencies/vcpkg/bootstrap-vcpkg.sh
- name: 'Setup NuGet Credentials for vcpkg' - name: 'Setup NuGet Credentials for vcpkg'
@ -78,7 +71,6 @@ jobs:
- name: "cmake" - name: "cmake"
run: | run: |
export VULKAN_SDK="${{ env.install_vulkan_folder }}/${{ env.install_vulkan_version }}/x86_64"
mkdir -p build mkdir -p build
cd build cd build
cmake .. ${{ env.BUILD_FLAGS }} -DCMAKE_BUILD_TYPE=${{ env.BUILD_MODE }} -DCMAKE_C_COMPILER=/usr/bin/clang-12 -DCMAKE_CXX_COMPILER=/usr/bin/clang++-12 -G Ninja -DCMAKE_MAKE_PROGRAM=/usr/bin/ninja cmake .. ${{ env.BUILD_FLAGS }} -DCMAKE_BUILD_TYPE=${{ env.BUILD_MODE }} -DCMAKE_C_COMPILER=/usr/bin/clang-12 -DCMAKE_CXX_COMPILER=/usr/bin/clang++-12 -G Ninja -DCMAKE_MAKE_PROGRAM=/usr/bin/ninja
@ -98,9 +90,6 @@ jobs:
build-windows: build-windows:
runs-on: windows-2022 runs-on: windows-2022
env:
install_vulkan_folder: "$GITHUB_WORKSPACE/vulkan_sdk"
install_vulkan_version: "1.3.216.0"
steps: steps:
- name: "Checkout repo" - name: "Checkout repo"
uses: actions/checkout@v3 uses: actions/checkout@v3
@ -121,12 +110,6 @@ jobs:
echo "BUILD_FLAGS=" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append echo "BUILD_FLAGS=" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
echo "Build mode is debug" echo "Build mode is debug"
- name: Prepare Vulkan SDK
uses: humbletim/setup-vulkan-sdk@v1.2.0
with:
vulkan-query-version: 1.3.216.0
vulkan-components: Vulkan-Headers, Vulkan-Loader
vulkan-use-cache: false
- name: Workaround - name: Workaround
run: | run: |

17
.gitignore vendored
View file

@ -16,7 +16,20 @@
build/ build/
out/ out/
.cache/
# Cemu bin files # Cemu bin files
otp.bin bin/otp.bin
seeprom.bin bin/seeprom.bin
bin/Cemu.pdb
bin/mlc01/*
bin/settings.xml
bin/title_list_cache.xml
!bin/shaderCache/info.txt
bin/shaderCache/*
bin/controllerProfiles/*
!bin/gameProfiles/default/*
bin/gameProfiles/*

3
.gitmodules vendored
View file

@ -10,3 +10,6 @@
path = dependencies/vcpkg path = dependencies/vcpkg
url = https://github.com/microsoft/vcpkg url = https://github.com/microsoft/vcpkg
shallow = true shallow = true
[submodule "dependencies/Vulkan-Headers"]
path = dependencies/Vulkan-Headers
url = https://github.com/KhronosGroup/Vulkan-Headers

View file

@ -5,7 +5,6 @@
Prerequisites: Prerequisites:
- A recent version of Visual Studio 2022 with CMake tools component - A recent version of Visual Studio 2022 with CMake tools component
- git - git
- Vulkan SDK ([https://vulkan.lunarg.com/](https://vulkan.lunarg.com/)). Don't forget to restart after installing.
Instructions: Instructions:
@ -23,12 +22,11 @@ To compile Cemu, a recent enough compiler and STL with C++20 support is required
For ubuntu and most derivatives: For ubuntu and most derivatives:
1) Make sure vulkansdk is installed and the VULKAN_SDK environment variable is set correctly. 1) `sudo apt install -y libgtk-3-dev libsecret-1-dev libgcrypt20-dev libsystemd-dev freeglut3-dev clang-12 nasm ninja-build`
2) `sudo apt install -y libgtk-3-dev libsecret-1-dev libgcrypt20-dev libsystemd-dev freeglut3-dev clang-12 nasm` 2) Run `git clone --recursive https://github.com/cemu-project/Cemu`
3) Run `git clone --recursive https://github.com/cemu-project/Cemu` 3) `cd Cemu`
4) `cd Cemu` 4) `mkdir build && cd build`
5) `mkdir build && cd build` 5) `cmake .. -DCMAKE_BUILD_TYPE=release -DCMAKE_C_COMPILER=/usr/bin/clang-12 -DCMAKE_CXX_COMPILER=/usr/bin/clang++-12 -G Ninja`
6) `cmake .. -DCMAKE_BUILD_TYPE=release -DCMAKE_C_COMPILER=/usr/bin/clang-12 -DCMAKE_CXX_COMPILER=/usr/bin/clang++-12 -G Ninja -DCMAKE_MAKE_PROGRAM=/usr/bin/ninja` 6) `ninja`
8) `ninja`
Build instructions for other distributions will be added in the future! Build instructions for other distributions will be added in the future!

View file

@ -23,6 +23,10 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set_property(GLOBAL PROPERTY USE_FOLDERS ON) set_property(GLOBAL PROPERTY USE_FOLDERS ON)
if (MSVC)
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT CemuBin)
endif()
if (MSVC) if (MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fp:precise") # floating point model: precise set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fp:precise") # floating point model: precise
@ -37,10 +41,6 @@ option(ENABLE_OPENGL "Enables the OpenGL backend" ON)
option(ENABLE_VULKAN "Enables the Vulkan backend" ON) option(ENABLE_VULKAN "Enables the Vulkan backend" ON)
option(ENABLE_DISCORD_RPC "Enables the Discord Rich Presence feature" ON) option(ENABLE_DISCORD_RPC "Enables the Discord Rich Presence feature" ON)
if (WIN32)
option(ENABLE_CEMUHOOK "Enables Cemuhook compatibility" ON)
endif()
# input backends # input backends
if (WIN32) if (WIN32)
option(ENABLE_XINPUT "Enables the usage of XInput" ON) option(ENABLE_XINPUT "Enables the usage of XInput" ON)
@ -70,8 +70,7 @@ find_package(ZLIB REQUIRED)
find_package(zstd CONFIG REQUIRED) find_package(zstd CONFIG REQUIRED)
if (ENABLE_VULKAN) if (ENABLE_VULKAN)
find_package(Vulkan REQUIRED) include_directories("dependencies/Vulkan-Headers/include")
include_directories("${Vulkan_INCLUDE_DIRS}")
endif() endif()
if (ENABLE_OPENGL) if (ENABLE_OPENGL)
@ -114,4 +113,3 @@ add_subdirectory(dependencies/ih264d)
add_subdirectory(dependencies/ZArchive) add_subdirectory(dependencies/ZArchive)
add_subdirectory(src) add_subdirectory(src)

View file

@ -22,13 +22,13 @@ Cemu is currently only available for 64-bit Windows and Linux devices.
## Download ## Download
You can download the latest Cemu releases from the [Github Releases](https://github.com/cemu-project/Cemu/releases/) or from [Cemu's website](http://cemu.info). 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).
Cemu is currently only available in a portable format so no installation is required besides extracting it in a safe place. 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. See [Current State Of Linux builds](https://github.com/cemu-project/Cemu/issues/1) for information on using Cemu natively on Linux.
Pre-2.0 releases can be found on Cemu's [changelog page](http://cemu.info/changelog.html). Pre-2.0 releases can be found on Cemu's [changelog page](https://cemu.info/changelog.html).
## Build Instructions ## Build Instructions

View file

@ -1,27 +0,0 @@
# This is an example configuration file. You can use this file as a guideline on how to create your own game profiles.
# Overview:
# The filename of the game profile can be found by looking at log.txt after a game was launched in Cemu.
# A '#' character starts a one-line comment. Any text afterwards will be ignored.
# If an option is not given in the .ini file, Cemu will use the value from the global settings instead.
[General]
loadSharedLibraries = true # If set to true, system rpl files will be loaded from /cafeLibs/ if present. Default value is true
useRDTSC = true # Use RDTSC instruction as timer source for emulated CPU, OS and audio
[Graphics]
accurateShaderMul = true # If set to true, Cemu will correctly emulate the non-IEEE behavior of the shader MUL instruction. Can fix graphic issues but also decreases shader performance and increases shader compile time. Default value is true.
# Since Cemu 1.7.5 the option accurateShaderMul also supports a third mode, enabled by using the value 'min' (e.g. accurateShaderMul = min). In this mode, Cemu will emulate non-ieee MUL instructions in a more GPU-friendly way which generates less complex shaders. However, this mode might not be 100% accurate
disableGPUFence = false # If set to true, GPU fence operations will be skipped. Default value is false. Enabling this option can lead to instability and crashes
GPUBufferCacheAccuracy = 0 # Controls the accuracy of vertex and uniform data caching. A higher accuracy means more expensive checks which can slow down rendering. Possible values: 0 = high, 1 = medium, 2 = low
streamoutBufferCacheSize = 24 # buffer cache size of the streamout buffer in MB.
extendedTextureReadback = false # If set to true, Cemu will try to mirror data written by GPU operations to CPU RAM (but only if access by CPU is assumed to be likely) Default value is false
[CPU]
cpuTimer = cycleCounter # Timer source for OS and CPU time. Supported values are 'hostBased' (timers are based on actual OS time) and 'cycleCounter' (timers are based on speed of emulated CPU).
emulateSinglePrecision = true # If set to false, the recompiler won't correctly round the result of single-precision instructions in certain situations. This can introduce gameplay bugs, but might also improve performance.
cpuMode = Singlecore-Recompiler # CPU mode. Possible values: Singlecore-Interpreter, Singlecore-Recompiler, Dualcore-Recompiler, Triplecore-Recompiler

1
dependencies/Vulkan-Headers vendored Submodule

@ -0,0 +1 @@
Subproject commit 715673702f5b18ffb8e5832e67cf731468d32ac6

12
dist/linux/info.cemu.Cemu.desktop vendored Normal file
View file

@ -0,0 +1,12 @@
[Desktop Entry]
Name=Cemu
Type=Application
Terminal=false
Icon=info.cemu.Cemu
Exec=cemu
Comment=Software to emulate Wii U games and applications on PC
Comment[de]=Software zum emulieren von Wii U Spielen und Anwendungen auf dem PC
Comment[ru]=Программа для эмуляции игр и приложений Wii U на PC
Categories=Game;Emulator;
Keywords=Nintendo;
MimeType=application/x-wii-u-rom;

58
dist/linux/info.cemu.Cemu.metainfo.xml vendored Normal file
View file

@ -0,0 +1,58 @@
<?xml version='1.0' encoding='utf-8'?>
<component type="desktop">
<!--Created with jdAppdataEdit 4.2-->
<id>info.cemu.Cemu</id>
<name>Cemu</name>
<summary>Software to emulate Wii U games and applications on PC</summary>
<summary xml:lang="de">Software zum emulieren von Wii U Spielen und Anwendungen auf dem PC</summary>
<developer_name>Cemu Project</developer_name>
<launchable type="desktop-id">info.cemu.Cemu.desktop</launchable>
<metadata_license>CC0-1.0</metadata_license>
<project_license>MPL-2.0</project_license>
<description>
<p>Cemu is a Nintendo Wii U emulator that is able to run most Wii U games and homebrew in a playable state. Created by Exzap, and written in C/C++.</p>
<p xml:lang="de">Cemu ist ein Nintendo Wii U-Emulator, der die meisten Wii U Spiele und Homebrew in einem spielbaren Zustand ausführen kann. Erstellt von Exzap, und geschrieben in C/C++.</p>
<p>This emulator aims at providing both high-accuracy and performance, and is actively being developed with new features and fixes to increase compatibility, convenience and usability.</p>
<p xml:lang="de">Dieser Emulator zielt darauf ab, sowohl hohe Genauigkeit als auch Leistung zu bieten, und wird aktiv mit neuen Funktionen und Korrekturen weiterentwickelt, um Kompatibilität, Komfort und Benutzerfreundlichkeit zu verbessern.</p>
<p>It was written from scratch and development on the project began roughly early 2015.</p>
<p xml:lang="de">Er wird seit Anfang 2015 entwickelt.</p>
</description>
<screenshots>
<screenshot type="default">
<image type="source">https://upload.wikimedia.org/wikipedia/commons/5/58/Cemu_Screenshot.png</image>
</screenshot>
</screenshots>
<releases>
<release version="v2.0" date="2022-08-22" type="stable">
<url>https://github.com/cemu-project/Cemu/releases/tag/v2.0</url>
</release>
</releases>
<url type="homepage">https://cemu.info</url>
<url type="bugtracker">https://github.com/cemu-project/Cemu/issues</url>
<url type="faq">https://cemu.info/faq.html</url>
<url type="help">https://wiki.cemu.info</url>
<url type="vcs-browser">https://github.com/cemu-project/Cemu</url>
<categories>
<category>Game</category>
<category>Emulator</category>
</categories>
<requires>
<memory>4096</memory>
</requires>
<recommends>
<memory>8192</memory>
</recommends>
<supports>
<control>pointing</control>
<control>keyboard</control>
<control>gamepad</control>
</supports>
<content_rating type="oars-1.1"/>
<provides>
<binary>cemu</binary>
<mediatype>application/x-wii-u-rom</mediatype>
</provides>
<keywords>
<keyword>nintendo</keyword>
</keywords>
</component>

View file

@ -20,12 +20,12 @@ if(MSVC)
# _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING # _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING
# _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS # _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS
elseif(UNIX) elseif(UNIX)
add_definitions(-fms-extensions) if(NOT APPLE)
# add_definitions(-fms-compatibility-version=19.14)
# add_definitions(-fdelayed-template-parsing)
add_definitions(-fpermissive)
add_definitions(-DVK_USE_PLATFORM_XLIB_KHR) # legacy. Do we need to support XLIB surfaces? add_definitions(-DVK_USE_PLATFORM_XLIB_KHR) # legacy. Do we need to support XLIB surfaces?
add_definitions(-DVK_USE_PLATFORM_XCB_KHR) add_definitions(-DVK_USE_PLATFORM_XCB_KHR)
endif()
add_definitions(-fms-extensions)
add_definitions(-fpermissive)
add_definitions(-maes) add_definitions(-maes)
# warnings # warnings
add_compile_options(-Wno-switch -Wno-ignored-attributes -Wno-deprecated-enum-enum-conversion -Wno-ambiguous-reversed-operator) add_compile_options(-Wno-switch -Wno-ignored-attributes -Wno-deprecated-enum-enum-conversion -Wno-ambiguous-reversed-operator)
@ -47,11 +47,6 @@ add_subdirectory(imgui)
add_subdirectory(resource) add_subdirectory(resource)
add_subdirectory(asm) add_subdirectory(asm)
if(ENABLE_CEMUHOOK)
add_definitions(-DUSE_CEMUHOOK)
add_subdirectory(cemuhook)
endif()
if(PUBLIC_RELEASE) if(PUBLIC_RELEASE)
add_executable(CemuBin WIN32 add_executable(CemuBin WIN32
main.cpp main.cpp
@ -69,7 +64,6 @@ target_precompile_headers(CemuBin PRIVATE Common/precompiled.h)
if(WIN32) if(WIN32)
target_sources(CemuBin PRIVATE target_sources(CemuBin PRIVATE
resource/cemu.rc resource/cemu.rc
exports.def # for Cemuhook
) )
endif() endif()
@ -90,10 +84,6 @@ target_link_libraries(CemuBin PRIVATE CURL::libcurl)
target_link_libraries(CemuBin PRIVATE imgui::imgui) target_link_libraries(CemuBin PRIVATE imgui::imgui)
target_link_libraries(CemuBin PRIVATE pugixml pugixml::static pugixml::pugixml) target_link_libraries(CemuBin PRIVATE pugixml pugixml::static pugixml::pugixml)
if(ENABLE_CEMUHOOK)
target_link_libraries(CemuBin PRIVATE CemuCemuhook)
endif()
target_link_libraries(CemuBin PUBLIC target_link_libraries(CemuBin PUBLIC
CemuCommon CemuAudio CemuInput CemuComponents CemuCafe CemuConfig CemuGui imguiImpl) CemuCommon CemuAudio CemuInput CemuComponents CemuCafe CemuConfig CemuGui imguiImpl)

View file

@ -3,12 +3,13 @@
#include "gui/CemuApp.h" #include "gui/CemuApp.h"
#include "util/helpers/SystemException.h" #include "util/helpers/SystemException.h"
#include <random>
#include "config/ActiveSettings.h" #include "config/ActiveSettings.h"
#include "Cafe/IOSU/legacy/iosu_crypto.h" #include "Cafe/IOSU/legacy/iosu_crypto.h"
#include "Common/filestream.h" #include "Common/filestream.h"
#include <random>
#include <boost/random/uniform_int.hpp>
std::vector<Account> Account::s_account_list; std::vector<Account> Account::s_account_list;
Account::Account(uint32 persistent_id) Account::Account(uint32 persistent_id)
@ -65,7 +66,10 @@ Account::Account(uint32 persistent_id, std::wstring_view mii_name)
static std::random_device s_random_device; static std::random_device s_random_device;
static std::mt19937 s_mte(s_random_device()); static std::mt19937 s_mte(s_random_device());
std::uniform_int_distribution<uint16> dist(std::numeric_limits<uint8>::min(), std::numeric_limits<uint8>::max());
// use boost library to escape static asserts in linux builds
boost::random::uniform_int_distribution<uint16> dist(std::numeric_limits<uint8>::min(), std::numeric_limits<uint8>::max());
std::generate(m_uuid.begin(), m_uuid.end(), [&]() { return (uint8)dist(s_mte); }); std::generate(m_uuid.begin(), m_uuid.end(), [&]() { return (uint8)dist(s_mte); });
// 1000004 or 2000004 | lower uint32 from uuid from uuid // 1000004 or 2000004 | lower uint32 from uuid from uuid

View file

@ -282,7 +282,7 @@ struct
static_assert(sizeof(SharedDataEntry) == 0x1C); static_assert(sizeof(SharedDataEntry) == 0x1C);
DLLEXPORT uint32 loadSharedData() uint32 loadSharedData()
{ {
// check if font files are dumped // check if font files are dumped
bool hasAllShareddataFiles = true; bool hasAllShareddataFiles = true;
@ -364,7 +364,7 @@ void cemu_initForGame()
time_t theTime = (time(NULL) - 946684800); time_t theTime = (time(NULL) - 946684800);
{ {
tm* lt = localtime(&theTime); tm* lt = localtime(&theTime);
#if BOOST_OS_WINDOWS > 0 #if BOOST_OS_WINDOWS
theTime = _mkgmtime(lt); theTime = _mkgmtime(lt);
#else #else
theTime = timegm(lt); theTime = timegm(lt);

View file

@ -1029,7 +1029,7 @@ bool FSTVerifier::VerifyContentFile(FileStream* fileContent, const NCrypto::AesK
SHA256_Init(&sha256Ctx); SHA256_Init(&sha256Ctx);
while (remainingBytes > 0) while (remainingBytes > 0)
{ {
uint32 bytesToRead = (uint32)std::min(remainingBytes, buffer.size()); uint32 bytesToRead = (uint32)std::min(remainingBytes, (uint64)buffer.size());
uint32 bytesToReadPadded = ((bytesToRead + 0xF) & ~0xF); uint32 bytesToReadPadded = ((bytesToRead + 0xF) & ~0xF);
uint32 bytesRead = fileContent->readData(buffer.data(), bytesToReadPadded); uint32 bytesRead = fileContent->readData(buffer.data(), bytesToReadPadded);
if (bytesRead != bytesToReadPadded) if (bytesRead != bytesToReadPadded)

View file

@ -22,7 +22,7 @@ struct gameProfileBooleanOption_t
* If the option exists, true is returned. * If the option exists, true is returned.
* The boolean is stored in *optionValue * The boolean is stored in *optionValue
*/ */
DLLEXPORT bool gameProfile_loadBooleanOption(IniParser* iniParser, char* optionName, gameProfileBooleanOption_t* option) bool gameProfile_loadBooleanOption(IniParser* iniParser, char* optionName, gameProfileBooleanOption_t* option)
{ {
auto option_value = iniParser->FindOption(optionName); auto option_value = iniParser->FindOption(optionName);
option->isPresent = false; option->isPresent = false;
@ -81,7 +81,7 @@ bool gameProfile_loadBooleanOption2(IniParser& iniParser, const char* optionName
* Attempts to load a integer option * Attempts to load a integer option
* Allows to specify min and max value (error is logged if out of range and default value is picked) * Allows to specify min and max value (error is logged if out of range and default value is picked)
*/ */
DLLEXPORT bool gameProfile_loadIntegerOption(IniParser* iniParser, const char* optionName, gameProfileIntegerOption_t* option, sint32 defaultValue, sint32 minVal, sint32 maxVal) bool gameProfile_loadIntegerOption(IniParser* iniParser, const char* optionName, gameProfileIntegerOption_t* option, sint32 defaultValue, sint32 minVal, sint32 maxVal)
{ {
auto option_value = iniParser->FindOption(optionName); auto option_value = iniParser->FindOption(optionName);
option->isPresent = false; option->isPresent = false;
@ -166,17 +166,10 @@ bool gameProfile_loadEnumOption(IniParser& iniParser, const char* optionName, st
return result; return result;
} }
#pragma optimize( "", off )
DLLEXPORT NOINLINE void gameProfile_categoryBegin(IniParser* iniParser)
{
// do nothing
}
#pragma optimize( "", on )
void gameProfile_load() void gameProfile_load()
{ {
g_current_game_profile->ResetOptional(); // reset with global values as optional g_current_game_profile->ResetOptional(); // reset with global values as optional
g_current_game_profile->Load(CafeSystem::GetForegroundTitleId(), true); g_current_game_profile->Load(CafeSystem::GetForegroundTitleId());
// apply some settings immediately // apply some settings immediately
ppcThreadQuantum = g_current_game_profile->GetThreadQuantum(); ppcThreadQuantum = g_current_game_profile->GetThreadQuantum();
@ -185,7 +178,7 @@ void gameProfile_load()
cemuLog_force("Thread quantum set to {}", ppcThreadQuantum); cemuLog_force("Thread quantum set to {}", ppcThreadQuantum);
} }
bool GameProfile::Load(uint64_t title_id, bool notifyCemuhook) bool GameProfile::Load(uint64_t title_id)
{ {
auto gameProfilePath = ActiveSettings::GetPath("gameProfiles/{:016x}.ini", title_id); auto gameProfilePath = ActiveSettings::GetPath("gameProfiles/{:016x}.ini", title_id);
@ -220,9 +213,6 @@ bool GameProfile::Load(uint64_t title_id, bool notifyCemuhook)
// parse ini // parse ini
while (iniParser.NextSection()) while (iniParser.NextSection())
{ {
//if (notifyCemuhook)
// gameProfile_categoryBegin(gameProfile); // hookable export for Cemuhook
if (boost::iequals(iniParser.GetCurrentSectionName(), "General")) if (boost::iequals(iniParser.GetCurrentSectionName(), "General"))
{ {
gameProfile_loadBooleanOption2(iniParser, "loadSharedLibraries", m_loadSharedLibraries); gameProfile_loadBooleanOption2(iniParser, "loadSharedLibraries", m_loadSharedLibraries);
@ -379,24 +369,3 @@ void GameProfile::Reset()
for (auto& profile : m_controllerProfile) for (auto& profile : m_controllerProfile)
profile.reset(); profile.reset();
} }
// legacy code for Cemuhook
DLLEXPORT char* gameProfile_loadStringOption(IniParser* iniParser, char* optionName)
{
return nullptr;
}
DLLEXPORT char* gameProfile_getCurrentCategoryName(IniParser* iniParser)
{
return nullptr;
}
struct gpNamedOptionEntry_t
{
char* name;
sint32 value;
};
DLLEXPORT bool gameProfile_loadIntegerNamedOption(IniParser* iniParser, char* optionName, gameProfileIntegerOption_t* option, sint32 defaultValue, const gpNamedOptionEntry_t* nameValues, sint32 numNameValues)
{
return false;
}

View file

@ -16,7 +16,7 @@ class GameProfile
public: public:
static const uint32 kThreadQuantumDefault = 45000; static const uint32 kThreadQuantumDefault = 45000;
bool Load(uint64_t title_id, bool notifyCemuhook); bool Load(uint64_t title_id);
void Save(uint64_t title_id); void Save(uint64_t title_id);
void ResetOptional(); void ResetOptional();
void Reset(); void Reset();
@ -65,4 +65,4 @@ private:
}; };
extern std::unique_ptr<GameProfile> g_current_game_profile; extern std::unique_ptr<GameProfile> g_current_game_profile;
DLLEXPORT void gameProfile_load(); void gameProfile_load();

View file

@ -4,31 +4,6 @@
#include "config/ActiveSettings.h" #include "config/ActiveSettings.h"
#include "Cafe/GraphicPack/GraphicPack2.h" #include "Cafe/GraphicPack/GraphicPack2.h"
typedef struct
{
int placeholder;
}graphicPack_t;
// scans the graphic pack directory for shaders
DLLEXPORT void graphicPack_loadGraphicPackShaders(graphicPack_t* gp, wchar_t* graphicPackPath)
{
// this function is part of the deprecated/removed v1 graphic pack code
// as of Cemuhook 0.5.7.3 this function must exist with a minimum length for detour
// otherwise Cemuhook graphic pack stuff will error out, so we just create some pointless instructions which wont be optimized away
forceLog_printf("STUB1");
forceLog_printf("STUB2");
forceLog_printf("STUB3");
}
// for cemuhook compatibility only
DLLEXPORT bool config_isGraphicPackEnabled(uint64 id)
{
forceLog_printf("STUB4");
forceLog_printf("STUB5");
forceLog_printf("STUB6");
return false;
}
/* /*
* Loads the graphic pack if the titleId is referenced in rules.ini * Loads the graphic pack if the titleId is referenced in rules.ini
*/ */

View file

@ -599,23 +599,6 @@ void GraphicPack2::LoadShaders()
} }
} }
#pragma optimize( "", off )
DLLEXPORT NOINLINE void GraphicPack2_notifyActivate(GraphicPack2* gp, ExpressionParser* ep)
{
// for Cemuhook
int placeholder = 0xDEADDEAD;
}
DLLEXPORT NOINLINE void GraphicPack2_notifyDeactivate(GraphicPack2* gp)
{
// for Cemuhook
int placeholder = 0xDEADDEAD;
}
#pragma optimize( "", on )
bool GraphicPack2::SetActivePreset(std::string_view name) bool GraphicPack2::SetActivePreset(std::string_view name)
{ {
return SetActivePreset("", name); return SetActivePreset("", name);
@ -862,7 +845,6 @@ bool GraphicPack2::Activate()
m_output_settings.downscale_filter = LatteTextureView::MagFilter::kNearestNeighbor; m_output_settings.downscale_filter = LatteTextureView::MagFilter::kNearestNeighbor;
} }
} }
GraphicPack2_notifyActivate(this, &parser);
} }
catch(const std::exception& ex) catch(const std::exception& ex)
{ {
@ -932,7 +914,6 @@ bool GraphicPack2::Deactivate()
LatteTiming_disableCustomVsyncFrequency(); LatteTiming_disableCustomVsyncFrequency();
} }
GraphicPack2_notifyDeactivate(this);
return true; return true;
} }
@ -1149,45 +1130,3 @@ std::vector<std::pair<MPTR, MPTR>> GraphicPack2::GetActiveRAMMappings()
}); });
return v; return v;
} }
// C-style exports for Cemuhook
DLLEXPORT const wchar_t* GraphicPack2_GetFilename(GraphicPack2* gp)
{
return gp->GetFilename().c_str();
}
DLLEXPORT const char* GraphicPack2_GetName(GraphicPack2* gp)
{
if (!gp->HasName())
return "";
return gp->GetName().c_str();
}
DLLEXPORT const char* GraphicPack2_GetPath(GraphicPack2* gp)
{
return gp->GetPath().c_str();
}
DLLEXPORT const char* GraphicPack2_GetDescription(GraphicPack2* gp)
{
return gp->GetDescription().c_str();
}
DLLEXPORT const sint32 GraphicPack2_GetTitleIdCount(GraphicPack2* gp)
{
return gp->GetTitleIds().size();
}
DLLEXPORT const uint64* GraphicPack2_GetTitleIdList(GraphicPack2* gp)
{
return &gp->GetTitleIds()[0];
}
DLLEXPORT ExpressionParser* GraphicPack2_CreateExpressionParser(GraphicPack2* gp)
{
auto ep = new ExpressionParser();
gp->AddConstantsForCurrentPreset((ExpressionParser&)*ep);
return ep;
}

View file

@ -166,8 +166,8 @@ public:
static bool DeactivateGraphicPack(const std::shared_ptr<GraphicPack2>& graphic_pack); static bool DeactivateGraphicPack(const std::shared_ptr<GraphicPack2>& graphic_pack);
static void ClearGraphicPacks(); static void ClearGraphicPacks();
private: private:
DLLEXPORT bool Activate(); bool Activate();
DLLEXPORT bool Deactivate(); bool Deactivate();
static std::vector<std::shared_ptr<GraphicPack2>> s_graphic_packs; static std::vector<std::shared_ptr<GraphicPack2>> s_graphic_packs;
static std::vector<std::shared_ptr<GraphicPack2>> s_active_graphic_packs; static std::vector<std::shared_ptr<GraphicPack2>> s_active_graphic_packs;

View file

@ -8,7 +8,7 @@
#include "Cafe/OS/libs/coreinit/coreinit.h" #include "Cafe/OS/libs/coreinit/coreinit.h"
#if BOOST_OS_WINDOWS > 0 #if BOOST_OS_WINDOWS
#include <Windows.h> #include <Windows.h>
#endif #endif
@ -158,7 +158,7 @@ void debugger_updateMemoryBreakpoint(DebuggerBreakpoint* bp)
{ {
std::vector<std::thread::native_handle_type> schedulerThreadHandles = coreinit::OSGetSchedulerThreads(); std::vector<std::thread::native_handle_type> schedulerThreadHandles = coreinit::OSGetSchedulerThreads();
#if BOOST_OS_WINDOWS > 0 #if BOOST_OS_WINDOWS
debuggerState.activeMemoryBreakpoint = bp; debuggerState.activeMemoryBreakpoint = bp;
for (auto& hThreadNH : schedulerThreadHandles) for (auto& hThreadNH : schedulerThreadHandles)
{ {

View file

@ -100,11 +100,6 @@ PPCInterpreter_t* PPCCore_executeCallbackInternal(uint32 functionMPTR)
return hCPU; return hCPU;
} }
DLLEXPORT void PPCCore_executeCallback(uint32 functionMPTR)
{
PPCCore_executeCallbackInternal(functionMPTR);
}
void PPCCore_deleteAllThreads() void PPCCore_deleteAllThreads()
{ {
assert_dbg(); assert_dbg();

View file

@ -5,7 +5,7 @@
#include "util/helpers/fspinlock.h" #include "util/helpers/fspinlock.h"
#include "util/highresolutiontimer/HighResolutionTimer.h" #include "util/highresolutiontimer/HighResolutionTimer.h"
#if BOOST_OS_LINUX > 0 #if BOOST_OS_LINUX || BOOST_OS_MACOS
static __inline__ static __inline__
uint64 _umul128(uint64 multiplier, uint64 multiplicand, uint64 *highProduct) { uint64 _umul128(uint64 multiplier, uint64 multiplicand, uint64 *highProduct) {
unsigned __int128 x = (unsigned __int128)multiplier * (unsigned __int128)multiplicand; unsigned __int128 x = (unsigned __int128)multiplier * (unsigned __int128)multiplicand;
@ -115,7 +115,7 @@ uint64 PPCTimer_microsecondsToTsc(uint64 us)
uint64 PPCTimer_tscToMicroseconds(uint64 us) uint64 PPCTimer_tscToMicroseconds(uint64 us)
{ {
uint128_t r{}; uint128_t r{};
#if BOOST_OS_WINDOWS > 0 #if BOOST_OS_WINDOWS
r.low = _umul128(us, 1000000ULL, &r.high); r.low = _umul128(us, 1000000ULL, &r.high);
#else #else
r.low = _umul128(us, 1000000ULL, (unsigned long long*)&r.high); r.low = _umul128(us, 1000000ULL, (unsigned long long*)&r.high);
@ -155,7 +155,7 @@ uint64 PPCTimer_getFromRDTSC()
rdtscDif = rdtscDif & ~(uint64)((sint64)rdtscDif >> 63); rdtscDif = rdtscDif & ~(uint64)((sint64)rdtscDif >> 63);
uint128_t diff{}; uint128_t diff{};
#if BOOST_OS_WINDOWS > 0 #if BOOST_OS_WINDOWS
diff.low = _umul128(rdtscDif, Espresso::CORE_CLOCK, &diff.high); diff.low = _umul128(rdtscDif, Espresso::CORE_CLOCK, &diff.high);
#else #else
diff.low = _umul128(rdtscDif, Espresso::CORE_CLOCK, (unsigned long long*)&diff.high); diff.low = _umul128(rdtscDif, Espresso::CORE_CLOCK, (unsigned long long*)&diff.high);
@ -165,7 +165,7 @@ uint64 PPCTimer_getFromRDTSC()
_rdtscLastMeasure = rdtscCurrentMeasure; // only travel forward in time _rdtscLastMeasure = rdtscCurrentMeasure; // only travel forward in time
uint8 c = 0; uint8 c = 0;
#if BOOST_OS_WINDOWS > 0 #if BOOST_OS_WINDOWS
c = _addcarry_u64(c, _rdtscAcc.low, diff.low, &_rdtscAcc.low); c = _addcarry_u64(c, _rdtscAcc.low, diff.low, &_rdtscAcc.low);
_addcarry_u64(c, _rdtscAcc.high, diff.high, &_rdtscAcc.high); _addcarry_u64(c, _rdtscAcc.high, diff.high, &_rdtscAcc.high);
#else #else

View file

@ -72,7 +72,7 @@ void PPCRecompiler_recompileIfUnvisited(uint32 enterAddress)
void PPCRecompiler_enter(PPCInterpreter_t* hCPU, PPCREC_JUMP_ENTRY funcPtr) void PPCRecompiler_enter(PPCInterpreter_t* hCPU, PPCREC_JUMP_ENTRY funcPtr)
{ {
#if BOOST_OS_WINDOWS > 0 #if BOOST_OS_WINDOWS
uint32 prevState = _controlfp(0, 0); uint32 prevState = _controlfp(0, 0);
_controlfp(_RC_NEAR, _MCW_RC); _controlfp(_RC_NEAR, _MCW_RC);
PPCRecompiler_enterRecompilerCode((uint64)funcPtr, (uint64)hCPU); PPCRecompiler_enterRecompilerCode((uint64)funcPtr, (uint64)hCPU);
@ -374,7 +374,7 @@ struct ppcRecompilerFuncRange_t
size_t x86Size; size_t x86Size;
}; };
DLLEXPORT bool PPCRecompiler_findFuncRanges(uint32 addr, ppcRecompilerFuncRange_t* rangesOut, size_t* countInOut) bool PPCRecompiler_findFuncRanges(uint32 addr, ppcRecompilerFuncRange_t* rangesOut, size_t* countInOut)
{ {
PPCRecompilerState.recompilerSpinlock.acquire(); PPCRecompilerState.recompilerSpinlock.acquire();
size_t countIn = *countInOut; size_t countIn = *countInOut;
@ -399,7 +399,7 @@ DLLEXPORT bool PPCRecompiler_findFuncRanges(uint32 addr, ppcRecompilerFuncRange_
return true; return true;
} }
DLLEXPORT uintptr_t* PPCRecompiler_getJumpTableBase() extern "C" DLLEXPORT uintptr_t * PPCRecompiler_getJumpTableBase()
{ {
if (ppcRecompilerInstanceData == nullptr) if (ppcRecompilerInstanceData == nullptr)
return nullptr; return nullptr;
@ -431,7 +431,7 @@ void PPCRecompiler_deleteFunction(PPCRecFunction_t* func)
// todo - free x86 code // todo - free x86 code
} }
DLLEXPORT void PPCRecompiler_invalidateRange(uint32 startAddr, uint32 endAddr) void PPCRecompiler_invalidateRange(uint32 startAddr, uint32 endAddr)
{ {
if (ppcRecompilerEnabled == false) if (ppcRecompilerEnabled == false)
return; return;

View file

@ -369,14 +369,14 @@ typedef struct
uint32 _x64XMM_mxCsr_ftzOff; uint32 _x64XMM_mxCsr_ftzOff;
}PPCRecompilerInstanceData_t; }PPCRecompilerInstanceData_t;
extern DLLEXPORT PPCRecompilerInstanceData_t* ppcRecompilerInstanceData; extern PPCRecompilerInstanceData_t* ppcRecompilerInstanceData;
extern bool ppcRecompilerEnabled; extern bool ppcRecompilerEnabled;
DLLEXPORT void PPCRecompiler_init(); void PPCRecompiler_init();
void PPCRecompiler_allocateRange(uint32 startAddress, uint32 size); void PPCRecompiler_allocateRange(uint32 startAddress, uint32 size);
DLLEXPORT void PPCRecompiler_invalidateRange(uint32 startAddr, uint32 endAddr); void PPCRecompiler_invalidateRange(uint32 startAddr, uint32 endAddr);
extern void ATTR_MS_ABI (*PPCRecompiler_enterRecompilerCode)(uint64 codeMem, uint64 ppcInterpreterInstance); extern void ATTR_MS_ABI (*PPCRecompiler_enterRecompilerCode)(uint64 codeMem, uint64 ppcInterpreterInstance);
extern void ATTR_MS_ABI (*PPCRecompiler_leaveRecompilerCode_visited)(); extern void ATTR_MS_ABI (*PPCRecompiler_leaveRecompilerCode_visited)();
@ -385,10 +385,10 @@ extern void ATTR_MS_ABI (*PPCRecompiler_leaveRecompilerCode_unvisited)();
#define PPC_REC_INVALID_FUNCTION ((PPCRecFunction_t*)-1) #define PPC_REC_INVALID_FUNCTION ((PPCRecFunction_t*)-1)
// CPUID // CPUID
extern DLLEXPORT bool hasLZCNTSupport; extern bool hasLZCNTSupport;
extern DLLEXPORT bool hasMOVBESupport; extern bool hasMOVBESupport;
extern DLLEXPORT bool hasBMI2Support; extern bool hasBMI2Support;
extern DLLEXPORT bool hasAVXSupport; extern bool hasAVXSupport;
// todo - move some of the stuff above into PPCRecompilerInternal.h // todo - move some of the stuff above into PPCRecompilerInternal.h

View file

@ -284,7 +284,7 @@ void LatteIndices_generateAutoLineLoopIndices(void* indexDataOutput, uint32 coun
indexMax = std::max(count, 1u) - 1; indexMax = std::max(count, 1u) - 1;
} }
#if BOOST_OS_LINUX #if BOOST_OS_LINUX || BOOST_OS_MACOS
#pragma clang attribute push (__attribute__((target("avx2"))), apply_to=function) #pragma clang attribute push (__attribute__((target("avx2"))), apply_to=function)
#endif #endif
@ -352,11 +352,11 @@ void LatteIndices_fastConvertU16_AVX2(const void* indexDataInput, void* indexDat
indexMin = std::min(indexMin, _minIndex); indexMin = std::min(indexMin, _minIndex);
} }
#if BOOST_OS_LINUX #if BOOST_OS_LINUX || BOOST_OS_MACOS
#pragma clang attribute pop #pragma clang attribute pop
#endif #endif
#if BOOST_OS_LINUX #if BOOST_OS_LINUX || BOOST_OS_MACOS
#pragma clang attribute push (__attribute__((target("avx2"))), apply_to=function) #pragma clang attribute push (__attribute__((target("avx2"))), apply_to=function)
#endif #endif
@ -423,11 +423,11 @@ void LatteIndices_fastConvertU16_SSE41(const void* indexDataInput, void* indexDa
indexMin = std::min(indexMin, _minIndex); indexMin = std::min(indexMin, _minIndex);
} }
#if BOOST_OS_LINUX #if BOOST_OS_LINUX || BOOST_OS_MACOS
#pragma clang attribute pop #pragma clang attribute pop
#endif #endif
#if BOOST_OS_LINUX #if BOOST_OS_LINUX || BOOST_OS_MACOS
#pragma clang attribute push (__attribute__((target("avx2"))), apply_to=function) #pragma clang attribute push (__attribute__((target("avx2"))), apply_to=function)
#endif #endif
@ -497,7 +497,7 @@ void LatteIndices_fastConvertU32_AVX2(const void* indexDataInput, void* indexDat
indexMin = std::min(indexMin, _minIndex); indexMin = std::min(indexMin, _minIndex);
} }
#if BOOST_OS_LINUX #if BOOST_OS_LINUX || BOOST_OS_MACOS
#pragma clang attribute pop #pragma clang attribute pop
#endif #endif

View file

@ -1003,7 +1003,7 @@ void LatteRenderTarget_copyToBackbuffer(LatteTextureView* textureView, bool isPa
g_renderer->ImguiEnd(); g_renderer->ImguiEnd();
} }
bool DLLEXPORT alwaysDisplayDRC = false; bool alwaysDisplayDRC = false;
bool ctrlTabHotkeyPressed = false; bool ctrlTabHotkeyPressed = false;
void LatteRenderTarget_itHLECopyColorBufferToScanBuffer(MPTR colorBufferPtr, uint32 colorBufferWidth, uint32 colorBufferHeight, uint32 colorBufferSliceIndex, uint32 colorBufferFormat, uint32 colorBufferPitch, Latte::E_HWTILEMODE colorBufferTilemode, uint32 colorBufferSwizzle, uint32 renderTarget) void LatteRenderTarget_itHLECopyColorBufferToScanBuffer(MPTR colorBufferPtr, uint32 colorBufferWidth, uint32 colorBufferHeight, uint32 colorBufferSliceIndex, uint32 colorBufferFormat, uint32 colorBufferPitch, Latte::E_HWTILEMODE colorBufferTilemode, uint32 colorBufferSwizzle, uint32 renderTarget)

View file

@ -27,7 +27,7 @@
#include <wx/msgdlg.h> #include <wx/msgdlg.h>
#if BOOST_OS_WINDOWS > 0 #if BOOST_OS_WINDOWS
#include <psapi.h> #include <psapi.h>
#endif #endif
@ -189,7 +189,7 @@ void LatteShaderCache_load()
const auto timeLoadStart = now_cached(); const auto timeLoadStart = now_cached();
// remember current amount of committed memory // remember current amount of committed memory
#if BOOST_OS_WINDOWS > 0 #if BOOST_OS_WINDOWS
PROCESS_MEMORY_COUNTERS pmc1; PROCESS_MEMORY_COUNTERS pmc1;
GetProcessMemoryInfo(GetCurrentProcess(), &pmc1, sizeof(PROCESS_MEMORY_COUNTERS)); GetProcessMemoryInfo(GetCurrentProcess(), &pmc1, sizeof(PROCESS_MEMORY_COUNTERS));
LONGLONG totalMem1 = pmc1.PagefileUsage; LONGLONG totalMem1 = pmc1.PagefileUsage;
@ -285,7 +285,7 @@ void LatteShaderCache_load()
LatteShaderCache_updateCompileQueue(0); LatteShaderCache_updateCompileQueue(0);
// write load time and RAM usage to log file (in dev build) // write load time and RAM usage to log file (in dev build)
#if BOOST_OS_WINDOWS > 0 #if BOOST_OS_WINDOWS
const auto timeLoadEnd = now_cached(); const auto timeLoadEnd = now_cached();
const auto timeLoad = std::chrono::duration_cast<std::chrono::milliseconds>(timeLoadEnd - timeLoadStart).count(); const auto timeLoad = std::chrono::duration_cast<std::chrono::milliseconds>(timeLoadEnd - timeLoadStart).count();
PROCESS_MEMORY_COUNTERS pmc2; PROCESS_MEMORY_COUNTERS pmc2;
@ -432,7 +432,7 @@ void LatteShaderCache_ShowProgress(const std::function <bool(void)>& loadUpdateF
} }
ImGui::SetCursorPosX(width - ImGui::CalcTextSize(text.c_str()).x / 2); ImGui::SetCursorPosX(width - ImGui::CalcTextSize(text.c_str()).x / 2);
ImGui::Text(text.c_str()); ImGui::Text("%s", text.c_str());
float percentLoaded; float percentLoaded;
if(isPipelines) if(isPipelines)
@ -446,7 +446,7 @@ void LatteShaderCache_ShowProgress(const std::function <bool(void)>& loadUpdateF
else else
text = fmt::format("{}/{} ({}%%)", g_shaderCacheLoaderState.loadedShaderFiles, g_shaderCacheLoaderState.shaderFileCount, (int)(percentLoaded * 100)); text = fmt::format("{}/{} ({}%%)", g_shaderCacheLoaderState.loadedShaderFiles, g_shaderCacheLoaderState.shaderFileCount, (int)(percentLoaded * 100));
ImGui::SetCursorPosX(width - ImGui::CalcTextSize(text.c_str()).x / 2); ImGui::SetCursorPosX(width - ImGui::CalcTextSize(text.c_str()).x / 2);
ImGui::Text(text.c_str()); ImGui::Text("%s", text.c_str());
ImGui::End(); ImGui::End();
} }
ImGui::PopFont(); ImGui::PopFont();

View file

@ -145,7 +145,7 @@ uint32 LatteTexture_CalculateTextureDataHash(LatteTexture* hostTexture)
bool isCompressedFormat = hostTexture->IsCompressedFormat(); bool isCompressedFormat = hostTexture->IsCompressedFormat();
if( isCompressedFormat == false ) if( isCompressedFormat == false )
{ {
#if BOOST_OS_WINDOWS > 0 #if BOOST_OS_WINDOWS
if (_cpuExtension_AVX2) if (_cpuExtension_AVX2)
{ {
__m256i h256 = { 0 }; __m256i h256 = { 0 };
@ -426,11 +426,3 @@ void LatteTC_UnloadAllTextures()
} }
LatteRenderTarget_unloadAll(); LatteRenderTarget_unloadAll();
} }
/*
* Asynchronous way to invalidate textures
*/
DLLEXPORT void gpu7Texture_forceInvalidateByImagePtr(MPTR imagePtr)
{
// deprecated. Texture cache heuristics are now good enough to detect moving frames
}

View file

@ -7,7 +7,7 @@ using namespace Latte;
namespace LatteAddrLib namespace LatteAddrLib
{ {
#if BOOST_OS_LINUX #if BOOST_OS_LINUX || BOOST_OS_MACOS
unsigned char _BitScanReverse(uint32* _Index, uint32 _Mask) unsigned char _BitScanReverse(uint32* _Index, uint32 _Mask)
{ {
if (!_Mask) if (!_Mask)

View file

@ -95,7 +95,7 @@ OpenGLRenderer::OpenGLRenderer()
glRendererState.uploadIndex = 0; glRendererState.uploadIndex = 0;
} }
#if BOOST_OS_WINDOWS > 0 #if BOOST_OS_WINDOWS
try try
{ {
m_dxgi_wrapper = std::make_unique<DXGIWrapper>(); m_dxgi_wrapper = std::make_unique<DXGIWrapper>();
@ -191,7 +191,7 @@ void OpenGLRenderer::DeleteFontTextures()
typedef void(*GL_IMPORT)(); typedef void(*GL_IMPORT)();
#if BOOST_OS_WINDOWS > 0 #if BOOST_OS_WINDOWS
GL_IMPORT _GetOpenGLFunction(HMODULE hLib, const char* name) GL_IMPORT _GetOpenGLFunction(HMODULE hLib, const char* name)
{ {
GL_IMPORT r = (GL_IMPORT)wglGetProcAddress(name); GL_IMPORT r = (GL_IMPORT)wglGetProcAddress(name);
@ -207,7 +207,7 @@ void LoadOpenGLImports()
#include "Common/GLInclude/glFunctions.h" #include "Common/GLInclude/glFunctions.h"
#undef GLFUNC #undef GLFUNC
} }
#else #elif BOOST_OS_LINUX
GL_IMPORT _GetOpenGLFunction(void* hLib, PFNGLXGETPROCADDRESSPROC func, const char* name) GL_IMPORT _GetOpenGLFunction(void* hLib, PFNGLXGETPROCADDRESSPROC func, const char* name)
{ {
GL_IMPORT r = (GL_IMPORT)func((const GLubyte*)name); GL_IMPORT r = (GL_IMPORT)func((const GLubyte*)name);
@ -233,6 +233,11 @@ void LoadOpenGLImports()
#include "Common/GLInclude/glFunctions.h" #include "Common/GLInclude/glFunctions.h"
#undef GLFUNC #undef GLFUNC
} }
#elif BOOST_OS_MACOS
void LoadOpenGLImports()
{
cemu_assert_unimplemented();
}
#endif #endif
void OpenGLRenderer::Initialize() void OpenGLRenderer::Initialize()
@ -244,7 +249,7 @@ void OpenGLRenderer::Initialize()
LoadOpenGLImports(); LoadOpenGLImports();
GetVendorInformation(); GetVendorInformation();
#if BOOST_OS_WINDOWS > 0 #if BOOST_OS_WINDOWS
if (wglSwapIntervalEXT) if (wglSwapIntervalEXT)
wglSwapIntervalEXT(0); // disable V-Sync per default wglSwapIntervalEXT(0); // disable V-Sync per default
#endif #endif
@ -349,7 +354,7 @@ void OpenGLRenderer::NotifyLatteCommandProcessorIdle()
void OpenGLRenderer::EnableVSync(int state) void OpenGLRenderer::EnableVSync(int state)
{ {
#if BOOST_OS_WINDOWS > 0 #if BOOST_OS_WINDOWS
if(wglSwapIntervalEXT) if(wglSwapIntervalEXT)
wglSwapIntervalEXT(state); // 1 = enabled, 0 = disabled wglSwapIntervalEXT(state); // 1 = enabled, 0 = disabled
#else #else

View file

@ -531,6 +531,6 @@ void VKRMemoryManager::appendOverlayHeapDebugInfo()
uint32 heapSizeMB = (heapSize / 1024 / 1024); uint32 heapSizeMB = (heapSize / 1024 / 1024);
uint32 allocatedBytesMB = (allocatedBytes / 1024 / 1024); uint32 allocatedBytesMB = (allocatedBytes / 1024 / 1024);
ImGui::Text(fmt::format("{0:#08x} Size: {1}MB/{2}MB", itr.first, allocatedBytesMB, heapSizeMB).c_str()); ImGui::Text("%s", fmt::format("{0:#08x} Size: {1}MB/{2}MB", itr.first, allocatedBytesMB, heapSizeMB).c_str());
} }
} }

View file

@ -2,7 +2,7 @@
#define VKFUNC_DEFINE #define VKFUNC_DEFINE
#include "Cafe/HW/Latte/Renderer/Vulkan/VulkanAPI.h" #include "Cafe/HW/Latte/Renderer/Vulkan/VulkanAPI.h"
#if BOOST_OS_LINUX #if BOOST_OS_LINUX || BOOST_OS_MACOS
#include <dlfcn.h> #include <dlfcn.h>
#endif #endif

View file

@ -104,7 +104,7 @@ std::vector<VulkanRenderer::DeviceInfo> VulkanRenderer::GetDevices()
requiredExtensions.emplace_back(VK_KHR_SURFACE_EXTENSION_NAME); requiredExtensions.emplace_back(VK_KHR_SURFACE_EXTENSION_NAME);
#if BOOST_OS_WINDOWS #if BOOST_OS_WINDOWS
requiredExtensions.emplace_back(VK_KHR_WIN32_SURFACE_EXTENSION_NAME); requiredExtensions.emplace_back(VK_KHR_WIN32_SURFACE_EXTENSION_NAME);
#else #elif BOOST_OS_LINUX
requiredExtensions.emplace_back(VK_KHR_XLIB_SURFACE_EXTENSION_NAME); requiredExtensions.emplace_back(VK_KHR_XLIB_SURFACE_EXTENSION_NAME);
#endif #endif
@ -1143,7 +1143,7 @@ std::vector<const char*> VulkanRenderer::CheckInstanceExtensionSupport(FeatureCo
requiredInstanceExtensions.emplace_back(VK_KHR_SURFACE_EXTENSION_NAME); requiredInstanceExtensions.emplace_back(VK_KHR_SURFACE_EXTENSION_NAME);
#if BOOST_OS_WINDOWS #if BOOST_OS_WINDOWS
requiredInstanceExtensions.emplace_back(VK_KHR_WIN32_SURFACE_EXTENSION_NAME); requiredInstanceExtensions.emplace_back(VK_KHR_WIN32_SURFACE_EXTENSION_NAME);
#else #elif BOOST_OS_LINUX
requiredInstanceExtensions.emplace_back(VK_KHR_XLIB_SURFACE_EXTENSION_NAME); requiredInstanceExtensions.emplace_back(VK_KHR_XLIB_SURFACE_EXTENSION_NAME);
#endif #endif
if (cafeLog_isLoggingFlagEnabled(LOG_TYPE_VULKAN_VALIDATION)) if (cafeLog_isLoggingFlagEnabled(LOG_TYPE_VULKAN_VALIDATION))
@ -1319,8 +1319,11 @@ VkSurfaceKHR VulkanRenderer::CreateFramebufferSurface(VkInstance instance, struc
{ {
#if BOOST_OS_WINDOWS #if BOOST_OS_WINDOWS
return CreateWinSurface(instance, windowInfo.hwnd); return CreateWinSurface(instance, windowInfo.hwnd);
#else #elif BOOST_OS_LINUX
return CreateXlibSurface(instance, windowInfo.xlib_display, windowInfo.xlib_window); return CreateXlibSurface(instance, windowInfo.xlib_display, windowInfo.xlib_window);
#elif BOOST_OS_MACOS
cemu_assert_unimplemented();
return nullptr;
#endif #endif
} }

View file

@ -389,7 +389,7 @@ uint8 memory_readU8(uint32 address)
return *(uint8*)(memory_getPointerFromVirtualOffset(address)); return *(uint8*)(memory_getPointerFromVirtualOffset(address));
} }
DLLEXPORT void* memory_getBase() extern "C" DLLEXPORT void* memory_getBase()
{ {
return memory_base; return memory_base;
} }

View file

@ -1,6 +1,6 @@
#pragma once #pragma once
DLLEXPORT void memory_init(); void memory_init();
void memory_mapForCurrentTitle(); void memory_mapForCurrentTitle();
void memory_logModifiedMemoryRanges(); void memory_logModifiedMemoryRanges();
@ -201,6 +201,9 @@ static uint16 CPU_swapEndianU16(uint16 v)
#elif BOOST_OS_LINUX #elif BOOST_OS_LINUX
#define CPU_swapEndianU64(_v) bswap_64((uint64)(_v)) #define CPU_swapEndianU64(_v) bswap_64((uint64)(_v))
#define CPU_swapEndianU32(_v) bswap_32((uint32)(_v)) #define CPU_swapEndianU32(_v) bswap_32((uint32)(_v))
#elif BOOST_OS_MACOS
#define CPU_swapEndianU64(_v) OSSwapInt64((uint64)(_v))
#define CPU_swapEndianU32(_v) OSSwapInt32((uint32)(_v))
#endif #endif
// direct memory access (no hardware interface access) // direct memory access (no hardware interface access)

View file

@ -6,7 +6,7 @@
#if BOOST_OS_LINUX #if BOOST_OS_LINUX
// using chrono::year_month_date and other features require a relatively recent stdlibc++ // using chrono::year_month_date and other features require a relatively recent stdlibc++
// to avoid upping the required version we use the STL reference implementation for now // to avoid upping the required version we use the STL reference implementation for now
#include "Common/linux/date.h" #include "Common/unix/date.h"
namespace chrono_d = date; namespace chrono_d = date;
#else #else
namespace chrono_d = std::chrono; namespace chrono_d = std::chrono;

View file

@ -46,8 +46,8 @@ ChunkedFlatAllocator<64 * 1024> g_heapTrampolineArea;
std::vector<rplDependency_t*> rplDependencyList = std::vector<rplDependency_t*>(); std::vector<rplDependency_t*> rplDependencyList = std::vector<rplDependency_t*>();
DLLEXPORT RPLModule* rplModuleList[256]; RPLModule* rplModuleList[256];
DLLEXPORT sint32 rplModuleCount = 0; sint32 rplModuleCount = 0;
uint32 _currentTLSModuleIndex = 1; // value 0 is reserved uint32 _currentTLSModuleIndex = 1; // value 0 is reserved

View file

@ -14,7 +14,7 @@ MPTR RPLLoader_AllocateCodeSpace(uint32 size, uint32 alignment);
uint32 RPLLoader_GetMaxCodeOffset(); uint32 RPLLoader_GetMaxCodeOffset();
uint32 RPLLoader_GetDataAllocatorAddr(); uint32 RPLLoader_GetDataAllocatorAddr();
DLLEXPORT RPLModule* rpl_loadFromMem(uint8* rplData, sint32 size, char* name); RPLModule* rpl_loadFromMem(uint8* rplData, sint32 size, char* name);
uint32 rpl_mapHLEImport(RPLModule* rplLoaderContext, const char* rplName, const char* funcName, bool functionMustExist); uint32 rpl_mapHLEImport(RPLModule* rplLoaderContext, const char* rplName, const char* funcName, bool functionMustExist);
void RPLLoader_Link(); void RPLLoader_Link();

View file

@ -99,7 +99,7 @@ void osLib_addFunctionInternal(const char* libraryName, const char* functionName
s_osFunctionTable->emplace_back(libHashA, libHashB, funcHashA, funcHashB, fmt::format("{}.{}", libraryName, functionName), PPCInterpreter_registerHLECall(osFunction)); s_osFunctionTable->emplace_back(libHashA, libHashB, funcHashA, funcHashB, fmt::format("{}.{}", libraryName, functionName), PPCInterpreter_registerHLECall(osFunction));
} }
DLLEXPORT void osLib_registerHLEFunction(const char* libraryName, const char* functionName, void(*osFunction)(PPCInterpreter_t* hCPU)) extern "C" DLLEXPORT void osLib_registerHLEFunction(const char* libraryName, const char* functionName, void(*osFunction)(PPCInterpreter_t * hCPU))
{ {
osLib_addFunctionInternal(libraryName, functionName, osFunction); osLib_addFunctionInternal(libraryName, functionName, osFunction);
} }

View file

@ -78,7 +78,7 @@ void CafeInit()
rpxPathStart = 0; rpxPathStart = 0;
} }
std::string_view rpxFileName = std::basic_string_view<char>(_pathToExecutable.data() + rpxPathStart, _pathToExecutable.data() + _pathToExecutable.size()); std::string_view rpxFileName(_pathToExecutable.data() + rpxPathStart, _pathToExecutable.size() - rpxPathStart);
argStorageIndex = 0; argStorageIndex = 0;
_coreinitInfo->argc = 0; _coreinitInfo->argc = 0;

View file

@ -424,7 +424,7 @@ typedef struct
static_assert(sizeof(UCParamStruct_t) == 0x54); // unsure static_assert(sizeof(UCParamStruct_t) == 0x54); // unsure
#if BOOST_OS_LINUX #if BOOST_OS_LINUX || BOOST_OS_MACOS
#define _strcmpi strcasecmp #define _strcmpi strcasecmp
#endif #endif

View file

@ -538,7 +538,6 @@ namespace coreinit
void coreinitExport_MEMAllocFromAllocator(PPCInterpreter_t* hCPU) void coreinitExport_MEMAllocFromAllocator(PPCInterpreter_t* hCPU)
{ {
debug_printf("MEMAllocFromAllocator(0x%x, 0x%x)\n", hCPU->gpr[3], hCPU->gpr[4]);
MEMAllocator* memAllocator = (MEMAllocator*)memory_getPointerFromVirtualOffset(hCPU->gpr[3]); MEMAllocator* memAllocator = (MEMAllocator*)memory_getPointerFromVirtualOffset(hCPU->gpr[3]);
// redirect execution to allocator alloc callback // redirect execution to allocator alloc callback
hCPU->instructionPointer = memAllocator->func->funcAlloc.GetMPTR(); hCPU->instructionPointer = memAllocator->func->funcAlloc.GetMPTR();
@ -546,7 +545,6 @@ namespace coreinit
void coreinitExport_MEMFreeToAllocator(PPCInterpreter_t* hCPU) void coreinitExport_MEMFreeToAllocator(PPCInterpreter_t* hCPU)
{ {
debug_printf("MEMFreeToAllocator(0x%x, 0x%08x)\n", hCPU->gpr[3], hCPU->gpr[4]);
MEMAllocator* memAllocator = (MEMAllocator*)memory_getPointerFromVirtualOffset(hCPU->gpr[3]); MEMAllocator* memAllocator = (MEMAllocator*)memory_getPointerFromVirtualOffset(hCPU->gpr[3]);
// redirect execution to allocator free callback // redirect execution to allocator free callback
hCPU->instructionPointer = memAllocator->func->funcFree.GetMPTR(); hCPU->instructionPointer = memAllocator->func->funcFree.GetMPTR();
@ -568,11 +566,10 @@ namespace coreinit
void coreinitExport_MEMInitAllocatorForDefaultHeap(PPCInterpreter_t* hCPU) void coreinitExport_MEMInitAllocatorForDefaultHeap(PPCInterpreter_t* hCPU)
{ {
debug_printf("MEMInitAllocatorForDefaultHeap(0x%08x)", hCPU->gpr[3]);
ppcDefineParamStructPtr(memAllocator, MEMAllocator, 0); ppcDefineParamStructPtr(memAllocator, MEMAllocator, 0);
gDefaultHeapAllocator->funcAlloc = _swapEndianU32(PPCInterpreter_makeCallableExportDepr(_DefaultHeapAllocator_Alloc)); gDefaultHeapAllocator->funcAlloc = PPCInterpreter_makeCallableExportDepr(_DefaultHeapAllocator_Alloc);
gDefaultHeapAllocator->funcFree = _swapEndianU32(PPCInterpreter_makeCallableExportDepr(_DefaultHeapAllocator_Free)); gDefaultHeapAllocator->funcFree = PPCInterpreter_makeCallableExportDepr(_DefaultHeapAllocator_Free);
memAllocator->func = gDefaultHeapAllocator.GetPtr(); memAllocator->func = gDefaultHeapAllocator.GetPtr();
memAllocator->heap = MEMPTR<void>(MEMGetBaseHeapHandle(1)); memAllocator->heap = MEMPTR<void>(MEMGetBaseHeapHandle(1));

View file

@ -831,8 +831,8 @@ SysAllocator<MEMAllocatorFunc> gExpHeapDefaultAllocator;
void MEMInitAllocatorForExpHeap(MEMAllocator* allocator, MEMHeapHandle heap, sint32 alignment) void MEMInitAllocatorForExpHeap(MEMAllocator* allocator, MEMHeapHandle heap, sint32 alignment)
{ {
allocator->func = gExpHeapDefaultAllocator.GetPtr(); allocator->func = gExpHeapDefaultAllocator.GetPtr();
gExpHeapDefaultAllocator->funcAlloc = _swapEndianU32(PPCInterpreter_makeCallableExportDepr(_DefaultAllocatorForExpHeap_Alloc)); gExpHeapDefaultAllocator->funcAlloc = PPCInterpreter_makeCallableExportDepr(_DefaultAllocatorForExpHeap_Alloc);
gExpHeapDefaultAllocator->funcFree = _swapEndianU32(PPCInterpreter_makeCallableExportDepr(_DefaultAllocatorForExpHeap_Free)); gExpHeapDefaultAllocator->funcFree = PPCInterpreter_makeCallableExportDepr(_DefaultAllocatorForExpHeap_Free);
allocator->heap = heap; allocator->heap = heap;
allocator->param1 = alignment; allocator->param1 = alignment;

View file

@ -63,7 +63,8 @@ namespace coreinit
bool negativeAlignment = alignment < 0; bool negativeAlignment = alignment < 0;
if (negativeAlignment) if (negativeAlignment)
alignment = -alignment; alignment = -alignment;
if (!std::has_single_bit<uint32>((uint32)alignment)) uint32 bits = (uint32)alignment;
if (bits == 0 || (bits & (bits - 1)) != 0)
{ {
cemuLog_log(LogType::APIErrors, "MEMGetAllocatableSizeForFrmHeapEx(): Invalid alignment"); cemuLog_log(LogType::APIErrors, "MEMGetAllocatableSizeForFrmHeapEx(): Invalid alignment");
return 0; return 0;

View file

@ -366,7 +366,7 @@ namespace coreinit
void InitializeTimeAndCalendar() void InitializeTimeAndCalendar()
{ {
osLib_addFunction("coreinit", "OSGetTime", export_OSGetTime); osLib_addFunction("coreinit", "OSGetTime", export_OSGetTime);
osLib_addFunction("coreinit", "OSGetSystemTime", export_OSGetSystemTimeDummy); // register dummy HLE function to get Cemuhook to patch our dummy instead of the real function osLib_addFunction("coreinit", "OSGetSystemTime", export_OSGetSystemTimeDummy);
osLib_addFunction("coreinit", "OSGetTick", export_OSGetTick); osLib_addFunction("coreinit", "OSGetTick", export_OSGetTick);
cafeExportRegister("coreinit", OSTicksToCalendarTime, LogType::Placeholder); cafeExportRegister("coreinit", OSTicksToCalendarTime, LogType::Placeholder);

View file

@ -455,7 +455,7 @@ void export_curl_multi_fdset(PPCInterpreter_t* hCPU)
ppcDefineParamMEMPTR(exceptionFd, wu_fd_set, 3); ppcDefineParamMEMPTR(exceptionFd, wu_fd_set, 3);
ppcDefineParamU32BEPtr(maxFd, 4); ppcDefineParamU32BEPtr(maxFd, 4);
#if BOOST_OS_LINUX > 0 #if BOOST_OS_LINUX || BOOST_OS_MACOS
cemuLog_log(LogType::Force, "curl_multi_fdset(...) - todo"); cemuLog_log(LogType::Force, "curl_multi_fdset(...) - todo");
osLib_returnFromFunction(hCPU, 0); osLib_returnFromFunction(hCPU, 0);

View file

@ -242,7 +242,7 @@ namespace save
} }
catch (const std::exception& ex) catch (const std::exception& ex)
{ {
#if BOOST_OS_WINDOWS > 0 #if BOOST_OS_WINDOWS
std::wstringstream errorMsg; std::wstringstream errorMsg;
errorMsg << L"Couldn't move your save files!" << std::endl << std::endl; errorMsg << L"Couldn't move your save files!" << std::endl << std::endl;
errorMsg << L"Error: " << ex.what() << std::endl << std::endl; errorMsg << L"Error: " << ex.what() << std::endl << std::endl;

View file

@ -3,7 +3,7 @@
#include <bitset> #include <bitset>
#include "nsyshid.h" #include "nsyshid.h"
#if BOOST_OS_WINDOWS > 0 #if BOOST_OS_WINDOWS
#include <setupapi.h> #include <setupapi.h>
#include <initguid.h> #include <initguid.h>

View file

@ -6,7 +6,7 @@
#include "Common/socket.h" #include "Common/socket.h"
#if BOOST_OS_WINDOWS > 0 #if BOOST_OS_WINDOWS
#define WU_AF_INET 2 #define WU_AF_INET 2
@ -2085,7 +2085,7 @@ void nsysnet_load()
osLib_addFunction("nsysnet", "NSSLExportInternalClientCertificate", nsysnet::export_NSSLExportInternalClientCertificate); osLib_addFunction("nsysnet", "NSSLExportInternalClientCertificate", nsysnet::export_NSSLExportInternalClientCertificate);
} }
#if BOOST_OS_LINUX #if BOOST_OS_LINUX || BOOST_OS_MACOS
void nsysnet_notifyCloseSharedSocket(SOCKET existingSocket) void nsysnet_notifyCloseSharedSocket(SOCKET existingSocket)
{ {

View file

@ -2,7 +2,7 @@
#include <set> #include <set>
#include <vector> #include <vector>
#if BOOST_OS_WINDOWS > 0 #if BOOST_OS_WINDOWS
#include <WinSock2.h> #include <WinSock2.h>
#else #else
#include <sys/socket.h> #include <sys/socket.h>

View file

@ -390,7 +390,7 @@ void swkbd_render(bool mainWindow)
ImGui::PushFont(font); ImGui::PushFont(font);
if (ImGui::Begin("Keyboard Input", nullptr, kPopupFlags)) if (ImGui::Begin("Keyboard Input", nullptr, kPopupFlags))
{ {
ImGui::Text(_utf8WrapperPtr(ICON_FA_KEYBOARD)); ImGui::Text("%s", _utf8WrapperPtr(ICON_FA_KEYBOARD));
ImGui::SameLine(70); ImGui::SameLine(70);
auto text = boost::nowide::narrow(fmt::format(L"{}", swkbdInternalState->formStringBuffer)); auto text = boost::nowide::narrow(fmt::format(L"{}", swkbdInternalState->formStringBuffer));

View file

@ -44,48 +44,3 @@ void ExpressionParser_test()
cemu_assert_debug(_testEvaluateToType<float>("5 > 4 > 3 > -2") == 1.0f); // this should evaluate the operations from left to right, (5 > 4) -> 0.0, (0.0 > 4) -> 0.0, (0.0 > 3) -> 0.0, (0.0 > -2) -> 1.0 cemu_assert_debug(_testEvaluateToType<float>("5 > 4 > 3 > -2") == 1.0f); // this should evaluate the operations from left to right, (5 > 4) -> 0.0, (0.0 > 4) -> 0.0, (0.0 > 3) -> 0.0, (0.0 > -2) -> 1.0
cemu_assert_debug(_testEvaluateToType<float>("(5 == 5) > (5 == 6)") == 1.0f); cemu_assert_debug(_testEvaluateToType<float>("(5 == 5) > (5 == 6)") == 1.0f);
} }
// Cemuhook exports
DLLEXPORT ExpressionParser* ExpressionParser_Create()
{
return new ExpressionParser();
}
DLLEXPORT ExpressionParser* ExpressionParser_CreateCopy(ExpressionParser* ep)
{
return new ExpressionParser((ExpressionParser&)*ep);
}
DLLEXPORT void ExpressionParser_Delete(ExpressionParser* ep)
{
delete ep;
}
DLLEXPORT void ExpressionParser_AddConstantDouble(ExpressionParser* ep, const char* name, double value)
{
ep->AddConstant(name, value);
}
DLLEXPORT void ExpressionParser_AddConstantString(ExpressionParser* ep, const char* name, const char* value)
{
ep->AddConstant(name, value);
}
DLLEXPORT bool ExpressionParser_EvaluateToDouble(ExpressionParser* ep, const char* expression, double* result)
{
try
{
const double temp = ep->Evaluate(std::string(expression));
if (result)
*result = temp;
return true;
}
catch (const std::exception& ex)
{
if( result )
forceLog_printf("Unable to evaluate expression: %s", ex.what());
return false;
}
}

View file

@ -12,7 +12,7 @@
#include <fmt/format.h> #include <fmt/format.h>
#ifdef __clang__ #ifdef __clang__
#include "Common/linux/fast_float.h" #include "Common/unix/fast_float.h"
#define _EP_FROM_CHARS_DBL(...) _convFastFloatResult(fast_float::from_chars(__VA_ARGS__)) #define _EP_FROM_CHARS_DBL(...) _convFastFloatResult(fast_float::from_chars(__VA_ARGS__))
inline std::from_chars_result _convFastFloatResult(fast_float::from_chars_result r) inline std::from_chars_result _convFastFloatResult(fast_float::from_chars_result r)

View file

@ -200,7 +200,7 @@ void cafeLog_log(uint32 type, const char* format, ...)
char logTempStr[2048]; char logTempStr[2048];
va_list(args); va_list(args);
va_start(args, format); va_start(args, format);
#if BOOST_OS_WINDOWS > 0 #if BOOST_OS_WINDOWS
vsprintf_s(logTempStr, format, args); vsprintf_s(logTempStr, format, args);
#else #else
vsprintf(logTempStr, format, args); vsprintf(logTempStr, format, args);
@ -226,7 +226,7 @@ void cafeLog_logW(uint32 type, const wchar_t* format, ...)
wchar_t logTempStr[2048]; wchar_t logTempStr[2048];
va_list(args); va_list(args);
va_start(args, format); va_start(args, format);
#if BOOST_OS_WINDOWS > 0 #if BOOST_OS_WINDOWS
vswprintf_s(logTempStr, format, args); vswprintf_s(logTempStr, format, args);
#else #else
vswprintf(logTempStr, 2048, format, args); vswprintf(logTempStr, 2048, format, args);
@ -243,7 +243,7 @@ void cafeLog_logW(uint32 type, const wchar_t* format, ...)
LoggingWindow::Log(it->second, logTempStr); LoggingWindow::Log(it->second, logTempStr);
} }
DLLEXPORT void cemuLog_log() void cemuLog_log()
{ {
typedef void(*VoidFunc)(); typedef void(*VoidFunc)();
const VoidFunc func = (VoidFunc)cafeLog_log; const VoidFunc func = (VoidFunc)cafeLog_log;

View file

@ -628,7 +628,7 @@ public:
ppcAssembler_setError(assemblerCtx->ctx, fmt::format("\'{}\' does not end with valid memory register syntax. Memory operand must have the form offset(gpr). Example: 0x20(r3)", svOpText)); ppcAssembler_setError(assemblerCtx->ctx, fmt::format("\'{}\' does not end with valid memory register syntax. Memory operand must have the form offset(gpr). Example: 0x20(r3)", svOpText));
return false; return false;
} }
std::string_view svExpressionPart(startPtr, endPtr); std::string_view svExpressionPart(startPtr, endPtr - startPtr);
std::string_view svRegPart(memoryRegBegin, memoryRegEnd - memoryRegBegin); std::string_view svRegPart(memoryRegBegin, memoryRegEnd - memoryRegBegin);
sint32 memGpr = _parseRegIndex(svRegPart, "r"); sint32 memGpr = _parseRegIndex(svRegPart, "r");
//if (_ppcAssembler_parseRegister(svRegPart, "r", memGpr) == false || (memGpr < 0 || memGpr >= 32)) //if (_ppcAssembler_parseRegister(svRegPart, "r", memGpr) == false || (memGpr < 0 || memGpr >= 32))

View file

@ -73,6 +73,11 @@ CurlRequestHelper::CurlRequestHelper()
curl_easy_setopt(m_curl, CURLOPT_FOLLOWLOCATION, 1); curl_easy_setopt(m_curl, CURLOPT_FOLLOWLOCATION, 1);
curl_easy_setopt(m_curl, CURLOPT_MAXREDIRS, 2); curl_easy_setopt(m_curl, CURLOPT_MAXREDIRS, 2);
if(GetConfig().proxy_server.GetValue() != "")
{
curl_easy_setopt(m_curl, CURLOPT_PROXY, GetConfig().proxy_server.GetValue().c_str());
}
} }
CurlRequestHelper::~CurlRequestHelper() CurlRequestHelper::~CurlRequestHelper()
@ -216,6 +221,11 @@ CurlSOAPHelper::CurlSOAPHelper()
// SSL // SSL
curl_easy_setopt(m_curl, CURLOPT_SSL_CTX_FUNCTION, _sslctx_function_SOAP); curl_easy_setopt(m_curl, CURLOPT_SSL_CTX_FUNCTION, _sslctx_function_SOAP);
curl_easy_setopt(m_curl, CURLOPT_SSL_CTX_DATA, NULL); curl_easy_setopt(m_curl, CURLOPT_SSL_CTX_DATA, NULL);
if(GetConfig().proxy_server.GetValue() != "")
{
curl_easy_setopt(m_curl, CURLOPT_PROXY, GetConfig().proxy_server.GetValue().c_str());
}
} }
CurlSOAPHelper::~CurlSOAPHelper() CurlSOAPHelper::~CurlSOAPHelper()

View file

@ -5,7 +5,7 @@
#include "util/crypto/md5.h" #include "util/crypto/md5.h"
// for inet_pton: // for inet_pton:
#if BOOST_OS_WINDOWS > 0 #if BOOST_OS_WINDOWS
#include <WS2tcpip.h> #include <WS2tcpip.h>
#else #else
#include <arpa/inet.h> #include <arpa/inet.h>

View file

@ -4,6 +4,8 @@
#include<bitset> #include<bitset>
#include<random> #include<random>
#include <boost/random/uniform_int.hpp>
void swap(unsigned char *a, unsigned char *b) void swap(unsigned char *a, unsigned char *b)
{ {
int tmp = *a; int tmp = *a;
@ -111,7 +113,8 @@ void releasePRUDPPort(uint16 port)
} }
std::mt19937_64 prudpRG(GetTickCount()); std::mt19937_64 prudpRG(GetTickCount());
std::uniform_int_distribution<int> prudpDis8(0, 0xFF); // workaround for static asserts when using uniform_int_distribution
boost::random::uniform_int_distribution<int> prudpDis8(0, 0xFF);
uint8 prudp_generateRandomU8() uint8 prudp_generateRandomU8()
{ {
@ -529,7 +532,7 @@ prudpClient::prudpClient(uint32 dstIp, uint16 dstPort, const char* key) : prudpC
break; break;
} }
// set socket to non-blocking mode // set socket to non-blocking mode
#if BOOST_OS_WINDOWS > 0 #if BOOST_OS_WINDOWS
u_long nonBlockingMode = 1; // 1 to enable non-blocking socket u_long nonBlockingMode = 1; // 1 to enable non-blocking socket
ioctlsocket(socketUdp, FIONBIO, &nonBlockingMode); ioctlsocket(socketUdp, FIONBIO, &nonBlockingMode);
#else #else

View file

@ -17,8 +17,8 @@ PRIVATE
else() else()
target_sources(CemuCommon target_sources(CemuCommon
PRIVATE PRIVATE
linux/platform.cpp unix/platform.cpp
linux/platform.h unix/platform.h
) )
endif() endif()

View file

@ -1,7 +1,7 @@
#include "Common/precompiled.h" #include "Common/precompiled.h"
#include "Cafe/CafeSystem.h" #include "Cafe/CafeSystem.h"
#if BOOST_OS_LINUX #if BOOST_OS_LINUX || BOOST_OS_MACOS
#include <signal.h> #include <signal.h>
#include <execinfo.h> #include <execinfo.h>
#endif #endif
@ -41,7 +41,6 @@ void crashlog_writeHeader(const char* header)
} }
bool crashLogCreated = false; bool crashLogCreated = false;
bool IsCemuhookLoaded();
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
BOOL CALLBACK MyMiniDumpCallback(PVOID pParam, const PMINIDUMP_CALLBACK_INPUT pInput, PMINIDUMP_CALLBACK_OUTPUT pOutput) BOOL CALLBACK MyMiniDumpCallback(PVOID pParam, const PMINIDUMP_CALLBACK_INPUT pInput, PMINIDUMP_CALLBACK_OUTPUT pOutput)
{ {
@ -375,9 +374,6 @@ void createCrashlog(EXCEPTION_POINTERS* e, PCONTEXT context)
fs::copy_file(ActiveSettings::GetPath("log.txt"), p, ec); fs::copy_file(ActiveSettings::GetPath("log.txt"), p, ec);
} }
if (IsCemuhookLoaded())
TerminateProcess(GetCurrentProcess(), 0); // abort();
else
exit(0); exit(0);
return; return;

View file

@ -6,11 +6,12 @@
#if BOOST_OS_WINDOWS #if BOOST_OS_WINDOWS
#include "Common/windows/platform.h" #include "Common/windows/platform.h"
#elif BOOST_OS_LINUX #elif BOOST_OS_LINUX
#include "byteswap.h" #include <byteswap.h>
//#include <boost/core/enable_if.hpp> #include <X11/Xlib.h>
// #include <boost/type_traits.hpp> #include <X11/extensions/Xrender.h>
#include "Common/linux/platform.h" #include <X11/Xutil.h>
#include "Common/unix/platform.h"
#elif BOOST_OS_MACOS #elif BOOST_OS_MACOS
#include <libkern/OSByteOrder.h>
#include "Common/unix/platform.h"
#endif #endif

View file

@ -138,22 +138,32 @@ inline sint16 _swapEndianS16(sint16 v)
{ {
return (sint16)(((uint16)v >> 8) | ((uint16)v << 8)); return (sint16)(((uint16)v >> 8) | ((uint16)v << 8));
} }
#endif #else
#if BOOST_OS_LINUX
inline uint64 _swapEndianU64(uint64 v) inline uint64 _swapEndianU64(uint64 v)
{ {
#if BOOST_OS_MACOS
return OSSwapInt64(v);
#else
return bswap_64(v); return bswap_64(v);
#endif
} }
inline uint32 _swapEndianU32(uint32 v) inline uint32 _swapEndianU32(uint32 v)
{ {
#if BOOST_OS_MACOS
return OSSwapInt32(v);
#else
return bswap_32(v); return bswap_32(v);
#endif
} }
inline sint32 _swapEndianS32(sint32 v) inline sint32 _swapEndianS32(sint32 v)
{ {
#if BOOST_OS_MACOS
return (sint32)OSSwapInt32((uint32)v);
#else
return (sint32)bswap_32((uint32)v); return (sint32)bswap_32((uint32)v);
#endif
} }
inline uint16 _swapEndianU16(uint16 v) inline uint16 _swapEndianU16(uint16 v)

View file

@ -1,6 +1,6 @@
#pragma once #pragma once
#if BOOST_OS_WINDOWS > 0 #if BOOST_OS_WINDOWS
#include <WinSock2.h> #include <WinSock2.h>
typedef int socklen_t; typedef int socklen_t;

View file

@ -32,9 +32,6 @@ inline uint32_t GetExceptionError()
return errno; return errno;
} }
#include <X11/Xlib.h>
#include <X11/extensions/Xrender.h>
#include <X11/Xutil.h>
#undef False #undef False
#undef True #undef True
#undef None #undef None

View file

@ -12,7 +12,11 @@ set_source_files_properties(x64util_masm.asm PROPERTIES LANGUAGE ASM_MASM)
ELSE() ELSE()
# NASM # NASM
IF (APPLE)
set(CMAKE_ASM_NASM_COMPILE_OBJECT "<CMAKE_ASM_NASM_COMPILER> -g -Fdwarf -f macho64 --prefix _ -o <OBJECT> <SOURCE>")
ELSE()
set(CMAKE_ASM_NASM_COMPILE_OBJECT "<CMAKE_ASM_NASM_COMPILER> -g -Fdwarf -f elf64 -o <OBJECT> <SOURCE>") set(CMAKE_ASM_NASM_COMPILE_OBJECT "<CMAKE_ASM_NASM_COMPILER> -g -Fdwarf -f elf64 -o <OBJECT> <SOURCE>")
ENDIF()
set(CMAKE_ASM_NASM_LINK_EXECUTABLE "ld <FLAGS> <CMAKE_ASM_NASM_LINK_FLAGS> <LINK_FLAGS> -fPIC <OBJECTS> -o <TARGET> <LINK_LIBRARIES>") set(CMAKE_ASM_NASM_LINK_EXECUTABLE "ld <FLAGS> <CMAKE_ASM_NASM_LINK_FLAGS> <LINK_FLAGS> -fPIC <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
enable_language(C ASM_NASM) enable_language(C ASM_NASM)
@ -22,7 +26,11 @@ x64util_nasm.asm
) )
set_source_files_properties(x64util_nasm.asm PROPERTIES LANGUAGE ASM_NASM) set_source_files_properties(x64util_nasm.asm PROPERTIES LANGUAGE ASM_NASM)
IF (APPLE)
set_target_properties(CemuAsm PROPERTIES NASM_OBJ_FORMAT macho64)
ELSE()
set_target_properties(CemuAsm PROPERTIES NASM_OBJ_FORMAT elf64) set_target_properties(CemuAsm PROPERTIES NASM_OBJ_FORMAT elf64)
ENDIF()
set_target_properties(CemuAsm PROPERTIES LINKER_LANGUAGE C) set_target_properties(CemuAsm PROPERTIES LINKER_LANGUAGE C)
ENDIF() ENDIF()

View file

@ -1,6 +1,6 @@
#include "IAudioAPI.h" #include "IAudioAPI.h"
#if BOOST_OS_WINDOWS > 0 #if BOOST_OS_WINDOWS
#include "XAudio2API.h" #include "XAudio2API.h"
#include "XAudio27API.h" #include "XAudio27API.h"
#include "DirectSoundAPI.h" #include "DirectSoundAPI.h"
@ -37,7 +37,7 @@ void IAudioAPI::PrintLogging()
void IAudioAPI::InitWFX(sint32 samplerate, sint32 channels, sint32 bits_per_sample) void IAudioAPI::InitWFX(sint32 samplerate, sint32 channels, sint32 bits_per_sample)
{ {
#if BOOST_OS_WINDOWS > 0 #if BOOST_OS_WINDOWS
// move this to Windows-specific audio API implementations and use a cross-platform format here // move this to Windows-specific audio API implementations and use a cross-platform format here
m_wfx.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE; m_wfx.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE;
m_wfx.Format.nChannels = channels; m_wfx.Format.nChannels = channels;

View file

@ -1,6 +1,6 @@
#pragma once #pragma once
#if BOOST_OS_WINDOWS > 0 #if BOOST_OS_WINDOWS
#include <mmreg.h> #include <mmreg.h>
#endif #endif
@ -64,7 +64,7 @@ public:
static std::vector<DeviceDescriptionPtr> GetDevices(AudioAPI api); static std::vector<DeviceDescriptionPtr> GetDevices(AudioAPI api);
protected: protected:
#if BOOST_OS_WINDOWS > 0 #if BOOST_OS_WINDOWS
WAVEFORMATEXTENSIBLE m_wfx{}; WAVEFORMATEXTENSIBLE m_wfx{};
#endif #endif

View file

@ -1,12 +0,0 @@
project(CemuCemuhook)
add_library(CemuCemuhook
wxEvtHook.inl
wxCemuhookExports.cpp
)
set_property(TARGET CemuCemuhook PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
target_precompile_headers(CemuCemuhook PRIVATE ../Common/precompiled.h)
target_include_directories(CemuCemuhook PRIVATE ../)

View file

@ -1,196 +0,0 @@
#ifdef USE_CEMUHOOK
#include <wx/app.h>
#include <wx/event.h>
#include <wx/process.h>
#include <wx/timer.h>
#include <wx/window.h>
#include <wx/dialog.h>
#include <wx/dcclient.h>
#include <wx/frame.h>
#include <wx/menu.h>
#include <wx/sizer.h>
#include <wx/checklst.h>
#include <wx/button.h>
#include <wx/combobox.h>
#include <wx/stattext.h>
#include <wx/listctrl.h>
#include <wx/dataview.h>
#include <wx/filedlg.h>
#include <wx/mstream.h>
#include <wx/hyperlink.h>
#include <wx/clipbrd.h>
#include <wx/notebook.h>
#include <wx/spinctrl.h>
#include <wx/collpane.h>
#include <wx/collheaderctrl.h>
#include <wx/power.h>
#include <wx/gauge.h>
#define CHECK_FOR_WX_EVT_STRING(strVar, strConst) if (strcmp(strVar, #strConst) == 0){ return static_cast<int>(strConst); }
DLLEXPORT wxEvtHandler* wxEvtHandler_Initialize(uint8_t* allocMemory)
{
wxEvtHandler* handler = new (allocMemory) wxEvtHandler();
return handler;
}
DLLEXPORT void wxEvtHandler_Connect(wxEvtHandler* eventSource, int id, int lastId, int eventType, wxObjectEventFunction func, wxObject* userData, wxEvtHandler* eventSink)
{
eventSource->Connect(id, lastId, eventType, func, userData, eventSink);
}
DLLEXPORT void wxEvtHandler_Disconnect(wxEvtHandler* eventSource, int id, int lastId, int eventType, wxObjectEventFunction func, wxObject* userData, wxEvtHandler* eventSink)
{
eventSource->Disconnect(id, lastId, eventType, func, userData, eventSink);
}
DLLEXPORT const wchar_t* GetTranslationWChar(const wchar_t* text)
{
return wxGetTranslation(text).wc_str();
}
DLLEXPORT int wxGetEventByName(const char* eventName)
{
#define PROCESS_OWN_WXEVT(EventVarName,EventHookId) if (!strcmp(eventName,#EventVarName)){ return static_cast<int>(EventVarName); }
#include "wxEvtHook.inl"
#undef PROCESS_OWN_WXEVT
return -1;
}
#pragma optimize( "", off )
static bool FixupWxEvtId(const wxEventType& outObj, const int newId)
{
const int oldVal = static_cast<int>(outObj);
if (oldVal == newId)
return false;
wxEventType* dstObj = const_cast<wxEventType*>(&outObj);
memcpy(dstObj, &newId, sizeof(newId));
// check value again
if (static_cast<int>(outObj) != newId)
assert_dbg();
return true;
}
void FixupWxEvtIdsToMatchCemuHook()
{
// instantiate all the events
#define PROCESS_OWN_WXEVT(EventVarName,EventHookId) static_cast<int>(EventVarName);
#include "cemuhook/wxEvtHook.inl"
#undef PROCESS_OWN_WXEVT
// fix them
#define PROCESS_OWN_WXEVT(EventVarName,EventHookId) FixupWxEvtId(EventVarName,EventHookId)
#include "cemuhook/wxEvtHook.inl"
#undef PROCESS_OWN_WXEVT
}
#pragma optimize( "", on )
// these I added on my own since they might be useful
DLLEXPORT void coreinitAPI_OSYieldThread()
{
PPCCore_switchToScheduler();
}
#define xstr(a) str(a)
#define str(a) #a
#define PRINT_EVENT(__evtName) printf(xstr(__evtName) " = %d\n", (int)(wxEventType)__evtName);
void PrintEvents()
{
PRINT_EVENT(wxEVT_IDLE)
PRINT_EVENT(wxEVT_THREAD)
PRINT_EVENT(wxEVT_ASYNC_METHOD_CALL)
PRINT_EVENT(wxEVT_BUTTON)
PRINT_EVENT(wxEVT_CHECKBOX)
PRINT_EVENT(wxEVT_CHOICE)
PRINT_EVENT(wxEVT_LISTBOX)
PRINT_EVENT(wxEVT_LISTBOX_DCLICK)
PRINT_EVENT(wxEVT_CHECKLISTBOX)
PRINT_EVENT(wxEVT_MENU)
PRINT_EVENT(wxEVT_SLIDER)
PRINT_EVENT(wxEVT_RADIOBOX)
PRINT_EVENT(wxEVT_RADIOBUTTON)
PRINT_EVENT(wxEVT_SCROLLBAR)
PRINT_EVENT(wxEVT_LEFT_DOWN)
PRINT_EVENT(wxEVT_LEFT_UP)
PRINT_EVENT(wxEVT_MIDDLE_DOWN)
PRINT_EVENT(wxEVT_MIDDLE_UP)
PRINT_EVENT(wxEVT_RIGHT_DOWN)
PRINT_EVENT(wxEVT_RIGHT_UP)
PRINT_EVENT(wxEVT_MOTION)
PRINT_EVENT(wxEVT_ENTER_WINDOW)
PRINT_EVENT(wxEVT_LEAVE_WINDOW)
PRINT_EVENT(wxEVT_CHAR)
PRINT_EVENT(wxEVT_SET_CURSOR)
PRINT_EVENT(wxEVT_SCROLL_TOP)
PRINT_EVENT(wxEVT_SCROLL_BOTTOM)
PRINT_EVENT(wxEVT_SIZE)
PRINT_EVENT(wxEVT_MOVE)
PRINT_EVENT(wxEVT_CLOSE_WINDOW)
PRINT_EVENT(wxEVT_END_SESSION)
PRINT_EVENT(wxEVT_ACTIVATE_APP)
PRINT_EVENT(wxEVT_ACTIVATE)
PRINT_EVENT(wxEVT_CREATE)
PRINT_EVENT(wxEVT_DESTROY)
PRINT_EVENT(wxEVT_SHOW)
PRINT_EVENT(wxEVT_ICONIZE)
PRINT_EVENT(wxEVT_MAXIMIZE)
PRINT_EVENT(wxEVT_PAINT)
PRINT_EVENT(wxEVT_MENU_OPEN)
PRINT_EVENT(wxEVT_MENU_CLOSE)
PRINT_EVENT(wxEVT_MENU_HIGHLIGHT)
PRINT_EVENT(wxEVT_CONTEXT_MENU)
PRINT_EVENT(wxEVT_UPDATE_UI)
PRINT_EVENT(wxEVT_SIZING)
PRINT_EVENT(wxEVT_MOVING)
PRINT_EVENT(wxEVT_TEXT_COPY)
PRINT_EVENT(wxEVT_TEXT_CUT)
PRINT_EVENT(wxEVT_TEXT_PASTE)
}
void wxMatchCemuhookEventIds()
{
FixupWxEvtIdsToMatchCemuHook();
//PrintEvents();
// check if key eventIds match with Cemuhook
cemu_assert((wxEventType)wxEVT_SIZE == 10078);
cemu_assert((wxEventType)wxEVT_HYPERLINK == 10156);
cemu_assert((wxEventType)wxEVT_IDLE == 10001);
cemu_assert((wxEventType)wxEVT_UPDATE_UI == 10116);
}
/* This code reserves the first 300 wxWidgets event ids early, so that they cant be grabbed by wxWidgets constructors for the regular events. We then assign fixed IDs that match Cemuhook's later */
#pragma init_seg(lib)
int wxNewEventType();
bool wxReserveEventIds()
{
for (int i = 0; i < 300; i++)
wxNewEventType();
return true;
}
bool s_placeholderResult = wxReserveEventIds();
#endif

View file

@ -1,171 +0,0 @@
PROCESS_OWN_WXEVT(wxEVT_NULL,10000);
PROCESS_OWN_WXEVT(wxEVT_IDLE,10001);
PROCESS_OWN_WXEVT(wxEVT_THREAD,10002);
PROCESS_OWN_WXEVT(wxEVT_ASYNC_METHOD_CALL,10003);
PROCESS_OWN_WXEVT(wxEVT_END_PROCESS,10004);
PROCESS_OWN_WXEVT(wxEVT_TIMER,10005);
PROCESS_OWN_WXEVT(wxEVT_BUTTON,10006);
PROCESS_OWN_WXEVT(wxEVT_CHECKBOX,10007);
PROCESS_OWN_WXEVT(wxEVT_CHOICE,10008);
PROCESS_OWN_WXEVT(wxEVT_LISTBOX,10009);
PROCESS_OWN_WXEVT(wxEVT_LISTBOX_DCLICK,10010);
PROCESS_OWN_WXEVT(wxEVT_CHECKLISTBOX,10011);
PROCESS_OWN_WXEVT(wxEVT_MENU,10012);
PROCESS_OWN_WXEVT(wxEVT_SLIDER,10013);
PROCESS_OWN_WXEVT(wxEVT_RADIOBOX,10014);
PROCESS_OWN_WXEVT(wxEVT_RADIOBUTTON,10015);
PROCESS_OWN_WXEVT(wxEVT_SCROLLBAR,10016);
PROCESS_OWN_WXEVT(wxEVT_VLBOX,10017);
PROCESS_OWN_WXEVT(wxEVT_COMBOBOX,10018);
PROCESS_OWN_WXEVT(wxEVT_TOOL_RCLICKED,10019);
PROCESS_OWN_WXEVT(wxEVT_TOOL_ENTER,10020);
PROCESS_OWN_WXEVT(wxEVT_TOOL_DROPDOWN,10021);
PROCESS_OWN_WXEVT(wxEVT_COMBOBOX_DROPDOWN,10022);
PROCESS_OWN_WXEVT(wxEVT_COMBOBOX_CLOSEUP,10023);
PROCESS_OWN_WXEVT(wxEVT_LEFT_DOWN,10024);
PROCESS_OWN_WXEVT(wxEVT_LEFT_UP,10025);
PROCESS_OWN_WXEVT(wxEVT_MIDDLE_DOWN,10026);
PROCESS_OWN_WXEVT(wxEVT_MIDDLE_UP,10027);
PROCESS_OWN_WXEVT(wxEVT_RIGHT_DOWN,10028);
PROCESS_OWN_WXEVT(wxEVT_RIGHT_UP,10029);
PROCESS_OWN_WXEVT(wxEVT_MOTION,10030);
PROCESS_OWN_WXEVT(wxEVT_ENTER_WINDOW,10031);
PROCESS_OWN_WXEVT(wxEVT_LEAVE_WINDOW,10032);
PROCESS_OWN_WXEVT(wxEVT_LEFT_DCLICK,10033);
PROCESS_OWN_WXEVT(wxEVT_MIDDLE_DCLICK,10034);
PROCESS_OWN_WXEVT(wxEVT_RIGHT_DCLICK,10035);
PROCESS_OWN_WXEVT(wxEVT_SET_FOCUS,10036);
PROCESS_OWN_WXEVT(wxEVT_KILL_FOCUS,10037);
PROCESS_OWN_WXEVT(wxEVT_CHILD_FOCUS,10038);
PROCESS_OWN_WXEVT(wxEVT_MOUSEWHEEL,10039);
PROCESS_OWN_WXEVT(wxEVT_AUX1_DOWN,10040);
PROCESS_OWN_WXEVT(wxEVT_AUX1_UP,10041);
PROCESS_OWN_WXEVT(wxEVT_AUX1_DCLICK,10042);
PROCESS_OWN_WXEVT(wxEVT_AUX2_DOWN,10043);
PROCESS_OWN_WXEVT(wxEVT_AUX2_UP,10044);
PROCESS_OWN_WXEVT(wxEVT_AUX2_DCLICK,10045);
PROCESS_OWN_WXEVT(wxEVT_MAGNIFY,10046);
PROCESS_OWN_WXEVT(wxEVT_CHAR,10047);
PROCESS_OWN_WXEVT(wxEVT_AFTER_CHAR,10048);
PROCESS_OWN_WXEVT(wxEVT_CHAR_HOOK,10049);
PROCESS_OWN_WXEVT(wxEVT_NAVIGATION_KEY,10050);
PROCESS_OWN_WXEVT(wxEVT_KEY_DOWN,10051);
PROCESS_OWN_WXEVT(wxEVT_KEY_UP,10052);
PROCESS_OWN_WXEVT(wxEVT_HOTKEY,10053);
PROCESS_OWN_WXEVT(wxEVT_SET_CURSOR,10054);
PROCESS_OWN_WXEVT(wxEVT_SCROLL_TOP,10055);
PROCESS_OWN_WXEVT(wxEVT_SCROLL_BOTTOM,10056);
PROCESS_OWN_WXEVT(wxEVT_SCROLL_LINEUP,10057);
PROCESS_OWN_WXEVT(wxEVT_SCROLL_LINEDOWN,10058);
PROCESS_OWN_WXEVT(wxEVT_SCROLL_PAGEUP,10059);
PROCESS_OWN_WXEVT(wxEVT_SCROLL_PAGEDOWN,10060);
PROCESS_OWN_WXEVT(wxEVT_SCROLL_THUMBTRACK,10061);
PROCESS_OWN_WXEVT(wxEVT_SCROLL_THUMBRELEASE,10062);
PROCESS_OWN_WXEVT(wxEVT_SCROLL_CHANGED,10063);
PROCESS_OWN_WXEVT(wxEVT_SPIN_UP,10057);
PROCESS_OWN_WXEVT(wxEVT_SPIN_DOWN,10058);
PROCESS_OWN_WXEVT(wxEVT_SPIN,10061);
PROCESS_OWN_WXEVT(wxEVT_SCROLLWIN_TOP,10064);
PROCESS_OWN_WXEVT(wxEVT_SCROLLWIN_BOTTOM,10065);
PROCESS_OWN_WXEVT(wxEVT_SCROLLWIN_LINEUP,10066);
PROCESS_OWN_WXEVT(wxEVT_SCROLLWIN_LINEDOWN,10067);
PROCESS_OWN_WXEVT(wxEVT_SCROLLWIN_PAGEUP,10068);
PROCESS_OWN_WXEVT(wxEVT_SCROLLWIN_PAGEDOWN,10069);
PROCESS_OWN_WXEVT(wxEVT_SCROLLWIN_THUMBTRACK,10070);
PROCESS_OWN_WXEVT(wxEVT_SCROLLWIN_THUMBRELEASE,10071);
PROCESS_OWN_WXEVT(wxEVT_GESTURE_PAN,10072);
PROCESS_OWN_WXEVT(wxEVT_GESTURE_ZOOM,10073);
PROCESS_OWN_WXEVT(wxEVT_GESTURE_ROTATE,10074);
PROCESS_OWN_WXEVT(wxEVT_TWO_FINGER_TAP,10075);
PROCESS_OWN_WXEVT(wxEVT_LONG_PRESS,10076);
PROCESS_OWN_WXEVT(wxEVT_PRESS_AND_TAP,10077);
PROCESS_OWN_WXEVT(wxEVT_SIZE,10078);
PROCESS_OWN_WXEVT(wxEVT_SIZING,10079);
PROCESS_OWN_WXEVT(wxEVT_MOVE,10080);
PROCESS_OWN_WXEVT(wxEVT_MOVING,10081);
PROCESS_OWN_WXEVT(wxEVT_MOVE_START,10082);
PROCESS_OWN_WXEVT(wxEVT_MOVE_END,10083);
PROCESS_OWN_WXEVT(wxEVT_CLOSE_WINDOW,10084);
PROCESS_OWN_WXEVT(wxEVT_END_SESSION,10085);
PROCESS_OWN_WXEVT(wxEVT_QUERY_END_SESSION,10086);
PROCESS_OWN_WXEVT(wxEVT_HIBERNATE,10087);
PROCESS_OWN_WXEVT(wxEVT_ACTIVATE_APP,10088);
PROCESS_OWN_WXEVT(wxEVT_ACTIVATE,10089);
PROCESS_OWN_WXEVT(wxEVT_CREATE,10090);
PROCESS_OWN_WXEVT(wxEVT_DESTROY,10091);
PROCESS_OWN_WXEVT(wxEVT_SHOW,10092);
PROCESS_OWN_WXEVT(wxEVT_ICONIZE,10093);
PROCESS_OWN_WXEVT(wxEVT_MAXIMIZE,10094);
PROCESS_OWN_WXEVT(wxEVT_FULLSCREEN,10095);
PROCESS_OWN_WXEVT(wxEVT_MOUSE_CAPTURE_CHANGED,10096);
PROCESS_OWN_WXEVT(wxEVT_MOUSE_CAPTURE_LOST,10097);
PROCESS_OWN_WXEVT(wxEVT_PAINT,10098);
PROCESS_OWN_WXEVT(wxEVT_ERASE_BACKGROUND,10099);
PROCESS_OWN_WXEVT(wxEVT_NC_PAINT,10100);
PROCESS_OWN_WXEVT(wxEVT_MENU_OPEN,10101);
PROCESS_OWN_WXEVT(wxEVT_MENU_CLOSE,10102);
PROCESS_OWN_WXEVT(wxEVT_MENU_HIGHLIGHT,10103);
PROCESS_OWN_WXEVT(wxEVT_CONTEXT_MENU,10104);
PROCESS_OWN_WXEVT(wxEVT_SYS_COLOUR_CHANGED,10105);
PROCESS_OWN_WXEVT(wxEVT_DISPLAY_CHANGED,10106);
PROCESS_OWN_WXEVT(wxEVT_DPI_CHANGED,10107);
PROCESS_OWN_WXEVT(wxEVT_QUERY_NEW_PALETTE,10108);
PROCESS_OWN_WXEVT(wxEVT_PALETTE_CHANGED,10109);
PROCESS_OWN_WXEVT(wxEVT_JOY_BUTTON_DOWN,10110);
PROCESS_OWN_WXEVT(wxEVT_JOY_BUTTON_UP,10111);
PROCESS_OWN_WXEVT(wxEVT_JOY_MOVE,10112);
PROCESS_OWN_WXEVT(wxEVT_JOY_ZMOVE,10113);
PROCESS_OWN_WXEVT(wxEVT_DROP_FILES,10114);
PROCESS_OWN_WXEVT(wxEVT_INIT_DIALOG,10115);
PROCESS_OWN_WXEVT(wxEVT_UPDATE_UI,10116);
PROCESS_OWN_WXEVT(wxEVT_TEXT_COPY,10117);
PROCESS_OWN_WXEVT(wxEVT_TEXT_CUT,10118);
PROCESS_OWN_WXEVT(wxEVT_TEXT_PASTE,10119);
PROCESS_OWN_WXEVT(wxEVT_COMMAND_LEFT_CLICK,10120);
PROCESS_OWN_WXEVT(wxEVT_COMMAND_LEFT_DCLICK,10121);
PROCESS_OWN_WXEVT(wxEVT_COMMAND_RIGHT_CLICK,10122);
PROCESS_OWN_WXEVT(wxEVT_COMMAND_RIGHT_DCLICK,10123);
PROCESS_OWN_WXEVT(wxEVT_COMMAND_SET_FOCUS,10124);
PROCESS_OWN_WXEVT(wxEVT_COMMAND_KILL_FOCUS,10125);
PROCESS_OWN_WXEVT(wxEVT_COMMAND_ENTER,10126);
PROCESS_OWN_WXEVT(wxEVT_HELP,10127);
PROCESS_OWN_WXEVT(wxEVT_DETAILED_HELP,10128);
PROCESS_OWN_WXEVT(wxEVT_LIST_BEGIN_DRAG,10129);
PROCESS_OWN_WXEVT(wxEVT_LIST_BEGIN_RDRAG,10130);
PROCESS_OWN_WXEVT(wxEVT_LIST_BEGIN_LABEL_EDIT,10131);
PROCESS_OWN_WXEVT(wxEVT_LIST_END_LABEL_EDIT,10132);
PROCESS_OWN_WXEVT(wxEVT_LIST_DELETE_ITEM,10133);
PROCESS_OWN_WXEVT(wxEVT_LIST_DELETE_ALL_ITEMS,10134);
PROCESS_OWN_WXEVT(wxEVT_LIST_ITEM_SELECTED,10135);
PROCESS_OWN_WXEVT(wxEVT_LIST_ITEM_DESELECTED,10136);
PROCESS_OWN_WXEVT(wxEVT_LIST_KEY_DOWN,10137);
PROCESS_OWN_WXEVT(wxEVT_LIST_INSERT_ITEM,10138);
PROCESS_OWN_WXEVT(wxEVT_LIST_COL_CLICK,10139);
PROCESS_OWN_WXEVT(wxEVT_LIST_COL_RIGHT_CLICK,10140);
PROCESS_OWN_WXEVT(wxEVT_LIST_COL_BEGIN_DRAG,10141);
PROCESS_OWN_WXEVT(wxEVT_LIST_COL_DRAGGING,10142);
PROCESS_OWN_WXEVT(wxEVT_LIST_COL_END_DRAG,10143);
PROCESS_OWN_WXEVT(wxEVT_LIST_ITEM_RIGHT_CLICK,10144);
PROCESS_OWN_WXEVT(wxEVT_LIST_ITEM_MIDDLE_CLICK,10145);
PROCESS_OWN_WXEVT(wxEVT_LIST_ITEM_ACTIVATED,10146);
PROCESS_OWN_WXEVT(wxEVT_LIST_ITEM_FOCUSED,10147);
PROCESS_OWN_WXEVT(wxEVT_LIST_ITEM_CHECKED,10148);
PROCESS_OWN_WXEVT(wxEVT_LIST_ITEM_UNCHECKED,10149);
PROCESS_OWN_WXEVT(wxEVT_LIST_CACHE_HINT,10150);
PROCESS_OWN_WXEVT(wxEVT_TEXT,10151);
PROCESS_OWN_WXEVT(wxEVT_TEXT_ENTER,10152);
PROCESS_OWN_WXEVT(wxEVT_TEXT_URL,10153);
PROCESS_OWN_WXEVT(wxEVT_TEXT_MAXLEN,10154);
PROCESS_OWN_WXEVT(wxEVT_WINDOW_MODAL_DIALOG_CLOSED,10155);
PROCESS_OWN_WXEVT(wxEVT_HYPERLINK,10156);
PROCESS_OWN_WXEVT(wxEVT_CLIPBOARD_CHANGED,10157);
PROCESS_OWN_WXEVT(wxEVT_NOTEBOOK_PAGE_CHANGED,10158);
PROCESS_OWN_WXEVT(wxEVT_NOTEBOOK_PAGE_CHANGING,10159);
PROCESS_OWN_WXEVT(wxEVT_SPINCTRL,10160);
PROCESS_OWN_WXEVT(wxEVT_SPINCTRLDOUBLE,10161);
PROCESS_OWN_WXEVT(wxEVT_COLLAPSIBLEPANE_CHANGED,10162);
PROCESS_OWN_WXEVT(wxEVT_COLLAPSIBLEHEADER_CHANGED,10163);
PROCESS_OWN_WXEVT(wxEVT_POWER_SUSPENDING,10164);
PROCESS_OWN_WXEVT(wxEVT_POWER_SUSPENDED,10165);
PROCESS_OWN_WXEVT(wxEVT_POWER_SUSPEND_CANCEL,10166);
PROCESS_OWN_WXEVT(wxEVT_POWER_RESUME,10167);

View file

@ -10,7 +10,7 @@
#include "Cafe/HW/Latte/Renderer/Vulkan/VulkanAPI.h" #include "Cafe/HW/Latte/Renderer/Vulkan/VulkanAPI.h"
#include "Cafe/CafeSystem.h" #include "Cafe/CafeSystem.h"
extern bool DLLEXPORT alwaysDisplayDRC; extern bool alwaysDisplayDRC;
void ActiveSettings::LoadOnce() void ActiveSettings::LoadOnce()
{ {

View file

@ -65,6 +65,7 @@ void CemuConfig::Load(XMLConfigParser& parser)
did_show_vulkan_warning = parser.get("vk_warning", did_show_vulkan_warning); did_show_vulkan_warning = parser.get("vk_warning", did_show_vulkan_warning);
did_show_graphic_pack_download = parser.get("gp_download", did_show_graphic_pack_download); did_show_graphic_pack_download = parser.get("gp_download", did_show_graphic_pack_download);
fullscreen = parser.get("fullscreen", fullscreen); fullscreen = parser.get("fullscreen", fullscreen);
proxy_server = parser.get("proxy_server", "");
// cpu_mode = parser.get("cpu_mode", cpu_mode.GetInitValue()); // cpu_mode = parser.get("cpu_mode", cpu_mode.GetInitValue());
//console_region = parser.get("console_region", console_region.GetInitValue()); //console_region = parser.get("console_region", console_region.GetInitValue());
@ -340,6 +341,7 @@ void CemuConfig::Save(XMLConfigParser& parser)
config.set<bool>("vk_warning", did_show_vulkan_warning); config.set<bool>("vk_warning", did_show_vulkan_warning);
config.set<bool>("gp_download", did_show_graphic_pack_download); config.set<bool>("gp_download", did_show_graphic_pack_download);
config.set<bool>("fullscreen", fullscreen); config.set<bool>("fullscreen", fullscreen);
config.set("proxy_server", proxy_server.GetValue().c_str());
// config.set("cpu_mode", cpu_mode.GetValue()); // config.set("cpu_mode", cpu_mode.GetValue());
//config.set("console_region", console_region.GetValue()); //config.set("console_region", console_region.GetValue());

View file

@ -331,6 +331,7 @@ struct CemuConfig
ConfigValue<std::wstring> mlc_path {}; ConfigValue<std::wstring> mlc_path {};
ConfigValue<bool> fullscreen_menubar{ false }; ConfigValue<bool> fullscreen_menubar{ false };
ConfigValue<bool> fullscreen{ false }; ConfigValue<bool> fullscreen{ false };
ConfigValue<std::string> proxy_server{};
std::vector<std::wstring> game_paths; std::vector<std::wstring> game_paths;
std::mutex game_cache_entries_mutex; std::mutex game_cache_entries_mutex;

View file

@ -396,7 +396,7 @@ public:
} }
FILE* file = nullptr; FILE* file = nullptr;
#if BOOST_OS_WINDOWS > 0 #if BOOST_OS_WINDOWS
file = _wfopen(tmp_name.c_str(), L"wb"); file = _wfopen(tmp_name.c_str(), L"wb");
#else #else
file = fopen(boost::nowide::narrow(tmp_name).c_str(), "wb"); file = fopen(boost::nowide::narrow(tmp_name).c_str(), "wb");

View file

@ -1,57 +0,0 @@
EXPORTS
cemuLog_log=?cemuLog_log@@YAXXZ
PPCCore_executeCallback=?PPCCore_executeCallback@@YAXI@Z
osLib_registerHLEFunction=?osLib_registerHLEFunction@@YAXPEBD0P6AXPEAUPPCInterpreter_t@@@Z@Z
gameProfile_load=?gameProfile_load@@YAXXZ
gameProfile_categoryBegin=?gameProfile_categoryBegin@@YAXPEAVIniParser@@@Z
gameProfile_getCurrentCategoryName=?gameProfile_getCurrentCategoryName@@YAPEADPEAVIniParser@@@Z
gameProfile_loadStringOption=?gameProfile_loadStringOption@@YAPEADPEAVIniParser@@PEAD@Z
gameProfile_loadBooleanOption=?gameProfile_loadBooleanOption@@YA_NPEAVIniParser@@PEADPEAUgameProfileBooleanOption_t@@@Z
gameProfile_loadIntegerNamedOption=?gameProfile_loadIntegerNamedOption@@YA_NPEAVIniParser@@PEADPEAUgameProfileIntegerOption_t@@HPEBUgpNamedOptionEntry_t@@H@Z
gameProfile_loadIntegerOption=?gameProfile_loadIntegerOption@@YA_NPEAVIniParser@@PEBDPEAUgameProfileIntegerOption_t@@HHH@Z
memory_init=?memory_init@@YAXXZ
memory_getBase=?memory_getBase@@YAPEAXXZ
wxMainWindowCreated=?wxMainWindowCreated@@YAPEAVwxTopLevelWindow@@PEAV1@IPEAVCemuApp@@@Z
wxEvtHandler_Initialize=?wxEvtHandler_Initialize@@YAPEAVwxEvtHandler@@PEAE@Z
wxEvtHandler_Connect=?wxEvtHandler_Connect@@YAXPEAVwxEvtHandler@@HHHP81@EAAXAEAVwxEvent@@@ZPEAVwxObject@@0@Z
wxEvtHandler_Disconnect=?wxEvtHandler_Disconnect@@YAXPEAVwxEvtHandler@@HHHP81@EAAXAEAVwxEvent@@@ZPEAVwxObject@@0@Z
wxGetEventByName=?wxGetEventByName@@YAHPEBD@Z
gameMeta_loadForCurrent=?gameMeta_loadForCurrent@@YAXXZ
gameMeta_getTitleId=?gameMeta_getTitleId@@YA_KXZ
PPCRecompiler_init=?PPCRecompiler_init@@YAXXZ
hasMOVBESupport=?hasMOVBESupport@@3_NA
hasLZCNTSupport=?hasLZCNTSupport@@3_NA
hasAVXSupport=?hasAVXSupport@@3_NA
ppcRecompilerInstanceData=?ppcRecompilerInstanceData@@3PEAUPPCRecompilerInstanceData_t@@EA
currentTLSModuleIndex=?_currentTLSModuleIndex@@3IA
rplModuleCount=?rplModuleCount@@3HA
rplModuleList=?rplModuleList@@3PAPEAURPLModule@@A
rpl_loadFromMem=?rpl_loadFromMem@@YAPEAURPLModule@@PEAEHPEAD@Z
loadSharedData=?loadSharedData@@YAIXZ
graphicPack_loadGraphicPackShaders=?graphicPack_loadGraphicPackShaders@@YAXPEAUgraphicPack_t@@PEA_W@Z
config_isGraphicPackEnabled=?config_isGraphicPackEnabled@@YA_N_K@Z
alwaysDisplayDRC=?alwaysDisplayDRC@@3_NA
ppcCyclesSince2000=?ppcCyclesSince2000@@3_KA
ppcMainThreadCycleCounter=?ppcMainThreadCycleCounter@@3_KC
GetTranslationWChar=?GetTranslationWChar@@YAPEB_WPEB_W@Z
ActivateGraphicPack=?Activate@GraphicPack2@@AEAA_NXZ
DeactivateGraphicPack=?Deactivate@GraphicPack2@@AEAA_NXZ
coreinitAPI_OSYieldThread=?coreinitAPI_OSYieldThread@@YAXXZ
GraphicPack2_GetFilename=?GraphicPack2_GetFilename@@YAPEB_WPEAVGraphicPack2@@@Z
GraphicPack2_GetName=?GraphicPack2_GetName@@YAPEBDPEAVGraphicPack2@@@Z
GraphicPack2_GetPath=?GraphicPack2_GetPath@@YAPEBDPEAVGraphicPack2@@@Z
GraphicPack2_GetDescription=?GraphicPack2_GetDescription@@YAPEBDPEAVGraphicPack2@@@Z
GraphicPack2_GetTitleIdCount=?GraphicPack2_GetTitleIdCount@@YA?BHPEAVGraphicPack2@@@Z
GraphicPack2_GetTitleIdList=?GraphicPack2_GetTitleIdList@@YAPEB_KPEAVGraphicPack2@@@Z
GraphicPack2_notifyActivate=?GraphicPack2_notifyActivate@@YAXPEAVGraphicPack2@@PEAVExpressionParser@@@Z
GraphicPack2_notifyDeactivate=?GraphicPack2_notifyDeactivate@@YAXPEAVGraphicPack2@@@Z
GraphicPack2_CreateExpressionParser=?GraphicPack2_CreateExpressionParser@@YAPEAVExpressionParser@@PEAVGraphicPack2@@@Z
ExpressionParser_Create=?ExpressionParser_Create@@YAPEAVExpressionParser@@XZ
ExpressionParser_CreateCopy=?ExpressionParser_CreateCopy@@YAPEAVExpressionParser@@PEAV1@@Z
ExpressionParser_Delete=?ExpressionParser_Delete@@YAXPEAVExpressionParser@@@Z
ExpressionParser_AddConstantDouble=?ExpressionParser_AddConstantDouble@@YAXPEAVExpressionParser@@PEBDN@Z
ExpressionParser_AddConstantString=?ExpressionParser_AddConstantString@@YAXPEAVExpressionParser@@PEBD1@Z
ExpressionParser_EvaluateToDouble=?ExpressionParser_EvaluateToDouble@@YA_NPEAVExpressionParser@@PEBDPEAN@Z
PPCRecompiler_findFuncRanges=?PPCRecompiler_findFuncRanges@@YA_NIPEAUppcRecompilerFuncRange_t@@PEA_K@Z
PPCRecompiler_getJumpTableBase=?PPCRecompiler_getJumpTableBase@@YAPEA_KXZ
PPCRecompiler_invalidateRange=?PPCRecompiler_invalidateRange@@YAXII@Z

View file

@ -68,14 +68,6 @@ void unused_translation_dummy()
void(_("PrincipalId missing")); void(_("PrincipalId missing"));
} }
#pragma optimize( "", off )
DLLEXPORT NOINLINE wxTopLevelWindow* wxMainWindowCreated(wxTopLevelWindow* wndPtr, uint32 magicConstant, CemuApp* appPointer)
{
return wndPtr;
}
#pragma optimize( "", on )
bool CemuApp::OnInit() bool CemuApp::OnInit()
{ {
wxInitAllImageHandlers(); wxInitAllImageHandlers();
@ -140,9 +132,6 @@ bool CemuApp::OnInit()
g_window_info.app_active = true; g_window_info.app_active = true;
SetTopWindow(m_mainFrame); SetTopWindow(m_mainFrame);
// Cemuhook callback
wxMainWindowCreated(m_mainFrame, 0xDABABE, this);
m_mainFrame->Show(); m_mainFrame->Show();
return true; return true;
} }
@ -150,7 +139,7 @@ bool CemuApp::OnInit()
int CemuApp::OnExit() int CemuApp::OnExit()
{ {
wxApp::OnExit(); wxApp::OnExit();
#if BOOST_OS_WINDOWS > 0 #if BOOST_OS_WINDOWS
ExitProcess(0); ExitProcess(0);
#else #else
exit(0); exit(0);
@ -306,7 +295,7 @@ void CemuApp::CreateDefaultFiles(bool first_start)
std::stringstream errorMsg; std::stringstream errorMsg;
errorMsg << fmt::format(_("Couldn't create a required mlc01 subfolder or file!\n\nError: {0}\nTarget path:\n{1}").ToStdString(), ex.what(), boost::nowide::narrow(mlc)); errorMsg << fmt::format(_("Couldn't create a required mlc01 subfolder or file!\n\nError: {0}\nTarget path:\n{1}").ToStdString(), ex.what(), boost::nowide::narrow(mlc));
#if BOOST_OS_WINDOWS > 0 #if BOOST_OS_WINDOWS
const DWORD lastError = GetLastError(); const DWORD lastError = GetLastError();
if (lastError != ERROR_SUCCESS) if (lastError != ERROR_SUCCESS)
errorMsg << fmt::format("\n\n{}", GetSystemErrorMessage(lastError)); errorMsg << fmt::format("\n\n{}", GetSystemErrorMessage(lastError));
@ -332,7 +321,7 @@ void CemuApp::CreateDefaultFiles(bool first_start)
std::stringstream errorMsg; std::stringstream errorMsg;
errorMsg << fmt::format(_("Couldn't create a required cemu directory or file!\n\nError: {0}").ToStdString(), ex.what()); errorMsg << fmt::format(_("Couldn't create a required cemu directory or file!\n\nError: {0}").ToStdString(), ex.what());
#if BOOST_OS_WINDOWS > 0 #if BOOST_OS_WINDOWS
const DWORD lastError = GetLastError(); const DWORD lastError = GetLastError();
if (lastError != ERROR_SUCCESS) if (lastError != ERROR_SUCCESS)
errorMsg << fmt::format("\n\n{}", GetSystemErrorMessage(lastError)); errorMsg << fmt::format("\n\n{}", GetSystemErrorMessage(lastError));

View file

@ -510,12 +510,11 @@ void CemuUpdateWindow::WorkerThread()
} }
} }
bool IsCemuhookLoaded();
void CemuUpdateWindow::OnClose(wxCloseEvent& event) void CemuUpdateWindow::OnClose(wxCloseEvent& event)
{ {
event.Skip(); event.Skip();
#if BOOST_OS_WINDOWS > 0 #if BOOST_OS_WINDOWS
if (m_restart_required && !m_restart_file.empty() && fs::exists(m_restart_file)) if (m_restart_required && !m_restart_file.empty() && fs::exists(m_restart_file))
{ {
PROCESS_INFORMATION pi{}; PROCESS_INFORMATION pi{};
@ -530,9 +529,6 @@ void CemuUpdateWindow::OnClose(wxCloseEvent& event)
HANDLE lock = CreateMutex(nullptr, TRUE, L"Global\\cemu_update_lock"); HANDLE lock = CreateMutex(nullptr, TRUE, L"Global\\cemu_update_lock");
CreateProcess(nullptr, (wchar_t*)cmdline.c_str(), nullptr, nullptr, FALSE, 0, nullptr, nullptr, &si, &pi); CreateProcess(nullptr, (wchar_t*)cmdline.c_str(), nullptr, nullptr, FALSE, 0, nullptr, nullptr, &si, &pi);
if (IsCemuhookLoaded())
TerminateProcess(GetCurrentProcess(), 0);
else
exit(0); exit(0);
} }
#else #else

View file

@ -11,8 +11,8 @@
#include "gui/helpers/wxHelpers.h" #include "gui/helpers/wxHelpers.h"
#include "input/InputManager.h" #include "input/InputManager.h"
#if BOOST_OS_LINUX #if BOOST_OS_LINUX || BOOST_OS_MACOS
#include "resource/linux/resources.h" #include "resource/embedded/resources.h"
#endif #endif
GameProfileWindow::GameProfileWindow(wxWindow* parent, uint64_t title_id) GameProfileWindow::GameProfileWindow(wxWindow* parent, uint64_t title_id)
@ -21,7 +21,7 @@ GameProfileWindow::GameProfileWindow(wxWindow* parent, uint64_t title_id)
SetIcon(wxICON(X_GAME_PROFILE)); SetIcon(wxICON(X_GAME_PROFILE));
m_game_profile.Reset(); m_game_profile.Reset();
m_game_profile.Load(title_id, false); m_game_profile.Load(title_id);
this->SetSizeHints(wxDefaultSize, wxDefaultSize); this->SetSizeHints(wxDefaultSize, wxDefaultSize);

View file

@ -16,7 +16,7 @@
#include "config/CemuConfig.h" #include "config/CemuConfig.h"
#include "audio/IAudioAPI.h" #include "audio/IAudioAPI.h"
#if BOOST_OS_WINDOWS > 0 #if BOOST_OS_WINDOWS
#include "audio/DirectSoundAPI.h" #include "audio/DirectSoundAPI.h"
#include "audio/XAudio27API.h" #include "audio/XAudio27API.h"
#endif #endif
@ -31,7 +31,7 @@
#include "gui/dialogs/CreateAccount/wxCreateAccountDialog.h" #include "gui/dialogs/CreateAccount/wxCreateAccountDialog.h"
#include "config/PermanentStorage.h" #include "config/PermanentStorage.h"
#if BOOST_OS_WINDOWS > 0 #if BOOST_OS_WINDOWS
#include <VersionHelpers.h> #include <VersionHelpers.h>
#endif #endif
@ -39,8 +39,8 @@
#include "config/ActiveSettings.h" #include "config/ActiveSettings.h"
#include "gui/helpers/wxHelpers.h" #include "gui/helpers/wxHelpers.h"
#if BOOST_OS_LINUX > 0 #if BOOST_OS_LINUX || BOOST_OS_MACOS
#include "resource/linux/resources.h" #include "resource/embedded/resources.h"
#endif #endif
#include "Cafe/CafeSystem.h" #include "Cafe/CafeSystem.h"
@ -649,7 +649,7 @@ wxPanel* GeneralSettings2::AddAccountPage(wxNotebook* notebook)
{ {
m_account_information = new wxCollapsiblePane(online_panel, wxID_ANY, _("Account information")); m_account_information = new wxCollapsiblePane(online_panel, wxID_ANY, _("Account information"));
#if BOOST_OS_WINDOWS > 0 #if BOOST_OS_WINDOWS
m_account_information->GetControlWidget()->SetBackgroundColour(*wxWHITE); m_account_information->GetControlWidget()->SetBackgroundColour(*wxWHITE);
#endif #endif
auto win = m_account_information->GetPane(); auto win = m_account_information->GetPane();
@ -1063,7 +1063,7 @@ void GeneralSettings2::ResetAccountInformation()
// refresh pane size // refresh pane size
m_account_information->InvalidateBestSize(); m_account_information->InvalidateBestSize();
#if BOOST_OS_WINDOWS > 0 #if BOOST_OS_WINDOWS
m_account_information->OnStateChange(GetBestSize()); m_account_information->OnStateChange(GetBestSize());
#endif #endif
} }

View file

@ -15,8 +15,8 @@
#include "Cafe/TitleList/TitleList.h" #include "Cafe/TitleList/TitleList.h"
#if BOOST_OS_LINUX > 0 #if BOOST_OS_LINUX || BOOST_OS_MACOS
#include "resource/linux/resources.h" #include "resource/embedded/resources.h"
#endif #endif
#include "wxHelper.h" #include "wxHelper.h"

View file

@ -10,13 +10,11 @@
#include "Cafe/CafeSystem.h" #include "Cafe/CafeSystem.h"
#include "Cafe/TitleList/TitleList.h" #include "Cafe/TitleList/TitleList.h"
#if BOOST_OS_LINUX > 0 #if BOOST_OS_LINUX || BOOST_OS_MACOS
#include "resource/linux/resources.h" #include "resource/embedded/resources.h"
#endif #endif
// main.cpp // main.cpp
bool IsCemuhookLoaded();
class wxGraphicPackData : public wxTreeItemData class wxGraphicPackData : public wxTreeItemData
{ {
public: public:

View file

@ -50,12 +50,12 @@
#include "gui/input/InputSettings2.h" #include "gui/input/InputSettings2.h"
#include "input/InputManager.h" #include "input/InputManager.h"
#if BOOST_OS_WINDOWS > 0 #if BOOST_OS_WINDOWS
#define exit(__c) ExitProcess(__c) #define exit(__c) ExitProcess(__c)
#endif #endif
#if BOOST_OS_LINUX > 0 #if BOOST_OS_LINUX || BOOST_OS_MACOS
#include "resource/linux/resources.h" #include "resource/embedded/resources.h"
#endif #endif
#include "Cafe/TitleList/TitleInfo.h" #include "Cafe/TitleList/TitleInfo.h"
@ -65,8 +65,6 @@
extern WindowInfo g_window_info; extern WindowInfo g_window_info;
extern std::shared_mutex g_mutex; extern std::shared_mutex g_mutex;
bool IsCemuhookLoaded();
wxDEFINE_EVENT(wxEVT_SET_WINDOW_TITLE, wxCommandEvent); wxDEFINE_EVENT(wxEVT_SET_WINDOW_TITLE, wxCommandEvent);
enum enum
@ -296,7 +294,7 @@ MainWindow::MainWindow()
SetClientSize(1280, 720); SetClientSize(1280, 720);
SetIcon(wxICON(M_WND_ICON128)); SetIcon(wxICON(M_WND_ICON128));
#if BOOST_OS_WINDOWS > 0 #if BOOST_OS_WINDOWS
HICON hWindowIcon = (HICON)LoadImageA(NULL, "M_WND_ICON16", IMAGE_ICON, 16, 16, LR_LOADFROMFILE); HICON hWindowIcon = (HICON)LoadImageA(NULL, "M_WND_ICON16", IMAGE_ICON, 16, 16, LR_LOADFROMFILE);
SendMessage(this->GetHWND(), WM_SETICON, ICON_SMALL, (LPARAM)hWindowIcon); SendMessage(this->GetHWND(), WM_SETICON, ICON_SMALL, (LPARAM)hWindowIcon);
#endif #endif
@ -347,18 +345,6 @@ MainWindow::MainWindow()
Bind(wxEVT_OPEN_GRAPHIC_PACK, &MainWindow::OnGraphicWindowOpen, this); Bind(wxEVT_OPEN_GRAPHIC_PACK, &MainWindow::OnGraphicWindowOpen, this);
Bind(wxEVT_LAUNCH_GAME, &MainWindow::OnLaunchFromFile, this); Bind(wxEVT_LAUNCH_GAME, &MainWindow::OnLaunchFromFile, this);
if (fs::exists(ActiveSettings::GetPath("dbghelp.dll")) && !fs::exists(ActiveSettings::GetPath("cemuhook.dll")))
{
m_statusBar = CreateStatusBar(1);
wxStaticText* statusBarText = new wxStaticText(m_statusBar, wxID_ANY, wxT("The installed version of Cemuhook is not compatible. To get the latest version visit: "));
wxHyperlinkCtrl* cemuhookUrl = new wxHyperlinkCtrl(m_statusBar, wxID_ANY, "https://cemuhook.sshnuke.net/", "https://cemuhook.sshnuke.net/");
// align elements
auto textSize = statusBarText->GetSize();
statusBarText->SetPosition(wxPoint(6, (m_statusBar->GetSize().GetHeight() - textSize.GetHeight()) / 2));
if(cemuhookUrl)
cemuhookUrl->SetPosition(wxPoint(textSize.GetWidth() + 12, (m_statusBar->GetSize().GetHeight() - textSize.GetHeight()) / 2));
}
if (LaunchSettings::GetLoadFile().has_value()) if (LaunchSettings::GetLoadFile().has_value())
{ {
MainWindow::RequestLaunchGame(LaunchSettings::GetLoadFile().value(), wxLaunchGameEvent::INITIATED_BY::COMMAND_LINE); MainWindow::RequestLaunchGame(LaunchSettings::GetLoadFile().value(), wxLaunchGameEvent::INITIATED_BY::COMMAND_LINE);
@ -650,7 +636,7 @@ void MainWindow::OnInstallUpdate(wxCommandEvent& event)
break; break;
if (modalChoice == wxID_OK) if (modalChoice == wxID_OK)
{ {
#if BOOST_OS_LINUX #if BOOST_OS_LINUX || BOOST_OS_MACOS
fs::path dirPath((const char*)(openDirDialog.GetPath().fn_str())); fs::path dirPath((const char*)(openDirDialog.GetPath().fn_str()));
#else #else
fs::path dirPath(openDirDialog.GetPath().fn_str()); fs::path dirPath(openDirDialog.GetPath().fn_str());
@ -2086,12 +2072,6 @@ void MainWindow::RecreateMenu()
#ifndef PUBLIC_RELEASE #ifndef PUBLIC_RELEASE
m_fileMenu->Append(MAINFRAME_MENU_ID_FILE_END_EMULATION, _("End emulation")); m_fileMenu->Append(MAINFRAME_MENU_ID_FILE_END_EMULATION, _("End emulation"));
#endif #endif
// destroy Cemuhook update indicator status bar
if (m_statusBar)
{
delete m_statusBar;
m_statusBar = nullptr;
}
} }
m_exitMenuItem = m_fileMenu->Append(MAINFRAME_MENU_ID_FILE_EXIT, _("&Exit")); m_exitMenuItem = m_fileMenu->Append(MAINFRAME_MENU_ID_FILE_EXIT, _("&Exit"));

View file

@ -161,8 +161,6 @@ private:
wxSize m_restored_size; wxSize m_restored_size;
wxPoint m_restored_position; wxPoint m_restored_position;
wxStatusBar* m_statusBar{};
bool m_menu_visible = false; bool m_menu_visible = false;
bool m_game_launched = false; bool m_game_launched = false;

View file

@ -13,8 +13,8 @@
#include "gui/helpers/wxHelpers.h" #include "gui/helpers/wxHelpers.h"
#include "input/InputManager.h" #include "input/InputManager.h"
#if BOOST_OS_LINUX #if BOOST_OS_LINUX || BOOST_OS_MACOS
#include "resource/linux/resources.h" #include "resource/embedded/resources.h"
#endif #endif
#include "wxHelper.h" #include "wxHelper.h"

View file

@ -42,8 +42,8 @@
#include "Cafe/TitleList/TitleList.h" #include "Cafe/TitleList/TitleList.h"
#if BOOST_OS_LINUX #if BOOST_OS_LINUX || BOOST_OS_MACOS
#include "resource/linux/resources.h" #include "resource/embedded/resources.h"
#endif #endif
#include "Cafe/TitleList/SaveList.h" #include "Cafe/TitleList/SaveList.h"

View file

@ -20,7 +20,7 @@
#include "util/helpers/helpers.h" #include "util/helpers/helpers.h"
#if BOOST_OS_LINUX #if BOOST_OS_LINUX
#include "resource/linux/resources.h" #include "resource/embedded/resources.h"
#endif #endif
enum enum

View file

@ -17,21 +17,17 @@ std::shared_mutex g_mutex;
MainWindow* g_mainFrame = nullptr; MainWindow* g_mainFrame = nullptr;
#if BOOST_OS_WINDOWS #if BOOST_OS_WINDOWS
void wxMatchCemuhookEventIds();
void _wxLaunch() void _wxLaunch()
{ {
SetThreadName("MainThread_UI"); SetThreadName("MainThread_UI");
wxEntry(); wxEntry();
} }
#endif #endif
void gui_create() void gui_create()
{ {
SetThreadName("MainThread"); SetThreadName("MainThread");
#if BOOST_OS_WINDOWS #if BOOST_OS_WINDOWS
wxMatchCemuhookEventIds();
// on Windows wxWidgets there is a bug where wxDirDialog->ShowModal will deadlock in Windows internals somehow // on Windows wxWidgets there is a bug where wxDirDialog->ShowModal will deadlock in Windows internals somehow
// moving the UI thread off the main thread fixes this // moving the UI thread off the main thread fixes this
std::thread t = std::thread(_wxLaunch); std::thread t = std::thread(_wxLaunch);
@ -159,9 +155,9 @@ typedef void GdkDisplay;
void gui_initHandleContextFromWxWidgetsWindow(WindowHandleInfo& handleInfoOut, class wxWindow* wxw) void gui_initHandleContextFromWxWidgetsWindow(WindowHandleInfo& handleInfoOut, class wxWindow* wxw)
{ {
#if BOOST_OS_WINDOWS > 0 #if BOOST_OS_WINDOWS
handleInfoOut.hwnd = wxw->GetHWND(); handleInfoOut.hwnd = wxw->GetHWND();
#else #elif BOOST_OS_LINUX
/* dynamically retrieve GTK imports so we dont have to include and link the whole lib */ /* dynamically retrieve GTK imports so we dont have to include and link the whole lib */
void (*dyn_gtk_widget_realize)(GtkWidget *widget); void (*dyn_gtk_widget_realize)(GtkWidget *widget);
dyn_gtk_widget_realize = (void(*)(GtkWidget* widget))dlsym(RTLD_NEXT, "gtk_widget_realize"); dyn_gtk_widget_realize = (void(*)(GtkWidget* widget))dlsym(RTLD_NEXT, "gtk_widget_realize");

View file

@ -2,7 +2,7 @@
#include <atomic> #include <atomic>
#if BOOST_OS_LINUX > 0 #if BOOST_OS_LINUX
#include "xcb/xproto.h" #include "xcb/xproto.h"
#endif #endif

View file

@ -30,7 +30,7 @@
#include "util/EventService.h" #include "util/EventService.h"
#if BOOST_OS_LINUX #if BOOST_OS_LINUX
#include "resource/linux/resources.h" #include "resource/embedded/resources.h"
#endif #endif
bool g_inputConfigWindowHasFocus = false; bool g_inputConfigWindowHasFocus = false;

View file

@ -28,24 +28,22 @@
#include "Cafe/OS/libs/vpad/vpad.h" #include "Cafe/OS/libs/vpad/vpad.h"
#include "audio/IAudioAPI.h" #include "audio/IAudioAPI.h"
#if BOOST_OS_WINDOWS > 0 #if BOOST_OS_WINDOWS
#pragma comment(lib,"Dbghelp.lib") #pragma comment(lib,"Dbghelp.lib")
#endif #endif
#define SDL_MAIN_HANDLED #define SDL_MAIN_HANDLED
#include <SDL.h> #include <SDL.h>
#if BOOST_OS_LINUX > 0 #if BOOST_OS_LINUX || BOOST_OS_MACOS
#define _putenv(__s) putenv((char*)(__s)) #define _putenv(__s) putenv((char*)(__s))
#endif #endif
#if BOOST_OS_WINDOWS > 0
extern "C" extern "C"
{ {
DLLEXPORT int AmdPowerXpressRequestHighPerformance = 1; __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
DLLEXPORT DWORD NvOptimusEnablement = 0x00000001; __declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
} }
#endif
bool _cpuExtension_SSSE3 = false; bool _cpuExtension_SSSE3 = false;
bool _cpuExtension_SSE4_1 = false; bool _cpuExtension_SSE4_1 = false;
@ -53,51 +51,11 @@ bool _cpuExtension_AVX2 = false;
std::atomic_bool g_isGPUInitFinished = false; std::atomic_bool g_isGPUInitFinished = false;
#if BOOST_OS_WINDOWS > 0
std::wstring executablePath; std::wstring executablePath;
#endif
bool g_cemuhook_loaded = false;
bool IsCemuhookLoaded()
{
return g_cemuhook_loaded;
}
void checkForCemuhook()
{
#if BOOST_OS_WINDOWS > 0
// check if there is a dbghelp.dll in the current working directory
if (!fs::exists(ActiveSettings::GetPath("cemuhook.dll")))
return;
// check if Cemuhook can be detected
DWORD verHandle;
DWORD verLen = GetFileVersionInfoSizeW(L"cemuhook.dll", &verHandle);
if (verLen == 0)
return;
uint8* verData = (uint8*)malloc(verLen);
GetFileVersionInfoW(L"cemuhook.dll", 0, verLen, verData);
// get version
LPVOID lpBuffer;
UINT size;
if (VerQueryValueW(verData, L"\\", (LPVOID*)&lpBuffer, (PUINT)&size))
{
if (size)
{
VS_FIXEDFILEINFO *verInfo = (VS_FIXEDFILEINFO *)lpBuffer;
if (verInfo->dwSignature == 0xfeef04bd)
{
forceLog_printf("Cemuhook version: %d.%d.%d.%d", (verInfo->dwFileVersionMS >> 16) & 0xFFFF, (verInfo->dwFileVersionMS >> 0) & 0xFFFF, (verInfo->dwFileVersionLS >> 16) & 0xFFFF, (verInfo->dwFileVersionLS >> 0) & 0xFFFF);
g_cemuhook_loaded = true;
}
}
}
free(verData);
#endif
}
void logCPUAndMemoryInfo() void logCPUAndMemoryInfo()
{ {
#if BOOST_OS_WINDOWS > 0 #if BOOST_OS_WINDOWS
int CPUInfo[4] = { -1 }; int CPUInfo[4] = { -1 };
unsigned nExIds, i = 0; unsigned nExIds, i = 0;
char CPUBrandString[0x40]; char CPUBrandString[0x40];
@ -133,7 +91,7 @@ bool IsRunningInWine()
void checkForWine() void checkForWine()
{ {
#if BOOST_OS_WINDOWS > 0 #if BOOST_OS_WINDOWS
const HMODULE hmodule = GetModuleHandleA("ntdll.dll"); const HMODULE hmodule = GetModuleHandleA("ntdll.dll");
if (!hmodule) if (!hmodule)
return; return;
@ -154,8 +112,6 @@ void infoLog_cemuStartup()
cemuLog_force("------- Init {} {}.{}{} -------", EMULATOR_NAME, EMULATOR_VERSION_LEAD, EMULATOR_VERSION_MAJOR, EMULATOR_VERSION_SUFFIX); cemuLog_force("------- Init {} {}.{}{} -------", EMULATOR_NAME, EMULATOR_VERSION_LEAD, EMULATOR_VERSION_MAJOR, EMULATOR_VERSION_SUFFIX);
cemuLog_force("Init Wii U memory space (base: 0x{:016x})", (size_t)memory_base); cemuLog_force("Init Wii U memory space (base: 0x{:016x})", (size_t)memory_base);
cemuLog_force(u8"mlc01 path: {}", ActiveSettings::GetMlcPath().generic_u8string()); cemuLog_force(u8"mlc01 path: {}", ActiveSettings::GetMlcPath().generic_u8string());
// check if Cemuhook is installed
checkForCemuhook();
// check for wine version // check for wine version
checkForWine(); checkForWine();
// CPU and RAM info // CPU and RAM info
@ -210,7 +166,7 @@ void reconfigureGLDrivers()
std::string nvCacheDirEnvOption("__GL_SHADER_DISK_CACHE_PATH="); std::string nvCacheDirEnvOption("__GL_SHADER_DISK_CACHE_PATH=");
nvCacheDirEnvOption.append(_utf8Wrapper(nvCacheDir)); nvCacheDirEnvOption.append(_utf8Wrapper(nvCacheDir));
#if BOOST_OS_WINDOWS > 0 #if BOOST_OS_WINDOWS
std::wstring tmpW = boost::nowide::widen(nvCacheDirEnvOption); std::wstring tmpW = boost::nowide::widen(nvCacheDirEnvOption);
_wputenv(tmpW.c_str()); _wputenv(tmpW.c_str());
#else #else
@ -240,10 +196,10 @@ void mainEmulatorCommonInit()
_cpuExtension_SSSE3 = ((cpuInfo[2] >> 9) & 1) != 0; _cpuExtension_SSSE3 = ((cpuInfo[2] >> 9) & 1) != 0;
_cpuExtension_SSE4_1 = ((cpuInfo[2] >> 19) & 1) != 0; _cpuExtension_SSE4_1 = ((cpuInfo[2] >> 19) & 1) != 0;
__cpuidex1(cpuInfo, 0x7, 0); __cpuidex(cpuInfo, 0x7, 0);
_cpuExtension_AVX2 = ((cpuInfo[1] >> 5) & 1) != 0; _cpuExtension_AVX2 = ((cpuInfo[1] >> 5) & 1) != 0;
#if BOOST_OS_WINDOWS > 0 #if BOOST_OS_WINDOWS
executablePath.resize(4096); executablePath.resize(4096);
int i = GetModuleFileName(NULL, executablePath.data(), executablePath.size()); int i = GetModuleFileName(NULL, executablePath.data(), executablePath.size());
if(i >= 0) if(i >= 0)
@ -328,7 +284,7 @@ int mainEmulatorHLE()
bool isConsoleConnected = false; bool isConsoleConnected = false;
void requireConsole() void requireConsole()
{ {
#if BOOST_OS_WINDOWS > 0 #if BOOST_OS_WINDOWS
if (isConsoleConnected) if (isConsoleConnected)
return; return;
@ -349,7 +305,7 @@ void HandlePostUpdate()
const auto filename = ActiveSettings::GetFullPath().replace_extension("exe.backup"); const auto filename = ActiveSettings::GetFullPath().replace_extension("exe.backup");
if (fs::exists(filename)) if (fs::exists(filename))
{ {
#if BOOST_OS_WINDOWS > 0 #if BOOST_OS_WINDOWS
HANDLE lock; HANDLE lock;
do do
{ {
@ -378,7 +334,7 @@ void HandlePostUpdate()
void ToolShaderCacheMerger(); void ToolShaderCacheMerger();
#if BOOST_OS_WINDOWS > 0 #if BOOST_OS_WINDOWS
#ifndef PUBLIC_RELEASE #ifndef PUBLIC_RELEASE
#include <crtdbg.h> #include <crtdbg.h>
@ -415,7 +371,9 @@ int wWinMain( _In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ L
#else #else
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
#if BOOST_OS_LINUX
XInitThreads(); XInitThreads();
#endif
if (!LaunchSettings::HandleCommandline(argc, argv)) if (!LaunchSettings::HandleCommandline(argc, argv))
return 0; return 0;
@ -426,48 +384,7 @@ int main(int argc, char *argv[])
} }
#endif #endif
/* Cemuhook legacy API */ extern "C" DLLEXPORT uint64 gameMeta_getTitleId()
#pragma optimize("",off)
DLLEXPORT void gameMeta_loadForCurrent()
{
int placeholderA = 0x11223344;
int placeholderB = 0x55667788;
}
#pragma optimize("",on)
DLLEXPORT uint64 gameMeta_getTitleId()
{ {
return CafeSystem::GetForegroundTitleId(); return CafeSystem::GetForegroundTitleId();
} }
/* Cemuhook loading */
#if BOOST_OS_WINDOWS > 0
#pragma init_seg(".CRT$XCT")
HANDLE dbgLib;
int dbghelp_init(void)
{
// load dbghelp.dll from the system folder instead of loading outdated cemuhook via dbghelp.dll
WCHAR dllPath[MAX_PATH];
GetSystemDirectoryW(dllPath, MAX_PATH);
wcscat_s(dllPath, sizeof(dllPath) / sizeof(WCHAR), TEXT("\\dbghelp.dll"));
dbgLib = LoadLibraryW(dllPath);
if (dbgLib == NULL)
return -1;
return 0;
}
HMODULE _earlyInitFunction()
{
dbghelp_init();
return LoadLibraryA("cemuhook2.dll");
}
HMODULE _cemuHookDllHandle = _earlyInitFunction();
#endif

View file

@ -7,8 +7,8 @@ target_precompile_headers(CemuResource PRIVATE ../Common/precompiled.h)
# icon resources # icon resources
if(UNIX) if(UNIX)
target_sources(CemuResource PRIVATE target_sources(CemuResource PRIVATE
linux/resources.cpp embedded/resources.cpp
linux/resources.h embedded/resources.h
) )
endif() endif()

Some files were not shown because too many files have changed in this diff Show more