Romhacking.net

Romhacking => Help Wanted Ads => Topic started by: BlackPaladin on December 01, 2021, 12:25:01 am

Title: [Technical]Game Protection Deactivation for FDS Game (Dracula 2: Noroi no Fuuin)
Post by: BlackPaladin on December 01, 2021, 12:25:01 am
I managed to successfully insert the English font into the game and corrected any sprite errors within said game.  Graphics decompression is no longer an issue, thanks to Anime_world and his tool which had recommended.

The problem now is trying to deactivating whatever protection inside the ROM that prevents any text changes in the game’s script or other areas where text is present.  I tried changing it myself in my ROM with the English font inserted, but the game would loops the FDS BIOS menu if any text changes are made within the ROM.  This also happens with the unedited ROM as well.)

I don’t know if this is because the ROM which I had worked with has a header.  (131,016 bytes)

Anyway, I need an experienced NES ROM hacker’s assistant in deactivating the ROM’s built in protection so that any text changes will be displayed in the ROM and not force the FDS BIOS to loop indefinitely.  My patch with the English font is further down in this post’s thread.  I’ll copy and paste the link here for convenience sake.

https://www.sendspace.com/file/3cagsy

Again, thank you to Anime_world for the assistance you’ve given me so far.  I won’t forget your kindness.

P.S.:  I removed the header from the FDS ROM, and the BIOS loop still occurred.  So that means the built-in protection in the ROM will go off, header or no header.  So this will still need assistance from an experienced ROM Hacker to deactivate it.
Title: Re: [Technical]Graphics Decompression for FDS Game (Dracula 2: Noroi no Fuuin)
Post by: Anime_World on December 01, 2021, 10:05:23 am
Tiledata present in CHR-ROM is RLE Compressed. RLE is quite simple!
Just check this article about RLE: https://datacrystal.romhacking.net/wiki/Compression#RLE_.28Run_Length_Encoding.29


Look at 0x202 and follow this rules:
$00-80 - The next byte is repeated n times
$81-FE - The next 128-n bytes are uncompressed
$FF - End of stream
Title: Re: [Technical]Graphics Decompression for FDS Game (Dracula 2: Noroi no Fuuin)
Post by: Pennywise on December 01, 2021, 02:09:35 pm
Try D's Graveyard Duck utility. IIRC, it should work for this game.
Title: Re: [Technical]Graphics Decompression for FDS Game (Dracula 2: Noroi no Fuuin)
Post by: BlackPaladin on December 01, 2021, 04:21:48 pm
Try D's Graveyard Duck utility. IIRC, it should work for this game.

I downloaded the Graveyard Duck utility, and since it requires Python, I had to download a program so that I can use it in Windows.

From what I read from the readme and the information shared here so far, I had typed up the command as followed on Python:

graveduck.py -d noroi.fds 0x202 noroi.data

this is how I understand how this utility is used for decompressing...

graveduck.py (The suggested program)
-d (flag for decompressing)
noroi.fds (the FDS from of "Dracula II: Noroi no Fuuin")
0x202 (the offset where the compressed font is located)
noroi.data (The file that Graveyard Duck is supposed to output)

I'm pretty sure I did something wrong here.  I keep getting "SyntaxError: Unexpected Character after Line Continuation Error" when I type up the command in Python.  (Please keep in mind that I thought that Python is just the type of snake, not a programming language.  Consider me a total neophyte when it comes to Python.)

Can someone explain to me what I'm doing wrong? 
Title: Re: [Technical]Graphics Decompression for FDS Game (Dracula 2: Noroi no Fuuin)
Post by: Anime_World on December 01, 2021, 06:05:08 pm
Try my compressor/decompressor:
https://github.com/hansbonini/rle_konami

Windows executable is inside dist/ folder
For decompress:
main.exe D rom decompressed_file offset
For compress:
main.exe C rom decompressed_file offset_to_be_inserted_in_rom
Title: Re: [Technical]Graphics Decompression for FDS Game (Dracula 2: Noroi no Fuuin)
Post by: BlackPaladin on December 01, 2021, 06:42:41 pm
Try my compressor/decompressor:
https://github.com/hansbonini/rle_konami

Windows executable is inside dist/ folder
For decompress:
main.exe D rom decompressed_file offset
For compress:
main.exe C rom decompressed_file offset_to_be_inserted_in_rom

I can't get it to run.  Every time I use it, it tells me that it's incompatible with my computer's OS.  (I run 64-bit Windows 10)  How can I get this program to run on my system?
Title: Re: [Technical]Graphics Decompression for FDS Game (Dracula 2: Noroi no Fuuin)
Post by: Anime_World on December 01, 2021, 07:02:56 pm
I can't get it to run.  Every time I use it, it tells me that it's incompatible with my computer's OS.  (I run 64-bit Windows 10)  How can I get this program to run on my system?

Since you have python installed, run: "python main.py" or change exe properties to windows 8 compatibility
Title: Re: [Technical]Graphics Decompression for FDS Game (Dracula 2: Noroi no Fuuin)
Post by: BlackPaladin on December 01, 2021, 08:40:04 pm
Since you have python installed, run: "python main.py" or change exe properties to windows 8 compatibility

I did what you suggested.  This is what happened.

Quote
C:\FCE_Ultra\tools\graveyardduck-master>python main.py -d noroi.fds noroidata $0200
  File "C:\FCE_Ultra\tools\graveyardduck-master\main.py", line 105
    <title>rle_konami/main.py at da98d2784435c1d12409101a45f83a64e786ec44 · hansbonini/rle_konami · GitHub</title>
                                                                          ^
SyntaxError: invalid character '·' (U+00B7)

C:\FCE_Ultra\tools\graveyardduck-master>
Title: Re: [Technical]Graphics Decompression for FDS Game (Dracula 2: Noroi no Fuuin)
Post by: Anime_World on December 01, 2021, 10:35:59 pm
I did what you suggested.  This is what happened.

Download files here: https://github.com/hansbonini/rle_konami/archive/refs/heads/main.zip and try again :thumbsup: ::)

And the command line is:
Code: [Select]
python main.py D rom decompressed_file offsetCause it's not graveyardduck...

GOLDEN TIP: never mix files of different tools under same folder.
Title: Re: [Technical]Graphics Decompression for FDS Game (Dracula 2: Noroi no Fuuin)
Post by: BlackPaladin on December 02, 2021, 03:59:39 am
This is actually working for me now.  I'm getting decompressed data from the program you suggested.  Now, I just need to figure out where the Japanese font starts so that I can replace it with an English font.

I'm much further ahead in this than I thought... thanks to you, Anime_world!  :)

P.S.:  After further experimentation, I'm getting some mixed results.  At times, the program decompresses approximately half the Japanese font.  (Maybe it's because either I haven't found the exact location yet or the ROM I was using has a header.  I found the same Dracula II FDS ROM without a header, and I'm going to experiment with that one as well.  Maybe, I can get better results.)

These are the results I received so far...

(https://i.imgur.com/VPr971X.png)

I got this when I typed up the following, according to the tool you recommended:

python main.py D noroi.fds noroifile 0x15f

main.py (the program used in Python)
D (Decompression switch)
noroi.fds (The ROM file)
noroifile (uncompressed data file)
0x15F (the offset I had typed up; this might not be the correct offset where the Japanese font starts in the first place)

Am I doing something wrong here?  I can only assume the offset I typed in is -NOT- exactly where the beginning of the Japanese font is stored, correct?
Title: Re: [Technical]Graphics Decompression for FDS Game (Dracula 2: Noroi no Fuuin)
Post by: Anime_World on December 02, 2021, 12:58:47 pm
Tile data is stored in chunks... so you'll not decompress all tiledata with 1 unique command... you need to search all compressed chunks offsets.  :thumbsup:
Title: Re: [Technical]Graphics Decompression for FDS Game (Dracula 2: Noroi no Fuuin)
Post by: BlackPaladin on December 02, 2021, 01:37:26 pm
Tile data is stored in chunks... so you'll not decompress all tiledata with 1 unique command... you need to search all compressed chunks offsets.  :thumbsup:

Oh, so I am doing it right... it's just not complete.

At least, I found one chunk, so I'll have to find more in the ROM until I have the full font decompressed.

Time to resume spelunking in the FDS ROM.   8)

December 03, 2021, 03:44:47 pm - (Auto Merged - Double Posts are not allowed before 7 days.)
I did some more spelunking in the FDS ROM and found more chunks of data that shows the font uncompressed.  I haven’t found all chunks yet, but I’m still holding out hope.

Also on a freak, I tried looking for the ROM’s script in Windhex.  It’s uncompressed?  The graphics are compress, but the script isn’t?!  WTF Konami?!

Speaking of the script, I now need to figure out the ROM’s pointer system.  I don’t know if pointer systems on FDS ROMs differ compared to those in NES ROMs.  I may have to read up on that later.

Point being, progress is being made.  Slow progress… but it’s better than hitting a wall, lol.

P.S.:  Typing this on an iPhone with fat fingers is annoying.  🤬

December 03, 2021, 09:23:49 pm - (Auto Merged - Double Posts are not allowed before 7 days.)
(https://i.imgur.com/19pT5jj.png)

And after spelunking further, I FOUND THE WHOLE FONT!!!  After poking through myriad offsets, I found the font in one place!  (0xE81)  Now, the step is to apply an English font and re-insert this into the ROM. 

Let's see if I'm successful here.  *Crosses fingers*

Anime_world, thank you so much for the tool you recommended!  This wouldn't have been possible without your assistance!

December 03, 2021, 10:57:16 pm - (Auto Merged - Double Posts are not allowed before 7 days.)
Back to the roadblock... I after I decompressed the font, I added the English font from Castlevania III to the decompressed file and tried inserting it EXACTLY where I had extracted it in the first place (0xE71).  However, when I ran the edited ROM, FCE Ultra (I use that and Mesen for beta testing) gave me a "Disc Trouble Err. 25" message.

What could I be doing wrong here?  o_O???

December 04, 2021, 08:18:34 pm - (Auto Merged - Double Posts are not allowed before 7 days.)
(https://i.imgur.com/0gFkNTc.png)(https://i.imgur.com/pabkaQT.png)
(https://i.imgur.com/KR9P3QU.png)(https://i.imgur.com/iEuBQJ6.png)

I think I made a breakthrough, but I'm not finished yet.  After more tinkering, I managed to adjust the offset by two (Inserting at 0xE81 instead of 0xE83.  The font could also be decompressed and extracted at 0xE83) and I managed to insert the English font into the ROM and it's running.  The problem is some of the sprites were changed as well... not how I had hoped it would work.  The last 16 sprites show numbers and letters instead of actual game sprites.  I'll have to fix that somehow.

At least, I managed to insert the English font, so that mission seems to be accomplished.  I just need to re-add the original sprites that were, somehow, changed inadvertantly. 
Title: Re: [Technical]Graphics Decompression for FDS Game (Dracula 2: Noroi no Fuuin)
Post by: Anime_World on December 06, 2021, 08:21:09 am
(https://i.imgur.com/0gFkNTc.png)(https://i.imgur.com/pabkaQT.png)
(https://i.imgur.com/KR9P3QU.png)(https://i.imgur.com/iEuBQJ6.png)

I think I made a breakthrough, but I'm not finished yet.  After more tinkering, I managed to adjust the offset by two (Inserting at 0xE81 instead of 0xE83.  The font could also be decompressed and extracted at 0xE83) and I managed to insert the English font into the ROM and it's running.  The problem is some of the sprites were changed as well... not how I had hoped it would work.  The last 16 sprites show numbers and letters instead of actual game sprites.  I'll have to fix that somehow.

At least, I managed to insert the English font, so that mission seems to be accomplished.  I just need to re-add the original sprites that were, somehow, changed inadvertantly.

Wrong chunk decompression....  ;)
Title: Re: [Technical]Graphics Decompression for FDS Game (Dracula 2: Noroi no Fuuin)
Post by: BlackPaladin on December 07, 2021, 12:25:16 am
Okay, got some good news and bad news...

Good news.  With some frankensteining my edited ROM and the unedited ROM, I managed to correct the sprites so that the "1324" in the previous screenshots now displays the correct sprites.  So I successfully inserted the English font into the game and have sprites fixed therein.  That's no longer an issue.

Now for the bad news...  :(

Changing the text in the ROM may be much harder than I thought.  If I change a byte of text, the ROM will loop the BIOS repeatedly and the game won't run.  (This happens in both my edited version of the ROM as well as the unedited one.  I checked.)

I can only imagine there's some sort of protection built inside that will prevent any text change in the game.  (Kinda like how the Seikima-II: Akuma no Gyakushuu game will fail if ONE byte is changed in the ROM.)

If I want to go any further with this, someone with some massive ASM wizardry will have to deactivate this type of protection in the ROM.  This is something that's beyond my meager ROM hacking skills at the moment.   

https://www.sendspace.com/file/3cagsy

This is what I have accomplished so far... three tables (two for Japanese, one Shift-JIS and one UTF8 encoding, and one in English) and an IPS patch file with the work I've done so far.  I don't know if someone will want to work on this instead of me.  Maybe, I'll acquire the skills to further hack the ROM in the future.  Right now, I'm just putting this possible project on the backburner for the time being.  At least, I accomplished my goal of changing the Japanese characters in the game to English, so that's a victory.

Anime_world, this wouldn't have been possible without your help.  Thank you so much!  I only wish I could go further with this right now.

P.S.:  The patch will work on a "Dracula II: Noroi no Fuuin" ROM with a header.  (131,016 bytes)
Title: Re: [Technical]Game Protection Deactivation for FDS Game (Dracula 2: Noroi no Fuuin)
Post by: Cyneprepou4uk on December 17, 2021, 01:30:48 pm
I've applied your patch, edited several bytes of text, and who would have thought it - didn't get stuck in a BIOS loop or whatever. Guess I am an ASM wizard  >:D

Spoiler:
(https://i.imgur.com/p3IsRwp.png)

(https://i.imgur.com/KnmjblK.png) (https://i.imgur.com/YMBxxBP.png)

(https://i.imgur.com/lpYKc5y.png)
Title: Re: [Technical]Game Protection Deactivation for FDS Game (Dracula 2: Noroi no Fuuin)
Post by: KingMike on December 18, 2021, 10:34:45 am
I know I at some point found the code in Love Soldier Nicol, but I'm sure other Konami games are doing the same thing:

the game checks the "main" program file and if something is changed, it has a JMP to the entry point of the FDS BIOS (thus effectively acting as a console reset).
So somewhere is going to be a JMP $EE24 instruction (4C 24 EE).
Would need to see how the checksum function is run to see how to properly make the game not run that code.
Title: Re: [Technical]Game Protection Deactivation for FDS Game (Dracula 2: Noroi no Fuuin)
Post by: BlackPaladin on December 21, 2021, 07:27:23 am
I may have been a bit presumptuous about the “BIOS Loop” problem I had reported.  Last night, I did a little more tinkering with the ROM because why the heck not?  In an earlier version of my edited ROM, I worked a little with the text and *GASP* the BIOS loop didn’t happen!
 
Yeah, this means somewhere I screwed up with the editing. 

This is why one should ALWAYS keep your ROM’s backed up we edit made, lol.

Now, I’m starting to look up control codes in the ROM.  So it looks like progress is starting again… albeit slowly.
Title: Re: [Technical]Game Protection Deactivation for FDS Game (Dracula 2: Noroi no Fuuin)
Post by: Brutapode89 on December 22, 2021, 07:18:56 pm
Ah? If not I already turned some Japanese letters into West letters.

https://www.romhacking.net/forum/index.php?topic=32620.0
Title: Re: [Technical]Game Protection Deactivation for FDS Game (Dracula 2: Noroi no Fuuin)
Post by: BlackPaladin on December 23, 2021, 12:03:27 am
Ah? If not I already turned some Japanese letters into West letters.

https://www.romhacking.net/forum/index.php?topic=32620.0

I remember seeing that topic some time ago but forgot about it.  In any case, I did manage to insert the English letters into the script, thanks to Anime_world's help and his tool.

For what it's worth, I do have this snapshot to share...

(https://i.imgur.com/tzXxuYb.png)

Looks like I can change the dialogue in-game after all!  I do, however, have to make sure it's all fits in the limited space available, though.  (In that line, it originally called it a "crystal", but it was too big to fit.  (I also thought of using "bauble" instead, but it also didn't fit.  That's why I went with "glass".)

However, there was one area that the "BIOS Loop" problem did trigger.  When I tried changing the text that appear supposed to display flipping and reinserting the disk...

(http://i.imgur.com/pabkaQT.png) (https://imgur.com/pabkaQT)

This for example...

If I changed the text there, the "BIOS Loop" would trigger.  (That text was in 0x3971 in the headered ROM.)

Looks like I might have a new project to play with, but unless that "BIOS Loop" problem gets sorted out, I can't say that it'll be completed on my own.  I may need help with that in the future...
Title: Re: [Technical]Game Protection Deactivation for FDS Game (Dracula 2: Noroi no Fuuin)
Post by: Cyneprepou4uk on December 29, 2021, 05:49:44 pm
This is a copyright calculation (or whatever the hell it is) routine.

(https://i.imgur.com/qSJgAnz.png)

Make sure BEQ at 7811 always branches to 781B, and you'll be fine. For example you can write 3 NOP's instead of JSR, which leaves Z = 1 after LDA 00. Or you can replace JSR with a JMP to 781B.
Title: Re: [Technical]Game Protection Deactivation for FDS Game (Dracula 2: Noroi no Fuuin)
Post by: DragonAtma on December 31, 2021, 10:49:11 pm
I'd go with orb, as "buy a glass" sounds like he's recommending a drinking cup .;)

Out of curiosity, is there any empty space (repeated 00s or FFs) nearby? If so, you may be able to sidestep the limited space by moving the dialog there and adjusting the pointers.
Title: Re: [Technical]Game Protection Deactivation for FDS Game (Dracula 2: Noroi no Fuuin)
Post by: BlackPaladin on January 02, 2022, 03:16:08 am
This is a copyright calculation (or whatever the hell it is) routine.

(https://i.imgur.com/qSJgAnz.png)

Make sure BEQ at 7811 always branches to 781B, and you'll be fine. For example you can write 3 NOP's instead of JSR, which leaves Z = 1 after LDA 00. Or you can replace JSR with a JMP to 781B.

(https://i.imgur.com/Mc8DuXn.png)

IT WORKED!!!

Thanks to your advice, I managed to bypass that accursed "BIOS Loop", and I can further edit the FDS ROM.  Now that this blockade is out of the way, the next step I'm still having trouble with is figuring out the FDS ROM's pointer system for dialogue.
Title: Re: [Technical]Game Protection Deactivation for FDS Game (Dracula 2: Noroi no Fuuin)
Post by: Brutapode89 on March 13, 2022, 11:44:30 pm
When the english translation will be finished, can I use it to translate in french?
Title: Re: [Technical]Game Protection Deactivation for FDS Game (Dracula 2: Noroi no Fuuin)
Post by: BlackPaladin on March 14, 2022, 08:35:13 am
When the english translation will be finished, can I use it to translate in french?

I don't know when that's going to be, but when it's finally available... then yes.  You can TL it to French from English.
Title: Re: [Technical]Game Protection Deactivation for FDS Game (Dracula 2: Noroi no Fuuin)
Post by: Brutapode89 on March 15, 2022, 02:14:42 pm
I don't know when that's going to be, but when it's finally available... then yes.  You can TL it to French from English.

Excuse me, I wanted say in fact "The day when the english translation will be finished" instead "When only". But thanks for permission ;D