Hacking Changing the internal resolution of the Virtual Console DS Emulator

Lorenz_

New Member
OP
Newbie
Joined
Nov 1, 2024
Messages
4
Trophies
0
Age
24
XP
56
Country
United States
Hello everyone.

For the games it supports, the Virtual Console DS emulator is, in my opinion, the best way to play DS games. The Wii U gamepad is a perfect way to handle the second screen, something PC DS emulators struggle with. There is one aspect with which PC emulators are universally better though, and that is with upscaling. For the uninitiated, upscaling is process of taking an image and increasing its resolution so that it can be displayed at a larger size. The way the DS Virtual Console emulator handles upscaling from the tiny DS screen to the relavitly massive Wii U screen is less than graceful.

There is a "Screen Settings" option within the emulator that lets you set the size and location of each display to a number of preset options. Your options are pretty limited, but fortunately, you can set the size and location to whatever you'd like by editing a file called "configuration_cafe.json" in the "content\0010" folder of the emulator's files.

Both displays on the DS have a resolution of 256 x 192, so setting the size of a screen to a multiple of said resolution (i.e. 256 x 192, 512 x 384, 768 x 576, ect.) will use integer scaling while upscaling the image. Integer scaling means that every pixel of the DS' display corresponds to a perfectly square array of pixels on the Wii U's display. This produces a very sharp looking image, and it is by far the best way to upscale displays as low resolution as the DS' screens. The trade-off to using integer scaling is that it requires the DS screen size to be set to a small number of fixed values, so invariably you will need letterboxing (black bars to fill the sides of the screen) to make up for the fact that none of the fixed sizes fill up the Wii U's entire display.

If the size is not set to a multiple of 256 x 192, the screens will still upscale, but they will use a more sophisticated upscaling algorithm that leaves artifacts. Under most circumstances, these artifacts aren't too noticable, and they are worth the trade-off of being able to set the DS screen size to something that fills most of the Wii U's displaty with little letterboxing. This is not the case with vertically oriented games. The below screenshot is the default layout for vertically oriented DS games. It scales each screen to 522 x 696 (696 x 522 rotated 90°). The game pictured is Tokimeki Memorial: Girl's Side - 1st Love Plus.
720p_Scaling_0.png

When upscaled to this resolution, illistrations (characters, backgrounds, ect.) look fine, but the font is abrasively terrible. Notice how the strokes of letters are of unequal thickness. The stem of the letters like "t," "k," and "p" are sometimes way too thin. The letters like "w" and "o" loose their symmetry. The curvature on almost every letter looks squished. The more you look at it, the worse it gets. It would be an exageration to say it makes the game unplayable, but it is distracting to the point that it is massivly determintal to the experience.

You are able to switch to a different upscaling algorithm by changing the "PixelArtUpscaler" setting in configuration_cafe.json from 0 to 1, but I think the results speak for themselves:
720p_Scaling_1.png


The natural solution to this problem would be to adjust the size of the DS screens so that they use integer scaling. The internal resolution of the Virtual Console DS emulator is 1280 x 720, so the largest possible multiple of 192 x 256 you can set the DS screen size to without exceeding the bounds of the display is 384 x 512. That looks like this:
720p_Integer_Scaling.png

The image becomes very sharp. In my opinion, this is much more acceptable than the above two, but there is a new problem in that the letterboxing is rather egregious. Fortunately, there is (potentially) a solution.

The limiting factor in increasing the size further is the height of the DS display, so the following calculations will focus on the y-axis of the resolution. The perctange of the y-axis that consists of letter boxing when using the largest possible integer scaling compatible screen size can be calcualted with the equation "100 * (n mod 256) / n" where n is the height of the emulator's internal resolution. The Wii U has three possible wide screen resolutions: 1920 x 1080, 1280 x 720, and 856 x 480. Here is what the percantage of vertical lettboxing is for each:

480p: 100 * (480 mod 256) / 480 = 46.67% of the height is letterboxing.
720p: 100 * (720 mod 256) / 720 = 28.89% of the height is letterboxing.
1080p: 100 * (1080 mod 256) / 1080 = 5.19% of the height is letterboxing.

For whatever reason, even though the Wii U's maximum output resolution is 1920 x 1080, the developers of the Virtual Console DS emulator set the app's internal resolution to 1280 x 720. Had they instead opted to set the emulator's resolution to 1080p, it would be possible to use integer scaling with virtually no letterboxing. I made a mockup of what that would look like:
1080p_MOCKUP.png

This image is immaculate. My goal is to try to modify the Virtual Console DS emulator's executable file to increase its internal resolution from 1280 x 720 to 1920 x 1080 to allow for scaling like in the mockup above. With a little research, I was able to convert the emulator's .rpx file to a .elf file, open it in Ghidra, edit it, and re-convert it back to a .rpx file that runs both in CEMU and on original hardware. Here is where I hit a wall; I am not at all familiar with the Wii U's rendering framework, and documentation of it online is scarce. I don't really know what to do from here.

I tried searching for instances of the constants 1280 and 720 and changing them to 1920 and 1080 respectively. Going off of another thread I found on GBATemp, I tried changing the value of the third parameter of GX2SetTVBuffer() from 2 to 4. I may have made a few other changes, but to be perfectly honest, this was a few days ago and I don't remember perfectly.

After a lot of trial and error, I got the emulator to boot at a higher resolution... kinda....
1080p_MODIFIED_A.png

The app's resolution increased, but the DS screens where still drawn to the bounds of 1280 x 720. If I try to open the Virtual Console menu, it looks like this:
1080p_MODIFIED_B.png

This screen also appears bounded to 720p, only its centered. Interestingly, you can actually see the buttons fly in from the "out of bounds" region of the screen during the animation that plays upon opening the menu. Ultimately, I don't mind this screen being wrong. The biggest problem my changes cause is that they make the emulator incredibly unstable. The emulator hangs on boot if you have restore point data, and most games can't get past the title screen before a crash. Brain Age (which is the e-shop release this instance of the emulator is from, if that matters) can't even boot to the title screen. It crashes after the intro screen.

I have a suspicion that these problems are solvable, but I don't have enough technical knowledge about the Wii U to know how to proceed from here. If anyone has any ideas, please let me know. If it would help, I can generate an xdelta patch for my new version of the emulator's rpx file. I can also go back and try to see the exact changes I made in Ghidra.

Thank you,
Lorzen
 

Attachments

  • 1080p_MODIFIED_A.png
    1080p_MODIFIED_A.png
    56.9 KB · Views: 9
  • 1080p_MODIFIED_B.png
    1080p_MODIFIED_B.png
    234.2 KB · Views: 7

Ettino

Well-Known Member
Member
Joined
Oct 12, 2022
Messages
695
Trophies
0
XP
1,418
Country
Canada
The Wii U gamepad is a perfect way to handle the second screen, something PC DS emulators struggle with.
Struggle? I just turn one of my monitor vertically and bam both DS screens on 1 monitor. These days though, any half way decent phone or tablet can run DS emulator better than the Wii U. No issue with DSi games either.
 

sonictopfan

Well-Known Member
Member
Joined
Mar 2, 2010
Messages
2,800
Trophies
1
XP
2,244
Country
Quite interesting, meanwhile I'm still waiting for a response for my question few years ago regarding the mic support on the DS VC emulator, the games I injected don't seem to register the mic, some are required to progress, then we have Brain Age that has mic support.
 

Unithrex

Member
Newcomer
Joined
Jul 3, 2023
Messages
15
Trophies
0
Age
21
XP
69
Country
United States
Hello everyone.

For the games it supports, the Virtual Console DS emulator is, in my opinion, the best way to play DS games. The Wii U gamepad is a perfect way to handle the second screen, something PC DS emulators struggle with. There is one aspect with which PC emulators are universally better though, and that is with upscaling. For the uninitiated, upscaling is process of taking an image and increasing its resolution so that it can be displayed at a larger size. The way the DS Virtual Console emulator handles upscaling from the tiny DS screen to the relavitly massive Wii U screen is less than graceful.

There is a "Screen Settings" option within the emulator that lets you set the size and location of each display to a number of preset options. Your options are pretty limited, but fortunately, you can set the size and location to whatever you'd like by editing a file called "configuration_cafe.json" in the "content\0010" folder of the emulator's files.

Both displays on the DS have a resolution of 256 x 192, so setting the size of a screen to a multiple of said resolution (i.e. 256 x 192, 512 x 384, 768 x 576, ect.) will use integer scaling while upscaling the image. Integer scaling means that every pixel of the DS' display corresponds to a perfectly square array of pixels on the Wii U's display. This produces a very sharp looking image, and it is by far the best way to upscale displays as low resolution as the DS' screens. The trade-off to using integer scaling is that it requires the DS screen size to be set to a small number of fixed values, so invariably you will need letterboxing (black bars to fill the sides of the screen) to make up for the fact that none of the fixed sizes fill up the Wii U's entire display.

If the size is not set to a multiple of 256 x 192, the screens will still upscale, but they will use a more sophisticated upscaling algorithm that leaves artifacts. Under most circumstances, these artifacts aren't too noticable, and they are worth the trade-off of being able to set the DS screen size to something that fills most of the Wii U's displaty with little letterboxing. This is not the case with vertically oriented games. The below screenshot is the default layout for vertically oriented DS games. It scales each screen to 522 x 696 (696 x 522 rotated 90°). The game pictured is Tokimeki Memorial: Girl's Side - 1st Love Plus.
View attachment 468908
When upscaled to this resolution, illistrations (characters, backgrounds, ect.) look fine, but the font is abrasively terrible. Notice how the strokes of letters are of unequal thickness. The stem of the letters like "t," "k," and "p" are sometimes way too thin. The letters like "w" and "o" loose their symmetry. The curvature on almost every letter looks squished. The more you look at it, the worse it gets. It would be an exageration to say it makes the game unplayable, but it is distracting to the point that it is massivly determintal to the experience.

You are able to switch to a different upscaling algorithm by changing the "PixelArtUpscaler" setting in configuration_cafe.json from 0 to 1, but I think the results speak for themselves:
View attachment 468918

The natural solution to this problem would be to adjust the size of the DS screens so that they use integer scaling. The internal resolution of the Virtual Console DS emulator is 1280 x 720, so the largest possible multiple of 192 x 256 you can set the DS screen size to without exceeding the bounds of the display is 384 x 512. That looks like this:
View attachment 468926
The image becomes very sharp. In my opinion, this is much more acceptable than the above two, but there is a new problem in that the letterboxing is rather egregious. Fortunately, there is (potentially) a solution.

The limiting factor in increasing the size further is the height of the DS display, so the following calculations will focus on the y-axis of the resolution. The perctange of the y-axis that consists of letter boxing when using the largest possible integer scaling compatible screen size can be calcualted with the equation "100 * (n mod 256) / n" where n is the height of the emulator's internal resolution. The Wii U has three possible wide screen resolutions: 1920 x 1080, 1280 x 720, and 856 x 480. Here is what the percantage of vertical lettboxing is for each:

480p: 100 * (480 mod 256) / 480 = 46.67% of the height is letterboxing.
720p: 100 * (720 mod 256) / 720 = 28.89% of the height is letterboxing.
1080p: 100 * (1080 mod 256) / 1080 = 5.19% of the height is letterboxing.

For whatever reason, even though the Wii U's maximum output resolution is 1920 x 1080, the developers of the Virtual Console DS emulator set the app's internal resolution to 1280 x 720. Had they instead opted to set the emulator's resolution to 1080p, it would be possible to use integer scaling with virtually no letterboxing. I made a mockup of what that would look like:
View attachment 468932
This image is immaculate. My goal is to try to modify the Virtual Console DS emulator's executable file to increase its internal resolution from 1280 x 720 to 1920 x 1080 to allow for scaling like in the mockup above. With a little research, I was able to convert the emulator's .rpx file to a .elf file, open it in Ghidra, edit it, and re-convert it back to a .rpx file that runs both in CEMU and on original hardware. Here is where I hit a wall; I am not at all familiar with the Wii U's rendering framework, and documentation of it online is scarce. I don't really know what to do from here.

I tried searching for instances of the constants 1280 and 720 and changing them to 1920 and 1080 respectively. Going off of another thread I found on GBATemp, I tried changing the value of the third parameter of GX2SetTVBuffer() from 2 to 4. I may have made a few other changes, but to be perfectly honest, this was a few days ago and I don't remember perfectly.

After a lot of trial and error, I got the emulator to boot at a higher resolution... kinda....
View attachment 468961
The app's resolution increased, but the DS screens where still drawn to the bounds of 1280 x 720. If I try to open the Virtual Console menu, it looks like this:
View attachment 468963
This screen also appears bounded to 720p, only its centered. Interestingly, you can actually see the buttons fly in from the "out of bounds" region of the screen during the animation that plays upon opening the menu. Ultimately, I don't mind this screen being wrong. The biggest problem my changes cause is that they make the emulator incredibly unstable. The emulator hangs on boot if you have restore point data, and most games can't get past the title screen before a crash. Brain Age (which is the e-shop release this instance of the emulator is from, if that matters) can't even boot to the title screen. It crashes after the intro screen.

I have a suspicion that these problems are solvable, but I don't have enough technical knowledge about the Wii U to know how to proceed from here. If anyone has any ideas, please let me know. If it would help, I can generate an xdelta patch for my new version of the emulator's rpx file. I can also go back and try to see the exact changes I made in Ghidra.

Thank you,
Lorzen
There is a way to change the resolution of the window to get widescreen in n64 vc https ://gbatemp.net/threads/wiiu-virtual-console-finally-fixed-no-more-dark-filter-and-widescreen-support.517158/. I'd recommend trying that with ds vc
 

Lorenz_

New Member
OP
Newbie
Joined
Nov 1, 2024
Messages
4
Trophies
0
Age
24
XP
56
Country
United States
There is a way to change the resolution of the window to get widescreen in n64 vc . I'd recommend trying that with ds vc
No luck. The DS emulator doesn't have any .arc files. The functional equivalent to the N64 emulator's .arc files, the "configuration_cafe.json" file, allows you to change the brightness and DS display resolution within the emulator application, but it does not allow you to change the emulator application's internal resolution.
 
  • Like
Reactions: Unithrex

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
  • SylverReZ @ SylverReZ:
    That's what kind of bothers me. People asking the same question from decades ago. It's like a cycle going round and round. If they can't be arsed to search something so simple and easy to identify, then I can't think for words.
  • NinStar @ NinStar:
    the problem is, it is a regular chat channel, discord had forum channels for quite a while now, but the server doesn't have any
  • NinStar @ NinStar:
    I literally joined expecting to find something specific because their troubleshooting and faq pages are lacking a lot of information
    +1
  • NinStar @ NinStar:
    but since they don't have forums it is kinda hard, a lot of messages are either outdated or related to other conversations
    +1
  • SylverReZ @ SylverReZ:
    Oof. That's not looking good. Would be good if they at least put some FAQ & troubleshooting pages up; rather than ask somebody who clearly knows very little about the subject.
  • SylverReZ @ SylverReZ:
    Outdated stuff that involves hardware modifications is always a bad idea.
  • kijetesantakalu042 @ kijetesantakalu042:
    I literally only have 500 mb left on my ssd
  • NinStar @ NinStar:
    yes, I was specifically looking for more information about the wifi firmware while running ubuntu, their faq is extremely vague on that
  • NinStar @ NinStar:
    @kijetesantakalu042 delete your hentai folder
  • kijetesantakalu042 @ kijetesantakalu042:
    @NinStar I store that on google drive. Not my hard drive
  • NinStar @ NinStar:
    I once had a shared folder on google drive, one of the collaborators was putting porn on it with the file names and extensions all changed to avoid suspicion
  • NinStar @ NinStar:
    took me a while to realize
  • kijetesantakalu042 @ kijetesantakalu042:
    I have it on a shared folder so the other person will be blamed if someone finds out
  • SylverReZ @ SylverReZ:
    @kijetesantakalu042, Just don't store it on Google Drive, ok? Put it in your MEGA folder.
  • kijetesantakalu042 @ kijetesantakalu042:
    I don't use meganx
  • SylverReZ @ SylverReZ:
    @kijetesantakalu042, I use MEGA, has a lot more storage compared to what Google offers.
  • kijetesantakalu042 @ kijetesantakalu042:
    Honestly I just want a bigger ssd or extra hard drive
  • SylverReZ @ SylverReZ:
    @kijetesantakalu042, Have something larger like a 1TB SSD, it's about enough for mostly everything you need.
  • kijetesantakalu042 @ kijetesantakalu042:
    I just have a 512 gb and I'm saving for my computer build when I finally have more space so I can't really invest in a ssd
  • NinStar @ NinStar:
    I only really use my ssd for things I'm constantly accessing on my computer
  • NinStar @ NinStar:
    everything else goes to my hdd
  • kijetesantakalu042 @ kijetesantakalu042:
    I only have an ssd
  • kijetesantakalu042 @ kijetesantakalu042:
    budget gaming laptop issue
  • K3Nv2 @ K3Nv2:
    Mail all back up data directly to Nintendo
    +1
    K3Nv2 @ K3Nv2: https://store.steampowered.com/app/1271100/Deadly_Premonition_2_A_Blessing_in_Disguise/ hell yeah