mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 21:39:52 +00:00
commit
89c320fe2b
@ -69,7 +69,8 @@ public:
|
||||
void clear() { size_ = 0; }
|
||||
bool empty() const { return size_ == 0; }
|
||||
|
||||
const T *data() { return data_; }
|
||||
const T *data() const { return data_; }
|
||||
|
||||
T *begin() { return data_; }
|
||||
T *end() { return data_ + size_; }
|
||||
const T *begin() const { return data_; }
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "Common/Log.h"
|
||||
|
||||
// Insert-only small-set implementation. Performs no allocation unless MaxFastSize is exceeded.
|
||||
// Can also be used as a small vector, then use push_back (or push_in_place) instead of insert.
|
||||
// Duplicates are thus allowed if you use that, but not if you exclusively use insert.
|
||||
@ -32,16 +34,18 @@ struct TinySet {
|
||||
}
|
||||
slowLookup_->push_back(t);
|
||||
}
|
||||
inline T *add_back() {
|
||||
inline T &push_uninitialized() {
|
||||
if (fastCount_ < MaxFastSize) {
|
||||
return &fastLookup_[fastCount_++];
|
||||
return fastLookup_[fastCount_++];
|
||||
}
|
||||
if (!slowLookup_) {
|
||||
slowLookup_ = new std::vector<T>();
|
||||
}
|
||||
|
||||
// The slow lookup is also slow at adding.
|
||||
T t;
|
||||
slowLookup_->push_back(t);
|
||||
return slowLookup_->back();
|
||||
return *slowLookup_->back();
|
||||
}
|
||||
void append(const TinySet<T, MaxFastSize> &other) {
|
||||
size_t otherSize = other.size();
|
||||
@ -136,8 +140,8 @@ private:
|
||||
};
|
||||
|
||||
template <class T, int MaxSize>
|
||||
struct FixedTinyVec {
|
||||
~FixedTinyVec() {}
|
||||
struct FixedVec {
|
||||
~FixedVec() {}
|
||||
// WARNING: Can fail if you exceed MaxSize!
|
||||
inline bool push_back(const T &t) {
|
||||
if (count_ < MaxSize) {
|
||||
@ -147,13 +151,16 @@ struct FixedTinyVec {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// WARNING: Can fail if you exceed MaxSize!
|
||||
inline T *add_back() {
|
||||
inline T &push_uninitialized() {
|
||||
if (count_ < MaxSize) {
|
||||
return &data_[count_++];
|
||||
}
|
||||
return nullptr;
|
||||
_dbg_assert_(false);
|
||||
return *data_[MaxSize - 1]; // BAD
|
||||
}
|
||||
|
||||
// Invalid if empty().
|
||||
void pop_back() { count_--; }
|
||||
|
||||
@ -184,7 +191,7 @@ struct FixedTinyVec {
|
||||
const T &back() const { return (*this)[size() - 1]; }
|
||||
const T &front() const { return (*this)[0]; }
|
||||
|
||||
bool operator == (const FixedTinyVec<T, MaxSize> &other) const {
|
||||
bool operator == (const FixedVec<T, MaxSize> &other) const {
|
||||
if (count_ != other.count_)
|
||||
return false;
|
||||
for (int i = 0; i < count_; i++) {
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
#include "Common/Log.h"
|
||||
#include "Common/GPU/Vulkan/VulkanLoader.h"
|
||||
#include "Common/Data/Collections/FastVec.h"
|
||||
|
||||
class VulkanContext;
|
||||
|
||||
@ -13,6 +14,8 @@ class VulkanContext;
|
||||
// However, not thread safe in any way!
|
||||
class VulkanBarrier {
|
||||
public:
|
||||
VulkanBarrier() : imageBarriers_(4) {}
|
||||
|
||||
void TransitionImage(
|
||||
VkImage image, int baseMip, int numMipLevels, int numLayers, VkImageAspectFlags aspectMask,
|
||||
VkImageLayout oldImageLayout, VkImageLayout newImageLayout,
|
||||
@ -25,7 +28,7 @@ public:
|
||||
dstStageMask_ |= dstStageMask;
|
||||
dependencyFlags_ |= VK_DEPENDENCY_BY_REGION_BIT;
|
||||
|
||||
VkImageMemoryBarrier imageBarrier;
|
||||
VkImageMemoryBarrier &imageBarrier = imageBarriers_.push_uninitialized();
|
||||
imageBarrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
|
||||
imageBarrier.pNext = nullptr;
|
||||
imageBarrier.srcAccessMask = srcAccessMask;
|
||||
@ -40,7 +43,6 @@ public:
|
||||
imageBarrier.subresourceRange.baseArrayLayer = 0;
|
||||
imageBarrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
|
||||
imageBarrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
|
||||
imageBarriers_.push_back(imageBarrier);
|
||||
}
|
||||
|
||||
// Automatically determines access and stage masks from layouts.
|
||||
@ -93,7 +95,7 @@ public:
|
||||
break;
|
||||
}
|
||||
|
||||
VkImageMemoryBarrier imageBarrier;
|
||||
VkImageMemoryBarrier &imageBarrier = imageBarriers_.push_uninitialized();
|
||||
imageBarrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
|
||||
imageBarrier.pNext = nullptr;
|
||||
imageBarrier.srcAccessMask = srcAccessMask;
|
||||
@ -108,7 +110,6 @@ public:
|
||||
imageBarrier.subresourceRange.baseArrayLayer = 0;
|
||||
imageBarrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
|
||||
imageBarrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
|
||||
imageBarriers_.push_back(imageBarrier);
|
||||
}
|
||||
|
||||
void Flush(VkCommandBuffer cmd);
|
||||
@ -116,6 +117,6 @@ public:
|
||||
private:
|
||||
VkPipelineStageFlags srcStageMask_ = 0;
|
||||
VkPipelineStageFlags dstStageMask_ = 0;
|
||||
std::vector<VkImageMemoryBarrier> imageBarriers_;
|
||||
FastVec<VkImageMemoryBarrier> imageBarriers_;
|
||||
VkDependencyFlags dependencyFlags_ = 0;
|
||||
};
|
||||
|
@ -188,6 +188,8 @@ enum SystemProperty {
|
||||
SYSPROP_SKIP_UI,
|
||||
|
||||
SYSPROP_USER_DOCUMENTS_DIR,
|
||||
|
||||
SYSPROP_OK_BUTTON_LEFT,
|
||||
};
|
||||
|
||||
enum class SystemNotification {
|
||||
|
@ -1,6 +1,9 @@
|
||||
#include <algorithm>
|
||||
|
||||
#include "Common/Log.h"
|
||||
#include "Common/System/Display.h"
|
||||
#include "Common/System/System.h"
|
||||
#include "Common/System/Request.h"
|
||||
#include "Common/Input/InputState.h"
|
||||
#include "Common/Input/KeyCodes.h"
|
||||
#include "Common/Math/curves.h"
|
||||
@ -10,8 +13,6 @@
|
||||
#include "Common/UI/Root.h"
|
||||
#include "Common/Data/Text/I18n.h"
|
||||
#include "Common/Render/DrawBuffer.h"
|
||||
#include "Common/Log.h"
|
||||
#include <Common/System/Request.h>
|
||||
|
||||
static const bool ClickDebug = false;
|
||||
|
||||
@ -393,10 +394,8 @@ void PopupScreen::TriggerFinish(DialogResult result) {
|
||||
|
||||
OnCompleted(result);
|
||||
}
|
||||
#if PPSSPP_PLATFORM(UWP)
|
||||
// Inform UI that popup close to hide OSK (if visible)
|
||||
System_NotifyUIState("popup_closed");
|
||||
#endif
|
||||
}
|
||||
|
||||
void PopupScreen::CreateViews() {
|
||||
@ -433,17 +432,17 @@ void PopupScreen::CreateViews() {
|
||||
Margins buttonMargins(5, 5);
|
||||
|
||||
// Adjust button order to the platform default.
|
||||
#if defined(_WIN32)
|
||||
defaultButton_ = buttonRow->Add(new Button(button1_, new LinearLayoutParams(1.0f, buttonMargins)));
|
||||
defaultButton_->OnClick.Handle<UIScreen>(this, &UIScreen::OnOK);
|
||||
if (!button2_.empty())
|
||||
buttonRow->Add(new Button(button2_, new LinearLayoutParams(1.0f, buttonMargins)))->OnClick.Handle<UIScreen>(this, &UIScreen::OnCancel);
|
||||
#else
|
||||
if (!button2_.empty())
|
||||
buttonRow->Add(new Button(button2_, new LinearLayoutParams(1.0f)))->OnClick.Handle<UIScreen>(this, &UIScreen::OnCancel);
|
||||
defaultButton_ = buttonRow->Add(new Button(button1_, new LinearLayoutParams(1.0f)));
|
||||
defaultButton_->OnClick.Handle<UIScreen>(this, &UIScreen::OnOK);
|
||||
#endif
|
||||
if (System_GetPropertyBool(SYSPROP_OK_BUTTON_LEFT)) {
|
||||
defaultButton_ = buttonRow->Add(new Button(button1_, new LinearLayoutParams(1.0f, buttonMargins)));
|
||||
defaultButton_->OnClick.Handle<UIScreen>(this, &UIScreen::OnOK);
|
||||
if (!button2_.empty())
|
||||
buttonRow->Add(new Button(button2_, new LinearLayoutParams(1.0f, buttonMargins)))->OnClick.Handle<UIScreen>(this, &UIScreen::OnCancel);
|
||||
} else {
|
||||
if (!button2_.empty())
|
||||
buttonRow->Add(new Button(button2_, new LinearLayoutParams(1.0f)))->OnClick.Handle<UIScreen>(this, &UIScreen::OnCancel);
|
||||
defaultButton_ = buttonRow->Add(new Button(button1_, new LinearLayoutParams(1.0f)));
|
||||
defaultButton_->OnClick.Handle<UIScreen>(this, &UIScreen::OnOK);
|
||||
}
|
||||
|
||||
box_->Add(buttonRow);
|
||||
}
|
||||
|
@ -184,7 +184,7 @@ static bool DefaultVSync() {
|
||||
}
|
||||
|
||||
static bool DefaultEnableStateUndo() {
|
||||
#ifdef MOBILE_DEVICE
|
||||
#ifdef PPSSPP_PLATFORM(ANDROID) || PPSSPP_PLATFORM(IOS)
|
||||
// Off on mobile to save disk space.
|
||||
return false;
|
||||
#endif
|
||||
|
@ -1405,10 +1405,6 @@ static PSPModule *__KernelLoadELFFromPtr(const u8 *ptr, size_t elfSize, u32 load
|
||||
|
||||
if (!module->isFake) {
|
||||
bool scan = true;
|
||||
#if defined(MOBILE_DEVICE)
|
||||
scan = g_Config.bFuncReplacements;
|
||||
#endif
|
||||
|
||||
// If the ELF has debug symbols, don't add entries to the symbol table.
|
||||
bool insertSymbols = scan && !reader.LoadSymbols();
|
||||
std::vector<SectionID> codeSections = reader.GetCodeSections();
|
||||
|
@ -408,8 +408,8 @@ const KeyMap_IntStrPair psp_button_names[] = {
|
||||
{VIRTKEY_SPEED_CUSTOM2, "Alt speed 2"},
|
||||
{VIRTKEY_SPEED_ANALOG, "Analog speed"},
|
||||
{VIRTKEY_PAUSE, "Pause"},
|
||||
#ifndef MOBILE_DEVICE
|
||||
{VIRTKEY_FRAME_ADVANCE, "Frame Advance"},
|
||||
#if !defined(MOBILE_DEVICE)
|
||||
{VIRTKEY_RECORD, "Audio/Video Recording" },
|
||||
#endif
|
||||
{VIRTKEY_REWIND, "Rewind"},
|
||||
|
@ -148,7 +148,7 @@ namespace KeyMap {
|
||||
return false;
|
||||
}
|
||||
|
||||
FixedTinyVec<InputMapping, 3> mappings;
|
||||
FixedVec<InputMapping, 3> mappings;
|
||||
};
|
||||
|
||||
typedef std::map<int, std::vector<MultiInputMapping>> KeyMapping;
|
||||
|
@ -566,11 +566,9 @@ void PSP_Shutdown() {
|
||||
if (coreState == CORE_RUNNING)
|
||||
Core_Stop();
|
||||
|
||||
#ifndef MOBILE_DEVICE
|
||||
if (g_Config.bFuncHashMap) {
|
||||
MIPSAnalyst::StoreHashMap();
|
||||
}
|
||||
#endif
|
||||
|
||||
if (pspIsIniting)
|
||||
Core_NotifyLifecycle(CoreLifecycle::START_COMPLETE);
|
||||
|
@ -435,6 +435,8 @@ bool System_GetPropertyBool(SystemProperty prop) {
|
||||
}
|
||||
case SYSPROP_DEBUGGER_PRESENT:
|
||||
return IsDebuggerPresent();
|
||||
case SYSPROP_OK_BUTTON_LEFT:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
@ -383,6 +383,8 @@ bool System_GetPropertyBool(SystemProperty prop) {
|
||||
return !g_Config.bDisableHTTPS;
|
||||
case SYSPROP_DEBUGGER_PRESENT:
|
||||
return IsDebuggerPresent();
|
||||
case SYSPROP_OK_BUTTON_LEFT:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user