Merge pull request #19466 from hrydgard/misc-changes

Fix crash in reporting functionality, some other minor changes
This commit is contained in:
Henrik Rydgård authored and GitHub committed 2024-09-17 12:59:52 +02:00
commit 496ccfe7ba
6 files changed
+33 -16

No files matched your search

+1
View File
@@ -185,6 +185,7 @@ ScreenRenderFlags ScreenManager::render() {
Screen *coveringScreen = nullptr;
Screen *foundBackgroundScreen = nullptr;
bool first = true;
do {
--iter;
ScreenRenderRole role = iter->screen->renderRole(first);
+3
View File
@@ -292,12 +292,14 @@ void MetaFileSystem::Mount(const std::string &prefix, std::shared_ptr<IFileSyste
fileSystems.push_back(x);
}
// Assumes the lock is held
void MetaFileSystem::UnmountAll() {
fileSystems.clear();
currentDir.clear();
}
void MetaFileSystem::Unmount(const std::string &prefix) {
std::lock_guard<std::recursive_mutex> guard(lock);
for (auto iter = fileSystems.begin(); iter != fileSystems.end(); iter++) {
if (iter->prefix == prefix) {
fileSystems.erase(iter);
@@ -325,6 +327,7 @@ IFileSystem *MetaFileSystem::GetSystemFromFilename(const std::string &filename)
}
IFileSystem *MetaFileSystem::GetSystem(const std::string &prefix) {
std::lock_guard<std::recursive_mutex> guard(lock);
for (auto it = fileSystems.begin(); it != fileSystems.end(); ++it) {
if (it->prefix == NormalizePrefix(prefix))
return it->system.get();
+2 -1
View File
@@ -43,8 +43,9 @@ private:
currentDir_t currentDir;
std::string startingDirectory;
std::recursive_mutex lock; // must be recursive
std::recursive_mutex lock; // must be recursive. TODO: fix that
// Assumes the lock is held
void Reset() {
// This used to be 6, probably an attempt to replicate PSP handles.
// However, that's an artifact of using psplink anyway...
+6 -4
View File
@@ -2403,10 +2403,13 @@ static u32 sceKernelUnloadModule(u32 moduleId)
u32 hleKernelStopUnloadSelfModuleWithOrWithoutStatus(u32 exitCode, u32 argSize, u32 argp, u32 statusAddr, u32 optionAddr, bool WithStatus) {
if (loadedModules.size() > 1) {
if (WithStatus)
if (WithStatus) {
ERROR_LOG_REPORT(Log::sceModule, "UNIMPL sceKernelStopUnloadSelfModuleWithStatus(%08x, %08x, %08x, %08x, %08x): game may have crashed", exitCode, argSize, argp, statusAddr, optionAddr);
else
ERROR_LOG_REPORT(Log::sceModule, "UNIMPL sceKernelSelfStopUnloadModule(%08x, %08x, %08x): game may have crashed", exitCode, argSize, argp);
} else {
// NOTE: The previous "may have crashed" message is not accurate, Splinter Cell Essentials uses this normally when leaving/entering in-game.
// We should not report this.
WARN_LOG(Log::sceModule, "sceKernelSelfStopUnloadModule(%08x, %08x, %08x)", exitCode, argSize, argp);
}
SceUID moduleID = __KernelGetCurThreadModuleId();
u32 priority = 0x20;
u32 stacksize = 0x40000;
@@ -2420,7 +2423,6 @@ u32 hleKernelStopUnloadSelfModuleWithOrWithoutStatus(u32 exitCode, u32 argSize,
ERROR_LOG(Log::sceModule, "sceKernelStopUnloadSelfModuleWithStatus(%08x, %08x, %08x, %08x, %08x): invalid module id", exitCode, argSize, argp, statusAddr, optionAddr);
else
ERROR_LOG(Log::sceModule, "sceKernelSelfStopUnloadModule(%08x, %08x, %08x): invalid module id", exitCode, argSize, argp);
return error;
}
+14 -9
View File
@@ -160,20 +160,20 @@ void CompatRatingChoice::SetupChoices() {
AddChoice(4, rp->T("Nothing"));
}
ReportScreen::ReportScreen(const Path &gamePath)
: UIDialogScreenWithGameBackground(gamePath) {
ReportScreen::ReportScreen(const Path &gamePath) // unused gamePath, after removing the background
: UIDialogScreen(), gamePath_(gamePath) {
enableReporting_ = Reporting::IsEnabled();
ratingEnabled_ = enableReporting_;
}
ScreenRenderFlags ReportScreen::render(ScreenRenderMode mode) {
ScreenRenderFlags flags = UIScreen::render(mode);
_dbg_assert_(mode & ScreenRenderMode::FIRST);
_dbg_assert_(mode & ScreenRenderMode::TOP);
if (mode & ScreenRenderMode::TOP) {
// We do this after render because we need it to be within the frame (so the screenshot works).
// We could do it mid frame, but then we have to reapply viewport/scissor.
if (!tookScreenshot_) {
if (!tookScreenshot_ && !g_Config.bSkipBufferEffects) {
Path path = GetSysDirectory(DIRECTORY_SCREENSHOT);
if (!File::Exists(path)) {
File::CreateDir(path);
@@ -189,6 +189,11 @@ ScreenRenderFlags ReportScreen::render(ScreenRenderMode mode) {
tookScreenshot_ = true;
}
}
// We take the screenshot first, then we start rendering.
// We are the only screen visible so this avoid starting and then trying to resume a backbuffer render pass.
ScreenRenderFlags flags = UIScreen::render(mode);
return flags;
}
@@ -200,12 +205,12 @@ void ReportScreen::update() {
screenshot_->SetVisibility(V_GONE);
}
}
UIDialogScreenWithGameBackground::update();
UIDialogScreen::update();
UpdateCRCInfo();
}
void ReportScreen::resized() {
UIDialogScreenWithGameBackground::resized();
UIDialogScreen::resized();
RecreateViews();
}
@@ -407,7 +412,7 @@ EventReturn ReportScreen::HandleShowCRC(EventParams &e) {
}
ReportFinishScreen::ReportFinishScreen(const Path &gamePath, ReportingOverallScore score)
: UIDialogScreenWithGameBackground(gamePath), score_(score) {
: UIDialogScreen(), gamePath_(gamePath), score_(score) {
}
void ReportFinishScreen::CreateViews() {
@@ -468,7 +473,7 @@ void ReportFinishScreen::update() {
}
}
UIDialogScreenWithGameBackground::update();
UIDialogScreen::update();
}
void ReportFinishScreen::ShowSuggestions() {
+7 -2
View File
@@ -33,12 +33,15 @@ enum class ReportingOverallScore : int {
INVALID = -1,
};
class ReportScreen : public UIDialogScreenWithGameBackground {
class ReportScreen : public UIDialogScreen {
public:
ReportScreen(const Path &gamePath);
const char *tag() const override { return "Report"; }
// For the screenshotting functionality to work.
ScreenRenderRole renderRole(bool isTop) const override { return ScreenRenderRole::MUST_BE_FIRST | ScreenRenderRole::CAN_BE_BACKGROUND; }
protected:
ScreenRenderFlags render(ScreenRenderMode mode) override;
void update() override;
@@ -60,6 +63,7 @@ protected:
UI::TextView *overallDescription_ = nullptr;
UI::TextView *crcInfo_ = nullptr;
UI::Choice *showCrcButton_ = nullptr;
Path gamePath_;
Path screenshotFilename_;
ReportingOverallScore overall_ = ReportingOverallScore::INVALID;
@@ -73,7 +77,7 @@ protected:
bool showCRC_ = false;
};
class ReportFinishScreen : public UIDialogScreenWithGameBackground {
class ReportFinishScreen : public UIDialogScreen {
public:
ReportFinishScreen(const Path &gamePath, ReportingOverallScore score);
@@ -88,6 +92,7 @@ protected:
UI::TextView *resultNotice_ = nullptr;
UI::LinearLayout *resultItems_ = nullptr;
Path gamePath_;
ReportingOverallScore score_;
bool setStatus_ = false;
};