mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-21 03:55:32 +00:00
Add support for "test mode"
Since @devmapal hasn't made a PR for this and this would be probably
useful for Coveralls and unit tests I'm making a PR for it myself.
More info:
c72f5d40f5
This commit is contained in:
parent
f2e2786959
commit
f15c679fea
2 changed files with 43 additions and 5 deletions
|
@ -202,6 +202,22 @@ void compile_shader(std::string path)
|
|||
|
||||
bool Rpcs3App::OnInit()
|
||||
{
|
||||
static const wxCmdLineEntryDesc desc[]
|
||||
{
|
||||
{ wxCMD_LINE_SWITCH, "h", "help", "Command line options:\nh (help): Help and commands\nt (test): For directly executing a (S)ELF", wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP },
|
||||
{ wxCMD_LINE_SWITCH, "t", "test", "Run in test mode on (S)ELF", wxCMD_LINE_VAL_NONE },
|
||||
{ wxCMD_LINE_PARAM, NULL, NULL, "(S)ELF", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL },
|
||||
{ wxCMD_LINE_NONE }
|
||||
};
|
||||
|
||||
parser.SetDesc(desc);
|
||||
parser.SetCmdLine(argc, argv);
|
||||
if (parser.Parse())
|
||||
{
|
||||
// help was given, terminating
|
||||
this->Exit();
|
||||
}
|
||||
|
||||
SetSendDbgCommandCallback([](DbgCommand id, CPUThread* t)
|
||||
{
|
||||
wxGetApp().SendDbgCommand(id, t);
|
||||
|
@ -296,7 +312,7 @@ bool Rpcs3App::OnInit()
|
|||
m_MainFrame->Show();
|
||||
m_MainFrame->DoSettings(true);
|
||||
|
||||
OnArguments();
|
||||
OnArguments(parser);
|
||||
|
||||
//compile_shader("compile_shader0.spo");
|
||||
//compile_shader("compile_shader1.spo");
|
||||
|
@ -304,14 +320,26 @@ bool Rpcs3App::OnInit()
|
|||
return true;
|
||||
}
|
||||
|
||||
void Rpcs3App::OnArguments()
|
||||
void Rpcs3App::OnArguments(const wxCmdLineParser& parser)
|
||||
{
|
||||
// Usage:
|
||||
// rpcs3-*.exe Initializes RPCS3
|
||||
// rpcs3-*.exe [(S)ELF] Initializes RPCS3, then loads and runs the specified (S)ELF file.
|
||||
|
||||
if (Rpcs3App::argc > 1) {
|
||||
Emu.SetPath(fmt::ToUTF8(argv[1]));
|
||||
if (parser.FoundSwitch("t"))
|
||||
{
|
||||
HLEExitOnStop = Ini.HLEExitOnStop.GetValue();
|
||||
Ini.HLEExitOnStop.SetValue(true);
|
||||
if (parser.GetParamCount() != 1)
|
||||
{
|
||||
wxLogDebug(wxT("A (S)ELF file needs to be given in test mode, exiting."));
|
||||
this->Exit();
|
||||
}
|
||||
}
|
||||
|
||||
if (parser.GetParamCount() > 0)
|
||||
{
|
||||
Emu.SetPath(fmt::ToUTF8(parser.GetParam(0)));
|
||||
Emu.Load();
|
||||
Emu.Run();
|
||||
}
|
||||
|
@ -319,6 +347,11 @@ void Rpcs3App::OnArguments()
|
|||
|
||||
void Rpcs3App::Exit()
|
||||
{
|
||||
if (parser.FoundSwitch("t"))
|
||||
{
|
||||
Ini.HLEExitOnStop.SetValue(HLEExitOnStop);
|
||||
}
|
||||
|
||||
Emu.Stop();
|
||||
Ini.Save();
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "Emu/DbgCommand.h"
|
||||
#include "Utilities/Thread.h"
|
||||
#include <wx/app.h>
|
||||
#include <wx/cmdline.h>
|
||||
|
||||
class CPUThread;
|
||||
|
||||
|
@ -11,11 +12,15 @@ wxDECLARE_EVENT(wxEVT_DBG_COMMAND, wxCommandEvent);
|
|||
|
||||
class Rpcs3App : public wxApp
|
||||
{
|
||||
private:
|
||||
wxCmdLineParser parser;
|
||||
// Used to restore the configuration state after a test run
|
||||
bool HLEExitOnStop;
|
||||
public:
|
||||
MainFrame* m_MainFrame;
|
||||
|
||||
virtual bool OnInit(); // RPCS3's entry point
|
||||
virtual void OnArguments(); // Handle arguments: Rpcs3App::argc, Rpcs3App::argv
|
||||
virtual void OnArguments(const wxCmdLineParser& parser); // Handle arguments: Rpcs3App::argc, Rpcs3App::argv
|
||||
virtual void Exit();
|
||||
|
||||
Rpcs3App();
|
||||
|
|
Loading…
Add table
Reference in a new issue