ROM Hack Could someone write me a text editor...

WataruKun

Rom translator.
OP
Banned
Joined
Sep 12, 2009
Messages
616
Trophies
0
Website
Visit site
XP
130
Country
United States
azerty1 said:
WataruKun said:
DarthNemesis said:
Looks like this game uses file formats similar to Kimi no Yusha - the text is embedded into the event scripting, so there are no pointers, just line lengths. This makes writing an inserter a lot more complicated, since you have to be able to determine which parts of the file to interpret as text and which parts to ignore. You can either do that by figuring out all the other control codes in the file, or by applying some sort of pattern to identify text.

For example, this is the format of the control code to display text:
03xxFFyy[nntt]nntt
xx = speaker ID
yy = speaker mode
nn = length
tt = text
If y is 0 it uses the speaker's assigned name from CharaName.dat.
If y is 1 then before the length and text block there is an additional block with the length and replacement text to use for the speaker's name.
A text control code is usually followed by control codes 06 and 05, which respectively tell the game to wait for you to press the button and to wait for the text to finish drawing before continuing with the scene.

If you can identify the format of all the other control codes, or if you can come up with some other way to reliably locate those text control codes programmatically without missing any or finding false positives, I could adapt YushaTrans to work with it. Knowing the format of the other control codes would allow you to add or remove text boxes as necessary, though. The first two bytes of each script file indicate the total number of control codes for that file.
So basically make a list of what each control code does?

wait, didn't he say that he was getting black screens when he didn't rewrite pointers?
oh, heh...i personally find embedded codes easier to deal with since you can just corrupt them and it also makes the programming a bit easier. of course, it all depends on the game.
programming-wise, just loop through the entire program and if ever you land on a byte you recognize, do whatever is needed. Like, if index i is 0x03 and index i+2 is 0xFF, then you know that index i+4 is going to be the length, so read everything from i+4 to i+4+whatever###you just got. a lot depends on luck, though. if 03**FF is used for anything else, you're going to have a lot of garbage in your output...so...the best thing to do is get to know those file formats. some games i've hacked, i've been able to write ane extractor after looking through the hex for about 3 minutes, others i've had to sit there for 3 hours, screwing with stuff until it was happy...
from darth's' description, it sounds relatively simple compared to other games i've seen, so maybe you might want to take this opportunity and try out coding your own extractor, to learn.
The problem is that I've got no coding knowledge and the other problem is, is that I'm looking for a program to edit text, that can manually change the string length byte, not an extractor. And it's actually NOT incorrect pointers that gives me the black screens but, incorrect string length bytes.

For instance if the string length byte is 2A and the length from the string length byte to the end of the screen is not 2A, then it will screw up the whole file.
 

WataruKun

Rom translator.
OP
Banned
Joined
Sep 12, 2009
Messages
616
Trophies
0
Website
Visit site
XP
130
Country
United States
Anyone DarthNemesis here's some information I found out about the control codes...

QUOTE said:
Control Code Information:
0301FF00= A code which is used before Akuji speaks. This code is always followed by a 1 byte string length thing, which is always followed by the text.

So this might be used like...

0301FF00-0B-Blah, blah

[ControlCode][StringLengthCalculator][Message]

6200004C = Hai hai sound that Akuji makes.
6200001C = Uh... sound that Akuji makes.
6200001E = "Taku" sound Akuji makes.
62000050 = Relieved sound Akuji makes.

I even went further to see if I could find the control codes for one of Clau's voice effect thingies...

62001326 = A sound she makes when surprised.

So we can confidently assume that "6200" loads up a voice effect. We can further conclude that the following two bytes, tell the game what voice effect to play.

So we can conclude that the 4 bytes that come before the bytes that you tell who's talking, are control codes that tell the game what voice to play. If the game doesn't play a voice, you'll simply see a control code telling you who's talking, so to break it down...

6200001E0301FF002A
[VoiceEffect][AkujiTalking][StringLengthDataByte]

So yeah.

0316FF0106= A code that's used before an unknown character "???" speaks. This code will be followed by the name "???". After that there will be the 1 byte string length data thing. Then after that, you'll find the text. It can also be used on the rare occassion that a name is actually displayed in the script.

61010564016301 = A sound that's made when he picks up the phone.

61010664016301 = A sound that's made when he hangs up the phone.

041E = Turns off the message box.

2000460047000000481F14000414000000= Not sure what each individual part of the code does, but this code seems to make the screen and have no text box.

0300FF00 = A code that's used when nobody is talking, just to display a message.

870013010A = Displays one of Clau's portraits.

0316FF00 = A message used before Clau talks.

Now to break down this code that happens before someone talks it goes sort of like this 03xxFF00

03 = Probably just a code so that the game knows a name is about to be displayed.

xx = The position of that persons name in the character name file.

FF00 = Not really sure.

0604 = Used to end a line without the user needing to press a button.

000000 = Possibly divides different codes.

3A0302030414= Used to display 3 text boxes in the 1st script file. This will not always be the same, but it tells you that atleast 6 bytes will come before the text that happens when you make choices.

I could tell you each specific control code but that would probably take days to gather info on. This gives you a basic idea of how much space the control codes take up.
 

azerty1

Well-Known Member
Member
Joined
Mar 22, 2009
Messages
160
Trophies
0
Age
29
Website
Visit site
XP
99
Country
Canada
WataruKun said:
azerty1 said:
WataruKun said:
DarthNemesis said:
Looks like this game uses file formats similar to Kimi no Yusha - the text is embedded into the event scripting, so there are no pointers, just line lengths. This makes writing an inserter a lot more complicated, since you have to be able to determine which parts of the file to interpret as text and which parts to ignore. You can either do that by figuring out all the other control codes in the file, or by applying some sort of pattern to identify text.

For example, this is the format of the control code to display text:
03xxFFyy[nntt]nntt
xx = speaker ID
yy = speaker mode
nn = length
tt = text
If y is 0 it uses the speaker's assigned name from CharaName.dat.
If y is 1 then before the length and text block there is an additional block with the length and replacement text to use for the speaker's name.
A text control code is usually followed by control codes 06 and 05, which respectively tell the game to wait for you to press the button and to wait for the text to finish drawing before continuing with the scene.

If you can identify the format of all the other control codes, or if you can come up with some other way to reliably locate those text control codes programmatically without missing any or finding false positives, I could adapt YushaTrans to work with it. Knowing the format of the other control codes would allow you to add or remove text boxes as necessary, though. The first two bytes of each script file indicate the total number of control codes for that file.
So basically make a list of what each control code does?

wait, didn't he say that he was getting black screens when he didn't rewrite pointers?
oh, heh...i personally find embedded codes easier to deal with since you can just corrupt them and it also makes the programming a bit easier. of course, it all depends on the game.
programming-wise, just loop through the entire program and if ever you land on a byte you recognize, do whatever is needed. Like, if index i is 0x03 and index i+2 is 0xFF, then you know that index i+4 is going to be the length, so read everything from i+4 to i+4+whatever###you just got. a lot depends on luck, though. if 03**FF is used for anything else, you're going to have a lot of garbage in your output...so...the best thing to do is get to know those file formats. some games i've hacked, i've been able to write ane extractor after looking through the hex for about 3 minutes, others i've had to sit there for 3 hours, screwing with stuff until it was happy...
from darth's' description, it sounds relatively simple compared to other games i've seen, so maybe you might want to take this opportunity and try out coding your own extractor, to learn.
The problem is that I've got no coding knowledge and the other problem is, is that I'm looking for a program to edit text, that can manually change the string length byte, not an extractor. And it's actually NOT incorrect pointers that gives me the black screens but, incorrect string length bytes.

For instance if the string length byte is 2A and the length from the string length byte to the end of the screen is not 2A, then it will screw up the whole file.
the point of an extractor is to pull all the text into an easy to edit file (like a .txt) and then take the edited text and shove it back into the rom automatically without having to do anything manually. in other words, an inserter would recalculate the string length and replace the old one with the new one automatically.
A text editor would be exactly the same thing as an extractor and inserter except for the fact that it would have its own Notepad, which is really useless...

regardless, the control codes you found should be more than enough for DarthNemesis to adapt his YushaTrans to it. what you have can probably reliably find the text. since you've got the picture display figured out and the string-length figured out, that should probably enough (I've made do with less), but you should also take a look at the end of a textbox and see if htere's anything there. sometimes there's like a 00 and a 50 to show that you have to press the A button to continue, which is fairly important.
 

DarthNemesis

Well-Known Member
Member
Joined
Feb 19, 2008
Messages
1,210
Trophies
0
XP
260
Country
United States
WataruKun said:
I could tell you each specific control code but that would probably take days to gather info on.
Yes, yes it would. That's what I did for Kimi no Yuusha, so anything less than all the control codes would require a completely different approach.
 

WataruKun

Rom translator.
OP
Banned
Joined
Sep 12, 2009
Messages
616
Trophies
0
Website
Visit site
XP
130
Country
United States
DarthNemesis said:
WataruKun said:
I could tell you each specific control code but that would probably take days to gather info on.
Yes, yes it would. That's what I did for Kimi no Yuusha, so anything less than all the control codes would require a completely different approach.
Well I can get control codes for the menus and stuff. Is that what you mean?

And also are control codes for EVERY character and EVERY sound necessary? Since they all follow the same format(For instance, all voice codes are the same length and all name codes are the same length)?
 

azerty1

Well-Known Member
Member
Joined
Mar 22, 2009
Messages
160
Trophies
0
Age
29
Website
Visit site
XP
99
Country
Canada
DarthNemesis said:
WataruKun said:
I could tell you each specific control code but that would probably take days to gather info on.
Yes, yes it would. That's what I did for Kimi no Yuusha, so anything less than all the control codes would require a completely different approach.
really? how different is your Yushatrans from your SummonTrans? The latter just seemed to have about 5 or 6 control codes in there and it just skipped a few bytes every time it hit one of the unimportant ones.
 

DarthNemesis

Well-Known Member
Member
Joined
Feb 19, 2008
Messages
1,210
Trophies
0
XP
260
Country
United States
azerty1 said:
really? how different is your Yushatrans from your SummonTrans? The latter just seemed to have about 5 or 6 control codes in there and it just skipped a few bytes every time it hit one of the unimportant ones.
No, Summon Night had about 35 different control codes and I had to identify all of their lengths for it as well.
 

WataruKun

Rom translator.
OP
Banned
Joined
Sep 12, 2009
Messages
616
Trophies
0
Website
Visit site
XP
130
Country
United States
I think a big problem with the control codes thing is sometimes there are big gaps, that seperate 1 scene from the other. I think it might work better if I gave you the start and end offsets for each scene. What might also work is the editor detecting the string length byte somehow, which is infront of every piece of text.

But yeah, there are huge gaps in the text when the game switches from one scene to another and there really doesn't seem to be any consistancy in how long these gaps are.

Other than those gaps, I pretty much know all the control code formats.

I'm talking of course about these...

gap.jpg


They're used when transitioning from one scene to another.
 

azerty1

Well-Known Member
Member
Joined
Mar 22, 2009
Messages
160
Trophies
0
Age
29
Website
Visit site
XP
99
Country
Canada
WataruKun said:
I think a big problem with the control codes thing is sometimes there are big gaps, that seperate 1 scene from the other. I think it might work better if I gave you the start and end offsets for each scene. What might also work is the editor detecting the string length byte somehow, which is infront of every piece of text.

But yeah, there are huge gaps in the text when the game switches from one scene to another and there really doesn't seem to be any consistancy in how long these gaps are.

Other than those gaps, I pretty much know all the control code formats.

I'm talking of course about these...

gap.jpg


They're used when transitioning from one scene to another.
can't you just be lazy and just look for nothing but the text? you can just search for nothing but the 03xxFF that precedes the text, and keep track of the indices at where that occurs. As long as there aren't any other instances of 03xxFF, you should be fine. You won't even need to care about scene gap thingies...
that is, of course, if you're able to translate the text in a one textbox to one textbox ratio...
if it's just the scene changes that are annoying you, look at the very first one, right after the headers and there should probably be some scene initialization command.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    K3Nv2 @ K3Nv2: https://www.ebay.com/itm/386617469929?mkcid=16&mkevt=1&mkrid=711-127632-2357-0&ssspo=2T8UwYf_Qse&...