Homebrew TWPatcher - DS(i) mode screen filters and patches

  • Thread starter Sono
  • Start date
  • Views 761,702
  • Replies 2,430
  • Likes 102

Are you interested in a complete replacement of TwlBg which includes all patches?

  • Yes, I don't care how broken it will be!

    Votes: 188 79.3%
  • No, I don't want to use even more broken stuff

    Votes: 20 8.4%
  • Yes, but only in GBA mode, because I play DSi exclusives

    Votes: 12 5.1%
  • No, because I only use DS and DSi mode

    Votes: 17 7.2%

  • Total voters
    237
  • Poll closed .

Stellar

Well-Known Member
Member
Joined
Jul 20, 2014
Messages
210
Trophies
0
XP
1,808
Country
Portugal
In 800px mode this code is always disabled because it crashes the GPU.

What will this mean for performance overall? (what I mean is, will 800px mode end up being slower or have a different sort of visual artifacts?).

And also, is anyone implementing 800px mode, and if so where can we follow development (sorry, I came to this thread primarily for the screen scaling and unstart patches so I'm largely ignorant of adjacent topics).


Scratch all that. Rather, is there a way to just disable the code that causes the odd behavior I described in my last post (GBA games slicing off bottom portions of the screen and drawing it on top instead) without adverse effects? Or is the function that the code serves crucial to performance in some way?

You can notice when this code is disabled because if you're looking at 60FPS fluid motion, you'll see stutter every once in a while because the LCD timings can NOT be matched without artifacts or within the 3DS LCD's limit.

Okay nevermind, you've already mentioned what happens when that code is disabled.
 
Last edited by Stellar,

wanderindirk

Active Member
Newcomer
Joined
Aug 29, 2014
Messages
43
Trophies
0
Age
31
XP
173
Country
Vietnam
I see.

As for the wide compat list: I don't need to see it, but I know that two things play a role so that a game could get on that list:
1) The game has to be using the 3D engine. Since almost all graphics on the DS is hardware-accelerated, games using the 2D engine can't be squished because the 2D hardware doesn't support aspect ratio correction. As for 3D engine, since the triangles and quads are calculated with the CPU, in most 3D games there is a variable to patch which controls the aspect ratio to squish the world. By patching that variable, the game gets even more squished, resulting in anamorphic widescreen.
2) Someone has to have found the variable and patched it :P Although some games require insane amount of patches, most games to my knowledge only need the aspect ratio correction, and sometimes a few patches to increase the rendering width so the triangles and quads normally outside the visible area are still rendered.

I never bothered to try the widescreen mode on any purely 2D DS game, but it must be the case then that these games can't be squished (your word is good enough by me). Not that it would concern me or anything :D

One thing that might be of my interest (though it sounds more like wishful thinking) is that whether or not widescreen mode in 2D sections (like the menu) or FMVs could possibly be temporarily deactivated back to normal resolution in games that are truly widescreen-compatible, and then switched back to widescreen in other in-game sections. Currently this is the only major reason which might discourage me from going full widescreen in every compatible game. My guess is of course that it's simply impossible but I'm still a bit curious as to why.
 

emcintosh

On the internet, everyone knows I'm a cat
Member
Joined
Dec 4, 2016
Messages
461
Trophies
0
XP
2,384
Country
United Kingdom
One thing that might be of my interest (though it sounds more like wishful thinking) is that whether or not widescreen mode in 2D sections (like the menu) or FMVs could possibly be temporarily deactivated back to normal resolution in games that are truly widescreen-compatible, and then switched back to widescreen in other in-game sections. Currently this is the only major reason which might discourage me from going full widescreen in every compatible game. My guess is of course that it's simply impossible but I'm still a bit curious as to why.

I don't believe this is possible, as the DS game doesn't know it's being rendered in widescreen. The widescreen codes force the game to render a wider viewport in 3D scenes but with all the objects squashed, which the 3DS (which doesn't know whether the 256x192 image the DS mode is sending is 3D objects, 2D sprites or a mix of both) then stretches back to the correct proportions. This is how we used to get widescreen on TV - 'anamorphic widescreen' squashes the 16:9 picture to 4:3 on the recording, and the TV stretches it.
 
Last edited by emcintosh,

Sono

cripple piss
OP
Developer
Joined
Oct 16, 2015
Messages
2,829
Trophies
2
Location
home
XP
9,423
Country
Hungary
Scratch all that. Rather, is there a way to just disable the code that causes the odd behavior I described in my last post (GBA games slicing off bottom portions of the screen and drawing it on top instead) without adverse effects? Or is the function that the code serves crucial to performance in some way?

Sadly I can't fix the timing issue, or at least not that I know of. That requires so extreme patching of the driver that I might as well attempt to make open_twl_firm and help out profi200 with it :P

I never bothered to try the widescreen mode on any purely 2D DS game, but it must be the case then that these games can't be squished (your word is good enough by me). Not that it would concern me or anything :D

One thing that might be of my interest (though it sounds more like wishful thinking) is that whether or not widescreen mode in 2D sections (like the menu) or FMVs could possibly be temporarily deactivated back to normal resolution in games that are truly widescreen-compatible, and then switched back to widescreen in other in-game sections. Currently this is the only major reason which might discourage me from going full widescreen in every compatible game. My guess is of course that it's simply impossible but I'm still a bit curious as to why.
I don't believe this is possible, as the DS game doesn't know it's being rendered in widescreen. The widescreen codes force the game to render a wider viewport in 3D scenes but with all the objects squashed, which the 3DS (which doesn't know whether the 256x192 image the DS mode is sending is 3D objects, 2D sprites or a mix of both) then stretches back to the correct proportions. This is how we used to get widescreen on TV - 'anamorphic widescreen' squashes the 16:9 picture to 4:3 on the recording, and the TV stretches it.

That is only possible in very rare circumstances:
- the game's ARM7 has to be rtcom-patched
- you must use the MTX-based upscaling, because GPU upscaling requires so many patches that it's practically impossible to patch it at runtime
- the game has to be patched so when the screen mode has changed, the ARM9 tells the ARM7 to tell the ARM11 to switch upscaling mode (lol at this ridiculous setup)
- the game has to be patched so it can switch the 3D aspect ratio on the fly when both the 3D and 2D engines are used (thanks @emcintosh for pointing that out!)
 

BETA215

Member not found
Member
Joined
Dec 30, 2014
Messages
359
Trophies
0
Location
they/them | 0xDEAD brain
XP
1,730
Country
Argentina
Sadly I can't fix the timing issue, or at least not that I know of. That requires so extreme patching of the driver that I might as well attempt to make open_twl_firm and help out profi200 with it :P

Tbh, if you ever feel like trying to attempt something like open_twl_firm, we'll be more than happy to read about your journey! (whether it has a nice ending or not) :D
 
  • Like
Reactions: RocketRobz and Sono

RocketRobz

Stylish TWiLight Hero
Developer
Joined
Oct 1, 2010
Messages
16,652
Trophies
3
Age
25
XP
21,146
Country
United States
Have you found out if the FF values (and the write-lock flag) in the GBA Slot ROM are set by either TWL_FIRM or the hardware?
Reason is because I found that NO$GBA loads the booted .nds file into the GBA ROM area in the memory map, if DS console is set.
But here's where it gets more interesting. It also works with DSi console set!
So this kinda gives me hope that we can use the GBA ROM area for memory/RAM expansion.
 
Last edited by RocketRobz,

Sono

cripple piss
OP
Developer
Joined
Oct 16, 2015
Messages
2,829
Trophies
2
Location
home
XP
9,423
Country
Hungary
Have you found out if the FF values (and the write-lock flag) in the GBA Slot ROM are set by either TWL_FIRM or the hardware?
Reason is because I found that NO$GBA loads the booted .nds file into the GBA ROM area in the memory map, if DS console is set.
But here's where it gets more interesting. It also works with DSi console set!
So this kinda gives me hope that we can use the GBA ROM area for memory/RAM expansion.

Can you please tell me the related (DS(i)-side) registers so I can look them up on gbatek?

As for the 3DS, I have a feeling it's no longer possible since the GBA slot and DS Main RAM overlap on the same physical FCRAM locations.
 

RocketRobz

Stylish TWiLight Hero
Developer
Joined
Oct 1, 2010
Messages
16,652
Trophies
3
Age
25
XP
21,146
Country
United States
Can you please tell me the related (DS(i)-side) registers so I can look them up on gbatek?
The GBA ROM is located at 0x08000000-0x09FFFFFF.
As for the write lock flag, it doesn't exist. Was wondering if that was a thing in TWL_FIRM itself. :P
As for the 3DS, I have a feeling it's no longer possible since the GBA slot and DS Main RAM overlap on the same physical FCRAM locations.
Does that mean we can't map the GBA ROM area to somewhere in the 3DS RAM?
 

Ihavegbasp

New Member
Newbie
Joined
Feb 22, 2020
Messages
3
Trophies
0
Age
35
XP
48
Country
Belgium
Just found out about this patch and been playing Chrono trigger with the Sono crisp matrix and it looks amazing, thanks Sono!
But how do you access all other features listed in the post like screen swapping, button remapping and the blue light filter?
I'm using the version linked in the original post is it outdated or something?

And can AGB_FIRM be modified in the same way?
 
Last edited by Ihavegbasp,

Sono

cripple piss
OP
Developer
Joined
Oct 16, 2015
Messages
2,829
Trophies
2
Location
home
XP
9,423
Country
Hungary
The GBA ROM is located at 0x08000000-0x09FFFFFF.
As for the write lock flag, it doesn't exist. Was wondering if that was a thing in TWL_FIRM itself. :P

Does that mean we can't map the GBA ROM area to somewhere in the 3DS RAM?

Ah.
Yeah no, GBA mode is just a clever hack using existing hardware and memory remapping tricks. According to profi200 and/or nocash, FCRAM is always removed from the 3DS-side bus, no matter what. In DS and DSi mode it becomes main RAM, and in GBA mode it becomes cartridge ROM. To my knowledge it hasn't been attempted yet if it's possible to somehow remap the FCRAM and/or if it's writable after having poked some regs.

Just found out about this patch and been playing Chrono trigger with the Sono crisp matrix and it looks amazing, thanks Sono!
But how do you access all other features listed in the post like screen swapping, button remapping and the blue light filter?
I'm using the version linked in the original post is it outdated or something?

And can AGB_FIRM be modified in the same way?

Yes, it is very outdated, others have also fallen into this "trap". Just keep looking for a puu.sh URL everyone keeps posting every 1-2 pages and that'll be most likely it.

Button remapping patch is not available yet, as I don't have time, and mode 800 patch has a higher priority now anyway. Screen swapping is also not user-accessible. The patch itself is compiled into the patcher, but no code exists to patch the screen swap code into TwlBg itself.

AgbBg patching is not officially supported by me, but I develop the patches both for TwlBg and AgbBg at the same time, so almost all patches are available for one or the other.
You can hold - I think - Y while TWPatch is booting to unlock the secret "AGBG" patching mode.
 

KaduPSE

Revolution and cake
Member
Joined
Dec 26, 2015
Messages
260
Trophies
0
XP
408
Country
Brazil
Ah.
Yeah no, GBA mode is just a clever hack using existing hardware and memory remapping tricks. According to profi200 and/or nocash, FCRAM is always removed from the 3DS-side bus, no matter what. In DS and DSi mode it becomes main RAM, and in GBA mode it becomes cartridge ROM. To my knowledge it hasn't been attempted yet if it's possible to somehow remap the FCRAM and/or if it's writable after having poked some regs.



Yes, it is very outdated, others have also fallen into this "trap". Just keep looking for a puu.sh URL everyone keeps posting every 1-2 pages and that'll be most likely it.

Button remapping patch is not available yet, as I don't have time, and mode 800 patch has a higher priority now anyway. Screen swapping is also not user-accessible. The patch itself is compiled into the patcher, but no code exists to patch the screen swap code into TwlBg itself.

AgbBg patching is not officially supported by me, but I develop the patches both for TwlBg and AgbBg at the same time, so almost all patches are available for one or the other.
You can hold - I think - Y while TWPatch is booting to unlock the secret "AGBG" patching mode.

There´s actual hope for a 800px mode though? From your previous posts I assumed the system didn´t like it
 

Ihavegbasp

New Member
Newbie
Joined
Feb 22, 2020
Messages
3
Trophies
0
Age
35
XP
48
Country
Belgium
Yes, it is very outdated, others have also fallen into this "trap". Just keep looking for a puu.sh URL everyone keeps posting every 1-2 pages and that'll be most likely it.

Button remapping patch is not available yet, as I don't have time, and mode 800 patch has a higher priority now anyway. Screen swapping is also not user-accessible. The patch itself is compiled into the patcher, but no code exists to patch the screen swap code into TwlBg itself.

AgbBg patching is not officially supported by me, but I develop the patches both for TwlBg and AgbBg at the same time, so almost all patches are available for one or the other.
You can hold - I think - Y while TWPatch is booting to unlock the secret "AGBG" patching mode.
Thanks for the help Sono got everything figured out now.
Will be looking forward to 800px mode :)
 

Sono

cripple piss
OP
Developer
Joined
Oct 16, 2015
Messages
2,829
Trophies
2
Location
home
XP
9,423
Country
Hungary
There´s actual hope for a 800px mode though? From your previous posts I assumed the system didn´t like it

It does work™, but it's unusable. It's either extremely stretched, or parts of the screen are cut off and black or flickering.
I'll make a funny video compilation with my attempts and post it here.
 

KaduPSE

Revolution and cake
Member
Joined
Dec 26, 2015
Messages
260
Trophies
0
XP
408
Country
Brazil
whats 800px mode? GBA taking up the entire screen or somthing for DS?
All 3DS models (except the o2DS) have a screen with a particular matrix where pixels are slightly distant vertically, and you have double the horizontal resolution (800px). When using 3D, each doubled horizontal pixel goes to a different eye using a parallax barrier, so two different images can be formed. When you´re not using 3D those pixels try to create one single pixel (400px as the horizontal resolution) by behaving in pairs, this works... But you´re essentially throwing away 400px of horizontal resolution, and these duplicated pixels don´t look like proper squares so pixel art gets slightly messed up. Some people (Robz8?) figured out a flag you can enable to build your apps to run in 800px without 3D, essentially using every single pixel in the screen. Try Hori-HD or build Mario 64 with this mode enable to compare.
 

Raylight

Paranoid Temper
Member
Joined
May 10, 2014
Messages
1,178
Trophies
1
Age
34
Location
Who wants to know?
Website
sites.google.com
XP
2,872
Country
United States
All 3DS models (except the o2DS) have a screen with a particular matrix where pixels are slightly distant vertically, and you have double the horizontal resolution (800px). When using 3D, each doubled horizontal pixel goes to a different eye using a parallax barrier, so two different images can be formed. When you´re not using 3D those pixels try to create one single pixel (400px as the horizontal resolution) by behaving in pairs, this works... But you´re essentially throwing away 400px of horizontal resolution, and these duplicated pixels don´t look like proper squares so pixel art gets slightly messed up. Some people (Robz8?) figured out a flag you can enable to build your apps to run in 800px without 3D, essentially using every single pixel in the screen. Try Hori-HD or build Mario 64 with this mode enable to compare.
Wait so theres a way to get a crisper picture in DS and GBA using this mode?
 

Sono

cripple piss
OP
Developer
Joined
Oct 16, 2015
Messages
2,829
Trophies
2
Location
home
XP
9,423
Country
Hungary
whats 800px mode? GBA taking up the entire screen or somthing for DS?
Wait so theres a way to get a crisper picture in DS and GBA using this mode?

For GBA, kinda yes. Sadly this is only true for GBA width, not GBA height, but instead of 1.5 x 1.5 upscaling, with mode 800 it's possible to get 3 x 1.5 upscaling, which still looks much better than without the patch.
 

Vague Rant

Deceptively cute
Member
Joined
Aug 7, 2008
Messages
2,464
Trophies
2
Location
Melbourne
Website
vaguerant.tumblr.com
XP
3,318
Country
Wait so theres a way to get a crisper picture in DS and GBA using this mode?
For GBA, kinda yes.
Technically DS can also benefit from it if you're playing in widescreen. Similar to the GBA, you can do a non-matching 3x by 1.25y scale.

Horizontal: 3*256 = 768
Vertical: 1.25*192 = 240

768*240 is, remembering that the pixels are half as wide as normal square pixels, a 16:10 aspect ratio, identical to how DS widescreen support operates on 3DS currently. This means, at least for games with widescreen support, you'd be able to get a clean triple-resolution scale on the horizontal axis, which should look a lot crisper. On the vertical, you are still stuck with the awkward 1.25 times scale.

If you don't mind that it's an awful idea, you could do a 3x by 1y scale, 768*192, for a 2:1 aspect ratio image with black borders on all sides.
 
  • Like
Reactions: RocketRobz and Sono

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    AncientBoi @ AncientBoi: Now go take a shower @BakerMan . Phew +1