ReaTsukuda / Exim

Basic tool for exporting and Etrian Odyssey text to JSON and importing it back from JSON.
MIT License
1 stars 2 forks source link

Underscore symbol makes EXIM unable to convert .json/.txt to .mbm #1

Open ShoukonTuskweather opened 2 years ago

ShoukonTuskweather commented 2 years ago

image This is part of the content from a .json file, freshly exported from an .mbm file.

When I try to import it as .mbm again, EXIM returns an error message, and I found out that the underscore symbol ("_") is responsible for the error. I tried to replace the half-width "_" with full-width "_", but then it seems the new .mbm no longer recognize "V_CHAR_190/EVENT/bir_221" as a path and a file name, and got turned into Shift-JIS code instead(?) Is there something I can do to get around it?

ReaTsukuda commented 2 years ago

This would be because I never fully implemented exporting EO5/EON JSON back to MBM, due to exactly this issue. I'll try to get to this soon, but the project breaks when I open it in Rider and I need to figure out what's going on there.

Apologies for the slow response, I was traveling until yesterday.

ShoukonTuskweather commented 2 years ago

Edit: Sorry for the closing and the reopening. I clicked it because I thought it would change to "Open" or maybe "Keep it open". Despite that, I am in no hurry, I think I have roundabout ways to handle the dialogue-changing things.


Don't worry, take your time. Travelling must be tiring.

.

I figured out a way to work around that by generating two more files: 1 is changing all to % and nothing else; 2 is changing all to % and make all the dialogue changes I want.

Then I compare the differences of pointer values (byte-length and starting byte of a "line") in the first half of these two new MBM files, then change those pointer values in the original MBM file. Then I overwrite the changed "text" in the original MBM file.

Even though changing _ to % makes EXIM regard the file name as ordinary text, thus affecting some of the pointers, the comparison still works for me.

.

But now I have encountered another problem.

image

The text is displayed properly when the sound file "V_CHAR_190/EVENT/bir_221" has even-number of bytes. But if it is an odd-number, like "V_CHAR_105/SYSTEM/REPORT2/gov_132" (33 bytes), Atlus seems to add a "00" (hex value) after the file name and before the [00 00] header to make its length even-numbered. The result is that there are three "00" (hex) before the dialogue text, and I guess your program took the first two "00" as a cue to interpret the next bytes as dialogue text, so the text becomes right-shifted by one byte, like: "00 82 6E 82 8E 82 83 82 85 81 40 82 81 82 87 82 81 82 89 82"   (gibberish text with weird headers) instead of: "82 6E 82 8E 82 83 82 85 81 40 82 81 82 87 82 81 82 89 82 8E"   (translates to "Once again")

I think I can still work around that, by changing the sound file from "gov_132" to "gov_1322" in the MBM. So, with only two "00" in between (instead of 3), EXIM should read the dialogue text properly. I can do the dialogue editing as usual, and then change the file name back to "gov_132" directly in the MBM.