Files
Adrian "asie" Siekierka 5bb64aacf0 WS: Initial Pocket Challenge V2 support (#95)
The Pocket Challenge V2 is an education handheld based on the ASWAN SoC, as used in the WonderSwan. It uses the same boot ROM (with an early exit), but has some implementation changes:

    The LCD icon segment area is not present (on the display panel only).
    There is no onboard internal EEPROM.
    The input keypad layout differs.
    The headphone output is always used with a custom onboard DAC, as opposed to relying on the SoC's own PWM DAC for the internal speaker.

This PR implements support for all of this. Support for the PCv2-exclusive cartridge mapper (KARNAK) will be added by a separate PR.
2026-05-17 01:11:02 +09:00

60 lines
1.4 KiB
C#

using Mesen.Config;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Mesen.Utilities
{
public static class FolderHelper
{
private static HashSet<string> _romExtensions = new HashSet<string>() {
".sfc", ".smc", ".fig", ".swc", ".bs", ".st",
".gb", ".gbc", ".gbx",
".nes", ".unif", ".unf", ".fds", ".qd", ".studybox",
".pce", ".sgx", ".cue",
".sms", ".gg", ".sg", ".col",
".gba",
".ws", ".wsc", ".pc2"
};
public static bool IsRomFile(string path)
{
string ext = Path.GetExtension(path).ToLower();
return _romExtensions.Contains(ext);
}
public static bool IsArchiveFile(string path)
{
string ext = Path.GetExtension(path).ToLower();
return ext == ".7z" || ext == ".zip";
}
public static bool CheckFolderPermissions(string folder, bool checkWritePermission = true)
{
if(!Directory.Exists(folder)) {
try {
if(string.IsNullOrWhiteSpace(folder)) {
return false;
}
Directory.CreateDirectory(folder);
} catch {
return false;
}
}
if(checkWritePermission) {
try {
string fileName = Guid.NewGuid().ToString() + ".txt";
File.WriteAllText(Path.Combine(folder, fileName), "");
File.Delete(Path.Combine(folder, fileName));
} catch {
return false;
}
}
return true;
}
}
}