Announcement

Collapse
No announcement yet.

Getting started with ps2smap

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Getting started with ps2smap

    So I have attempted to start trying out some ps2 side network communication and it did not go all that well. First I compiled the ps2smap.irx and converted it to a *.o. Then I added that to the Makefile. Copied the smap.h and types.h (required by the smap.h) to the directory with my makefile. Then made a quick main.c just to test the compiling. It worked. Then I added a function from ps2smap and compiled it. It gave me an error stating that SMapInit is undefined. Can anyone help me getting started with this?

    main.c:

    Code:
    #include <debug.h>
    #include <smap.h>
    #include <stdio.h>
    
    int main(void)
    
    {
    
          printf("Begun\n");
    
          SMapInit(ARG1, ARG2, ARG3); //I was just checking that it would recognize SMapInit, then I would worry about the correct arguments
    
          return 0;
    
    }
    Last edited by dnawrkshp; 08-06-2012, 10:14:29 PM.

  • #2
    This isn't entirely relevant, but if the idea comes to mind... Don't use ps2rd as a reference for using this module. I'm not sure if it's this specific one causing the issue, but however networking was modified on ps2rd makes it utterly incapable of networking without a direct ps2 to pc cable connection.

    Comment


    • #3
      I wasn't planning to. Although, some samples would be lovely. Can't seem to find any but ee-echo. Which isn't the most useful thing. Actually let me check if there is a special lib included in the makefile. Well turns out that there is a lib include called "ps2ip" and I will attempt to use that ASAP.

      Turns out it doesn't integrate smap.
      Last edited by dnawrkshp; 08-06-2012, 10:52:06 PM.

      Comment


      • #4
        Originally posted by LiquidManZero View Post
        This isn't entirely relevant, but if the idea comes to mind... Don't use ps2rd as a reference for using this module. I'm not sure if it's this specific one causing the issue, but however networking was modified on ps2rd makes it utterly incapable of networking without a direct ps2 to pc cable connection.
        That's completely wrong.

        1) PS2rd allows you to select which SMAP implementation to use; either the standard PS2SDK module or the SMS variant. See https://github.com/mlafeldt/ps2rd/bl...p.txt#L102-105

        The IOP modules can be found here: https://github.com/mlafeldt/ps2rd/tree/master/iop

        2) SMAP has a standard interface. That makes the code really simple as the loader doesn't have to care about the SMAP implementation and can use the network stack as-is.

        Check the source code of PS2rd on how to invoke SMapInit().

        Code:
        [ps2rd (master)]$ git grep -i smapinit
        iop/SMSMAP/main.c:static int SMapInit ( IPAddr IP, IPAddr NM, IPAddr GW ) {
        iop/SMSMAP/main.c:}  /* end SMapInit */
        iop/SMSMAP/main.c: return !SMapInit( IP, NM, GW );
        iop/smap/main.c:SMapInit(IPAddr IP,IPAddr NM,IPAddr GW)
        iop/smap/main.c:        dbgprintf("SMapInit: Dev9 detected & initialized\n");
        iop/smap/main.c:                printf("SMapInit: Fatal error - unable to create iSendMutex\n");
        iop/smap/main.c:                printf("SMapInit: Fatal error - unable to create iSendReqMutex\n");
        iop/smap/main.c:        dbgprintf("SMapInit: SMap initialized\n");
        iop/smap/main.c:        dbgprintf("SMapInit: Interrupt-handler installed\n");
        iop/smap/main.c:        dbgprintf("SMapInit: Timer installed\n");
        iop/smap/main.c:        dbgprintf("SMapInit: NetIF added to ps2ip\n");
        iop/smap/main.c:        if      (!SMapInit(IP,NM,GW))

        Comment


        • #5
          I understand the use of SMapInit(), however, I can not implement it without the compiling error of " main.c: undefined reference to `SMapInit' ". I have looked at multiple samples and they all just add the .irx and include smap.h. This is quite troubling!

          Comment


          • #6
            For one thing, if smap.h is part of your project, you should probably have its include in quotes rather than brackets. Your issue is how you're attempting to build smap into your project. Whether it's just a makefile issue or something a bit more expansive I can't say, since all you've provided is your C code.

            Comment


            • #7
              Could it be that you're trying to call SMAPInit() from EE? Actually, it's a local function that is called from inside the SMAP IOP module (*.irx). More precisely, the SMAP module accepts IP, network mask, and gateway as arguments and then passes them to SMAPInit(). All that is done inside _start() which is run when the module is loaded from EE. See https://github.com/mlafeldt/ps2rd/bl...ain.c#L492-538

              Comment


              • #8
                Originally posted by misfire View Post
                That's completely wrong.

                1) PS2rd allows you to select which SMAP implementation to use; either the standard PS2SDK module or the SMS variant. See https://github.com/mlafeldt/ps2rd/bl...p.txt#L102-105
                That option was tested. Regardless of value if there was a router or switch between the ps2 and pc ends... The packets just got lost. Unless something's been done about that about the past 6 months that's still the case.

                There's only one obvious point of failure when all other homebrew using either of those two modules will work networked with that kind of hardware involved.

                Comment


                • #9
                  Okay got that working thanks misfire.

                  I am now trying to get ps2ip_init() to work. It seems to freeze.

                  Pyriel: Here's the makefile and main.c;

                  main.c:

                  Code:
                  #include <stdio.h>
                  #include <debug.h>
                  #include "ps2ip.h"
                  #include "smap/smap.h"
                  #include <sifrpc.h>
                  #include <iopcontrol.h>
                  
                  #include <loadfile.h>
                  
                  int main(void)
                  
                  {
                  
                  	SifInitRpc(0);
                  	init_scr();
                  
                  	scr_printf("	Begun\n");
                  	
                     	if (SifLoadModule("mc1:/irx/PS2DEV9.IRX", 0, NULL) < 0 ) //I don't like using ps2client, so I have a folder with some irx modules
                  	{
                          scr_printf("	Could not load PS2DEV9.IRX!\n");
                  	return -1;
                  	}
                  
                  	scr_printf("	Loaded irx modules\n");
                  
                  	ps2ip_init();
                  
                  	scr_printf("	Initialized ps2ip!\n");
                  
                  	return 0;
                  
                  }
                  Makefile;

                  Code:
                  EE_BIN = ethtest.elf
                  
                  EE_OBJS = main.o Obj/ps2smap_irx.o Obj/ps2ip_irx.o Obj/ps2ips_irx.o
                  
                  EE_LIBS = -lps2ip -lc -ldebug
                  
                  
                  
                  all: $(EE_BIN)
                  
                  
                  
                  clean:
                  
                  	rm -f *.elf *.o
                  
                  
                  
                  include $(PS2SDK)/samples/Makefile.pref
                  
                  include $(PS2SDK)/samples/Makefile.eeglobal
                  When I run that the screen prints out:

                  Begun
                  Loaded irx modules

                  and then nothing.
                  Last edited by dnawrkshp; 08-07-2012, 11:07:08 PM.

                  Comment


                  • #10
                    Figured it out: http://forums.ps2dev.org/viewtopic.p...ight=ps2ipinit

                    Also didn't realize that if I added the irx.o's to the Makefile, it still meant I had to load the irx's with SifLoadModule().

                    Now works fine, no Makefile changes (unless I should get rid of the irx.o's).

                    ip_addr.h seems to have conflicting definitions for a bunch of ip4_addr?'s. Is there a way around that? I am trying to be able to declare an ip address with 'ip_addr'.

                    main.c:

                    Code:
                    #include <stdio.h>
                    #include <debug.h>
                    #include <kernel.h>
                    #include "ps2ip.h"
                    #include "smap/smap.h"
                    #include "sifrpc.h"
                    #include <iopcontrol.h>
                    #include <loadfile.h>
                    
                    int Initialize(void);
                    
                    int main(void)
                    {
                    
                    	Initialize();
                    
                    	return 0;
                    
                    }
                    
                    int Initialize(void)
                    {
                    
                    	int a;
                    	SifInitRpc(0);
                    	init_scr();
                    
                    
                    	scr_printf("	Beginning initialization!\n");
                    	
                    	a = SifLoadModule("mc1:/irx/POWEROFF.IRX", 0, NULL);
                    	if (a < 0 ) //I don't like using ps2client, so I have a folder on my mc1 with some IRX modules
                    	{
                            scr_printf("	Could not load POWEROFF.IRX! %d\n", a);
                    	return -1;
                    	}
                    
                    	scr_printf("	Loaded POWEROFF.IRX!\n");
                    
                    	a = SifLoadModule("mc1:/irx/PS2DEV9.IRX", 0, NULL);
                       	if (a < 0 )
                    	{
                            scr_printf("	Could not load PS2DEV9.IRX! %d\n", a);
                    	return -1;
                    	}
                    
                    	scr_printf("	Loaded PS2DEV9.IRX!\n");
                    
                    	a = SifLoadModule("mc1:/irx/PS2IP.IRX", 0, NULL);
                    	if (a < 0 )
                    	{
                            scr_printf("	Could not load PS2IP.IRX!\n %d", a);
                    	return -1;
                    	}
                    
                    	scr_printf("	Loaded PS2IP.IRX!\n");
                    
                    	a = SifLoadModule("mc1:/irx/DNS.IRX", 0, NULL);
                    	if (a < 0)
                    	{
                            scr_printf("	Could not load DNS.IRX! %d\n", a);
                    	return -1;
                    	}
                    
                    	scr_printf("	Loaded DNS.IRX!\n");
                    
                    	a = SifLoadModule("mc1:/irx/PS2IPS.IRX", 0, NULL);
                    	if (a < 0)
                    	{
                            scr_printf("	Could not load PS2IPS.IRX! %d\n", a);
                    	return -1;
                    	}
                    
                    	scr_printf("	Loaded PS2IPS.IRX!\n");
                    
                    	a = SifLoadModule("mc1:/irx/DNS.IRX", 0, NULL);
                    	if (a < 0)
                    	{
                            scr_printf("	Could not load SMAPX.IRX! %d\n", a);
                    	return -1;
                    	}
                    
                    	scr_printf("	Loaded SMAPX.IRX!\n");
                    
                    	scr_printf("	Loaded irx modules\n");
                    
                    	a = ps2ip_init();
                    	if (a < 0)
                    	{
                    	scr_printf("	Could not initialize ps2ip %d\n", a);
                    	return -1;
                    	}
                    
                    	scr_printf("	Initialized ps2ip!\n");
                    
                    	return 0;
                    
                    }
                    Last edited by dnawrkshp; 08-08-2012, 07:24:04 AM.

                    Comment


                    • #11
                      Originally posted by LiquidManZero View Post
                      That option was tested. Regardless of value if there was a router or switch between the ps2 and pc ends... The packets just got lost. Unless something's been done about that about the past 6 months that's still the case.

                      There's only one obvious point of failure when all other homebrew using either of those two modules will work networked with that kind of hardware involved.
                      I checked the sources again. The functionality of PS2SDK's SMAP module hasn't been touched at all by PS2rd. So when you set sms_modules to false and your IP configuration is correct, the SMAP module should work as in every other homebrew using it.

                      With the SMS modules, the situation is different. We applied a couple of patches to force 100 Mbps full duplex mode. It is quite likely that this is causing problems, especially on newer consoles where the network chips are different.

                      Comment


                      • #12
                        Here's a question. When was the last time you tested ps2rd through a router? And if this did occur, what was the resulting operation?

                        Comment


                        • #13
                          I've looked in everything in ps2eth as well as the tcpip sources and I can't find the header file that allows me to use ip_addr. If I add an include for ip_addr.h, the compiler gives me a ton of redefinition warnings and '[main.o] Error 1'. It would seem that ps2ip.h isn't compatible with ip_addr.h. So what allows me to declare an ip? In the all I just want to use the ps2ip_setconfig() and ps2ip_getconfig() functions.
                          Last edited by dnawrkshp; 08-09-2012, 02:33:42 AM.

                          Comment


                          • #14
                            Originally posted by LiquidManZero View Post
                            Here's a question. When was the last time you tested ps2rd through a router? And if this did occur, what was the resulting operation?
                            Actually, I've never used a router for PS2 stuff; only a switch or crossover cable.

                            Comment


                            • #15
                              Originally posted by dnawrkshp View Post
                              I've looked in everything in ps2eth as well as the tcpip sources and I can't find the header file that allows me to use ip_addr. If I add an include for ip_addr.h, the compiler gives me a ton of redefinition warnings and '[main.o] Error 1'. It would seem that ps2ip.h isn't compatible with ip_addr.h. So what allows me to declare an ip? In the all I just want to use the ps2ip_setconfig() and ps2ip_getconfig() functions.
                              Protip: Clone https://github.com/ps2dev/ps2sdk and run a "git grep ip_addr" so see how it is used. That's one of the first things I would do.
                              Last edited by misfire; 08-09-2012, 03:30:53 AM.

                              Comment

                              Working...
                              X