higan-emu / higan

higan is a multi-system emulator focused on accuracy, preservation, and configurability.
Other
1.15k stars 111 forks source link

Write debug logs to the emulated system folder #95

Open Screwtapello opened 4 years ago

Screwtapello commented 4 years ago

higan's emulation cores can log when certain events occur. In the simple UI (byuu), these events are written to a log file beside the loaded ROM file, but in the complex UI they are written to a fixed location on disk:

https://github.com/higan-emu/higan/blob/8636045550955f0e65395b38b1c08871e53bf7cd/higan-ui/emulator/platform.cpp#L79-L86

That code fails to work on Windows (which doesn't have a /tmp directory) and it's a security vulnerability (writing to a predictable filename in a world-writable directory), so what we should do is write the logs to a subdirectory of the system folder. For example, if the user has created a "Super Famicom" console stored in ~/higan-ui/Super Famicom, the logs should probably go into ~/higan-ui/Super Famicom/logs.

I'm not actually sure how to get the path of the system folder from that part of the code, but hopefully it's not too difficult.

Kawa-oneechan commented 4 years ago

You're right, it should do what you're proposing.