X Tutup
Skip to content

TESTBED: Small Improvements & Bugfixes#6605

Merged
bluegr merged 4 commits intoscummvm:masterfrom
chkuendig:testbed
May 25, 2025
Merged

TESTBED: Small Improvements & Bugfixes#6605
bluegr merged 4 commits intoscummvm:masterfrom
chkuendig:testbed

Conversation

@chkuendig
Copy link
Member

@chkuendig chkuendig commented May 9, 2025

@sev-
Copy link
Member

sev- commented May 9, 2025

Please fix code formatting

@chkuendig
Copy link
Member Author

Sorry missed the formatting issues. Fixed now (and I also fixed some older formatting issues in the same files)

@scummvm scummvm locked as spam and limited conversation to collaborators May 10, 2025
@scummvm scummvm deleted a comment May 10, 2025
@scummvm scummvm deleted a comment May 10, 2025
@scummvm scummvm deleted a comment May 10, 2025
@scummvm scummvm deleted a comment May 10, 2025
@scummvm scummvm deleted a comment May 10, 2025
@scummvm scummvm deleted a comment May 10, 2025
@scummvm scummvm deleted a comment May 10, 2025
@scummvm scummvm deleted a comment May 10, 2025
@scummvm scummvm deleted a comment May 10, 2025
@scummvm scummvm deleted a comment May 10, 2025
@scummvm scummvm deleted a comment May 10, 2025
@scummvm scummvm deleted a comment May 10, 2025
@scummvm scummvm deleted a comment May 10, 2025
@scummvm scummvm deleted a comment May 10, 2025
@scummvm scummvm unlocked this conversation May 11, 2025
@bluegr
Copy link
Member

bluegr commented May 14, 2025

Support opening logfile in Emscripten: This is similar to the screenshot export from #5587. I added a button to download the log file:

Would it be possible to have this button in desktop builds too, which would open the log file with the default system text editor?

@chkuendig
Copy link
Member Author

chkuendig commented May 14, 2025

I havent seen any comparable function to open files on the host system in OSystem or any specific backend. The reason I added this to Emscripten was because theres no good way to access the filesystem (intially needed for screenshots), but in theory this could work everywhere if we feel its worth implementing for each backend. Probably should be added as an optional feature to OSystem.

PS: I wonder how the mobile platforms solve this, its not that easy to access the filesystem there either.

@bluegr
Copy link
Member

bluegr commented May 17, 2025

I havent seen any comparable function to open files on the host system in OSystem or any specific backend. The reason I added this to Emscripten was because theres no good way to access the filesystem (intially needed for screenshots), but in theory this could work everywhere if we feel its worth implementing for each backend. Probably should be added as an optional feature to OSystem.

PS: I wonder how the mobile platforms solve this, its not that easy to access the filesystem there either.

We do have displayLogFile(), a function called to open our default log file in the system's default text editor.

This function is implemented in some of our backends (including Emscripten).

Perhaps we could override the log file name that is opened by this function?

@chkuendig
Copy link
Member Author

chkuendig commented May 18, 2025

I added a feature to this effect. There's now also displayFile which let's you open any arbitrary file. I did not want to limit myself to log files, as in Emscripten I already need something to open screenshots and I imagine other platforms also having a use for that.

edit: I'll fix the typos breaking CI later today

@chkuendig chkuendig force-pushed the testbed branch 3 times, most recently from 9ec5f4b to f2b85e7 Compare May 18, 2025 07:31
@chkuendig chkuendig force-pushed the testbed branch 2 times, most recently from 5426a91 to 089bf98 Compare May 18, 2025 12:22
Comment on lines +57 to +59
#ifdef EMSCRIPTEN
g_system->delayMillis(10);
#endif
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we do this on all platforms, not just Emscripten?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so. This is a quirk of single-threaded webassembly. Without threads, everything runs in the JavaScript event loop. Having a loop such as the above blocks this event loop with the result that no I/O can happen and the page freezes.

I don't think other platforms have this issue.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have other single thread platforms which could benefit from it.
In addition, on desktop platforms, not having this call makes a high CPU usage because the loop never pauses.

Any event loop should have such call. So this should be unguarded.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the clarification, I unguarded it.

Comment on lines +57 to +59
#ifdef EMSCRIPTEN
#include "backends/platform/sdl/emscripten/emscripten.h"
#endif
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like it can be removed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot to add removing this to the commit introducing the arbitrary file open method in OSystem. I have since reverted that commit, so this is needed again.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's gone now again as I removed all backend-specific code.

@chkuendig
Copy link
Member Author

@bluegr after the discussion on discord I removed cfda843. I think for now it's probably easier to keep this button limited to Emscripten and later add functionality to open such files on any platform properly:

if this “open file” is to be generalized, it should actually also be implemented in other backends (e.g. share sheet in iOS/Android) and use cases (screenshots maybe). theres no point generalizing in advance.
unless its the default logfile or a screenshot, “desktop backends” (macOS, Linux, Windows) with access to the whole system FS (no app isolation) should open the containing folder, not launch any arbitrary file.

@bluegr bluegr closed this May 23, 2025
@bluegr bluegr reopened this May 23, 2025
@bluegr
Copy link
Member

bluegr commented May 23, 2025

@chkuendig We discussed about implementing the log file reading functionality in the UI, instead of making it backend-specific.

We do display the main logfile in the options GUI. It would be preferable to use a single implementation this way, instead of something that's only available to a single backend

@chkuendig
Copy link
Member Author

@bluegr I adjusted it accordingly.

@bluegr
Copy link
Member

bluegr commented May 25, 2025

@chkuendig Excellent work! Thanks for addressing all issues

Squashing

@bluegr bluegr merged commit e1e3ff0 into scummvm:master May 25, 2025
8 checks passed
@chkuendig chkuendig deleted the testbed branch August 4, 2025 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

X Tutup