mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2024-11-14 21:37:42 -07:00
* emulation settings dialog
* proper setting for booting directly or from BIOS * fix shit, again
This commit is contained in:
parent
f88226c99f
commit
2db5b21760
@ -107,10 +107,13 @@
|
||||
<Unit filename="src/Wifi.h" />
|
||||
<Unit filename="src/types.h" />
|
||||
<Unit filename="src/version.h" />
|
||||
<Unit filename="src/wx/EmuConfig.cpp" />
|
||||
<Unit filename="src/wx/EmuConfig.h" />
|
||||
<Unit filename="src/wx/InputConfig.cpp" />
|
||||
<Unit filename="src/wx/InputConfig.h" />
|
||||
<Unit filename="src/wx/main.cpp" />
|
||||
<Unit filename="src/wx/main.h" />
|
||||
<Unit filename="src/wx/scancode_wx2sdl.h" />
|
||||
<Unit filename="xp.manifest" />
|
||||
<Extensions>
|
||||
<code_completion />
|
||||
|
74
src/wx/EmuConfig.cpp
Normal file
74
src/wx/EmuConfig.cpp
Normal file
@ -0,0 +1,74 @@
|
||||
/*
|
||||
Copyright 2016-2017 StapleButter
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
melonDS is free software: you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation, either version 3 of the License, or (at your option)
|
||||
any later version.
|
||||
|
||||
melonDS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with melonDS. If not, see http://www.gnu.org/licenses/.
|
||||
*/
|
||||
|
||||
#include "../types.h"
|
||||
#include "EmuConfig.h"
|
||||
#include "../Config.h"
|
||||
|
||||
|
||||
wxBEGIN_EVENT_TABLE(EmuConfigDialog, wxDialog)
|
||||
EVT_COMMAND(1001, wxEVT_BUTTON, EmuConfigDialog::OnOk)
|
||||
EVT_COMMAND(1002, wxEVT_BUTTON, EmuConfigDialog::OnCancel)
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
|
||||
EmuConfigDialog::EmuConfigDialog(wxWindow* parent)
|
||||
: wxDialog(parent, -1, "Emulation settings - melonDS")
|
||||
{
|
||||
wxBoxSizer* vboxmain = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
cbDirectBoot = new wxCheckBox(this, wxID_ANY, "Boot game directly");
|
||||
vboxmain->Add(cbDirectBoot, 0, wxALL&(~wxBOTTOM), 15);
|
||||
cbDirectBoot->SetValue(Config::DirectBoot != 0);
|
||||
|
||||
{
|
||||
wxPanel* p = new wxPanel(this);
|
||||
wxBoxSizer* sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
wxButton* ok = new wxButton(p, 1001, "OK");
|
||||
sizer->Add(ok);
|
||||
|
||||
wxButton* cancel = new wxButton(p, 1002, "Cancel");
|
||||
sizer->Add(3, 0);
|
||||
sizer->Add(cancel);
|
||||
|
||||
p->SetSizer(sizer);
|
||||
vboxmain->Add(p, 0, wxALL|wxALIGN_RIGHT, 15);
|
||||
}
|
||||
|
||||
SetSizer(vboxmain);
|
||||
Fit();
|
||||
}
|
||||
|
||||
EmuConfigDialog::~EmuConfigDialog()
|
||||
{
|
||||
}
|
||||
|
||||
void EmuConfigDialog::OnOk(wxCommandEvent& event)
|
||||
{
|
||||
Config::DirectBoot = cbDirectBoot->GetValue() ? 1:0;
|
||||
Config::Save();
|
||||
|
||||
Close();
|
||||
}
|
||||
|
||||
void EmuConfigDialog::OnCancel(wxCommandEvent& event)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
43
src/wx/EmuConfig.h
Normal file
43
src/wx/EmuConfig.h
Normal file
@ -0,0 +1,43 @@
|
||||
/*
|
||||
Copyright 2016-2017 StapleButter
|
||||
|
||||
This file is part of melonDS.
|
||||
|
||||
melonDS is free software: you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation, either version 3 of the License, or (at your option)
|
||||
any later version.
|
||||
|
||||
melonDS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with melonDS. If not, see http://www.gnu.org/licenses/.
|
||||
*/
|
||||
|
||||
#ifndef WX_EMUCONFIG_H
|
||||
#define WX_EMUCONFIG_H
|
||||
|
||||
#include <wx/wxprec.h>
|
||||
#ifndef WX_PRECOMP
|
||||
#include <wx/wx.h>
|
||||
#endif
|
||||
|
||||
class EmuConfigDialog : public wxDialog
|
||||
{
|
||||
public:
|
||||
EmuConfigDialog(wxWindow* parent);
|
||||
~EmuConfigDialog();
|
||||
|
||||
private:
|
||||
wxDECLARE_EVENT_TABLE();
|
||||
|
||||
void OnOk(wxCommandEvent& event);
|
||||
void OnCancel(wxCommandEvent& event);
|
||||
|
||||
wxCheckBox* cbDirectBoot;
|
||||
};
|
||||
|
||||
#endif // WX_EMUCONFIG_H
|
||||
|
@ -165,8 +165,6 @@ InputConfigDialog::InputConfigDialog(wxWindow* parent)
|
||||
polltimer = new wxTimer(this);
|
||||
pollid = 0;
|
||||
|
||||
keystate = SDL_GetKeyboardState(&nkeys);
|
||||
|
||||
njoys = SDL_NumJoysticks();
|
||||
if (njoys) joy = SDL_JoystickOpen(0);
|
||||
}
|
||||
@ -210,8 +208,27 @@ void InputConfigDialog::OnKeyDown(wxKeyEvent& event)
|
||||
pollbtn->Refresh();
|
||||
return;
|
||||
}
|
||||
else if ((code == SDL_SCANCODE_BACKSPACE) && (pollid >= 200))
|
||||
{
|
||||
id = pollid - 200;
|
||||
if (id >= 12) return;
|
||||
|
||||
if (pollid >= 200) return;
|
||||
joymapping[id] = -1;
|
||||
|
||||
char keyname[16];
|
||||
JoyMappingName(joymapping[id], keyname);
|
||||
pollbtn->SetLabel(keyname);
|
||||
|
||||
polltimer->Stop();
|
||||
pollid = 0;
|
||||
|
||||
pollbtn->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
|
||||
pollbtn->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNTEXT));
|
||||
pollbtn->Refresh();
|
||||
return;
|
||||
}
|
||||
|
||||
if (pollid >= 12) return;
|
||||
|
||||
keymapping[id] = code;
|
||||
|
||||
@ -272,23 +289,6 @@ void InputConfigDialog::OnPoll(wxTimerEvent& event)
|
||||
int id = pollid - 200;
|
||||
if (id >= 12) return;
|
||||
|
||||
if (keystate[SDL_SCANCODE_BACKSPACE])
|
||||
{
|
||||
joymapping[id] = -1;
|
||||
|
||||
char keyname[16];
|
||||
JoyMappingName(joymapping[id], keyname);
|
||||
pollbtn->SetLabel(keyname);
|
||||
|
||||
polltimer->Stop();
|
||||
pollid = 0;
|
||||
|
||||
pollbtn->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
|
||||
pollbtn->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNTEXT));
|
||||
pollbtn->Refresh();
|
||||
return;
|
||||
}
|
||||
|
||||
int nbuttons = SDL_JoystickNumButtons(joy);
|
||||
for (int i = 0; i < nbuttons; i++)
|
||||
{
|
||||
|
@ -48,8 +48,6 @@ private:
|
||||
|
||||
void JoyMappingName(int id, char* str);
|
||||
|
||||
const u8* keystate;
|
||||
int nkeys;
|
||||
int njoys;
|
||||
SDL_Joystick* joy;
|
||||
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "../GPU.h"
|
||||
|
||||
#include "InputConfig.h"
|
||||
#include "EmuConfig.h"
|
||||
|
||||
|
||||
wxIMPLEMENT_APP_NO_MAIN(wxApp_melonDS);
|
||||
@ -103,6 +104,7 @@ wxBEGIN_EVENT_TABLE(MainFrame, wxFrame)
|
||||
EVT_MENU(ID_PAUSE, MainFrame::OnPause)
|
||||
EVT_MENU(ID_RESET, MainFrame::OnReset)
|
||||
|
||||
EVT_MENU(ID_EMUCONFIG, MainFrame::OnEmuConfig)
|
||||
EVT_MENU(ID_INPUTCONFIG, MainFrame::OnInputConfig)
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
@ -122,6 +124,7 @@ MainFrame::MainFrame()
|
||||
systemmenu->Append(ID_RESET, "Reset");
|
||||
|
||||
wxMenu* settingsmenu = new wxMenu();
|
||||
settingsmenu->Append(ID_EMUCONFIG, "Emulation");
|
||||
settingsmenu->Append(ID_INPUTCONFIG, "Input");
|
||||
|
||||
wxMenuBar* melonbar = new wxMenuBar();
|
||||
@ -199,7 +202,7 @@ void MainFrame::OnOpenROM(wxCommandEvent& event)
|
||||
emuthread->EmuPause();
|
||||
|
||||
rompath = opener.GetPath();
|
||||
NDS::LoadROM(rompath.mb_str(), true);
|
||||
NDS::LoadROM(rompath.mb_str(), Config::DirectBoot);
|
||||
|
||||
emuthread->EmuRun();
|
||||
GetMenuBar()->Enable(ID_PAUSE, true);
|
||||
@ -259,7 +262,7 @@ void MainFrame::OnReset(wxCommandEvent& event)
|
||||
emuthread->EmuPause();
|
||||
|
||||
if (!rompath.IsEmpty())
|
||||
NDS::LoadROM(rompath.mb_str(), true);
|
||||
NDS::LoadROM(rompath.mb_str(), Config::DirectBoot);
|
||||
else
|
||||
NDS::LoadBIOS();
|
||||
|
||||
@ -278,6 +281,12 @@ void MainFrame::OnReset(wxCommandEvent& event)
|
||||
}
|
||||
}
|
||||
|
||||
void MainFrame::OnEmuConfig(wxCommandEvent& event)
|
||||
{
|
||||
EmuConfigDialog dlg(this);
|
||||
dlg.ShowModal();
|
||||
}
|
||||
|
||||
void MainFrame::OnInputConfig(wxCommandEvent& event)
|
||||
{
|
||||
if (joy)
|
||||
|
@ -35,6 +35,7 @@ enum
|
||||
ID_PAUSE,
|
||||
ID_RESET,
|
||||
|
||||
ID_EMUCONFIG,
|
||||
ID_INPUTCONFIG,
|
||||
};
|
||||
|
||||
@ -71,6 +72,7 @@ private:
|
||||
void OnPause(wxCommandEvent& event);
|
||||
void OnReset(wxCommandEvent& event);
|
||||
|
||||
void OnEmuConfig(wxCommandEvent& event);
|
||||
void OnInputConfig(wxCommandEvent& event);
|
||||
|
||||
void ProcessSDLEvents();
|
||||
|
Loading…
Reference in New Issue
Block a user