mirror of
https://github.com/stenzek/duckstation.git
synced 2024-11-23 05:49:43 +00:00
Misc: Build fixes for Android
This commit is contained in:
parent
538266aacd
commit
f05ff4103e
@ -1,28 +0,0 @@
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "x64-Debug",
|
||||
"generator": "Ninja",
|
||||
"configurationType": "Debug",
|
||||
"inheritEnvironments": [ "msvc_x64_x64" ],
|
||||
"buildRoot": "${projectDir}\\build\\${name}",
|
||||
"installRoot": "${projectDir}\\out\\install\\${name}",
|
||||
"cmakeCommandArgs": "",
|
||||
"buildCommandArgs": "-v",
|
||||
"ctestCommandArgs": "",
|
||||
"variables": []
|
||||
},
|
||||
{
|
||||
"name": "x64-Release",
|
||||
"generator": "Ninja",
|
||||
"configurationType": "RelWithDebInfo",
|
||||
"buildRoot": "${projectDir}\\build\\${name}",
|
||||
"installRoot": "${projectDir}\\out\\install\\${name}",
|
||||
"cmakeCommandArgs": "",
|
||||
"buildCommandArgs": "-v",
|
||||
"ctestCommandArgs": "",
|
||||
"inheritEnvironments": [ "msvc_x64_x64" ],
|
||||
"variables": []
|
||||
}
|
||||
]
|
||||
}
|
@ -14,7 +14,7 @@
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE__) || defined(IOAPI_NO_64)
|
||||
#if defined(__APPLE__) || defined(__ANDROID__) || defined(IOAPI_NO_64)
|
||||
// In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions
|
||||
#define FOPEN_FUNC(filename, mode) fopen(filename, mode)
|
||||
#define FTELLO_FUNC(stream) ftello(stream)
|
||||
|
@ -640,13 +640,6 @@ int FileSystem::OpenFDFile(const char* filename, int flags, int mode, Error* err
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
FileSystem::ManagedCFilePtr FileSystem::OpenManagedCFile(const char* filename, const char* mode, Error* error)
|
||||
{
|
||||
return ManagedCFilePtr(OpenCFile(filename, mode, error));
|
||||
}
|
||||
|
||||
std::FILE* FileSystem::OpenSharedCFile(const char* filename, const char* mode, FileShareMode share_mode, Error* error)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
@ -687,6 +680,13 @@ std::FILE* FileSystem::OpenSharedCFile(const char* filename, const char* mode, F
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
FileSystem::ManagedCFilePtr FileSystem::OpenManagedCFile(const char* filename, const char* mode, Error* error)
|
||||
{
|
||||
return ManagedCFilePtr(OpenCFile(filename, mode, error));
|
||||
}
|
||||
|
||||
FileSystem::ManagedCFilePtr FileSystem::OpenManagedSharedCFile(const char* filename, const char* mode,
|
||||
FileShareMode share_mode, Error* error)
|
||||
{
|
||||
|
@ -293,7 +293,10 @@ void Log::DebugOutputLogCallback(void* pUserParam, const char* channelName, cons
|
||||
FormatLogMessageAndPrintW(channelName, functionName, level, message, false, false, true,
|
||||
[](const std::wstring_view& message) { OutputDebugStringW(message.data()); });
|
||||
#elif defined(__ANDROID__)
|
||||
static const int logPriority[LOGLEVEL_COUNT] = {
|
||||
if (message.empty())
|
||||
return;
|
||||
|
||||
static constexpr int logPriority[LOGLEVEL_COUNT] = {
|
||||
ANDROID_LOG_INFO, // NONE
|
||||
ANDROID_LOG_ERROR, // ERROR
|
||||
ANDROID_LOG_WARN, // WARNING
|
||||
@ -306,7 +309,7 @@ void Log::DebugOutputLogCallback(void* pUserParam, const char* channelName, cons
|
||||
ANDROID_LOG_DEBUG, // TRACE
|
||||
};
|
||||
|
||||
__android_log_write(logPriority[level], channelName, message);
|
||||
__android_log_print(logPriority[level], channelName, "%.*s", static_cast<int>(message.length()), message.data());
|
||||
#else
|
||||
#endif
|
||||
}
|
||||
|
@ -272,7 +272,7 @@ bool SharedMemoryMappingArea::Unmap(void* map_base, size_t map_size)
|
||||
return true;
|
||||
}
|
||||
|
||||
#else
|
||||
#elif !defined(__ANDROID__)
|
||||
|
||||
bool MemMap::MemProtect(void* baseaddr, size_t size, PageProtect mode)
|
||||
{
|
||||
|
@ -1,6 +1,7 @@
|
||||
add_library(core
|
||||
achievements.cpp
|
||||
achievements.h
|
||||
achievements_private.h
|
||||
analog_controller.cpp
|
||||
analog_controller.h
|
||||
analog_joystick.cpp
|
||||
|
@ -7,6 +7,7 @@
|
||||
#define IMGUI_DEFINE_MATH_OPERATORS
|
||||
|
||||
#include "achievements.h"
|
||||
#include "achievements_private.h"
|
||||
#include "bios.h"
|
||||
#include "bus.h"
|
||||
#include "cpu_core.h"
|
||||
@ -164,22 +165,18 @@ static void DisplayHardcoreDeferredMessage();
|
||||
static void DisplayAchievementSummary();
|
||||
static void UpdateRichPresence(std::unique_lock<std::recursive_mutex>& lock);
|
||||
|
||||
static std::string GetAchievementBadgePath(const rc_client_achievement_t* achievement, int state);
|
||||
static std::string GetUserBadgePath(const std::string_view& username);
|
||||
static std::string GetLeaderboardUserBadgePath(const rc_client_leaderboard_entry_t* entry);
|
||||
|
||||
static void DrawAchievement(const rc_client_achievement_t* cheevo);
|
||||
static void DrawLeaderboardListEntry(const rc_client_leaderboard_t* lboard);
|
||||
static void DrawLeaderboardEntry(const rc_client_leaderboard_entry_t& entry, bool is_self, float rank_column_width,
|
||||
float name_column_width, float time_column_width, float column_spacing);
|
||||
static void OpenLeaderboard(const rc_client_leaderboard_t* lboard);
|
||||
static void LeaderboardFetchNearbyCallback(int result, const char* error_message,
|
||||
rc_client_leaderboard_entry_list_t* list, rc_client_t* client,
|
||||
void* callback_userdata);
|
||||
static void LeaderboardFetchAllCallback(int result, const char* error_message, rc_client_leaderboard_entry_list_t* list,
|
||||
rc_client_t* client, void* callback_userdata);
|
||||
static void FetchNextLeaderboardEntries();
|
||||
static void CloseLeaderboard();
|
||||
|
||||
#ifndef __ANDROID__
|
||||
static void DrawAchievement(const rc_client_achievement_t* cheevo);
|
||||
static void DrawLeaderboardListEntry(const rc_client_leaderboard_t* lboard);
|
||||
static void DrawLeaderboardEntry(const rc_client_leaderboard_entry_t& entry, bool is_self, float rank_column_width,
|
||||
float name_column_width, float time_column_width, float column_spacing);
|
||||
#endif
|
||||
|
||||
static bool s_hardcore_mode = false;
|
||||
|
||||
@ -228,6 +225,16 @@ std::unique_lock<std::recursive_mutex> Achievements::GetLock()
|
||||
return std::unique_lock(s_achievements_mutex);
|
||||
}
|
||||
|
||||
rc_client_t* Achievements::GetClient()
|
||||
{
|
||||
return s_client;
|
||||
}
|
||||
|
||||
const rc_client_user_game_summary_t& Achievements::GetGameSummary()
|
||||
{
|
||||
return s_game_summary;
|
||||
}
|
||||
|
||||
std::string Achievements::GetUserAgent()
|
||||
{
|
||||
return fmt::format("DuckStation for {} ({}) {}", TARGET_OS_STR, CPU_ARCH_STR, g_scm_tag_str);
|
||||
@ -369,6 +376,11 @@ const std::string& Achievements::GetGameTitle()
|
||||
return s_game_title;
|
||||
}
|
||||
|
||||
const std::string& Achievements::GetGameIconPath()
|
||||
{
|
||||
return s_game_icon;
|
||||
}
|
||||
|
||||
const std::string& Achievements::GetRichPresenceString()
|
||||
{
|
||||
return s_rich_presence_string;
|
||||
@ -642,6 +654,15 @@ void Achievements::IdleUpdate()
|
||||
rc_client_idle(s_client);
|
||||
}
|
||||
|
||||
bool Achievements::NeedsIdleUpdate()
|
||||
{
|
||||
if (!IsActive())
|
||||
return false;
|
||||
|
||||
const auto lock = GetLock();
|
||||
return (s_http_downloader && s_http_downloader->HasAnyRequests());
|
||||
}
|
||||
|
||||
void Achievements::FrameUpdate()
|
||||
{
|
||||
if (!IsActive())
|
||||
@ -980,9 +1001,10 @@ void Achievements::DisplayAchievementSummary()
|
||||
std::string summary;
|
||||
if (s_game_summary.num_core_achievements > 0)
|
||||
{
|
||||
summary = fmt::format(TRANSLATE_FS("Achievements", "You have unlocked {} of {} achievements, and earned {} of {} points."),
|
||||
s_game_summary.num_unlocked_achievements, s_game_summary.num_core_achievements,
|
||||
s_game_summary.points_unlocked, s_game_summary.points_core);
|
||||
summary = fmt::format(
|
||||
TRANSLATE_FS("Achievements", "You have unlocked {} of {} achievements, and earned {} of {} points."),
|
||||
s_game_summary.num_unlocked_achievements, s_game_summary.num_core_achievements, s_game_summary.points_unlocked,
|
||||
s_game_summary.points_core);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1507,7 +1529,8 @@ bool Achievements::DoState(StateWrapper& sw)
|
||||
}
|
||||
}
|
||||
|
||||
std::string Achievements::GetAchievementBadgePath(const rc_client_achievement_t* achievement, int state)
|
||||
std::string Achievements::GetAchievementBadgePath(const rc_client_achievement_t* achievement, int state,
|
||||
bool download_if_missing)
|
||||
{
|
||||
static constexpr std::array<const char*, NUM_RC_CLIENT_ACHIEVEMENT_STATES> s_achievement_state_strings = {
|
||||
{"inactive", "active", "unlocked", "disabled"}};
|
||||
@ -1520,7 +1543,7 @@ std::string Achievements::GetAchievementBadgePath(const rc_client_achievement_t*
|
||||
path = Path::Combine(s_image_directory, TinyString::from_fmt("achievement_{}_{}_{}.png", s_game_id, achievement->id,
|
||||
s_achievement_state_strings[state]));
|
||||
|
||||
if (!FileSystem::FileExists(path.c_str()))
|
||||
if (download_if_missing && !FileSystem::FileExists(path.c_str()))
|
||||
{
|
||||
char buf[512];
|
||||
const int res = rc_client_achievement_get_image_url(achievement, state, buf, std::size(buf));
|
||||
@ -1767,12 +1790,15 @@ bool Achievements::ConfirmHardcoreModeDisable(const char* trigger)
|
||||
|
||||
void Achievements::ClearUIState()
|
||||
{
|
||||
#ifndef __ANDROID__
|
||||
if (FullscreenUI::IsAchievementsWindowOpen() || FullscreenUI::IsLeaderboardsWindowOpen())
|
||||
FullscreenUI::ReturnToPreviousWindow();
|
||||
|
||||
CloseLeaderboard();
|
||||
#endif
|
||||
|
||||
s_achievement_badge_paths = {};
|
||||
|
||||
CloseLeaderboard();
|
||||
s_leaderboard_user_icon_paths = {};
|
||||
s_leaderboard_entry_lists = {};
|
||||
if (s_leaderboard_list)
|
||||
@ -1921,6 +1947,8 @@ void Achievements::DrawGameOverlays()
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef __ANDROID__
|
||||
|
||||
void Achievements::DrawPauseMenuOverlays()
|
||||
{
|
||||
using ImGuiFullscreen::g_large_font;
|
||||
@ -2767,6 +2795,8 @@ void Achievements::DrawLeaderboardListEntry(const rc_client_leaderboard_t* lboar
|
||||
OpenLeaderboard(lboard);
|
||||
}
|
||||
|
||||
#endif // __ANDROID__
|
||||
|
||||
void Achievements::OpenLeaderboard(const rc_client_leaderboard_t* lboard)
|
||||
{
|
||||
Log_DevPrintf("Opening leaderboard '%s' (%u)", lboard->title, lboard->id);
|
||||
@ -2779,6 +2809,36 @@ void Achievements::OpenLeaderboard(const rc_client_leaderboard_t* lboard)
|
||||
s_client, lboard->id, LEADERBOARD_NEARBY_ENTRIES_TO_FETCH, LeaderboardFetchNearbyCallback, nullptr);
|
||||
}
|
||||
|
||||
bool Achievements::OpenLeaderboardById(u32 leaderboard_id)
|
||||
{
|
||||
const rc_client_leaderboard_t* lb = rc_client_get_leaderboard_info(s_client, leaderboard_id);
|
||||
if (!lb)
|
||||
return false;
|
||||
|
||||
OpenLeaderboard(lb);
|
||||
return true;
|
||||
}
|
||||
|
||||
u32 Achievements::GetOpenLeaderboardId()
|
||||
{
|
||||
return s_open_leaderboard ? s_open_leaderboard->id : 0;
|
||||
}
|
||||
|
||||
bool Achievements::IsShowingAllLeaderboardEntries()
|
||||
{
|
||||
return s_is_showing_all_leaderboard_entries;
|
||||
}
|
||||
|
||||
const std::vector<rc_client_leaderboard_entry_list_t*>& Achievements::GetLeaderboardEntryLists()
|
||||
{
|
||||
return s_leaderboard_entry_lists;
|
||||
}
|
||||
|
||||
const rc_client_leaderboard_entry_list_t* Achievements::GetLeaderboardNearbyEntries()
|
||||
{
|
||||
return s_leaderboard_nearby_entries;
|
||||
}
|
||||
|
||||
void Achievements::LeaderboardFetchNearbyCallback(int result, const char* error_message,
|
||||
rc_client_leaderboard_entry_list_t* list, rc_client_t* client,
|
||||
void* callback_userdata)
|
||||
|
@ -11,6 +11,8 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
struct rc_client_t;
|
||||
|
||||
class Error;
|
||||
class StateWrapper;
|
||||
class CDImage;
|
||||
@ -28,6 +30,9 @@ enum class LoginRequestReason
|
||||
/// Acquires the achievements lock. Must be held when accessing any achievement state from another thread.
|
||||
std::unique_lock<std::recursive_mutex> GetLock();
|
||||
|
||||
/// Returns the rc_client instance. Should have the lock held.
|
||||
rc_client_t* GetClient();
|
||||
|
||||
/// Initializes the RetroAchievments client.
|
||||
bool Initialize();
|
||||
|
||||
@ -52,6 +57,9 @@ void FrameUpdate();
|
||||
/// Called when the system is paused, because FrameUpdate() won't be getting called.
|
||||
void IdleUpdate();
|
||||
|
||||
/// Returns true if idle updates are necessary (e.g. outstanding requests).
|
||||
bool NeedsIdleUpdate();
|
||||
|
||||
/// Saves/loads state.
|
||||
bool DoState(StateWrapper& sw);
|
||||
|
||||
@ -118,6 +126,8 @@ void DrawGameOverlays();
|
||||
/// Draws ImGui overlays when paused.
|
||||
void DrawPauseMenuOverlays();
|
||||
|
||||
#ifndef __ANDROID__
|
||||
|
||||
/// Queries the achievement list, and if no achievements are available, returns false.
|
||||
bool PrepareAchievementsWindow();
|
||||
|
||||
@ -130,6 +140,8 @@ bool PrepareLeaderboardsWindow();
|
||||
/// Renders the leaderboard list.
|
||||
void DrawLeaderboardsWindow();
|
||||
|
||||
#endif // __ANDROID__
|
||||
|
||||
#ifdef ENABLE_RAINTEGRATION
|
||||
/// Prevents the internal implementation from being used. Instead, RAIntegration will be
|
||||
/// called into when achievement-related events occur.
|
||||
|
34
src/core/achievements_private.h
Normal file
34
src/core/achievements_private.h
Normal file
@ -0,0 +1,34 @@
|
||||
// SPDX-FileCopyrightText: 2019-2023 Connor McLaughlin <stenzek@gmail.com>
|
||||
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "achievements.h"
|
||||
|
||||
#include "rc_client.h"
|
||||
|
||||
namespace Achievements {
|
||||
|
||||
/// Returns the rc_client instance. Should have the lock held.
|
||||
rc_client_t* GetClient();
|
||||
|
||||
const rc_client_user_game_summary_t& GetGameSummary();
|
||||
const std::string& GetGameIconPath();
|
||||
|
||||
std::string GetAchievementBadgePath(const rc_client_achievement_t* achievement, int state,
|
||||
bool download_if_missing = true);
|
||||
std::string GetUserBadgePath(const std::string_view& username);
|
||||
std::string GetLeaderboardUserBadgePath(const rc_client_leaderboard_entry_t* entry);
|
||||
|
||||
void OpenLeaderboard(const rc_client_leaderboard_t* lboard);
|
||||
bool OpenLeaderboardById(u32 leaderboard_id);
|
||||
u32 GetOpenLeaderboardId();
|
||||
bool IsShowingAllLeaderboardEntries();
|
||||
void FetchNextLeaderboardEntries();
|
||||
|
||||
const std::vector<rc_client_leaderboard_entry_list_t*>& GetLeaderboardEntryLists();
|
||||
const rc_client_leaderboard_entry_list_t* GetLeaderboardNearbyEntries();
|
||||
|
||||
void CloseLeaderboard();
|
||||
|
||||
} // namespace Achievements
|
@ -90,6 +90,7 @@
|
||||
<ClCompile Include="timing_event.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="achievements_private.h" />
|
||||
<ClInclude Include="analog_controller.h" />
|
||||
<ClInclude Include="analog_joystick.h" />
|
||||
<ClInclude Include="bios.h" />
|
||||
@ -229,4 +230,4 @@
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="..\..\dep\msvc\vsprops\Targets.props" />
|
||||
</Project>
|
||||
</Project>
|
@ -135,5 +135,6 @@
|
||||
<ClInclude Include="cpu_newrec_compiler_aarch64.h" />
|
||||
<ClInclude Include="cpu_newrec_compiler_riscv64.h" />
|
||||
<ClInclude Include="cpu_newrec_compiler_aarch32.h" />
|
||||
<ClInclude Include="achievements_private.h" />
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -6687,110 +6687,6 @@ void FullscreenUI::ProgressCallback::SetCancelled()
|
||||
m_cancelled = true;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
// "Lightweight" version with only notifications for Android.
|
||||
namespace FullscreenUI {
|
||||
static bool s_initialized = false;
|
||||
static bool s_tried_to_initialize = false;
|
||||
} // namespace FullscreenUI
|
||||
|
||||
bool FullscreenUI::Initialize()
|
||||
{
|
||||
if (s_initialized)
|
||||
return true;
|
||||
|
||||
if (s_tried_to_initialize)
|
||||
return false;
|
||||
|
||||
ImGuiFullscreen::SetTheme(false);
|
||||
ImGuiFullscreen::UpdateLayoutScale();
|
||||
|
||||
if (!ImGuiManager::AddFullscreenFontsIfMissing() || !ImGuiFullscreen::Initialize("images/placeholder.png"))
|
||||
{
|
||||
ImGuiFullscreen::Shutdown();
|
||||
s_tried_to_initialize = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
s_initialized = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FullscreenUI::IsInitialized()
|
||||
{
|
||||
return s_initialized;
|
||||
}
|
||||
|
||||
bool FullscreenUI::HasActiveWindow()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void FullscreenUI::CheckForConfigChanges(const Settings& old_settings)
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
void FullscreenUI::OnSystemStarted()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
void FullscreenUI::OnSystemPaused()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
void FullscreenUI::OnSystemResumed()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
void FullscreenUI::OnSystemDestroyed()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
void FullscreenUI::OnRunningGameChanged()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
void FullscreenUI::OpenPauseMenu()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
bool FullscreenUI::OpenAchievementsWindow()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool FullscreenUI::OpenLeaderboardsWindow()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void FullscreenUI::Shutdown()
|
||||
{
|
||||
ImGuiFullscreen::Shutdown();
|
||||
s_initialized = false;
|
||||
s_tried_to_initialize = false;
|
||||
}
|
||||
|
||||
void FullscreenUI::Render()
|
||||
{
|
||||
if (!s_initialized)
|
||||
return;
|
||||
|
||||
ImGuiFullscreen::UploadAsyncTextures();
|
||||
|
||||
ImGuiFullscreen::BeginLayout();
|
||||
ImGuiFullscreen::EndLayout();
|
||||
ImGuiFullscreen::ResetCloseMenuIfNeeded();
|
||||
}
|
||||
|
||||
#endif // __ANDROID__
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -21,6 +21,8 @@ void OnSystemPaused();
|
||||
void OnSystemResumed();
|
||||
void OnSystemDestroyed();
|
||||
void OnRunningGameChanged();
|
||||
|
||||
#ifndef __ANDROID__
|
||||
void OpenPauseMenu();
|
||||
void OpenAchievementsWindow();
|
||||
bool IsAchievementsWindowOpen();
|
||||
@ -28,6 +30,7 @@ void OpenLeaderboardsWindow();
|
||||
bool IsLeaderboardsWindowOpen();
|
||||
void ReturnToMainWindow();
|
||||
void ReturnToPreviousWindow();
|
||||
#endif
|
||||
|
||||
void Shutdown();
|
||||
void Render();
|
||||
|
@ -628,9 +628,13 @@ void GameList::Refresh(bool invalidate_cache, bool only_cache, ProgressCallback*
|
||||
|
||||
const std::vector<std::string> excluded_paths(Host::GetBaseStringListSetting("GameList", "ExcludedPaths"));
|
||||
const std::vector<std::string> dirs(Host::GetBaseStringListSetting("GameList", "Paths"));
|
||||
const std::vector<std::string> recursive_dirs(Host::GetBaseStringListSetting("GameList", "RecursivePaths"));
|
||||
std::vector<std::string> recursive_dirs(Host::GetBaseStringListSetting("GameList", "RecursivePaths"));
|
||||
const PlayedTimeMap played_time(LoadPlayedTimeMap(GetPlayedTimeFile()));
|
||||
|
||||
#ifdef __ANDROID__
|
||||
recursive_dirs.push_back(Path::Combine(EmuFolders::DataRoot, "games"));
|
||||
#endif
|
||||
|
||||
if (!dirs.empty() || !recursive_dirs.empty())
|
||||
{
|
||||
progress->SetProgressRange(static_cast<u32>(dirs.size() + recursive_dirs.size()));
|
||||
|
@ -125,12 +125,12 @@ ALWAYS_INLINE_RELEASE void MaskValidate(PGXP_value* pV, u32 psxV, u32 mask, u32
|
||||
|
||||
ALWAYS_INLINE_RELEASE double f16Sign(double in)
|
||||
{
|
||||
u32 s = (u32)(in * (double)((u32)1 << 16));
|
||||
return ((double)*((s32*)&s)) / (double)((s32)1 << 16);
|
||||
const s32 s = static_cast<s32>(static_cast<u64>(in * (USHRT_MAX + 1)));
|
||||
return static_cast<double>(s) / static_cast<double>(USHRT_MAX + 1);
|
||||
}
|
||||
ALWAYS_INLINE_RELEASE double f16Unsign(double in)
|
||||
{
|
||||
return (in >= 0) ? in : ((double)in + (double)USHRT_MAX + 1);
|
||||
return (in >= 0) ? in : (in + (USHRT_MAX + 1));
|
||||
}
|
||||
ALWAYS_INLINE_RELEASE double f16Overflow(double in)
|
||||
{
|
||||
@ -599,13 +599,11 @@ void CPU_MOVE(u32 rd_and_rs, u32 rsVal)
|
||||
void CPU_ADDI(u32 instr, u32 rsVal)
|
||||
{
|
||||
// Rt = Rs + Imm (signed)
|
||||
psx_value tempImm;
|
||||
PGXP_value ret;
|
||||
|
||||
Validate(&CPU_reg[rs(instr)], rsVal);
|
||||
ret = CPU_reg[rs(instr)];
|
||||
tempImm.d = imm(instr);
|
||||
tempImm.sd = (tempImm.sd << 16) >> 16; // sign extend
|
||||
PGXP_value ret = CPU_reg[rs(instr)];
|
||||
|
||||
psx_value tempImm;
|
||||
tempImm.d = SignExtend32(static_cast<u16>(imm(instr)));
|
||||
|
||||
if (tempImm.d != 0)
|
||||
{
|
||||
@ -929,6 +927,11 @@ static void CPU_BITWISE(u32 instr, u32 rdVal, u32 rsVal, u32 rtVal)
|
||||
ret.z = CPU_reg[rt(instr)].z;
|
||||
ret.compFlags[2] = CPU_reg[rt(instr)].compFlags[2];
|
||||
}
|
||||
else
|
||||
{
|
||||
ret.z = 0.0f;
|
||||
ret.compFlags[2] = 0;
|
||||
}
|
||||
|
||||
ret.value = rdVal;
|
||||
CPU_reg[rd(instr)] = ret;
|
||||
|
@ -405,7 +405,6 @@ struct Settings
|
||||
static const char* GetMultitapModeName(MultitapMode mode);
|
||||
static const char* GetMultitapModeDisplayName(MultitapMode mode);
|
||||
|
||||
// Default to D3D11 on Windows as it's more performant and at this point, less buggy.
|
||||
static constexpr GPURenderer DEFAULT_GPU_RENDERER = GPURenderer::Automatic;
|
||||
static constexpr GPUTextureFilter DEFAULT_GPU_TEXTURE_FILTER = GPUTextureFilter::Nearest;
|
||||
static constexpr GPUDownsampleMode DEFAULT_GPU_DOWNSAMPLE_MODE = GPUDownsampleMode::Disabled;
|
||||
@ -449,12 +448,7 @@ struct Settings
|
||||
|
||||
static constexpr u8 DEFAULT_CDROM_READAHEAD_SECTORS = 8;
|
||||
|
||||
#ifndef __ANDROID__
|
||||
// Android still defaults to digital controller for now.
|
||||
static constexpr ControllerType DEFAULT_CONTROLLER_1_TYPE = ControllerType::AnalogController;
|
||||
#else
|
||||
static constexpr ControllerType DEFAULT_CONTROLLER_1_TYPE = ControllerType::DigitalController;
|
||||
#endif
|
||||
static constexpr ControllerType DEFAULT_CONTROLLER_2_TYPE = ControllerType::None;
|
||||
static constexpr MemoryCardType DEFAULT_MEMORY_CARD_1_TYPE = MemoryCardType::PerGameTitle;
|
||||
static constexpr MemoryCardType DEFAULT_MEMORY_CARD_2_TYPE = MemoryCardType::None;
|
||||
|
@ -256,8 +256,10 @@ void System::Internal::ProcessStartup()
|
||||
if (g_settings.achievements_enabled)
|
||||
Achievements::Initialize();
|
||||
|
||||
#ifdef ENABLE_DISCORD_PRESENCE
|
||||
if (g_settings.enable_discord_presence)
|
||||
InitializeDiscordPresence();
|
||||
#endif
|
||||
}
|
||||
|
||||
void System::Internal::ProcessShutdown()
|
||||
@ -3700,6 +3702,7 @@ void System::CheckForSettingsChanges(const Settings& old_settings)
|
||||
|
||||
FullscreenUI::CheckForConfigChanges(old_settings);
|
||||
|
||||
#ifdef ENABLE_DISCORD_PRESENCE
|
||||
if (g_settings.enable_discord_presence != old_settings.enable_discord_presence)
|
||||
{
|
||||
if (g_settings.enable_discord_presence)
|
||||
@ -3707,6 +3710,7 @@ void System::CheckForSettingsChanges(const Settings& old_settings)
|
||||
else
|
||||
ShutdownDiscordPresence();
|
||||
}
|
||||
#endif
|
||||
|
||||
if (g_settings.log_level != old_settings.log_level || g_settings.log_filter != old_settings.log_filter ||
|
||||
g_settings.log_timestamps != old_settings.log_timestamps ||
|
||||
|
@ -95,7 +95,6 @@ static void AsyncOpThreadEntryPoint(std::function<void(ProgressCallback*)> callb
|
||||
static std::unique_ptr<INISettingsInterface> s_base_settings_interface;
|
||||
static bool s_batch_mode = false;
|
||||
static bool s_is_fullscreen = false;
|
||||
static bool s_save_state_on_shutdown = false;
|
||||
static bool s_was_paused_by_focus_loss = false;
|
||||
|
||||
static Threading::Thread s_cpu_thread;
|
||||
@ -323,6 +322,10 @@ void Host::ReportDebuggerMessage(const std::string_view& message)
|
||||
Log_ErrorPrintf("ReportDebuggerMessage: %.*s", static_cast<int>(message.size()), message.data());
|
||||
}
|
||||
|
||||
void Host::AddFixedInputBindings(SettingsInterface& si)
|
||||
{
|
||||
}
|
||||
|
||||
void Host::OnInputDeviceConnected(const std::string_view& identifier, const std::string_view& device_name)
|
||||
{
|
||||
Host::AddKeyedOSDMessage(fmt::format("InputDeviceConnected-{}", identifier),
|
||||
@ -700,7 +703,6 @@ void Host::ReleaseRenderWindow()
|
||||
|
||||
void Host::OnSystemStarting()
|
||||
{
|
||||
s_save_state_on_shutdown = false;
|
||||
s_was_paused_by_focus_loss = false;
|
||||
}
|
||||
|
||||
|
@ -1424,6 +1424,10 @@ void Host::ReportDebuggerMessage(const std::string_view& message)
|
||||
emit g_emu_thread->debuggerMessageReported(QString::fromUtf8(message));
|
||||
}
|
||||
|
||||
void Host::AddFixedInputBindings(SettingsInterface& si)
|
||||
{
|
||||
}
|
||||
|
||||
void Host::OnInputDeviceConnected(const std::string_view& identifier, const std::string_view& device_name)
|
||||
{
|
||||
emit g_emu_thread->onInputDeviceConnected(
|
||||
|
@ -355,6 +355,11 @@ std::optional<std::string> InputManager::ConvertHostKeyboardCodeToString(u32 cod
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
void Host::AddFixedInputBindings(SettingsInterface& si)
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
void Host::OnInputDeviceConnected(const std::string_view& identifier, const std::string_view& device_name)
|
||||
{
|
||||
// noop
|
||||
|
@ -1,5 +1,5 @@
|
||||
# _scmversion.cpp is a dummy file that will never be created, so the command will always be run
|
||||
if(WIN32)
|
||||
if(CMAKE_HOST_SYSTEM MATCHES "Windows")
|
||||
add_custom_command(OUTPUT scmversion.cpp _scmversion.cpp
|
||||
COMMAND cmd /k "${CMAKE_CURRENT_SOURCE_DIR}/gen_scmversion.bat"
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
|
@ -140,10 +140,7 @@ if(ENABLE_OPENGL)
|
||||
)
|
||||
endif()
|
||||
if(ANDROID)
|
||||
target_sources(util PRIVATE
|
||||
gl/context_egl_android.cpp
|
||||
gl/context_egl_android.h
|
||||
)
|
||||
target_include_directories(util PRIVATE "${CMAKE_SOURCE_DIR}/android/app/src/cpp")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
@ -18,6 +18,8 @@
|
||||
#include "context_wgl.h"
|
||||
#elif defined(__APPLE__)
|
||||
#include "context_agl.h"
|
||||
#elif defined(__ANDROID__)
|
||||
#include "context_egl_android.h"
|
||||
#else
|
||||
#ifdef ENABLE_EGL
|
||||
#ifdef ENABLE_WAYLAND
|
||||
@ -120,6 +122,8 @@ std::unique_ptr<GL::Context> Context::Create(const WindowInfo& wi, const Version
|
||||
context = ContextWGL::Create(wi, versions_to_try, num_versions_to_try);
|
||||
#elif defined(__APPLE__)
|
||||
context = ContextAGL::Create(wi, versions_to_try, num_versions_to_try);
|
||||
#elif defined(__ANDROID__)
|
||||
context = ContextEGLAndroid::Create(wi, versions_to_try, num_versions_to_try);
|
||||
#else
|
||||
#if defined(ENABLE_X11)
|
||||
if (wi.type == WindowInfo::Type::X11)
|
||||
|
@ -1604,6 +1604,8 @@ void InputManager::ReloadBindings(SettingsInterface& si, SettingsInterface& bind
|
||||
s_pad_vibration_array.clear();
|
||||
s_pointer_move_callbacks.clear();
|
||||
|
||||
Host::AddFixedInputBindings(binding_si);
|
||||
|
||||
// Hotkeys use the base configuration, except if the custom hotkeys option is enabled.
|
||||
const bool use_profile_hotkeys = si.GetBoolValue("ControllerPorts", "UseProfileHotkeyBindings", false);
|
||||
AddHotkeyBindings(use_profile_hotkeys ? binding_si : si);
|
||||
|
@ -351,6 +351,9 @@ void OnInputDeviceDisconnected(const std::string_view& identifier);
|
||||
} // namespace InputManager
|
||||
|
||||
namespace Host {
|
||||
/// Adds any fixed bindings from the host.
|
||||
void AddFixedInputBindings(SettingsInterface& si);
|
||||
|
||||
/// Called when a new input device is connected.
|
||||
void OnInputDeviceConnected(const std::string_view& identifier, const std::string_view& device_name);
|
||||
|
||||
|
@ -220,6 +220,10 @@ bool VulkanDevice::SelectInstanceExtensions(ExtensionList* extension_list, const
|
||||
if (wi.type == WindowInfo::Type::MacOS && !SupportsExtension(VK_EXT_METAL_SURFACE_EXTENSION_NAME, true))
|
||||
return false;
|
||||
#endif
|
||||
#if defined(VK_USE_PLATFORM_ANDROID_KHR)
|
||||
if (wi.type == WindowInfo::Type::Android && !SupportsExtension(VK_KHR_ANDROID_SURFACE_EXTENSION_NAME, true))
|
||||
return false;
|
||||
#endif
|
||||
|
||||
// VK_EXT_debug_utils
|
||||
if (enable_debug_utils && !SupportsExtension(VK_EXT_DEBUG_UTILS_EXTENSION_NAME, false))
|
||||
|
@ -56,6 +56,10 @@ VULKAN_INSTANCE_ENTRY_POINT(vkCreateWaylandSurfaceKHR, false)
|
||||
VULKAN_INSTANCE_ENTRY_POINT(vkCreateMetalSurfaceEXT, false)
|
||||
#endif
|
||||
|
||||
#if defined(VK_USE_PLATFORM_ANDROID_KHR)
|
||||
VULKAN_INSTANCE_ENTRY_POINT(vkCreateAndroidSurfaceKHR, false)
|
||||
#endif
|
||||
|
||||
// VK_EXT_debug_utils
|
||||
VULKAN_INSTANCE_ENTRY_POINT(vkCmdBeginDebugUtilsLabelEXT, false)
|
||||
VULKAN_INSTANCE_ENTRY_POINT(vkCmdEndDebugUtilsLabelEXT, false)
|
||||
|
Loading…
Reference in New Issue
Block a user