REQUEST: Port Half-Life SDK Extension DLLs CLEANLY to Windows CE

Discussion in 'Sega Dreamcast Development and Research' started by TerdFerguson, Dec 3, 2016.

  1. megavolt85

    megavolt85 Peppy Member

    Joined:
    Jan 8, 2015
    Messages:
    311
    Likes Received:
    454
    on dreamcast is function don't used, you can't create new folder on cd :)

    Code:
    void CTestHull :: BuildNodeGraph( void )
    {
       
    }
    
    int CGraph :: FSaveGraph ( char *szMapName )
    {
       (void *) szMapName;
        return FALSE;
    }
    
    int CGraph :: FLoadGraph ( char *szMapName )
    {
        (void *) szMapName;
        return FALSE;
    }
    [code]
     
    TerdFerguson likes this.
  2. megavolt85

    megavolt85 Peppy Member

    Joined:
    Jan 8, 2015
    Messages:
    311
    Likes Received:
    454
    add to util.cpp

    Code:
    int strnicmp(const char *a, const char *b, int n)
    {
        const char *s1 = a, *s2 = b;
       
        while (toupper(*s1) == toupper(*s2))
        {
            if (*s1 == 0 || !n)
                return 0;
            s1++;
            s2++;
            n--;
        }
       
        return toupper(*(unsigned const char *)s1) - toupper(*(unsigned const char *)(s2));
    }
    
    add to helper.h

    Code:
    extern int strnicmp(const char *a, const char *b, int n);
    
     
    TerdFerguson likes this.
  3. TerdFerguson

    TerdFerguson ls ~/

    Joined:
    Apr 27, 2015
    Messages:
    664
    Likes Received:
    353
    Where should this be added in nodes.cpp?
     
  4. megavolt85

    megavolt85 Peppy Member

    Joined:
    Jan 8, 2015
    Messages:
    311
    Likes Received:
    454
    this need replace in nodes.cpp

    add to util.cpp

    Code:
    int isprint(int ch)
    {
        if (ch > 0x1F && ch < 0x7F)
            return 1;
       
        return 0;
    }
    
    add to helper.h

    Code:
    extern int isprint(int ch);
    
     
    TerdFerguson likes this.
  5. megavolt85

    megavolt85 Peppy Member

    Joined:
    Jan 8, 2015
    Messages:
    311
    Likes Received:
    454
    add to util.cpp

    Code:
    int isalpha(int ch)
    {
        if ((ch > 0x40 && ch < 0x5B) || (ch > 0x60 && ch < 0x7B))
            return 1;
      
        return 0;
    }
    
    int isdigit(int ch)
    {
        if (ch > 0x2F && ch < 0x3A)
            return 1;
      
        return 0;
    }
    
    add to helper.h

    Code:
    extern int isalpha(int ch);
    extern int isdigit(int ch);
    
     
    TerdFerguson likes this.
  6. TerdFerguson

    TerdFerguson ls ~/

    Joined:
    Apr 27, 2015
    Messages:
    664
    Likes Received:
    353
    The only errors left are
    There are two source code folders, what I'm using is "OldSourceCode". I used that to ensure it'd work with pre-steam half-life. But it complains about missing exports on Win32. The second folder "SourceCode", has a bunch of new files, and their own errors

    I want to finish "OldSourceCode" first, then I'll look at the newer "SourceCode" folder. I was looking before and the only errors for client.dll are syntax errors from Win32 winsock.h, and a few input (for controller/keyboard/etc) undeclared identifiers. So we already did a lot, or most, of the total errors for both "old" and "new" sources. "New" only adds a few more, at least in client.dll

    Thanks a lot for walking me through this @megavolt85 , I appreciate it a lot. You're credited in //comments for everything you re-implemented

    Edit: But how exactly do I replace those functions in nodes.cpp properly?
     
  7. megavolt85

    megavolt85 Peppy Member

    Joined:
    Jan 8, 2015
    Messages:
    311
    Likes Received:
    454
    upload player.cpp and sound.cpp
     

    Attached Files:

    TerdFerguson likes this.
  8. TerdFerguson

    TerdFerguson ls ~/

    Joined:
    Apr 27, 2015
    Messages:
    664
    Likes Received:
    353
    Here it is
     

    Attached Files:

  9. megavolt85

    megavolt85 Peppy Member

    Joined:
    Jan 8, 2015
    Messages:
    311
    Likes Received:
    454
    add to util.cpp

    Code:
    char *itoa(int value, char *str, int base)
    {
        int i, n = 2, tmp;
        char buf[33];
    
        switch(base)
        {
            case 16:
              
                for(i = 0; i < 8; ++i)
                    if(value / base > 0)
                        n++;
              
                snprintf(str, n, "%x" ,value);
                break;
            
            case 10:
          
                for(i = 0; i < 10; ++i)
                    if(value / base > 0)
                        n++;
              
                snprintf(str, n, "%d" ,value);
                break;
          
            case 8:
                for(i = 0; i < 11; ++i)
                    if(value/base > 0)
                        n++;
                snprintf(str, n, "%o" ,value);
                break;
          
            case 2:
                for(i = 0, tmp = value; i < 32; ++i)
                {
                    if(tmp / base > 0)
                        n++;
                  
                    tmp /= base;
                }
              
                for(i = 1 ,tmp = value; i < n; ++i)
                {
                    if(tmp % 2)
                        buf[n-i-1] = '1';
                    else
                        buf[n-i-1] = '0';
                  
                    tmp /= base;
                }
              
                buf[n-1] = '\0';
                strcpy(str, buf);
                break;
          
            default:
                return NULL;
        }
        return str;
    }
    
    add to helper.h

    Code:
    extern char *itoa(int value, char *str, int base);
    
     

    Attached Files:

  10. TerdFerguson

    TerdFerguson ls ~/

    Joined:
    Apr 27, 2015
    Messages:
    664
    Likes Received:
    353
    One final error for "OldSourceCode", in the last function replacement
    errors.png
    Thanks a shitload again, much appriciated

    After this branch is finished, I'm going to attach both client.dll and hl.dll source trees from "OldSourceCode"
    Then I'll apply all of your fixes in both hl.dll and client.dll in the newer "SourceCode" folder and post the remaining errors

    Edit: After both "OldSourceCode" and "SourceCode" are done for Windows CE, I'm going to create a branch of both for Win32. So if this ends up working, mods can be made compatible with both Dreamcast and PC

    Edit2: "OldSourceCode" hl.dll might be supported, so using the newer source might not be needed
    Thanks again
     
    Anthony817 likes this.
  11. megavolt85

    megavolt85 Peppy Member

    Joined:
    Jan 8, 2015
    Messages:
    311
    Likes Received:
    454
    replace in util.cpp itoa function

    Code:
    static const char itoa_lower_digits[16] = "0123456789abcdef";
    
    char *itoa(int value, char *str, int base)
    {
        *str = 0;
       
        do
            *--str = itoa_lower_digits[value % base];
        while ((value /= base) != 0);
    
        return str;
    }
    
     
    Anthony817 and TerdFerguson like this.
  12. TerdFerguson

    TerdFerguson ls ~/

    Joined:
    Apr 27, 2015
    Messages:
    664
    Likes Received:
    353
    Array bounds overflow
    error_util.png
     
  13. megavolt85

    megavolt85 Peppy Member

    Joined:
    Jan 8, 2015
    Messages:
    311
    Likes Received:
    454
    OMG need more sleep, don't apply itoa changes, it's damage memory
     
    Anthony817 and TerdFerguson like this.
  14. TerdFerguson

    TerdFerguson ls ~/

    Joined:
    Apr 27, 2015
    Messages:
    664
    Likes Received:
    353
    Also, these are the only new errors with the new "SourceCode" folder

    Only one new undeclared identifier error. Changes in nodes.cpp, player.cpp, and sound.cpp need to be reapplied, I'm not sure what you did. But that's it
    hl_newsrc.png

    Client.dll is only one new undeclared identifier error, same as hl.dll. And others are from Win32 Winsock API that needs to be converted to Windows CE Winsock API subset. And a parameter error in greiger.cpp for the PlaySound() function. But that's it and it's done
    client_newsrc.png
    I'm willing to knock these errors out and upload the sources if you're willing to continue helping. Again many thanks, much appreciated, I've been trying to do this for like a year lol
     
  15. megavolt85

    megavolt85 Peppy Member

    Joined:
    Jan 8, 2015
    Messages:
    311
    Likes Received:
    454
    Code:
    const char itoa_lower_digits[17] = "0123456789abcdef";
    
    char *itoa(int value, char *str, int base)
    {
        int i = value;
        
        do
            *str++;
        while ((i /= base) != 0);
        
        *str = '\0';
        
        do
            *--str = itoa_lower_digits[value % base];
        while ((value /= base) != 0);
        
        return str;
    }
     
    TerdFerguson likes this.
  16. megavolt85

    megavolt85 Peppy Member

    Joined:
    Jan 8, 2015
    Messages:
    311
    Likes Received:
    454
    add to util.cpp

    Code:
    int isalnum(ch)
    {
        if(isalpha(ch) || isdigit(ch))
            return 1;
       
        return 0;
    }
    
    add to helper.h

    Code:
    extern int isalnum(int ch);
    
     
    TerdFerguson likes this.
  17. TerdFerguson

    TerdFerguson ls ~/

    Joined:
    Apr 27, 2015
    Messages:
    664
    Likes Received:
    353
    I got this
    error_sspace.png

    Removed the redefinitions from each source and it compiled
    hl_compile.png
    Amazing, I cannot understate my thanks for your fixes @megavolt85

    I'll prepare the source trees for each "OldSourceCode" hl.dll and client.dll now and attach to this post. Compiled hl.dll is attached for now

    Edit: @megavolt85 are you willing to help with the last errors in the newer source branch right now?

    Edit2:

    "OldSourceCode" branch of Client.dll and game.dll ready to open and compile in Windows CE Dreamcast SDK

    client.dll --> hldc_dlls\cl_dll\client\client.dsw
    game.dll --> hldc_dlls\dlls\hl\hl.dsw
    http://hldc.dreampipe.net/sdk/hldc_dlls-0.5.zip

    Will update HLDC-SDK with the source code after I know if we're going to continue with the remaining errors in newer "SourceCode" folder (I'll upload the HLSDK 2.1 installer now with the original source code branches i'm talking about)
     

    Attached Files:

    Last edited: Dec 14, 2016
  18. megavolt85

    megavolt85 Peppy Member

    Joined:
    Jan 8, 2015
    Messages:
    311
    Likes Received:
    454
    upload new nodes.cpp, player.cpp, sound.cpp, winsock.h, hud_servers.cpp, inputw32.cpp
     
  19. TerdFerguson

    TerdFerguson ls ~/

    Joined:
    Apr 27, 2015
    Messages:
    664
    Likes Received:
    353
    Amazing, attached

    I'm going to create a full .msi installer for the HLDC-SDK ( http://hldc.dreampipe.net/sdk/hldc-sdk-0.0.7.zip ) and HLSDK, with client.dll and hl.dll source codes, ready to open\modify\compile with WCE\Dreamcast SDK after the new "SourceCode" branch is finished. Giving full credit to everyone who helped

    So essentially it will be the full HLSDK 2.1 ported to Windows CE, and all of the tools needed to create and port mods for Half-Life on Dreamcast
     

    Attached Files:

    Anthony817, truemaster1 and Xerxes3rd like this.
  20. truemaster1

    truemaster1 Enthusiastic Member

    Joined:
    Nov 10, 2015
    Messages:
    512
    Likes Received:
    226
    you guys are amazing!!! will this fixed opposing force as well??
     
sonicdude10
Draft saved Draft deleted
Insert every image as a...
  1.  0%

Share This Page