Homebrew [TOOL] .nds NO-INTRO roms to DSiWARE

elenarguez

Well-Known Member
Member
Joined
Jun 14, 2018
Messages
231
Trophies
0
XP
991
Country
Spain
Well, there is a particular game (Clash Elementalist) that does'nt create the "Data" folder but the "Content" folder yes :(
 

fwannmacher

Active Member
OP
Newcomer
Joined
Mar 23, 2016
Messages
37
Trophies
0
Age
36
XP
503
Country
Brazil
So, with this tool,
I can use converted DSiWare from *.bin to *.nds to place them back to *.bin with a custom set Ticket and Key so you can play them on your DSi?

Do I understand that correctly?
Not really. There are .NDS ROMs out there from dsiware titles. With this tool you can convert those ROMs to the folder structure used by HiyaCFW.
 

redunka

Well-Known Member
Member
Joined
Nov 26, 2014
Messages
433
Trophies
0
Age
29
XP
2,560
Country
Russia
Finally got some time to make another update for my Windows pack.
The problem with exclamation marks in names is fixed (should've used subroutines instead of DelayedExpansion from the start).
Plus, there's a couple more changes to the pack that I'll describe further.

1. First of all, the most important change is the savefiles creation, the BFI tool has been ditched now.
Windows doesn't have many good tools for making FAT images, the majority of them is either outdated or lacks features.
So, I decided to use my 3DS to get properly formatted saves for all known save sizes instead.
Including the whole savefiles into the pack would increase its size, so they're trimmed down to their MBR partitions only (512KB).
The script uses truncate app to extend them back to the needed size.
I know, this may be not the best solution, but this way I can be sure that saves are formatted properly.
Especially with those titles that use quite large saves (up to few MB), better to be safe than sorry.

2. Turned out there are some non-system titles that use private.sav instead of public.sav.
Examples of such titles would be USA version of Robot Rescue, or Trailblaze that actually uses both public and private saves.
I edited the print_rom_data.py script to support private saves as well, I'll post it below.

3. Since I've already edited the python script, I tried to look if I can also make it tell whether the game uses banner.sav.
I don't really know python, so I had to use some examples from here for reference.
Here's the edited script, I probably made it ugly, but it works:
Code:
import struct
import sys


with open(sys.argv[1], 'rb') as file:
    if sys.argv[2] == 'title_id':
        file.seek(560)
        print '%x' % struct.unpack('<i', file.read(4))
    elif sys.argv[2] == 'save_size':
        file.seek(568)
        print struct.unpack('i', file.read(4))[0]
    elif sys.argv[2] == 'privsave_size':
        file.seek(572)
        print struct.unpack('i', file.read(4))[0]
    elif sys.argv[2] == 'banner_save':
        file.seek(447)
        print ' '.join('{0:08b}'.format(ord(x), 'b') for x in struct.unpack('c', file.read(1)))[-3]

It returns the size of private save if you use "privsave_size" as the second argument.
Using the "banner_save" argument will return either 0 or 1, depending on whether the game can't/can use banner save.
Banner save is not a FAT image, it's blank by default, the game will use it to change game's standard banner as you progress in game.

Example:
yUGlVrk.gif
UIelghH.gif

By the way, if @fwannmacher would also like to use preformatted saves instead of creating FAT images, they're in "tools/mbr" folder in my pack. ^^
Here's also my edits to convert_to_dsiware.bash script that I've been testing on Ubuntu 16.04, if you want it.
The "mbr" folder has to be placed next to the scripts and maketmd.
Code:
root_folder=$(basename "${1}" ".nds")
title_id=$(python print_rom_data.py "${1}" title_id)
save_size=$(python print_rom_data.py "${1}" save_size)
privsave_size=$(python print_rom_data.py "${1}" privsave_size)
banner_save=$(python print_rom_data.py "${1}" banner_save)
content_folder="${root_folder}/${title_id}/content"
data_folder="${root_folder}/${title_id}/data"

mkdir -p "${content_folder}"
./maketmd "${1}"
mv title.tmd "${content_folder}/."

if [[ save_size -ne 0 ]]
then
    mkdir "${data_folder}"
    cp "mbr/${save_size}" "${data_folder}/public.sav"
    truncate -s ${save_size} "${data_folder}/public.sav"
fi

if [[ privsave_size -ne 0 ]]
then
    mkdir "${data_folder}"
    cp "mbr/${privsave_size}" "${data_folder}/private.sav"
    truncate -s ${privsave_size} "${data_folder}/private.sav"
fi

if [[ banner_save -ne 0 ]]
then
    dd if=/dev/zero of=banner.sav bs=1 count=16384
    mv banner.sav "${data_folder}/."
fi

cp "${1}" "${content_folder}/00000000.app"
I apologize for such a wall of text, and also, big thanks to @fwannmacher once againg, for creating the original script and inspiring me to try and make a Windows version. :wub:

P.S. The upcoming major update for No-Intro's DSiWare DAT may force us to rewrite the scripts again, but at least maketmd won't be needed anymore. ¯\(ツ)/¯
 

Attachments

  • nds2dsiware4win_v2.zip
    3.3 MB · Views: 204
Last edited by redunka,
  • Like
Reactions: MarioFlying

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • BigOnYa @ BigOnYa:
    Is it a free to play bs, pay to get any good weapon/gear
  • K3Nv2 @ K3Nv2:
    Not free to play but $35
  • K3Nv2 @ K3Nv2:
    Inb4 kiiwii gives it a 0/10
  • BigOnYa @ BigOnYa:
    6/10 rating on steam
  • Psionic Roshambo @ Psionic Roshambo:
    I would like a Predator game "Kill Team" it takes place in the Jungle of the first movie, your team is sent to hunt the predator, using current tech drones and a trained team. Set traps use strategy to hunt and trap or kill the predator.
  • BigOnYa @ BigOnYa:
    Ill stick with my Battlefield. Yea a predator hunting game like that would be cool. Esp if you can be Arnold and say "Get to da choppa"
    +1
  • Psionic Roshambo @ Psionic Roshambo:
    Maybe Arnold could do a cameo voice acting, he is the one briefing you on the mission
    +1
  • Psionic Roshambo @ Psionic Roshambo:
    Honestly surprised they didn't make a tie in game for Predators that movie was awesome
  • Psionic Roshambo @ Psionic Roshambo:
    I was kinda sad the Yakuza guy died sword fighting a predator lol
  • Psionic Roshambo @ Psionic Roshambo:
    The Russian guy went out like a boss
  • Psionic Roshambo @ Psionic Roshambo:
    Double claymores to the face definitely kill a predator lol
  • BigOnYa @ BigOnYa:
    I went today and looked at a motorcycle someone was selling. I get there and the battery on it was dead, so the guy grabbed a battery charger and hooked it up. He plugged it into the wall, and the motorcycle sparked and started smoking. Come to find out the bike uses a 6 volt battery and the guy had the charger set to 12v. I said sorry to the dude and walked away. I felt bad for him tho.
  • Psionic Roshambo @ Psionic Roshambo:
    Sounds like it would be an exciting ride....
  • Psionic Roshambo @ Psionic Roshambo:
    Not sure I would want something on fire between my legs
  • BigOnYa @ BigOnYa:
    He ruined it basically. Sad cause it was a decent old bike. It would take more money to rewire the bike than it was worth tho.
  • Psionic Roshambo @ Psionic Roshambo:
    Yeah I'm sure at minimum the starter was fried
  • Psionic Roshambo @ Psionic Roshambo:
    Alternator and battery
  • BigOnYa @ BigOnYa:
    Prob alot of fried parts. It was still smoking when I left.
  • K3Nv2 @ K3Nv2:
    I would've said show me how it rides
  • Psionic Roshambo @ Psionic Roshambo:
    I always wanted one of those Smart Cars with a Hyabusa motor in it.
  • K3Nv2 @ K3Nv2:
    I'm getting sick and tired of cheap ass baking pans now
  • BigOnYa @ BigOnYa:
    I think it be cool to have one that would fit in my pickup truck bed, then I could put down ramps n drive it off.
    BigOnYa @ BigOnYa: I think it be cool to have one that would fit in my pickup truck bed, then I could put down...