YunyunsFriends / Konosuba-JGG-ENG-TL

English translation project for Kono Subarashii Sekai ni Shukufuku o! -Kono Yokubukai Game ni Shinpan o!-
https://discord.gg/X2MWMUzWJ5
13 stars 0 forks source link

Could you share font modification process? #2

Closed nikvoid closed 1 year ago

nikvoid commented 1 year ago

Hello, could you please share how you modified the game font? I'm very interested in this cause cyrillic symbols are just fucked. Also I'm glad to see that someone made use of my debugger) You could also see my fork of Squirrel Decompiler, if you haven't done so already.

Shaggythecat commented 1 year ago

Heya, I modified the font by extracting the font psbs from font_body and font_info using FreeMote. Then I used FreeMote to decompile the individual fonts, the font itself is a bitmap is a texture and I fixed the cutoff letters in photoshop but it doesn't look the the cyrillic letters are cut off at all in the texture. image I'm not at all familiar with the cyrillic alphabet/symbols, but it looks like the spacing with letters is pretty bad. If you open textfont##.psb.json that was made by FreeMote you can edit the values for placement and the location of the letter on the texture. image As an example this is what "Λ" will look like in textfont52.json I'm not sure what a b d h and id are for, but x and y are coordinates for where a character is on the texture and width and height are what portion of the texture is going to be displayed in game as the specified character. w is the space the character will take up between other characters so if you lower that number the letters will get closer together.

Also I'm glad to see that someone made use of my debugger

Thanks you for making it. It's been pretty useful so far, but I'm probably only scratching the surface on what it can be used for.

You could also see my fork of Squirrel Decompiler, if you haven't done so already.

Yeah I used NutCracker to decomp the Squirrel scripts in script_body that I needed to make edits to.

nikvoid commented 1 year ago

Thanks, I'll try that with cyrillic letters later.

I'm not sure what a b d h for

Probably ascender, baseline, descender, and height of rendered letter image

Thanks you for making it. It's been pretty useful so far, but I'm probably only scratching the surface on what it can be used for.

I originally planned to use it to play with fonts and script format, but it was too fun and I've eventually forgotten that plans... The most recent feature is that you can add decompiled scripts as sources and examine step-by-step execution with a view into the code.

Also I tried to recompile scripts back and so I have following results, if you're interested: Script recompilation state

state module note note
ok action
ok application
ok baselayer
ok basepicture
ok basiclayer
ok basicpicture
ok basicrender
ok basictext
ok confirmdialog
ok debug might need fixes
ok dmmauth DRM check located here
ok doublepicture
ok envenv
bad envplayer cannot load game window stuck
ok envsystem
bad exception cannot skip intro?(no) game crash right after it
ok fontinfo
ok gestureinfo
ok include
ok init
bad main black screen
ok minigame
ok motionpanel
ok override
? savesystem script certainly broken in error-handling section intro video skipped
ok selectdialog
ok sound
ok spec
ok spec_ps3
ok spec_ps4
ok spec_psp
ok spec_vita
ok spec_win
ok spec_x360
ok startup
ok system
ok text
ok title
ok tus
bad util no ingame art and sprites including galleries and thumbs
ok world
Shaggythecat commented 1 year ago

One more thing I did related to the font was I modified motion/main.psb to call a smaller font and change the line spacing, same with motion/backlog.psb. I uploaded the json for main.psb to the repo if you want to see the the changes I made to it.

Also I tried to recompile scripts back

I'm wondering why your recompiling them, because the scripts -that decomp properly- that I've ran trough NutCracker still work in the game. Or at least the scripts I've needed to modify work.

bad | main | black screen

Strange you're getting a black screen with main. The decompiled one I'm using doesn't have that issue, I'm using main to relocate some functions from override (like exit game, I don't get why the text for the dialogue box for it is in override) so I can make changes to them if needed.

ok | debug | might need fixes

One thing strange about debug is it's the same script from another KAW game I worked on, Plastic Memories, and the debug menu for it works just fine but for Konosuba it's broken. Edit: I just noticed your comment on the other issue.

nikvoid commented 1 year ago

I'm wondering why your recompiling them, because the scripts -that decomp properly- that I've ran trough NutCracker still work in the game. Or at least the scripts I've needed to modify work.

Isn't it cool to be able to compile entire game scripts from source (well, leaving native functions aside)? Also I wanted to find faulty parts of decompilation (it still has problems though, probably with switch stmts and endless loops).

Strange you're getting a black screen with main. The decompiled one I'm using doesn't have that issue,

That's interesting, cause when I look on recompiled main through debugger, it shows literally nothing, like the game fails to find entry point. I wonder if this behaviour related to source code paths, need to check on this later.

nikvoid commented 1 year ago

https://github.com/ErisOrder/konosuba-yokubukai

Just opened repo with my experiments from half of year ago. Maybe that hand-made build system will help you.