/* $Id$
This file is part of gldbg
-Copyright © 2009 Mikko Rasa, Mikkosoft Productions
+Copyright © 2009-2010 Mikko Rasa, Mikkosoft Productions
Distributed under the GPL
*/
#include <msp/io/print.h>
#include <msp/strings/lexicalcast.h>
#include "gldbg.h"
-#include "glprint.h"
+#include "gldecoder.h"
+#include "tool.h"
using namespace std;
using namespace Msp;
{
FS::Path libdir = FS::get_sys_lib_dir(argv[0], "gldbg");
process.setenv("LD_PRELOAD", (libdir/"glwrap.so").str().c_str());
+
+ const list<Tool::Factory *> &factories = Tool::get_factories();
+ for(list<Tool::Factory *>::const_iterator i=factories.begin(); i!=factories.end(); ++i)
+ tools.push_back((*i)->create(*this));
+}
+
+GlDbg::~GlDbg()
+{
+ for(list<Tool *>::iterator i=tools.begin(); i!=tools.end(); ++i)
+ delete *i;
}
int GlDbg::main()
set_loop_mode(TICK_BUSY);
IO::print("GLdbg 0.0\n");
- IO::print("Copyright © 2009 Mikkosoft Productions\n");
+ IO::print("Copyright © 2009-2010 Mikkosoft Productions\n");
IO::print("Type \"help\" for a list of commands\n");
Application::main();
int size = gldecoder_decode(0, data, len);
if(size<0)
break;
- tracer.decode(data, len);
- glstate.decode(data, len);
+ for(list<Tool *>::iterator i=tools.begin(); i!=tools.end(); ++i)
+ (*i)->decode(data, size);
buf_offset += size;
}
if(buf_offset>8192)
{
buffer.erase(0, buf_offset);
- buf_offset=0;
+ buf_offset = 0;
}
}
}