Half-Life for Dreamcast has some functional multiplayer components

Discussion in 'Sega Dreamcast Development and Research' started by TerdFerguson, Jul 13, 2015.

  1. TerdFerguson

    TerdFerguson ls ~/

    Joined:
    Apr 27, 2015
    Messages:
    664
    Likes Received:
    353
    If anyone else wants to try this, you need to disable the "GDI graphics driver" in the "Dreamcast image configuration tool", copy the files from c:\wcedreamcast\release\retail (or debug but i have not gotten debug to work yet) to the cd root directory with half-life's files, run 'bincon' on the 0WINCEOS.BIN to make a 1ST_READ.BIN, then use binhack and render the CDI using mkisofs, isofix, then bin2boot
     
  2. Trident6

    Trident6 Spirited Member

    Joined:
    Oct 17, 2015
    Messages:
    119
    Likes Received:
    55
    I am too busy to keep up with this at the moment, but I am almost positive this statement is not true. WinCE uses a load process similar to standard Windows, and the boot parameters are stored in HKEY_LOCAL_MACHINE\init if I recall correctly. I believe this is the same across all Windows CE versions so you can probably find out more by looking at the generic WinCE docs from Microsoft to find out more about passing command line parameters.

    I'm pretty sure I recall the Dreamcast HL executable checking startup parameters (or at least having a code path to do it), but I can't dig my Windows laptop out at the moment to check.
     
    TerdFerguson likes this.
  3. TerdFerguson

    TerdFerguson ls ~/

    Joined:
    Apr 27, 2015
    Messages:
    664
    Likes Received:
    353
    I tried looking for the proper registry values to add parameters, but I was not able to find much. Perhaps I do not know the correct terminology or wording for my searches

    It does parse the cmd parameters, that is what 'stuffcmds' does. It stuffs the command line statements put in front of the hl.exe. The only problem has been finding a way to run those parameters, as you cannot use the 'stuffcmds' command itself to call the parameters by running something like "stuffcmds -dll dlls/hl.dll". This will not even work on PC

    If you do some research into the proper parameter registry values, try looking for registry values to initialize/dial the modem on startup. Because if that can work, the game would very likely be able to see the internet connection. Tossing out the idea of needing a DLL to handle everything, but we should still find out how to load so we can port a crapton of multiplayer/singleplayer mods

    Maybe those parameters will work after all. I hope so. We would not need any hacking if it does work
     
    Anthony817 likes this.
  4. Trident6

    Trident6 Spirited Member

    Joined:
    Oct 17, 2015
    Messages:
    119
    Likes Received:
    55
    sa1 and TerdFerguson like this.
  5. TerdFerguson

    TerdFerguson ls ~/

    Joined:
    Apr 27, 2015
    Messages:
    664
    Likes Received:
    353
    I briefly took a glance at that, but it looks like code to make another exe to run an exe with params. I'm looking for the correct values to add to the autorun.reg file a couple posts back. When I obtain or make a coders cable I can actually use the command line

    I did some test using the '-game cstrike' parameter, it did not seems to do anything. But loading a map from the auto load vmu file made it stop loading in the last 15%. I did not test without the parameter so I do not think that is conclusive whether it stops loading because of the parameter

    I made a disc image of the WinCE image set to run "microphone.exe", a sample application in the devkit/WinCE image. I uploaded to mega in case anyone wants to try it, it's the first time I was actually able to use one of my two Dreamcast microphones. I wanted to see if a headset with a 3.5mm mic input worked for the Dreamcast, now I can test that after I buy one

    I do not think there is a WinCE game that uses the mic, so I think the fact that it works proves the code to use it is in the WinCE image. And probably can be coded into the DLL once we finally get it to load

    I hope this does not count as piracy, it's just a sample application from the devkit which is linked in these DC-dev boards multiple times
    https://mega.nz/#!WEwE1IoC!Q4nGZLZO02lhNDgYHGy5LFD10Uil9j-sV7ZIblsRBsQ
     
    wombat and sa1 like this.
  6. TerdFerguson

    TerdFerguson ls ~/

    Joined:
    Apr 27, 2015
    Messages:
    664
    Likes Received:
    353
    Okay so here is where I'm at with this stuff:

    I found this in platform.reg
    Code:
    IF INITMODEM
    [HKEY_LOCAL_MACHINE\WDMDrivers\BuiltIn\Modem]
       "Dll"="SEG_ROCK.DLL"
       "Order"=dword:3
       "FriendlyName"="Built-in Modem"
       "Properties"=hex: ff,ff, 01,00, ff,00,00,00, 00,00,00,00, ff,ff,00,00, ff,ff,00,00, 00,08,07,00, 00,00,00,00, 00,00,00,00, 00,00,00,00, 00,c2,01,00, 08,00, 00,01, ff,ff,ff,ff, ff,ff,ff,ff
    ENDIF
    
    IF INITSCSI
    [HKEY_LOCAL_MACHINE\WDMDrivers\BuiltIn\SCSI]
       "Dll"="S7SCSI.DLL"
       "Order"=dword:3
       "FriendlyName"="WDM SCSI Driver"
    ENDIF
    I'm not 100% sure if it means: IF INITMODEM --> HKLM\WDMD\BI\Modem or ENDIF --> IF INITSCSI. I'm pretty sure it is IF INITMODEM it points the the modem registry key though

    I tried following this https://msdn.microsoft.com/en-us/library/ms901773.aspx and adding
    Code:
    [HKEY_LOCAL_MACHINE\init]
    
    ;    "Autorun"="appname.exe"
    
        "Launch11"="shell.exe"
    
        "Launch40"="wdevice.exe"
        "Depend40"=hex:1e,00
    
        "Launch50"="microstk.exe"
        "Depend50"=hex:28,00
    
        "Launch60"="sysstart.exe"
        "Depend60"=hex:32,00
      
        "Launch70"="RAS.EXE"
        "Launch80"="SEG_ROCK.DLL"
    
    then setting the autorun.reg file to boot half-life after the boot phase with the added modem files launches. But nothing happened at the second Sega splash screen. So it probably was not setup correctly or RAS.EXE needs to be connected to the CE software debugger

    So what I'm trying to do is
    Setup the registry to dial the modem automatically within the OS before it launches the Half-Life binary. Then the internet connection would be setup similar to how it is on PC; The OS establishes the connection and the game uses the OS's connection. It's probable that the GoldSRC engine could use the connection established within WinCE. I'm not sure how or where we'd call the "IF INITMODEM" var/function from the registry

    Find alternative ways to adding command line parameters during launch. Possibly by making an LNK file/shortcut that works with WinCE. I found this about adding parameters when launching from the registry
    http://www.embedded101.com/Articles...tainerSrc=[G]Containers/_default/No Container
    This would explain why the parameters had no effect when I tried them yesterday

    It would be nice to get the modem to initialize and load the DLL without the need for hacking anything. I think as of now it's more or less a matter of figuring out how considering we have full manipulation of an OS so to speak

    I hope others that have more knowledge about controlling WinCE registry, if Win32/WinCE shortcuts are different, and how the file system would be setup for the Dreamcast WinCE kernel (should the lnk file be "c:\halflife_dc.exe" or "\cd-rom\halflife_dc.exe") could offer some suggestions
     
    Anthony817 and sa1 like this.
  7. wombat

    wombat SEGA!

    Joined:
    Mar 14, 2004
    Messages:
    2,671
    Likes Received:
    319
    @TerdFerguson once again I would like to applaud you on your dedication and progress on this matter, every post you make regarding this subject is very detailed and interesting. So keep up the good work :)
     
    Anthony817, sa1 and TerdFerguson like this.
  8. TerdFerguson

    TerdFerguson ls ~/

    Joined:
    Apr 27, 2015
    Messages:
    664
    Likes Received:
    353
    I did some research on the use of INITMODEM for WinCE and found in the WinCE sticky thread in these boards
    http://assemblergames.com/l/threads...ndows-ce-for-dreamcast-sdk-version-1-0.32770/

    So INITMODEM does not dial the modem, only loads the driver. Which is already done considering I have the modem and RAS/WinSock drivers set to load on launch. I'm not quite sure what I'm looking for to dial the modem on launch of the OS image before half-life launches. If I had a coders cable this would be a whole lot easier to test things
     
  9. TerdFerguson

    TerdFerguson ls ~/

    Joined:
    Apr 27, 2015
    Messages:
    664
    Likes Received:
    353
    I actually just found this in that same thread
    Code:
    Sega Passport
    
    Sega Passport information is registry data for network communications. It is stored in the internal flash memory. When Windows CE for Dreamcast boots up, it checks the Sega Passport information in the flash memory. If valid Sega Passport information is found, it is loaded into the system registry HKEY_LOCAL_MACHINE\Comm\NetworkInfo, the built-in modem is configured accordingly, and a remote access server (RAS) entry named ISP0 is created. All applications should access the Sega Passport information through the registry. The registry value NetworkInfo is of type REG_BINARY and contains a binary dump of a NetworkInfo type, which is defined in the Netinfo.h header file.
    Any changes made to the Sega Passport information in the internal flash memory are not reflected in the registry until the system reboots or the FlashLoadNetworkInfo function is called.
    FlashLoadNetworkInfo
    
    This function loads Sega Passport information into the system registry and configures the built-in modem accordingly. It also creates a RAS entry named ISP0 (ISP-zero) with dial-up information from the Sega Passport.
    Syntax
    This is what I will be testing tomorrow if my 100 CD-Rs I ordered arrives. I'm hoping they do
     
    sa1 and Anthony817 like this.
  10. TerdFerguson

    TerdFerguson ls ~/

    Joined:
    Apr 27, 2015
    Messages:
    664
    Likes Received:
    353
    "Passport.exe" did not dial the modem and I realized why
    It just appends the information from the Dream Passport modem configuration in the flash rom to the registry and outputs it to the debug console. But the source code for this is in the SDK in (assuming default install dir) C:\WCEDreamcast\samples\misc\passport

    But I found more information about establishing an internet connection
    And information about accessing the TCP/IP stack which is what we'd need I think
    I pretty much require a coders cable or hardwiring the serial pins to a serial cable to go any further into this

    It's very likely this cannot be done by just adding the information to the registry to run on launch, though that remains a possibility. We'll probably need a new EXE to be coded at some point that appends the modem configuration in flash rom to the registry, calls the WiniNet modem initialization functions then uses the WinSock TCP/IP stack before launching the Half-Life EXE. Either in the same disc or using a boot-disc if the WinCE kernel remains loaded in RAM. There is source code for using multiple discs in a WinCE Dreamcast sample application, the readme is
    But before any of that, we must find out how to load the mod/extension DLLs. Because even if we do acheive all of that either by registry configuration or by the application I just outlined; It remains uncertain if Half-Life will just be able to use the internet connection established within WinCE, though that is certainly a possibility because of the way the engine is built to use the internet in such a way on PC. If it cannot, then the handling of the WinCE internet can likely be added within the DLL. Along with adding microphone support

    I'm going to try connecting one of my Dreamcasts to the WinCE SDK and try running those command line parameters using the actual command line in the SDK. Or in the meantime since I'd have to get all the parts, test alternative ways of running the parameters. I may try a bunch of modified LNK shortcuts, but I do not have a high expectation of that working properly
     
    sa1 and Anthony817 like this.
  11. TerdFerguson

    TerdFerguson ls ~/

    Joined:
    Apr 27, 2015
    Messages:
    664
    Likes Received:
    353
    One last thing, lets not forget that both WiniNet and WinSock are in the WON version of Half-Life's import table within the EXE. And the function calls match those outlined in the documentation excerpt I quoted
    [​IMG]
     
    Anthony817 likes this.
  12. TerdFerguson

    TerdFerguson ls ~/

    Joined:
    Apr 27, 2015
    Messages:
    664
    Likes Received:
    353
    Update:

    I've found it very likely command line arguments can be tested using a coders cable
    [​IMG]
    That is in one of the options in the WinDBG debug tool. So that is likely where that would be tested. If I had a coders cable I could test, among other things like fiddling with the registry and trying to dial the modem

    I also found other DLLs and EXEs can be included in the Dreamcast Windows CE binaries (0winceos.bin and nk.bin) compiled by Dreamcast Image Configuration Tool
    [​IMG]
    I set the hl.dll as a module in the OS image. So I did load it into memory, just not within the game so there was no change. But this gives another area to potentially add things into the OS instead of hacking

    Setting the half-life EXE as a module makes the engine crash on startup. Likely because it's being loaded into memory twice. I also tried parameters in the "enviroment variables" field of the Image Configuration Tool, which made the engine crash. But I'm not sure if that was also while having the EXE included in the OS binaries

    So if I had a coders cable, I could test a lot more. Until I find one I'm running out of other things to try
    ---
    Does anyone have any input regarding the possibilities of using the actual OS?
     
    Anthony817 and sa1 like this.
  13. Trident6

    Trident6 Spirited Member

    Joined:
    Oct 17, 2015
    Messages:
    119
    Likes Received:
    55
    In what sense? Assuming HL uses a standard WinMain() like the rest of the CE demos, it should have an "LPTSTR lpCmdLine" argument that contains the ASCII command line used to launch the program. This is parsed with GetCommandLine() or GetCommandLineW() in CE I believe.
     
    TerdFerguson likes this.
  14. TerdFerguson

    TerdFerguson ls ~/

    Joined:
    Apr 27, 2015
    Messages:
    664
    Likes Received:
    353
    I'm pretty sure a small program can be coded that just launches the exe with parameters. If it was one .c file you could just recompile it with different parameters

    In the documentation for the sample applications a bunch of them have descriptions of different cmdline parameter functions. So you can run them on a Dreamcast. But this was for development/debugging on a devbox/coders cable retail unit. So we'd have to get them to run without the dev software anyway

    It may not do what we want it to do, but the documentation does show it can be done and there are cmdline arguments as strings in the hl exe
     
  15. TerdFerguson

    TerdFerguson ls ~/

    Joined:
    Apr 27, 2015
    Messages:
    664
    Likes Received:
    353
     
  16. TerdFerguson

    TerdFerguson ls ~/

    Joined:
    Apr 27, 2015
    Messages:
    664
    Likes Received:
    353
    What's neat is, those screenshots of the WinCE registry a few pages back, when you run that same loader program with the WinCE image you can see all of the changes to the registry. Along with being able to use the sample applications, when you press esc to exit like in the previous post it goes back to the loader which is very nice too

    I can also verify the modem information from flashrom seems to be added to the registry on kernel load
    [​IMG]
    This is nice because it makes a middle ground from loading the kernel to launching an app. As well as verifying registry changes and such were loaded in memory
     
    Last edited: Mar 24, 2016
    sa1 likes this.
  17. dcnigma

    dcnigma Active Member

    Joined:
    Nov 16, 2014
    Messages:
    47
    Likes Received:
    15
    @TerdFerguson I would like to applaud you also for your findings you found. you came a long way read al 12 pages ;)
    Thumps Up

    One thing found that this post was very familiar, I thought to myself did i reply to this or not....
    So i checkt my reply's and found this post Half-Life multiplayer theory and i am pretty sure I was the guy that said there where multiplayer commands haha.
    But al jokes a side good finds very interesting stuff
    Seen very good progress on this getting it to work.

    Well after reading al 12 pages i wonder did you ever checkt a Dreamcast windows ce game that supported modem?
    Did a search for Windows Ce games found this :
    source

    So i checkt every game cover to find out if there are games using modem on CE
    [​IMG]
    [​IMG]

    If I was you I would check those 2 games and try to find the dll or exe file responsible for loading the BBA or modem for those games.
    my presumption is that you will find a program to setup or initiate the modem something like that.
    Someone here already hinted this because every game had there own settings menu.
    From what i have read you can load a EXE before you load the HALFLIFE_DC.EXE so if you can load the needed exe file first this would be the fix you need. just my 2 cents :p

    There is also a command to check all commands for console in console menu of half life: slist Basic Console Commands
    just saying maybe there are some custom commands like for half life 2 survivor that i found by cross reference those two.
     
    Anthony817, TerdFerguson and sa1 like this.
  18. treyldog

    treyldog Active Member

    Joined:
    Jul 22, 2015
    Messages:
    28
    Likes Received:
    8
    if you were to do that and have a functioning server, would that help at all in bringing the next tetris back online? I'm no tech guy, just wondering
     
  19. dcnigma

    dcnigma Active Member

    Joined:
    Nov 16, 2014
    Messages:
    47
    Likes Received:
    15
    This would only help to start the modem for half life and then you would be able to load a direct connection form ip 2 ip.
    For Next Tetris online I don't think. Never seen the online side of the game.
    But if it would need a server it should always need a server.

    Half life is different because its server and client in one.
    Maybe Next Tetris online used just a simpel lobby system that could connect ips to each other but this still needs a server to handle this.
    So in short Nope :cool:

    Not saying that server emulation is been done in the past but this is a hole other thing.
    Need to find out how Next Tetris online worked.. First you need to re patch the IP adres for the lobby to a working server then you need to find out how next tetris would accept the commands form the server and visa versa. So in theory it could be done but it would be a lot of forking around. And not sure all info is found on client side so some out side the box thinking would also be required to resolve some issues. If its a lobby system otherwise it would be impossible.
     
    Last edited: Mar 25, 2016
    Anthony817 likes this.
  20. TerdFerguson

    TerdFerguson ls ~/

    Joined:
    Apr 27, 2015
    Messages:
    664
    Likes Received:
    353
    Tetris can eat anus compared to the possibility of a multiplayer ready, moddable/expandable GoldSRC engine on the Dreamcast

    That was also me in that "multiplayer theory" thread. After your post I decided to look into it myself and have come A LOT farther than I thought I would. The fact that it runs on WinCE and the way GoldSRC is coded/designed makes this the "perfect storm"
    -----
    4x4, Pool, and Starlancer all have modem support. I can see if there is a seperate binary for the modem stuff, but I'd imagine it was all coded in the game. I'll look into it

    Though in "HTMLSAMP.EXE", a WinCE sample application which is more or less a demo of Internet Explorer for Dreamcast, there is this
    [​IMG]
    Full instructions for a ".ras" file, which is more or less a file that "HTMLSAMP" needs to dial the modem (or the OS would dial it?)
    I'm going to make one of those and see how it works for HTMLSAMP, then see if the same will apply for HL which I doubt but just to test it

    Also here is hl.dll present in the Windows folder of the CE viewer program (all of the modules loaded into RAM it looks like).
    [​IMG]
    Showing that it is indeed loaded with the OS, it does not do anything but it shows new modules can be added

    I think it's ironic that Tetris got mentioned though, because the way it looks now it'd probably be harder to reverse engineer a server for Tetris than it would to get this working

    Though I do not think that dialing the modem should be the main objective. Loading the mod dlls should be. Because then the engine can be greatly expanded, many games can be ported, and code for using the modem could be added into it

    I looked into ways of "injecting" a dll into an exe a few weeks ago, and this is mostly done, on PC at least, by loading it into memory after the injectee program has started


    So if that hl.dll cannot be loaded natively in-game in any way, then injecting it or another dll to load the hl.dll properly is an option. Which could probably work. Because it uses Windows, and you can control the entire OS kernel

    This is nice @dcnigma because as you read a few pages back, I said we could probably just use the OS to our advantage. It seems I've figured out how that can be done. If I could only figure out how to run those parameters..
     
    Anthony817 likes this.
sonicdude10
Draft saved Draft deleted
Insert every image as a...
  1.  0%

Share This Page