ROM Hack Culdcept DS [open translation]

DarthNemesis

Well-Known Member
Member
Joined
Feb 19, 2008
Messages
1,210
Trophies
0
XP
260
Country
United States
theli said:
hm.... maybe someone will help ... no sure how i should better work with such files containing tiles ... http://omploader.org/vMWxrYQ/00096
frown.gif

Looks like a pretty simple format. The file contains a palette, the tiles, and an image map.

00096.png


4 bytes - palette offset
4 bytes - tiles offset
4 bytes - map offset
palette section - 16 colors, 2 bytes per color (15bpp BGR format)
tiles section - 32 bytes per tile (4bpp linear reverse-order codec)
map section - 1 byte width, 1 byte height, 2 bytes per tile (1 byte index, 1 byte transformations)

CODE/*
* Created by SharpDevelop.
* User: DarthNemesis
* Date: 4/29/2009
* Time: 10:04 AM
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/

using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Windows.Forms;

namespace CuldceptPic
{
ÂÂÂÂ///
ÂÂÂÂ/// Description of MainForm.
ÂÂÂÂ///
ÂÂÂÂpublic partial class MainForm : Form
ÂÂÂÂ{
ÂÂÂÂÂÂÂÂprivate Color[] palette;
ÂÂÂÂÂÂÂÂprivate Bitmap[] tiles;
ÂÂÂÂÂÂÂÂprivate Bitmap image;
ÂÂÂÂÂÂÂÂ
ÂÂÂÂÂÂÂÂpublic MainForm()
ÂÂÂÂÂÂÂÂ{
ÂÂÂÂÂÂÂÂÂÂÂÂInitializeComponent();
ÂÂÂÂÂÂÂÂ}
ÂÂÂÂÂÂÂÂ
ÂÂÂÂÂÂÂÂvoid MainFormLoad(object sender, EventArgs e)
ÂÂÂÂÂÂÂÂ{
ÂÂÂÂÂÂÂÂÂÂÂÂstring fileName = "00096";
ÂÂÂÂÂÂÂÂÂÂÂÂFileStream file;
ÂÂÂÂÂÂÂÂÂÂÂÂBinaryReader reader;
ÂÂÂÂÂÂÂÂÂÂÂÂif (!File.Exists(fileName))
ÂÂÂÂÂÂÂÂÂÂÂÂ{
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂMessageBox.Show("Cannot find file.");
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂreturn;
ÂÂÂÂÂÂÂÂÂÂÂÂ}
ÂÂÂÂÂÂÂÂÂÂÂÂfile = new FileStream(fileName, FileMode.Open, FileAccess.Read);
ÂÂÂÂÂÂÂÂÂÂÂÂreader = new BinaryReader(file);
ÂÂÂÂÂÂÂÂÂÂÂÂuint paletteOffset = reader.ReadUInt32();
ÂÂÂÂÂÂÂÂÂÂÂÂuint tilesOffset = reader.ReadUInt32();
ÂÂÂÂÂÂÂÂÂÂÂÂuint mapOffset = reader.ReadUInt32();
ÂÂÂÂÂÂÂÂÂÂÂÂ
ÂÂÂÂÂÂÂÂÂÂÂÂfile.Seek(paletteOffset, SeekOrigin.Begin);
ÂÂÂÂÂÂÂÂÂÂÂÂreader = new BinaryReader(file);
ÂÂÂÂÂÂÂÂÂÂÂÂReadPalette(reader);
ÂÂÂÂÂÂÂÂÂÂÂÂ
ÂÂÂÂÂÂÂÂÂÂÂÂfile.Seek(tilesOffset, SeekOrigin.Begin);
ÂÂÂÂÂÂÂÂÂÂÂÂreader = new BinaryReader(file);
ÂÂÂÂÂÂÂÂÂÂÂÂReadTiles(reader, mapOffset - tilesOffset);
ÂÂÂÂÂÂÂÂÂÂÂÂ
ÂÂÂÂÂÂÂÂÂÂÂÂfile.Seek(mapOffset, SeekOrigin.Begin);
ÂÂÂÂÂÂÂÂÂÂÂÂreader = new BinaryReader(file);
ÂÂÂÂÂÂÂÂÂÂÂÂReadImage(reader);
ÂÂÂÂÂÂÂÂÂÂÂÂreader.Close();
ÂÂÂÂÂÂÂÂÂÂÂÂ
ÂÂÂÂÂÂÂÂÂÂÂÂpanelImage.Width = image.Width;
ÂÂÂÂÂÂÂÂÂÂÂÂpanelImage.Height = image.Height;
ÂÂÂÂÂÂÂÂÂÂÂÂpanelImage.Invalidate();
ÂÂÂÂÂÂÂÂ}
ÂÂÂÂÂÂÂÂ
ÂÂÂÂÂÂÂÂprivate Color ReadColor(BinaryReader reader)
ÂÂÂÂÂÂÂÂ{
ÂÂÂÂÂÂÂÂÂÂÂÂushort code = reader.ReadUInt16();
ÂÂÂÂÂÂÂÂÂÂÂÂint r = (code & 0x001F) > 2;
ÂÂÂÂÂÂÂÂÂÂÂÂint b = (code & 0x7C00) >> 7;
ÂÂÂÂÂÂÂÂÂÂÂÂreturn System.Drawing.Color.FromArgb(r, g, b);
ÂÂÂÂÂÂÂÂ}
ÂÂÂÂÂÂÂÂ
ÂÂÂÂÂÂÂÂprivate void ReadPalette(BinaryReader reader)
ÂÂÂÂÂÂÂÂ{
ÂÂÂÂÂÂÂÂÂÂÂÂuint numColors = 16;
ÂÂÂÂÂÂÂÂÂÂÂÂpalette = new Color[numColors];
ÂÂÂÂÂÂÂÂÂÂÂÂfor (int i = 0; i < numColors; i++)
ÂÂÂÂÂÂÂÂÂÂÂÂ{
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂpalette = ReadColor(reader);
ÂÂÂÂÂÂÂÂÂÂÂÂ}
ÂÂÂÂÂÂÂÂ}
ÂÂÂÂÂÂÂÂ
ÂÂÂÂÂÂÂÂprivate Bitmap ReadTile(BinaryReader reader)
ÂÂÂÂÂÂÂÂ{
ÂÂÂÂÂÂÂÂÂÂÂÂBitmap tile = new Bitmap(8, 8);
ÂÂÂÂÂÂÂÂÂÂÂÂbyte remainder = 0;
ÂÂÂÂÂÂÂÂÂÂÂÂbool lowByte = true;
ÂÂÂÂÂÂÂÂÂÂÂÂfor (int y = 0; y < 8; y++)
ÂÂÂÂÂÂÂÂÂÂÂÂ{
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂfor (int x = 0; x < 8; x++)
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ{
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂbyte curColorIndex = 0;
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂif (lowByte)
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ{
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂremainder = reader.ReadByte();
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂcurColorIndex = (byte)(remainder & 0x0F);
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂremainder >>= 4;
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂlowByte = false;
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ}
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂelse
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ{
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂcurColorIndex = remainder;
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂlowByte = true;
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ}
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂtile.SetPixel(x, y, palette[curColorIndex]);
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ}
ÂÂÂÂÂÂÂÂÂÂÂÂ}
ÂÂÂÂÂÂÂÂÂÂÂÂreturn tile;
ÂÂÂÂÂÂÂÂ}
ÂÂÂÂÂÂÂÂ
ÂÂÂÂÂÂÂÂprivate void ReadTiles(BinaryReader reader, uint length)
ÂÂÂÂÂÂÂÂ{
ÂÂÂÂÂÂÂÂÂÂÂÂuint numTiles = length / 32;
ÂÂÂÂÂÂÂÂÂÂÂÂtiles = new Bitmap[numTiles];
ÂÂÂÂÂÂÂÂÂÂÂÂfor (int i = 0; i < numTiles; i++)
ÂÂÂÂÂÂÂÂÂÂÂÂ{
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂtiles = ReadTile(reader);
ÂÂÂÂÂÂÂÂÂÂÂÂ}
ÂÂÂÂÂÂÂÂ}
ÂÂÂÂÂÂÂÂ
ÂÂÂÂÂÂÂÂprivate void ReadImage(BinaryReader reader)
ÂÂÂÂÂÂÂÂ{
ÂÂÂÂÂÂÂÂÂÂÂÂint MAX_X = reader.ReadByte();
ÂÂÂÂÂÂÂÂÂÂÂÂint MAX_Y = reader.ReadByte();
ÂÂÂÂÂÂÂÂÂÂÂÂimage = new Bitmap(8*MAX_X, 8*MAX_Y);
ÂÂÂÂÂÂÂÂÂÂÂÂGraphics g = Graphics.FromImage(image);
ÂÂÂÂÂÂÂÂÂÂÂÂfor (int y = 0; y < MAX_Y; y++)
ÂÂÂÂÂÂÂÂÂÂÂÂ{
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂfor (int x = 0; x < MAX_X; x++)
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ{
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂbyte tileIndex = reader.ReadByte();
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂbyte tileModifier = reader.ReadByte();
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂSystem.Drawing.Bitmap curTile = tiles[tileIndex].Clone() as System.Drawing.Bitmap;
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂswitch (tileModifier)
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ{
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂcase 0x04:
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂcurTile.RotateFlip(System.Drawing.RotateFlipType.RotateNoneFlipX);
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂbreak;
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂcase 0x08:
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂcurTile.RotateFlip(System.Drawing.RotateFlipType.RotateNoneFlipY);
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂbreak;
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂcase 0x0C:
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂcurTile.RotateFlip(System.Drawing.RotateFlipType.RotateNoneFlipXY);
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂbreak;
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ};
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂg.DrawImageUnscaled(curTile, 8*x, 8*y);
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ}
ÂÂÂÂÂÂÂÂÂÂÂÂ}
ÂÂÂÂÂÂÂÂÂÂÂÂg.Dispose();
ÂÂÂÂÂÂÂÂ}
ÂÂÂÂÂÂÂÂ
ÂÂÂÂÂÂÂÂvoid PanelImagePaint(object sender, PaintEventArgs e)
ÂÂÂÂÂÂÂÂ{
ÂÂÂÂÂÂÂÂÂÂÂÂGraphics g = panelImage.CreateGraphics();
ÂÂÂÂÂÂÂÂÂÂÂÂg.DrawImageUnscaled(image, 0, 0);
ÂÂÂÂÂÂÂÂÂÂÂÂg.Dispose();
ÂÂÂÂÂÂÂÂ}
ÂÂÂÂ}
}


gbasp.gif
 

theli

Well-Known Member
OP
Member
Joined
Oct 20, 2006
Messages
223
Trophies
0
Age
40
Website
theli.is-a-geek.org
XP
301
Country
so it was a map at the end of file afterall ....
thanks Darth !
smile.gif


maybe you can suggest routine for importing this back?

also... i have images with other format:
header (width, height)
a number of palettes
8x8 tiles one by one
and a map of palettes... (i.e. which palette uses each tile)..

for that format i'm also not sure of best method to import image back ...
(example file: http://omploader.org/vMWxsMw/00773.unpacked )
 

DarthNemesis

Well-Known Member
Member
Joined
Feb 19, 2008
Messages
1,210
Trophies
0
XP
260
Country
United States
theli said:
maybe you can suggest routine for importing this back?
I would suggest starting with the simplest method - iterate through the bitmap and treat every 8x8 section as a new tile, so your tile map would be 0000 0100 0200 0300 etc.
Then once you have that working, come up with a way to detect duplicate tiles (maybe use a hashmap/dictionary?) and use the existing tile index instead of a creating new tile.
For multiple palettes you'd probably need to store a separate version of each tile with each palette, and likewise for tiles that are X/Y flipped.

This is something I still need to figure out for Summon Night, so I'm interested in any ideas you may have as well.

Edit: Your multiple palettes comment reminded me, the bits in each map entry most likely correspond to this format:
CODEAAAAAAAABBBBBBBB
A01 Tile index
A02 Tile index
A04 Tile index
A08 Tile index
A10 Tile index
A20 Tile index
A40 Tile index
A80 Tile index
B01 Tile index
B02 Tile index
B04 X-flip
B08 Y-flip
B10 Palette index
B20 Palette index
B40 Palette index
B80 Palette index
 

theli

Well-Known Member
OP
Member
Joined
Oct 20, 2006
Messages
223
Trophies
0
Age
40
Website
theli.is-a-geek.org
XP
301
Country
Harun85 said:
Are there other files you can upload to the wiki? I'd like to check out the help system (when the user presses SELECT).

Cheers,

yeah.. i already have texts from maps' name/description, gallery, in-game npc's taunts, tutorial at story-mode start, shrines effects, crests, rules(name/descr)
(maybe something else which i forgot) i just need time to work on putting them into editable state
 

Green Card

New Member
Newbie
Joined
Apr 30, 2009
Messages
3
Trophies
0
XP
48
Country
United States
Sasha77 said:
I don't have any knowledge in romhacking , I am not a genius, but I could apply the x delta patch.
I tried to use the Gui , but it did not work, so I downloaded xdelta3.0u.x86-32.exe from Theli's link and put it in the same directory as the rom and the patch.

Then you Choose Start / Run
You type cmd and press enter to access the DOS mode.

You go in the directory where your rom and patch are stored.
Then you enter

xdelta3.0u.x86-32.exe -d -s Nameoftherom.nds nameoftheCuldcept_patch.xdelta3 Culdcept_EN.nds

Then it 's done

Thanks, I finally got it to work!

And thanks to the translators! I can't wait to play this baby tomorrow night; I gotta do some stuff tonight.
 

theli

Well-Known Member
OP
Member
Joined
Oct 20, 2006
Messages
223
Trophies
0
Age
40
Website
theli.is-a-geek.org
XP
301
Country
DarthNemesis said:
This is something I still need to figure out for Summon Night, so I'm interested in any ideas you may have as well.
well.. i'm back from vacation and did some work on importing images...
for images with full number of tiles and reduced palettes :
first i tried to use cmd wrapper around quither ... but i didn't like dithering artifacts this produced ...
for now i'm just assuming that translated image doesn't differ much from original (we should only replace text)
and i am using original palettes and palette map ... o i just split image to 8x8 tiles, and using FreeImage library i 'map' that image to palette bank it used originally ... this looks good
biggrin.gif


something like this:
CODEÂÂÂÂÂÂÂÂÂÂÂÂbitdata = new byte[bmp.Height * bmp.Width / 2];
ÂÂÂÂÂÂÂÂÂÂÂÂBinaryWriter bw = new BinaryWriter(new MemoryStream(bitdata));
ÂÂÂÂÂÂÂÂÂÂÂÂbyte[] pal = new byte[0x20];
ÂÂÂÂÂÂÂÂÂÂÂÂfor (int y = 0; y < (bmp.Height / 8); y++)
ÂÂÂÂÂÂÂÂÂÂÂÂ{
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂfor (int x = 0; x < (bmp.Width / 8); x++)
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ{
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂArray.Copy(origpalette, 0x20 * (map[x + y * (bmp.Width / 8)]), pal, 0, pal.Length);
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂbw.Write(FreeImageHelper.Get4BppRectWithPalette(bmp, new Rectangle(x*8,y*8,8,8), pal));
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ}
ÂÂÂÂÂÂÂÂÂÂÂÂ}
ÂÂÂÂÂÂÂÂÂÂÂÂbw.Close();
so, i'm just replacing bitmap in original file

for files with reduced tilemaps i'm planning on either use cmd wrapper around grit or porting grit's tile reduction algorithm to c#
 

Caineghis

Member
Newcomer
Joined
Oct 21, 2008
Messages
7
Trophies
0
XP
44
Country
Cote d'Ivoire
im sorry, but i try tu put the english patch with the xdelta gui, but it didnt work, someone can tell me how it has to be done plz
 

tsol

Well-Known Member
Member
Joined
Feb 15, 2009
Messages
110
Trophies
0
XP
90
Country
United States
I just wanted to offer some thanks - (and a bump, this deserves to be on the front page..) - for the amazing progress on this game.
 

GrandWizzle

New Member
Newbie
Joined
May 27, 2009
Messages
3
Trophies
0
XP
47
Country
United States
The patch is pretty sweet. i just wanna give out a big thank you to the people that made this possible. there's only one thing i noticed about the patch thats worth mentioning.

when i downloaded the 3 cards from wifi, they were still in the ir jpn text. i tried to see if doing the patch again after i downloaded the 3 cards would make it into english format but it stood in its jpn text. i know its only 3 cards for now but i'm pretty sure the game will update with new content as time goes by. my question is will the patch be updated???
 

concealed identi

Well-Known Member
Member
Joined
May 16, 2008
Messages
341
Trophies
0
Website
Visit site
XP
130
Country
thanks to those who have done translations so far...this game always looked interesting to me. i think i'm gonna wait until more of it is translated since i've never played it before and have no idea how it works, even on a fundamental level.
 

Ruri

Well-Known Member
Member
Joined
Jul 20, 2007
Messages
574
Trophies
0
XP
273
Country
United States
I suggest you try to find and play the PS2 version. It's very playable if you've played that.

...although really, now that the instructions are translated you can play this one without playing the PS2 one, too. The things that are left untranslated aren't very important.
 

concealed identi

Well-Known Member
Member
Joined
May 16, 2008
Messages
341
Trophies
0
Website
Visit site
XP
130
Country
Ruri said:
I suggest you try to find and play the PS2 version. It's very playable if you've played that.

...although really, now that the instructions are translated you can play this one without playing the PS2 one, too. The things that are left untranslated aren't very important.



Is the wiki not accurate then, or are the instructions translated somewhere else? On the wiki, almost none of the help/tutorial sections are translated, and I don't know if my Japanese is good enough to handle an explanation of a game that seems fairly complex.
 

phhavoc

New Member
Newbie
Joined
Jun 2, 2009
Messages
4
Trophies
0
XP
17
Country
United States
Could anyone help me in getting the patch to work. I followed what was said earlier but I get "xdelta3: too many file names: culdcept_eng.xdelta3 ... ". Can anyone help?
 

b_simpson1999

Member
Newcomer
Joined
Oct 21, 2008
Messages
5
Trophies
0
Age
41
Website
Visit site
XP
104
Country
I love this game, and got it to work fine. I hope that it will be fully english but for now am enjoying all the hard work all the ppl that have worked to get it this far keep it up
 

theli

Well-Known Member
OP
Member
Joined
Oct 20, 2006
Messages
223
Trophies
0
Age
40
Website
theli.is-a-geek.org
XP
301
Country
GrandWizzle said:
when i downloaded the 3 cards from wifi, they were still in the ir jpn text. i tried to see if doing the patch again after i downloaded the 3 cards would make it into english format but it stood in its jpn text. i know its only 3 cards for now but i'm pretty sure the game will update with new content as time goes by. my question is will the patch be updated???
i think that text is stored somewhere in your save file ... but i haven't found it on a first sight
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    Veho @ Veho: https://i.imgur.com/2VSGYf0.mp4