mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-06-17 12:15:45 -04:00
Implement RetroAchivements
This commit is contained in:
@ -91,7 +91,7 @@ if(ENABLE_DISCORD_PRESENCE)
|
||||
target_link_libraries(frontend-common PRIVATE discord-rpc)
|
||||
endif()
|
||||
|
||||
if(ENABLE_RETROACHIEVEMENTS)
|
||||
if(ENABLE_CHEEVOS)
|
||||
target_sources(frontend-common PRIVATE
|
||||
http_downloader.cpp
|
||||
http_downloader.h
|
||||
@ -102,6 +102,13 @@ if(ENABLE_RETROACHIEVEMENTS)
|
||||
http_downloader_winhttp.h
|
||||
)
|
||||
endif()
|
||||
|
||||
target_sources(frontend-common PRIVATE
|
||||
cheevos.cpp
|
||||
cheevos.h
|
||||
)
|
||||
target_compile_definitions(frontend-common PUBLIC -DWITH_CHEEVOS=1)
|
||||
target_link_libraries(frontend-common PRIVATE rcheevos rapidjson)
|
||||
endif()
|
||||
|
||||
# Copy the provided data directory to the output directory.
|
||||
|
1114
src/frontend-common/cheevos.cpp
Normal file
1114
src/frontend-common/cheevos.cpp
Normal file
File diff suppressed because it is too large
Load Diff
76
src/frontend-common/cheevos.h
Normal file
76
src/frontend-common/cheevos.h
Normal file
@ -0,0 +1,76 @@
|
||||
#pragma once
|
||||
#include "core/types.h"
|
||||
#include <functional>
|
||||
#include <string>
|
||||
|
||||
class CDImage;
|
||||
class CommonHostInterface;
|
||||
class SettingsInterface;
|
||||
|
||||
namespace Cheevos {
|
||||
|
||||
struct Achievement
|
||||
{
|
||||
u32 id;
|
||||
std::string title;
|
||||
std::string description;
|
||||
std::string memaddr;
|
||||
std::string locked_badge_path;
|
||||
std::string unlocked_badge_path;
|
||||
u32 points;
|
||||
bool locked;
|
||||
bool active;
|
||||
};
|
||||
|
||||
extern bool g_active;
|
||||
extern u32 g_game_id;
|
||||
|
||||
ALWAYS_INLINE bool IsActive()
|
||||
{
|
||||
return g_active;
|
||||
}
|
||||
|
||||
ALWAYS_INLINE bool HasActiveGame()
|
||||
{
|
||||
return g_game_id != 0;
|
||||
}
|
||||
|
||||
ALWAYS_INLINE u32 GetGameID()
|
||||
{
|
||||
return g_game_id;
|
||||
}
|
||||
|
||||
bool Initialize(CommonHostInterface* hi, bool test_mode, bool use_first_disc_from_playlist, bool enable_rich_presence);
|
||||
void Reset();
|
||||
void Shutdown();
|
||||
void Update();
|
||||
|
||||
bool IsLoggedIn();
|
||||
bool IsTestModeActive();
|
||||
bool IsUsingFirstDiscFromPlaylist();
|
||||
bool IsRichPresenceEnabled();
|
||||
const std::string& GetUsername();
|
||||
const std::string& GetRichPresenceString();
|
||||
|
||||
bool LoginAsync(const char* username, const char* password);
|
||||
bool Login(const char* username, const char* password);
|
||||
void Logout();
|
||||
|
||||
bool HasActiveGame();
|
||||
void GameChanged(const std::string& path, CDImage* image);
|
||||
|
||||
const std::string& GetGameTitle();
|
||||
const std::string& GetGameDeveloper();
|
||||
const std::string& GetGamePublisher();
|
||||
const std::string& GetGameReleaseDate();
|
||||
const std::string& GetGameIcon();
|
||||
|
||||
bool EnumerateAchievements(std::function<bool(const Achievement&)> callback);
|
||||
u32 GetUnlockedAchiementCount();
|
||||
u32 GetAchievementCount();
|
||||
u32 GetMaximumPointsForGame();
|
||||
u32 GetCurrentPointsForGame();
|
||||
|
||||
void UnlockAchievement(u32 achievement_id, bool add_notification = true);
|
||||
|
||||
} // namespace Cheevos
|
@ -43,6 +43,10 @@
|
||||
#include "discord_rpc.h"
|
||||
#endif
|
||||
|
||||
#ifdef WITH_CHEEVOS
|
||||
#include "cheevos.h"
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#include "common/windows_headers.h"
|
||||
#include <KnownFolders.h>
|
||||
@ -89,6 +93,10 @@ bool CommonHostInterface::Initialize()
|
||||
|
||||
CreateImGuiContext();
|
||||
|
||||
#ifdef WITH_CHEEVOS
|
||||
UpdateCheevosActive();
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -102,6 +110,10 @@ void CommonHostInterface::Shutdown()
|
||||
ShutdownDiscordPresence();
|
||||
#endif
|
||||
|
||||
#ifdef WITH_CHEEVOS
|
||||
Cheevos::Shutdown();
|
||||
#endif
|
||||
|
||||
if (m_controller_interface)
|
||||
{
|
||||
m_controller_interface->Shutdown();
|
||||
@ -127,11 +139,17 @@ void CommonHostInterface::InitializeUserDirectory()
|
||||
|
||||
result &= FileSystem::CreateDirectory(GetUserDirectoryRelativePath("bios").c_str(), false);
|
||||
result &= FileSystem::CreateDirectory(GetUserDirectoryRelativePath("cache").c_str(), false);
|
||||
result &= FileSystem::CreateDirectory(
|
||||
GetUserDirectoryRelativePath("cache" FS_OSPATH_SEPARATOR_STR "achievement_badge").c_str(), false);
|
||||
result &= FileSystem::CreateDirectory(
|
||||
GetUserDirectoryRelativePath("cache" FS_OSPATH_SEPARATOR_STR "achievement_gameicon").c_str(), false);
|
||||
result &= FileSystem::CreateDirectory(GetUserDirectoryRelativePath("cheats").c_str(), false);
|
||||
result &= FileSystem::CreateDirectory(GetUserDirectoryRelativePath("covers").c_str(), false);
|
||||
result &= FileSystem::CreateDirectory(GetUserDirectoryRelativePath("dump").c_str(), false);
|
||||
result &= FileSystem::CreateDirectory(GetUserDirectoryRelativePath("dump/audio").c_str(), false);
|
||||
result &= FileSystem::CreateDirectory(GetUserDirectoryRelativePath("dump/textures").c_str(), false);
|
||||
result &=
|
||||
FileSystem::CreateDirectory(GetUserDirectoryRelativePath("dump" FS_OSPATH_SEPARATOR_STR "audio").c_str(), false);
|
||||
result &=
|
||||
FileSystem::CreateDirectory(GetUserDirectoryRelativePath("dump" FS_OSPATH_SEPARATOR_STR "textures").c_str(), false);
|
||||
result &= FileSystem::CreateDirectory(GetUserDirectoryRelativePath("inputprofiles").c_str(), false);
|
||||
result &= FileSystem::CreateDirectory(GetUserDirectoryRelativePath("memcards").c_str(), false);
|
||||
result &= FileSystem::CreateDirectory(GetUserDirectoryRelativePath("savestates").c_str(), false);
|
||||
@ -192,6 +210,15 @@ void CommonHostInterface::PowerOffSystem()
|
||||
RequestExit();
|
||||
}
|
||||
|
||||
void CommonHostInterface::ResetSystem()
|
||||
{
|
||||
HostInterface::ResetSystem();
|
||||
|
||||
#ifdef WITH_CHEEVOS
|
||||
Cheevos::Reset();
|
||||
#endif
|
||||
}
|
||||
|
||||
static void PrintCommandLineVersion(const char* frontend_name)
|
||||
{
|
||||
const bool was_console_enabled = Log::IsConsoleOutputEnabled();
|
||||
@ -434,11 +461,23 @@ bool CommonHostInterface::ParseCommandLineParameters(int argc, char* argv[],
|
||||
return true;
|
||||
}
|
||||
|
||||
void CommonHostInterface::OnAchievementsRefreshed()
|
||||
{
|
||||
#ifdef WITH_CHEEVOS
|
||||
// noop
|
||||
#endif
|
||||
}
|
||||
|
||||
void CommonHostInterface::PollAndUpdate()
|
||||
{
|
||||
#ifdef WITH_DISCORD_PRESENCE
|
||||
PollDiscordPresence();
|
||||
#endif
|
||||
|
||||
#ifdef WITH_CHEEVOS
|
||||
if (Cheevos::IsActive())
|
||||
Cheevos::Update();
|
||||
#endif
|
||||
}
|
||||
|
||||
bool CommonHostInterface::IsFullscreen() const
|
||||
@ -612,6 +651,20 @@ void CommonHostInterface::UpdateControllerInterface()
|
||||
}
|
||||
}
|
||||
|
||||
bool CommonHostInterface::LoadState(const char* filename)
|
||||
{
|
||||
const bool system_was_valid = System::IsValid();
|
||||
const bool result = HostInterface::LoadState(filename);
|
||||
if (system_was_valid || !result)
|
||||
{
|
||||
#ifdef WITH_CHEEVOS
|
||||
Cheevos::Reset();
|
||||
#endif
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
bool CommonHostInterface::LoadState(bool global, s32 slot)
|
||||
{
|
||||
if (!global && (System::IsShutdown() || System::GetRunningCode().empty()))
|
||||
@ -924,6 +977,11 @@ void CommonHostInterface::OnRunningGameChanged(const std::string& path, CDImage*
|
||||
#ifdef WITH_DISCORD_PRESENCE
|
||||
UpdateDiscordPresence();
|
||||
#endif
|
||||
|
||||
#ifdef WITH_CHEEVOS
|
||||
if (Cheevos::IsLoggedIn())
|
||||
Cheevos::GameChanged(path, image);
|
||||
#endif
|
||||
}
|
||||
|
||||
void CommonHostInterface::OnControllerTypeChanged(u32 slot)
|
||||
@ -2448,6 +2506,14 @@ void CommonHostInterface::SetDefaultSettings(SettingsInterface& si)
|
||||
#ifdef WITH_DISCORD_PRESENCE
|
||||
si.SetBoolValue("Main", "EnableDiscordPresence", false);
|
||||
#endif
|
||||
|
||||
#ifdef WITH_CHEEVOS
|
||||
si.SetBoolValue("Cheevos", "Enabled", false);
|
||||
si.SetBoolValue("Cheevos", "TestMode", false);
|
||||
si.SetBoolValue("Cheevos", "UseFirstDiscFromPlaylist", true);
|
||||
si.DeleteValue("Cheevos", "Username");
|
||||
si.DeleteValue("Cheevos", "Token");
|
||||
#endif
|
||||
}
|
||||
|
||||
void CommonHostInterface::LoadSettings()
|
||||
@ -2482,8 +2548,15 @@ void CommonHostInterface::LoadSettings(SettingsInterface& si)
|
||||
SetDiscordPresenceEnabled(si.GetBoolValue("Main", "EnableDiscordPresence", false));
|
||||
#endif
|
||||
|
||||
#ifdef WITH_CHEEVOS
|
||||
UpdateCheevosActive();
|
||||
const bool cheevos_active = Cheevos::IsActive();
|
||||
#else
|
||||
const bool cheevos_active = false;
|
||||
#endif
|
||||
|
||||
const bool fullscreen_ui_enabled =
|
||||
si.GetBoolValue("Main", "EnableFullscreenUI", false) || m_flags.force_fullscreen_ui;
|
||||
si.GetBoolValue("Main", "EnableFullscreenUI", false) || cheevos_active || m_flags.force_fullscreen_ui;
|
||||
if (fullscreen_ui_enabled != m_fullscreen_ui_enabled)
|
||||
{
|
||||
m_fullscreen_ui_enabled = fullscreen_ui_enabled;
|
||||
@ -3211,3 +3284,27 @@ void CommonHostInterface::PollDiscordPresence()
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef WITH_CHEEVOS
|
||||
|
||||
void CommonHostInterface::UpdateCheevosActive()
|
||||
{
|
||||
const bool cheevos_enabled = GetBoolSettingValue("Cheevos", "Enabled", false);
|
||||
const bool cheevos_test_mode = GetBoolSettingValue("Cheevos", "TestMode", false);
|
||||
const bool cheevos_use_first_disc_from_playlist = GetBoolSettingValue("Cheevos", "UseFirstDiscFromPlaylist", true);
|
||||
const bool cheevos_rich_presence = GetBoolSettingValue("Cheevos", "RichPresence", true);
|
||||
|
||||
if (cheevos_enabled != Cheevos::IsActive() || cheevos_test_mode != Cheevos::IsTestModeActive() ||
|
||||
cheevos_use_first_disc_from_playlist != Cheevos::IsUsingFirstDiscFromPlaylist() ||
|
||||
cheevos_rich_presence != Cheevos::IsRichPresenceEnabled())
|
||||
{
|
||||
Cheevos::Shutdown();
|
||||
if (cheevos_enabled)
|
||||
{
|
||||
if (!Cheevos::Initialize(this, cheevos_test_mode, cheevos_use_first_disc_from_playlist, cheevos_rich_presence))
|
||||
ReportError("Failed to initialize cheevos after settings change.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
@ -93,7 +93,6 @@ public:
|
||||
std::vector<u32> screenshot_data;
|
||||
};
|
||||
|
||||
using HostInterface::LoadState;
|
||||
using HostInterface::SaveState;
|
||||
|
||||
/// Returns the name of the frontend.
|
||||
@ -127,10 +126,15 @@ public:
|
||||
|
||||
virtual bool BootSystem(const SystemBootParameters& parameters) override;
|
||||
virtual void PowerOffSystem() override;
|
||||
virtual void ResetSystem() override;
|
||||
virtual void DestroySystem() override;
|
||||
|
||||
/// Returns the settings interface.
|
||||
ALWAYS_INLINE SettingsInterface* GetSettingsInterface() const { return m_settings_interface.get(); }
|
||||
ALWAYS_INLINE std::lock_guard<std::recursive_mutex> GetSettingsLock()
|
||||
{
|
||||
return std::lock_guard<std::recursive_mutex>(m_settings_mutex);
|
||||
}
|
||||
|
||||
/// Returns the game list.
|
||||
ALWAYS_INLINE GameList* GetGameList() const { return m_game_list.get(); }
|
||||
@ -165,6 +169,9 @@ public:
|
||||
/// Saves the current input configuration to the specified profile name.
|
||||
bool SaveInputProfile(const char* profile_path);
|
||||
|
||||
/// Loads state from the specified filename.
|
||||
bool LoadState(const char* filename);
|
||||
|
||||
/// Loads the current emulation state from file. Specifying a slot of -1 loads the "resume" game state.
|
||||
bool LoadState(bool global, s32 slot);
|
||||
|
||||
@ -273,6 +280,9 @@ public:
|
||||
/// Returns a pointer to the top-level window, needed by some controller interfaces.
|
||||
virtual void* GetTopLevelWindowHandle() const;
|
||||
|
||||
/// Called when achievements data is loaded.
|
||||
virtual void OnAchievementsRefreshed();
|
||||
|
||||
/// Opens a file in the DuckStation "package".
|
||||
/// This is the APK for Android builds, or the program directory for standalone builds.
|
||||
virtual std::unique_ptr<ByteStream> OpenPackageFile(const char* path, u32 flags) override;
|
||||
@ -408,8 +418,8 @@ protected:
|
||||
|
||||
std::unique_ptr<HostDisplayTexture> m_logo_texture;
|
||||
|
||||
std::deque<OSDMessage> m_osd_active_messages; // accessed only by GUI/OSD thread (no lock reqs)
|
||||
std::deque<OSDMessage> m_osd_posted_messages; // written to by multiple threads.
|
||||
std::deque<OSDMessage> m_osd_active_messages; // accessed only by GUI/OSD thread (no lock reqs)
|
||||
std::deque<OSDMessage> m_osd_posted_messages; // written to by multiple threads.
|
||||
std::mutex m_osd_messages_lock;
|
||||
|
||||
bool m_fullscreen_ui_enabled = false;
|
||||
@ -459,6 +469,10 @@ private:
|
||||
void PollDiscordPresence();
|
||||
#endif
|
||||
|
||||
#ifdef WITH_CHEEVOS
|
||||
void UpdateCheevosActive();
|
||||
#endif
|
||||
|
||||
HotkeyInfoList m_hotkeys;
|
||||
|
||||
std::unique_ptr<FrontendCommon::SaveStateSelectorUI> m_save_state_selector_ui;
|
||||
|
@ -66,6 +66,9 @@
|
||||
<ProjectReference Include="..\..\dep\libcue\libcue.vcxproj">
|
||||
<Project>{6a4208ed-e3dc-41e1-81cd-f61025fc285a}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\dep\rcheevos\rcheevos.vcxproj">
|
||||
<Project>{4ba0a6d4-3ae1-42b2-9347-096fd023ff64}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\dep\simpleini\simpleini.vcxproj">
|
||||
<Project>{3773f4cc-614e-4028-8595-22e08ca649e3}</Project>
|
||||
</ProjectReference>
|
||||
@ -93,7 +96,7 @@
|
||||
<ClCompile Include="game_list.cpp" />
|
||||
<ClCompile Include="game_settings.cpp" />
|
||||
<ClCompile Include="http_downloader.cpp" />
|
||||
<ClCompile Include="http_downloader_wininet.cpp" />
|
||||
<ClCompile Include="http_downloader_winhttp.cpp" />
|
||||
<ClCompile Include="icon.cpp" />
|
||||
<ClCompile Include="imgui_fullscreen.cpp" />
|
||||
<ClCompile Include="imgui_impl_dx11.cpp" />
|
||||
@ -105,6 +108,7 @@
|
||||
<ClCompile Include="postprocessing_chain.cpp" />
|
||||
<ClCompile Include="postprocessing_shader.cpp" />
|
||||
<ClCompile Include="postprocessing_shadergen.cpp" />
|
||||
<ClCompile Include="cheevos.cpp" />
|
||||
<ClCompile Include="save_state_selector_ui.cpp" />
|
||||
<ClCompile Include="sdl_audio_stream.cpp" />
|
||||
<ClCompile Include="sdl_controller_interface.cpp" />
|
||||
@ -123,7 +127,7 @@
|
||||
<ClInclude Include="game_list.h" />
|
||||
<ClInclude Include="game_settings.h" />
|
||||
<ClInclude Include="http_downloader.h" />
|
||||
<ClInclude Include="http_downloader_wininet.h" />
|
||||
<ClInclude Include="http_downloader_winhttp.h" />
|
||||
<ClInclude Include="icon.h" />
|
||||
<ClInclude Include="imgui_fullscreen.h" />
|
||||
<ClInclude Include="imgui_impl_dx11.h" />
|
||||
@ -135,6 +139,7 @@
|
||||
<ClInclude Include="postprocessing_chain.h" />
|
||||
<ClInclude Include="postprocessing_shader.h" />
|
||||
<ClInclude Include="postprocessing_shadergen.h" />
|
||||
<ClInclude Include="cheevos.h" />
|
||||
<ClInclude Include="save_state_selector_ui.h" />
|
||||
<ClInclude Include="sdl_audio_stream.h" />
|
||||
<ClInclude Include="sdl_controller_interface.h" />
|
||||
@ -347,10 +352,10 @@
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WITH_IMGUI=1;WITH_SDL2=1;WITH_DISCORD_PRESENCE=1;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WITH_IMGUI=1;WITH_SDL2=1;WITH_DISCORD_PRESENCE=1;WITH_CHEEVOS=1;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)dep\msvc\include\SDL;$(SolutionDir)dep\cubeb\include;$(SolutionDir)dep\imgui\include;$(SolutionDir)dep\simpleini\include;$(SolutionDir)dep\tinyxml2\include;$(SolutionDir)dep\discord-rpc\include;$(SolutionDir)dep\glad\include;$(SolutionDir)dep\vulkan-loader\include;$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)dep\msvc\include\SDL;$(SolutionDir)dep\cubeb\include;$(SolutionDir)dep\imgui\include;$(SolutionDir)dep\simpleini\include;$(SolutionDir)dep\tinyxml2\include;$(SolutionDir)dep\discord-rpc\include;$(SolutionDir)dep\glad\include;$(SolutionDir)dep\vulkan-loader\include;$(SolutionDir)dep\rcheevos\include;$(SolutionDir)dep\rapidjson\include;$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
@ -374,10 +379,10 @@
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WITH_IMGUI=1;WITH_SDL2=1;WITH_DISCORD_PRESENCE=1;_ITERATOR_DEBUG_LEVEL=1;WIN32;_DEBUGFAST;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WITH_IMGUI=1;WITH_SDL2=1;WITH_DISCORD_PRESENCE=1;WITH_CHEEVOS=1;_ITERATOR_DEBUG_LEVEL=1;WIN32;_DEBUGFAST;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)dep\msvc\include\SDL;$(SolutionDir)dep\cubeb\include;$(SolutionDir)dep\imgui\include;$(SolutionDir)dep\simpleini\include;$(SolutionDir)dep\tinyxml2\include;$(SolutionDir)dep\discord-rpc\include;$(SolutionDir)dep\glad\include;$(SolutionDir)dep\vulkan-loader\include;$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)dep\msvc\include\SDL;$(SolutionDir)dep\cubeb\include;$(SolutionDir)dep\imgui\include;$(SolutionDir)dep\simpleini\include;$(SolutionDir)dep\tinyxml2\include;$(SolutionDir)dep\discord-rpc\include;$(SolutionDir)dep\glad\include;$(SolutionDir)dep\vulkan-loader\include;$(SolutionDir)dep\rcheevos\include;$(SolutionDir)dep\rapidjson\include;$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
|
||||
<SupportJustMyCode>false</SupportJustMyCode>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
@ -404,10 +409,10 @@
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WITH_IMGUI=1;WITH_SDL2=1;WITH_DISCORD_PRESENCE=1;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WITH_IMGUI=1;WITH_SDL2=1;WITH_DISCORD_PRESENCE=1;WITH_CHEEVOS=1;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)dep\msvc\include\SDL;$(SolutionDir)dep\cubeb\include;$(SolutionDir)dep\imgui\include;$(SolutionDir)dep\simpleini\include;$(SolutionDir)dep\tinyxml2\include;$(SolutionDir)dep\discord-rpc\include;$(SolutionDir)dep\glad\include;$(SolutionDir)dep\vulkan-loader\include;$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)dep\msvc\include\SDL;$(SolutionDir)dep\cubeb\include;$(SolutionDir)dep\imgui\include;$(SolutionDir)dep\simpleini\include;$(SolutionDir)dep\tinyxml2\include;$(SolutionDir)dep\discord-rpc\include;$(SolutionDir)dep\glad\include;$(SolutionDir)dep\vulkan-loader\include;$(SolutionDir)dep\rcheevos\include;$(SolutionDir)dep\rapidjson\include;$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
@ -431,10 +436,10 @@
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WITH_IMGUI=1;WITH_SDL2=1;WITH_DISCORD_PRESENCE=1;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WITH_IMGUI=1;WITH_SDL2=1;WITH_DISCORD_PRESENCE=1;WITH_CHEEVOS=1;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)dep\msvc\include\SDL;$(SolutionDir)dep\cubeb\include;$(SolutionDir)dep\imgui\include;$(SolutionDir)dep\simpleini\include;$(SolutionDir)dep\tinyxml2\include;$(SolutionDir)dep\discord-rpc\include;$(SolutionDir)dep\glad\include;$(SolutionDir)dep\vulkan-loader\include;$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)dep\msvc\include\SDL;$(SolutionDir)dep\cubeb\include;$(SolutionDir)dep\imgui\include;$(SolutionDir)dep\simpleini\include;$(SolutionDir)dep\tinyxml2\include;$(SolutionDir)dep\discord-rpc\include;$(SolutionDir)dep\glad\include;$(SolutionDir)dep\vulkan-loader\include;$(SolutionDir)dep\rcheevos\include;$(SolutionDir)dep\rapidjson\include;$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
@ -458,10 +463,10 @@
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WITH_IMGUI=1;WITH_SDL2=1;WITH_DISCORD_PRESENCE=1;_ITERATOR_DEBUG_LEVEL=1;WIN32;_DEBUGFAST;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WITH_IMGUI=1;WITH_SDL2=1;WITH_DISCORD_PRESENCE=1;WITH_CHEEVOS=1;_ITERATOR_DEBUG_LEVEL=1;WIN32;_DEBUGFAST;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)dep\msvc\include\SDL;$(SolutionDir)dep\cubeb\include;$(SolutionDir)dep\imgui\include;$(SolutionDir)dep\simpleini\include;$(SolutionDir)dep\tinyxml2\include;$(SolutionDir)dep\discord-rpc\include;$(SolutionDir)dep\glad\include;$(SolutionDir)dep\vulkan-loader\include;$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)dep\msvc\include\SDL;$(SolutionDir)dep\cubeb\include;$(SolutionDir)dep\imgui\include;$(SolutionDir)dep\simpleini\include;$(SolutionDir)dep\tinyxml2\include;$(SolutionDir)dep\discord-rpc\include;$(SolutionDir)dep\glad\include;$(SolutionDir)dep\vulkan-loader\include;$(SolutionDir)dep\rcheevos\include;$(SolutionDir)dep\rapidjson\include;$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
|
||||
<SupportJustMyCode>false</SupportJustMyCode>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
@ -488,10 +493,10 @@
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WITH_IMGUI=1;WITH_SDL2=1;WITH_DISCORD_PRESENCE=1;_ITERATOR_DEBUG_LEVEL=1;WIN32;_DEBUGFAST;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WITH_IMGUI=1;WITH_SDL2=1;WITH_DISCORD_PRESENCE=1;WITH_CHEEVOS=1;_ITERATOR_DEBUG_LEVEL=1;WIN32;_DEBUGFAST;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)dep\msvc\include\SDL;$(SolutionDir)dep\cubeb\include;$(SolutionDir)dep\imgui\include;$(SolutionDir)dep\simpleini\include;$(SolutionDir)dep\tinyxml2\include;$(SolutionDir)dep\discord-rpc\include;$(SolutionDir)dep\glad\include;$(SolutionDir)dep\vulkan-loader\include;$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)dep\msvc\include\SDL;$(SolutionDir)dep\cubeb\include;$(SolutionDir)dep\imgui\include;$(SolutionDir)dep\simpleini\include;$(SolutionDir)dep\tinyxml2\include;$(SolutionDir)dep\discord-rpc\include;$(SolutionDir)dep\glad\include;$(SolutionDir)dep\vulkan-loader\include;$(SolutionDir)dep\rcheevos\include;$(SolutionDir)dep\rapidjson\include;$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
|
||||
<SupportJustMyCode>false</SupportJustMyCode>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
@ -520,9 +525,9 @@
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WITH_IMGUI=1;WITH_SDL2=1;WITH_DISCORD_PRESENCE=1;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WITH_IMGUI=1;WITH_SDL2=1;WITH_DISCORD_PRESENCE=1;WITH_CHEEVOS=1;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)dep\msvc\include\SDL;$(SolutionDir)dep\cubeb\include;$(SolutionDir)dep\imgui\include;$(SolutionDir)dep\simpleini\include;$(SolutionDir)dep\tinyxml2\include;$(SolutionDir)dep\discord-rpc\include;$(SolutionDir)dep\glad\include;$(SolutionDir)dep\vulkan-loader\include;$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)dep\msvc\include\SDL;$(SolutionDir)dep\cubeb\include;$(SolutionDir)dep\imgui\include;$(SolutionDir)dep\simpleini\include;$(SolutionDir)dep\tinyxml2\include;$(SolutionDir)dep\discord-rpc\include;$(SolutionDir)dep\glad\include;$(SolutionDir)dep\vulkan-loader\include;$(SolutionDir)dep\rcheevos\include;$(SolutionDir)dep\rapidjson\include;$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
@ -551,9 +556,9 @@
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WITH_IMGUI=1;WITH_SDL2=1;WITH_DISCORD_PRESENCE=1;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WITH_IMGUI=1;WITH_SDL2=1;WITH_DISCORD_PRESENCE=1;WITH_CHEEVOS=1;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)dep\msvc\include\SDL;$(SolutionDir)dep\cubeb\include;$(SolutionDir)dep\imgui\include;$(SolutionDir)dep\simpleini\include;$(SolutionDir)dep\tinyxml2\include;$(SolutionDir)dep\discord-rpc\include;$(SolutionDir)dep\glad\include;$(SolutionDir)dep\vulkan-loader\include;$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)dep\msvc\include\SDL;$(SolutionDir)dep\cubeb\include;$(SolutionDir)dep\imgui\include;$(SolutionDir)dep\simpleini\include;$(SolutionDir)dep\tinyxml2\include;$(SolutionDir)dep\discord-rpc\include;$(SolutionDir)dep\glad\include;$(SolutionDir)dep\vulkan-loader\include;$(SolutionDir)dep\rcheevos\include;$(SolutionDir)dep\rapidjson\include;$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<OmitFramePointers>true</OmitFramePointers>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
@ -582,9 +587,9 @@
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WITH_IMGUI=1;WITH_SDL2=1;WITH_DISCORD_PRESENCE=1;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WITH_IMGUI=1;WITH_SDL2=1;WITH_DISCORD_PRESENCE=1;WITH_CHEEVOS=1;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)dep\msvc\include\SDL;$(SolutionDir)dep\cubeb\include;$(SolutionDir)dep\imgui\include;$(SolutionDir)dep\simpleini\include;$(SolutionDir)dep\tinyxml2\include;$(SolutionDir)dep\discord-rpc\include;$(SolutionDir)dep\glad\include;$(SolutionDir)dep\vulkan-loader\include;$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)dep\msvc\include\SDL;$(SolutionDir)dep\cubeb\include;$(SolutionDir)dep\imgui\include;$(SolutionDir)dep\simpleini\include;$(SolutionDir)dep\tinyxml2\include;$(SolutionDir)dep\discord-rpc\include;$(SolutionDir)dep\glad\include;$(SolutionDir)dep\vulkan-loader\include;$(SolutionDir)dep\rcheevos\include;$(SolutionDir)dep\rapidjson\include;$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
@ -613,9 +618,9 @@
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WITH_IMGUI=1;WITH_SDL2=1;WITH_DISCORD_PRESENCE=1;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WITH_IMGUI=1;WITH_SDL2=1;WITH_DISCORD_PRESENCE=1;WITH_CHEEVOS=1;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)dep\msvc\include\SDL;$(SolutionDir)dep\cubeb\include;$(SolutionDir)dep\imgui\include;$(SolutionDir)dep\simpleini\include;$(SolutionDir)dep\tinyxml2\include;$(SolutionDir)dep\discord-rpc\include;$(SolutionDir)dep\glad\include;$(SolutionDir)dep\vulkan-loader\include;$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)dep\msvc\include\SDL;$(SolutionDir)dep\cubeb\include;$(SolutionDir)dep\imgui\include;$(SolutionDir)dep\simpleini\include;$(SolutionDir)dep\tinyxml2\include;$(SolutionDir)dep\discord-rpc\include;$(SolutionDir)dep\glad\include;$(SolutionDir)dep\vulkan-loader\include;$(SolutionDir)dep\rcheevos\include;$(SolutionDir)dep\rapidjson\include;$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
@ -644,9 +649,9 @@
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WITH_IMGUI=1;WITH_SDL2=1;WITH_DISCORD_PRESENCE=1;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WITH_IMGUI=1;WITH_SDL2=1;WITH_DISCORD_PRESENCE=1;WITH_CHEEVOS=1;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)dep\msvc\include\SDL;$(SolutionDir)dep\cubeb\include;$(SolutionDir)dep\imgui\include;$(SolutionDir)dep\simpleini\include;$(SolutionDir)dep\tinyxml2\include;$(SolutionDir)dep\discord-rpc\include;$(SolutionDir)dep\glad\include;$(SolutionDir)dep\vulkan-loader\include;$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)dep\msvc\include\SDL;$(SolutionDir)dep\cubeb\include;$(SolutionDir)dep\imgui\include;$(SolutionDir)dep\simpleini\include;$(SolutionDir)dep\tinyxml2\include;$(SolutionDir)dep\discord-rpc\include;$(SolutionDir)dep\glad\include;$(SolutionDir)dep\vulkan-loader\include;$(SolutionDir)dep\rcheevos\include;$(SolutionDir)dep\rapidjson\include;$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<OmitFramePointers>true</OmitFramePointers>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
@ -675,9 +680,9 @@
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WITH_IMGUI=1;WITH_SDL2=1;WITH_DISCORD_PRESENCE=1;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WITH_IMGUI=1;WITH_SDL2=1;WITH_DISCORD_PRESENCE=1;WITH_CHEEVOS=1;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)dep\msvc\include\SDL;$(SolutionDir)dep\cubeb\include;$(SolutionDir)dep\imgui\include;$(SolutionDir)dep\simpleini\include;$(SolutionDir)dep\tinyxml2\include;$(SolutionDir)dep\discord-rpc\include;$(SolutionDir)dep\glad\include;$(SolutionDir)dep\vulkan-loader\include;$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)dep\msvc\include\SDL;$(SolutionDir)dep\cubeb\include;$(SolutionDir)dep\imgui\include;$(SolutionDir)dep\simpleini\include;$(SolutionDir)dep\tinyxml2\include;$(SolutionDir)dep\discord-rpc\include;$(SolutionDir)dep\glad\include;$(SolutionDir)dep\vulkan-loader\include;$(SolutionDir)dep\rcheevos\include;$(SolutionDir)dep\rapidjson\include;$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<OmitFramePointers>true</OmitFramePointers>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
|
@ -27,8 +27,9 @@
|
||||
<ClCompile Include="imgui_fullscreen.cpp" />
|
||||
<ClCompile Include="fullscreen_ui.cpp" />
|
||||
<ClCompile Include="fullscreen_ui_progress_callback.cpp" />
|
||||
<ClCompile Include="http_downloader_wininet.cpp" />
|
||||
<ClCompile Include="cheevos.cpp" />
|
||||
<ClCompile Include="http_downloader.cpp" />
|
||||
<ClCompile Include="http_downloader_winhttp.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="icon.h" />
|
||||
@ -57,8 +58,9 @@
|
||||
<ClInclude Include="imgui_fullscreen.h" />
|
||||
<ClInclude Include="fullscreen_ui.h" />
|
||||
<ClInclude Include="fullscreen_ui_progress_callback.h" />
|
||||
<ClInclude Include="http_downloader_wininet.h" />
|
||||
<ClInclude Include="cheevos.h" />
|
||||
<ClInclude Include="http_downloader.h" />
|
||||
<ClInclude Include="http_downloader_winhttp.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="font_roboto_regular.inl" />
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
#include "fullscreen_ui.h"
|
||||
#include "IconsFontAwesome5.h"
|
||||
#include "cheevos.h"
|
||||
#include "common/byte_stream.h"
|
||||
#include "common/file_system.h"
|
||||
#include "common/log.h"
|
||||
@ -81,6 +82,7 @@ static void ClearImGuiFocus();
|
||||
static void ReturnToMainWindow();
|
||||
static void DrawLandingWindow();
|
||||
static void DrawQuickMenu(MainWindowType type);
|
||||
static void DrawAchievementWindow();
|
||||
static void DrawDebugMenu();
|
||||
static void DrawStatsOverlay();
|
||||
static void DrawOSDMessages();
|
||||
@ -304,9 +306,11 @@ void Render()
|
||||
DrawSettingsWindow();
|
||||
break;
|
||||
case MainWindowType::QuickMenu:
|
||||
case MainWindowType::MoreQuickMenu:
|
||||
DrawQuickMenu(s_current_main_window);
|
||||
break;
|
||||
case MainWindowType::Achievements:
|
||||
DrawAchievementWindow();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -1073,7 +1077,7 @@ void DrawSettingsWindow()
|
||||
ICON_FA_GAMEPAD " Controller Settings", ICON_FA_KEYBOARD " Hotkey Settings",
|
||||
ICON_FA_SD_CARD " Memory Card Settings", ICON_FA_TV " Display Settings",
|
||||
ICON_FA_MAGIC " Enhancement Settings", ICON_FA_HEADPHONES " Audio Settings",
|
||||
ICON_FA_EXCLAMATION_TRIANGLE " Advanced Settings"}};
|
||||
ICON_FA_TROPHY " Achievements Settings", ICON_FA_EXCLAMATION_TRIANGLE " Advanced Settings"}};
|
||||
|
||||
BeginMenuButtons();
|
||||
for (u32 i = 0; i < static_cast<u32>(titles.size()); i++)
|
||||
@ -1932,6 +1936,108 @@ void DrawSettingsWindow()
|
||||
}
|
||||
break;
|
||||
|
||||
case SettingsPage::AchievementsSetings:
|
||||
{
|
||||
#ifdef WITH_CHEEVOS
|
||||
BeginMenuButtons();
|
||||
|
||||
MenuHeading("Settings");
|
||||
settings_changed |= ToggleButtonForNonSetting(
|
||||
"Enable RetroAchievements", "When enabled and logged in, DuckStation will scan for achievements on startup.",
|
||||
"Cheevos", "Enabled", false);
|
||||
settings_changed |= ToggleButtonForNonSetting(
|
||||
"Rich Presence",
|
||||
"When enabled, rich presence information will be collected and sent to the server where supported.",
|
||||
"Cheevos", "RichPresence", true);
|
||||
settings_changed |=
|
||||
ToggleButtonForNonSetting("Test Mode",
|
||||
"When enabled, DuckStation will assume all achievements are locked and not "
|
||||
"send any unlock notifications to the server.",
|
||||
"Cheevos", "TestMode", false);
|
||||
settings_changed |= ToggleButtonForNonSetting("Use First Disc From Playlist",
|
||||
"When enabled, the first disc in a playlist will be used for "
|
||||
"achievements, regardless of which disc is active.",
|
||||
"Cheevos", "UseFirstDiscFromPlaylist", true);
|
||||
|
||||
MenuHeading("Account");
|
||||
if (Cheevos::IsLoggedIn())
|
||||
{
|
||||
ImGui::PushStyleColor(ImGuiCol_TextDisabled, ImGui::GetStyle().Colors[ImGuiCol_Text]);
|
||||
ActiveButton(SmallString::FromFormat(ICON_FA_USER " Username: %s", Cheevos::GetUsername().c_str()), false,
|
||||
false, ImGuiFullscreen::LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY);
|
||||
|
||||
Timestamp ts;
|
||||
TinyString ts_string;
|
||||
ts.SetUnixTimestamp(StringUtil::FromChars<u64>(s_host_interface->GetSettingsInterface()->GetStringValue(
|
||||
"Cheevos", "LoginTimestamp", "0"))
|
||||
.value_or(0));
|
||||
ts.ToString(ts_string, "%Y-%m-%d %H:%M:%S");
|
||||
ActiveButton(SmallString::FromFormat(ICON_FA_CLOCK " Login token generated on %s", ts_string.GetCharArray()),
|
||||
false, false, ImGuiFullscreen::LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY);
|
||||
ImGui::PopStyleColor();
|
||||
|
||||
if (MenuButton(ICON_FA_KEY " Logout", "Logs out of RetroAchievements."))
|
||||
Cheevos::Logout();
|
||||
}
|
||||
else
|
||||
{
|
||||
ActiveButton(SmallString::FromFormat(ICON_FA_USER " Not Logged In", Cheevos::GetUsername().c_str()), false,
|
||||
false, ImGuiFullscreen::LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY);
|
||||
|
||||
if (MenuButton(ICON_FA_KEY " Login", "Logs in to RetroAchievements."))
|
||||
Cheevos::LoginAsync("", "");
|
||||
}
|
||||
|
||||
MenuHeading("Current Game");
|
||||
if (Cheevos::HasActiveGame())
|
||||
{
|
||||
ImGui::PushStyleColor(ImGuiCol_TextDisabled, ImGui::GetStyle().Colors[ImGuiCol_Text]);
|
||||
ActiveButton(TinyString::FromFormat(ICON_FA_BOOKMARK " Game ID: %u", Cheevos::GetGameID()), false, false,
|
||||
ImGuiFullscreen::LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY);
|
||||
ActiveButton(TinyString::FromFormat(ICON_FA_BOOK " Game Title: %s", Cheevos::GetGameTitle().c_str()), false,
|
||||
false, ImGuiFullscreen::LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY);
|
||||
ActiveButton(
|
||||
TinyString::FromFormat(ICON_FA_DESKTOP " Game Developer: %s", Cheevos::GetGameDeveloper().c_str()), false,
|
||||
false, ImGuiFullscreen::LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY);
|
||||
ActiveButton(
|
||||
TinyString::FromFormat(ICON_FA_DESKTOP " Game Publisher: %s", Cheevos::GetGamePublisher().c_str()), false,
|
||||
false, ImGuiFullscreen::LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY);
|
||||
ActiveButton(TinyString::FromFormat(ICON_FA_TROPHY " Achievements: %u (%u points)",
|
||||
Cheevos::GetAchievementCount(), Cheevos::GetMaximumPointsForGame()),
|
||||
false, false, ImGuiFullscreen::LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY);
|
||||
|
||||
const std::string& rich_presence_string = Cheevos::GetRichPresenceString();
|
||||
if (!rich_presence_string.empty())
|
||||
{
|
||||
ActiveButton(SmallString::FromFormat(ICON_FA_MAP " %s", rich_presence_string.c_str()), false, false,
|
||||
ImGuiFullscreen::LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY);
|
||||
}
|
||||
else
|
||||
{
|
||||
ActiveButton(ICON_FA_MAP " Rich presence inactive or unsupported.", false, false,
|
||||
ImGuiFullscreen::LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY);
|
||||
}
|
||||
|
||||
ImGui::PopStyleColor();
|
||||
}
|
||||
else
|
||||
{
|
||||
ActiveButton(ICON_FA_BAN " Game not loaded or no RetroAchievements available.", false, false,
|
||||
ImGuiFullscreen::LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY);
|
||||
}
|
||||
|
||||
EndMenuButtons();
|
||||
#else
|
||||
BeginMenuButtons();
|
||||
ActiveButton(ICON_FA_BAN " This build was not compiled with RetroAchivements support.", false, false,
|
||||
ImGuiFullscreen::LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY);
|
||||
EndMenuButtons();
|
||||
#endif
|
||||
// ImGuiFullscreen::moda
|
||||
// if (ImGui::BeginPopup("))
|
||||
}
|
||||
break;
|
||||
|
||||
case SettingsPage::AdvancedSettings:
|
||||
{
|
||||
BeginMenuButtons();
|
||||
@ -2073,7 +2179,7 @@ void DrawQuickMenu(MainWindowType type)
|
||||
if (BeginFullscreenWindow(window_pos, window_size, "pause_menu", ImVec4(0.0f, 0.0f, 0.0f, 0.0f), 0.0f, 10.0f,
|
||||
ImGuiWindowFlags_NoBackground))
|
||||
{
|
||||
BeginMenuButtons(11, 1.0f, ImGuiFullscreen::LAYOUT_MENU_BUTTON_X_PADDING,
|
||||
BeginMenuButtons(12, 1.0f, ImGuiFullscreen::LAYOUT_MENU_BUTTON_X_PADDING,
|
||||
ImGuiFullscreen::LAYOUT_MENU_BUTTON_Y_PADDING,
|
||||
ImGuiFullscreen::LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY);
|
||||
|
||||
@ -2087,6 +2193,17 @@ void DrawQuickMenu(MainWindowType type)
|
||||
CloseQuickMenu();
|
||||
}
|
||||
|
||||
#ifdef WITH_CHEEVOS
|
||||
const bool achievements_enabled = Cheevos::HasActiveGame() && (Cheevos::GetAchievementCount() > 0);
|
||||
if (ActiveButton(ICON_FA_TROPHY " Achievements", false, achievements_enabled))
|
||||
{
|
||||
CloseQuickMenu();
|
||||
s_current_main_window = MainWindowType::Achievements;
|
||||
}
|
||||
#else
|
||||
ActiveButton(ICON_FA_TROPHY " Achievements", false, false);
|
||||
#endif
|
||||
|
||||
if (ActiveButton(ICON_FA_CAMERA " Save Screenshot", false))
|
||||
{
|
||||
CloseQuickMenu();
|
||||
@ -3578,6 +3695,242 @@ void DrawDebugDebugMenu()
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef WITH_CHEEVOS
|
||||
|
||||
static void DrawAchievement(const Cheevos::Achievement& cheevo)
|
||||
{
|
||||
static constexpr float alpha = 0.8f;
|
||||
|
||||
TinyString id_str;
|
||||
id_str.Format("%u", cheevo.id);
|
||||
|
||||
ImRect bb;
|
||||
bool visible, hovered;
|
||||
bool pressed =
|
||||
MenuButtonFrame(id_str, true, LAYOUT_MENU_BUTTON_HEIGHT, &visible, &hovered, &bb.Min, &bb.Max, 0, alpha);
|
||||
if (!visible)
|
||||
return;
|
||||
|
||||
const ImVec2 image_size(LayoutScale(LAYOUT_MENU_BUTTON_HEIGHT, LAYOUT_MENU_BUTTON_HEIGHT));
|
||||
const std::string& badge_path = cheevo.locked ? cheevo.locked_badge_path : cheevo.unlocked_badge_path;
|
||||
if (!badge_path.empty())
|
||||
{
|
||||
HostDisplayTexture* badge = GetCachedTexture(badge_path);
|
||||
if (badge)
|
||||
{
|
||||
ImGui::GetWindowDrawList()->AddImage(badge->GetHandle(), bb.Min, bb.Min + image_size, ImVec2(0.0f, 0.0f),
|
||||
ImVec2(1.0f, 1.0f), IM_COL32(255, 255, 255, 255));
|
||||
}
|
||||
}
|
||||
|
||||
const float midpoint = bb.Min.y + g_large_font->FontSize + LayoutScale(4.0f);
|
||||
const float text_start_x = bb.Min.x + image_size.x + LayoutScale(15.0f);
|
||||
const ImRect title_bb(ImVec2(text_start_x, bb.Min.y), ImVec2(bb.Max.x, midpoint));
|
||||
const ImRect summary_bb(ImVec2(text_start_x, midpoint), bb.Max);
|
||||
SmallString text;
|
||||
|
||||
ImGui::PushFont(g_large_font);
|
||||
ImGui::RenderTextClipped(title_bb.Min, title_bb.Max, cheevo.title.c_str(), cheevo.title.c_str() + cheevo.title.size(),
|
||||
nullptr, ImVec2(0.0f, 0.0f), &title_bb);
|
||||
ImGui::PopFont();
|
||||
|
||||
if (!cheevo.description.empty())
|
||||
{
|
||||
ImGui::PushFont(g_medium_font);
|
||||
ImGui::RenderTextClipped(summary_bb.Min, summary_bb.Max, cheevo.description.c_str(),
|
||||
cheevo.description.c_str() + cheevo.description.size(), nullptr, ImVec2(0.0f, 0.0f),
|
||||
&summary_bb);
|
||||
ImGui::PopFont();
|
||||
}
|
||||
|
||||
#if 0
|
||||
// The API doesn't seem to send us this :(
|
||||
if (!cheevo.locked)
|
||||
{
|
||||
ImGui::PushFont(g_medium_font);
|
||||
|
||||
const ImRect time_bb(ImVec2(text_start_x, bb.Min.y),
|
||||
ImVec2(bb.Max.x, bb.Min.y + g_medium_font->FontSize + LayoutScale(4.0f)));
|
||||
text.Format("Unlocked 21 Feb, 2019 @ 3:14am");
|
||||
ImGui::RenderTextClipped(time_bb.Min, time_bb.Max, text.GetCharArray(), text.GetCharArray() + text.GetLength(),
|
||||
nullptr, ImVec2(1.0f, 0.0f), &time_bb);
|
||||
ImGui::PopFont();
|
||||
}
|
||||
#endif
|
||||
|
||||
if (pressed)
|
||||
{
|
||||
// TODO: What should we do here?
|
||||
// Display information or something..
|
||||
}
|
||||
}
|
||||
|
||||
void DrawAchievementWindow()
|
||||
{
|
||||
static constexpr float alpha = 0.8f;
|
||||
static constexpr float heading_height_unscaled = 110.0f;
|
||||
|
||||
ImGui::SetNextWindowBgAlpha(alpha);
|
||||
|
||||
const ImVec4 background(0.13f, 0.13f, 0.13f, alpha);
|
||||
const ImVec2 display_size(ImGui::GetIO().DisplaySize);
|
||||
const float window_width = LayoutScale(LAYOUT_SCREEN_WIDTH);
|
||||
const float heading_height = LayoutScale(heading_height_unscaled);
|
||||
|
||||
if (BeginFullscreenWindow(
|
||||
ImVec2(0.0f, 0.0f), ImVec2(display_size.x, heading_height), "achievements_heading", background, 0.0f, 0.0f,
|
||||
ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoScrollWithMouse))
|
||||
{
|
||||
ImRect bb;
|
||||
bool visible, hovered;
|
||||
bool pressed = MenuButtonFrame("achievements_heading", false, heading_height_unscaled, &visible, &hovered, &bb.Min,
|
||||
&bb.Max, 0, alpha);
|
||||
if (visible)
|
||||
{
|
||||
const float padding = LayoutScale(10.0f);
|
||||
const float spacing = LayoutScale(10.0f);
|
||||
const float image_height = LayoutScale(85.0f);
|
||||
|
||||
const ImVec2 icon_min(bb.Min + ImVec2(padding, padding));
|
||||
const ImVec2 icon_max(icon_min + ImVec2(image_height, image_height));
|
||||
|
||||
const std::string& icon_path = Cheevos::GetGameIcon();
|
||||
if (!icon_path.empty())
|
||||
{
|
||||
HostDisplayTexture* badge = GetCachedTexture(icon_path);
|
||||
if (badge)
|
||||
{
|
||||
ImGui::GetWindowDrawList()->AddImage(badge->GetHandle(), icon_min, icon_max, ImVec2(0.0f, 0.0f),
|
||||
ImVec2(1.0f, 1.0f), IM_COL32(255, 255, 255, 255));
|
||||
}
|
||||
}
|
||||
|
||||
float left = bb.Min.x + padding + image_height + spacing;
|
||||
float right = bb.Max.x - padding;
|
||||
float top = bb.Min.y + padding;
|
||||
ImDrawList* dl = ImGui::GetWindowDrawList();
|
||||
SmallString text;
|
||||
ImVec2 text_size;
|
||||
|
||||
const u32 unlocked_count = Cheevos::GetUnlockedAchiementCount();
|
||||
const u32 achievement_count = Cheevos::GetAchievementCount();
|
||||
const u32 current_points = Cheevos::GetCurrentPointsForGame();
|
||||
const u32 total_points = Cheevos::GetMaximumPointsForGame();
|
||||
|
||||
text.Format(ICON_FA_TIMES);
|
||||
text_size = g_large_font->CalcTextSizeA(g_large_font->FontSize, right, -1.0f, text.GetCharArray(),
|
||||
text.GetCharArray() + text.GetLength());
|
||||
const ImRect close_button_bb(ImVec2(right - padding - text_size.x, top), ImVec2(right, top + text_size.y));
|
||||
|
||||
bool close_held, close_hovered;
|
||||
bool close_clicked = ImGui::ButtonBehavior(close_button_bb, ImGui::GetCurrentWindow()->GetID("close_button"),
|
||||
&close_hovered, &close_held);
|
||||
if (close_clicked)
|
||||
{
|
||||
ReturnToMainWindow();
|
||||
}
|
||||
else if (close_hovered || close_held)
|
||||
{
|
||||
const ImU32 col = ImGui::GetColorU32(close_held ? ImGuiCol_ButtonActive : ImGuiCol_ButtonHovered, alpha);
|
||||
ImGui::RenderFrame(close_button_bb.Min, close_button_bb.Max, col, true, 0.0f);
|
||||
}
|
||||
|
||||
ImGui::PushFont(g_large_font);
|
||||
ImGui::RenderTextClipped(close_button_bb.Min, close_button_bb.Max, text.GetCharArray(),
|
||||
text.GetCharArray() + text.GetLength(), nullptr, ImVec2(0.0f, 0.0f), &close_button_bb);
|
||||
ImGui::PopFont();
|
||||
|
||||
const ImRect title_bb(ImVec2(left, top), ImVec2(right, top + g_large_font->FontSize));
|
||||
text.Assign(Cheevos::GetGameTitle());
|
||||
|
||||
const std::string& developer = Cheevos::GetGameDeveloper();
|
||||
if (!developer.empty())
|
||||
text.AppendFormattedString(" (%s)", developer.c_str());
|
||||
|
||||
top += g_large_font->FontSize + spacing;
|
||||
|
||||
ImGui::PushFont(g_large_font);
|
||||
ImGui::RenderTextClipped(title_bb.Min, title_bb.Max, text.GetCharArray(), text.GetCharArray() + text.GetLength(),
|
||||
nullptr, ImVec2(0.0f, 0.0f), &title_bb);
|
||||
ImGui::PopFont();
|
||||
|
||||
const ImRect summary_bb(ImVec2(left, top), ImVec2(right, top + g_medium_font->FontSize));
|
||||
if (unlocked_count == achievement_count)
|
||||
{
|
||||
text.Format("You have unlocked all achievements and earned %u points!", total_points);
|
||||
}
|
||||
else
|
||||
{
|
||||
text.Format("You have unlocked %u of %u achievements, earning %u of %u possible points.", unlocked_count,
|
||||
achievement_count, current_points, total_points);
|
||||
}
|
||||
|
||||
top += g_medium_font->FontSize + spacing;
|
||||
|
||||
ImGui::PushFont(g_medium_font);
|
||||
ImGui::RenderTextClipped(summary_bb.Min, summary_bb.Max, text.GetCharArray(),
|
||||
text.GetCharArray() + text.GetLength(), nullptr, ImVec2(0.0f, 0.0f), &summary_bb);
|
||||
ImGui::PopFont();
|
||||
|
||||
const float progress_height = LayoutScale(20.0f);
|
||||
const ImRect progress_bb(ImVec2(left, top), ImVec2(right, top + progress_height));
|
||||
const float fraction = static_cast<float>(unlocked_count) / static_cast<float>(achievement_count);
|
||||
dl->AddRectFilled(progress_bb.Min, progress_bb.Max, ImGui::GetColorU32(ImGuiFullscreen::UIPrimaryDarkColor()));
|
||||
dl->AddRectFilled(progress_bb.Min,
|
||||
ImVec2(progress_bb.Min.x + fraction * progress_bb.GetWidth(), progress_bb.Max.y),
|
||||
ImGui::GetColorU32(ImGuiFullscreen::UISecondaryColor()));
|
||||
|
||||
text.Format("%d%%", static_cast<int>(std::round(fraction * 100.0f)));
|
||||
text_size = ImGui::CalcTextSize(text);
|
||||
const ImVec2 text_pos(progress_bb.Min.x + ((progress_bb.Max.x - progress_bb.Min.x) / 2.0f) - (text_size.x / 2.0f),
|
||||
progress_bb.Min.y + ((progress_bb.Max.y - progress_bb.Min.y) / 2.0f) -
|
||||
(text_size.y / 2.0f));
|
||||
dl->AddText(g_medium_font, g_medium_font->FontSize, text_pos,
|
||||
ImGui::GetColorU32(ImGuiFullscreen::UIPrimaryTextColor()), text.GetCharArray(),
|
||||
text.GetCharArray() + text.GetLength());
|
||||
top += progress_height + spacing;
|
||||
}
|
||||
}
|
||||
EndFullscreenWindow();
|
||||
|
||||
ImGui::SetNextWindowBgAlpha(alpha);
|
||||
|
||||
if (BeginFullscreenWindow(ImVec2(0.0f, heading_height), ImVec2(display_size.x, display_size.x - heading_height),
|
||||
"achievements", background, 0.0f, 0.0f, 0))
|
||||
{
|
||||
|
||||
BeginMenuButtons();
|
||||
|
||||
MenuHeading("Unlocked Achievements");
|
||||
Cheevos::EnumerateAchievements([](const Cheevos::Achievement& cheevo) -> bool {
|
||||
if (!cheevo.locked)
|
||||
DrawAchievement(cheevo);
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
if (Cheevos::GetUnlockedAchiementCount() != Cheevos::GetAchievementCount())
|
||||
{
|
||||
MenuHeading("Locked Achievements");
|
||||
Cheevos::EnumerateAchievements([](const Cheevos::Achievement& cheevo) -> bool {
|
||||
if (cheevo.locked)
|
||||
DrawAchievement(cheevo);
|
||||
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
EndMenuButtons();
|
||||
}
|
||||
EndFullscreenWindow();
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void DrawAchievementWindow() {}
|
||||
|
||||
#endif
|
||||
|
||||
bool SetControllerNavInput(FrontendCommon::ControllerNavigationButton button, bool value)
|
||||
{
|
||||
s_nav_input_values[static_cast<u32>(button)] = value;
|
||||
|
@ -18,7 +18,7 @@ enum class MainWindowType
|
||||
GameList,
|
||||
Settings,
|
||||
QuickMenu,
|
||||
MoreQuickMenu
|
||||
Achievements,
|
||||
};
|
||||
|
||||
enum class SettingsPage
|
||||
@ -34,6 +34,7 @@ enum class SettingsPage
|
||||
DisplaySettings,
|
||||
EnhancementSettings,
|
||||
AudioSettings,
|
||||
AchievementsSetings,
|
||||
AdvancedSettings,
|
||||
Count
|
||||
};
|
||||
|
Reference in New Issue
Block a user