Hacking Nayuta no Kiseki - English Translation

Diag

Well-Known Member
Member
Joined
Feb 25, 2014
Messages
149
Trophies
0
Age
38
XP
316
Country
Gambia, The
i just asked how many chapters not for a walktrough, but yeah, thanks.. i guess.. you seem to be a really nice guy :mthr:
 

Blackiris.

Active Member
Newcomer
Joined
Nov 26, 2014
Messages
44
Trophies
0
Age
31
XP
237
Country
Gambia, The
Looks promising so far, I'm happy that someone finally decided to do Nayuta, and it seems you've made some really decent progress so far. Kudos to you, sir!

I'll be watching this project. I hope you'll be progressing steadily. I can't be much of a help now, but I'll make sure to report errors or possible bugs once I decide to play it.
 

flame1234

Well-Known Member
OP
Member
Joined
May 17, 2009
Messages
734
Trophies
0
XP
957
Country
United States
Excel VBA code (that nobody asked for).
It takes a .xlsx file as exported from google spreadsheets and saves each sheet as tab-separated values (.txt extension).
Useful for going between google sheets documents (where you have lots of sheets) and game code.
Code:
Sub MySub2()
    Application.DisplayAlerts = False
    filenamebase = "C:\Users\w8jcd_000\Documents\Nayuta\USRDIR\script\"
    For Each Sheet In ActiveWorkbook.Worksheets
        Sheet.Activate
        myfilename = filenamebase + Sheet.Name + ".txt"
        ActiveWorkbook.SaveAs Filename:=myfilename, _
            FileFormat:=xlUnicodeText, CreateBackup:=False
 
    Next
    Application.DisplayAlerts = True
 
End Sub

Changes:
fileformat now UnicodeText. Text won't work for my purposes.
application.displayalerts commands make it not annoy you.

Okay, that's great, but Excel won't save in SHIFT-JIS.
Python program to make things work:
Code:
import os
 
def get_data(filename):
    totalbytes = os.path.getsize(filename)
    infile = open(filename, 'rb')
    totalfiledata = infile.read(totalbytes)
    infile.close()
    return totalfiledata
 
mypath = os.path.dirname(os.path.realpath(__file__)) #path of this python file
files = [ f for f in os.listdir(mypath) if \
          os.path.isfile(os.path.join(mypath,f)) ]
 
for myfile in files:
    if os.path.splitext(myfile)[1] == '.txt':
        filedata = get_data(myfile)
        filedata = filedata[2:].decode('utf_16_le') #first 2 bytes are an Excel flag
        outfile = open(os.path.splitext(myfile)[0],'wb')
        outfile.write(filedata.encode('cp932'))
        outfile.close()
---------------
Okay, that above code doesn't work because Excel is a jerk.
Here's some working Excel code, no need for a python program.
Code:
Sub WriteTSV()
Const strPathBaseName As String = "C:\Users\w8jcd_000\Documents\Nayuta\USRDIR\script\"
Dim filename As String
Const adTypeText = 2
Const adSaveCreateOverWrite = 2
Dim BinaryStream
Dim myObj As Variant
 
For Each myObj In ActiveWorkbook.Worksheets
    Set BinaryStream = CreateObject("ADODB.Stream")
    BinaryStream.Charset = "shift-jis"
    BinaryStream.Type = adTypeText
    myObj.Activate
    Set wkb = ActiveWorkbook.ActiveSheet
    If wkb.Name = "Noi_orig" Then
        filename = strPathBaseName + "noi.data"
    Else
        filename = strPathBaseName + "mp_" + wkb.Name + ".data"
    End If
    BinaryStream.Open
 
    For r = 1 To wkb.UsedRange.Rows.Count
        s = ""
        For c = 1 To wkb.UsedRange.Columns.Count
            s = s & wkb.Cells(r, c).Value & Chr(9)
        Next c
        BinaryStream.WriteText s, 1
    Next r
 
    BinaryStream.SaveToFile filename, adSaveCreateOverWrite
    BinaryStream.Close
    Set BinaryStream = Nothing
Next
 
End Sub
Script Dump v1.4
Script Insert v1.2 <- Bulk version
Script Insert v1.2 <- Individual version
 

flame1234

Well-Known Member
OP
Member
Joined
May 17, 2009
Messages
734
Trophies
0
XP
957
Country
United States
Patch 3
Still a ways to go I think.
Museum sub-areas are not translated. Every other string in the whole script has a translation.
I'll look into:
Faster text display speed.
Translation for quests, stage names, goal descriptions, character names.

Hacking help needed for:
Faster text display speed.
Translation for quests, stage names, goal descriptions, character names.

I could also use some help with editing. If you download and try it, you'll see that help is needed in this area.
Also, please submit your bug reports.

I hope you will enjoy this patch. :)
 

GHANMI

Well-Known Member
Member
Joined
Jun 10, 2012
Messages
969
Trophies
0
XP
914
Country
Patch 3
Still a ways to go I think.
Museum sub-areas are not translated. Every other string in the whole script has a translation.
I'll look into:
Faster text display speed.
Translation for quests, stage names, goal descriptions, character names.
...

I hope you will enjoy this patch. :)


Really thanks a lot for your efforts flame1234!
With my reading comprehension skills, I thought the bolded meant you already did EVERYTHING in the game (story text and quests and all - this game has quite the substantial plot after all) and I almost couldn't take the joy overload. Thanks a lot for this new year gift (and happy awesome lucky new year to you btw).

Your dedication with this is admirable, but about the text speed, didn't Falcom already add a separate button that makes the text appear instantly (and fast-forward cutscenes if the button is held). With how much text there is in the game, I assume most will just use the skip feature. It might also conflict with voice acting synch.
Voice acted segments might be the ones using control codes for text speed.
I'm sure the NPC names are graphics here (like location names but that's a given). Did you have some degree of success looking inside of itp archives in this game?
 

flame1234

Well-Known Member
OP
Member
Joined
May 17, 2009
Messages
734
Trophies
0
XP
957
Country
United States
Actually, please just hang on. For the next patch, which will be just a couple hours:
1) Fix a problem with extra (unneeded) quotation marks in eboot and item strings. Darn MS Excel XD
2) Fix some strings in Chapter 8 (after story)

All of the quest "main text," which is in the script files, is translated.
Not translated related to quests:
1) Post box messages.
2) Quest screen text (under SYSTEM in the menus).
For players that would like to use this patch, I recommend talking to the quest giver with square again. That will usually give you a hint.
If you still have a question, ask here within spoiler tag and I'll do my best to answer.

Unfortunately, there is no good FAQ available for this game.
If you have a question about proceeding through the main story, push SELECT to see the sub-menu. The "comment" there should provide a clue as to what's needed to proceed with the main story.
If you still have a question, post within spoiler tag and I'll do my best to answer.
---------------

Re: Gameplay-related questions:
These are not really hacking-related, or related to this project in any way. Is it OK to make a new thread within "PSP/Games and Content" for this type of question?

I would say for now just PM me (no need for spoiler tags), and if there are a bunch of questions from players, I'll make a thread there.
----------------
Patch 3.01 <- Here's the patch with those revisions

If anyone cares:
In Nayuta no Kiseki there are:
15,579 opcodes with text in them
29,862 lines with text in them
-Name lines are not counted
-Blank lines are not counted
361,549 characters (assumes two bytes per character)

By comparison, there are around 105,000 lines in Zero no Kiseki, so it's around 3.5 times as big as this.
 

flame1234

Well-Known Member
OP
Member
Joined
May 17, 2009
Messages
734
Trophies
0
XP
957
Country
United States
I am on my phone so it's hard but:
I'm having a problem where Google sheets is deleting my trailing spaces on export.
A solution I can think of is to replace spaces with another character, then convert back in Excel.
Are there better solutions?
 
D

Deleted User

Guest
Hi flame can you copy it to notepad++ and use the search and replace function?
 

flame1234

Well-Known Member
OP
Member
Joined
May 17, 2009
Messages
734
Trophies
0
XP
957
Country
United States
I have 150 sheets and want to do a batch job.

Google Apps Script Code:
First function:
Converts the active sheet to a .tsv file and saves it to your Google Drive under name "active sheet name + .tsv"

Second function:
Makes a folder in your Google Drive with the name of the active spreadsheet.
Then, for each sheet in the active spreadsheet, converts it to .tsv and saves it to your Google Drive under that folder under name "active sheet name + .tsv"
Code:
Code:
function ConvertToTSV(sheet) {
  var ws = sheet.getDataRange();
  try {
    var data = ws.getValues();
    // Loop through the data in the range and build a string with the TSV data
    var csv = "";
    for (var row = 0; row < data.length; row++) {
      // Join each row's columns
      // Add a carriage return to end of each row
      csv += data[row].join("\t") + "\r\n";
    }
    return csv;
  }
  catch(err) {
    Logger.log(err);
    Browser.msgBox(err);
  }
}
 
function BulkTSVExport() {
  var myFolder = DriveApp.createFolder(SpreadsheetApp.getActiveSpreadsheet().getName());
  var sheets = SpreadsheetApp.getActiveSpreadsheet().getSheets();
  for (var i = 0; i < sheets.length; i++) {
      var csv = ConvertToTSV(sheets[i]);
      myFolder.createFile(sheets[i].getName() + ".tsv", csv);
      }
 
}
 
function TSVExport() {
  var sheet = SpreadsheetApp.getActiveSheet();
  var csv = ConvertToTSV(sheet);
  DriveApp.createFile(sheet.getName() + ".tsv", csv);
}
 
function onOpen() {
  var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
  var entries = [
    {name : "Export Current Sheet to TSV", functionName : "TSVExport"},
    {name : "Export All Sheets to TSV", functionName : "BulkTSVExport"}
  ];
  spreadsheet.addMenu("TSV", entries);
}
 

Tobas

Well-Known Member
Newcomer
Joined
Jun 19, 2007
Messages
56
Trophies
1
XP
445
Country
United States
I am so impressed by this translation. You guys are amazing, I wish everyone who knew how to do cool things like this was this awesome and friendly. I wish there was something I could do to help out. much respect.
 

flame1234

Well-Known Member
OP
Member
Joined
May 17, 2009
Messages
734
Trophies
0
XP
957
Country
United States
None that I'm currently aware of :)

I mean, it should be able to run from start to finish.

Still need help with hacking of the remaining text, that is in compressed files:
-Quest postbox
-Quest menu
-Dialogue bubble names
-Level names
-Level objectives

Someone by the name of SkyWelse offered their assistance with editing images, so those will be coming in a future patch. Not really necessary to enjoy the game, IMO.

I was having trouble keeping the filelist (from UMDgen) and data.lst in \USRDIR aligned. And the game won't work if they're not :(
I wrote a program that compares the files and makes sure they match. I found the mp_0115 (museum) problem as well as two others when I ran it. So I fixed those manually in data.lst to match up with the filelist, inserted, checked (only the museum) to make sure it worked, then xdelta'd and posted a patch. Sorry if that last sentence was a bit long :)
 
  • Like
Reactions: GHANMI

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    Xdqwerty @ Xdqwerty: @SylverReZ, @Psionic Roshambo sorry but im not that used to listening to non game music +1