Hacking PSP ASM Hacking for Variable Width Font

ChepChep

Well-Known Member
OP
Member
Joined
Feb 9, 2011
Messages
611
Trophies
0
XP
876
Country
United States
I am going to try doing it myself with Kelebek's description. I will learn more if I figure it out with help then just letting someone else do it for me. I rather struggle a bit and get it since then I will understand what is going on.
 
  • Like
Reactions: Pablitox

Scorp

Well-Known Member
Member
Joined
Sep 23, 2010
Messages
248
Trophies
0
XP
296
Country
Kazakhstan
Well, if you would figure, what is big meaning in sections, why they intersect with program (and sometimes not) - please share. As by now I just ignore them, just fixing offsets.

And, if you would succeed (well, not if - when) with your proportional print routine, can you please do some tutorial? Would be helpful, I think.
 

ChepChep

Well-Known Member
OP
Member
Joined
Feb 9, 2011
Messages
611
Trophies
0
XP
876
Country
United States
So with Kelebek help(mostly his work), I was able to expand the eboot.bin by 0x1000 bytes. It turns out I was modifying an already modified eboot and needed a clean one (stupid mistake on my part). Also didn't add 0x20 to that section header table pointer (the pointer at 0x20 in the file), and also 0x20 to the iPaddr.

I just added 0x1000 bytes (all 00's) to the end of the eboot.

Here is a screenshot of the before and after in case it helps anyone:
Original Eboot
qybeck.jpg

Edited Eboot
33o4o55.jpg
 

JamRules

.....
Member
Joined
Jan 9, 2014
Messages
527
Trophies
1
XP
2,204
Country
United States
Just added an initial vwf attempt, what I did
-Find the point were the constant width/spacing value is added to the x pos for the next letter (In my case the width value is added after the vertex for each letter is saved and the x pos is stored, not calculated each which would be a problem)
-Trace back to where this width was loaded (luckily it was reloaded for each char)
-Extend the eboot to allow for the extra code and char table (big thanks to Kelebek)
-Inject when a char is loaded and save it for later
-Inject before the width is loaded and save a new width value by comparing the char saved earlier to the char table added to the eboot

sol-vwf.png


comparison-2.png


The font still renders full size but the white space on the right is overlapped,
I still need to align all the letters to the left the letters to look correct
 

Scorp

Well-Known Member
Member
Joined
Sep 23, 2010
Messages
248
Trophies
0
XP
296
Country
Kazakhstan
Very interesting! Just one thing:

-Find the point were the constant width/spacing value is added to the x pos for the next letter (In my case the width value is added after the vertex for each letter is saved and the x pos is stored, not calculated each which would be a problem)

What is the fastest way to find that? Apart tracing whole text, obv. Seems using GE Debug somehow (sorry for noob questions)?
 

JamRules

.....
Member
Joined
Jan 9, 2014
Messages
527
Trophies
1
XP
2,204
Country
United States
Yeah using GE debugger step texture until the font and then step primative, this only works if the letters are rendered seperately though
 

flame1234

Well-Known Member
Member
Joined
May 17, 2009
Messages
734
Trophies
0
XP
957
Country
United States
I don't even know what's what.
What is the meaning of instruction c.lt?
How do you see the values of register f12 and f14?
How do you know how big to make each letter? Is there a list somewhere of recommended widths?

It looks like you have a bunch of eight-byte entries. What kind of number format is the last two bytes (which I think might be the width)?
 

JamRules

.....
Member
Joined
Jan 9, 2014
Messages
527
Trophies
1
XP
2,204
Country
United States
I don't even know what's what.

What is the meaning of instruction c.lt?

Compare Less Than, but this just the original instruction I replaced with a jump.

How do you see the values of register f12 and f14?

The float coprocessor registers (f12, etc.) can be seen by clicking FPU above the standard register list.

How do you know how big to make each letter? Is there a list somewhere of recommended widths?

I changed the ram at run-time until it looked right, then I can update the eboot.

It looks like you have a bunch of eight-byte entries. What kind of number format is the last two bytes (which I think might be the width)?

4 bytes for the char, 4 bytes for a float which is loaded into a float register


The code's not the best and has some redundant opcodes as I made it up as I went along, also PPSSPP had a weird fit with lw s2, 0x4(s5) so I had to use addiu s5, s5, 0x4, lw s2, 0x0(s5)
 

JamRules

.....
Member
Joined
Jan 9, 2014
Messages
527
Trophies
1
XP
2,204
Country
United States
I'm more interested in what you use to insert your code. Have you heard about .sym ?


Actually no, I just used the assemble opcode function of the debugger.

Edit: basically you mean to symbolcate it so its more human readable?
Names for constants, etc.
 

Scorp

Well-Known Member
Member
Joined
Sep 23, 2010
Messages
248
Trophies
0
XP
296
Country
Kazakhstan
Please explain, what is that .sym and how it would help in inserting the code. As I thought the way everyone do (e.g. coding in debugger (maybe also assembler? never tried to find one for MIPS) and putting few bytes in some free space) is the only way :)
 

StorMyu

"I'm way too old for this"
Member
Joined
Jan 2, 2010
Messages
943
Trophies
1
Age
97
XP
1,093
Country
France
Actually no, I just used the assemble opcode function of the debugger.

Edit: basically you mean to symbolcate it so its more human readable?
Names for constants, etc.
almost, it's just a thing that Martin Korth started with his debuggers and Kingcom made it for PPSSPP too.
I don't have any new screenshots for that so I'll just use an old with NoGba but the concept is the same:

c3oinjgm4dv5adjfy.gif


You can assign any memory address to a label that will appear on the debugger, it's especially useful since you can "Text Search" inside the assembly window (in PPSSPP too) thexyz is using Armips, as I do, it's an assembler that will allow you to output a .sym file and you just have to have the same name in the same directory for ppsspp to recognize it.
- Sol Trigger.iso / Sol Trigger.sym for example.

Then it's easy to just track down your own code to see if there's something wrong, you define labels like that:

Code:
.org 0x08922200
 
Font:
 
.ifdef English
    .import Data\Font\Italian.raw
.endif
.ifdef French
    .import Data\Font\French.raw
.endif
.ifdef Italian
    .import Data\Font\Italian.raw
.endif
.ifdef Spanish
    .import Data\Font\Spanish.raw
.endif
I've shown you this because you can see that you can also ifdef, which is nice (for my Tales of Rebirth translation on multiple languages in this case ^^)
Anyway, that will replace 0x08922200 by Font in PPSSPP, and then you can just Ctrl+S to check for it. It'll even allow you to see where it's called, stuff like "li a0,font" (very unlikely but I had no good examples in mind)

Note that you can also load Directories in PPSSPP, reducing the time to build an iso so a quick change to the EBOOT is not hard to do, armips is quite fast. You'll be able to test your changes in a matter of seconds without fear of gamebreaking freeze / mistakes and your whole code will be in your .asm file so easy to change.
 

JamRules

.....
Member
Joined
Jan 9, 2014
Messages
527
Trophies
1
XP
2,204
Country
United States
almost, it's just a thing that Martin Korth started with his debuggers and Kingcom made it for PPSSPP too.
I don't have any new screenshots for that so I'll just use an old with NoGba but the concept is the same:

c3oinjgm4dv5adjfy.gif


You can assign any memory address to a label that will appear on the debugger, it's especially useful since you can "Text Search" inside the assembly window (in PPSSPP too) thexyz is using Armips, as I do, it's an assembler that will allow you to output a .sym file and you just have to have the same name in the same directory for ppsspp to recognize it.
- Sol Trigger.iso / Sol Trigger.sym for example.

Then it's easy to just track down your own code to see if there's something wrong, you define labels like that:

Code:
.org 0x08922200
 
Font:
 
.ifdef English
    .import Data\Font\Italian.raw
.endif
.ifdef French
    .import Data\Font\French.raw
.endif
.ifdef Italian
    .import Data\Font\Italian.raw
.endif
.ifdef Spanish
    .import Data\Font\Spanish.raw
.endif
I've shown you this because you can see that you can also ifdef, which is nice (for my Tales of Rebirth translation on multiple languages in this case ^^)
Anyway, that will replace 0x08922200 by Font in PPSSPP, and then you can just Ctrl+S to check for it. It'll even allow you to see where it's called, stuff like "li a0,font" (very unlikely but I had no good examples in mind)

Note that you can also load Directories in PPSSPP, reducing the time to build an iso so a quick change to the EBOOT is not hard to do, armips is quite fast. You'll be able to test your changes in a matter of seconds without fear of gamebreaking freeze / mistakes and your whole code will be in your .asm file so easy to change.

Very interesting didn't know that existed, I'll have to try it.
Thanks for the tips.

Edit: gave it a quick go

symbol-example.png
 
  • Like
Reactions: Gil_Unx

Scorp

Well-Known Member
Member
Joined
Sep 23, 2010
Messages
248
Trophies
0
XP
296
Country
Kazakhstan
Well, I personally seems too die-hard, so I still think, that symbolic only useful, if you really want to disassemble a lot. By me when there is 50 bytes of code and 3 label there is not so big need for translating addresses to label. But convenient sometimes, yes :) So if you assemble in separate tool, could be useful, I think.
 
  • Like
Reactions: JamRules

StorMyu

"I'm way too old for this"
Member
Joined
Jan 2, 2010
Messages
943
Trophies
1
Age
97
XP
1,093
Country
France
It's not like it's difficult. I insert my code with armips anyway, the symbols are just a bonus.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
  • BigOnYa @ BigOnYa:
    I kept thinking jaws was gonna come up and attack
  • K3Nv2 @ K3Nv2:
    Jaws is on a diet
  • K3Nv2 @ K3Nv2:
    Damn power went out
  • BigOnYa @ BigOnYa:
    Ok xdqwerty, your little bro prob tripped On the cord and unplugged you
  • K3Nv2 @ K3Nv2:
    Ya I'm afraid of the dark hug me
  • BigOnYa @ BigOnYa:
    Grab and hold close your AncientBoi doll.
  • K3Nv2 @ K3Nv2:
    Damn didn't charge my external battery either
  • BigOnYa @ BigOnYa:
    Take the batteries out of your SuperStabber3000... Or is it gas powered?
  • K3Nv2 @ K3Nv2:
    I stole batteries from your black mamba
    +1
  • K3Nv2 @ K3Nv2:
    My frozen food better hold up for an hour I know that
  • BigOnYa @ BigOnYa:
    Or else gonna be a big lunch and dinner tomorrow.
  • BigOnYa @ BigOnYa:
    Did you pay your power bill? Or give all yo money to my wife, again.
  • K3Nv2 @ K3Nv2:
    Oh good the estimated time is the same exact time they just said
    +1
  • BigOnYa @ BigOnYa:
    Load up your pc and monitor, and head to a McDonalds dining room, they have free WiFi
  • K3Nv2 @ K3Nv2:
    Sir please watch your porn in the bathroom
    +2
  • BigOnYa @ BigOnYa:
    No sir we can not sell you anymore apple pies, after what you did with the last one.
  • K3Nv2 @ K3Nv2:
    We ran out
  • HiradeGirl @ HiradeGirl:
    for your life
    +1
  • K3Nv2 @ K3Nv2:
    My life has no value my fat ass is staying right here
  • K3Nv2 @ K3Nv2:
    Nearly 4 hours without power :(
  • Veho @ Veho:
    SO POWERLESS
  • K3Nv2 @ K3Nv2:
    Tell Kanye I need power
    K3Nv2 @ K3Nv2: Tell Kanye I need power