Is there a simple way to make the DS switch display screens?

Discussion in 'NDS - Emulation and Homebrew' started by Zowayix, Jan 12, 2011.

  1. Zowayix
    OP

    Member Zowayix GBAtemp Regular

    Joined:
    Dec 27, 2008
    Messages:
    149
    Country:
    United States
    See topic title.

    I know of a few homebrew programs (such as Lameboy) that have an option to switch the display screens (so that the top screen displays what the bottom screen used to, and the bottom screen displays what the top screen used to).

    Is this a simple method, or is it very complex?

    If it's simple, can someone hack Lockjaw (http://www.pineight.com/lj/) so that either
    - the top screen never displays anything and the bottom screen displays everything
    or
    - pressing a button combination (preferably A+B+X+Y) switches the display screens

    My DS's top screen is broken, and since everything except the options menu in Lockjaw is displayed on the top screen, I can't play it at all.
     


  2. twiztidsinz

    Member twiztidsinz Taiju Yamada Fan

    Joined:
    Dec 23, 2008
    Messages:
    4,981
    Country:
    United States
    In short: No, there is no easy way to do that.

    It is possible... if you have the source code and know how to edit it. Not exactly what I'd call 'easy'.
     
  3. habababa

    Newcomer habababa Advanced Member

    Joined:
    Nov 24, 2010
    Messages:
    60
    Country:
    Philippines
    It is possible.I think.
    You have to rewrite the binary?And the code changes with different ROMs.
    For the toggling,maybe you'll need to force a V-Blanking?I don't know because the display switching I made can't be toggled.
    Lower Display is permanently swapped to Upper Display.
    I have some rewritten arm9.bin's in my pc.If you're interested,PM me the name of the game you want me to work on.
    It works with Megaman Zero Collection.[​IMG]
     
  4. twiztidsinz

    Member twiztidsinz Taiju Yamada Fan

    Joined:
    Dec 23, 2008
    Messages:
    4,981
    Country:
    United States
     
  5. habababa

    Newcomer habababa Advanced Member

    Joined:
    Nov 24, 2010
    Messages:
    60
    Country:
    Philippines
    Oh,sorry.I'll try to tinker with it later.
     
  6. Swifty1992

    Newcomer Swifty1992 Member

    Joined:
    Apr 13, 2009
    Messages:
    48
    Country:
    Australia
    I've got the source for the game you linked, and I know how to compile it to display the main screen on the bottom. I'll recompile it like that and upload it to filetrip or something for you.

    It's also quite possible that I can add in the X+Y+A+B thing for you.

    EDIT: The last time this code got updated was 2008, so I'll have to update it to a recent version of libNDS. Although, I've got a rather large amount of spare time right now so I don't really mind.
     
  7. Zowayix
    OP

    Member Zowayix GBAtemp Regular

    Joined:
    Dec 27, 2008
    Messages:
    149
    Country:
    United States
    Wow, thanks. I only thing I know about DS hacking except that ROMs contain lots of .bin files that do...something. [​IMG]

    What does arm9.bin do?
     
  8. twiztidsinz

    Member twiztidsinz Taiju Yamada Fan

    Joined:
    Dec 23, 2008
    Messages:
    4,981
    Country:
    United States
    I think it's executable code for the ARM9 processor, though I could be wrong.
     
  9. MJaoune

    Member MJaoune GBAtemp Regular

    Joined:
    Feb 27, 2010
    Messages:
    112
    Country:
    United States
    it can be easily fixed, you can fix it yourself by watching Youtube videos on how to do it and buying the top screen from the internet, or let Nintendo fix it for you, you can use your warranty or use cash money.
    And I think using an Action Replay code that can switch screens would do it but I am not sure.
     
  10. Zowayix
    OP

    Member Zowayix GBAtemp Regular

    Joined:
    Dec 27, 2008
    Messages:
    149
    Country:
    United States
    The problem is that I'm extremely tight on money right now, and my DS is long out of warranty.

    If there's an AR code that can switch screens, that would instantly solve all my screen-related problems. Is there a universal code? (I know there's a universal code for changing the backlight brightness while playing.)
     
  11. Mario92

    Member Mario92 GBAtemp Advanced Fan

    Joined:
    Feb 20, 2010
    Messages:
    878
    Location:
    Finland
    Country:
    Finland
    New top screen costs 10$ and usually games use either both screens or touch screen. Making code to switch screen takes much more time than getting money for new screen.
     
  12. Swifty1992

    Newcomer Swifty1992 Member

    Joined:
    Apr 13, 2009
    Messages:
    48
    Country:
    Australia
    Actually, if the code was using a relatively recent version of the devKit, then it'd be really simple.
     
  13. Zowayix
    OP

    Member Zowayix GBAtemp Regular

    Joined:
    Dec 27, 2008
    Messages:
    149
    Country:
    United States
    What does that mean?
     
  14. RoyalCardMan

    Member RoyalCardMan DS App Studio™ Developer

    Joined:
    Aug 11, 2010
    Messages:
    628
    Location:
    In the middle of gun fire.
    Country:
    United States
    It means that if you had the most recent version of DevkitPro, then you could use a function to flip the screen displays for homebrew that you make.
     
  15. Zowayix
    OP

    Member Zowayix GBAtemp Regular

    Joined:
    Dec 27, 2008
    Messages:
    149
    Country:
    United States
    How hard would it be to edit Lockjaw's source code to make everything that would be displayed on the top screen be displayed on the bottom instead?
    How hard would it be to make an AR code that switches the display screens?
     
  16. DanTheManMS

    Member DanTheManMS aka Ricochet Otter

    Joined:
    Jun 2, 2007
    Messages:
    4,325
    Location:
    Georgia
    Country:
    United States
    EDIT: actually I think that's for the subscreen with the status text. Possibly the main setup is done with the "videoSetMode(MODE_0_2D | DISPLAY_BG0_ACTIVE);" line in the "ljgbads.inc" file. I dunno, this is all mostly speculation on my part here.
     
  17. Swifty1992

    Newcomer Swifty1992 Member

    Joined:
    Apr 13, 2009
    Messages:
    48
    Country:
    Australia
    I'm fairly sure that all you need to do is to change the mainOnTop to mainOnBottom (or vice versa) within the ljds.c (or whatever it's specifically called). Or when I get around to updating, there's a swapScreens function you can trigger using an unused button or combination.
     
  18. FAST6191

    Reporter FAST6191 Techromancer

    pip
    Joined:
    Nov 21, 2005
    Messages:
    21,719
    Country:
    United Kingdom
    Edit: the following probably will not work, http://gbatemp.net/t274089-is-there-a-simp...t&p=3404455 might also be worth a read.

    http://nocash.emubase.de/gbatek.htm#dspowermanagement

    Bit 15 in 4000304h aka POWCNT1 (ARM9 memory only- you are going to have to patch into an ARM9.bin file). It is fairly high up in the video toolchain but those that have fiddled with it in the past have not necessarily had good results (it deals with display engine a to a given screen (when set to 0 is goes to the lower screen). Display engine b is the other but it has considerably less power (all proper 3d and a fair chunk of 2d work is done on display engine A - your program or indeed desirable screen might use B but just change the bit in that case)

    It seems it can be accessed by a straight write (which is nice as the alternative for these sorts of things is SPI and that would be a less fun hack to pull off)

    Wire in a code (use DSATM if you have to) to change the bit 15 to 0 at 4000304h - personally I would logical NOR the 16 bit thing with 1000 0000 0000 0000 binary (8000 hex) or as that should set 0 and leave the rest untouched- you might have to account for endianess (see big vs little endian) in which case it would probably be 0080 hex for your 16 bit command but I am not sure how cheats or your chosen method will play out.
    Looking at the docs there is also a logical AND instruction for ARM mode- AND the register with 0111 1111 1111 1111 binary or 7FFF hex (again it might be flipped to FF7F)

    Indeed looking at the mapping you might even get away with an 8bit code or even a simple memory write (the bits 9 through 15 are mostly unused with only 15 being this stuff and 9 being enable display engine b).
    If you want an Action Replay DS cheat it probably reads something like 24000304 000000FF or 2400030C 000000FF with the latter being if the memory is troubled by endianess (this assumes no Offset code has been entered either and you might have to change the FF part to 7F if it does not like display engine b being enabled)
    Those codes are the braindead option of constant ram write codes, a far more elegant version would use OR options of D4 (needs 023FE424 E1833004 to be ran first to change D4 codes to OR apparently) or indeed even proper custom ASM. I am not convinced about writing directly to registers like this either- whether it is too much controls hacking on the brain or not is open to debate but instincts want me to copy the register to normal ram, fiddle with it and write it back.



    This will hopefully change the screen, do it right and you might even be able to have a key combo to swap screens but do try proof of concept first before trying anything fiddly like that.
    Regarding homebrew if you are really clever you might be able to hijack DLDI to do you dirty work- DLDI patches are code after all and are loaded fairly early on for most homebrew programs. Realistically though it will be a very small patch (assuming no keypress/interrupt stuff)


    Short version- you need to change bit15 in POWCNT1 (4000304h in the ARM9 memory space) probably to 0 if not to 1

    If you have action replay code capability (or want to try feeding it into DSATM) then
    24000304 000000FF is one possible code and if that does not work try 2400030C 000000FF (you might have to change the FF part to 7F if it does not like display engine b being enabled).
    This however is a very quick and dirty method of trying to swap screens, there is serious possibility for refinement.
     
  19. ninjaapple

    Newcomer ninjaapple Advanced Member

    Joined:
    Oct 2, 2010
    Messages:
    97
    Country:
    Trinidad and Tobago
    No man, tough!
    Unless someone made a DS homebrew to switch between screens!
     
  20. aiRWaLKRe

    Member aiRWaLKRe GBAtemp Regular

    Joined:
    Sep 12, 2009
    Messages:
    260
    Location:
    Orlando
    Country:
    United States
    Why not buy a new screen? A ds lite replacement top lcd is 8 to 12 bucks? so it would be easier to buy one, cant cost too much depending on ur model
     

Share This Page