Merge pull request #19547 from hrydgard/even-more-fixes

Improve some asserts, minor fixes (theme, warnings)
This commit is contained in:
Henrik Rydgård authored and GitHub committed 2024-10-23 00:45:30 +02:00
commit 7279d18d7e
20 files changed
+73 -66

No files matched your search

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