mirror of
https://github.com/libretro/Mesen.git
synced 2025-02-24 18:41:48 +00:00
Debugging: Added command line flags to disable audio/video/input
This commit is contained in:
parent
1681669413
commit
1273eafa9b
@ -212,7 +212,7 @@ namespace Mesen.GUI.Forms
|
||||
}
|
||||
} else if(field.FieldType == typeof(string)) {
|
||||
combo.SelectedItem = value;
|
||||
if(combo.SelectedIndex < 0) {
|
||||
if(combo.SelectedIndex < 0 && combo.Items.Count > 0) {
|
||||
combo.SelectedIndex = 0;
|
||||
}
|
||||
}
|
||||
|
@ -37,10 +37,26 @@ namespace Mesen.GUI.Forms
|
||||
private object _loadRomLock = new object();
|
||||
private int _romLoadCounter = 0;
|
||||
|
||||
private bool _noAudio = false;
|
||||
private bool _noVideo = false;
|
||||
private bool _noInput = false;
|
||||
|
||||
public frmMain(string[] args)
|
||||
{
|
||||
if(args.Length > 0 && File.Exists(args[0])) {
|
||||
_romToLoad = args[0];
|
||||
var a = new List<string>();
|
||||
for(int i = 0; i < args.Length; i++) {
|
||||
a.Add(args[i].ToLowerInvariant());
|
||||
}
|
||||
_noVideo = a.Contains("/novideo");
|
||||
_noAudio = a.Contains("/noaudio");
|
||||
_noInput = a.Contains("/noinput");
|
||||
|
||||
if(args.Length > 0) {
|
||||
foreach(string arg in args) {
|
||||
if(File.Exists(arg)) {
|
||||
_romToLoad = args[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
InitializeComponent();
|
||||
@ -156,7 +172,7 @@ namespace Mesen.GUI.Forms
|
||||
|
||||
void InitializeEmu()
|
||||
{
|
||||
InteropEmu.InitializeEmu(ConfigManager.HomeFolder, this.Handle, this.ctrlRenderer.Handle);
|
||||
InteropEmu.InitializeEmu(ConfigManager.HomeFolder, this.Handle, this.ctrlRenderer.Handle, _noAudio, _noVideo, _noInput);
|
||||
foreach(RecentItem recentItem in ConfigManager.Config.RecentFiles) {
|
||||
InteropEmu.AddKnowGameFolder(Path.GetDirectoryName(recentItem.Path).ToLowerInvariant());
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ namespace Mesen.GUI
|
||||
|
||||
[DllImport(DLLPath, EntryPoint = "GetMesenVersion")] private static extern UInt32 GetMesenVersionWrapper();
|
||||
|
||||
[DllImport(DLLPath)] public static extern void InitializeEmu([MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(UTF8Marshaler))]string homeFolder, IntPtr windowHandle, IntPtr dxViewerHandle);
|
||||
[DllImport(DLLPath)] public static extern void InitializeEmu([MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(UTF8Marshaler))]string homeFolder, IntPtr windowHandle, IntPtr dxViewerHandle, [MarshalAs(UnmanagedType.I1)]bool noAudio, [MarshalAs(UnmanagedType.I1)]bool noVideo, [MarshalAs(UnmanagedType.I1)]bool noInput);
|
||||
[DllImport(DLLPath)] public static extern void Release();
|
||||
|
||||
[DllImport(DLLPath)] public static extern void SetDisplayLanguage(Language lang);
|
||||
|
@ -61,7 +61,7 @@ namespace InteropEmu {
|
||||
|
||||
DllExport uint32_t __stdcall GetMesenVersion() { return EmulationSettings::GetMesenVersion(); }
|
||||
|
||||
DllExport void __stdcall InitializeEmu(const char* homeFolder, HWND windowHandle, HWND dxViewerHandle)
|
||||
DllExport void __stdcall InitializeEmu(const char* homeFolder, HWND windowHandle, HWND dxViewerHandle, bool noAudio, bool noVideo, bool noInput)
|
||||
{
|
||||
FolderUtilities::SetHomeFolder(homeFolder);
|
||||
|
||||
@ -69,11 +69,18 @@ namespace InteropEmu {
|
||||
_windowHandle = windowHandle;
|
||||
_viewerHandle = dxViewerHandle;
|
||||
|
||||
_renderer = new NES::Renderer(_viewerHandle);
|
||||
_soundManager = new SoundManager(_windowHandle);
|
||||
_keyManager = new WindowsKeyManager(_windowHandle);
|
||||
if(!noVideo) {
|
||||
_renderer = new NES::Renderer(_viewerHandle);
|
||||
}
|
||||
|
||||
ControlManager::RegisterKeyManager(_keyManager);
|
||||
if(!noAudio) {
|
||||
_soundManager = new SoundManager(_windowHandle);
|
||||
}
|
||||
|
||||
if(!noInput) {
|
||||
_keyManager = new WindowsKeyManager(_windowHandle);
|
||||
ControlManager::RegisterKeyManager(_keyManager);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -107,7 +114,7 @@ namespace InteropEmu {
|
||||
|
||||
DllExport void __stdcall SetMousePosition(double x, double y) { ControlManager::SetMousePosition(x, y); }
|
||||
|
||||
DllExport void __stdcall UpdateInputDevices() { _keyManager->UpdateDevices(); }
|
||||
DllExport void __stdcall UpdateInputDevices() { if(_keyManager) { _keyManager->UpdateDevices(); } }
|
||||
DllExport uint32_t __stdcall GetPressedKey() { return ControlManager::GetPressedKey(); }
|
||||
DllExport const char* __stdcall GetKeyName(uint32_t keyCode)
|
||||
{
|
||||
@ -229,8 +236,15 @@ namespace InteropEmu {
|
||||
GameServer::StopServer();
|
||||
GameClient::Disconnect();
|
||||
MessageManager::RegisterMessageManager(nullptr);
|
||||
delete _renderer;
|
||||
delete _soundManager;
|
||||
|
||||
if(_renderer) {
|
||||
delete _renderer;
|
||||
_renderer = nullptr;
|
||||
}
|
||||
if(_soundManager) {
|
||||
delete _soundManager;
|
||||
_soundManager = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
DllExport void __stdcall TakeScreenshot() { VideoDecoder::GetInstance()->TakeScreenshot(); }
|
||||
@ -337,11 +351,11 @@ namespace InteropEmu {
|
||||
|
||||
DllExport const char* __stdcall GetAudioDevices()
|
||||
{
|
||||
_returnString = _soundManager->GetAvailableDevices();
|
||||
_returnString = _soundManager ? _soundManager->GetAvailableDevices() : "";
|
||||
return _returnString.c_str();
|
||||
}
|
||||
|
||||
DllExport void __stdcall SetAudioDevice(char* audioDevice) { _soundManager->SetAudioDevice(audioDevice); }
|
||||
DllExport void __stdcall SetAudioDevice(char* audioDevice) { if(_soundManager) { _soundManager->SetAudioDevice(audioDevice); } }
|
||||
|
||||
DllExport void __stdcall GetScreenSize(ScreenSize &size, bool ignoreScale) { VideoDecoder::GetInstance()->GetScreenSize(size, ignoreScale); }
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user