You are not logged in.

Read the FAQ and Knowledge Base before posting.
We won't make a 3DS/2DS emulator.



#1 2018-06-25 16:28:56

retr0s4ge
Member
Registered: 2018-06-25
Posts: 4

Desmume 0.9.12 with working WiFi

Hi,

I created a separate branch in a proper fork of desmume to test WiFi fixes from Desmume-Reloaded by Jackobo Le Chocobo. I applied the relevant fixes to snapshot of master branch taken at 22/06/2018.
Please review the branch with working WiFi here:
https://github.com/retr0s4ge/desmume/tr … _test_WiFi

and the compiled (x64) windows executable at:
https://ci.appveyor.com/project/retr0s4 … /artifacts

All credit for the 0.9.12 WiFi fix goes to Jackobo Le Chocobo, and for original code to Luigi_/StapleButter

I originally submitted a pull request for the changes, but closed it after I saw the official auto builder immediately applied it. Closing the pull request didn't remove the build, sorry about that.


[edit]
After testing for some time, I merged the changes in master20180622_test_WiFi to master branch, and rebased on current TASVideos/desmume master branch (bd63ff1 Tree).
https://github.com/retr0s4ge/desmume/tree/master

Compiled (x64) windows executable is at:
https://ci.appveyor.com/project/retr0s4 … /artifacts

Instructions for setting up WiFi and connecting to AltWFC network
https://github.com/retr0s4ge/desmume/wi … FC-network

Last edited by retr0s4ge (2018-06-29 17:00:26)

Offline

#2 2018-06-26 06:25:16

zeromus
Radical Ninja
Registered: 2009-01-05
Posts: 6,219

Re: Desmume 0.9.12 with working WiFi

I changed the buildbot to only build the master branch

Offline

#3 2018-06-29 13:13:21

retr0s4ge
Member
Registered: 2018-06-25
Posts: 4

Re: Desmume 0.9.12 with working WiFi

I re-based my master branch on current tree (bd63ff1) and submitted pull request.
https://github.com/TASVideos/desmume/pull/150

Last edited by retr0s4ge (2018-06-29 13:28:29)

Offline

#4 2018-06-29 17:09:50

zeromus
Radical Ninja
Registered: 2009-01-05
Posts: 6,219

Re: Desmume 0.9.12 with working WiFi

so whats your story? do you have deeper knowledge of this subject than you new github account would suggest? are you planning to continue development on it? are you just trying to be helpful and keep jackobo's commits alive since he's deleted his repository, so that once this is done you're gonna move on? I don't mind hosting jackobo's branch in a branch of ours, but if nobody's going to stick around and support it, I don't want it in master

Offline

#5 2018-06-30 01:05:50

retr0s4ge
Member
Registered: 2018-06-25
Posts: 4

Re: Desmume 0.9.12 with working WiFi

Hi, Thanks for replying.
I am new to GitHub, and this is my first time trying to contribute to an open source project.

As to why I am doing this, I wanted an up to date build with working WiFi to use myself. I found Jackobo's post here but his repository was gone. Thankfully though, someone else forked it before that. https://github.com/slawekwaga/DeSmuME-Reloaded
To prevent that work from being out of date after some time (especially that it is functioning very well), this should be merged upstream.

Jackobo didn't create an online fork of demume due to some conflicts with desmume developers, so I got the date Jackobo locally cloned the master branch from his post in this forum, cloned the desmume master branch at that date, and generated diff between his fork and that to get his commits. I forked desmume and applied the commits to a separate branch, fixed some missing includes and tested that build for a while. Which leaves us here...

As explained above, I have no relation with the development of the changes related to fixing WiFi and I am not familiar with the inner workings of WiFi on the NDS and thus the logic behind the code in wifi.cpp and wifi.h. Apart from that, the rest of the changes are fairly easy to read through and maintain.

So to answer your question, I am not planning to develop WiFi functionality any further than current state (Only infrastructure mode working correctly), but I can work my way around bugs that might be introduced by future commits and maintain it for the foreseeable future.

Some arguments when evaluating whether or not to merge to master:
1- Despite the large number of changed lines, they are mostly localized in 2 files wifi.cpp, wifi.h which aren't useful in their current state (before merge) anyway.

2- Changes to other files are minor such as adding command line options, include statements and logging function. These should be easy to maintain.
    If you want, we can discuss each change apart from those to wifi.cpp and wifi.h on the pull request page.

3- You can always omit "--enable-wifi" from ./configure for Linux build, and unset EXPERIMENTAL_WIFI_COMM in desmume.props for windows and builds will be back to current situation.

Offline

#6 2018-06-30 05:14:07

zeromus
Radical Ninja
Registered: 2009-01-05
Posts: 6,219

Re: Desmume 0.9.12 with working WiFi

I merged it and gave you commit permissions. Feel free to push future wifi work directly. If you want to do anything else, find us on IRC first

Offline

#7 2018-06-30 12:07:23

retr0s4ge
Member
Registered: 2018-06-25
Posts: 4

Re: Desmume 0.9.12 with working WiFi

Thanks, looking forward to contribute.

Offline

#8 2018-08-02 16:50:55

zeromus
Radical Ninja
Registered: 2009-01-05
Posts: 6,219

Re: Desmume 0.9.12 with working WiFi

For the record, here's wackobo's thread full of raving:
http://forums.desmume.org/viewtopic.php?id=11118

Offline

#9 2018-08-03 22:39:15

Wiferni
Member
Registered: 2018-08-03
Posts: 15

Re: Desmume 0.9.12 with working WiFi

Anyone here gonna test Emu to Emu?
I have tested Emu to DS in Pokèmon Gen 4, after some bit we got into a battle but it was really laggy and soon after it started we DCed. It might be my PC that was bottlenecking so someone with a better PC might have better results.
Haven't tested MKDS on Emu to DS and haven't tested Emu to Emu at all. So if anyone wants to try that, hit me up maybe.

Offline

#10 2018-08-06 13:56:26

Wiferni
Member
Registered: 2018-08-03
Posts: 15

Re: Desmume 0.9.12 with working WiFi

Tested Emu to DS and Emu to Emu on MKDS, same results for me (before the countdown, the game softlocks). Yet my partner (Matze) didn't get softlocked.
I think more research to DS Wi-Fi and such should be done in order to have Wi-Fi emulated better.

Offline

#11 2018-08-07 01:05:00

Jackobo
Member
Registered: 2017-12-13
Posts: 11

Re: Desmume 0.9.12 with working WiFi

Hi,

@Wiferni, It's because the tests of WiFi with DWC are done with real hardware and not Emu to Emu. They don't appreciate that people use emulators.
Yeah more work can be done here indeed, like local multiplayer mode that MelonDS uses, issues with timing games.
But the Wifi support with DWC on Desmume works for some games.

@retr0s4ge, thanks for the credit and happy to see that you have applied successfully my Wifi Code modifications on Desmume. I tested it and it works without issue.
Desmume-Reloaded will still exist : Github pages doesn't exist now because Microsoft owns now GitHub. I moved all to Gitlab ( I have a life too like all people ) :

DeSmuME-Reloaded (DS emulator with Wifi support on DWC and RetroArch Support) : https://gitlab.com/JackoboLeChocobo/Desmume-Reloaded

You can report here too all bugs/issues with the project.

Jackobo The Chocobo
https://gitlab.com/users/JackoboLeChocobo/projects

Last edited by Jackobo (2018-08-07 01:08:47)


Gitlab : https://gitlab.com/users/JackoboLeChocobo/projects
DeSmuME-Reloaded (DS emulator with Wifi support on DWC and RetroArch Support) : https://gitlab.com/JackoboLeChocobo/Desmume-Reloaded
VisualBoyAdvance Link (GBA emulator with Multiplayer Link and RetroArch Support) : https://gitlab.com/JackoboLeChocobo/Vis … vance-Link

Offline

#12 2018-08-07 02:38:26

Wiferni
Member
Registered: 2018-08-03
Posts: 15

Re: Desmume 0.9.12 with working WiFi

@Jackobo What games are known to work online in DeSmuME? Especially Emu to DS. Also, is there any improvements in Wi-Fi emulation in Reloaded compared to the dev builds?

Offline

#13 2018-08-07 10:27:47

Jackobo
Member
Registered: 2017-12-13
Posts: 11

Re: Desmume 0.9.12 with working WiFi

Hi all,

@Wiferni, Here is a link of the DWC project that lists a compatibility list : https://github.com/polaris-/dwc_network … patibility
I suggest you to do some tests with that. Don't hesitate to share your results ( your game needs to be patched with WfcPatcher to connect to the/your DWC server ( https://github.com/AdmiralCurtiss/WfcPatcher / https://github.com/AdmiralCurtiss/WfcPatcher/releases ) ).

Desmume uses the same Wifi code that I repair on Desmume-Reloaded. So you will get the same results.

For the moment I look after local multiplayer and Wifi DWC code.

Jackobo The Chocobo


Gitlab : https://gitlab.com/users/JackoboLeChocobo/projects
DeSmuME-Reloaded (DS emulator with Wifi support on DWC and RetroArch Support) : https://gitlab.com/JackoboLeChocobo/Desmume-Reloaded
VisualBoyAdvance Link (GBA emulator with Multiplayer Link and RetroArch Support) : https://gitlab.com/JackoboLeChocobo/Vis … vance-Link

Offline

#14 2018-08-07 23:19:05

AsPoke3172
Member
Registered: 2010-04-21
Posts: 209

Re: Desmume 0.9.12 with working WiFi

Oh nice WIFI! tongue I will try them anytime soon! wink Anyway, how about show this news on GBATemp website before everyone enjoy WIFI games right now! big_smile

Offline

#15 2018-08-08 00:04:40

Jackobo
Member
Registered: 2017-12-13
Posts: 11

Re: Desmume 0.9.12 with working WiFi

Hi,

@AsPoke3172, I don't have problem with that for Desmume-Reloaded if you want to share that ^^ (I had repaired the Wifi code originally for Desmume-Reloaded , one of my projects, according to 0.9.4 Wifi code of StapleButter and adapted it to 0.9.12 code)

Still some works is needed to improve Wifi. If we can combine the work with MelonDS / StapleButter's project (about the local Wifi multiplayer), I'm sure we can have the best emulator : a future project that can be named for instance MelonDeSmume, a combination of all the works on one emulator ^^ . A dream for all users.

It will be sad that we will go on the same destiny of redream and other Dreamcast emulators for instance ( no Reicast OIT don't work, really... ).

If zeromus and other people of Desmume want a patch / files to add RetroArch support on it, i can send them the files and test it on the last master code ( I have Xubuntu 18.04 - 64-bit as Linux environnement and Windows 10). I can prepare that for you this week (yeah, there are only fools who do not change their minds in the end ).

Jackobo The Chocobo

Last edited by Jackobo (2018-08-08 00:15:06)


Gitlab : https://gitlab.com/users/JackoboLeChocobo/projects
DeSmuME-Reloaded (DS emulator with Wifi support on DWC and RetroArch Support) : https://gitlab.com/JackoboLeChocobo/Desmume-Reloaded
VisualBoyAdvance Link (GBA emulator with Multiplayer Link and RetroArch Support) : https://gitlab.com/JackoboLeChocobo/Vis … vance-Link

Offline

#16 2018-08-08 03:28:38

zeromus
Radical Ninja
Registered: 2009-01-05
Posts: 6,219

Re: Desmume 0.9.12 with working WiFi

retroarch forked desmume for whatever reasons. we don't need to paste what libretro did into our repositories ourselves; they could do that if they thought it was wise and the time was right. I assume they've made more various modifications dispersed throughout the desmume code. have you incorporated libretro's own work, including those modifications? I cannot tell since your first commit already had that work in it. Or is your libretro implementation your own? It would seem so, since you credited yourself for it. We don't need someone else's libretro implementation unless someone from libretro says it's ace.

Offline

#17 2018-08-08 09:45:46

Jackobo
Member
Registered: 2017-12-13
Posts: 11

Re: Desmume 0.9.12 with working WiFi

Hi,

@zeromus, we can said that : they forked to much desmume versions ... :
- Retroarch desmume2014 : https://github.com/libretro/desmume2014
- Retroarch desmume2015 : https://github.com/libretro/desmume2015
- Retroarch desmume : https://github.com/libretro/desmume

So I used the code of "Retroarch desmume" ( only the libretro part ) : I modified / adapted it on your last desmume code and it worked. The only difficult part was the compilation for Windows because we must add the include files for WinPCAP. Few modifications are applied on the "desmume code" part to add RetroArch support.

I will test it now on the last master branch this week and I will inform you of that. It will be useful that you get too the RetroArch support in case of, like PPSSPP project ( RetroArch forked it and create the support, PPSSPP's creator added it too on his project )

Jackobo The Chocobo

EDIT : 08 August 2018 - 12:16 : They don't wait for you to use your code for RetroArch = https://github.com/libretro/desmume/com … 6d9f8319d5 . So I understand your choice about that. But what is the goal for them to have old versions of desmume ?

Last edited by Jackobo (2018-08-08 10:21:40)


Gitlab : https://gitlab.com/users/JackoboLeChocobo/projects
DeSmuME-Reloaded (DS emulator with Wifi support on DWC and RetroArch Support) : https://gitlab.com/JackoboLeChocobo/Desmume-Reloaded
VisualBoyAdvance Link (GBA emulator with Multiplayer Link and RetroArch Support) : https://gitlab.com/JackoboLeChocobo/Vis … vance-Link

Offline

#18 2018-08-08 19:48:10

Wiferni
Member
Registered: 2018-08-03
Posts: 15

Re: Desmume 0.9.12 with working WiFi

It shouldn't be a problem to get StapleButter to help with local wireless emulation.

Offline

#19 2018-08-08 21:16:47

zeromus
Radical Ninja
Registered: 2009-01-05
Posts: 6,219

Re: Desmume 0.9.12 with working WiFi

They keep porting updated things because it's easier than merging upstream. We still need whatever "improvements" they put in desmume (otherwise we will then have libretro/desmume2014, libretro/desmume2015, libretro/desmume, libretro/desmume-reloaded, libretro/desmume-upstream). I'm not going to sanction creating a new fork. We need to do this right, and merge the wifi along with whatever "improvements" libretro does so that there is no doubt what to use.

note that libretro's "improvements" often consist of things like
1. deleting features they dont care about
2. cosmetic changes which contribute nothing but merging grief.
3. build fixes for other platforms -- very useful, but mixed in with the other garbage

it's stupid, but that's what we have to work with. we need to isolate the all the good values so I can go tell libretro we have an official libretro upstream that they have no reason not to use, and now they need to use it.

Offline

#20 2018-08-10 15:36:37

Jackobo
Member
Registered: 2017-12-13
Posts: 11

Re: Desmume 0.9.12 with working WiFi

Hi, so I look about Adhoc code and why it doesn't send or receive packets. And I found the solution for Windows :

1°) Add the lines on Adhoc_Init() after the line "int res;"

#ifdef __WIN32__
    WSADATA wsadata;
    if (WSAStartup(MAKEWORD(2, 2), &wsadata) != 0)
    {
        return false;
    }
#endif

2°) Add the lines on Adhoc_DeInit() after the line "closesocket(wifi_socket);"

#ifdef __WIN32__
    WSACleanup();
#endif

We have the same issue as before ( Detection of the player but after disconnection ( NSMB issue ) ).
Any news about that ?

Last edited by Jackobo (2018-08-10 15:37:36)


Gitlab : https://gitlab.com/users/JackoboLeChocobo/projects
DeSmuME-Reloaded (DS emulator with Wifi support on DWC and RetroArch Support) : https://gitlab.com/JackoboLeChocobo/Desmume-Reloaded
VisualBoyAdvance Link (GBA emulator with Multiplayer Link and RetroArch Support) : https://gitlab.com/JackoboLeChocobo/Vis … vance-Link

Offline

#21 2018-08-10 16:22:01

rogerman
Member
Registered: 2011-06-04
Posts: 380

Re: Desmume 0.9.12 with working WiFi

Wait a minute... so in src/frontend/windows/main.cpp, using WSAStartup() in main.cpp:2992 and WSACleanup() in main.cpp:3620 are insufficient for Ad-hoc mode? Because it seems to work for me. (Although, as you already mentioned, Ad-hoc mode only allows DeSmuME to detect other players, but disconnects them after that.)

Offline

#22 2018-08-10 17:16:53

Jackobo
Member
Registered: 2017-12-13
Posts: 11

Re: Desmume 0.9.12 with working WiFi

Hi,

Oh... You have answered at my question on RetroArch support : that's why RetroArch doesn't detect that at all before the modifications.
You added these lines in main.cpp for "Full" Windows Support (without RetroArch or another launcher).

Me, I added these lines in wifi.cpp and I can use the Ad-Hoc mode on RetroArch now on Windows (retroarch support doesn't use main.cpp) .

About the issue that Ad-hoc mode only allows DeSmuME to detect other players, but disconnects them after that, MelonDS has the solution for it in these files ( according to me ) :
- Wifi.cpp : https://github.com/StapleButter/melonDS … c/Wifi.cpp


- Wifi.h : https://github.com/StapleButter/melonDS … src/Wifi.h

See the registers of MelonDS ( Desmume doesn't have these registers ) :   
==> W_TXSlotReply1 = 0x094,
==> W_TXSlotReply2 = 0x098,
==> W_CmdTotalTime = 0x0C0,
==> W_CmdReplyTime = 0x0C4,
==> W_TXHeaderCnt = 0x194,

On Desmume, we have that in "wifi.h" :
// 094 - ?
// 098 - ?
// 0C0 - ?
// 0C4 - ?
// 194 - ?

For the moment, I use these names for Desmume for instance in wifi.h

#define        REG_WIFI_TXBUFREPLY1            0x094
#define        REG_WIFI_TXBUFREPLY2            0x098
#define        REG_WIFI_CMDTOTALTIME            0x0C0
#define        REG_WIFI_CMDREPLYTIME            0x0C4
#define        REG_WIFI_TXHEADERCOUNT        0x194


- Platform.cpp : https://github.com/StapleButter/melonDS … atform.cpp


MelonDS has the solution , but doesn't have a good accurancy/performance for the moment to launch the games ( i talk about compatibility for solo gameplays / 3D textures / ... ). DeSmume has the performance for that.
If someone has an idea according to these datas ( or even if StapleButter can share/help with that), we can do a new step for the Ad-Hoc support.

Last edited by Jackobo (2018-08-10 17:25:24)


Gitlab : https://gitlab.com/users/JackoboLeChocobo/projects
DeSmuME-Reloaded (DS emulator with Wifi support on DWC and RetroArch Support) : https://gitlab.com/JackoboLeChocobo/Desmume-Reloaded
VisualBoyAdvance Link (GBA emulator with Multiplayer Link and RetroArch Support) : https://gitlab.com/JackoboLeChocobo/Vis … vance-Link

Offline

#23 2018-08-10 17:26:34

rogerman
Member
Registered: 2011-06-04
Posts: 380

Re: Desmume 0.9.12 with working WiFi

Thanks to retr0s4ge's WiFi work, I'm currently reworking the WiFi API in DeSmuME to be easier to use for front-end integration and more feature-rich for better usage. In this first round of reworks, it is simple refactoring of code from C to C++ without any added features or any emulation changes. This is being done to modernize this section of the codebase to make it easier for future work.

After the WiFi API is modernized, anything goes from there!

Offline

#24 2018-08-26 20:47:36

Zinx
Member
Registered: 2018-08-26
Posts: 2

Re: Desmume 0.9.12 with working WiFi

Best thing to do is to get rid of the requirement to use a wired adapter. out of the box.

Last edited by Zinx (2018-08-27 20:46:49)

Offline

#25 2018-08-27 00:14:55

zeromus
Radical Ninja
Registered: 2009-01-05
Posts: 6,219

Re: Desmume 0.9.12 with working WiFi

it cant work with an ethernet adapter or any other virtual network adapter on your system?

Offline

Board footer

Powered by FluxBB