Merge pull request #2 from cemu-project/main

mm
This commit is contained in:
RyzenDew 2022-08-27 18:20:42 -03:00 committed by GitHub
commit 2d18df75a1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
124 changed files with 367 additions and 988 deletions

View file

@ -1,7 +1,7 @@
name: Build Cemu
on:
pull_request_target:
pull_request:
paths-ignore:
- "*.md"
types:

16
.gitignore vendored
View file

@ -19,5 +19,17 @@ out/
.cache/
# Cemu bin files
otp.bin
seeprom.bin
bin/otp.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/*

View file

@ -23,6 +23,10 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS 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)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc")
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_DISCORD_RPC "Enables the Discord Rich Presence feature" ON)
if (WIN32)
option(ENABLE_CEMUHOOK "Enables Cemuhook compatibility" ON)
endif()
# input backends
if (WIN32)
option(ENABLE_XINPUT "Enables the usage of XInput" ON)
@ -112,5 +112,4 @@ endif()
add_subdirectory(dependencies/ih264d)
add_subdirectory(dependencies/ZArchive)
add_subdirectory(src)
add_subdirectory(src)

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

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

@ -0,0 +1,13 @@
[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
Comment[fr]=Application pour émuler des jeux et des applications Wii U sur PC
Categories=Game;Emulator;
Keywords=Nintendo;
MimeType=application/x-wii-u-rom;

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

@ -0,0 +1,62 @@
<?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>
<summary xml:lang="fr">Application pour émuler des jeux et applications Wii U sur 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 xml:lang="fr">Cemu est un émulateur de Wii U capable de lancer la plupart des jeux Wii U et des homebrews en interface de jeu. Crée par Exzap, et développé en 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 xml:lang="fr">Cet émulateur vise à la fois à offrir fidélité et performance, il est activement développé avec des nouvelles fonctionnalités et des correctifs pour augmenter la compatibilité, la commodité et la facilité d'utilisation.</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>
<p xml:lang="fr">Il a été écrit à partir de zéro et son développement a débuté vers le début de l'année 2015.</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,11 +20,13 @@ if(MSVC)
# _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING
# _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS
elseif(UNIX)
if(NOT APPLE)
add_definitions(-DVK_USE_PLATFORM_XLIB_KHR) # legacy. Do we need to support XLIB surfaces?
add_definitions(-DVK_USE_PLATFORM_XCB_KHR)
endif()
add_definitions(-fms-extensions)
add_definitions(-fms-compatibility-version=19.14)
add_definitions(-fdelayed-template-parsing)
add_definitions(-DVK_USE_PLATFORM_XLIB_KHR) # legacy. Do we need to support XLIB surfaces?
add_definitions(-DVK_USE_PLATFORM_XCB_KHR)
add_definitions(-maes)
# warnings
add_compile_options(-Wno-switch -Wno-ignored-attributes -Wno-deprecated-enum-enum-conversion -Wno-ambiguous-reversed-operator)
@ -46,11 +48,6 @@ add_subdirectory(imgui)
add_subdirectory(resource)
add_subdirectory(asm)
if(ENABLE_CEMUHOOK)
add_definitions(-DUSE_CEMUHOOK)
add_subdirectory(cemuhook)
endif()
if(PUBLIC_RELEASE)
add_executable(CemuBin WIN32
main.cpp
@ -68,7 +65,6 @@ target_precompile_headers(CemuBin PRIVATE Common/precompiled.h)
if(WIN32)
target_sources(CemuBin PRIVATE
resource/cemu.rc
exports.def # for Cemuhook
)
endif()
@ -89,10 +85,6 @@ target_link_libraries(CemuBin PRIVATE CURL::libcurl)
target_link_libraries(CemuBin PRIVATE imgui::imgui)
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
CemuCommon CemuAudio CemuInput CemuComponents CemuCafe CemuConfig CemuGui imguiImpl)

View file

@ -3,12 +3,13 @@
#include "gui/CemuApp.h"
#include "util/helpers/SystemException.h"
#include <random>
#include "config/ActiveSettings.h"
#include "Cafe/IOSU/legacy/iosu_crypto.h"
#include "Common/filestream.h"
#include <random>
#include <boost/random/uniform_int.hpp>
std::vector<Account> Account::s_account_list;
Account::Account(uint32 persistent_id)
@ -65,8 +66,11 @@ Account::Account(uint32 persistent_id, std::wstring_view mii_name)
static std::random_device 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());
std::generate(m_uuid.begin(), m_uuid.end(), [&]() { return (uint8)dist(s_mte); });
// 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); });
// 1000004 or 2000004 | lower uint32 from uuid from uuid
m_transferable_id_base = (0x2000004ULL << 32);
@ -575,4 +579,4 @@ void actPwTest()
makePWHash(pwHash, 32, pid, pwHash); // calculates AccountPasswordHash
assert_dbg();
}
}

View file

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

View file

@ -1029,7 +1029,7 @@ bool FSTVerifier::VerifyContentFile(FileStream* fileContent, const NCrypto::AesK
SHA256_Init(&sha256Ctx);
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 bytesRead = fileContent->readData(buffer.data(), bytesToReadPadded);
if (bytesRead != bytesToReadPadded)

View file

@ -216,4 +216,4 @@ struct CoreinitFSParsedPath
void coreinitFS_parsePath(CoreinitFSParsedPath* parsedPath, const char* path);
bool coreinitFS_checkNodeName(CoreinitFSParsedPath* parsedPath, sint32 index, const char* name);
char* coreinitFS_getNodeName(CoreinitFSParsedPath* parsedPath, sint32 index);
char* coreinitFS_getNodeName(CoreinitFSParsedPath* parsedPath, sint32 index);

View file

@ -22,7 +22,7 @@ struct gameProfileBooleanOption_t
* If the option exists, true is returned.
* The boolean is stored in *optionValue
*/
__declspec(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);
option->isPresent = false;
@ -81,7 +81,7 @@ bool gameProfile_loadBooleanOption2(IniParser& iniParser, const char* optionName
* 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)
*/
__declspec(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);
option->isPresent = false;
@ -166,17 +166,10 @@ bool gameProfile_loadEnumOption(IniParser& iniParser, const char* optionName, st
return result;
}
#pragma optimize( "", off )
__declspec(dllexport) __declspec(noinline) void gameProfile_categoryBegin(IniParser* iniParser)
{
// do nothing
}
#pragma optimize( "", on )
void gameProfile_load()
{
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
ppcThreadQuantum = g_current_game_profile->GetThreadQuantum();
@ -185,7 +178,7 @@ void gameProfile_load()
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);
@ -220,9 +213,6 @@ bool GameProfile::Load(uint64_t title_id, bool notifyCemuhook)
// parse ini
while (iniParser.NextSection())
{
//if (notifyCemuhook)
// gameProfile_categoryBegin(gameProfile); // hookable export for Cemuhook
if (boost::iequals(iniParser.GetCurrentSectionName(), "General"))
{
gameProfile_loadBooleanOption2(iniParser, "loadSharedLibraries", m_loadSharedLibraries);
@ -378,25 +368,4 @@ void GameProfile::Reset()
// controller settings
for (auto& profile : m_controllerProfile)
profile.reset();
}
// legacy code for Cemuhook
__declspec(dllexport) char* gameProfile_loadStringOption(IniParser* iniParser, char* optionName)
{
return nullptr;
}
__declspec(dllexport) char* gameProfile_getCurrentCategoryName(IniParser* iniParser)
{
return nullptr;
}
struct gpNamedOptionEntry_t
{
char* name;
sint32 value;
};
__declspec(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:
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 ResetOptional();
void Reset();
@ -65,4 +65,4 @@ private:
};
extern std::unique_ptr<GameProfile> g_current_game_profile;
__declspec(dllexport) void gameProfile_load();
void gameProfile_load();

View file

@ -4,31 +4,6 @@
#include "config/ActiveSettings.h"
#include "Cafe/GraphicPack/GraphicPack2.h"
typedef struct
{
int placeholder;
}graphicPack_t;
// scans the graphic pack directory for shaders
__declspec(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
__declspec(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
*/

View file

@ -599,23 +599,6 @@ void GraphicPack2::LoadShaders()
}
}
#pragma optimize( "", off )
DLLEXPORT __declspec(noinline) void GraphicPack2_notifyActivate(GraphicPack2* gp, ExpressionParser* ep)
{
// for Cemuhook
int placeholder = 0xDEADDEAD;
}
DLLEXPORT __declspec(noinline) void GraphicPack2_notifyDeactivate(GraphicPack2* gp)
{
// for Cemuhook
int placeholder = 0xDEADDEAD;
}
#pragma optimize( "", on )
bool GraphicPack2::SetActivePreset(std::string_view name)
{
return SetActivePreset("", name);
@ -862,7 +845,6 @@ bool GraphicPack2::Activate()
m_output_settings.downscale_filter = LatteTextureView::MagFilter::kNearestNeighbor;
}
}
GraphicPack2_notifyActivate(this, &parser);
}
catch(const std::exception& ex)
{
@ -932,7 +914,6 @@ bool GraphicPack2::Deactivate()
LatteTiming_disableCustomVsyncFrequency();
}
GraphicPack2_notifyDeactivate(this);
return true;
}
@ -1148,46 +1129,4 @@ std::vector<std::pair<MPTR, MPTR>> GraphicPack2::GetActiveRAMMappings()
return a.first < b.first;
});
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 void ClearGraphicPacks();
private:
__declspec(dllexport) bool Activate();
__declspec(dllexport) bool Deactivate();
bool Activate();
bool Deactivate();
static std::vector<std::shared_ptr<GraphicPack2>> s_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"
#if BOOST_OS_WINDOWS > 0
#if BOOST_OS_WINDOWS
#include <Windows.h>
#endif
@ -158,7 +158,7 @@ void debugger_updateMemoryBreakpoint(DebuggerBreakpoint* bp)
{
std::vector<std::thread::native_handle_type> schedulerThreadHandles = coreinit::OSGetSchedulerThreads();
#if BOOST_OS_WINDOWS > 0
#if BOOST_OS_WINDOWS
debuggerState.activeMemoryBreakpoint = bp;
for (auto& hThreadNH : schedulerThreadHandles)
{

View file

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

View file

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

View file

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

View file

@ -369,14 +369,14 @@ typedef struct
uint32 _x64XMM_mxCsr_ftzOff;
}PPCRecompilerInstanceData_t;
extern __declspec(dllexport) PPCRecompilerInstanceData_t* ppcRecompilerInstanceData;
extern PPCRecompilerInstanceData_t* ppcRecompilerInstanceData;
extern bool ppcRecompilerEnabled;
__declspec(dllexport) void PPCRecompiler_init();
void PPCRecompiler_init();
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_leaveRecompilerCode_visited)();
@ -385,10 +385,10 @@ extern void ATTR_MS_ABI (*PPCRecompiler_leaveRecompilerCode_unvisited)();
#define PPC_REC_INVALID_FUNCTION ((PPCRecFunction_t*)-1)
// CPUID
extern __declspec(dllexport) bool hasLZCNTSupport;
extern __declspec(dllexport) bool hasMOVBESupport;
extern __declspec(dllexport) bool hasBMI2Support;
extern __declspec(dllexport) bool hasAVXSupport;
extern bool hasLZCNTSupport;
extern bool hasMOVBESupport;
extern bool hasBMI2Support;
extern bool hasAVXSupport;
// 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;
}
#if BOOST_OS_LINUX
#if BOOST_OS_LINUX || BOOST_OS_MACOS
#pragma clang attribute push (__attribute__((target("avx2"))), apply_to=function)
#endif
@ -352,11 +352,11 @@ void LatteIndices_fastConvertU16_AVX2(const void* indexDataInput, void* indexDat
indexMin = std::min(indexMin, _minIndex);
}
#if BOOST_OS_LINUX
#if BOOST_OS_LINUX || BOOST_OS_MACOS
#pragma clang attribute pop
#endif
#if BOOST_OS_LINUX
#if BOOST_OS_LINUX || BOOST_OS_MACOS
#pragma clang attribute push (__attribute__((target("avx2"))), apply_to=function)
#endif
@ -423,11 +423,11 @@ void LatteIndices_fastConvertU16_SSE41(const void* indexDataInput, void* indexDa
indexMin = std::min(indexMin, _minIndex);
}
#if BOOST_OS_LINUX
#if BOOST_OS_LINUX || BOOST_OS_MACOS
#pragma clang attribute pop
#endif
#if BOOST_OS_LINUX
#if BOOST_OS_LINUX || BOOST_OS_MACOS
#pragma clang attribute push (__attribute__((target("avx2"))), apply_to=function)
#endif
@ -497,7 +497,7 @@ void LatteIndices_fastConvertU32_AVX2(const void* indexDataInput, void* indexDat
indexMin = std::min(indexMin, _minIndex);
}
#if BOOST_OS_LINUX
#if BOOST_OS_LINUX || BOOST_OS_MACOS
#pragma clang attribute pop
#endif

View file

@ -13,6 +13,8 @@
#include "input/InputManager.h"
#include <cinttypes>
#if BOOST_OS_WINDOWS
#include <Psapi.h>
#include <winternl.h>
@ -405,16 +407,16 @@ void LatteOverlay_RenderNotifications(ImVec2& position, ImVec2& pivot, sint32 di
if (s_pipeline_count_async > 0)
{
if (s_pipeline_count > 1)
ImGui::Text("Compiled %d new pipelines... (%d async) TotalSync: %lldms", s_pipeline_count, s_pipeline_count_async, totalTime);
ImGui::Text("Compiled %d new pipelines... (%d async) TotalSync: %" PRIu64 "ms", s_pipeline_count, s_pipeline_count_async, totalTime);
else
ImGui::Text("Compiled %d new pipeline... (%d async) TotalSync: %lldms", s_pipeline_count, s_pipeline_count_async, totalTime);
ImGui::Text("Compiled %d new pipeline... (%d async) TotalSync: %" PRIu64 "ms", s_pipeline_count, s_pipeline_count_async, totalTime);
}
else
{
if (s_pipeline_count > 1)
ImGui::Text("Compiled %d new pipelines... TotalSync: %lldms", s_pipeline_count, totalTime);
ImGui::Text("Compiled %d new pipelines... TotalSync: %" PRIu64 "ms", s_pipeline_count, totalTime);
else
ImGui::Text("Compiled %d new pipeline... TotalSync: %lldms", s_pipeline_count, totalTime);
ImGui::Text("Compiled %d new pipeline... TotalSync: %" PRIu64 "ms", s_pipeline_count, totalTime);
}
#else
if (s_pipeline_count_async > 0)

View file

@ -1003,7 +1003,7 @@ void LatteRenderTarget_copyToBackbuffer(LatteTextureView* textureView, bool isPa
g_renderer->ImguiEnd();
}
bool DLLEXPORT alwaysDisplayDRC = false;
bool alwaysDisplayDRC = 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)

View file

@ -27,7 +27,7 @@
#include <wx/msgdlg.h>
#if BOOST_OS_WINDOWS > 0
#if BOOST_OS_WINDOWS
#include <psapi.h>
#endif
@ -189,7 +189,7 @@ void LatteShaderCache_load()
const auto timeLoadStart = now_cached();
// remember current amount of committed memory
#if BOOST_OS_WINDOWS > 0
#if BOOST_OS_WINDOWS
PROCESS_MEMORY_COUNTERS pmc1;
GetProcessMemoryInfo(GetCurrentProcess(), &pmc1, sizeof(PROCESS_MEMORY_COUNTERS));
LONGLONG totalMem1 = pmc1.PagefileUsage;
@ -285,7 +285,7 @@ void LatteShaderCache_load()
LatteShaderCache_updateCompileQueue(0);
// 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 timeLoad = std::chrono::duration_cast<std::chrono::milliseconds>(timeLoadEnd - timeLoadStart).count();
PROCESS_MEMORY_COUNTERS pmc2;

View file

@ -145,7 +145,7 @@ uint32 LatteTexture_CalculateTextureDataHash(LatteTexture* hostTexture)
bool isCompressedFormat = hostTexture->IsCompressedFormat();
if( isCompressedFormat == false )
{
#if BOOST_OS_WINDOWS > 0
#if BOOST_OS_WINDOWS
if (_cpuExtension_AVX2)
{
__m256i h256 = { 0 };
@ -425,12 +425,4 @@ void LatteTC_UnloadAllTextures()
LatteTexture_Delete(itr);
}
LatteRenderTarget_unloadAll();
}
/*
* Asynchronous way to invalidate textures
*/
__declspec(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
{
#if BOOST_OS_LINUX
#if BOOST_OS_LINUX || BOOST_OS_MACOS
unsigned char _BitScanReverse(uint32* _Index, uint32 _Mask)
{
if (!_Mask)

View file

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

View file

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

View file

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

View file

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

View file

@ -1,6 +1,6 @@
#pragma once
DLLEXPORT void memory_init();
void memory_init();
void memory_mapForCurrentTitle();
void memory_logModifiedMemoryRanges();
@ -201,6 +201,9 @@ static uint16 CPU_swapEndianU16(uint16 v)
#elif BOOST_OS_LINUX
#define CPU_swapEndianU64(_v) bswap_64((uint64)(_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
// direct memory access (no hardware interface access)

View file

@ -6,7 +6,7 @@
#if BOOST_OS_LINUX
// 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
#include "Common/linux/date.h"
#include "Common/unix/date.h"
namespace chrono_d = date;
#else
namespace chrono_d = std::chrono;
@ -373,4 +373,4 @@ namespace iosu
}
};
};
};

View file

@ -46,8 +46,8 @@ ChunkedFlatAllocator<64 * 1024> g_heapTrampolineArea;
std::vector<rplDependency_t*> rplDependencyList = std::vector<rplDependency_t*>();
__declspec(dllexport) RPLModule* rplModuleList[256];
__declspec(dllexport) sint32 rplModuleCount = 0;
RPLModule* rplModuleList[256];
sint32 rplModuleCount = 0;
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_GetDataAllocatorAddr();
__declspec(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);
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));
}
__declspec(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);
}

View file

@ -78,7 +78,7 @@ void CafeInit()
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;
_coreinitInfo->argc = 0;

View file

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

View file

@ -63,7 +63,8 @@ namespace coreinit
bool negativeAlignment = alignment < 0;
if (negativeAlignment)
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");
return 0;

View file

@ -366,7 +366,7 @@ namespace coreinit
void InitializeTimeAndCalendar()
{
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);
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);
ppcDefineParamU32BEPtr(maxFd, 4);
#if BOOST_OS_LINUX > 0
#if BOOST_OS_LINUX || BOOST_OS_MACOS
cemuLog_log(LogType::Force, "curl_multi_fdset(...) - todo");
osLib_returnFromFunction(hCPU, 0);

View file

@ -5,6 +5,7 @@
#include "Cafe/OS/libs/coreinit/coreinit_IOS.h"
#include "Cafe/OS/libs/coreinit/coreinit_Time.h"
#include <cinttypes>
#include <filesystem>
#include <fstream>
@ -102,7 +103,7 @@ namespace acp
{
// found the entry! -> update timestamp
xml::XMLElement* timestamp = account->FirstChildElement("timestamp");
sprintf(tmp, "%016llx", _acpGetTimestamp());
sprintf(tmp, "%" PRIx64, _acpGetTimestamp());
if (timestamp)
timestamp->SetText(tmp);
else
@ -125,7 +126,7 @@ namespace acp
tinyxml2::XMLElement* timestamp = doc.NewElement("timestamp");
{
sprintf(tmp, "%016llx", _acpGetTimestamp());
sprintf(tmp, "%" PRIx64, _acpGetTimestamp());
timestamp->SetText(tmp);
}
@ -506,4 +507,4 @@ namespace acp
osLib_addFunction("nn_acp", "ACPConvertNetworkTimeToOSCalendarTime", export_ACPConvertNetworkTimeToOSCalendarTime);
}
}
}
}

View file

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

View file

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

View file

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

View file

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

View file

@ -645,10 +645,10 @@ std::string TitleInfo::GetInstallPath() const
{
TitleId titleId = GetAppTitleId();
TitleIdParser tip(titleId);
std::string tmp;
std::string tmp;
if (tip.IsSystemTitle())
tmp = fmt::format("sys\\title\\{:08x}\\{:08x}", GetTitleIdHigh(titleId), GetTitleIdLow(titleId));
else
tmp = fmt::format("usr\\title\\{:08x}\\{:08x}", GetTitleIdHigh(titleId), GetTitleIdLow(titleId));
tmp = fmt::format("sys/title/{:08x}/{:08x}", GetTitleIdHigh(titleId), GetTitleIdLow(titleId));
else
tmp = fmt::format("usr/title/{:08x}/{:08x}", GetTitleIdHigh(titleId), GetTitleIdLow(titleId));
return tmp;
}
}

View file

@ -43,49 +43,4 @@ void ExpressionParser_test()
cemu_assert_debug(_testEvaluateToType<float>("5 > 4 > 3 > 2") == 0.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) -> 0.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);
}
// 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>
#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__))
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];
va_list(args);
va_start(args, format);
#if BOOST_OS_WINDOWS > 0
#if BOOST_OS_WINDOWS
vsprintf_s(logTempStr, format, args);
#else
vsprintf(logTempStr, format, args);
@ -226,7 +226,7 @@ void cafeLog_logW(uint32 type, const wchar_t* format, ...)
wchar_t logTempStr[2048];
va_list(args);
va_start(args, format);
#if BOOST_OS_WINDOWS > 0
#if BOOST_OS_WINDOWS
vswprintf_s(logTempStr, format, args);
#else
vswprintf(logTempStr, 2048, format, args);
@ -243,7 +243,7 @@ void cafeLog_logW(uint32 type, const wchar_t* format, ...)
LoggingWindow::Log(it->second, logTempStr);
}
__declspec(dllexport) void cemuLog_log()
void cemuLog_log()
{
typedef void(*VoidFunc)();
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));
return false;
}
std::string_view svExpressionPart(startPtr, endPtr);
std::string_view svExpressionPart(startPtr, endPtr - startPtr);
std::string_view svRegPart(memoryRegBegin, memoryRegEnd - memoryRegBegin);
sint32 memGpr = _parseRegIndex(svRegPart, "r");
//if (_ppcAssembler_parseRegister(svRegPart, "r", memGpr) == false || (memGpr < 0 || memGpr >= 32))

View file

@ -15,6 +15,7 @@
#include "Cafe/Filesystem/FST/FST.h"
#include "Cafe/TitleList/TitleList.h"
#include <cinttypes>
#include <charconv>
#include <curl/curl.h>
#include <pugixml.hpp>
@ -580,7 +581,7 @@ void DownloadManager::searchForIncompleteDownloads()
uint64 titleId;
uint32 version;
std::string name = p.path().filename().generic_string();
if( sscanf(name.c_str(), "cemu_%016llx_v%u", &titleId, &version) != 2)
if( sscanf(name.c_str(), "cemu_% " PRIx64 "_v%u", &titleId, &version) != 2)
continue;
std::unique_lock<std::recursive_mutex> _l(m_mutex);
for (auto& itr : m_ticketCache)

View file

@ -73,6 +73,11 @@ CurlRequestHelper::CurlRequestHelper()
curl_easy_setopt(m_curl, CURLOPT_FOLLOWLOCATION, 1);
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()
@ -216,6 +221,11 @@ CurlSOAPHelper::CurlSOAPHelper()
// SSL
curl_easy_setopt(m_curl, CURLOPT_SSL_CTX_FUNCTION, _sslctx_function_SOAP);
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()
@ -390,4 +400,4 @@ namespace NAPI
result.apiError = NAPI_RESULT::SUCCESS;
return true;
}
};
};

View file

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

View file

@ -4,6 +4,8 @@
#include<bitset>
#include<random>
#include <boost/random/uniform_int.hpp>
void swap(unsigned char *a, unsigned char *b)
{
int tmp = *a;
@ -111,7 +113,8 @@ void releasePRUDPPort(uint16 port)
}
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()
{
@ -529,7 +532,7 @@ prudpClient::prudpClient(uint32 dstIp, uint16 dstPort, const char* key) : prudpC
break;
}
// 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
ioctlsocket(socketUdp, FIONBIO, &nonBlockingMode);
#else

View file

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

View file

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

View file

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

View file

@ -1,9 +1,3 @@
//Temporary Workaround for static_assert related errors in libstdc++12
//TODO: Make a proper fix
#ifdef __clang__
#define static_assert(...) static_assert(true, "")
#endif
#pragma once
#include <stdlib.h> // for size_t
@ -144,22 +138,32 @@ inline sint16 _swapEndianS16(sint16 v)
{
return (sint16)(((uint16)v >> 8) | ((uint16)v << 8));
}
#endif
#if BOOST_OS_LINUX
#else
inline uint64 _swapEndianU64(uint64 v)
{
#if BOOST_OS_MACOS
return OSSwapInt64(v);
#else
return bswap_64(v);
#endif
}
inline uint32 _swapEndianU32(uint32 v)
{
#if BOOST_OS_MACOS
return OSSwapInt32(v);
#else
return bswap_32(v);
#endif
}
inline sint32 _swapEndianS32(sint32 v)
{
#if BOOST_OS_MACOS
return (sint32)OSSwapInt32((uint32)v);
#else
return (sint32)bswap_32((uint32)v);
#endif
}
inline uint16 _swapEndianU16(uint16 v)

View file

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

View file

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

View file

@ -12,7 +12,11 @@ set_source_files_properties(x64util_masm.asm PROPERTIES LANGUAGE ASM_MASM)
ELSE()
# 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>")
ENDIF()
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)
@ -22,7 +26,11 @@ x64util_nasm.asm
)
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)
ENDIF()
set_target_properties(CemuAsm PROPERTIES LINKER_LANGUAGE C)
ENDIF()

View file

@ -1,6 +1,6 @@
#include "IAudioAPI.h"
#if BOOST_OS_WINDOWS > 0
#if BOOST_OS_WINDOWS
#include "XAudio2API.h"
#include "XAudio27API.h"
#include "DirectSoundAPI.h"
@ -37,7 +37,7 @@ void IAudioAPI::PrintLogging()
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
m_wfx.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE;
m_wfx.Format.nChannels = channels;

View file

@ -1,6 +1,6 @@
#pragma once
#if BOOST_OS_WINDOWS > 0
#if BOOST_OS_WINDOWS
#include <mmreg.h>
#endif
@ -64,7 +64,7 @@ public:
static std::vector<DeviceDescriptionPtr> GetDevices(AudioAPI api);
protected:
#if BOOST_OS_WINDOWS > 0
#if BOOST_OS_WINDOWS
WAVEFORMATEXTENSIBLE m_wfx{};
#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); }
__declspec(dllexport) wxEvtHandler* wxEvtHandler_Initialize(uint8_t* allocMemory)
{
wxEvtHandler* handler = new (allocMemory) wxEvtHandler();
return handler;
}
__declspec(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);
}
__declspec(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);
}
__declspec(dllexport) const wchar_t* GetTranslationWChar(const wchar_t* text)
{
return wxGetTranslation(text).wc_str();
}
__declspec(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
__declspec(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/CafeSystem.h"
extern bool DLLEXPORT alwaysDisplayDRC;
extern bool alwaysDisplayDRC;
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_graphic_pack_download = parser.get("gp_download", did_show_graphic_pack_download);
fullscreen = parser.get("fullscreen", fullscreen);
proxy_server = parser.get("proxy_server", "");
// cpu_mode = parser.get("cpu_mode", cpu_mode.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>("gp_download", did_show_graphic_pack_download);
config.set<bool>("fullscreen", fullscreen);
config.set("proxy_server", proxy_server.GetValue().c_str());
// config.set("cpu_mode", cpu_mode.GetValue());
//config.set("console_region", console_region.GetValue());
@ -576,4 +578,4 @@ void CemuConfig::AddRecentNfcFile(std::wstring_view file)
// keep maximum of entries
while (recent_nfc_files.size() > kMaxRecentEntries)
recent_nfc_files.pop_back();
}
}

View file

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

View file

@ -406,7 +406,7 @@ public:
}
FILE* file = nullptr;
#if BOOST_OS_WINDOWS > 0
#if BOOST_OS_WINDOWS
file = _wfopen(tmp_name.c_str(), L"wb");
#else
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"));
}
#pragma optimize( "", off )
DLLEXPORT _declspec(noinline) wxTopLevelWindow* wxMainWindowCreated(wxTopLevelWindow* wndPtr, uint32 magicConstant, CemuApp* appPointer)
{
return wndPtr;
}
#pragma optimize( "", on )
bool CemuApp::OnInit()
{
wxInitAllImageHandlers();
@ -140,9 +132,6 @@ bool CemuApp::OnInit()
g_window_info.app_active = true;
SetTopWindow(m_mainFrame);
// Cemuhook callback
wxMainWindowCreated(m_mainFrame, 0xDABABE, this);
m_mainFrame->Show();
return true;
}
@ -150,7 +139,7 @@ bool CemuApp::OnInit()
int CemuApp::OnExit()
{
wxApp::OnExit();
#if BOOST_OS_WINDOWS > 0
#if BOOST_OS_WINDOWS
ExitProcess(0);
#else
exit(0);
@ -306,7 +295,7 @@ void CemuApp::CreateDefaultFiles(bool first_start)
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));
#if BOOST_OS_WINDOWS > 0
#if BOOST_OS_WINDOWS
const DWORD lastError = GetLastError();
if (lastError != ERROR_SUCCESS)
errorMsg << fmt::format("\n\n{}", GetSystemErrorMessage(lastError));
@ -332,7 +321,7 @@ void CemuApp::CreateDefaultFiles(bool first_start)
std::stringstream errorMsg;
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();
if (lastError != ERROR_SUCCESS)
errorMsg << fmt::format("\n\n{}", GetSystemErrorMessage(lastError));

View file

@ -510,12 +510,11 @@ void CemuUpdateWindow::WorkerThread()
}
}
bool IsCemuhookLoaded();
void CemuUpdateWindow::OnClose(wxCloseEvent& event)
{
event.Skip();
#if BOOST_OS_WINDOWS > 0
#if BOOST_OS_WINDOWS
if (m_restart_required && !m_restart_file.empty() && fs::exists(m_restart_file))
{
PROCESS_INFORMATION pi{};
@ -529,11 +528,8 @@ void CemuUpdateWindow::OnClose(wxCloseEvent& event)
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);
if (IsCemuhookLoaded())
TerminateProcess(GetCurrentProcess(), 0);
else
exit(0);
exit(0);
}
#else
cemuLog_log(LogType::Force, "unimplemented - restart on update");

View file

@ -11,8 +11,8 @@
#include "gui/helpers/wxHelpers.h"
#include "input/InputManager.h"
#if BOOST_OS_LINUX
#include "resource/linux/resources.h"
#if BOOST_OS_LINUX || BOOST_OS_MACOS
#include "resource/embedded/resources.h"
#endif
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));
m_game_profile.Reset();
m_game_profile.Load(title_id, false);
m_game_profile.Load(title_id);
this->SetSizeHints(wxDefaultSize, wxDefaultSize);

View file

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

View file

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

View file

@ -10,13 +10,11 @@
#include "Cafe/CafeSystem.h"
#include "Cafe/TitleList/TitleList.h"
#if BOOST_OS_LINUX > 0
#include "resource/linux/resources.h"
#if BOOST_OS_LINUX || BOOST_OS_MACOS
#include "resource/embedded/resources.h"
#endif
// main.cpp
bool IsCemuhookLoaded();
class wxGraphicPackData : public wxTreeItemData
{
public:
@ -423,6 +421,10 @@ void GraphicPacksWindow2::OnTreeSelectionChanged(wxTreeEvent& event)
{
wxWindowUpdateLocker lock(this);
bool item_deselected = m_graphic_pack_tree->GetSelection() == m_graphic_pack_tree->GetRootItem();
if (item_deselected)
return;
const auto selection = m_graphic_pack_tree->GetSelection();
if (selection.IsOk())
{

View file

@ -50,12 +50,12 @@
#include "gui/input/InputSettings2.h"
#include "input/InputManager.h"
#if BOOST_OS_WINDOWS > 0
#if BOOST_OS_WINDOWS
#define exit(__c) ExitProcess(__c)
#endif
#if BOOST_OS_LINUX > 0
#include "resource/linux/resources.h"
#if BOOST_OS_LINUX || BOOST_OS_MACOS
#include "resource/embedded/resources.h"
#endif
#include "Cafe/TitleList/TitleInfo.h"
@ -65,8 +65,6 @@
extern WindowInfo g_window_info;
extern std::shared_mutex g_mutex;
bool IsCemuhookLoaded();
wxDEFINE_EVENT(wxEVT_SET_WINDOW_TITLE, wxCommandEvent);
enum
@ -296,7 +294,7 @@ MainWindow::MainWindow()
SetClientSize(1280, 720);
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);
SendMessage(this->GetHWND(), WM_SETICON, ICON_SMALL, (LPARAM)hWindowIcon);
#endif
@ -347,18 +345,6 @@ MainWindow::MainWindow()
Bind(wxEVT_OPEN_GRAPHIC_PACK, &MainWindow::OnGraphicWindowOpen, 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())
{
MainWindow::RequestLaunchGame(LaunchSettings::GetLoadFile().value(), wxLaunchGameEvent::INITIATED_BY::COMMAND_LINE);
@ -650,7 +636,7 @@ void MainWindow::OnInstallUpdate(wxCommandEvent& event)
break;
if (modalChoice == wxID_OK)
{
#if BOOST_OS_LINUX
#if BOOST_OS_LINUX || BOOST_OS_MACOS
fs::path dirPath((const char*)(openDirDialog.GetPath().fn_str()));
#else
fs::path dirPath(openDirDialog.GetPath().fn_str());
@ -2086,12 +2072,6 @@ void MainWindow::RecreateMenu()
#ifndef PUBLIC_RELEASE
m_fileMenu->Append(MAINFRAME_MENU_ID_FILE_END_EMULATION, _("End emulation"));
#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"));

View file

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

View file

@ -400,7 +400,7 @@ void MemorySearcherTool::OnResultListClick(wxMouseEvent& event)
auto currValue = m_listResults->GetItemText(selectedIndex, 1);
char addressString[256];
sprintf(addressString, "0x%08x", address);
sprintf(addressString, "0x%08lx", address);
// description, address, type, value, freeze
wxVector<wxVariant> data;

View file

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

View file

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

View file

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

View file

@ -17,21 +17,17 @@ std::shared_mutex g_mutex;
MainWindow* g_mainFrame = nullptr;
#if BOOST_OS_WINDOWS
void wxMatchCemuhookEventIds();
void _wxLaunch()
{
SetThreadName("MainThread_UI");
wxEntry();
}
#endif
void gui_create()
{
SetThreadName("MainThread");
#if BOOST_OS_WINDOWS
wxMatchCemuhookEventIds();
// 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
std::thread t = std::thread(_wxLaunch);
@ -159,9 +155,9 @@ typedef void GdkDisplay;
void gui_initHandleContextFromWxWidgetsWindow(WindowHandleInfo& handleInfoOut, class wxWindow* wxw)
{
#if BOOST_OS_WINDOWS > 0
#if BOOST_OS_WINDOWS
handleInfoOut.hwnd = wxw->GetHWND();
#else
#elif BOOST_OS_LINUX
/* dynamically retrieve GTK imports so we dont have to include and link the whole lib */
void (*dyn_gtk_widget_realize)(GtkWidget *widget);
dyn_gtk_widget_realize = (void(*)(GtkWidget* widget))dlsym(RTLD_NEXT, "gtk_widget_realize");

View file

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

View file

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

View file

@ -5,6 +5,8 @@
#include "Cafe/OS/RPL/rpl.h"
#include "Cafe/OS/RPL/rpl_symbol_storage.h"
#include <cinttypes>
enum
{
// options
@ -233,11 +235,11 @@ void DebugPPCThreadsWindow::RefreshThreadList()
m_thread_list->SetItem(i, 7, tempStr);
// last awake in cycles
uint64 lastWakeUpTime = cafeThread->wakeUpTime;
sprintf(tempStr, "%I64u", lastWakeUpTime);
sprintf(tempStr, "%" PRIu64, lastWakeUpTime);
m_thread_list->SetItem(i, 8, tempStr);
// awake time in cycles
uint64 awakeTime = cafeThread->totalCycles;
sprintf(tempStr, "%I64u", awakeTime);
sprintf(tempStr, "%" PRIu64, awakeTime);
m_thread_list->SetItem(i, 9, tempStr);
// thread name
const char* threadName = "NULL";

View file

@ -28,14 +28,14 @@
#include "Cafe/OS/libs/vpad/vpad.h"
#include "audio/IAudioAPI.h"
#if BOOST_OS_WINDOWS > 0
#if BOOST_OS_WINDOWS
#pragma comment(lib,"Dbghelp.lib")
#endif
#define SDL_MAIN_HANDLED
#include <SDL.h>
#if BOOST_OS_LINUX > 0
#if BOOST_OS_LINUX || BOOST_OS_MACOS
#define _putenv(__s) putenv((char*)(__s))
#endif
@ -53,47 +53,9 @@ std::atomic_bool g_isGPUInitFinished = false;
std::wstring executablePath;
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()
{
#if BOOST_OS_WINDOWS > 0
#if BOOST_OS_WINDOWS
int CPUInfo[4] = { -1 };
unsigned nExIds, i = 0;
char CPUBrandString[0x40];
@ -129,7 +91,7 @@ bool IsRunningInWine()
void checkForWine()
{
#if BOOST_OS_WINDOWS > 0
#if BOOST_OS_WINDOWS
const HMODULE hmodule = GetModuleHandleA("ntdll.dll");
if (!hmodule)
return;
@ -150,8 +112,6 @@ void infoLog_cemuStartup()
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(u8"mlc01 path: {}", ActiveSettings::GetMlcPath().generic_u8string());
// check if Cemuhook is installed
checkForCemuhook();
// check for wine version
checkForWine();
// CPU and RAM info
@ -206,7 +166,7 @@ void reconfigureGLDrivers()
std::string nvCacheDirEnvOption("__GL_SHADER_DISK_CACHE_PATH=");
nvCacheDirEnvOption.append(_utf8Wrapper(nvCacheDir));
#if BOOST_OS_WINDOWS > 0
#if BOOST_OS_WINDOWS
std::wstring tmpW = boost::nowide::widen(nvCacheDirEnvOption);
_wputenv(tmpW.c_str());
#else
@ -239,7 +199,7 @@ void mainEmulatorCommonInit()
__cpuidex(cpuInfo, 0x7, 0);
_cpuExtension_AVX2 = ((cpuInfo[1] >> 5) & 1) != 0;
#if BOOST_OS_WINDOWS > 0
#if BOOST_OS_WINDOWS
executablePath.resize(4096);
int i = GetModuleFileName(NULL, executablePath.data(), executablePath.size());
if(i >= 0)
@ -324,7 +284,7 @@ int mainEmulatorHLE()
bool isConsoleConnected = false;
void requireConsole()
{
#if BOOST_OS_WINDOWS > 0
#if BOOST_OS_WINDOWS
if (isConsoleConnected)
return;
@ -345,7 +305,7 @@ void HandlePostUpdate()
const auto filename = ActiveSettings::GetFullPath().replace_extension("exe.backup");
if (fs::exists(filename))
{
#if BOOST_OS_WINDOWS > 0
#if BOOST_OS_WINDOWS
HANDLE lock;
do
{
@ -374,7 +334,7 @@ void HandlePostUpdate()
void ToolShaderCacheMerger();
#if BOOST_OS_WINDOWS > 0
#if BOOST_OS_WINDOWS
#ifndef PUBLIC_RELEASE
#include <crtdbg.h>
@ -411,7 +371,9 @@ int wWinMain( _In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ L
#else
int main(int argc, char *argv[])
{
#if BOOST_OS_LINUX
XInitThreads();
#endif
if (!LaunchSettings::HandleCommandline(argc, argv))
return 0;
@ -422,48 +384,7 @@ int main(int argc, char *argv[])
}
#endif
/* Cemuhook legacy API */
#pragma optimize("",off)
__declspec(dllexport) void gameMeta_loadForCurrent()
{
int placeholderA = 0x11223344;
int placeholderB = 0x55667788;
}
#pragma optimize("",on)
__declspec(dllexport) uint64 gameMeta_getTitleId()
extern "C" DLLEXPORT uint64 gameMeta_getTitleId()
{
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
if(UNIX)
target_sources(CemuResource PRIVATE
linux/resources.cpp
linux/resources.h
embedded/resources.cpp
embedded/resources.h
)
endif()

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