-
-
Notifications
You must be signed in to change notification settings - Fork 207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
link cable emulation between multiple instances #18
Comments
I plan to add netplay and multiple instances link cable emulation in version 0.11 (version 0.10 will be released this month). |
nice! Thanks 👍 |
That would be amazing, for the libretro core I could make a single libretro core run two instances if you can help me to link them :) |
Actually, adding it to the libretro core might actually be already possible as SameBoy already emulates the Link Cable – the things missing in the Cocoa and SDL ports is the GUI, and networking and synchronization code, which are already provided by libretro itself as far as I know. The Link Cable API is:
|
I wanted to start working on that, so I have a core that runs 2 instances (thanks to @bparker06 for helping me with the blitting issue) But I have exactly half performance now, I suspect because of the vblank thing, not sure if there's a sleep somewhere that causes this. Once we manage to iron these out I can start trying to hook up the proper API |
Errr... fixed the slowdown by commenting the audio_callback from GB2... guess that means I need to try to hookup serial now 📦 |
Oh looking cool! Slowdown makes sense because IIRC libretro times everything by the audio, and you were giving it 2 times the amount of audio. I hope frame synchronization would be good enough for serial though, it might be tricky. |
Well I have questions about the API, do I have to actually implement the callback for link cable? Because as far as I can see in printer.c your actual implementation is there, so I guess I would need to know exactly what needs to be sent? |
The printer is always running is slave mode (therefore the Game Boy runs in master mode), therefore the Game Boy side uses the callback API. Since you're emulating two Game Boys, both need to implement both master and slave logic (Because you can't know which will be master). Basically it's very simple, you set configure the callbacks for both instances:
Assuming both instances are synchronized well enough, this should just work :) |
Well, it does.. something https://www.youtube.com/watch?v=m62frQp3DPg&feature=youtu.be |
What should I return in the end callback? |
This is.. interesting... The end callback should return the value received from the other side of the serial. I.e. |
Ok that makes more sense now, I think you made a typo in your explanation |
Ok both "linked now" very slowly and input no longer worked :P |
Progress?
This is my code |
Looks correct other than the |
*GBC/GSC I guess? |
Yeah you'd need a save for that (otherwise it'd be very annoying) but it can be the same save for both instances. Any Gen 2 game would work. |
I pushed it into a branch in case you want to check it out |
Exactly what I thought. Since you run the instances frame-by-frame, the master instance is always one frame (about 1/60 seconds) ahead of the slave one. The serial, however, runs in 8192Hz, meaning it sends about 17 bytes per frame. This means the master instance sends the slave instance 17 bytes before the slave instance gets a chance to process anything, and then it effectively processes the last byte 17 times in a row. The way to solve it is by redoing how synchronizing the instances is done. An easy, naive, wrong, but still better way of doing it is by using |
What function would I use to end the loop in the vblank callback? |
Set a VBlank callback for both instances that simply sets a bool to true. Then, instead of using
|
Wasn't able to figure it out :p |
I'll have a look at it tomorrow :) |
Cool ty! |
Hey, did you have a chance to take a look? |
Yeah, I just finished adding proper synchronization between the two instances yet Tetris 2 behaves the same. I'll have to investigate further I guess. |
Tetris 2 does seem to work on an old internal build of SameBoy 0.7 that has experimental Netplay support, so it's clearly not an emulation bug. |
ahh, ok, well let me know if I can do anything :) |
I just noticed super mario bros dx disconnects at the level select screen, pokemon seems to still work properly though |
Some guy did some thorough testing btw A bit outdated gonna ask him if he can re-test |
Mario tennis works great. |
Anything new with this? |
My estimate of v0.12 (First half of 2019) still applies :) |
I guess this is delayed until v0.13, isn't it? |
Sadly yes. While I do have a working POC, the performance penalty is too high and needs more work. |
Anyway to load (4) games with this feature instead of two for multiple players to play through RetroArch? Not so much interested in the trading aspect, but more interested in loading (4) separate Game Boy instances for each user to play their own game, such as Pokemon. |
Isn't that just 4 instances of SameBoy open without any link cable emulation? What am I missing? |
Yes, but I don't believe there is anyway to run this through one RetroArch emulation. I've been using the link to run both side by side, but it would be awesome to run (4). Top-left, Top-right, Bottom-left, Bottom-right. Running multiple SameBoy instances is a lot of manual work with a mouse and re-alignment, etc. |
I don't think there's a way to link 4 so I didn't think it would be worthwhile to implement that. |
Bummer. Looks like I'll just have to create a script to run multiple SameBoy outside of RetroArch and re-assign controllers to each exe. |
There actually is a device that allows linking four Game Boys, but it's not emulated yet. |
I guess I'm more interested in not linking them through each game, although it would be great. It would be better having multiple instances run side by side, which would thus make a (1) player game into up to (4) players because each would have their own controller and it fills up the rest of the screen real-estate. Its nice having them all lined up and not have to manually modify each .EXE settings during each initial setup. Whereas through RetroArch, the controller auto set. See example below where I cropped out the title bars, the bottom task bar, etc. But I would still need to change each exe setting before going forward. |
I did this for mgba at some point and I just realized I nuked that repo :P
Edit: ahhh the PR still exists
libretro/mgba#81
I guess I can use it for reference.
I do think the multi instance code in the libretro core can accommodate this easily
…On Sat, Jun 22, 2019 at 10:46 AM whazzzzzup17 ***@***.***> wrote:
I guess I'm more interested in not linking them through each game,
although it would be great. It would be better having multiple instances
run side by side, which would thus make a (1) player game into up to (4)
players because each would have their own controller and it fills up the
rest of the screen real-estate.
Its nice having them all lined up and not have to manually modify each
.EXE settings during each initial setup. Whereas through RetroArch, the
controller auto set. See example below where I cropped out the title bars,
the bottom task bar, etc. But I would still need to change each exe setting
before going forward.
[image: image]
<https://user-images.githubusercontent.com/52107441/59965950-e900ec80-94c9-11e9-8676-76e18b83d515.png>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#18?email_source=notifications&email_token=AANEFUFUWSKHBKC55O3LFGTP3ZCLPA5CNFSM4EC2V3I2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYKL7WY#issuecomment-504676315>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AANEFUH6WKMRF7ITCUGENQ3P3ZCLRANCNFSM4EC2V3IQ>
.
|
Not to mention if (1) user wants to play Pokemon, the other (3) users can play totally different games all through one monitor at the same time. Extremely useful if you have a big 65 inch TV or something like that. Not sure if this is a different request or can be modified through the same request, as they both involve running multiple instances |
It's a different request for sure.
…On Sat, Jun 22, 2019 at 11:04 AM whazzzzzup17 ***@***.***> wrote:
Not to mention if (1) user wants to play Pokemon, the other (3) users can
play totally different games all through one monitor at the same time.
Extremely useful if you have a big 65 inch TV or something like that.
Not sure if this is a different request or can be modified through the
same request.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#18?email_source=notifications&email_token=AANEFUBGHGC3D7IYY2WKMA3P3ZESTA5CNFSM4EC2V3I2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYKMLDY#issuecomment-504677775>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AANEFUHIROSV4OYYA3NOM4DP3ZESTANCNFSM4EC2V3IQ>
.
|
Ah man I thought it will come soon... |
It was planned and mostly completed for v0.12, but sadly it had severe performance issues I've haven't managed to solve yet. |
So his isn't implemented, right? Because in Retroarch if I go to Subsystems and select "Load 2 Player Game Boy Link" it asks me for a rom, I select Pokemon Crystal and it seems to just load it normally. (I just want to "trade") |
subsystems is definitely implemented correctly in the core. |
Hi guys, @fr500 and @LIJI32 , I can confirm that subsystems still works on RetroArch 1.9.0 (latest git code). For users, the steps are : And Have a nice run ^^ . Congratulations for these huge works guys ! Note : Like me, you are in love with commands lines? Need this info for Retropie, EmulationStation and co? Here is an example of how to use it :
|
glad it works for you, you're from VBA right? does VBA have a similar API without relying on network? |
I'm not an official dev of VisualBoyAdvance-M, but I worked on a fork of VBALink that becames now a fork of VisualBoyAdvance-M with a working TCP/IP network for Linux and Windows (uses native socket code instead the SFML Library). In my knowledge, but i have never successfully used it, they have a support for local mode ( on the same computer ) that uses multiple instances. For the tests that I done today with my code, I can use the equivalent method : use multiple instances on the same machine ( Player1 = server , Player 2 to 4 = client that connects to 127.0.0.1) with a working retroarch core . But I don't know if we can modify it to support the method you and @LIJI32 used in SameBoy, because of the lack of a system/API method in VBA-M and in my fork. If you're interested to look on my project, I can create a repository of my fork if you want to look on the code ( personnally, GBA Link code is the main objective on my project (Multi-Pak and General Purpose Mode for FFTA works), the Joybus Protocol isn't necessary, and the GB/GBC Link works very better on SameBoy than VisualBoyAdvance-M + my fork ). EDIT : Does mGBA libretro core already have this feature ? |
The RetroArch core could also play online with some sort of rollback but i remember not getting it to work like I wanted lol. |
@LIJI32 Please put more attention into this issue. I mean, it's 0.15.x now, and we STILL haven't had network play arrive to SameBoy yet. I'd LOVE to have network play as a feature so I can battle Pokemon with my friends. Please work harder, I'd be willing to help! |
geezzz... |
Hi!
I realize the demand is pretty specific : I'd like to emulate link cables between virtual gameboys for sync stuff. The context is I use LSDJ to make music with gameboys, and you can connect multiple gameboys to get them to play together at the same rhythm, using a master/slave config.
On Windows, I usually use BGB, which supports it, but on Mac and Linux, you have to go through Wine. It works... okay let's say. It's just hella laggy and tends to desync pretty rapidly.
Just discovered your project today, so I don't know if this is possible at all. From what I can see, BGB creates a listening server that other instances can connect to. I'll check out if I can help about this
The text was updated successfully, but these errors were encountered: