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
432
Trophies
0
Age
29
XP
2,548
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
  • No one is chatting at the moment.
    SylverReZ @ SylverReZ: https://www.youtube.com/watch?v=pnRVIC7kS4s