pete-gordon / oricutron

Portable Oric-1/Atmos/Telestrat and Pravetz 8D emulator
http://www.petergordon.org.uk/oricutron/
GNU General Public License v2.0
69 stars 25 forks source link

fix/joystick management twilighteboard #191

Closed jedeoric closed 11 months ago

iss000 commented 11 months ago

Merging, but PLEASE revise your code, what about this:

    if( gimme_port_a )
    {
        // port A
         if (oric->twilighteboard_activated)
              twilighteboard_oric_write(oric->twilighte, 0x321, 0xff, mkmask_f);
    }

    if( gimme_port_b )
    {
      // port B
      if (oric->twilighteboard_activated)
             twilighteboard_oric_write(oric->twilighte, 0x320, 0xff, mkmask);
    }

The whole code become very polluted already and it's very difficult for maintenance. Maybe soon I'll have to do something about this like splitting all "extras" in own branches and make the main branch pure as standard Oric is... Opinions ?

assinie commented 11 months ago

I think that the "if" tests are useless since we are already in a block for which this condition is checked. Regarding all "extras", what about a plugins system?

iss000 commented 11 months ago

Hi @assinie! Yes, I'm 100% for a plugin system! :) IMO, it do not need to be something "super-mega-ultra", only 3-4 exported functions: init, read/write before, (here comes internal read/write), read/write after, close... Well, maybe an info function to report plugin name too :) .

jedeoric commented 11 months ago

Hello,

About plugin system, it's the reason i did a plugin folder and a file to init/manage chip (Like : https://github.com/pete-gordon/oricutron/blob/master/plugins/twilighte_board/oric_twilighte_board_plugin.c#L116).

In fact, it's the same behavior than Ace emulator (CPC emulator) : It manages plugins, and i use this code structure for twilighte board emulation (source code not available) : http://ace.cpcscene.net/en:downloads

Some years ago, we discuss about plugin system maybe with Pete, but i did not start anything, because i consider i am only contributor and not main coder of Oricutron. I have not the time also to build oricutron plugin system.

For example, it's really hard to find a way to add 65C816 to Oricutron with the current code. It seems that it could be useless, but i use 65C816 on my atmos, i can easily code on it with cross dev, but it's not efficient.

assinie commented 11 months ago

Hello, I agree, we only need a few functions (the Twilghte emulation exports only 5 if i'm not wrong) We need to find something simple that works regardless of the operating system. but i don't know which one.