mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
Merge pull request #19547 from hrydgard/even-more-fixes
Improve some asserts, minor fixes (theme, warnings)
This commit is contained in:
20 files changed
+73
-66
No files matched your search
@@ -62,7 +62,7 @@ bool GLRBuffer::Unmap() {
|
||||
return glUnmapBuffer(target_) == GL_TRUE;
|
||||
}
|
||||
|
||||
GLPushBuffer::GLPushBuffer(GLRenderManager *render, GLuint target, size_t size, const char *tag) : render_(render), size_(size), target_(target), tag_(tag) {
|
||||
GLPushBuffer::GLPushBuffer(GLRenderManager *render, GLuint target, size_t size, const char *tag) : render_(render), nextBufferSize_(size), target_(target), tag_(tag) {
|
||||
AddBuffer();
|
||||
RegisterGPUMemoryManager(this);
|
||||
}
|
||||
@@ -139,10 +139,10 @@ void GLPushBuffer::Flush() {
|
||||
void GLPushBuffer::AddBuffer() {
|
||||
// INFO_LOG(Log::G3D, "GLPushBuffer(%s): Allocating %d bytes", tag_, size_);
|
||||
BufInfo info;
|
||||
info.localMemory = (uint8_t *)AllocateAlignedMemory(size_, 16);
|
||||
_assert_msg_(info.localMemory != 0, "GLPushBuffer alloc fail: %d (%s)", (int)size_, tag_);
|
||||
info.buffer = render_->CreateBuffer(target_, size_, GL_DYNAMIC_DRAW);
|
||||
info.size = size_;
|
||||
info.localMemory = (uint8_t *)AllocateAlignedMemory(nextBufferSize_, 16);
|
||||
_assert_msg_(info.localMemory != 0, "GLPushBuffer alloc fail: %d (%s)", (int)nextBufferSize_, tag_);
|
||||
info.buffer = render_->CreateBuffer(target_, nextBufferSize_, GL_DYNAMIC_DRAW);
|
||||
info.size = nextBufferSize_;
|
||||
buf_ = buffers_.size();
|
||||
buffers_.push_back(info);
|
||||
}
|
||||
@@ -169,10 +169,10 @@ void GLPushBuffer::NextBuffer(size_t minSize) {
|
||||
Unmap();
|
||||
|
||||
buf_++;
|
||||
if (buf_ >= buffers_.size() || minSize > size_) {
|
||||
if (buf_ >= buffers_.size() || minSize > nextBufferSize_) {
|
||||
// Before creating the buffer, adjust to the new size_ if necessary.
|
||||
while (size_ < minSize) {
|
||||
size_ <<= 1;
|
||||
while (nextBufferSize_ < minSize) {
|
||||
nextBufferSize_ <<= 1;
|
||||
}
|
||||
AddBuffer();
|
||||
}
|
||||
@@ -208,7 +208,7 @@ void GLPushBuffer::Defragment() {
|
||||
Destroy(false);
|
||||
|
||||
// Set some sane but very free limits. If there's another spike, we'll just allocate more anyway.
|
||||
size_ = std::min(std::max(newSize, (size_t)65536), (size_t)(512 * 1024 * 1024));
|
||||
nextBufferSize_ = std::min(std::max(newSize, (size_t)65536), (size_t)(512 * 1024 * 1024));
|
||||
AddBuffer();
|
||||
}
|
||||
|
||||
@@ -272,5 +272,5 @@ void GLPushBuffer::UnmapDevice() {
|
||||
}
|
||||
|
||||
void GLPushBuffer::GetDebugString(char *buffer, size_t bufSize) const {
|
||||
snprintf(buffer, bufSize, "%s: %s/%s (%d)", tag_, NiceSizeFormat(this->offset_).c_str(), NiceSizeFormat(this->size_).c_str(), (int)buffers_.size());
|
||||
snprintf(buffer, bufSize, "%s: %s/%s (%d)", tag_, NiceSizeFormat(this->offset_).c_str(), NiceSizeFormat(this->nextBufferSize_).c_str(), (int)buffers_.size());
|
||||
}
|
||||
@@ -116,7 +116,7 @@ public:
|
||||
// again, call Rewind (see below).
|
||||
uint8_t *Allocate(uint32_t numBytes, uint32_t alignment, GLRBuffer **buf, uint32_t *bindOffset) {
|
||||
uint32_t offset = ((uint32_t)offset_ + alignment - 1) & ~(alignment - 1);
|
||||
if (offset + numBytes <= size_) {
|
||||
if (offset + numBytes <= nextBufferSize_) {
|
||||
// Common path.
|
||||
offset_ = offset + numBytes;
|
||||
*buf = buffers_[buf_].buffer;
|
||||
@@ -175,7 +175,7 @@ private:
|
||||
std::vector<BufInfo> buffers_;
|
||||
size_t buf_ = 0;
|
||||
size_t offset_ = 0;
|
||||
size_t size_ = 0;
|
||||
size_t nextBufferSize_ = 0;
|
||||
uint8_t *writePtr_ = nullptr;
|
||||
GLuint target_;
|
||||
GLBufferStrategy strategy_ = GLBufferStrategy::SUBDATA;
|
||||
|
||||
@@ -258,9 +258,6 @@ void *AllocateAlignedMemory(size_t size, size_t alignment) {
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
char temp[32];
|
||||
NiceSizeFormat(size, temp, sizeof(temp));
|
||||
_assert_msg_(ptr != nullptr, "Failed to allocate aligned memory of size %s (%llu)", temp, (unsigned long long)size);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@ bool ProtectMemoryPages(const void* ptr, size_t size, uint32_t memProtFlags);
|
||||
void FreeMemoryPages(void* ptr, size_t size);
|
||||
|
||||
// Regular aligned memory. Don't try to apply memory protection willy-nilly to memory allocated this way as in-page alignment is unknown (though could be checked).
|
||||
// No longer asserts, will return nullptr on failure.
|
||||
void* AllocateAlignedMemory(size_t size, size_t alignment);
|
||||
void FreeAlignedMemory(void* ptr);
|
||||
|
||||
|
||||
+2
-4
@@ -97,10 +97,8 @@ bool IsFocusMovementEnabled() {
|
||||
}
|
||||
|
||||
void LayoutViewHierarchy(const UIContext &dc, ViewGroup *root, bool ignoreInsets) {
|
||||
if (!root) {
|
||||
ERROR_LOG(Log::System, "Tried to layout a view hierarchy from a zero pointer root");
|
||||
return;
|
||||
}
|
||||
_assert_(root);
|
||||
_assert_(&dc);
|
||||
|
||||
Bounds rootBounds = ignoreInsets ? dc.GetBounds() : dc.GetLayoutBounds();
|
||||
|
||||
|
||||
+7
-5
@@ -602,8 +602,10 @@ ItemHeader::ItemHeader(std::string_view text, LayoutParams *layoutParams)
|
||||
|
||||
void ItemHeader::Draw(UIContext &dc) {
|
||||
dc.SetFontStyle(large_ ? dc.theme->uiFont : dc.theme->uiFontSmall);
|
||||
dc.DrawText(text_, bounds_.x + 4, bounds_.centerY(), dc.theme->headerStyle.fgColor, ALIGN_LEFT | ALIGN_VCENTER);
|
||||
dc.Draw()->DrawImageCenterTexel(dc.theme->whiteImage, bounds_.x, bounds_.y2()-2, bounds_.x2(), bounds_.y2(), dc.theme->headerStyle.fgColor);
|
||||
|
||||
const UI::Style &style = popupStyle_ ? dc.theme->popupStyle : dc.theme->headerStyle;
|
||||
dc.DrawText(text_, bounds_.x + 4, bounds_.centerY(), style.fgColor, ALIGN_LEFT | ALIGN_VCENTER);
|
||||
dc.Draw()->DrawImageCenterTexel(dc.theme->whiteImage, bounds_.x, bounds_.y2()-2, bounds_.x2(), bounds_.y2(), style.fgColor);
|
||||
}
|
||||
|
||||
void ItemHeader::GetContentDimensionsBySpec(const UIContext &dc, MeasureSpec horiz, MeasureSpec vert, float &w, float &h) const {
|
||||
@@ -641,10 +643,10 @@ void CollapsibleHeader::Draw(UIContext &dc) {
|
||||
float xoff = 37.0f;
|
||||
|
||||
dc.SetFontStyle(dc.theme->uiFontSmall);
|
||||
dc.DrawText(text_, bounds_.x + 4 + xoff, bounds_.centerY(), dc.theme->headerStyle.fgColor, ALIGN_LEFT | ALIGN_VCENTER);
|
||||
dc.Draw()->DrawImageCenterTexel(dc.theme->whiteImage, bounds_.x, bounds_.y2() - 2, bounds_.x2(), bounds_.y2(), dc.theme->headerStyle.fgColor);
|
||||
dc.DrawText(text_, bounds_.x + 4 + xoff, bounds_.centerY(), style.fgColor, ALIGN_LEFT | ALIGN_VCENTER);
|
||||
dc.Draw()->DrawImageCenterTexel(dc.theme->whiteImage, bounds_.x, bounds_.y2() - 2, bounds_.x2(), bounds_.y2(), style.fgColor);
|
||||
if (hasSubItems_) {
|
||||
dc.Draw()->DrawImageRotated(ImageID("I_ARROW"), bounds_.x + 20.0f, bounds_.y + 20.0f, 1.0f, *toggle_ ? -M_PI / 2 : M_PI);
|
||||
dc.Draw()->DrawImageRotated(ImageID("I_ARROW"), bounds_.x + 20.0f, bounds_.y + 20.0f, 1.0f, *toggle_ ? -M_PI / 2 : M_PI, style.fgColor);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -853,9 +853,11 @@ public:
|
||||
std::string DescribeText() const override;
|
||||
void GetContentDimensionsBySpec(const UIContext &dc, MeasureSpec horiz, MeasureSpec vert, float &w, float &h) const override;
|
||||
void SetLarge(bool large) { large_ = large; }
|
||||
void SetPopupStyle(bool popupStyle) { popupStyle_ = popupStyle; }
|
||||
private:
|
||||
std::string text_;
|
||||
bool large_ = false;
|
||||
bool popupStyle_ = false;
|
||||
};
|
||||
|
||||
class PopupHeader : public Item {
|
||||
|
||||
@@ -108,6 +108,8 @@ TextureCacheCommon::TextureCacheCommon(Draw::DrawContext *draw, Draw2D *draw2D)
|
||||
// Here we need 2KB to expand a 1KB CLUT.
|
||||
expandClut_ = (u32 *)AllocateAlignedMemory(2048, 16);
|
||||
|
||||
_assert_(clutBufRaw_ && clutBufConverted_ && expandClut_);
|
||||
|
||||
// Zap so we get consistent behavior if the game fails to load some of the CLUT.
|
||||
memset(clutBufRaw_, 0, 2048);
|
||||
memset(clutBufConverted_, 0, 2048);
|
||||
|
||||
@@ -741,6 +741,7 @@ bool TextureReplacer::WillSave(const ReplacedTextureDecodeInfo &replacedInfo) co
|
||||
void TextureReplacer::NotifyTextureDecoded(ReplacedTexture *texture, const ReplacedTextureDecodeInfo &replacedInfo, const void *data, int srcPitch, int level, int origW, int origH, int scaledW, int scaledH) {
|
||||
_assert_msg_(saveEnabled_, "Texture saving not enabled");
|
||||
_assert_(srcPitch >= 0);
|
||||
_assert_(data);
|
||||
|
||||
if (!WillSave(replacedInfo)) {
|
||||
// Ignore.
|
||||
|
||||
@@ -319,6 +319,7 @@ void TextureCacheGLES::BuildTexture(TexCacheEntry *const entry) {
|
||||
}
|
||||
|
||||
data = (u8 *)AllocateAlignedMemory(dataSize, 16);
|
||||
_assert_msg_(data != nullptr, "Failed to allocate aligned memory for texture level %d: %d bytes (%dx%d)", i, (int)dataSize, mipWidth, mipHeight);
|
||||
|
||||
if (!data) {
|
||||
ERROR_LOG(Log::G3D, "Ran out of RAM trying to allocate a temporary texture upload buffer (%dx%d)", mipWidth, mipHeight);
|
||||
@@ -341,6 +342,7 @@ void TextureCacheGLES::BuildTexture(TexCacheEntry *const entry) {
|
||||
|
||||
size_t dataSize = levelStride * plan.depth;
|
||||
u8 *data = (u8 *)AllocateAlignedMemory(dataSize, 16);
|
||||
_assert_msg_(data != nullptr, "Failed to allocate aligned memory for 3d texture: %d bytes", (int)dataSize);
|
||||
memset(data, 0, levelStride * plan.depth);
|
||||
u8 *p = data;
|
||||
|
||||
|
||||
@@ -42,8 +42,7 @@
|
||||
|
||||
TransformUnit::TransformUnit() {
|
||||
decoded_ = (u8 *)AllocateAlignedMemory(TRANSFORM_BUF_SIZE, 16);
|
||||
if (!decoded_)
|
||||
return;
|
||||
_assert_(decoded_);
|
||||
binner_ = new BinManager();
|
||||
}
|
||||
|
||||
|
||||
@@ -216,6 +216,7 @@ ShaderManagerVulkan::ShaderManagerVulkan(Draw::DrawContext *draw)
|
||||
uboAlignment_ = vulkan->GetPhysicalDeviceProperties().properties.limits.minUniformBufferOffsetAlignment;
|
||||
|
||||
uniforms_ = (Uniforms *)AllocateAlignedMemory(sizeof(Uniforms), 16);
|
||||
_assert_(uniforms_);
|
||||
|
||||
static_assert(sizeof(uniforms_->ub_base) <= 512, "ub_base grew too big");
|
||||
static_assert(sizeof(uniforms_->ub_lights) <= 512, "ub_lights grew too big");
|
||||
|
||||
@@ -768,8 +768,11 @@ void TextureCacheVulkan::LoadVulkanTextureLevel(TexCacheEntry &entry, uint8_t *w
|
||||
if (scaleFactor > 1) {
|
||||
u32 fmt = dstFmt;
|
||||
// CPU scaling reads from the destination buffer so we want cached RAM.
|
||||
uint8_t *rearrange = (uint8_t *)AllocateAlignedMemory(w * scaleFactor * h * scaleFactor * 4, 16);
|
||||
scaler_.ScaleAlways((u32 *)rearrange, pixelData, w, h, &w, &h, scaleFactor);
|
||||
size_t allocBytes = w * scaleFactor * h * scaleFactor * 4;
|
||||
uint8_t *scaleBuf = (uint8_t *)AllocateAlignedMemory(allocBytes, 16);
|
||||
_assert_msg_(scaleBuf, "Failed to allocate %d aligned bytes for texture scaler", (int)allocBytes);
|
||||
|
||||
scaler_.ScaleAlways((u32 *)scaleBuf, pixelData, w, h, &w, &h, scaleFactor);
|
||||
pixelData = (u32 *)writePtr;
|
||||
|
||||
// We always end up at 8888. Other parts assume this.
|
||||
@@ -779,13 +782,13 @@ void TextureCacheVulkan::LoadVulkanTextureLevel(TexCacheEntry &entry, uint8_t *w
|
||||
|
||||
if (decPitch != rowPitch) {
|
||||
for (int y = 0; y < h; ++y) {
|
||||
memcpy(writePtr + rowPitch * y, rearrange + decPitch * y, w * bpp);
|
||||
memcpy(writePtr + rowPitch * y, scaleBuf + decPitch * y, w * bpp);
|
||||
}
|
||||
decPitch = rowPitch;
|
||||
} else {
|
||||
memcpy(writePtr, rearrange, w * h * 4);
|
||||
memcpy(writePtr, scaleBuf, w * h * 4);
|
||||
}
|
||||
FreeAlignedMemory(rearrange);
|
||||
FreeAlignedMemory(scaleBuf);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -352,7 +352,7 @@ void EmuScreen::bootGame(const Path &filename) {
|
||||
ERROR_LOG(Log::Boot, "InitStart bootGame error: %s", errorMessage_.c_str());
|
||||
}
|
||||
|
||||
if (PSP_CoreParameter().compat.flags().RequireBufferedRendering && g_Config.bSkipBufferEffects) {
|
||||
if (PSP_CoreParameter().compat.flags().RequireBufferedRendering && g_Config.bSkipBufferEffects && !g_Config.bSoftwareRendering) {
|
||||
auto gr = GetI18NCategory(I18NCat::GRAPHICS);
|
||||
g_OSD.Show(OSDType::MESSAGE_WARNING, gr->T("BufferedRenderingRequired", "Warning: This game requires Rendering Mode to be set to Buffered."), 10.0f);
|
||||
}
|
||||
|
||||
@@ -1144,7 +1144,7 @@ void GameSettingsScreen::CreateSystemSettings(UI::ViewGroup *systemSettings) {
|
||||
#if PPSSPP_PLATFORM(ANDROID)
|
||||
if (System_GetPropertyInt(SYSPROP_DEVICE_TYPE) != DEVICE_TYPE_VR) {
|
||||
memstickDisplay_ = g_Config.memStickDirectory.ToVisualString();
|
||||
auto memstickPath = systemSettings->Add(new ChoiceWithValueDisplay(&memstickDisplay_, sy->T("Memory Stick folder", "Memory Stick folder"), I18NCat::NONE));
|
||||
auto memstickPath = systemSettings->Add(new ChoiceWithValueDisplay(&memstickDisplay_, sy->T("Memory Stick folder"), I18NCat::NONE));
|
||||
memstickPath->SetEnabled(!PSP_IsInited());
|
||||
memstickPath->OnClick.Handle(this, &GameSettingsScreen::OnShowMemstickScreen);
|
||||
|
||||
@@ -1161,16 +1161,16 @@ void GameSettingsScreen::CreateSystemSettings(UI::ViewGroup *systemSettings) {
|
||||
#elif defined(_WIN32)
|
||||
#if PPSSPP_PLATFORM(UWP)
|
||||
memstickDisplay_ = g_Config.memStickDirectory.ToVisualString();
|
||||
auto memstickPath = systemSettings->Add(new ChoiceWithValueDisplay(&memstickDisplay_, sy->T("Memory Stick folder", "Memory Stick folder"), I18NCat::NONE));
|
||||
auto memstickPath = systemSettings->Add(new ChoiceWithValueDisplay(&memstickDisplay_, sy->T("Memory Stick folder"), I18NCat::NONE));
|
||||
memstickPath->SetEnabled(!PSP_IsInited());
|
||||
memstickPath->OnClick.Handle(this, &GameSettingsScreen::OnShowMemstickScreen);
|
||||
#else
|
||||
SavePathInMyDocumentChoice = systemSettings->Add(new CheckBox(&installed_, sy->T("Save path in My Documents", "Save path in My Documents")));
|
||||
SavePathInMyDocumentChoice = systemSettings->Add(new CheckBox(&installed_, sy->T("Memory Stick in My Documents")));
|
||||
SavePathInMyDocumentChoice->SetEnabled(!PSP_IsInited());
|
||||
SavePathInMyDocumentChoice->OnClick.Handle(this, &GameSettingsScreen::OnSavePathMydoc);
|
||||
SavePathInOtherChoice = systemSettings->Add(new CheckBox(&otherinstalled_, sy->T("Save path in installed.txt", "Save path in installed.txt")));
|
||||
SavePathInMyDocumentChoice->OnClick.Handle(this, &GameSettingsScreen::OnMemoryStickMyDoc);
|
||||
SavePathInOtherChoice = systemSettings->Add(new CheckBox(&otherinstalled_, sy->T("Memory Stick in installed.txt")));
|
||||
SavePathInOtherChoice->SetEnabled(false);
|
||||
SavePathInOtherChoice->OnClick.Handle(this, &GameSettingsScreen::OnSavePathOther);
|
||||
SavePathInOtherChoice->OnClick.Handle(this, &GameSettingsScreen::OnMemoryStickOther);
|
||||
const bool myDocsExists = W32Util::UserDocumentsPath().size() != 0;
|
||||
|
||||
const Path &PPSSPPpath = File::GetExeDirectory();
|
||||
@@ -1379,7 +1379,7 @@ UI::EventReturn GameSettingsScreen::OnShowMemstickScreen(UI::EventParams &e) {
|
||||
|
||||
#if defined(_WIN32) && !PPSSPP_PLATFORM(UWP)
|
||||
|
||||
UI::EventReturn GameSettingsScreen::OnSavePathMydoc(UI::EventParams &e) {
|
||||
UI::EventReturn GameSettingsScreen::OnMemoryStickMyDoc(UI::EventParams &e) {
|
||||
const Path &PPSSPPpath = File::GetExeDirectory();
|
||||
const Path installedFile = PPSSPPpath / "installed.txt";
|
||||
installed_ = File::Exists(installedFile);
|
||||
@@ -1406,7 +1406,7 @@ UI::EventReturn GameSettingsScreen::OnSavePathMydoc(UI::EventParams &e) {
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
||||
UI::EventReturn GameSettingsScreen::OnSavePathOther(UI::EventParams &e) {
|
||||
UI::EventReturn GameSettingsScreen::OnMemoryStickOther(UI::EventParams &e) {
|
||||
const Path &PPSSPPpath = File::GetExeDirectory();
|
||||
if (otherinstalled_) {
|
||||
auto di = GetI18NCategory(I18NCat::DIALOG);
|
||||
|
||||
@@ -105,8 +105,8 @@ private:
|
||||
UI::EventReturn OnJitAffectingSetting(UI::EventParams &e);
|
||||
UI::EventReturn OnShowMemstickScreen(UI::EventParams &e);
|
||||
#if defined(_WIN32) && !PPSSPP_PLATFORM(UWP)
|
||||
UI::EventReturn OnSavePathMydoc(UI::EventParams &e);
|
||||
UI::EventReturn OnSavePathOther(UI::EventParams &e);
|
||||
UI::EventReturn OnMemoryStickMyDoc(UI::EventParams &e);
|
||||
UI::EventReturn OnMemoryStickOther(UI::EventParams &e);
|
||||
#endif
|
||||
UI::EventReturn OnScreenRotation(UI::EventParams &e);
|
||||
UI::EventReturn OnImmersiveModeChange(UI::EventParams &e);
|
||||
|
||||
+14
-15
@@ -774,6 +774,7 @@ void GameBrowser::Refresh() {
|
||||
auto mm = GetI18NCategory(I18NCat::MAINMENU);
|
||||
|
||||
// No topbar on recent screen
|
||||
gameList_ = nullptr;
|
||||
if (DisplayTopBar()) {
|
||||
LinearLayout *topBar = new LinearLayout(ORIENT_HORIZONTAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT));
|
||||
if (browseFlags_ & BrowseFlags::NAVIGATE) {
|
||||
@@ -828,12 +829,10 @@ void GameBrowser::Refresh() {
|
||||
|
||||
if (*gridStyle_) {
|
||||
gameList_ = new UI::GridLayoutList(UI::GridLayoutSettings(150*g_Config.fGameGridScale, 85*g_Config.fGameGridScale), new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT));
|
||||
Add(gameList_);
|
||||
} else {
|
||||
UI::LinearLayout *gl = new UI::LinearLayoutList(UI::ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT));
|
||||
gl->SetSpacing(4.0f);
|
||||
gameList_ = gl;
|
||||
Add(gameList_);
|
||||
}
|
||||
} else {
|
||||
if (*gridStyle_) {
|
||||
@@ -854,8 +853,8 @@ void GameBrowser::Refresh() {
|
||||
// grid->Add(gameList_);
|
||||
// grid->Add(gridOptionColumn);
|
||||
// Add(grid);
|
||||
Add(gameList_);
|
||||
}
|
||||
Add(gameList_);
|
||||
|
||||
// Find games in the current directory and create new ones.
|
||||
std::vector<DirButton *> dirButtons;
|
||||
@@ -1061,7 +1060,7 @@ UI::EventReturn GameBrowser::NavigateClick(UI::EventParams &e) {
|
||||
|
||||
UI::EventReturn GameBrowser::GridSettingsClick(UI::EventParams &e) {
|
||||
auto sy = GetI18NCategory(I18NCat::SYSTEM);
|
||||
auto gridSettings = new GridSettingsScreen(sy->T("Games list settings"));
|
||||
auto gridSettings = new GridSettingsPopupScreen(sy->T("Games list settings"));
|
||||
gridSettings->OnRecentChanged.Handle(this, &GameBrowser::OnRecentClear);
|
||||
if (e.v)
|
||||
gridSettings->SetPopupOrigin(e.v);
|
||||
@@ -1195,7 +1194,7 @@ void MainScreen::CreateViews() {
|
||||
if (g_Config.HasRecentIsos()) {
|
||||
tabHolder_->SetCurrentTab(0, true);
|
||||
} else if (g_Config.iMaxRecent > 0) {
|
||||
tabHolder_->SetCurrentTab(1, true);
|
||||
tabHolder_->SetCurrentTab(1, true);
|
||||
}
|
||||
|
||||
if (backFromStore_ || showHomebrewTab) {
|
||||
@@ -1721,7 +1720,7 @@ UI::EventReturn UmdReplaceScreen::OnGameSettings(UI::EventParams &e) {
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
||||
void GridSettingsScreen::CreatePopupContents(UI::ViewGroup *parent) {
|
||||
void GridSettingsPopupScreen::CreatePopupContents(UI::ViewGroup *parent) {
|
||||
using namespace UI;
|
||||
|
||||
auto di = GetI18NCategory(I18NCat::DIALOG);
|
||||
@@ -1734,34 +1733,34 @@ void GridSettingsScreen::CreatePopupContents(UI::ViewGroup *parent) {
|
||||
items->Add(new CheckBox(&g_Config.bGridView2, sy->T("Display Games on a grid")));
|
||||
items->Add(new CheckBox(&g_Config.bGridView3, sy->T("Display Homebrew on a grid")));
|
||||
|
||||
items->Add(new ItemHeader(sy->T("Grid icon size")));
|
||||
items->Add(new Choice(sy->T("Increase size")))->OnClick.Handle(this, &GridSettingsScreen::GridPlusClick);
|
||||
items->Add(new Choice(sy->T("Decrease size")))->OnClick.Handle(this, &GridSettingsScreen::GridMinusClick);
|
||||
items->Add(new ItemHeader(sy->T("Grid icon size")))->SetPopupStyle(true);
|
||||
items->Add(new Choice(sy->T("Increase size")))->OnClick.Handle(this, &GridSettingsPopupScreen::GridPlusClick);
|
||||
items->Add(new Choice(sy->T("Decrease size")))->OnClick.Handle(this, &GridSettingsPopupScreen::GridMinusClick);
|
||||
|
||||
items->Add(new ItemHeader(sy->T("Display Extra Info")));
|
||||
items->Add(new ItemHeader(sy->T("Display Extra Info")))->SetPopupStyle(true);
|
||||
items->Add(new CheckBox(&g_Config.bShowIDOnGameIcon, sy->T("Show ID")));
|
||||
items->Add(new CheckBox(&g_Config.bShowRegionOnGameIcon, sy->T("Show region flag")));
|
||||
|
||||
if (g_Config.iMaxRecent > 0) {
|
||||
items->Add(new ItemHeader(sy->T("Clear Recent")));
|
||||
items->Add(new Choice(sy->T("Clear Recent Games List")))->OnClick.Handle(this, &GridSettingsScreen::OnRecentClearClick);
|
||||
items->Add(new ItemHeader(sy->T("Clear Recent")))->SetPopupStyle(true);
|
||||
items->Add(new Choice(sy->T("Clear Recent Games List")))->OnClick.Handle(this, &GridSettingsPopupScreen::OnRecentClearClick);
|
||||
}
|
||||
|
||||
scroll->Add(items);
|
||||
parent->Add(scroll);
|
||||
}
|
||||
|
||||
UI::EventReturn GridSettingsScreen::GridPlusClick(UI::EventParams &e) {
|
||||
UI::EventReturn GridSettingsPopupScreen::GridPlusClick(UI::EventParams &e) {
|
||||
g_Config.fGameGridScale = std::min(g_Config.fGameGridScale*1.25f, MAX_GAME_GRID_SCALE);
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
||||
UI::EventReturn GridSettingsScreen::GridMinusClick(UI::EventParams &e) {
|
||||
UI::EventReturn GridSettingsPopupScreen::GridMinusClick(UI::EventParams &e) {
|
||||
g_Config.fGameGridScale = std::max(g_Config.fGameGridScale/1.25f, MIN_GAME_GRID_SCALE);
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
||||
UI::EventReturn GridSettingsScreen::OnRecentClearClick(UI::EventParams &e) {
|
||||
UI::EventReturn GridSettingsPopupScreen::OnRecentClearClick(UI::EventParams &e) {
|
||||
g_Config.ClearRecentIsos();
|
||||
OnRecentChanged.Trigger(e);
|
||||
return UI::EVENT_DONE;
|
||||
|
||||
+2
-2
@@ -193,9 +193,9 @@ private:
|
||||
UI::EventReturn OnGameSettings(UI::EventParams &e);
|
||||
};
|
||||
|
||||
class GridSettingsScreen : public PopupScreen {
|
||||
class GridSettingsPopupScreen : public PopupScreen {
|
||||
public:
|
||||
GridSettingsScreen(std::string_view label) : PopupScreen(label) {}
|
||||
GridSettingsPopupScreen(std::string_view label) : PopupScreen(label) {}
|
||||
void CreatePopupContents(UI::ViewGroup *parent) override;
|
||||
UI::Event OnRecentChanged;
|
||||
|
||||
|
||||
@@ -200,18 +200,18 @@ static void ExpandBezier(int &count, int op, const std::vector<SimpleVertex> &si
|
||||
output.count = 0;
|
||||
|
||||
ControlPoints cpoints;
|
||||
cpoints.pos = (Vec3f *)AllocateAlignedMemory(sizeof(Vec3f) * num_points, 16);
|
||||
cpoints.tex = (Vec2f *)AllocateAlignedMemory(sizeof(Vec2f) * num_points, 16);
|
||||
cpoints.col = (Vec4f *)AllocateAlignedMemory(sizeof(Vec4f) * num_points, 16);
|
||||
cpoints.pos = new Vec3f[num_points];
|
||||
cpoints.tex = new Vec2f[num_points];
|
||||
cpoints.col = new Vec4f[num_points];
|
||||
cpoints.Convert(points.data(), num_points);
|
||||
|
||||
surface.Init((int)generatedVerts.size());
|
||||
SoftwareTessellation(output, surface, gstate.vertType, cpoints);
|
||||
count = output.count;
|
||||
|
||||
FreeAlignedMemory(cpoints.pos);
|
||||
FreeAlignedMemory(cpoints.tex);
|
||||
FreeAlignedMemory(cpoints.col);
|
||||
delete [] cpoints.pos;
|
||||
delete [] cpoints.tex;
|
||||
delete [] cpoints.col;
|
||||
}
|
||||
|
||||
static void ExpandSpline(int &count, int op, const std::vector<SimpleVertex> &simpleVerts, const std::vector<u16> &indices, std::vector<SimpleVertex> &generatedVerts, std::vector<u16> &generatedInds) {
|
||||
|
||||
@@ -22,7 +22,7 @@ ItemDisabledStyleFg = "#808080FF"
|
||||
ItemDisabledStyleBg = "#C0C0C0FF"
|
||||
HeaderStyleFg = "#FFFFFFFF"
|
||||
InfoStyleFg = "#FFFFFFFF"
|
||||
InfoStyleBg = "#800080FF"
|
||||
InfoStyleBg = "#00000000"
|
||||
PopupStyleBg = "#FFFFAAFF"
|
||||
BackgroundColor = "#008080FF"
|
||||
UIAtlas = "../ui_atlas"
|
||||
Reference in new issue
Block a user