team-phoenix / Phoenix

A multi-system emulator and library manager designed to be both powerful and easy to use.
http://phoenix.vg
GNU General Public License v2.0
376 stars 40 forks source link

[WIP] Pipeline tree/frontend refactor #249

Closed athairus closed 8 years ago

athairus commented 8 years ago

This PR is for an implementation of the pipeline tree I had envisioned earlier. All nodes in the tree will communicate through a simple and clearly defined interface.

The PR is a package deal: work is being done here in feature-pipeline and also in phoenix-backend under the same name, feature-pipeline.

TODO:

athairus commented 8 years ago

Currently have the entire pipeline set up and working except for input. It currently only has GamepadManager up and running and LibretroCore ORs all input together into player 1.

athairus commented 8 years ago

There is a bug with PhoenixWindow I need to look into at some point. Toggling VSync creates this lovely picture:

capture

See my default Windows 10 wallpaper behind it? This must have something to do with how we reset the context to apply the new VSync setting... or a driver bug? (NVIDIA GTX 770, 364.72)

EDIT: Doesn't matter now, better less hacky VSync method is being used now

athairus commented 8 years ago

132 is fixed in this branch

athairus commented 8 years ago

Some Qt stuff we should try out: Q_GLOBAL_STATIC

athairus commented 8 years ago

Making GameConsole simpler

What if we had Nodes register themselves with GameConsole instead of GameConsole owning a set of Nodes? We could then have each Node, in its constructor, call something like this: GameConsole::RegisterNode( Node *node, bool gameConsoleOwnsPointer );. If gameConsoleOwnsPointer is true, it'll get moved to the game thread and will be deleted by GameConsole on app quit. This should be set to false when the object is owned by QML.

Maybe we can take advantage of Qt's meta object system to resolve what type of Node this is at runtime and store it into the appropriate member of GameConsole. Maybe we could take it one step further and have GameConsole track Node pointers by a QMap<QString, Node *> nodes, using a macro like #define connectNodes( a, b ) Node::connectNodes( nodes[ #a ], nodes[ #b ] ) or something, renaming Node::connectNodes to something else to prevent collisions. A program-terminating null check will be added to make sure things are being referenced properly.

Then to add a new Node you simply:

  1. Create your Node subclass
  2. Call GameConsole::registerNode( this, true/false ); in your Node subclass constructor
  3. Make connections as appropriate within GameConsole for your dynamic pipeline type
  4. The lifecycle is now automatically managed by either GameConsole or the QML engine

This will also get rid of the pointer properties within GameConsole. The objects will instead make themselves known to GameConsole by calling that function from their constructor.

GameConsole itself will have to be set up earlier than the QML engine for this to work for QML objects. We can simply declare it in main() and make it available to the entire QML engine with the name gameConsole.

athairus commented 8 years ago

Terms

athairus commented 8 years ago

Basic render loop breaks QML Timers and I don't know why...