mirror of
https://gitlab.com/manzerbredes/ochess.git
synced 2025-05-02 01:37:46 +00:00
Debug engine configuration
This commit is contained in:
parent
2b11848007
commit
1618113e61
6 changed files with 53 additions and 51 deletions
|
@ -56,7 +56,7 @@ void GameTabRightPanel::OnLiveAnalysis(wxCommandEvent &event) {
|
|||
ProcessEvent(notifyEvent);
|
||||
|
||||
live_engine = new LiveEngineDialog(
|
||||
this, engine_list->GetString(selection).ToStdString());
|
||||
this, selection);
|
||||
live_engine->SetFEN(game->GetFen());
|
||||
live_engine->Show();
|
||||
live_engine->Bind(wxEVT_CLOSE_WINDOW,
|
||||
|
@ -168,12 +168,12 @@ void GameTabRightPanel::ApplyPreferences() {
|
|||
engine_list->Clear();
|
||||
CONFIG_OPEN(conf);
|
||||
conf->SetPath("engines/");
|
||||
wxString engine_name;
|
||||
wxString engine_id;
|
||||
long index;
|
||||
if (conf->GetFirstGroup(engine_name, index)) {
|
||||
if (conf->GetFirstGroup(engine_id, index)) {
|
||||
do {
|
||||
engine_list->Append(engine_name);
|
||||
} while (conf->GetNextGroup(engine_name, index));
|
||||
engine_list->Append(conf->Read(engine_id+"/name"));
|
||||
} while (conf->GetNextGroup(engine_id, index));
|
||||
}
|
||||
CONFIG_CLOSE(conf);
|
||||
editor_canvas->ApplyPreferences();
|
||||
|
|
|
@ -1,12 +1,19 @@
|
|||
#include "LiveEngineDialog.hpp"
|
||||
|
||||
LiveEngineDialog::LiveEngineDialog(wxWindow *parent, std::string engine_name)
|
||||
: DialogLiveEngine(parent), engine_name(engine_name), interval(1000),
|
||||
LiveEngineDialog::LiveEngineDialog(wxWindow *parent, std::uint32_t engine_id)
|
||||
: DialogLiveEngine(parent), interval(1000),
|
||||
engine(nullptr) {
|
||||
lines_list->InsertColumn(0, "#", wxLIST_FORMAT_LEFT, 50);
|
||||
lines_list->InsertColumn(1, "CP", wxLIST_FORMAT_LEFT, 70);
|
||||
lines_list->InsertColumn(2, "Line", wxLIST_FORMAT_LEFT, 300);
|
||||
|
||||
// Load engine name
|
||||
confGroup="engines/"+std::to_string(engine_id);
|
||||
CONFIG_OPEN(conf);
|
||||
engine_name=conf->Read(confGroup+"/name");
|
||||
CONFIG_CLOSE(conf);
|
||||
current_engine->SetLabel(engine_name);
|
||||
|
||||
InitEngine();
|
||||
Bind(wxEVT_BUTTON, &LiveEngineDialog::TogglePauseEngine, this,
|
||||
LIVE_ENGINE_PAUSE_BUTTON);
|
||||
|
@ -25,11 +32,11 @@ void LiveEngineDialog::InitEngine() {
|
|||
wxLogDebug("Start engine: %s", engine_name);
|
||||
CONFIG_OPEN(conf);
|
||||
engine = new uciadapter::UCI(
|
||||
conf->Read("engines/" + engine_name + "/path").ToStdString());
|
||||
conf->Read(confGroup + "/path").ToStdString());
|
||||
engine->ucinewgame();
|
||||
|
||||
long index;
|
||||
std::string optsPath = "engines/" + engine_name + "/options";
|
||||
std::string optsPath = confGroup + "/options";
|
||||
conf->SetPath(optsPath);
|
||||
wxString opt_name;
|
||||
if (conf->GetFirstGroup(opt_name, index)) {
|
||||
|
|
|
@ -15,12 +15,14 @@ typedef struct EngineEvaluation {
|
|||
class LiveEngineDialog : public DialogLiveEngine {
|
||||
uciadapter::UCI *engine;
|
||||
std::string engine_name;
|
||||
std::string confGroup;
|
||||
|
||||
wxTimer timer;
|
||||
/// @brief The following time interval definitely need to be configure in the user settings (set to 1s for now)
|
||||
std::uint32_t interval;
|
||||
|
||||
public:
|
||||
LiveEngineDialog(wxWindow *parent, std::string engine_name);
|
||||
LiveEngineDialog(wxWindow *parent, std::uint32_t engine_id);
|
||||
~LiveEngineDialog();
|
||||
void InitEngine();
|
||||
void TogglePauseEngine(wxCommandEvent &event);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue