BIOS: Make GetInfoForHash() public

And it should take a const span.
This commit is contained in:
Stenzek 2024-10-01 21:13:36 +10:00
parent 08fe20ad76
commit 45c8f6ea56
No known key found for this signature in database
11 changed files with 20 additions and 19 deletions

View File

@ -184,7 +184,7 @@ void CrashHandler::WriteDumpForCaller()
WriteMinidumpAndCallstack(nullptr);
}
#elif !defined(__APPLE__)
#elif !defined(__APPLE__) && !defined(__ANDROID__)
#include <backtrace.h>
#include <cstdarg>

View File

@ -27,7 +27,7 @@
#include <mach/mach_vm.h>
#include <mach/vm_map.h>
#include <sys/mman.h>
#elif !defined(__ANDROID__)
#else
#include <cerrno>
#include <dlfcn.h>
#include <fcntl.h>
@ -598,7 +598,7 @@ void MemMap::EndCodeWrite()
#endif
#elif !defined(__ANDROID__)
#else
bool MemMap::MemProtect(void* baseaddr, size_t size, PageProtect mode)
{
@ -625,6 +625,8 @@ std::string MemMap::GetFileMappingName(const char* prefix)
#endif
}
#ifndef __ANDROID__
void* MemMap::CreateSharedMemory(const char* name, size_t size, Error* error)
{
const bool is_anonymous = (!name || *name == 0);
@ -683,6 +685,8 @@ void MemMap::DeleteSharedMemory(const char* name)
shm_unlink(name);
}
#endif
void* MemMap::MapSharedMemory(void* handle, size_t offset, void* baseaddr, size_t size, PageProtect mode)
{
const int flags = (baseaddr != nullptr) ? (MAP_SHARED | MAP_FIXED) : MAP_SHARED;

View File

@ -18,7 +18,6 @@
LOG_CHANNEL(BIOS);
namespace BIOS {
static const ImageInfo* GetInfoForHash(const std::span<u8> image, const ImageInfo::Hash& hash);
static constexpr ImageInfo::Hash MakeHashFromString(const char str[])
{
@ -206,7 +205,7 @@ std::optional<BIOS::Image> BIOS::LoadImageFromFile(const char* filename, Error*
return ret;
}
const BIOS::ImageInfo* BIOS::GetInfoForHash(const std::span<u8> image, const ImageInfo::Hash& hash)
const BIOS::ImageInfo* BIOS::GetInfoForHash(const std::span<const u8> image, const ImageInfo::Hash& hash)
{
// check for openbios
if (image.size() >= (s_openbios_signature_offset + std::size(s_openbios_signature)) &&

View File

@ -79,6 +79,8 @@ static_assert(sizeof(PSEXEHeader) == 0x800);
std::optional<Image> LoadImageFromFile(const char* filename, Error* error);
const ImageInfo* GetInfoForHash(const std::span<const u8> image, const ImageInfo::Hash& hash);
bool IsValidBIOSForRegion(ConsoleRegion console_region, ConsoleRegion bios_region);
bool PatchBIOSFastBoot(u8* image, u32 image_size, ImageInfo::FastBootPatch type);

View File

@ -140,9 +140,9 @@ public:
/// List of controller indices in the order that they should be displayed.
static const std::array<u32, NUM_CONTROLLER_AND_CARD_PORTS> PortDisplayOrder;
protected:
/// Returns true if automatic analog mode can be used.
static bool CanStartInAnalogMode(ControllerType ctype);
protected:
u32 m_index;
};

View File

@ -89,6 +89,8 @@ float SettingInfo::FloatStepValue() const
const MediaCaptureBackend Settings::DEFAULT_MEDIA_CAPTURE_BACKEND = MediaCaptureBackend::MediaFoundation;
#elif !defined(__ANDROID__)
const MediaCaptureBackend Settings::DEFAULT_MEDIA_CAPTURE_BACKEND = MediaCaptureBackend::FFmpeg;
#else
const MediaCaptureBackend Settings::DEFAULT_MEDIA_CAPTURE_BACKEND = MediaCaptureBackend::MaxCount;
#endif
Settings::Settings()

View File

@ -542,14 +542,12 @@ struct Settings
static constexpr SaveStateCompressionMode DEFAULT_SAVE_STATE_COMPRESSION_MODE = SaveStateCompressionMode::ZstDefault;
#ifndef __ANDROID__
static const MediaCaptureBackend DEFAULT_MEDIA_CAPTURE_BACKEND;
static constexpr const char* DEFAULT_MEDIA_CAPTURE_CONTAINER = "mp4";
static constexpr u32 DEFAULT_MEDIA_CAPTURE_VIDEO_WIDTH = 640;
static constexpr u32 DEFAULT_MEDIA_CAPTURE_VIDEO_HEIGHT = 480;
static constexpr u32 DEFAULT_MEDIA_CAPTURE_VIDEO_BITRATE = 6000;
static constexpr u32 DEFAULT_MEDIA_CAPTURE_AUDIO_BITRATE = 128;
#endif
// Android doesn't create settings until they're first opened, so we have to override the defaults here.
#ifndef __ANDROID__

View File

@ -160,9 +160,6 @@ static bool CreateGPU(GPURenderer renderer, bool is_switching, Error* error);
static bool RecreateGPU(GPURenderer renderer, bool force_recreate_device = false, bool update_display = true);
static void HandleHostGPUDeviceLost();
/// Returns true if fast forwarding or slow motion is currently active.
static bool IsRunningAtNonStandardSpeed();
/// Returns true if boot is being fast forwarded.
static bool IsFastForwardingBoot();
@ -4136,7 +4133,7 @@ bool System::CheckForSBIFile(CDImage* image, Error* error)
s_running_game_serial, s_running_game_title);
#else
// Shorter because no confirm messages.
Error::SetStringView(error, "Missing SBI file.", "The selected game requires a SBI file to run properly.");
Error::SetStringView(error, "The selected game requires a SBI file to run properly.");
#endif
return false;

View File

@ -268,6 +268,9 @@ void SingleStepCPU();
float GetTargetSpeed();
float GetAudioNominalRate();
/// Returns true if fast forwarding or slow motion is currently active.
bool IsRunningAtNonStandardSpeed();
/// Adjusts the throttle frequency, i.e. how many times we should sleep per second.
void SetThrottleFrequency(float frequency);
@ -391,8 +394,6 @@ bool SaveScreenshot(const char* filename = nullptr, DisplayScreenshotMode mode =
DisplayScreenshotFormat format = g_settings.display_screenshot_format,
u8 quality = g_settings.display_screenshot_quality, bool compress_on_thread = true);
#ifndef __ANDROID__
/// Returns the path that a new media capture would be saved to by default. Safe to call from any thread.
std::string GetNewMediaCapturePath(const std::string_view title, const std::string_view container);
@ -404,8 +405,6 @@ bool StartMediaCapture(std::string path = {});
bool StartMediaCapture(std::string path, bool capture_video, bool capture_audio);
void StopMediaCapture();
#endif
/// Loads the cheat list for the current game title from the user directory.
bool LoadCheatList();

View File

@ -2875,7 +2875,7 @@ MediaCapture::CodecList MediaCaptureFFmpeg::GetAudioCodecList(const char* contai
} // namespace
static constexpr const std::array s_backend_names = {
static constexpr const std::array<const char*, static_cast<size_t>(MediaCaptureBackend::MaxCount)> s_backend_names = {
#ifdef _WIN32
"MediaFoundation",
#endif
@ -2883,7 +2883,7 @@ static constexpr const std::array s_backend_names = {
"FFmpeg",
#endif
};
static constexpr const std::array s_backend_display_names = {
static constexpr const std::array<const char*, static_cast<size_t>(MediaCaptureBackend::MaxCount)> s_backend_display_names = {
#ifdef _WIN32
TRANSLATE_DISAMBIG_NOOP("Settings", "Media Foundation", "MediaCaptureBackend"),
#endif

View File

@ -153,7 +153,7 @@ std::unique_ptr<OpenGLContext> OpenGLContext::Create(const WindowInfo& wi, Error
#elif defined(__APPLE__)
context = OpenGLContextAGL::Create(wi, versions_to_try, error);
#elif defined(__ANDROID__)
context = ContextEGLAndroid::Create(wi, versions_to_try, error);
context = OpenGLContextEGLAndroid::Create(wi, versions_to_try, error);
#else
#if defined(ENABLE_X11)
if (wi.type == WindowInfo::Type::X11)