Initialize RAIntegration support if available. Untested.

This commit is contained in:
Henrik Rydgård 2024-04-05 11:07:57 +02:00
parent 32620ff12f
commit 5a8140c301
25 changed files with 201 additions and 53 deletions

2
.gitignore vendored
View File

@ -136,6 +136,8 @@ build
libretro/obj/local
ppsspp_retroachievements.dat
RACache
RAPrefs_PPSSPP.cfg
# For CLion
cmake-build-*/

View File

@ -192,6 +192,8 @@ enum SystemProperty {
SYSPROP_USER_DOCUMENTS_DIR,
SYSPROP_OK_BUTTON_LEFT,
SYSPROP_MAIN_WINDOW_HANDLE,
};
enum class SystemNotification {
@ -252,7 +254,7 @@ enum class UIMessage {
std::string System_GetProperty(SystemProperty prop);
std::vector<std::string> System_GetPropertyStringVec(SystemProperty prop);
int System_GetPropertyInt(SystemProperty prop);
int64_t System_GetPropertyInt(SystemProperty prop);
float System_GetPropertyFloat(SystemProperty prop);
bool System_GetPropertyBool(SystemProperty prop);

View File

@ -314,6 +314,7 @@ static bool DefaultSasThread() {
static const ConfigSetting achievementSettings[] = {
// Core settings
ConfigSetting("AchievementsEnable", &g_Config.bAchievementsEnable, true, CfgFlag::DEFAULT),
ConfigSetting("AchievementsEnableRAIntegration", &g_Config.bAchievementsEnableRAIntegration, false, CfgFlag::DEFAULT),
ConfigSetting("AchievementsChallengeMode", &g_Config.bAchievementsChallengeMode, true, CfgFlag::PER_GAME | CfgFlag::DEFAULT),
ConfigSetting("AchievementsEncoreMode", &g_Config.bAchievementsEncoreMode, false, CfgFlag::PER_GAME | CfgFlag::DEFAULT),
ConfigSetting("AchievementsUnofficial", &g_Config.bAchievementsUnofficial, false, CfgFlag::PER_GAME | CfgFlag::DEFAULT),

View File

@ -528,6 +528,7 @@ public:
bool bAchievementsSoundEffects;
bool bAchievementsLogBadMemReads;
bool bAchievementsSaveStateInHardcoreMode;
bool bAchievementsEnableRAIntegration;
// Positioning of the various notifications
int iAchievementsLeaderboardTrackerPos;

View File

@ -139,7 +139,7 @@
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<AdditionalIncludeDirectories>..\ffmpeg\WindowsInclude;..\ext\libchdr\include;..\ffmpeg\Windows\x86\include;../common;..;../ext/glew;../ext/snappy;../ext/libpng17;../ext/zlib;../ext;../ext/zstd/lib</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_CRTDBG_MAP_ALLOC;USING_WIN_UI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;USE_FFMPEG;WITH_UPNP;WIN32;_ARCH_32=1;_M_IX86=1;_DEBUG;_LIB;_UNICODE;UNICODE;MINIUPNP_STATICLIB;ARMIPS_USE_STD_FILESYSTEM;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>RC_CLIENT_SUPPORTS_RAINTEGRATION;_CRTDBG_MAP_ALLOC;USING_WIN_UI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;USE_FFMPEG;WITH_UPNP;WIN32;_ARCH_32=1;_M_IX86=1;_DEBUG;_LIB;_UNICODE;UNICODE;MINIUPNP_STATICLIB;ARMIPS_USE_STD_FILESYSTEM;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
<FloatingPointModel>Precise</FloatingPointModel>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
@ -166,7 +166,7 @@
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<AdditionalIncludeDirectories>..\ffmpeg\WindowsInclude;..\ext\libchdr\include;..\ffmpeg\Windows\x86_64\include;../common;..;../ext/glew;../ext/snappy;../ext/libpng17;../ext/zlib;../ext;../ext/zstd/lib;../ext/zstd/lib</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_CRTDBG_MAP_ALLOC;USING_WIN_UI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;USE_FFMPEG;WITH_UPNP;WIN32;_ARCH_64=1;_M_X64=1;_DEBUG;_LIB;_UNICODE;UNICODE;MINIUPNP_STATICLIB;ARMIPS_USE_STD_FILESYSTEM;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>RC_CLIENT_SUPPORTS_RAINTEGRATION;_CRTDBG_MAP_ALLOC;USING_WIN_UI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;USE_FFMPEG;WITH_UPNP;WIN32;_ARCH_64=1;_M_X64=1;_DEBUG;_LIB;_UNICODE;UNICODE;MINIUPNP_STATICLIB;ARMIPS_USE_STD_FILESYSTEM;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
<FloatingPointModel>Precise</FloatingPointModel>
<OmitFramePointers>false</OmitFramePointers>
@ -257,7 +257,7 @@
<BufferSecurityCheck>false</BufferSecurityCheck>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
<FloatingPointModel>Precise</FloatingPointModel>
<PreprocessorDefinitions>USING_WIN_UI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;USE_FFMPEG;WITH_UPNP;WIN32;_ARCH_32=1;_M_IX86=1;_LIB;NDEBUG;_UNICODE;UNICODE;MINIUPNP_STATICLIB;ARMIPS_USE_STD_FILESYSTEM;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>RC_CLIENT_SUPPORTS_RAINTEGRATION;USING_WIN_UI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;USE_FFMPEG;WITH_UPNP;WIN32;_ARCH_32=1;_M_IX86=1;_LIB;NDEBUG;_UNICODE;UNICODE;MINIUPNP_STATICLIB;ARMIPS_USE_STD_FILESYSTEM;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
@ -294,7 +294,7 @@
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<WholeProgramOptimization>false</WholeProgramOptimization>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<PreprocessorDefinitions>USING_WIN_UI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;USE_FFMPEG;WITH_UPNP;WIN32;_ARCH_64=1;_M_X64=1;_LIB;NDEBUG;_UNICODE;UNICODE;MINIUPNP_STATICLIB;ARMIPS_USE_STD_FILESYSTEM;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>RC_CLIENT_SUPPORTS_RAINTEGRATION;USING_WIN_UI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;USE_FFMPEG;WITH_UPNP;WIN32;_ARCH_64=1;_M_X64=1;_LIB;NDEBUG;_UNICODE;UNICODE;MINIUPNP_STATICLIB;ARMIPS_USE_STD_FILESYSTEM;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<StringPooling>true</StringPooling>

View File

@ -25,6 +25,7 @@
#include "ext/rcheevos/include/rcheevos.h"
#include "ext/rcheevos/include/rc_client.h"
#include "ext/rcheevos/include/rc_client_raintegration.h"
#include "ext/rcheevos/include/rc_api_user.h"
#include "ext/rcheevos/include/rc_api_info.h"
#include "ext/rcheevos/include/rc_api_request.h"
@ -38,8 +39,6 @@
#include "Common/Log.h"
#include "Common/File/Path.h"
#include "Common/File/FileUtil.h"
#include "Core/FileLoaders/LocalFileLoader.h"
#include "Core/FileSystems/BlockDevices.h"
#include "Common/Net/HTTPClient.h"
#include "Common/System/OSD.h"
#include "Common/System/System.h"
@ -55,19 +54,28 @@
#include "Core/MemMap.h"
#include "Core/Config.h"
#include "Core/CoreParameter.h"
#include "Core/ELF/ParamSFO.h"
#include "Core/Core.h"
#include "Core/System.h"
#include "Core/FileLoaders/LocalFileLoader.h"
#include "Core/FileSystems/BlockDevices.h"
#include "Core/ELF/ParamSFO.h"
#include "Core/FileSystems/MetaFileSystem.h"
#include "Core/FileSystems/ISOFileSystem.h"
#include "Core/RetroAchievements.h"
#if RC_CLIENT_SUPPORTS_RAINTEGRATION
#include "Windows/MainWindow.h"
#endif
static bool HashISOFile(ISOFileSystem *fs, const std::string filename, md5_context *md5) {
int handle = fs->OpenFile(filename, FILEACCESS_READ);
if (handle < 0) {
return false;
}
uint32_t sz = fs->SeekFile(handle, 0, FILEMOVE_END);
uint32_t sz = (uint32_t)fs->SeekFile(handle, 0, FILEMOVE_END);
fs->SeekFile(handle, 0, FILEMOVE_BEGIN);
if (!sz) {
return false;
@ -131,7 +139,7 @@ static Achievements::Statistics g_stats;
const std::string g_gameIconCachePrefix = "game:";
const std::string g_iconCachePrefix = "badge:";
Path s_game_path;
Path g_gamePath;
std::string s_game_hash;
std::set<uint32_t> g_activeChallenges;
@ -461,6 +469,93 @@ static void login_token_callback(int result, const char *error_message, rc_clien
g_isLoggingIn = false;
}
bool RAIntegrationDirty() {
#ifdef RC_CLIENT_SUPPORTS_RAINTEGRATION
return rc_client_raintegration_has_modifications(g_rcClient);
#else
return false;
#endif
}
#ifdef RC_CLIENT_SUPPORTS_RAINTEGRATION
static void raintegration_get_game_name_handler(char *buffer, uint32_t buffer_size, rc_client_t *client) {
snprintf(buffer, buffer_size, "%s", g_gamePath.GetFilename().c_str());
}
static void raintegration_write_memory_handler(uint32_t address, uint8_t *buffer, uint32_t num_bytes, rc_client_t *client) {
// convert_retroachievements_address_to_real_address
uint32_t realAddress = address + PSP_MEMORY_OFFSET;
uint8_t *writePtr = Memory::GetPointerWriteRange(address, num_bytes);
if (writePtr) {
memcpy(writePtr, buffer, num_bytes);
}
}
static void raintegration_event_handler(const rc_client_raintegration_event_t *event, rc_client_t *client) {
switch (event->type) {
case RC_CLIENT_RAINTEGRATION_EVENT_MENUITEM_CHECKED_CHANGED:
// The checked state of one of the menu items has changed and should be reflected in the UI.
// Call the handy helper function if the menu was created by rc_client_raintegration_rebuild_submenu.
rc_client_raintegration_update_menu_item(client, event->menu_item);
break;
case RC_CLIENT_RAINTEGRATION_EVENT_PAUSE:
// The toolkit has hit a breakpoint and wants to pause the emulator. Do so.
Core_EnableStepping(true, "ra_breakpoint");
break;
case RC_CLIENT_RAINTEGRATION_EVENT_HARDCORE_CHANGED:
// Hardcore mode has been changed (either directly by the user, or disabled through the use of the tools).
// The frontend doesn't necessarily need to know that this value changed, they can still query it whenever
// it's appropriate, but the event lets the frontend do things like enable/disable rewind or cheats.
// handle_hardcore_changed();
break;
default:
ERROR_LOG(ACHIEVEMENTS, "Unsupported raintegration event %u\n", event->type);
break;
}
}
static void load_integration_callback(int result, const char *error_message, rc_client_t *client, void *userdata) {
auto ac = GetI18NCategory(I18NCat::ACHIEVEMENTS);
// If DLL not present, do nothing. User can still play without the toolkit.
switch (result) {
case RC_OK:
{
// If not successful, just report the error and bail. Shouldn't happen.
// DLL was loaded.
g_OSD.Show(OSDType::MESSAGE_SUCCESS, ac->T("RAIntegration DLL loaded."));
// Hook up menu.
HWND hWnd = (HWND)userdata;
rc_client_raintegration_set_event_handler(g_rcClient, &raintegration_event_handler);
rc_client_raintegration_set_write_memory_function(g_rcClient, &raintegration_write_memory_handler);
rc_client_raintegration_set_get_game_name_function(g_rcClient, &raintegration_get_game_name_handler);
rc_client_raintegration_rebuild_submenu(g_rcClient, GetMenu(hWnd));
break;
}
case RC_MISSING_VALUE:
// This is fine, proceeding to login.
g_OSD.Show(OSDType::MESSAGE_WARNING, ac->T("RAIntegration is enabled, but RAIntegration-x64.dll was not found."));
break;
case RC_ABORTED:
// This is fine, proceeding to login.
g_OSD.Show(OSDType::MESSAGE_WARNING, ac->T("Wrong version of RAIntegration-x64.dll?"));
break;
default:
g_OSD.Show(OSDType::MESSAGE_ERROR, StringFromFormat("RAIntegration init failed: %s", error_message));
// Bailing.
return;
}
// Things are ready to load a game. If the DLL was initialized, calling rc_client_begin_load_game will be redirected
// through the DLL so the toolkit has access to the game data. Similarly, things like rc_create_leaderboard_list will
// be redirected through the DLL to reflect any local changes made by the user.
TryLoginByToken(true);
}
#endif
void Initialize() {
if (!g_Config.bAchievementsEnable) {
_dbg_assert_(!g_rcClient);
@ -477,7 +572,6 @@ void Initialize() {
// Provide a logging function to simplify debugging
rc_client_enable_logging(g_rcClient, RC_CLIENT_LOG_LEVEL_VERBOSE, log_message_callback);
if (!System_GetPropertyBool(SYSPROP_SUPPORTS_HTTPS)) {
// Disable SSL if not supported by our platform implementation.
rc_client_set_host(g_rcClient, "http://retroachievements.org");
@ -485,6 +579,21 @@ void Initialize() {
rc_client_set_event_handler(g_rcClient, event_handler_callback);
#ifdef RC_CLIENT_SUPPORTS_RAINTEGRATION
if (g_Config.bAchievementsEnableRAIntegration) {
wchar_t szFilePath[MAX_PATH];
GetModuleFileNameW(NULL, szFilePath, MAX_PATH);
for (int64_t i = wcslen(szFilePath) - 1; i > 0; i--) {
if (szFilePath[i] == '\\') {
szFilePath[i] = '\0';
break;
}
}
HWND hWnd = (HWND)System_GetPropertyInt(SYSPROP_MAIN_WINDOW_HANDLE);
rc_client_begin_load_raintegration(g_rcClient, szFilePath, hWnd, "PPSSPP", "1.0", &load_integration_callback, hWnd);
return;
}
#endif
TryLoginByToken(true);
}
@ -551,7 +660,7 @@ static void login_password_callback(int result, const char *error_message, rc_cl
bool LoginAsync(const char *username, const char *password) {
auto di = GetI18NCategory(I18NCat::DIALOG);
if (IsLoggedIn() || std::strlen(username) == 0 || std::strlen(password) == 0 || IsUsingRAIntegration())
if (IsLoggedIn() || std::strlen(username) == 0 || std::strlen(password) == 0)
return false;
g_OSD.SetProgressBar("cheevos_async_login", di->T("Logging in..."), 0, 0, 0, 0.0f);
@ -587,6 +696,9 @@ void UpdateSettings() {
bool Shutdown() {
g_activeChallenges.clear();
#ifdef RC_CLIENT_SUPPORTS_RAINTEGRATION
rc_client_unload_raintegration(g_rcClient);
#endif
rc_client_destroy(g_rcClient);
g_rcClient = nullptr;
INFO_LOG(ACHIEVEMENTS, "Achievements shut down.");
@ -832,6 +944,7 @@ void SetGame(const Path &path, IdentifiedFileType fileType, FileLoader *fileLoad
}
// The caller should hold off on executing game code until this turns false, checking with IsBlockingExecution()
g_gamePath = path;
g_isIdentifying = true;
// TODO: Fish the block device out of the loading process somewhere else. Though, probably easier to just do it here.
@ -861,6 +974,8 @@ void SetGame(const Path &path, IdentifiedFileType fileType, FileLoader *fileLoad
void UnloadGame() {
if (g_rcClient) {
rc_client_unload_game(g_rcClient);
g_gamePath.clear();
s_game_hash.clear();
}
}

View File

@ -34,20 +34,6 @@ struct Statistics {
int badMemoryAccessCount;
};
// RAIntegration only exists for Windows, so no point checking it on other platforms.
#ifdef WITH_RAINTEGRATION
bool IsUsingRAIntegration();
#else
static inline bool IsUsingRAIntegration()
{
return false;
}
#endif
// Returns true if the user is logged in properly, and everything is set up for playing games with achievements.
bool IsLoggedIn();
@ -80,6 +66,9 @@ bool WarnUserIfHardcoreModeActive(bool isSaveStateAction, std::string_view messa
// Returns the length of the string. If (size_t)-1, there's no message.
size_t GetRichPresenceMessage(char *buffer, size_t bufSize);
// Returns true if the user has unsaved RAIntegration changes. Should prompt the user to be sure they want to exit.
bool RAIntegrationDirty();
// The new API is so much nicer that we can use it directly instead of wrapping it. So let's expose the client.
// Will of course return nullptr if not active.
rc_client_t *GetClient();

View File

@ -185,7 +185,7 @@ std::vector<std::string> System_GetPropertyStringVec(SystemProperty prop) {
}
}
int System_GetPropertyInt(SystemProperty prop) {
int64_t System_GetPropertyInt(SystemProperty prop) {
switch (prop) {
#if defined(SDL)
case SYSPROP_AUDIO_SAMPLE_RATE:

View File

@ -492,7 +492,7 @@ std::vector<std::string> System_GetPropertyStringVec(SystemProperty prop) {
}
}
int System_GetPropertyInt(SystemProperty prop) {
int64_t System_GetPropertyInt(SystemProperty prop) {
switch (prop) {
case SYSPROP_AUDIO_SAMPLE_RATE:
return g_retFmt.freq;

View File

@ -553,7 +553,9 @@ UI::EventReturn PromptScreen::OnNo(UI::EventParams &e) {
}
void PromptScreen::TriggerFinish(DialogResult result) {
callback_(result == DR_OK || result == DR_YES);
if (callback_) {
callback_(result == DR_OK || result == DR_YES);
}
UIDialogScreenWithBackground::TriggerFinish(result);
}

View File

@ -258,7 +258,7 @@ void GamePauseScreen::update() {
UIScreen::update();
if (finishNextFrame_) {
TriggerFinish(DR_CANCEL);
TriggerFinish(finishNextFrameResult_);
finishNextFrame_ = false;
}
@ -494,10 +494,26 @@ UI::EventReturn GamePauseScreen::OnScreenshotClicked(UI::EventParams &e) {
}
UI::EventReturn GamePauseScreen::OnExitToMenu(UI::EventParams &e) {
if (g_Config.bPauseMenuExitsEmulator) {
System_ExitApp();
// If RAIntegration has dirty info, ask for confirmation.
if (Achievements::RAIntegrationDirty()) {
auto ac = GetI18NCategory(I18NCat::ACHIEVEMENTS);
auto di = GetI18NCategory(I18NCat::DIALOG);
screenManager()->push(new PromptScreen(gamePath_, ac->T("You have unsaved RAIntegration changes. Exit?"), di->T("Yes"), di->T("No"), [=](bool result) {
if (result) {
if (g_Config.bPauseMenuExitsEmulator) {
System_ExitApp();
} else {
finishNextFrameResult_ = DR_OK; // exit game
finishNextFrame_ = true;
}
}
}));
} else {
TriggerFinish(DR_OK);
if (g_Config.bPauseMenuExitsEmulator) {
System_ExitApp();
} else {
TriggerFinish(DR_OK);
}
}
return UI::EVENT_DONE;
}

View File

@ -24,6 +24,7 @@
#include "Common/UI/UIScreen.h"
#include "Common/UI/ViewGroup.h"
#include "UI/MiscScreens.h"
#include "UI/Screen.h"
enum class PauseScreenMode {
MAIN,
@ -65,6 +66,7 @@ private:
// hack
bool finishNextFrame_ = false;
DialogResult finishNextFrameResult_ = DR_CANCEL;
PauseScreenMode mode_ = PauseScreenMode::MAIN;
UI::Button *playButton_ = nullptr;

View File

@ -382,6 +382,9 @@ void RetroAchievementsSettingsScreen::CreateDeveloperToolsTab(UI::ViewGroup *vie
using namespace UI;
viewGroup->Add(new ItemHeader(di->T("Settings")));
#ifdef RC_CLIENT_SUPPORTS_RAINTEGRATION
viewGroup->Add(new CheckBox(&g_Config.bAchievementsEnableRAIntegration, ac->T("Enable RAIntegration (for achievement development)")))->SetEnabledPtr(&g_Config.bAchievementsEnable);
#endif
viewGroup->Add(new CheckBox(&g_Config.bAchievementsEncoreMode, ac->T("Encore Mode")))->SetEnabledPtr(&g_Config.bAchievementsEnable);
viewGroup->Add(new CheckBox(&g_Config.bAchievementsUnofficial, ac->T("Unofficial achievements")))->SetEnabledPtr(&g_Config.bAchievementsEnable);
viewGroup->Add(new CheckBox(&g_Config.bAchievementsLogBadMemReads, ac->T("Log bad memory accesses")))->SetEnabledPtr(&g_Config.bAchievementsEnable);

View File

@ -221,7 +221,7 @@
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<PreprocessorDefinitions>_CRTDBG_MAP_ALLOC;USING_WIN_UI;_CRT_SECURE_NO_WARNINGS;_ARCH_32=1;WIN32;_DEBUG;_LIB;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>RC_CLIENT_SUPPORTS_RAINTEGRATION;_CRTDBG_MAP_ALLOC;USING_WIN_UI;_CRT_SECURE_NO_WARNINGS;_ARCH_32=1;WIN32;_DEBUG;_LIB;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\include;../common;..;../ext/native;../ext/glew;../ext/snappy;../ext/zlib;../ext</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<MinimalRebuild>false</MinimalRebuild>
@ -242,7 +242,7 @@
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<PreprocessorDefinitions>_CRTDBG_MAP_ALLOC;USING_WIN_UI;_CRT_SECURE_NO_WARNINGS;_ARCH_64=1;WIN32;_DEBUG;_LIB;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>RC_CLIENT_SUPPORTS_RAINTEGRATION;_CRTDBG_MAP_ALLOC;USING_WIN_UI;_CRT_SECURE_NO_WARNINGS;_ARCH_64=1;WIN32;_DEBUG;_LIB;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\include;../common;..;../ext/native;../ext/glew;../ext/snappy;../ext/zlib;../ext</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<MinimalRebuild>false</MinimalRebuild>
@ -312,7 +312,7 @@
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>USING_WIN_UI;_CRT_SECURE_NO_WARNINGS;_ARCH_32=1;WIN32;NDEBUG;_LIB;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>RC_CLIENT_SUPPORTS_RAINTEGRATION;USING_WIN_UI;_CRT_SECURE_NO_WARNINGS;_ARCH_32=1;WIN32;NDEBUG;_LIB;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\include;../common;..;../ext/native;../ext/glew;../ext/snappy;../ext/zlib;../ext</AdditionalIncludeDirectories>
<BufferSecurityCheck>false</BufferSecurityCheck>
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
@ -339,7 +339,7 @@
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>USING_WIN_UI;_CRT_SECURE_NO_WARNINGS;_ARCH_64=1;WIN32;NDEBUG;_LIB;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>RC_CLIENT_SUPPORTS_RAINTEGRATION;USING_WIN_UI;_CRT_SECURE_NO_WARNINGS;_ARCH_64=1;WIN32;NDEBUG;_LIB;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\include;../common;..;../ext/native;../ext/glew;../ext/snappy;../ext/zlib;../ext</AdditionalIncludeDirectories>
<BufferSecurityCheck>false</BufferSecurityCheck>
<MultiProcessorCompilation>true</MultiProcessorCompilation>

View File

@ -354,7 +354,7 @@ std::vector<std::string> System_GetPropertyStringVec(SystemProperty prop) {
}
}
int System_GetPropertyInt(SystemProperty prop) {
int64_t System_GetPropertyInt(SystemProperty prop) {
switch (prop) {
case SYSPROP_AUDIO_SAMPLE_RATE:
return winAudioBackend ? winAudioBackend->GetSampleRate() : -1;

View File

@ -53,6 +53,10 @@
#include "Core/Core.h"
#include "Core/RetroAchievements.h"
#ifdef RC_CLIENT_SUPPORTS_RAINTEGRATION
#include "ext/rcheevos/include/rc_client_raintegration.h"
#endif
extern bool g_TakeScreenshot;
namespace MainWindow {
@ -946,7 +950,12 @@ namespace MainWindow {
break;
default:
MessageBox(hWnd, L"Unimplemented", L"Sorry", 0);
#ifdef RC_CLIENT_SUPPORTS_RAINTEGRATION
if (rc_client_raintegration_activate_menu_item(Achievements::GetClient(), LOWORD(wParam))) {
break;
}
#endif
MessageBox(hWnd, L"Unhandled menu item", L"Sorry", 0);
break;
}
}

View File

@ -231,7 +231,7 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PreprocessorDefinitions>_CRTDBG_MAP_ALLOC;USING_WIN_UI;GLEW_STATIC;_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_ARCH_32=1;_WINDOWS;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>RC_CLIENT_SUPPORTS_RAINTEGRATION;_CRTDBG_MAP_ALLOC;USING_WIN_UI;GLEW_STATIC;_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_ARCH_32=1;_WINDOWS;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>false</MinimalRebuild>
<ExceptionHandling>Sync</ExceptionHandling>
<PrecompiledHeader>Use</PrecompiledHeader>
@ -271,7 +271,7 @@
</Midl>
<ClCompile>
<MinimalRebuild>false</MinimalRebuild>
<PreprocessorDefinitions>_CRTDBG_MAP_ALLOC;USING_WIN_UI;GLEW_STATIC;_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_ARCH_64=1;_WINDOWS;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>RC_CLIENT_SUPPORTS_RAINTEGRATION;_CRTDBG_MAP_ALLOC;USING_WIN_UI;GLEW_STATIC;_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_ARCH_64=1;_WINDOWS;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>Sync</ExceptionHandling>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
@ -378,7 +378,7 @@
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<PreprocessorDefinitions>USING_WIN_UI;GLEW_STATIC;_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_ARCH_32=1;_WINDOWS;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>RC_CLIENT_SUPPORTS_RAINTEGRATION;USING_WIN_UI;GLEW_STATIC;_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_ARCH_32=1;_WINDOWS;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling>Sync</ExceptionHandling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
@ -428,7 +428,7 @@
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>false</OmitFramePointers>
<PreprocessorDefinitions>USING_WIN_UI;GLEW_STATIC;_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_ARCH_64=1;_WINDOWS;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>RC_CLIENT_SUPPORTS_RAINTEGRATION;USING_WIN_UI;GLEW_STATIC;_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_ARCH_64=1;_WINDOWS;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling>Sync</ExceptionHandling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>

View File

@ -307,8 +307,10 @@ static int ScreenRefreshRateHz() {
return rate;
}
int System_GetPropertyInt(SystemProperty prop) {
int64_t System_GetPropertyInt(SystemProperty prop) {
switch (prop) {
case SYSPROP_MAIN_WINDOW_HANDLE:
return (int64_t)MainWindow::GetHWND();
case SYSPROP_AUDIO_SAMPLE_RATE:
return winAudioBackend ? winAudioBackend->GetSampleRate() : -1;
case SYSPROP_DEVICE_TYPE:

View File

@ -441,7 +441,7 @@ std::vector<std::string> System_GetPropertyStringVec(SystemProperty prop) {
}
}
int System_GetPropertyInt(SystemProperty prop) {
int64_t System_GetPropertyInt(SystemProperty prop) {
switch (prop) {
case SYSPROP_SYSTEMVERSION:
return androidVersion;

View File

@ -55,6 +55,7 @@
<ClCompile Include="..\rcheevos\src\rcheevos\trigger.c" />
<ClCompile Include="..\rcheevos\src\rcheevos\value.c" />
<ClCompile Include="..\rcheevos\src\rc_client.c" />
<ClCompile Include="..\rcheevos\src\rc_client_raintegration.c" />
<ClCompile Include="..\rcheevos\src\rc_compat.c" />
<ClCompile Include="..\rcheevos\src\rc_util.c" />
<ClCompile Include="..\rcheevos\src\rhash\md5.c" />
@ -174,7 +175,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PreprocessorDefinitions>RC_DISABLE_LUA;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>RC_DISABLE_LUA;RC_CLIENT_SUPPORTS_RAINTEGRATION;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<AdditionalIncludeDirectories>../rcheevos/include</AdditionalIncludeDirectories>
@ -217,7 +218,7 @@
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>RC_DISABLE_LUA;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>RC_DISABLE_LUA;RC_CLIENT_SUPPORTS_RAINTEGRATION;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<AdditionalIncludeDirectories>../rcheevos/include</AdditionalIncludeDirectories>
@ -268,7 +269,7 @@
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>RC_DISABLE_LUA;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>RC_DISABLE_LUA;RC_CLIENT_SUPPORTS_RAINTEGRATION;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<AdditionalIncludeDirectories>../rcheevos/include</AdditionalIncludeDirectories>
@ -314,7 +315,7 @@
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>RC_DISABLE_LUA;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>RC_DISABLE_LUA;RC_CLIENT_SUPPORTS_RAINTEGRATION;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<AdditionalIncludeDirectories>../rcheevos/include</AdditionalIncludeDirectories>

View File

@ -84,6 +84,9 @@
<ClCompile Include="..\rcheevos\src\rhash\md5.c">
<Filter>rhash</Filter>
</ClCompile>
<ClCompile Include="..\rcheevos\src\rc_client_raintegration.c">
<Filter>rcheevos</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\rcheevos\src\rapi\rc_api_common.h">

View File

@ -99,7 +99,7 @@ void NativeResized() { }
std::string System_GetProperty(SystemProperty prop) { return ""; }
std::vector<std::string> System_GetPropertyStringVec(SystemProperty prop) { return std::vector<std::string>(); }
int System_GetPropertyInt(SystemProperty prop) {
int64_t System_GetPropertyInt(SystemProperty prop) {
if (prop == SYSPROP_SYSTEMVERSION)
return 31;
return -1;

View File

@ -303,7 +303,7 @@ std::vector<std::string> System_GetPropertyStringVec(SystemProperty prop) {
}
}
int System_GetPropertyInt(SystemProperty prop) {
int64_t System_GetPropertyInt(SystemProperty prop) {
switch (prop) {
case SYSPROP_AUDIO_SAMPLE_RATE:
return 44100;

View File

@ -1640,7 +1640,7 @@ void retro_cheat_set(unsigned index, bool enabled, const char *code) {
}
}
int System_GetPropertyInt(SystemProperty prop)
int64_t System_GetPropertyInt(SystemProperty prop)
{
switch (prop)
{

View File

@ -85,7 +85,7 @@
std::string System_GetProperty(SystemProperty prop) { return ""; }
std::vector<std::string> System_GetPropertyStringVec(SystemProperty prop) { return std::vector<std::string>(); }
int System_GetPropertyInt(SystemProperty prop) {
int64_t System_GetPropertyInt(SystemProperty prop) {
return -1;
}
float System_GetPropertyFloat(SystemProperty prop) {