Skip to content

Conversation

@njz3
Copy link

@njz3 njz3 commented Apr 25, 2025

Add TCP server socket 8000 and UDP (broadcast) 8001 for network outputs.

Copy link
Owner

@trzy trzy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a good feature but substantial rework needed. I don't like the Windows-specific nature of this. I think it's unnecessary: UDP should be done via SDL2_net, not Winsock, and threading should be done with std::thread, not the Windows API.

Also, make sure to add the Supermodel file header to each source file.

struct Packet
{

static const UINT32 BUFFER_SIZE_UDP = 1460;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we convert tabs to spaces everywhere? I think we are using a 4-character tab stop.

#include <vector>
#include <thread>

namespace SMUDP
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this namespace at all?


#pragma comment(lib, "ws2_32.lib")

WinSockWrap::WinSockWrap()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is Winsock needed? SDL2_net has UDP, to my knowledge. This should be platform-agnostic, similar to the netplay TCP code, no?

#endif
config.Set("Outputs", "none");
config.Set("DumpTextures", false);
config.Set("NetOutputsWithLF", "1");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can probably drop the Net prefix here and just group these below "Outputs".

#endif
config.Set("Outputs", "none");
config.Set("DumpTextures", false);
config.Set("NetOutputsWithLF", "1");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OutputsWithLF should probably be a bool rather than int?

// Will do SendUdpBroadcastWithId();
}

LRESULT CNetOutputs::CreateServerThread()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please refactor to eliminate all Windows dependencies here. std::thread can be used. No need for any Windows functions or types like LRESULT, DWORD, etc.

<ClCompile Include="..\Src\Network\SimNetBoard.cpp" />
<ClCompile Include="..\Src\Network\TCPReceive.cpp" />
<ClCompile Include="..\Src\Network\TCPSend.cpp" />
<ClCompile Include="..\Src\Network\TCPSendAsync.cpp" />
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't forget to update Rules.inc in Makefiles.

@dukeeeey
Copy link
Collaborator

All the network stuff is copy/paste from much earlier versions of supermodel before the networking code really worked. They shouldn't be needed I don't think for the mame outptut stuff. Tbh not even sure what it is / for.

@trzy
Copy link
Owner

trzy commented Apr 25, 2025

All the network stuff is copy/paste from much earlier versions of supermodel before the networking code really worked. They shouldn't be needed I don't think for the mame outptut stuff. Tbh not even sure what it is / for.

I've never used this feature but Nik hooked up the original output system to work with something called MameHooker (heh). It's for the various lights on the cabinets, for those who want to emulate those or implement them on custom cabs.

@trzy
Copy link
Owner

trzy commented Apr 25, 2025

The main thing is that the current outputs system is constrained to Windows but this one could actually be platform-independent. Better to do that.

@dukeeeey
Copy link
Collaborator

All the network code is what I wrote for spindizzi when we trying to get networking working. It wasn't required for the mame output stuff. In the end i rewrote the network code for SDL.

@njz3
Copy link
Author

njz3 commented Apr 25, 2025

@dukeeeey That's something I have done a long time ago for my own usage (forcefeedback software), maybe a few years ago, and forgot about it until somebody ask me an update today.
I simply updated the branch up to current master, and commited the files which explains why it is using old code from you.

When I will have spare time I will check your code review. Thank for spending time reviewing it.

@dukeeeey
Copy link
Collaborator

The only files you need are netoutputs.cpp / h. I am pretty sure the rest isn't needed.

@6Bolt
Copy link

6Bolt commented Jul 9, 2025

Hello, I am Darren, also known as 6Bolt, the coder of Hook Of The Reaper program. Github link below.

https://github.com/6Bolt/Hook-Of-The-Reaper

Hook Of The Reaper is an alternative to the aging MameHooker. Since it is a newer program, I didn't want to do the windows to windows communication. I get the output signals from TCP port 8000, on the localhost. This is supported by MAME, DemulShooter, and now nixxou's 3 light gun Emulator builds. HOTR has taken over MameHooker in the light gun community.

I have your SuperModel v0.3.1-26-g95968f3, which supported the network output. I have the needed DefaultLG game files on my website. These are similar to MameHooker ini game files, but work for any DefaultLG light gun, with no modification. To enable it , I had to put 'outputs = net' in the Supermodel.ini file. Link to game files below.

https://hotr.6bolt.com/pmwiki.php/GameFiles/SuperModel

Looking at the current code, the Src/OSD/Windows/NetOutputs.h/cpp is not there anymore. Was it moved to a different location? Or was Net Outputs removed? If not, how do you enable it? As light gun players are now wanting to play the light gun games with HOTR.

@trzy
Copy link
Owner

trzy commented Jul 9, 2025 via email

@6Bolt
Copy link

6Bolt commented Jul 9, 2025

OK, I understand. I only use Windows stuff, only when I have too.

I have converted nixxou's MameOutputSender program from windows to windows communications to network TCP communications. This is used on his light gun builds for Dolphin, Duck Station, and PCSX2.

Currently I am busy with the Hook Of The Reaper project. When that is completed, I could get it done. But that would be 6-9 months from now.

@njz3
Copy link
Author

njz3 commented Jul 10, 2025

It that's ok for @dukeeeey and @trzy , I will have a look to using SDL_net API. (Also need some weeks/months to do that.)

bagelswitch added a commit to bagelswitch/Supermodel that referenced this pull request Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants