DS2 Plugin Linker

Discussion in 'Supercard' started by Stormwave, Aug 27, 2010.

Aug 27, 2010

DS2 Plugin Linker by Stormwave at 9:51 PM (8,023 Views / 0 Likes) 35 replies

  1. Stormwave
    OP

    Member Stormwave GBAtemp Regular

    Joined:
    Apr 22, 2010
    Messages:
    223
    Country:
    United Kingdom
    As requested, I've created a program to allow you to create a customised NDS Linker.

    This program will allow you to create an NDS file that will automatically load another, user specified, NDS file. This *should* allow plugins that require a specific path to run from to be run from there original location as plugins.

    This is version 0.3b, I haven't fully tested it by any means. Any testing is welcome. I don't know if this only works with homebrew or if it works with ROMs aswell, I haven't tested that yet.

    Download DS2 Plugin Linker

    The usage can obviously be expanded out of it's created scope. you can use it to link programs into any homebrew loader (EOS, MoonShell2 etc).

    Changelog:

    0.3b - Fixed a critical bug causing the FAT initialization to fail
    0.3 - Completely changed the way it works.
     


  2. CannonFoddr

    Member CannonFoddr Regular GBATemp Lurker

    Joined:
    Sep 23, 2006
    Messages:
    4,106
    Location:
    Sitting by computer
    Country:
    United Kingdom
    Nice first attempt, I've had a (very) quick try - but, as usual with first attempts a couple of things to note
    • > Nothing is mentioned on what you can type into the PC Program
      Putting in JUST the nds name & you HAVE to have the original nds file in the ROOT.
      [I'm guessing IF we type in something like '/homebrew/colors.nds' then we can have 'colors.nds' in the /homebrew/ folder]

      > I've tried it with 4-5 homebrew (left in the root) - all worked EXCEPT 'amplituDS'.
      (It loaded up to the 'splash screen' but locked up (I guess it the way it's been programmed or something, & not to do with the linker.nds)
      Also tried a ROM (Bomberman.nds - also in root) - didn't work

      > BUG - You can't seem to be able to do multiple 'linker.nds' in one sitting.
      You need to shut down the program & restart it, otherwise you get an error stating it can't find 'Loader.dat',
      This is because it is looking for it in the folder you last saved the linker.nds to (i.e. 'x:\_dstwoplug\loader.Dat')

      > SUGGESTION - instead of the PC program to create the linker.nds - could we have a 'default' linker.nds file that looks at the name it been called, then read the corresponding ini file in the same directory which points to where the real nds file is stored. Or would this be to difficult ???

      e.g.
      • Lets say we rename 'linker.nds' to 'colors.nds' & put it into the /_dstwoplug/ folder
        When starting the linker, it sees it was called 'colors' so it looks for the file 'colors.ini' in the same directory
        Once found it then looks for a line like 'nds=' in the ini file
        It take the contents after the '=' (something like '/homebrew/colors.nds') & uses that to run the real nds
      This way people with something like 'DSOrganise' can edit the plugin ini without having to go to a PC to make a new 'linker.nds' each time
     
  3. Stormwave
    OP

    Member Stormwave GBAtemp Regular

    Joined:
    Apr 22, 2010
    Messages:
    223
    Country:
    United Kingdom
    Thanks for the feedback, I'll fix the bug asap.

    As for your suggestion, as far as I am aware it isn't possible. NDS programs have no arguments passed to them at all, unless from specific loaders, therefore it is impossible the NDS file to detect it's own name unfortunately, hence the reason I made the program work in this way.
     
  4. CannonFoddr

    Member CannonFoddr Regular GBATemp Lurker

    Joined:
    Sep 23, 2006
    Messages:
    4,106
    Location:
    Sitting by computer
    Country:
    United Kingdom
    Awww..... what a shame, still it's better than nothing then (unless some other way can be thought of [​IMG] )
     
  5. jurassicplayer

    Member jurassicplayer Completionist Themer

    Joined:
    Mar 7, 2009
    Messages:
    4,280
    Location:
    Pantsuland
    Country:
    United States
    Why not just use Xenon++'s NDSLink? It does almost the exact same thing, only it redirects using either moonshell2 or the fake moonshell2 folder he provided.
     
  6. spinal_cord

    Member spinal_cord Knows his stuff

    Joined:
    Jul 21, 2007
    Messages:
    2,871
    Location:
    somewhere
    Country:
    United Kingdom
    I'm about 95% sure that my iMenu (unreleased so far) sends the program path and filename when loading an nds file.

    If someone can suggest a specific homebrew that requires this, I will test it.
     
  7. CannonFoddr

    Member CannonFoddr Regular GBATemp Lurker

    Joined:
    Sep 23, 2006
    Messages:
    4,106
    Location:
    Sitting by computer
    Country:
    United Kingdom
    I think why this was originally suggested was so that people could place their homebrew in their own folders instead of being 'forced ' to use dstwoplug. If iMenu can launch homebrew that's in a different folder than the plugin one I don't think it matters

    Onto another idea for THIS linker.
    Instead of the pc program telling the linker.nds where the original is stored, how about it telling the linker what line to look for in a linker.ini

    We can copy the linker file over,
    rename it to whatever we like (eg 'link1.nds'),
    it will use 'link1.ini' for the program name & icon,
    when run it will look in 'linker.ini' for the line we told it when using the pc prog e.g. 'link1=',
    and use the path to run the original
     
  8. Xenon++

    Member Xenon++ Taiju Yamada

    Joined:
    Dec 17, 2009
    Messages:
    1,394
    Country:
    Japan
     
  9. CannonFoddr

    Member CannonFoddr Regular GBATemp Lurker

    Joined:
    Sep 23, 2006
    Messages:
    4,106
    Location:
    Sitting by computer
    Country:
    United Kingdom
    It will 'see' that 'Link1=/HBApps/colors' - so that's the program it will run

    We then could have a second 'linker.nds' that been hacked for 'Link2=', but that would load '/HBGame/vghero.nds' instead; 3rd linker.nds hacked to 'Link3=' & so on

    If there's a 'Link=' line that doesn't have a hacked 'linker.nds' in the plugin folder - then it's simply ignored
    If there's a hacked 'linker.nds' but no 'Link=' line - then up pops an error like 'Linkpath does not exist in Linker.ini'

    AFAIK - this won't need any of this ARGV stuff involved - you just need to remember which hacked 'linker.nds' is used for which 'link=' line - hence in my earlier post I suggested 'Link1.nds' would be the one hacked to look @ 'Link1=', 'Link2.nds' @ 'Link2=' etc etc

    Hope that makes it a little clearer to what I meant
     
  10. riverchen

    Member riverchen GBAtemp Fan

    Joined:
    Sep 27, 2009
    Messages:
    406
    Country:
    United States
    Is it possible to have a linker that opens up DS_GAME then autoboots it to my /homebrew/ folder?
     
  11. CannonFoddr

    Member CannonFoddr Regular GBATemp Lurker

    Joined:
    Sep 23, 2006
    Messages:
    4,106
    Location:
    Sitting by computer
    Country:
    United Kingdom
    I don't think so - from what I've read in other posts the DSTwo doesn't have an 'autoboot' facility, which is what I think you are asking for - although I'm sure spinal_cord will know much more than I do about DS2 methods, especially as he been working on an alternative plugin menu
     
  12. riverchen

    Member riverchen GBAtemp Fan

    Joined:
    Sep 27, 2009
    Messages:
    406
    Country:
    United States
    Dang, [​IMG]. I really don't want my plugin menu to be crowded, so i just have like 6 plugins.
     
  13. Stormwave
    OP

    Member Stormwave GBAtemp Regular

    Joined:
    Apr 22, 2010
    Messages:
    223
    Country:
    United Kingdom
    Your suggestion of multiple lines is certainly possible CannonFoddr. I might well use that concept in the next implementation. I suppose it will make it easier for people to change directories etc a bit easier. I'll probably do that in the next couple of days.

    As for the autoboot thing, afaik it would be extremely difficult, but not strictly impossible. It's quite outside my original perceived scope of this project, but I'll look into it, just don't get your hopes up [​IMG]
     
  14. riverchen

    Member riverchen GBAtemp Fan

    Joined:
    Sep 27, 2009
    Messages:
    406
    Country:
    United States

    OH GOD YEA YOU WILL BE MY GOD IF YOU MAKE THIS.
     
  15. Stormwave
    OP

    Member Stormwave GBAtemp Regular

    Joined:
    Apr 22, 2010
    Messages:
    223
    Country:
    United Kingdom
    Done and done.

    Download version 0.3 for the updates.

    You can now create a "linker.ini" file in your _dstwoplug folder, this is seperated by numbered tags like so:

    [link 1]
    file=fat:/test/test.nds

    [link 2]
    file=fat:/test2/test2.nds

    [link 3]
    file=fat:/_dstwo/DSGAME.nds
    autoboot=fat1:/HOMEBREW/

    [link 4]
    file=fat:/_dstwo/DSGAME.nds
    autoboot=fat1:/NDS/FAVOURITES/NULL.nds

    Autoboot allows you to choose a path to boot into if you are loading DSGAME.nds. Note that it has to be "fat1:/" rather than "fat:/". I have had some issues setting it up correctly, and you may need to enter a null filename to get it to work i.e. "autoboot=fat:/HOMEBREW/null.nds". It was quite a bit easier than I thought, since DSGAME already stores the last used directory. The loader simple overwrites the lastsave.ini file with a new path.

    To boot them use the DS Plugin Linker to create a loader, enter the link number you want to use and click "create". Save it where you want, and it should work fine.

    I think the limit is about 999 links.

    I know it's a bit tricky to use and my explanation is crap (way too tired atm, hehe). Any questions ask in here.
     
  16. Xenon++

    Member Xenon++ Taiju Yamada

    Joined:
    Dec 17, 2009
    Messages:
    1,394
    Country:
    Japan
    I think [Dir Info] will just allow to show the folder, not autoboot.
     
  17. CannonFoddr

    Member CannonFoddr Regular GBATemp Lurker

    Joined:
    Sep 23, 2006
    Messages:
    4,106
    Location:
    Sitting by computer
    Country:
    United Kingdom
    I've given 0.3 a try - slight problem has arisen... It doesn't seem to work now [​IMG]

    Every Homebrew I try comes up with 'Init'ing FAT... fail!'
    Here's a copy of my linker.ini
    As you can see all of the programs are in '/Homebrew/' folder on the root, & just as a tryout I even changed 'file=fat:/' to 'file=fat1:/' & it's still the same error message.

    Further info - although I doubt it actually matters - is that I changed the linker.nds name to the name of the program it's associated with so the 'linker.nds' that was set to '1' it was renamed as 'VideoGamesHero.nds', so that it also used the ini/bmp of the plugin
    I even tried setting the linker.nds as 'Link 1' and 'link 1' with the PC program - but that didn't work either,
    and I even DLDI'd the programs in the /Homebrew/ folder as well - just in case... That didn't work either

    On a side note - but I guess it depends on how hard it is to program - I think I'd prefer it if the linker.ini was arranged more like
    Code:
    [Links]
    Link1=fat:/Homebrew/VideoGamesHero.nds
    Link2=fat:/Homebrew/Colors.nds
    Link3=fat:/Homebrew/dsvideo.nds
     
  18. Stormwave
    OP

    Member Stormwave GBAtemp Regular

    Joined:
    Apr 22, 2010
    Messages:
    223
    Country:
    United Kingdom
    Warning: Spoilers inside!
     
  19. CannonFoddr

    Member CannonFoddr Regular GBATemp Lurker

    Joined:
    Sep 23, 2006
    Messages:
    4,106
    Location:
    Sitting by computer
    Country:
    United Kingdom
    Ah!! - didn't think of that......... Doh !!!
     
  20. Xenon++

    Member Xenon++ Taiju Yamada

    Joined:
    Dec 17, 2009
    Messages:
    1,394
    Country:
    Japan
    1. Well if you have many files on that directory, searching might be difficult (well riverchen just want to show homebrew folder so it is OK though)
    2. How do you apply DLDI? Well bootlib will do that automatically... Is your patching bootlib is OK?
     

Share This Page