Jump to content

i need help with repacking the scrip for tsuyokiss full edition


midanlaw

Recommended Posts

im trying to attempt  translating the vn, but i have 0 knowledge on any technical/programing stuff. thanks to a few 4chan anons, i learned to extract and repack the files using betterfpk.exe, but upon repacking the files the vn crashes even while not editing any files. acording to said anons, this is a problem, so i want to know if there are other tools, or any info on how to make this work.  

tsuyokiss runs on system-c by the way.

any help would be apreciated

Link to comment
Share on other sites

  • 3 weeks later...
import os
import struct
import sys

def calc_hash(name):
  name=name.upper().encode('utf-8')
  h=0
  for i in range(len(name)):
    h=(h+name[i]*(i+1))&0xffff
  return h

def pack(folder, output):
  files = os.listdir(folder)
  files.sort(key=calc_hash)
  fs= open(output, 'wb')
  fs.write((len(files)|0x80000000).to_bytes(4,'little'))
  idx = bytearray()
  off = 4
  for f in files:
    ff=open(os.path.join(folder,f),'rb')
    stm = ff.read()
    fs.write(stm)
    ff.close()
    idx+=struct.pack('II24sI', off, len(stm), f.encode('utf-8'), calc_hash(f))
    off+=len(stm)
  fs.write(idx)
  fs.write((0).to_bytes(4,'little'))
  fs.write(off.to_bytes(4, 'little'))
  fs.close()

pack(sys.argv[1],
  sys.argv[2])

Usage: python pak.py input_folder output_fpk

image.png?ex=656d5bc5&is=655ae6c5&hm=f33

Link to comment
Share on other sites

13 hours ago, Sisulizer said:
import os
import struct
import sys

def calc_hash(name):
  name=name.upper().encode('utf-8')
  h=0
  for i in range(len(name)):
    h=(h+name[i]*(i+1))&0xffff
  return h

def pack(folder, output):
  files = os.listdir(folder)
  files.sort(key=calc_hash)
  fs= open(output, 'wb')
  fs.write((len(files)|0x80000000).to_bytes(4,'little'))
  idx = bytearray()
  off = 4
  for f in files:
    ff=open(os.path.join(folder,f),'rb')
    stm = ff.read()
    fs.write(stm)
    ff.close()
    idx+=struct.pack('II24sI', off, len(stm), f.encode('utf-8'), calc_hash(f))
    off+=len(stm)
  fs.write(idx)
  fs.write((0).to_bytes(4,'little'))
  fs.write(off.to_bytes(4, 'little'))
  fs.close()

pack(sys.argv[1],
  sys.argv[2])

Usage: python pak.py input_folder output_fpk

image.png?ex=656d5bc5&is=655ae6c5&hm=f33

thanks, it looks like this is the way to go, i need to find out how does this work tho

Link to comment
Share on other sites

4 hours ago, midanlaw said:

thanks, it looks like this is the way to go, i need to find out how does this work tho

forget it, thank to the 4chan anon i made it work, thank you for your help, i hope i can get this project moving

Edited by midanlaw
typo
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...