VALKYRIE NO DENSETSU TRANSLATION

Introduction & small repair log

Valkyrie no Densetsu is a game that I love. I played it a lot but unfortunately my PCB had some strange sound issues. For example the bass line in stage 3 was garbled and some notes were missing in the stage 4 melody.

One day I decide that it’s time to try to repair that !

Those bugs are so specific that I suspect a data corruption in the sound rom. I dump it, compare it with Mame and indeed it is faulty!

I burn a new rom with good data and my PCB is fixed!

I play it a bit and I realize it would be great to do the adaptor to have the sound in stereo. The connector is hard to find nowadays but luckily I have one. Some weldings later and I discover that the stereo outputs aren’t amplified. I don’t have any amplifier in my cabinets, so I try to do the earphones connector. Yes, Namco System 1 and 2 had stereo outputs for speakers but also for earphones !

This time it’s perfect, the sound is amplified. I use a small PC speakers to adjust the volume and I finally enjoy the game with maximal audio quality! Then, after a few hours of gameplay I realize something : despite that I understand Japanese I never took the time to translate the story… and also that people who don’t understand this language can’t fully enjoy the game. What a shame! I remember to have seen guys doing some hacks on Mame to put old games in freeplay mode. I don’t have any knowledge in this but it’s ok, the challenge is accepted: let’s try to translate the game!


A hard start

I find some tutorials about Mame’s hacking, but there aren’t that much to be honest. I lunch the game with the debugger tool and I start to search for English texts in order to understand how it’s programmed. I try to find the text « PLEASE PRESS ONLY 1P BUTTON » that is displayed after inserting a credit. But I can’y find anything with the search function « find ». (find 0x0, 0x10000,PLEASE” )

I’m intrigued and I look at the source code with the debugger. The code doesn’t match with the code in the game’s roms… I’m completely lost. I decide to continue without the debugger and I search directly into the roms files for a while. Thanks to a script found on internet I finally find the text! It’s in the main program 1 rom (MPR1), the characters are encoded in hexadecimal on one byte (from 00 to FF). Here I make the word « PLEASE » disappear by putting some FF instead.

That’s a good start but I still don’t know to search texts in Japanese… until I discover that there is a way to see the sprites and tiles on Mame with the key F4!

We can see all the characters used and luckily the Latin alphabet correspond exactly to ASCII code in hexa! Which means that I might have found my Rosetta stone for Japanese! I try to search in the code for the first word in the game : « SHIAWASE ». According to the table it should be BC B1 DC BE. I search for that in the MPR1 rom and I have a match. I modify it with the word « TEST » in ASCII, I reboot the game and bingo!

I can start to translate the texts by substituting Japanese letters with English ones. The line break is done with the byte 0D, and the bubble separator is 0D FF. That’s not too complicated. But I encounter my first problem: I can’t put more letters than there were because all the texts are concatenated together and I can’t move the bubble separators… The translation task is getting hard because it generally requires more letters in English than Japanese to say something. I have no other choice than cutting some texts and making arrangements in order to keep the main meaning.

Everything is going well until I meet the first words using the second Japanese alphabet: the katakanas.

The result is completely wrong! I notice that the katakanas are further than a single byte (from 100 to 13F), so there is an offset somewhere but how does it work?

The characters bytes are following themselves without any space, how can I put an offset? I can’t find any answer and I end up using a dirty method: I replace in memory the katakanas tiles with Latin alphabet ones. Those tiles are in the rom CHAR0, I copy the letters from 40 to 7F and I paste them between 100 and 13F.

Thanks to that I’m able to continue the translation but the problem is huge:

– I have to modify one more rom (CHAR0),
– The news letters don’t match with ASCII code,
– I can’t use a line break where a katakana is.

Waiting to find a better solution I keep up with this method. I get to the end of the first level and a new type of text appears: horizontal one and on black background.

Those texts are managed the same way as the bubble’s ones. But some tags change: line breaks are FF 05 1D, and the beginning of a sentence is FF 0x 05 1B (x is the number of line from what I understood). That’s more complicated and I can’t move the line breaks without creating display issues! I have to let them where they are and that’s a new obstacle for my translation.

The worst thing is probably the fact that I can’t use the save states to go back quickly somewhere to see the result. The save states keep the ram’s states of course but also the main program ! I don’t know  why  but a have to restart and play from the beginning every time I modify something. That’s tough but I manage to fully translate the game.

I’m both happy and sad with this first version. I had to do dirty things and I would need more spaces for letters to put the best translation.


The true V1.0

A bit later, I meet Neocps1 during an arcade meeting. He knows a lot of things about hacking and I tell him my problems. He gives me a simple but wonderful solution: there is often some unused spaces in rom’s memory, I can put my new texts there without worrying about letter’s limitation. Then I have to find the address table that contains all the text’s address and change them to redirect to the new ones !

I run again the debugger tools to find this table. I don’t know if it is thanks to the small break but I quickly understand my mistakes. I thought that the codes of the two roms (MPR0 and MPR1) were put one behind the other. But in fact they are nested byte by byte. The instructions in the debugger make finally sense to me!

Now I can understand how katakanas work: for each byte that I modify in MPR1 to put a new letter, there is also another byte linked in MPR0 that is set to 00 most of the time and to 01 in katakana’s case. There is the offset that I was looking for. I just need to modify it to have a cleaner code and to avoid altering the CHAR0 rom.

I find two big unused spaces in the code that allow me to put all the texts. All I need now is to find the address table…

For that I use a breakpoint to stop Mame when the first letter of the first bubble is accessed by the program (wp 0x32A54,1,r). It gives me the address of the instruction that fetch this letter (0x0246FC). Then I use the trace function to export in a file all the CPU instructions in order and in readable format (trace >>instruction.tr). I use it along with a breakpoint to stop Mame to the instruction previously found (bp 0x0246FC). Now I have the code that is executed just before the first letter is displayed.

I just need to search into these instructions to find the address table. Unfortunately I don’t know anything about 68000 programming… so I use brekpoints again to go back line by line. By looking at the values in the registers I finally get what I want! The register A1 that had the address of the first letter changes here for the table’s address, which is 0x0325B8.

I now have all the ingredients to do a true decent V1.0. But rather than coding again directly into the rom’s codes, I think it’s time to go for the best: creating  a script that will modify the code for me. It requires more work at the beginning but once it’s done the maintenance is super easy and I will be able to share it since it’s just a patch!

So I start learning the Python that seems to be the best choice for this work. I have to admit it was not easy but the result was worth the effort, I’m really satisfied with this version !

The translations are better and anybody can easily change the texts if he wants to. I put some validation process to avoid any overflow.

At last, if you have an eprom burner you can enjoy this translated version on your PCB ! There are just two eproms to replace, all the instructions are in the readme file.

There it is, I hope you will enjoy this great game finally understandable to everyone !

Get the script here:

Valkyrie_to_english


Bonus stage : some discoveries into the code!

While digging into the code, I found some interesting stuff. There are for example some conversations that were not implemented in the final version of the game:

The goddess :

どうか、あなたの
ちからで
ひとびとを
すくってください

Please save the people with your strength (at 0x032AEE)

It’s a slightly different version of the goddess second bubble at the beginning. In the game she asks you to save the world (not the people)

The mammoth :

さっさっといくがよい。

Go now/quickly (at 0x01F00C)

Looking at its position in the code, it’s probably a sentence said after the player failed the mind test (just after « Terrible! Only a miracle can save us »). I don’t know why it has been removed.

ここでさんびきの
かいぶつと
たたかって
ちからをみせてもらおう!

Fight here against those three monsters and show me your strength! (at 0x033D46)

It must be said when entering the strength test room. But the enemies number has been updated since then!

よくここまできた。しかし きょうは
ここまでで おわりじゃ!
またつぎのきかいにあおう!
さらばじゃ!

Well done. But that’s all for today! We’ll meet again! Bye! (at 0x033CCE)

Once the enemies of the strength room defeated, the mammoth could have said that.

The merchant :

まいど
ありがとう
ございました。

Thank you very much (at 0x0336F4)

The merchant was supposed to thank us after each purchase! But I think it was too long.

なんでも
あく かぎ だよ

This key opens everything (at 0x033888)

The two only locked doors are in the castle’s dungeon. The key is in a chest nearby but maybe the developers originally wanted us to buy it…

やみよをてらす
ランプ
つかえるかもよ?

Maybe you can use a lamp to light the darkness? (at 0x0337F0)

Oh! An interesting item that indicates there was an area in the dark! I think that the best place is in the swamp at the end of stage 5. The game is going a bit darker there and I imagine Namco making a reference to The Tower of Druaga with a labyrinth int the dark. And there is a merchant just before…

スピ-ドアップする
スーパーシューズ
やすく しとくぜ

I’ll sell you those speed boost Super Shoes for a good price (at 0x033984)

That’s crazy! High speed boots  were planned ! I don’t know why they never got to the final version by I would love to try them 🙂

Finally, thanks to the tool showing the sprites I found some other cool things:

There are a lot of unused character’s animations. But the most noteworthy one is Quarkman who has some fight’s animations! Was he supposed to attack us? To help us?

We can also see those characters that say ougon no tane (The Gold Seed). There are not well colored because some sprites are colored just before being displayed. But looking at those detailed letters, I wonder if it was not supposed to be the game subtitle ? (Valkyrie no Densetsu – Ougon no Tane)

And I also found the sprites of the key, the lamp and the boots that the merchant could have sold. There is also an unused weapon, it looks like the boomerang used by some enemies.

Alright, that’s all I found. If someone more skilled could see if it’s possible to activate the speed boots I would be super happy! I so want to see what it could have been with them…

A.M. aka A-M

Leave a Reply