mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-12 09:48:37 +12: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()
|
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)
|
SetSendDbgCommandCallback([](DbgCommand id, CPUThread* t)
|
||||||
{
|
{
|
||||||
wxGetApp().SendDbgCommand(id, t);
|
wxGetApp().SendDbgCommand(id, t);
|
||||||
|
@ -296,7 +312,7 @@ bool Rpcs3App::OnInit()
|
||||||
m_MainFrame->Show();
|
m_MainFrame->Show();
|
||||||
m_MainFrame->DoSettings(true);
|
m_MainFrame->DoSettings(true);
|
||||||
|
|
||||||
OnArguments();
|
OnArguments(parser);
|
||||||
|
|
||||||
//compile_shader("compile_shader0.spo");
|
//compile_shader("compile_shader0.spo");
|
||||||
//compile_shader("compile_shader1.spo");
|
//compile_shader("compile_shader1.spo");
|
||||||
|
@ -304,14 +320,26 @@ bool Rpcs3App::OnInit()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Rpcs3App::OnArguments()
|
void Rpcs3App::OnArguments(const wxCmdLineParser& parser)
|
||||||
{
|
{
|
||||||
// Usage:
|
// Usage:
|
||||||
// rpcs3-*.exe Initializes RPCS3
|
// rpcs3-*.exe Initializes RPCS3
|
||||||
// rpcs3-*.exe [(S)ELF] Initializes RPCS3, then loads and runs the specified (S)ELF file.
|
// rpcs3-*.exe [(S)ELF] Initializes RPCS3, then loads and runs the specified (S)ELF file.
|
||||||
|
|
||||||
if (Rpcs3App::argc > 1) {
|
if (parser.FoundSwitch("t"))
|
||||||
Emu.SetPath(fmt::ToUTF8(argv[1]));
|
{
|
||||||
|
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.Load();
|
||||||
Emu.Run();
|
Emu.Run();
|
||||||
}
|
}
|
||||||
|
@ -319,6 +347,11 @@ void Rpcs3App::OnArguments()
|
||||||
|
|
||||||
void Rpcs3App::Exit()
|
void Rpcs3App::Exit()
|
||||||
{
|
{
|
||||||
|
if (parser.FoundSwitch("t"))
|
||||||
|
{
|
||||||
|
Ini.HLEExitOnStop.SetValue(HLEExitOnStop);
|
||||||
|
}
|
||||||
|
|
||||||
Emu.Stop();
|
Emu.Stop();
|
||||||
Ini.Save();
|
Ini.Save();
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "Emu/DbgCommand.h"
|
#include "Emu/DbgCommand.h"
|
||||||
#include "Utilities/Thread.h"
|
#include "Utilities/Thread.h"
|
||||||
#include <wx/app.h>
|
#include <wx/app.h>
|
||||||
|
#include <wx/cmdline.h>
|
||||||
|
|
||||||
class CPUThread;
|
class CPUThread;
|
||||||
|
|
||||||
|
@ -11,11 +12,15 @@ wxDECLARE_EVENT(wxEVT_DBG_COMMAND, wxCommandEvent);
|
||||||
|
|
||||||
class Rpcs3App : public wxApp
|
class Rpcs3App : public wxApp
|
||||||
{
|
{
|
||||||
|
private:
|
||||||
|
wxCmdLineParser parser;
|
||||||
|
// Used to restore the configuration state after a test run
|
||||||
|
bool HLEExitOnStop;
|
||||||
public:
|
public:
|
||||||
MainFrame* m_MainFrame;
|
MainFrame* m_MainFrame;
|
||||||
|
|
||||||
virtual bool OnInit(); // RPCS3's entry point
|
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();
|
virtual void Exit();
|
||||||
|
|
||||||
Rpcs3App();
|
Rpcs3App();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue