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

  • Thread starter Thread starter Sono
  • Start date Start date
  • Views Views 983,768
  • Replies Replies 2,626
  • Likes Likes 107

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 .
Hi, would it be possible to use TwPatch interpolation filters (such as Sono sharp and the other ones) with open agb firm?

TWPatch already has GBA filters (hold Y while opening TWPatch), but there is not much that could be done, as GBA is 1.5x upscale, while DS(i) is 1.25x upscale.
The DS(i) filters only work in GBA mode, if you make the image smaller. But if you already make the image smaller, might as well play it at original resolution to eliminate all the crustyness of the image.

The filtering of open_agb_firm is superior to whatever TWPatch can produce.

Otherwise yes, with reprogramming, open_agb_firm *could* support those filters, by changing the output resolution, as the filtering is in the capture card. But you'd still have the issues I have mentioned.
 
  • Like
Reactions: peel
TWPatch already has GBA filters (hold Y while opening TWPatch), but there is not much that could be done, as GBA is 1.5x upscale, while DS(i) is 1.25x upscale.
The DS(i) filters only work in GBA mode, if you make the image smaller. But if you already make the image smaller, might as well play it at original resolution to eliminate all the crustyness of the image.

The filtering of open_agb_firm is superior to whatever TWPatch can produce.

Otherwise yes, with reprogramming, open_agb_firm *could* support those filters, by changing the output resolution, as the filtering is in the capture card. But you'd still have the issues I have mentioned.
Ok so in that case the "TWPatch Gba Filters" would just be applied while using gbarunner through twmenu?
 
Also all buttons can be overridden in software, which would allow for things like button remapping, TAS input, macros (turbo fire button?), and other things.

Hi Sono, sorry to quote you on something from so long ago.

I'm looking to try tackling this software challenge: I currently have a lua script for Pokemon platinum containing a long list of inputs to beat the game, similarly to how a tas would format the inputs. I want to try get this running on actual hardware. I will probably have to use some sort of script to extract or reinterpret the inputs into a language that TWPatcher can understand. But my hope is that I can have something running in the background of an NDS title to accomplish this.

How feasible to you think some modification to TWPatch would be to undertake? Say if I had a text file on my SD card of all inputs sequentially. This script or modification would stream inputs into the game like how you mention in the quoted text. I see applications for this with tas demonstrations, but for me the end goal will be some cool shelf decoration of a game being repeatedly beaten.

Any info would be most valuable. Thank you very much :)
 
  • Like
Reactions: Sono
Hi Sono, sorry to quote you on something from so long ago.

I'm looking to try tackling this software challenge: I currently have a lua script for Pokemon platinum containing a long list of inputs to beat the game, similarly to how a tas would format the inputs. I want to try get this running on actual hardware. I will probably have to use some sort of script to extract or reinterpret the inputs into a language that TWPatcher can understand. But my hope is that I can have something running in the background of an NDS title to accomplish this.

How feasible to you think some modification to TWPatch would be to undertake? Say if I had a text file on my SD card of all inputs sequentially. This script or modification would stream inputs into the game like how you mention in the quoted text. I see applications for this with tas demonstrations, but for me the end goal will be some cool shelf decoration of a game being repeatedly beaten.

Any info would be most valuable. Thank you very much :)

Not possible at all...

BUT!
I have reimplementation since 2021, I can look into how to access files.

I don't have enough RAM, so if the playthrough doesn't compress well, it will simply not fit, as SD is removed in DS(i) mode.
If the Lua script is smaller, it might be better to include interpreter instead.

No such issue on GBA, only the main memory is removed, so streaming inputs is possible there.
 
All the script files in their current state are about 13.5mb. I'm sure there are optimisations I could make by converting the Lua from what looks like a dict structure which is easy to read and edit into something like a list of binary inputs representation of the inputs and the timings which can be played as a sequence. It looks like common button input routines for certain grinding portions use set routines that it just calls to avoid redundant repeated chunks of code.

Even if this specific playthrough is too large to work, there is surely some Tas out there which could be small enough to fit within RAM limits. I think these prospects are still worth investigating.

Could you expand on what you think is possible with an interpreter? Do you mean a Lua interpreter?
 
Last edited by sceeeene,
  • Like
Reactions: Sono
All the script files in their current state are about 13.5mb. I'm sure there are optimisations I could make by converting the Lua from what looks like a dict structure which is easy to read and edit into something like a list of binary inputs representation of the inputs and the timings which can be played as a sequence. It looks like common button input routines for certain grinding portions use set routines that it just calls to avoid redundant repeated chunks of code.

Even if this specific playthrough is too large to work, there is surely some Tas out there which could be small enough to fit within RAM limits. I think these prospects are still worth investigating.

Could you expand on what you think is possible with an interpreter? Do you mean a Lua interpreter?

Yes, Lua interpreter.

And yeah, no, I'm lucky if I can carve out 3MB from VRAM by disabling a lot of features. That thing definitely needs more compression :P

I could handle the compression part myself, I just need an input list.
If the input list already has abstractions (like often used key press routines), that is already a tremendous help, won't need as much complexity to make an input compressor before the heat death of the universe.
 
Ok so in that case the "TWPatch Gba Filters" would just be applied while using gbarunner through twmenu?
Ok I got it wrong since gbarunner runs with TWL_FIRM so it already uses the twlpatch interpolation filters. But when using AGB_FIRM, for example with virtual console gba titles if I'm not wrong, would it be possible to force a 1.25x scaling and one of the twpatch scaling filters for 1.25? With no scaling the gba image on a 3ds is too small but with 1.25x I find it better in terms of size, I mean it should be as big as the one you get by playing gba games on ds/ds lite right?
 
Yes, Lua interpreter.

And yeah, no, I'm lucky if I can carve out 3MB from VRAM by disabling a lot of features. That thing definitely needs more compression :P

I could handle the compression part myself, I just need an input list.
If the input list already has abstractions (like often used key press routines), that is already a tremendous help, won't need as much complexity to make an input compressor before the heat death of the universe.

My account is too new, so I cannot post links. But please search for 'PokemonPlatinumSingleSequence' in Google or GitHub. There is an accompanying YouTube video breaking down the techniques used which I also encourage watching as it's quite interesting.
 
  • Love
Reactions: Sono
My account is too new, so I cannot post links. But please search for 'PokemonPlatinumSingleSequence' in Google or GitHub. There is an accompanying YouTube video breaking down the techniques used which I also encourage watching as it's quite interesting.

Well... I found it, read it, and have some bad news...
I don't know yet how to inject touch... if it's even possible :(

Otherwise, I see that the format is extremely simple, I can make it compress really well.

I'll do some tests in BizHawk myself too. Good thing I made self-running TAS scripts, so that makes my job a lot easier :P
 
Well... I found it, read it, and have some bad news...
I don't know yet how to inject touch... if it's even possible :(

Otherwise, I see that the format is extremely simple, I can make it compress really well.

I'll do some tests in BizHawk myself too. Good thing I made self-running TAS scripts, so that makes my job a lot easier :P

That's great to hear, despite the lack of touch input. Given there's only one at the very beginning of the game I'm not too fussed if I have to initiate the run every time. I think it takes over a week to complete this one anyway so it will be a small inconvenience.

If the Lua script structure is somewhat universal, perhaps other Tas runs which do not require touch input will also be viable.
 
  • Like
Reactions: Sono
I made some filters based on linear interpolation 1, I liked the result, if you can test it, I would appreciate it.

based on linear interpolation 1 with tweaked sharpness
Code:
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
    0x0000, 0xFC7C, 0xFC7C, 0xFC7C, 0xFC7C,
    0xFC7C, 0x0DAC, 0x1B58, 0x2904, 0x36B0,
    0x4454, 0x36B0, 0x2904, 0x1B58, 0x0DAC,
    0xFC7C, 0xFC7C, 0xFC7C, 0xFC7C, 0xFC7C,
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000
,
based on linear interpolation 1 with less sharpness
Code:
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
    0x0000, 0xFCE0, 0xFCE0, 0xFCE0, 0xFCE0,
    0xFCE0, 0x0D20, 0x1A40, 0x2760, 0x3480,
    0x41A0, 0x3480, 0x2760, 0x1A40, 0x0D20,
    0xFCE0, 0xFCE0, 0xFCE0, 0xFCE0, 0xFCE0,
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000
 

Attachments

Last edited by LeonardoMeireles,
I made some filters based on linear interpolation 1, I liked the result, if you can test it, I would appreciate it.

based on linear interpolation 1 with tweaked sharpness
Code:
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
    0x0000, 0xFC7C, 0xFC7C, 0xFC7C, 0xFC7C,
    0xFC7C, 0x0DAC, 0x1B58, 0x2904, 0x36B0,
    0x4454, 0x36B0, 0x2904, 0x1B58, 0x0DAC,
    0xFC7C, 0xFC7C, 0xFC7C, 0xFC7C, 0xFC7C,
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000
,
based on linear interpolation 1 with less sharpness
Code:
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
    0x0000, 0xFCE0, 0xFCE0, 0xFCE0, 0xFCE0,
    0xFCE0, 0x0D20, 0x1A40, 0x2760, 0x3480,
    0x41A0, 0x3480, 0x2760, 0x1A40, 0x0D20,
    0xFCE0, 0xFCE0, 0xFCE0, 0xFCE0, 0xFCE0,
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000

Did you test these? Just by looking at the values, the coefficients don't add up to 0x4000, so it will slightly darken the image.

You can try on real hardware in TWPatch, by putting these files to tw_scale_twl.bin for DS(i), or tw_scale_agb.bin for GBA. File format is char name[32]; u16 data[]; where data is the same format as how you input the scale filter (same format you put the .bin file values you uploaded), left to right, top to bottom. So 0xABCD gets written as CD AB. Also, fill unused name with null character (not '0' of value 0x30, but '\0' of value 0x00).
 
made some filters based on linear interpolation 1, I liked the result, if I can test it, I would appreciate

Did you test these? Just by looking at the values, the coefficients don't add up to 0x4000, so it will slightly darken the image.

You can try on real hardware in TWPatch, by putting these files to tw_scale_twl.bin for DS(i), or tw_scale_agb.bin for GBA. File format is char name[32]; u16 data[]; where data is the same format as how you input the scale filter (same format you put the .bin file values you uploaded), left to right, top to bottom. So 0xABCD gets written as CD AB. Also, fill unused name with null character (not '0' of value 0x30, but '\0' of value 0x00).
It actually got a bit darker, I'll try that, thanks :)
 
  • Like
Reactions: Sono
Hi, guys.

Is it possible to play DS games directly on 3DS menu (with NDS forwarder) and apply filters and widescreen patch from TWPatcher?
I mean, to use the TWPatcher without Twilight.
 
Hi, guys.

Is it possible to play DS games directly on 3DS menu (with NDS forwarder) and apply filters and widescreen patch from TWPatcher?
I mean, to use the TWPatcher without Twilight.

Sadly the TWPatch patches are global (they apply to the 3DS-side software), so games without patches will display incorrectly.

As for the games, you can run a tool on the PC to apply cheats (widescreen patches usually come as cheats), and install the patched game as-is.
Do note however, that if you want to ditch TWiLightMenu++, then you need the original cartridges, as DS games are hardcoded to read from the cartridge, and only the code gets loaded from the 3DS.
 
  • Like
Reactions: lepsteam
Sadly the TWPatch patches are global (they apply to the 3DS-side software), so games without patches will display incorrectly.

As for the games, you can run a tool on the PC to apply cheats (widescreen patches usually come as cheats), and install the patched game as-is.
Do note however, that if you want to ditch TWiLightMenu++, then you need the original cartridges, as DS games are hardcoded to read from the cartridge, and only the code gets loaded from the 3DS.

Thanks. And have you a sugestion of a tool to patch on PC?
 

Site & Scene News

Popular threads in this forum