TWPatcher - DS(i) mode screen filters and patches

Discussion in '3DS - Homebrew Development and Emulators' started by Sono, Jul 4, 2019.

  1. Robz8

    Robz8 Coolest of TWL

    pip Developer
    19
    Oct 1, 2010
    United States
    Update to v10.0.1.
     
  2. Kolieder

    Kolieder Newbie

    Newcomer
    1
    Aug 24, 2019
    United States
    I updated and now opening twilight menu shows "An external firm module is invalid or corrupted"
     
  3. Robz8

    Robz8 Coolest of TWL

    pip Developer
    19
    Oct 1, 2010
    United States
    Delete "TwlBg.cxi" at "sd:/luma/sysmodules/", then follow the widescreen steps for TWiLight Menu++ again.
     
  4. Kolieder

    Kolieder Newbie

    Newcomer
    1
    Aug 24, 2019
    United States
    Updating made twilight menu show an external firm module is invalid or corrupted
     
  5. lordkaos

    lordkaos GBAtemp Advanced Fan

    Member
    6
    Mar 13, 2009
    United States
    can i ask you something?, is it normal for the 3DS to return to the home menu when I press the L+R+Select+Start or L+R+Down+B button combination while playing a DS game using twilightmenu?, I read you could return to the twilightmenu homescreen pressing one of those combinations but it has never worked for me, I'm on the latest version.
     
  6. Robz8

    Robz8 Coolest of TWL

    pip Developer
    19
    Oct 1, 2010
    United States
    It doesn't work on O3DS.
    On N3DS, it only fails to work sometimes.
     
  7. lordkaos

    lordkaos GBAtemp Advanced Fan

    Member
    6
    Mar 13, 2009
    United States
    so that's why, thank you, would it be possible to make it work on o3ds or is it because of hardware limitation?
     
  8. ghjfdtg

    ghjfdtg GBAtemp Fan

    Member
    6
    Jul 13, 2014
    Exactly. It uses the same resolution but stretched up which means there is quite a loss in quality. I don't understand how someone can do that to their eyes.
     
  9. Robz8

    Robz8 Coolest of TWL

    pip Developer
    19
    Oct 1, 2010
    United States
    I'd have to own an O3DS to even try to get it working.
     
  10. Kolieder

    Kolieder Newbie

    Newcomer
    1
    Aug 24, 2019
    United States
    I got twilight menu AND widescreen working. Thank you!
     
    Robz8 likes this.
  11. Vague Rant

    Vague Rant Deceptively cute

    Member
    7
    Aug 7, 2008
    Melbourne
    Sorry to batch quote you all here, but I think the majority of what you're objecting to is probably the filtering (or lack thereof) that's currently applied by the patched TwlBg when stretching games to widescreen. I don't understand the technical details whatsoever, but part of what the currently-available widescreen patch is doing is disabling all filtering on the horizontal axis, so you're seeing the bare, unfiltered, non-integer scaled pixels. The simple fact of this is that it's not going to look great, especially at the extremely low resolutions of the DS/3DS screens.

    Of course it's more than just that, and it's true that stretching the same number of pixels over a wider area is reducing the overall picture quality, but including some smoothing filter/s on the vertical and horizontal (which I believe Sono has said is possible) will go a long way to mitigate the visual artifacts of scaling up by another 20% from the default. I agree that right now the picture quality is not all that it could be, but--without intending to put any additional pressure on Sono, sorry--I do believe it's partly just the nature of a feature that's in its infancy and can/will be improved upon with (considerable) time and effort.

    EDIT: I went back and found Sono's post on widescreen and filtering:
     
    Last edited by Vague Rant, Sep 1, 2019
    Ars92, Robz8, Raylight and 2 others like this.
  12. Sono
    OP

    Sono Modern slave

    Member
    13
    Oct 16, 2015
    Hungary
    Austro-Hungarian Monarchy
    Exactly.

    The main reason I clear the scaling on the X axis is because I didn't have enough time to do patches which patch the X and Y matrixes individually (because the scale ratio isn't equal on both axises).
    Technical explaination
    tl;dr: I have to clear the filtering on the X axis because it would look even worse without clearing it because you have to "reprogram" the matrix hardware for each scaling ratio to look right, and that requires mathematically recalculating it again, which I can't do due to the lack of my mathematical knowledge.

    I can't enable X scaling until I can make the GUI be aware of it, and offer you to choose unique scale matrixes for both X and Y axis. I also have to develop a patch which can upload the X and Y axis individually (which is simple, but I have space problems, so it'll take a while to develop).
     
    Last edited by Sono, Sep 1, 2019
    Robz8, Raylight, YuseiFD and 3 others like this.
  13. Rahkeesh

    Rahkeesh GBAtemp Maniac

    Member
    7
    Apr 3, 2018
    United States
    That sounds like a ton of work. Way more than applying the prior non-widescreen twl patcher to agb. Wonder what kind of bribe that would take. :P
     
  14. Sono
    OP

    Sono Modern slave

    Member
    13
    Oct 16, 2015
    Hungary
    Austro-Hungarian Monarchy
    Nah, it's really simple, I just can't find a time in my nonexistant "schedule" where I'm not currently dying from the heat and not sleeping.
    And also, I need to learn maths, so I can autogenerate the filters regardless of the scaling ratio.

    The real work would be getting widescreen AND screen swap working. That IS a lot of work, because patching DMPGL (3DS' OpenGL driver) is nearly impossible, and most of the times I don't have enough code space and have to get very creative.
     
    Robz8, Raylight and Rahkeesh like this.
  15. Rahkeesh

    Rahkeesh GBAtemp Maniac

    Member
    7
    Apr 3, 2018
    United States
    Well its not that hot here but I'm still too dumb. I located the active image matrix in AGB_FIRM and have been able to change it and pack back into agbbg.xci. Most changes result in black screen unless I have the start button held to skip scaling, that includes the one Sono suggested way back on page 3 when he probably knew less about this process, as well as trying to import any matrix from twlbg.xci. But one time I swapped the location of the hex 20s and 40s in the matrix and got it to run with a pointillistic effect (black pixel boxes surrounding light pixels), so I know I'm in the right area at least. I just don't know what makes an acceptable matrix, especially for something like (bi?)linear interpolation.

    I'm guessing I should read these matricies as octal instead of hexidecimal, but I still have a hard time matching them up to your explanation. But it seems like it has to be more than just weighting how much of pixel X goes into the color of pixel Y if its so crash prone with the wrong values.
     
  16. Sono
    OP

    Sono Modern slave

    Member
    13
    Oct 16, 2015
    Hungary
    Austro-Hungarian Monarchy
    What do you mean you "located" the "active" image matrix? I never put patching instructions for AgbBg in the first post :wacko:

    Also, the values are in hex, fixed-point. 4000 is 1.0, 2000 is 0.5, E000 is -0.5, C000 is -1.0
     
  17. Rahkeesh

    Rahkeesh GBAtemp Maniac

    Member
    7
    Apr 3, 2018
    United States
    I meant the pattern

    Code:
    0000 0000 0000 0000 0000 0000
    0000 0000 0000 0000 0000 0000
    0000 0020 0040 0000 0020 0040
    0040 0020 0000 0040 0020 0000
    0000 0000 0000 0000 0000 0000
    0000 0000 0000 0000 0000 0000
    
    I find this around x4A190 in my code.bin extracted from my agbbg.xci. You suggested looking for this back on the 2nd or 3rd page.

    Its "active" in the sense that I can see changes in game when I make small changes to the values, so it seems to be the right area. Someone else on 3rd page suggested instead editing what looks like an unused matrix right above this one, it avoided crashes but doesn't seem to do anything. (Guessing that is unused 1.25x scaling?)

    Thanks for the obvious tip about treating these as fixed point decimals, makes these almost readable, maybe I will figure it out eventually.
     
    Last edited by Rahkeesh, Sep 2, 2019
  18. AkitoUF

    AkitoUF GBAtemp Regular

    Member
    4
    Jan 5, 2016
    Chile
    I just wanted to thank you guys for this achievement.
    Which is your preferred filter to play with?
     
  19. Raylight

    Raylight Paranoid Temper

    Member
    7
    May 10, 2014
    United States
    Who wants to know?
    Liner flter
     
  20. VMM

    VMM Hamon > Stand

    Member
    9
    GBAtemp Patron
    VMM is a Patron of GBAtemp and is helping us stay independent!

    Our Patreon
    Jul 1, 2010
    Brazil
    Duuuude... how many nights have you stayed awake since you started this project?
    I think I can speak in behalf of all community in this:

    We love the progress you're making, it's rather impressive and something good for the community,
    but you should always prioritize your health.

    This lack of sleeping will cause fatigue, can drive you sick and will hinder you as a developer.
    I can't remember how many times that as a developer, I made stupid coding mistakes because I was tired from not sleeping.
    Linters help a lot, but there is always something, calling a function with the wrong name,
    some wrong math, you know things that would be simple if I had rested properly.

    I see someone posted it before, but Sono actually is sleep in portuguese haha
    So do yourself a favor and get some sleep :)

    Also thank you very much for your work, been playing Heartgold again and your filter brought new life to it.
     
    Sono, Vulpes-Vulpeos and Robz8 like this.
Quick Reply
Draft saved Draft deleted
Loading...