r/homebrew • u/Bully2300 • 7d ago
News Update 2: Diablo for Nintendo NDS
Before I start: I want you to give you my donation Link and I know it very very rude and you dont have money either but I want to make my drivers license for motorcycle in germany but its very expensive an because of I am a 14 year old NDS nerd I have nothing where I can earn money so here it is: https://ko-fi.com/koenigjibjib. Would be very nice If you had a Dollar to donate or 5!!!
So I've been trying to get DevilutionX running on an actual Nintendo DS. devkitPro/Calico, 256x192, just using my own DIABDAT.MPQ. No emulator shim, real port.
It actually boots now. Town loads, character spawns, you can walk around. The screen is continuous, nothing's split anymore, no OOM.
Most of the pain so far was coordinate stuff. The engine lays everything out for 640x480 and the DS screen is 256x192, so the item bar ended up at x = -192, which is where the "it's all in the middle" look came from. I mapped the UI down 640->256 and had to rescale the panel art, and that was the other bit — my first pass used nearest neighbour and it just dropped 3 of 5 pixels per axis. Looked like garbage. Switched to a mode filter (most common palette index per block) and the lines and edges came back.
Then there was the 2 fps thing, which took me a while to find. nthread_has_500ms_passed() is the multiplayer turn check. In singleplayer nothing ever advances last_tick, it just sits at whatever it was set to at startup, so ticksElapsed grows forever and once it's past 50ms drawGame is just permanently false. The game itself was running fine the whole time, it just only redrew every 500ms. Logic fine, picture frozen. One early return in that function for singleplayer and it went to a full frame rate.
The blit was the other big one. DS VRAM only takes 16 or 32 bit writes, the game is buffering 8-bit indexed, so that was 49k individual palette lookups per frame. Two pixels per 32-bit write now.
Fonts were annoying too. Smallest translated font is 12px but after the downscale a panel button is 7px tall, so text didn't fit. I generate a 6px variant from the 12px one host-side, and the original version I had was flattening every pixel to a single shade, which is why the menu text colour looked off. Now it averages the 2x2 block instead, so the glyphs keep the same brightness and the same translation tables, just smaller.
What's still wrong: the panel button labels (QUESTS, MANUAL, MENU) are baked into the sprite, not drawn as text. After the 2/5 shrink those letters are about 5px tall and unreadable. I think I need to pull them out and draw them as a separate overlay, but I haven't done it yet.
Biggest caveat: all of this is verified in melonDS only. Never been on real hardware.
For anyone poking at it: Calico/devkitPro, hand written SDL1 shim, custom heap with a pool allocator (4MB DS RAM, ~1.6MB used). For debugging I write a FAT16 log that I read from the host side, because the on-screen console text isn't OCR-able. That channel is the only reason I found any of this.
Anyone dealt with shrinking baked-in sprite text before? Not sure there's a nicer way than the overlay.
•
u/AutoModerator 7d ago
Thank you for posting to r/homebrew. Please keep in mind the following: - Piracy is not supported here, and is against the law. - Please read the sticky post as it has answers to many common questions. - This isn't for homebrew beer.
We also have a Discord server where you may be able to get an answer faster: https://discord.gg/PeQvhsrRdh
This is sent on all posts. Your post has not been removed (unless you see a comment stating otherwise)
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.