Author Topic: Unraveling the mysteries of th_dnh.dat  (Read 25146 times)

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Unraveling the mysteries of th_dnh.dat
« on: October 18, 2009, 03:38:47 PM »
Right, we know Nuclear cheese is busy with a replacement for Danmakufu, but still it never stops me from being curious about our original tool. I had a small PM session with henry where he asked me if I managed to crack the files. No, it is like highly impossible at this moment for me. I am unfortunate not a real guru when it comes down to this.

Basically all I could do is open the DAT file with a hex editor. It reveals nothing more than the files that are inside it. By creating dummy files inside the folders such as 'img' 'se' you can force Danmakufu to ignore the defaults inside the dat and use the ones you tell him.




Brightmoon is useless, doesn't work (latest or old version). Th_dnh.dat is just packed differently.


Though sizes, coordinates are all unknown. Even my dummy sheet file is useless till a certain extend. But I used to replace alot of images and also discovered alot of them with hex editor. Has anybody actually managed to discover anything aside the stuff we already discovered in system.png and the STG frame + sounds?

DgBarca

  • Umineko fuck yeah
  • Spoilers ?
Re: Unraveling the mysteries of th_dnh.dat
« Reply #1 on: October 18, 2009, 04:08:47 PM »
Oh I just found Title.png and Menu1.png.
THANKS, HELEPOLIS
[21:16] <redacted> dgbarca makes great work
[21:16] <redacted> i hope he'll make a full game once

Drake

  • *
Re: Unraveling the mysteries of th_dnh.dat
« Reply #2 on: October 18, 2009, 07:54:26 PM »
I'll get on it when I have the time.

A Colorful Calculating Creative and Cuddly Crafty Callipygous Clever Commander
- original art by Aiけん | ウサホリ -

Henry

  • The observer
  • Exploring to the new world of Danmaku
Re: Unraveling the mysteries of th_dnh.dat
« Reply #3 on: October 19, 2009, 12:14:40 AM »
Oh I just found Title.png and Menu1.png.
THANKS, HELEPOLIS
Oh... It is easy to know the filename (and guess the directory) of the files if you open it in Notepad :P

Here is the list, but nobody can crack it?
Code: [Select]
stage0.txt
seSuperNaturalBorder1.wav
seScore.wav
sePlayerSpellCard.wav //SFX when player uses a SC
sePlayerShot01.wav //SFX for player shot
sePlayerCollision.wav //SFX when player dies
seGraze.wav //SFX for grazing
seGetSpellCardBonus.wav //...
seExplode01.wav
seEnemyExplode01.wav
seBomb_ReimuB.wav
seBomb_ReimuA.wav
se1UP.wav
seUseSpellCard.wav
seSuperNaturalBorder2.wav
BackGround_IceMountain.x
BackGround_IceMountain.bmp
BackGround_Default_Pool.png
BackGround_Default_01.x
BackGround_Default_01.bmp
BackGround.x
BackGround.bmp
Title.png //this is the MAIN menu
SystemText.png
System.png
STG_Player11.png
STG_Player01.png
STG_Frame.png //this is the frame
Shot.png
Select_Player11.png
Select_Player01.png
PowerOfSuperNaturalBorder.png
Menu01.png //this is the script menu
MagicCircle.png //this is the magical circle for the boss
Item.png
Font.png
Effect.png
CutIn_PlayerChar11.png
CutIn_PlayerChar01.png
Bomb2B.png
Bomb2A.png
Bomb1B2.png
Bomb1B1.png
Bomb1A.png
BackGroundDefault02.png
BackGroundDefault01.png
Old/Forgotten member.

Old Patchouli Project was outdated but new one is in progress.

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: Unraveling the mysteries of th_dnh.dat
« Reply #4 on: October 27, 2009, 10:06:18 PM »
Here is the list, but nobody can crack it?
Code: [Select]
stage0.txt
seSuperNaturalBorder1.wav //activation of SNB
seScore.wav
sePlayerSpellCard.wav //SFX when player uses a SC
sePlayerShot01.wav //SFX for player shot
sePlayerCollision.wav //SFX when player dies
seGraze.wav //SFX for grazing
seGetSpellCardBonus.wav //...
seExplode01.wav
seEnemyExplode01.wav //when you defeat a yosei
seBomb_ReimuB.wav // i think this is obvious
seBomb_ReimuA.wav //so is this
se1UP.wav //Extend! lives
seUseSpellCard.wav //I think it's the one when you call SetScore(score);...
seSuperNaturalBorder2.wav //Maybe when you crush a SNB.
BackGround_IceMountain.x
BackGround_IceMountain.bmp
BackGround_Default_Pool.png
BackGround_Default_01.x
BackGround_Default_01.bmp
BackGround.x
BackGround.bmp
Title.png //this is the MAIN menu
SystemText.png
System.png //I tried figuring this one out. It changes stuff like the health bar, the bomb graphic, the hitbox... etc.
STG_Player11.png //Marisa's sprites
STG_Player01.png //Reimu's sprites
STG_Frame.png //this is the frame
Shot.png
Select_Player11.png
Select_Player01.png
PowerOfSuperNaturalBorder.png //That thing that runs horiz and vertic when you use CutIn();
Menu01.png //this is the script menu
MagicCircle.png //this is the magical circle for the boss
Item.png //self-explanatory
Font.png
Effect.png //MAYbe ReimuA's bombing explosion things and the explosion things when the enemy dies.
CutIn_PlayerChar11.png //Marisa's cutins.
CutIn_PlayerChar01.png //Reimu's cutins.
Bomb2B.png //self-explanatory.
Bomb2A.png
Bomb1B2.png
Bomb1B1.png
Bomb1A.png //end self-explanatory
BackGroundDefault02.png
BackGroundDefault01.png

Nimble

  • Broken English Fox
  • Rushing toward the bullet!
    • Viewmix
Re: Unraveling the mysteries of th_dnh.dat
« Reply #5 on: October 27, 2009, 11:04:17 PM »
After 4x die try in System.png


with this grid table to loop edit&test


and last result, I still can't figure how long the little red bar that mark each script step has. I'll try again tomorrow. Why it need to be that long?
I really don't get it.


Quote from: AlwaysThe⑨
...
PowerOfSuperNaturalBorder.png //That thing that runs horiz and vertic when you use CutIn();
...
Something I really want to change it :P

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: Unraveling the mysteries of th_dnh.dat
« Reply #6 on: October 28, 2009, 02:03:31 AM »
...Something I really want to change it :P

Like this? :P I made it completely transparent(then I think I should have made it only a 1x1 pic)

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: Unraveling the mysteries of th_dnh.dat
« Reply #7 on: October 28, 2009, 03:49:34 PM »
From the old Danmakufu Q-A Thread...
Quote
Hitbox: 4,91;9,96
Lifebars: 0,0;127,11
Bomb icon: 1,64;16,81
Nullify box: 0,180;?,198 (I cannot figure out exactly where it ends on the right, because if I put it where it seems to end, I somehow get a blotch of black where I'm using the 0,0,0 color, which should be invisible in Danmakufu... Or maybe it's just me not seeing it well. Can't tell. In any case, what SEEMS to be the end is about...127. But I'd honestly advise putting it around 3 for the left bounce and 124 for the right bound, as there's no reason to actually stretch it across the whole thing.)
Boss marker: 1,160;48,174
Things-that-fly-around-boss (What the heck ARE these things...?): 0,134;22,156
Quote
Invincibility: 1, 384, 126, 510
Spell lines:  player spell: 0, 38, 259, 44   enemy spell: 0, 45 259, 51
Event Box: 0, 26, 127,...35
Super Natural Border, I had it once, but lost the only file I had with it in. Darn, I forgot to save a backup.

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Unraveling the mysteries of th_dnh.dat
« Reply #8 on: October 28, 2009, 06:22:11 PM »
Just don't forget there is more than just the System.png. There is also Effects.png for Concentration01 and such. And also SpellEffect ( see the list ) which handles the magic circle.


Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: Unraveling the mysteries of th_dnh.dat
« Reply #9 on: November 01, 2009, 09:32:25 PM »
Take a look at this.
Shot.png

Stuffman

  • *
  • We're having a ball!
Re: Unraveling the mysteries of th_dnh.dat
« Reply #10 on: November 01, 2009, 09:39:36 PM »
Oh, the default Reimu and Marisa shots are in there too? Interesting.

DgBarca

  • Umineko fuck yeah
  • Spoilers ?
Re: Unraveling the mysteries of th_dnh.dat
« Reply #11 on: November 01, 2009, 10:12:40 PM »
Take a look at this.
Shot.png

Isn't that CtC shot replace ?
[21:16] <redacted> dgbarca makes great work
[21:16] <redacted> i hope he'll make a full game once

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: Unraveling the mysteries of th_dnh.dat
« Reply #12 on: November 01, 2009, 10:26:22 PM »
Isn't that CtC shot replace ?
No, THIS is the CtC shot replacement png.

DgBarca

  • Umineko fuck yeah
  • Spoilers ?
Re: Unraveling the mysteries of th_dnh.dat
« Reply #13 on: November 01, 2009, 10:37:07 PM »
No, THIS is the CtC shot replacement png.

Yeah but why CtC bullets are here ? I was in CtC folder ?
WAIT ! *have just understand*
[21:16] <redacted> dgbarca makes great work
[21:16] <redacted> i hope he'll make a full game once

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: Unraveling the mysteries of th_dnh.dat
« Reply #14 on: November 02, 2009, 12:50:55 AM »
Take a look at this.
Shot.png
Take a look at this.
Code: [Select]
#TouhouDanmakufu
#Title[Shot.png]
#Text[Someone look into this.]
#BackGround[User()]
//BackGround[User(img\Shot.png, 3, -0.5)]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main {
    let BossImage = "img\Shot.png";
    @Initialize {
        SetLife(1);
        //LoadGraphic(BossImage);
        MagicCircle(false);
    }

    @MainLoop {
    }

    @DrawLoop {

        SetTexture(BossImage);
        SetGraphicRect(0, 0, 512, 256);
        SetGraphicAngle(0, 0, 90);
        DrawGraphic(GetCenterX, GetCenterY);

    }

    @Finalize {
        //DeleteGraphic(BossImage);
    }
}
:V

Azure Lazuline

  • Looooove!!
  • PM me for free huggles and love!
    • Entanma Project - indie game development
Re: Unraveling the mysteries of th_dnh.dat
« Reply #15 on: November 09, 2009, 01:57:08 AM »
Hm, I think I found a way to get a near-perfect copy of the image files (based on the above code, but it works with transparency). Obviously, System.png comes first. Transparency is very slightly messed up, but it's hardly noticeable. I know for a fact that this contains the entire image, but I don't recognize some of them (like the little... scribble thing on the right).

Are there any other images I should do next? I want to make sure this "technique" works before I start doing everything with it, then find out it's wrong...

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Unraveling the mysteries of th_dnh.dat
« Reply #16 on: November 09, 2009, 03:31:23 PM »
I'll take a look at the images when I am at home.

Cabblecorento

  • I'm a cat!
  • MEOW.
Re: Unraveling the mysteries of th_dnh.dat
« Reply #17 on: November 09, 2009, 04:42:57 PM »
I edited mine to where there are no annoying floaty things and the bar at the top is black and white.

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Unraveling the mysteries of th_dnh.dat
« Reply #18 on: November 10, 2009, 09:15:22 AM »
This is pretty amazing, the shotsheet Always9 posted is indeed working. Though makes me wonder how they did the CtC shot replace thing. Meaning they must have cracked the DAT file open to get the sheet, else noway they are going to position all bullets correctly.

Also Nimmble seeming to make progress with the System.png and such.

Nimble

  • Broken English Fox
  • Rushing toward the bullet!
    • Viewmix
Re: Unraveling the mysteries of th_dnh.dat
« Reply #19 on: November 10, 2009, 02:09:11 PM »
I end up using System.png that I found in old thread (I can't remember who attrach that file, may be Always お⑨烏? becuase as I remember, code was include in the reply.) but it size is 264x353 so I have to adjust it a little.
After that, It end like Azure did.




oTL~



Before I bury myself in shame. I do something instead.

I'm glad that Menu and Title is nothing but just 640*480 pixel png.....

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Unraveling the mysteries of th_dnh.dat
« Reply #20 on: November 10, 2009, 02:26:55 PM »
Uwaaa! Why did you release the System.png with black background? Do you have a transparant version (or PSD file which is even more suitable)

Nimble

  • Broken English Fox
  • Rushing toward the bullet!
    • Viewmix
Re: Unraveling the mysteries of th_dnh.dat
« Reply #21 on: November 10, 2009, 04:10:17 PM »
I just use this and it work well in game... oTL~

Azure already release transparent version :)

My system.psd is not diffirent from png version so much because I just use system.png that I got and adjust it position only (it come with black background too.)

I'll try removing black background, but I worry about both magic circle at the bottom.

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Unraveling the mysteries of th_dnh.dat
« Reply #22 on: November 10, 2009, 04:27:30 PM »
I just use this and it work well in game... oTL~

Azure already release transparent version :)

My system.psd is not diffirent from png version so much because I just use system.png that I got and adjust it position only (it come with black background too.)

I'll try removing black background, but I worry about both magic circle at the bottom.

Urf, I see. That won't do any good anymore. The reason for black bg being bad is the drawing style in Danmakufu. If it is ADD it requires black. If it is ALPHA it requires transparant. Neverless, it seems Dnh uses Additive drawing for the system functions.

Azure Lazuline

  • Looooove!!
  • PM me for free huggles and love!
    • Entanma Project - indie game development
Re: Unraveling the mysteries of th_dnh.dat
« Reply #23 on: November 10, 2009, 11:25:09 PM »
This is pretty amazing, the shotsheet Always9 posted is indeed working. Though makes me wonder how they did the CtC shot replace thing. Meaning they must have cracked the DAT file open to get the sheet, else noway they are going to position all bullets correctly.

The shot replace is just a bullet definition file. A really complicated one with a ton of bullets, but that's all it is. Just rename the .dnh files to .txt so you can open them.


Also, since the transparent system.png seems to work perfect, here's how I did it (needs Photoshop, and fairly long):

1. get this script:
Code: [Select]
#TouhouDanmakufu
#Title[image viewer]
#Text[]

#Player[FREE]
#ScriptVersion[2]

script_enemy_main {
    let imgBoss = "img\System.png";
    let imgWhite = GetCurrentScriptDirectory~"\white.png";

    let x=0;
    let y=-30;
    let color=0;
    @Initialize {
        SetLife(1);
LoadGraphic(imgWhite);
LoadGraphic(imgBoss);
        MagicCircle(false);
    }

    @MainLoop {
if(GetKeyState(VK_LEFT)==KEY_PUSH){x+=32;}
if(GetKeyState(VK_RIGHT)==KEY_PUSH){x-=32;}
if(GetKeyState(VK_UP)==KEY_PUSH){y+=32;}
if(GetKeyState(VK_DOWN)==KEY_PUSH){y-=32;}
if(GetKeyState(VK_USER)==KEY_PUSH){color=255-color;}
SetPlayerY(-10);
    }

    @DrawLoop {
        SetGraphicAngle(0, 0, 0);

        SetTexture(imgWhite);
        SetGraphicRect(0+x, 0+y, (GetClipMaxX-GetClipMinX)+x, (GetClipMaxY-GetClipMinY)+y);
SetColor(color,color,color);
        DrawGraphic(GetCenterX, GetCenterY);
SetColor(255,255,255);
        SetTexture(imgBoss);
        DrawGraphic(GetCenterX, GetCenterY);

SetColor(100,100,100);
        SetTexture(imgWhite);
        SetGraphicRect(0,0,GetClipMaxX-GetClipMinX,30);
DrawGraphic(GetCenterX,GetClipMinY+15);
DrawGraphic(GetCenterX,GetClipMaxY-5);
    }

    @Finalize {
        DeleteGraphic(imgWhite);
    }
}
2. I have it set to System.png here, but you can obviously change it if you want.
3. Create a "white.png" file in that directory (just a 5x5 or so white square).
4. Load up the script. Take a screenshot, then paste it into Photoshop and get it all nice and cropped. If the picture's bigger than the frame, just scroll around, take more screenshots, and paste them together (the script automatically scrolls in increments of 32 pixels).
5. press C to switch to a white background and do it again. Make sure everything lines up.
6. Make it so there's only those two layers, black on the bottom and white on the top.
7. Duplicate both and hide the originals.
8. Grayscale both (ctrl-shift-U).
9. Set the top layer (the white BG)'s blending mode to Difference, then merge it with the other layer (ctrl-E).
10. Ctrl-A, ctrl-C.
11. Hide or delete that layer, then deselect (ctrl-D... yes, I like keyboard shortcuts).
12. Set the layer with the black background to be visible again, and create an empty layer mask on it.
13. Open the channels tab (it should be right next to layers, if not, then go into the Window menu to find it), set the mask to be visible (click the only blank box in the tab), then set all the others to be invisible.
14. Paste what you copied before onto that layer (ctrl-V, of course), then invert it (ctrl-I).
15. Go to the layers menu and click the eye next to that layer to set its visible channels back to the default.

If I didn't forget anything and you didn't mess up, then you should be done. Save it, edit it, or do whatever you want with it. An idea I had was to replace the default Reimu and Marisa sprites with something better, but that's not my area of expertise - maybe someone else could draw up some sprites to use instead of ASCII-Reimu? And of course, edit shot.png and modify their bullets' transparency so you can actually see in front of you...

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Unraveling the mysteries of th_dnh.dat
« Reply #24 on: November 11, 2009, 06:53:32 AM »
The shot replace is just a bullet definition file. A really complicated one with a ton of bullets, but that's all it is. Just rename the .dnh files to .txt so you can open them.
That is not what I meant.


Edit: Ignore this post. I was partially being a (9) for not proper reading it. But I seem to get the picture now: Genius.
« Last Edit: November 12, 2009, 11:07:13 AM by Helepolis »

Drake

  • *
Re: Unraveling the mysteries of th_dnh.dat
« Reply #25 on: November 11, 2009, 11:42:20 PM »
Effect.png
Font.png
Item.png
STG_Player01.png
STG_Player11.png
« Last Edit: November 12, 2009, 12:53:48 AM by Drake »

A Colorful Calculating Creative and Cuddly Crafty Callipygous Clever Commander
- original art by Aiけん | ウサホリ -

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Unraveling the mysteries of th_dnh.dat
« Reply #26 on: November 12, 2009, 09:17:33 AM »
Drake, what the hell da ze. WHAT THE HELL DA ZE.

I see, Azure's method is pretty strong here.
« Last Edit: November 12, 2009, 09:19:09 AM by Helepolis »

DgBarca

  • Umineko fuck yeah
  • Spoilers ?
Re: Unraveling the mysteries of th_dnh.dat
« Reply #27 on: November 12, 2009, 05:27:17 PM »
 :toot:
[21:16] <redacted> dgbarca makes great work
[21:16] <redacted> i hope he'll make a full game once

Primula

  • EARL TYPE 222
Re: Unraveling the mysteries of th_dnh.dat
« Reply #28 on: November 12, 2009, 10:16:46 PM »
I did my custom sprite of Reimu and Marsa in that style but it required Naut's spellcards to get the sprites =/ -downloads stuff from Drake's post-

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: Unraveling the mysteries of th_dnh.dat
« Reply #29 on: November 12, 2009, 10:18:15 PM »
I'm almost done a Reimu sprite set (to replace STG_Player01.png)

« Last Edit: November 13, 2009, 04:19:15 PM by Always お⑨烏 »