here I am again ! So, I am developing an GBC emulator in C++ but I'm having some issues. First of all, I'm using Qt in VS10, which is working nice so far. But well, I have my GUI(main window) with a few Objects (QListWidget, Buttons etc). So, in my CPU class, I have a loop that emulates all the GBC instructions. It works in a simple way. Get code, decode, fetch and call the operation in a switch, do it all over again. So, my problem is, on each interation, I'd like to have this main screen showed up with the List updated.
Image below, I can't post cause I dont have 10 rep points. https://i.stack.imgur.com/BdaHo.png
So, a chunk of code so you can (try?) to understand whats going on: (cpu.cpp)
next:
op = FETCH;
setSelection((UINT32)op);
ciclos = cycles_table[op];
switch(op)
{
do the magic
emit onEndProcess((UINT32)op);
goto next;
}
cpu.h
signals:
void onEndProcess(UINT32);
which is received by ratagbc (ratagbc.h)
public slots:
void receivedEndProcess(UINT32);
And implemented:
void RataGBC::receivedEndProcess(UINT32 i){
this->ui.listWidget->item(i+1)->setSelected(true);
this->show();
}
And in the rata constructor, after ui.setupUI(...) I have:
cpp = new cpu();
connect(cpp,SIGNAL(onEndProcess(UINT32)),this,SLOT(receivedEndProcess(UINT32)));
}
Where cpp is an instance of cpu class. Here there is a problem, this connect is returning false !!
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
RataGBC w;
dasm dsm;
FILE *file = fopen("Tetris DX.gbc","r");
int c = 0;
while(dsm.DAsm(file,w.ui.listWidget,c));
fclose(file);
w.cpp->start();
w.show();
return a.exec();
}
One thing that I noticed is that I need to implement (a blank) onEndProcess in my cpu.cpp, or it gives me linking error. Is it really necessary ?
Hope you guys can understand what I need ! Thanks !