Merge pull request #19546 from hrydgard/more-fixes

More assorted fixes
This commit is contained in:
Henrik Rydgård authored and GitHub committed 2024-10-22 14:30:37 +02:00
commit 551b3a1121
27 files changed
+188 -74

No files matched your search

+74 -17
View File
@@ -37,27 +37,21 @@ inline bool isutf(char c) {
}
static const uint32_t offsetsFromUTF8[6] = {
0x00000000UL, 0x00003080UL, 0x000E2080UL,
0x03C82080UL, 0xFA082080UL, 0x82082080UL
0x00000000UL, 0x00003080UL, 0x000E2080UL,
0x03C82080UL, 0xFA082080UL, 0x82082080UL
};
static const uint8_t trailingBytesForUTF8[256] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5,
};
/* returns length of next utf-8 sequence */
int u8_seqlen(const char *s)
{
return trailingBytesForUTF8[(unsigned int)(unsigned char)s[0]] + 1;
}
/* conversions without error checking
only works for valid UTF-8, i.e. no 5- or 6-byte sequences
srcsz = source size in bytes, or -1 if 0-terminated
@@ -68,7 +62,7 @@ int u8_seqlen(const char *s)
for all the characters.
if sz = srcsz+1 (i.e. 4*srcsz+4 bytes), there will always be enough space.
*/
int u8_toucs(uint32_t *dest, int sz, const char *src, int srcsz)
int u8_toucs(uint32_t *dest, int sz, const char *src, int srcsz)
{
uint32_t ch;
const char *src_end = src + srcsz;
@@ -519,6 +513,69 @@ std::string CodepointToUTF8(uint32_t codePoint) {
return std::string(temp);
}
// Helper function to encode a Unicode code point into UTF-8, but doesn't support 4-byte output.
size_t encode_utf8_modified(uint32_t code_point, unsigned char* output) {
if (code_point <= 0x7F) {
output[0] = (unsigned char)code_point;
return 1;
} else if (code_point <= 0x7FF) {
output[0] = (unsigned char)(0xC0 | (code_point >> 6));
output[1] = (unsigned char)(0x80 | (code_point & 0x3F));
return 2;
} else if (code_point <= 0xFFFF) {
output[0] = (unsigned char)(0xE0 | (code_point >> 12));
output[1] = (unsigned char)(0x80 | ((code_point >> 6) & 0x3F));
output[2] = (unsigned char)(0x80 | (code_point & 0x3F));
return 3;
}
return 0;
}
// A function to convert regular UTF-8 to Java Modified UTF-8. Only used on Android.
// Written by ChatGPT and corrected and modified.
void ConvertUTF8ToJavaModifiedUTF8(std::string *output, std::string_view input) {
output->resize(input.size() * 6); // worst case: every character is encoded as 6 bytes
size_t out_idx = 0;
for (size_t i = 0; i < input.length(); ) {
unsigned char c = input[i];
if (c == 0) {
// Encode null character as 0xC0 0x80. TODO: We probably don't need to support this?
output[out_idx++] = (char)0xC0;
output[out_idx++] = (char)0x80;
i++;
} else if ((c & 0xF0) == 0xF0) { // 4-byte sequence (U+10000 to U+10FFFF)
// Decode the Unicode code point from the UTF-8 sequence
uint32_t code_point = ((input[i] & 0x07) << 18) |
((input[i + 1] & 0x3F) << 12) |
((input[i + 2] & 0x3F) << 6) |
(input[i + 3] & 0x3F);
// Convert to surrogate pair
uint16_t high_surrogate = ((code_point - 0x10000) / 0x400) + 0xD800;
uint16_t low_surrogate = ((code_point - 0x10000) % 0x400) + 0xDC00;
// Encode the surrogates in UTF-8
out_idx += encode_utf8_modified(high_surrogate, (unsigned char *)(output->data() + out_idx));
out_idx += encode_utf8_modified(low_surrogate, (unsigned char *)(output->data() + out_idx));
i += 4;
} else {
// Copy the other UTF-8 sequences (1-3 bytes)
size_t utf8_len = 1;
if ((c & 0xE0) == 0xC0) {
utf8_len = 2; // 2-byte sequence
} else if ((c & 0xF0) == 0xE0) {
utf8_len = 3; // 3-byte sequence
}
memcpy(output->data() + out_idx, input.data() + i, utf8_len);
out_idx += utf8_len;
i += utf8_len;
}
}
output->resize(out_idx);
_dbg_assert_(output->size() >= input.size());
}
#ifndef _WIN32
// Replacements for the Win32 wstring functions. Not to be used from emulation code!
+4
View File
@@ -126,3 +126,7 @@ std::string ConvertUCS2ToUTF8(const std::u16string &wstr);
// Dest size in units, not bytes.
void ConvertUTF8ToUCS2(char16_t *dest, size_t destSize, std::string_view source);
std::u16string ConvertUTF8ToUCS2(std::string_view source);
// Java needs 4-byte UTF-8 to be converted to surrogate pairs, each component of which get
// encoded into 3-byte UTF-8.
void ConvertUTF8ToJavaModifiedUTF8(std::string *output, std::string_view input);
+1
View File
@@ -895,6 +895,7 @@ private:
OpenGLTexture::OpenGLTexture(GLRenderManager *render, const TextureDesc &desc) : render_(render) {
_dbg_assert_(desc.format != Draw::DataFormat::UNDEFINED);
_dbg_assert_msg_(desc.width > 0 && desc.height > 0 && desc.depth > 0, "w: %d h: %d d: %d fmt: %s", desc.width, desc.height, desc.depth, DataFormatToString(desc.format));
_dbg_assert_(desc.width > 0 && desc.height > 0 && desc.depth > 0);
_dbg_assert_(desc.type != Draw::TextureType::UNKNOWN);
+14 -10
View File
@@ -1061,17 +1061,21 @@ void VulkanQueueRunner::PerformRenderPass(const VKRStep &step, VkCommandBuffer c
"expected %d sample count, got %d", fbSampleCount, graphicsPipeline->SampleCount());
}
if (!graphicsPipeline->pipeline[(size_t)rpType]) {
// NOTE: If render steps got merged, it can happen that, as they ended during recording,
// they didn't know their final render pass type so they created the wrong pipelines in EndCurRenderStep().
// Unfortunately I don't know if we can fix it in any more sensible place than here.
// Maybe a middle pass. But let's try to just block and compile here for now, this doesn't
// happen all that much.
graphicsPipeline->pipeline[(size_t)rpType] = Promise<VkPipeline>::CreateEmpty();
graphicsPipeline->Create(vulkan_, renderPass->Get(vulkan_, rpType, fbSampleCount), rpType, fbSampleCount, time_now_d(), -1);
}
VkPipeline pipeline;
VkPipeline pipeline = graphicsPipeline->pipeline[(size_t)rpType]->BlockUntilReady();
{
std::lock_guard<std::mutex> lock(graphicsPipeline->mutex_);
if (!graphicsPipeline->pipeline[(size_t)rpType]) {
// NOTE: If render steps got merged, it can happen that, as they ended during recording,
// they didn't know their final render pass type so they created the wrong pipelines in EndCurRenderStep().
// Unfortunately I don't know if we can fix it in any more sensible place than here.
// Maybe a middle pass. But let's try to just block and compile here for now, this doesn't
// happen all that much.
graphicsPipeline->pipeline[(size_t)rpType] = Promise<VkPipeline>::CreateEmpty();
graphicsPipeline->Create(vulkan_, renderPass->Get(vulkan_, rpType, fbSampleCount), rpType, fbSampleCount, time_now_d(), -1);
}
pipeline = graphicsPipeline->pipeline[(size_t)rpType]->BlockUntilReady();
}
if (pipeline != VK_NULL_HANDLE) {
vkCmdBindPipeline(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline);
+13 -10
View File
@@ -349,7 +349,7 @@ bool VulkanRenderManager::CreateBackbuffers() {
void VulkanRenderManager::StartThreads() {
{
std::unique_lock<std::mutex> lock(compileMutex_);
std::unique_lock<std::mutex> lock(compileQueueMutex_);
_assert_(compileQueue_.empty());
}
@@ -370,6 +370,8 @@ void VulkanRenderManager::StartThreads() {
// Called from main thread.
void VulkanRenderManager::StopThreads() {
// Make sure we don't have an open render pass.
EndCurRenderStep();
// Not sure this is a sensible check - should be ok even if not.
// _dbg_assert_(steps_.empty());
@@ -395,7 +397,7 @@ void VulkanRenderManager::StopThreads() {
}
{
std::unique_lock<std::mutex> lock(compileMutex_);
std::unique_lock<std::mutex> lock(compileQueueMutex_);
runCompileThread_ = false; // Compiler and present thread both look at this bool.
_assert_(compileThread_.joinable());
compileCond_.notify_one();
@@ -410,7 +412,7 @@ void VulkanRenderManager::StopThreads() {
CreateMultiPipelinesTask::WaitForAll();
{
std::unique_lock<std::mutex> lock(compileMutex_);
std::unique_lock<std::mutex> lock(compileQueueMutex_);
_assert_(compileQueue_.empty());
}
}
@@ -425,7 +427,7 @@ void VulkanRenderManager::DestroyBackbuffers() {
void VulkanRenderManager::CheckNothingPending() {
_assert_(pipelinesToCheck_.empty());
{
std::unique_lock<std::mutex> lock(compileMutex_);
std::unique_lock<std::mutex> lock(compileQueueMutex_);
_assert_(compileQueue_.empty());
}
}
@@ -434,7 +436,7 @@ VulkanRenderManager::~VulkanRenderManager() {
INFO_LOG(Log::G3D, "VulkanRenderManager destructor");
{
std::unique_lock<std::mutex> lock(compileMutex_);
std::unique_lock<std::mutex> lock(compileQueueMutex_);
_assert_(compileQueue_.empty());
}
@@ -462,7 +464,7 @@ void VulkanRenderManager::CompileThreadFunc() {
bool exitAfterCompile = false;
std::vector<CompileQueueEntry> toCompile;
{
std::unique_lock<std::mutex> lock(compileMutex_);
std::unique_lock<std::mutex> lock(compileQueueMutex_);
while (compileQueue_.empty() && runCompileThread_) {
compileCond_.wait(lock);
}
@@ -521,7 +523,7 @@ void VulkanRenderManager::CompileThreadFunc() {
sleep_ms(1);
}
std::unique_lock<std::mutex> lock(compileMutex_);
std::unique_lock<std::mutex> lock(compileQueueMutex_);
_assert_(compileQueue_.empty());
}
@@ -794,7 +796,7 @@ VKRGraphicsPipeline *VulkanRenderManager::CreateGraphicsPipeline(VKRGraphicsPipe
VKRRenderPassStoreAction::STORE, VKRRenderPassStoreAction::DONT_CARE, VKRRenderPassStoreAction::DONT_CARE,
};
VKRRenderPass *compatibleRenderPass = queueRunner_.GetRenderPass(key);
std::unique_lock<std::mutex> lock(compileMutex_);
std::unique_lock<std::mutex> lock(compileQueueMutex_);
bool needsCompile = false;
for (size_t i = 0; i < (size_t)RenderPassType::TYPE_COUNT; i++) {
if (!(variantBitmask & (1 << i)))
@@ -865,13 +867,14 @@ void VulkanRenderManager::EndCurRenderStep() {
VkSampleCountFlagBits sampleCount = curRenderStep_->render.framebuffer ? curRenderStep_->render.framebuffer->sampleCount : VK_SAMPLE_COUNT_1_BIT;
compileMutex_.lock();
compileQueueMutex_.lock();
bool needsCompile = false;
for (VKRGraphicsPipeline *pipeline : pipelinesToCheck_) {
if (!pipeline) {
// Not good, but let's try not to crash.
continue;
}
std::lock_guard<std::mutex> lock(pipeline->mutex_);
if (!pipeline->pipeline[(size_t)rpType]) {
pipeline->pipeline[(size_t)rpType] = Promise<VkPipeline>::CreateEmpty();
_assert_(renderPass);
@@ -881,7 +884,7 @@ void VulkanRenderManager::EndCurRenderStep() {
}
if (needsCompile)
compileCond_.notify_one();
compileMutex_.unlock();
compileQueueMutex_.unlock();
pipelinesToCheck_.clear();
// We don't do this optimization for very small targets, probably not worth it.
+4 -4
View File
@@ -137,11 +137,11 @@ struct VKRGraphicsPipeline {
VKRGraphicsPipelineDesc *desc = nullptr;
Promise<VkPipeline> *pipeline[(size_t)RenderPassType::TYPE_COUNT]{};
std::mutex mutex_; // protects the pipeline array
VkSampleCountFlagBits SampleCount() const { return sampleCount_; }
const char *Tag() const { return tag_.c_str(); }
private:
void DestroyVariantsInstant(VkDevice device);
@@ -285,9 +285,9 @@ public:
void ReportBadStateForDraw();
void NudgeCompilerThread() {
compileMutex_.lock();
compileQueueMutex_.lock();
compileCond_.notify_one();
compileMutex_.unlock();
compileQueueMutex_.unlock();
}
void AssertInRenderPass() const {
@@ -615,7 +615,7 @@ private:
std::thread compileThread_;
// Sync
std::condition_variable compileCond_;
std::mutex compileMutex_;
std::mutex compileQueueMutex_;
std::vector<CompileQueueEntry> compileQueue_;
// Thread for measuring presentation delay.
+3 -3
View File
@@ -40,7 +40,7 @@
// Compatibility wrappers making ARM64 NEON code run on ARM32
// With optimization on, these should compile down to the optimal code.
inline float32x4_t vmulq_laneq_f32(float32x4_t a, float32x4_t b, int lane) {
static inline float32x4_t vmulq_laneq_f32(float32x4_t a, float32x4_t b, int lane) {
switch (lane & 3) {
case 0: return vmulq_lane_f32(a, vget_low_f32(b), 0);
case 1: return vmulq_lane_f32(a, vget_low_f32(b), 1);
@@ -49,7 +49,7 @@ inline float32x4_t vmulq_laneq_f32(float32x4_t a, float32x4_t b, int lane) {
}
}
inline float32x4_t vmlaq_laneq_f32(float32x4_t a, float32x4_t b, float32x4_t c, int lane) {
static inline float32x4_t vmlaq_laneq_f32(float32x4_t a, float32x4_t b, float32x4_t c, int lane) {
switch (lane & 3) {
case 0: return vmlaq_lane_f32(a, b, vget_low_f32(c), 0);
case 1: return vmlaq_lane_f32(a, b, vget_low_f32(c), 1);
@@ -58,7 +58,7 @@ inline float32x4_t vmlaq_laneq_f32(float32x4_t a, float32x4_t b, float32x4_t c,
}
}
inline uint32x4_t vcgezq_f32(float32x4_t v) {
static inline uint32x4_t vcgezq_f32(float32x4_t v) {
return vcgeq_f32(v, vdupq_n_f32(0.0f));
}
+2 -2
View File
@@ -123,8 +123,8 @@ void TextDrawer::DrawString(DrawBuffer &target, std::string_view str, float x, f
void TextDrawer::MeasureString(std::string_view str, float *w, float *h) {
if (str.empty()) {
*w = 0.0;
*h = 0.0;
*w = 0.0f;
*h = 0.0f;
return;
}
+14 -6
View File
@@ -83,15 +83,18 @@ void TextDrawerAndroid::MeasureStringInternal(std::string_view str, float *w, fl
} else {
ERROR_LOG(Log::G3D, "Missing font");
}
std::string text(str);
std::string text;
ConvertUTF8ToJavaModifiedUTF8(&text, str);
auto env = getEnv();
// Unfortunate that we can't create a jstr from a std::string_view directly.
jstring jstr = env->NewStringUTF(text.c_str());
uint32_t size = env->CallStaticIntMethod(cls_textRenderer, method_measureText, jstr, scaledSize);
env->DeleteLocalRef(jstr);
*w = (size >> 16);
*h = (size & 0xFFFF);
*w = (float)(size >> 16);
*h = (float)(size & 0xFFFF);
WARN_LOG(Log::G3D, "Measure Modified: '%.*s' size: %fx%f", (int)text.length(), text.data(), *w, *h);
}
bool TextDrawerAndroid::DrawStringBitmap(std::vector<uint8_t> &bitmapData, TextStringEntry &entry, Draw::DataFormat texFormat, std::string_view str, int align, bool fullColor) {
@@ -100,7 +103,7 @@ bool TextDrawerAndroid::DrawStringBitmap(std::vector<uint8_t> &bitmapData, TextS
return false;
}
double size = 0.0;
float size = 0.0f;
auto iter = fontMap_.find(fontHash_);
if (iter != fontMap_.end()) {
size = iter->second.size;
@@ -109,7 +112,11 @@ bool TextDrawerAndroid::DrawStringBitmap(std::vector<uint8_t> &bitmapData, TextS
}
auto env = getEnv();
jstring jstr = env->NewStringUTF(std::string(str).c_str());
std::string text;
ConvertUTF8ToJavaModifiedUTF8(&text, str);
jstring jstr = env->NewStringUTF(text.c_str());
uint32_t textSize = env->CallStaticIntMethod(cls_textRenderer, method_measureText, jstr, size);
int imageWidth = (short)(textSize >> 16);
int imageHeight = (short)(textSize & 0xFFFF);
@@ -117,6 +124,7 @@ bool TextDrawerAndroid::DrawStringBitmap(std::vector<uint8_t> &bitmapData, TextS
imageWidth = 1;
if (imageHeight <= 0)
imageHeight = 1;
WARN_LOG(Log::G3D, "Text: '%.*s' (%02x)", (int)str.length(), str.data(), str[0]);
jintArray imageData = (jintArray)env->CallStaticObjectMethod(cls_textRenderer, method_renderText, jstr, size);
env->DeleteLocalRef(jstr);
+1 -1
View File
@@ -10,7 +10,7 @@
#include <jni.h>
struct AndroidFontEntry {
double size;
float size;
};
class TextDrawerAndroid : public TextDrawer {
-1
View File
@@ -151,7 +151,6 @@ bool TextDrawerWin32::DrawStringBitmap(std::vector<uint8_t> &bitmapData, TextStr
bitmapData.clear();
return false;
}
std::wstring wstr = ConvertUTF8ToWString(ReplaceAll(str, "\n", "\r\n"));
auto iter = fontMap_.find(fontHash_);
+10
View File
@@ -100,6 +100,16 @@ bool containsNoCase(std::string_view haystack, std::string_view needle) {
return found != haystack.end();
}
int countChar(std::string_view haystack, char needle) {
int count = 0;
for (int i = 0; i < haystack.size(); i++) {
if (haystack[i] == needle) {
count++;
}
}
return count;
}
bool CharArrayFromFormatV(char* out, int outsize, const char* format, va_list args)
{
int writtenCount = vsnprintf(out, outsize, format, args);
+2
View File
@@ -85,6 +85,8 @@ std::string_view StripQuotes(std::string_view s);
std::string_view StripPrefix(std::string_view prefix, std::string_view s);
int countChar(std::string_view haystack, char needle);
// NOTE: str must live at least as long as all uses of output.
void SplitString(std::string_view str, const char delim, std::vector<std::string_view> &output);
// Try to avoid this when possible, in favor of the string_view version.
+1 -1
View File
@@ -714,7 +714,7 @@ static const ConfigSetting soundSettings[] = {
ConfigSetting("AutoAudioDevice", &g_Config.bAutoAudioDevice, true, CfgFlag::DEFAULT),
ConfigSetting("AudioMixWithOthers", &g_Config.bAudioMixWithOthers, true, CfgFlag::DEFAULT),
ConfigSetting("AudioRespectSilentMode", &g_Config.bAudioRespectSilentMode, false, CfgFlag::DEFAULT),
ConfigSetting("UseNewAtrac", &g_Config.bUseNewAtrac, false, CfgFlag::DEFAULT),
ConfigSetting("UseExperimentalAtrac", &g_Config.bUseExperimentalAtrac, false, CfgFlag::DONT_SAVE),
};
static bool DefaultShowTouchControls() {
+1 -1
View File
@@ -280,7 +280,7 @@ public:
bool bExtraAudioBuffering; // For bluetooth
std::string sAudioDevice;
bool bAutoAudioDevice;
bool bUseNewAtrac;
bool bUseExperimentalAtrac;
// iOS only for now
bool bAudioMixWithOthers;
+4 -7
View File
@@ -209,12 +209,9 @@ void SaveFileInfo::DoState(PointerWrap &p)
SavedataParam::SavedataParam() { }
void SavedataParam::Init()
{
if (!pspFileSystem.GetFileInfo(savePath).exists)
{
pspFileSystem.MkDir(savePath);
}
void SavedataParam::Init() {
// If the folder already exists, this is a no-op.
pspFileSystem.MkDir(savePath);
// Create a nomedia file to hide save icons form Android image viewer
#if PPSSPP_PLATFORM(ANDROID)
int handle = pspFileSystem.OpenFile(savePath + ".nomedia", (FileAccess)(FILEACCESS_CREATE | FILEACCESS_WRITE), 0);
@@ -459,7 +456,7 @@ int SavedataParam::Save(SceUtilitySavedataParam* param, const std::string &saveD
}
}
u8* cryptedData = 0;
u8* cryptedData = nullptr;
int cryptedSize = 0;
u8 cryptedHash[0x10]{};
// Encrypt save.
+1 -1
View File
@@ -138,7 +138,7 @@ void __AtracDoState(PointerWrap &p) {
}
static AtracBase *allocAtrac(bool forceOld = false) {
if (g_Config.bUseNewAtrac && !forceOld) {
if (g_Config.bUseExperimentalAtrac && !forceOld) {
return new Atrac2();
} else {
return new Atrac();
+7
View File
@@ -657,6 +657,13 @@ void SoftGPU::CopyDisplayToOutput(bool reallyDirty) {
MarkDirty(displayFramebuf_, displayStride_, 272, displayFormat_, SoftGPUVRAMDirty::CLEAR);
}
void SoftGPU::BeginHostFrame() {
GPUCommon::BeginHostFrame();
if (presentation_) {
presentation_->BeginFrame();
}
}
bool SoftGPU::PresentedThisFrame() const {
return presentation_->PresentedThisFrame();
}
+1
View File
@@ -209,6 +209,7 @@ public:
typedef void (SoftGPU::*CmdFunc)(u32 op, u32 diff);
void BeginHostFrame() override;
bool PresentedThisFrame() const override;
protected:
+1 -1
View File
@@ -343,7 +343,7 @@ UI::EventReturn ControlMappingScreen::OnAutoConfigure(UI::EventParams &params) {
}
void ControlMappingScreen::dialogFinished(const Screen *dialog, DialogResult result) {
if (result == DR_OK && std::string(dialog->tag()) == "listpopup") {
if (result == DR_OK && !strcmp(dialog->tag(), "listpopup")) {
UI::ListPopupScreen *popup = (UI::ListPopupScreen *)dialog;
KeyMap::AutoConfForPad(popup->GetChoiceString());
}
+2
View File
@@ -384,6 +384,8 @@ LogLevelScreen::LogLevelScreen(std::string_view title) : ListPopupScreen(title)
list.push_back(logLevelList[i]);
}
adaptor_ = UI::StringVectorListAdaptor(list, -1);
// CreateViews takes care of, well, that.
}
void LogLevelScreen::OnCompleted(DialogResult result) {
+8 -3
View File
@@ -1281,14 +1281,16 @@ bool EmuScreen::checkPowerDown() {
}
if (coreState == CORE_POWERDOWN && !PSP_IsIniting() && !PSP_IsRebooting()) {
bool shutdown = false;
if (PSP_IsInited()) {
PSP_Shutdown();
shutdown = true;
}
INFO_LOG(Log::System, "SELF-POWERDOWN!");
screenManager()->switchScreen(new MainScreen());
bootPending_ = false;
invalid_ = true;
return true;
return shutdown;
}
return false;
}
@@ -1513,12 +1515,13 @@ ScreenRenderFlags EmuScreen::render(ScreenRenderMode mode) {
draw->BindFramebufferAsRenderTarget(nullptr, { RPAction::CLEAR, RPAction::CLEAR, RPAction::CLEAR, clearColor }, "EmuScreen_NoFrame");
draw->SetViewport(viewport);
draw->SetScissorRect(0, 0, g_display.pixel_xres, g_display.pixel_yres);
framebufferBound = true;
}
Draw::BackendState state = draw->GetCurrentBackendState();
// We allow if !state.valid, that means it's not the Vulkan backend.
_assert_msg_(!state.valid || state.passes >= 1, "skipB: %d sw: %d mode: %d back: %d", (int)skipBufferEffects, (int)g_Config.bSoftwareRendering, mode, (int)g_Config.iGPUBackend);
_assert_msg_(!state.valid || state.passes >= 1, "skipB: %d sw: %d mode: %d back: %d", (int)skipBufferEffects, (int)g_Config.bSoftwareRendering, (int)mode, (int)g_Config.iGPUBackend);
screenManager()->getUIContext()->BeginFrame();
@@ -1533,7 +1536,9 @@ ScreenRenderFlags EmuScreen::render(ScreenRenderMode mode) {
}
// NOTE: We don't check for powerdown if we're not the top screen.
checkPowerDown();
if (checkPowerDown()) {
draw->BindFramebufferAsRenderTarget(nullptr, { RPAction::CLEAR, RPAction::CLEAR, RPAction::CLEAR, clearColor }, "EmuScreen_PowerDown");
}
if (hasVisibleUI()) {
draw->SetViewport(viewport);
+1 -1
View File
@@ -1842,7 +1842,7 @@ void DeveloperToolsScreen::CreateViews() {
cpuTests->SetEnabled(TestsAvailable());
#endif
list->Add(new CheckBox(&g_Config.bUseNewAtrac, dev->T("Use experimental sceAtrac")));
// list->Add(new CheckBox(&g_Config.bUseExperimentalAtrac, dev->T("Use experimental sceAtrac")));
AddOverlayList(list, screenManager());
+13 -2
View File
@@ -1251,8 +1251,19 @@ void MainScreen::CreateViews() {
rightColumnItems->SetSpacing(0.0f);
rightColumn->Add(rightColumnItems);
char versionString[256];
snprintf(versionString, sizeof(versionString), "%s", PPSSPP_GIT_VERSION);
std::string versionString = PPSSPP_GIT_VERSION;
// Strip the 'v' from the displayed version, and shorten the commit hash.
if (versionString.size() > 2) {
if (versionString[0] == 'v' && isdigit(versionString[1])) {
versionString = versionString.substr(1);
}
if (countChar(versionString, '-') == 2) {
// Shorten the commit hash.
size_t cutPos = versionString.find_last_of('-') + 8;
versionString = versionString.substr(0, std::min(cutPos, versionString.size()));
}
}
rightColumnItems->SetSpacing(0.0f);
AnchorLayout *logos = new AnchorLayout(new AnchorLayoutParams(FILL_PARENT, 60.0f, false));
if (System_GetPropertyBool(SYSPROP_APP_GOLD)) {
+2 -2
View File
@@ -202,9 +202,9 @@ HRESULT ReaderCallback::OnReadSample(
// Mirror the image in-place if needed.
if (g_Config.bCameraMirrorHorizontal) {
for (int y = 0; y < dstH; y++) {
for (int y = 0; y < (int)dstH; y++) {
uint8_t *line = device->imageRGB + y * device->imgRGBLineSizes[0];
for (int x = 0; x < dstW / 2; x++) {
for (int x = 0; x < (int)dstW / 2; x++) {
const int invX = dstW - 1 - x;
const uint8_t r = line[x * 3 + 0];
const uint8_t g = line[x * 3 + 1];
+3
View File
@@ -473,6 +473,9 @@ ULES00703 = true
ULJM05940 = true
NPJH50794 = true
# Cave Story (homebrew)
CAVE00992 = true
# TODO: There are many more.
[RequireBlockTransfer]
+1 -1
View File
@@ -501,7 +501,7 @@ int main(int argc, const char* argv[])
g_Config.iGlobalVolume = VOLUME_FULL;
g_Config.iReverbVolume = VOLUME_FULL;
g_Config.internalDataDirectory.clear();
g_Config.bUseNewAtrac = newAtrac;
g_Config.bUseExperimentalAtrac = newAtrac;
Path exePath = File::GetExeDirectory();
g_Config.flash0Directory = exePath / "assets/flash0";