Working ScummVM DS build for 3DS!

Discussion in '3DS - Flashcards & Custom Firmwares' started by uomoartificiale, Feb 9, 2012.

  1. uomoartificiale
    OP

    uomoartificiale Member

    Newcomer
    13
    3
    Jan 22, 2012
    Italy
    update: I added a build of 1.2.1 and 1.4.1 with MAD support (MP3 and talkie support) plus instructions about libmad
    update: now I have a DSTwo. I added a package with the DSTwo plugins in the download section.

    First post here. ;)

    Here's two builds of scummVM DS especially compiled for 3DS users who can't get the touchscreen to work on their devices.
    These builds are merely "hacks" of the original source code and the changes I introduced are not particularly elegant. It's just a quick hack to get scummVM DS work on 3ds devices (should work fine on standard DS too). I suppose that the bug responsible for the broken touchscreen on the 3ds is still there deeply in the libnds library.

    Downloads:
    Download scummVM DS 1.2.1 (all the engines - MAD support) (reccomended)
    Download scummVM DS 1.4.1 (all the engines - MAD support)

    DSTWO Plugins:

    [​IMG] ScummVMDS Plugins


    older versions:
    Download scummVM DS 1.2.1 (all the engines no MAD support)
    Download scummVM DS 1.4.1 (all the engines no MAD support)

    I compiled both the last stable sources 1.4.1 and the 1.2.1 version which is the binary version most commonly used by end-users (so you should download this if you want to keep your existing compatibility).
    I didn't have a compiled version of libmad so I commented out USE_MAD = 1 as suggested, but if someone is willing to provide a compiled ARM version of the library (or provide a win32 devkitpro makefile for it) I'm more than happy to rebuild everything with MAD support.

    Boring stuff (and possibly gibberish...)
    Here's a quick explanation of what I changed and where I think the problem lied. Also, I'm not a professional programmer, so take my words with a grain of salt.

    The touchscreen code of scummvm is not broken on the 3ds, or at least not completely. The problem is in dsmain.cpp where most of the stuff happens. The main issue is that IPC->touchZ1 always returns 0. I suppose IPC->touchZ1 reads the Z axis (so to speak) of the stylus, that is it reads pressure and perpendicular touch (correct me if I'm wrong).
    The good news is that IPC->touchXpx and IPC->touchYpx still read the stylus coordinates just fine so all I did was to comment out occurrences of IPC->touchZ1 and in one instance replace it with a conjunct read of IPC->touchXpx and IPC->touchYpx both > 0 instead.
    I never used scummvm on a standard DS so I don't know if the touchscreen feels actually any different here. I suppose it doesn't, but let me know if that's the case.
    btw to really solve the issue, it could be necessary to track down the problem in the libnds library itself.

    Here are the source files I changed:
    http://www.mediafire...3ds_schanges.7z

    Instructions on building libmad for nds-arm are here: http://gbatemp.net/t...ost__p__4100204

    Warning: Spoilers inside!
     
    SLiV3R and Thorhian like this.


  2. Foxi4

    Foxi4 On the hunt...

    pip Reporter
    23,558
    21,536
    Sep 13, 2009
    Poland
    Gaming Grotto
    The DS has a resistive screen, it doesn't register pressure and isn't Multitouch - it only registers the "overall press point" as two values - on the Y and X axis. I really have no clue what touchZ1 could be, but still, good job on fixing the issue! (I'm saying overall press point because if you, for example, use two styluses to press the screen in two places, the final computed value will be situated exactly in the middle between those two points on both axises)
     
    1 person likes this.
  3. elisherer

    elisherer I ♥ 3DS

    Member
    778
    153
    Dec 16, 2009
    Iceland
    3dbrew.org
    Nice find...I wonder if the DSi has that bug also...because of using the sandboxed DS mode...
     
  4. totalnoob617

    totalnoob617 Banned

    Banned
    785
    83
    Sep 27, 2010
    United States
    nice .noe it would be nice if there was a fix for ned ds touch screen, or is there? i havent got the latest version, but yea i know its not 3ds specic issue
     
  5. Another World

    Another World Emulate the Planet!

    Former Staff
    10,499
    1,673
    Jan 3, 2008
    Colombia
    From Where???
    the last optimized build for the ds was v1.2.1, a bug fix release. was your v1.4.1 build was compiled from the official scummvm source? so it has support for engines and games that won't run on the ds? or did you do more than just fix the touch screen code?

    cheers,
    -another world
     
  6. uomoartificiale
    OP

    uomoartificiale Member

    Newcomer
    13
    3
    Jan 22, 2012
    Italy
    I initially thought that a more recent revision of the source could have fixed the issue (why re-invent the wheel?). So I went on and checked out the last svn and compiled. the issue was still there and the build was messy and unstable. So I rolled back to the official 1.4.1 sources from the scumvm download page. Fixed the issue, compiled, touched nothing else.

    I didn't know if there were any changes from 1.4.1 to 1.2.1 in the ds backends, so I compiled the official 1.2.1 sources from the scummvm sourceforge reposiitory. There's probably no difference whatsoever between the two builds, I just didn't want to break compatibility for anyone.
     
  7. uomoartificiale
    OP

    uomoartificiale Member

    Newcomer
    13
    3
    Jan 22, 2012
    Italy
    That's what I tought too. On the emulator touchZ1 returns 256 while clicking on the screen. I don't have a ds to check what values are registered on real hardware. At least for scummvm games, any information other than the screen coordinates seems superfluous. As I said, I actually don't know if this version feels any different compared to the original build.
     
  8. jceggbert5

    jceggbert5 Check out my hack, New Retro Mario Bros.

    Member
    989
    1
    Dec 1, 2008
    United States
    USA, Earth, MilkyWay
    You are incorrect about your pressure statement. The DS and DS Lite can register pressure input, Animanitee is the only one that I know of that fully utilizes that feature. No official software uses it, so they did not include the feature in the DSi(XL) or 3DS.
     
  9. spinal_cord

    spinal_cord Knows his stuff

    Member
    3,016
    595
    Jul 21, 2007
    somewhere
    I'm fairly sure Colors! has pressure sensing also :)
     
  10. jceggbert5

    jceggbert5 Check out my hack, New Retro Mario Bros.

    Member
    989
    1
    Dec 1, 2008
    United States
    USA, Earth, MilkyWay
    Never used it, so I had no idea.
     
  11. Fyrus

    Fyrus Artilleur Carmin

    Member
    798
    127
    Jul 6, 2010
    France
    Marseille - France
    Colors has pressure sensing.
     
  12. wasim

    wasim ♫ Music addict ♫

    Member
    907
    63
    Nov 13, 2010
    India
    Calicut
    There's no pressure sensitivity on 3DS ?!
     
  13. uomoartificiale
    OP

    uomoartificiale Member

    Newcomer
    13
    3
    Jan 22, 2012
    Italy
    back on topic... ;) does anyone has a libmad.a library compiled for nds? I'm really struggling to have it compile under devkitPro.

    @anotherworld. Did you compile the scummVM 1.2.1 binaries posted on the download section with MAD support? could you provide some info on how the hell did you manage to build it?
     
  14. Another World

    Another World Emulate the Planet!

    Former Staff
    10,499
    1,673
    Jan 3, 2008
    Colombia
    From Where???
    hm, i actually don't recall where i grabbed those files from. perhaps they were on nintendomax. i wonder if that site compiled it. agentq apparently did not release anything past 1.2.0 beta 1 for the nds.

    edit::

    i did a few seconds of digging on google and it looks like 1.2.1 did hit the sourceforge page but he never released it to the scummvmds homepage or the scummvm forum.

    http://sourceforge.net/projects/scummvm/files/scummvm/1.2.1/scummvm-1.2.1-ds.zip/download
    http://wiki.scummvm.org/index.php/Nintendo_DS

    -another world
     
  15. Foxi4

    Foxi4 On the hunt...

    pip Reporter
    23,558
    21,536
    Sep 13, 2009
    Poland
    Gaming Grotto
    Okay, I've read a little bit more on the subject and it appears that indeed there is a degree of pressure-sensing, however Nintendo does not recommend using that feature due to manufacturing differences between the screen. It would require some hardcore calibration to get the same results on two DS'es (hence the calibration mode in Colours!) that's why Ninty Boys "rejected it" as a feature, focusing on X and Y variables instead.

    So "Is the screen pressure sensitive?" should be answered "Yes and No" as it is physically possible, however not recommended (because the screens are crap at it) I suppose. Bizzare, I was convinced it's not possible at all. Good find, Spinal & jceggbert5. ;)
     
  16. jceggbert5

    jceggbert5 Check out my hack, New Retro Mario Bros.

    Member
    989
    1
    Dec 1, 2008
    United States
    USA, Earth, MilkyWay
    None available to NDS homebrew, which is the only thing I know of that ever had it in use, at least.
     
  17. uomoartificiale
    OP

    uomoartificiale Member

    Newcomer
    13
    3
    Jan 22, 2012
    Italy
    yep, I saw that. Then I suppose the 1.2.1 we see around is built on the official 1.2.1 sources from sourceforge.

    Also, the scummvm buildbot compiles a nightly build: http://buildbot.scummvm.org/builds.html which is totally broken.

    I'll try to find that library inside nintendomax, thanks for the heads up. ;)
     
  18. haxan

    haxan GBAtemp Regular

    Member
    245
    48
    Jul 26, 2011
    in my room?
    this is awesome thanx!!
     
  19. uomoartificiale
    OP

    uomoartificiale Member

    Newcomer
    13
    3
    Jan 22, 2012
    Italy
    I managed to build libmad using the latest devitARM. I'm currently compiling 1.2.1, I will post it in a couple of hours. Could anyone confirm that the touchscreen is working correctly? is there any difference with the standard DS version?

    For the one in need of a prebuilt libmad library here's libmad.a and the mad.h header:
    http://www.mediafire.com/file/5c2f3a3q73aaxij/libmad_prebuilt_armeabi5.7z

    for future reference:
    In order to build it, you need to install the latest devkitARM (win) then after setup, go to the msys directory. and launch msys.bat. a shell should appear.

    download the latest libmad from sourceforge and unpack it inside /home/username within the msys folder. Now in the msys shell navigate to the unpacked libmad folder and configure it using:

    Code:
    PATH=$DEVKITARM/bin:$PATH
    configure --host=arm-eabi --disable-shared --enable-static
    
    it will now generate the Makefile
    then launch:
    Code:
    make
    
    it will probably return an error saying that it doesn't understand the -fforce-mem parameter. Now open the Makefile with a text editor search and delete '-fforce-mem'

    launch make again. This time it will compile correctly and it will output a libmad.a in the .libs folder. Copy the library into the backend/platform/ds/arm9/libs folder for scummvm to find it. Copy also the mad.h header into backend/platform/ds/arm9/source/mad/
     
  20. uomoartificiale
    OP

    uomoartificiale Member

    Newcomer
    13
    3
    Jan 22, 2012
    Italy
    I updated the first post with new builds with libMAD support. Again, you should be OK downloading the 1.2.1 version (I reccomend that), but I compiled a 1.4.1 build just because it can turn out to be useful if someone is stuck with a bug in a game. Judging from the official scummvm compatibility table for both versions, if you're not playing backyard baseball, then you shouldn't even bother downloading 1.4.1.

    I tested mad support using the talkie version of Flight of the Amazon Queen and a compressed mp3 version of the Day of The Tentacle CD. As far as I can see, it works..