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

  • Thread starter Sono
  • Start date
  • Views 749,217
  • Replies 2,428
  • Likes 101

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 .

Sono

cripple piss
OP
Developer
Joined
Oct 16, 2015
Messages
2,821
Trophies
2
Location
home
XP
9,322
Country
Hungary
Is it also possible to change the VC filter?

Nope, sorry, TWPatch only supports DS(i) mode, and secretly GBA mode too. Other VC are emulated, not real hardware.

@Sono will the 3rd option in your poll require a pc at all? Or can the patcher be run via twilightmenu?
Edit:nvm im blindlol

If you can download the cia and nds and the patches using a 3DS only then only the 3DS is required.
 
  • Like
Reactions: Zense

Sono

cripple piss
OP
Developer
Joined
Oct 16, 2015
Messages
2,821
Trophies
2
Location
home
XP
9,322
Country
Hungary
It's me again, can I make a video about this app? I will put the credits and the download link will be from this site (what you left)

Nothing stops you from making a video, but the current patcher is under rewrite, so it'd end up looking/working different to what it is now. If you're fine with that then sure, go ahead :)
 
  • Like
Reactions: CaioHenrique360

Stellar

Well-Known Member
Member
Joined
Jul 20, 2014
Messages
194
Trophies
0
XP
1,776
Country
Portugal
Yeah, it only requires patching up to 4bits depending on how you want it to behave, simple. I'll look into it once I'll have time, which is unknown when :/

That is fantastic, thank you.

If there's a way to do that for GBA, that would be even better. It takes ages to boot a GBA VC inject on an old 3DS so it hurts my finger to hold select for so long :D
 

Sono

cripple piss
OP
Developer
Joined
Oct 16, 2015
Messages
2,821
Trophies
2
Location
home
XP
9,322
Country
Hungary
That is fantastic, thank you.

If there's a way to do that for GBA, that would be even better. It takes ages to boot a GBA VC inject on an old 3DS so it hurts my finger to hold select for so long :D

I co-develop AGB patches along with TWL patches, so all patches which work on TwlBg should work with AgbBg (within technical limits).
 

Sono

cripple piss
OP
Developer
Joined
Oct 16, 2015
Messages
2,821
Trophies
2
Location
home
XP
9,322
Country
Hungary
Hi, thank you for your valuable efforts and advances. May I ask if the widescreen "stretching" filter problem is being fixed?

Because of the advancements in rtcom technology, it will be eventually possible to do that from DS side.

As for doing it inside TwlBg, more work needs to be done. I managed to find more unused code space, but I need more work to get it working without any crashes while having a working sleep mode.
 

Sono

cripple piss
OP
Developer
Joined
Oct 16, 2015
Messages
2,821
Trophies
2
Location
home
XP
9,322
Country
Hungary
Seeing the poll, I have good and bad news:

Bad news: I tried to optimize the patcher... not only did I make it 4x slower, but I also broke it :rofl2:
Edit: I reverted the changes, made a few typos, and now it's marginally faster. yay.

Good news: I "recovered" roughly 0xDC bytes by relocating rtcom to the smaller hole (0x104 safe zone), leaving the big hole (0x1C8) usable for anything! This is good news, because the original hole is so big that it can fit (currently) all patches at once.(except rtcom of course). This also includes GBA support as well.

Now that I got a whiff of determination, I'll try to make useful commits every few days while working on the patcher ~5-40mins a day, if possible.
I have ideas on where to "cut corners" to make a functional, but not übercrappy release.
 
Last edited by Sono,

Sono

cripple piss
OP
Developer
Joined
Oct 16, 2015
Messages
2,821
Trophies
2
Location
home
XP
9,322
Country
Hungary
Yet another status update.

Turns out in my last post I was wrong about the good news. BUT WAIT!
This is good, because otherwise I wouldn't have discovered a new code hole! Sadly it's ridiculously small, being only a mere 0xF8 bytes (oof), but that's still a lot of bytes, considering the sizes of the patches.

This mistake on my part led to this great discovery, meaning we now have 3 holes:
- rtcom resides in a roughly 0x130 big hole with a tiny but still usable headroom
- the newly discovered 0xF8 bytes can be used for hardcoded trainers, like CPad-to-touch mappers, or widescreen toggler helpers (but sadly not both)
- the originally discovered 0x1E0 bytes can fit a lot of run-once initialization routines, like a crash handler installer, or the redshift unpacker

As for the 3DS-side patcher, I'll release two prereleases soon, one only containing rtcom (opt-out) + widescreen (opt-in) with the new hole system, and a later one where the Redshift configurator is fully present, allowing redshift to be configured from the configurator itself.
Yes, this means that FINALLY no exe patcher will be required, and it'll be accessible to everyone capable of installing CIAs :)
 

Sono

cripple piss
OP
Developer
Joined
Oct 16, 2015
Messages
2,821
Trophies
2
Location
home
XP
9,322
Country
Hungary
Finally, after debugging a stupid issue I finally got the patcher working again!

Changes since last public version:
- reworked hole system, so extra patches can fit in their respective holes
- can hold X before pressing and releasing START to enable the widescreen patch

[Download]

Is there any way to force 1:1 mode without having to hold select for GBA and DS games?

I haven't forgot about this (but I did before releasing this version, sorry), I hope I'll include it in the version with Redshift UI.
 

Stellar

Well-Known Member
Member
Joined
Jul 20, 2014
Messages
194
Trophies
0
XP
1,776
Country
Portugal
I haven't forgot about this (but I did before releasing this version, sorry), I hope I'll include it in the version with Redshift UI.

Thank you so much and don't worry, I don't presume anyone owes me anything. I'm beyond grateful that you're doing it at all, regardless of when it's released.

Good work and thanks again for being awesome.
 

Sono

cripple piss
OP
Developer
Joined
Oct 16, 2015
Messages
2,821
Trophies
2
Location
home
XP
9,322
Country
Hungary
Noob question... I need install only cia?

Install, then open it and follow the screen instructions, then a patched twlbg will be saved on your root/luma/sysmodules folder.

Yeah, but don't forget to enable "external module loading" in the Luma config!
After that it's literally just selecting a scale filter, pressing START, waiting 6mins, pressing SELECT to exit, then launching into DS(i)/GBA mode.
 
  • Like
Reactions: iGom

DSoryu

GBA/NDS Maniac
Member
Joined
May 5, 2010
Messages
2,359
Trophies
2
Location
In my house
XP
4,782
Country
Mexico
Yeah, but don't forget to enable "external module loading" in the Luma config!
After that it's literally just selecting a scale filter, pressing START, waiting 6mins, pressing SELECT to exit, then launching into DS(i)/GBA mode.

In my case it just takes about a minute to build the patch.
 

Zense

Well-Known Member
Member
Joined
Apr 20, 2008
Messages
1,977
Trophies
2
XP
4,308
Country
Italy
Gotta commend you for the .cia and last update @Sono! :grog: I was surprised to see it even worked with my forwarded PKMN HeartGold game, but I guess it shows that I don't really understand well how this works :P
 
  • Like
Reactions: Sono

Sono

cripple piss
OP
Developer
Joined
Oct 16, 2015
Messages
2,821
Trophies
2
Location
home
XP
9,322
Country
Hungary
In my case it just takes about a minute to build the patch.

Not if you're testing on a 2DS :ha:

Gotta commend you for the .cia and last update @Sono! :grog: I was surprised to see it even worked with my forwarded PKMN HeartGold game, but I guess it shows that I don't really understand well how this works :P

Simplified but still accurate explaination:
There's a "capture card" in the 3DS which is hooked up to the DS GPU. It records the output of the non-existant DS LCD, and stores the output in itself.
This "capture card" also has a built-in "matrix unit" which has the capability to apply filters to the output image, or even use it as an upscaler.

The CPU the 3DS games run on (ARM11) is in control of storing this captured image in VRAM, and uses the 3DS GPU (the PICA200) to draw it onto the screen, rotated (because on the 3DS both screens's top is actually on the left, so if you rotate your 3DS to the right, that's the right way up!).

What TWPatcher does, is patch Nintendo's original upscale filter with better ones, and for the widescreen patch it patches the GPU driver (named DMPGL, DMP being the company who makes the PICA200, and GL being OpenGL) to accomodate for the higher resolution output image from the "capture card".

As for rtcom, that's almost magic. Long story short, the real time clock (RTC) is sort of emulated, and hijacking it from ARM11 it's possible to exchange very small amounts of data between the ARM11 and ARM7. This is where the name comes from, RTC and COMmunication.
 

Zense

Well-Known Member
Member
Joined
Apr 20, 2008
Messages
1,977
Trophies
2
XP
4,308
Country
Italy
Not if you're testing on a 2DS :ha:



Simplified but still accurate explaination:
There's a "capture card" in the 3DS which is hooked up to the DS GPU. It records the output of the non-existant DS LCD, and stores the output in itself.
This "capture card" also has a built-in "matrix unit" which has the capability to apply filters to the output image, or even use it as an upscaler.

The CPU the 3DS games run on (ARM11) is in control of storing this captured image in VRAM, and uses the 3DS GPU (the PICA200) to draw it onto the screen, rotated (because on the 3DS both screens's top is actually on the left, so if you rotate your 3DS to the right, that's the right way up!).

What TWPatcher does, is patch Nintendo's original upscale filter with better ones, and for the widescreen patch it patches the GPU driver (named DMPGL, DMP being the company who makes the PICA200, and GL being OpenGL) to accomodate for the higher resolution output image from the "capture card".

As for rtcom, that's almost magic. Long story short, the real time clock (RTC) is sort of emulated, and hijacking it from ARM11 it's possible to exchange very small amounts of data between the ARM11 and ARM7. This is where the name comes from, RTC and COMmunication.
Thanks for the explanation! About rtcom it still amazes me to think the 3ds circle pad was possible to use in DS mode, regarding the vid you posted a while ago.

I've been playing around with the darkned filter in twpatcher and it's pretty nice. It makes me wonder if similar filters like a black and white and maybe a blue filter are possible or if that's more like a shader and requires more processing?
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    Psionic Roshambo @ Psionic Roshambo: https://www.youtube.com/watch?v=A0FyqCEfD0E