• Welcome to Final Fantasy Hacktics. Please login or sign up.
 
July 05, 2020, 08:02:08 pm

News:

Don't be hasty to start your own mod; all our FFT modding projects are greatly understaffed. Find out how you can help in the Recruitment section.


(App) MassHexASM: Encode directly to little endian (v13 Update: 1/11/2017)

Started by Glain, May 08, 2011, 12:41:12 am

Pickle Girl Fanboy

Quote from: Glain on March 18, 2012, 08:43:14 pmafter finally managing to install Java 1.7 (I was getting the "Unsupported major.minor version" error before then). For some reason, apt-get didn't work for me, so I had to follow these instructions (top answer). I downloaded the JDK, but I imagine the same instructions would work for the JRE.

Didn't see this here last time.  And gee golly, Oracle sure does fucking love it's users - see how easy they make updating!

Pickle Girl Fanboy

What portions of each bash script should I change, and what should I change them to?  I'm installing the Java Runtime Environment, not the JDK.

This really makes me want to quit.  Fuck you, Oracle.

Glain

You could probably just follow this. I'd also look to make sure they haven't added it to apt-get before writing that off.

Honestly, though... I may just deprecate the Java version (although I suppose it could still be useful). It's annoying to maintain both a C# and a Java version.

You might as well just get everything working with Wine. I'll play around on Ubuntu and see if I can get it to work.

I've got an update coming, mostly for pseudoinstruction support, but that's the C# version.
  • Modding version: Other/Unknown

Pickle Girl Fanboy

I don't really need all the latest features, just bug-fixes.  Though I'll be the only person using the Java version, so IDK about that.

There are C# and VB compilers that are cross-platform.  And I bet that it will work with Wine, but I can't update Wine until I update my OS, can't update my OS until I have an external (this is getting old).

Pickle Girl Fanboy

Okay, I have JRE 1.7 installed.  However, there doesn't seem to be any way to open JMassHexASM with anything but the JDK 1.6, which is what I used to have installed.  I tried to add JRE 1.7 to the Open With prompt, but JRE 1.7 doesn't appear.

Glain

If java -version is telling you anything but 1.7 (might be 1.7.(something)), then 1.7 still isn't being used as the default java version.
If java -version does give you 1.7, then java -jar JMassHexASM.jar should run it. Not sure why the UI would be dumb there.
  • Modding version: Other/Unknown

Pickle Girl Fanboy

April 27, 2012, 06:06:23 pm #46 Last Edit: April 27, 2012, 07:04:06 pm by Pickle Girl Fanboy
ryan@bacon ~ $ java -version
java version "1.7.0"
Java(TM) SE Runtime Environment (build 1.7.0-b147)
Java HotSpot(TM) Client VM (build 21.0-b17, mixed mode)
ryan@bacon ~ $

Thanks!

Feature request: Fixed width font.  Like Monospace, which distinguishes between O and 0 (unlike Courier New or Courier 10 Pitch, which is a free version of Courier New).  It doesn't actually matter at all, because I can format my hex data in leafpad (and windows users can format in notepad), but it is something you may want to consider for your next major release.

Glain

Just released version 9, mostly for pseudoinstruction support. This should also fix a few annoying bugs.
  • Modding version: Other/Unknown

Pickle Girl Fanboy

Are psudo-instructions used in existing games?  Because I came across some lines that probably aren't data, yet can't to be decoded.

Glain

Pseudoinstructions are an intermediate step -- they have to be translated to real instructions before being encoded. They don't even have an encoding. Actual program code consists of all real instructions, without exception.

There could just be a few instructions that your disassembler doesn't recognize. I know LEDecoder for one isn't perfect... there are even a few commands in FFT that it marks as unknown. I think they may be graphics or coprocessor calls but I'm not sure. (Example: Some effect files have ASM at the top of them and I get some unknowns in there.)

If everything around the unknown line(s) seems to be valid code in the normal construct of a subroutine, it's probably that. And by that I mean:

(subtract from sp/r29 - pSX makes this look like a huge addition)
(save things to sp/r29, notably ra/r31)
(valid code)
(unknown)
(valid code)
(load things from sp/r29, notably ra/r31)
(add to sp/r29)
(jr ra/r31)
(usually a nop)
  • Modding version: Other/Unknown

Pickle Girl Fanboy

SaGa Frontier
SCUS_942.30
0x00000800 : lb r2,0x0014(r0)
0x00000804 : lb r2,0x2adc(r0)
0x00000808 : lb r2,0x3084(r0)
0x0000080C : lb r2,0x3630(r0)
0x00000810 : lb r2,0x3e34(r0)
0x00000814 : lw r1,-0x7200(r16)
0x00000800 : lb r2,0x0014(r0)
0x00000804 : lb r2,0x2adc(r0)
0x00000808 : lb r2,0x3084(r0)
0x0000080C : lb r2,0x3630(r0)
0x00000810 : lb r2,0x3e34(r0)
0X00000814 : FAILED TO DECODE LINE : 02 06 00 5C
0x00000818 : lw r1,-0x7200(r16)
0x0000081C : FAILED TO DECODE LINE : 03 06 04 9C

Glain

None of that is actually code.

Data can coincidentally be "decoded" to real instructions a lot of the time, because there are only so many possible encodings and a LOT of them are valid. It's just a matter of seeing whether or not what's there actually makes any sense as code.

That doesn't. It isn't. (Why would they overwrite r2 every single line?) Generally only the stuff that follows the "subroutine structure" that I mentioned in my last post is actually code. (Without the unknown, and the sp/r29 stuff may or may not happen) Try searching for jr r31 to try to find real code blocks.
  • Modding version: Other/Unknown

Pride

Sometimes when I'm putting code into v. 9 I get a different, slightly longer code then what I originally put in and I'm not sure why. For example, I get this code output:


lui r3,0x800d
addiu r3,r3,0x4644
lw r2,0x0000(r3)
nop
ori r2,r2,0x0002
jr r31
sw r2,0x0000(r3)
lui r2,0x8014
add r2,r2,r3
lui r1,0x8000
addu r1,r1,r2
lbu r2,-0x2a00(r1)
lbu r3,0x0016(r3)
nop
slt r2,r2,r3
bne r2,r0,0x0013d5d4
nop
j 0x00091614
nop
j 0x000915f8
nop


From this one, the hex I put in comes out as the code above with the extra, unnecessary commands of lui r1,0x8000
addu r1,r1,r2


lui r3,0x800d
addiu r3,r3,0x4644
lw r2,0x0000(r3)
nop
ori r2,r2,0x0002
jr r31
sw r2,0x0000(r3)
lui r2,0x8014
add r2,r2,r3
lbu r2,-0x2A00(r2)
lbu r3,0x0016(r3)
nop
slt r2,r2,r3
bne r2,r0,0x0013d5d4
nop
j 0x00091614
nop
j 0x000915f8
nop
  • Modding version: PSX
Check out my ASM thread. Who doesn't like hax?

Glain

Ack, that's pretty bad. Uploading v10 to fix that problem. (Also updating patcher)
  • Modding version: Other/Unknown

Pride

It also doesn't appear to convert jalr commands correctly as well

jalr r2,r31 - 00400009
  • Modding version: PSX
Check out my ASM thread. Who doesn't like hax?

Glain

That's interesting. I had the wrong encoding for jalr.

Try opening mips_encode.dat in a text editor, find the line for jalr, and replace it with this:
jalr : 5 : 000000s00000t00000001001

Then save the change and reload MHA. For "jalr r2,r31", you should get: 0040F809 (big endian). That seems to match up with what the pSX disassembler says the encoding is.

I can add that fix to the next version of MHA, but that should do for now. I can also add a default r31 for the second argument fo jalr. From what I can tell, that's what it's supposed to default to, but for now, it'll just require both args.
  • Modding version: Other/Unknown

Pride

  • Modding version: PSX
Check out my ASM thread. Who doesn't like hax?

Choto

I'm gonna make one small quality of life request.. It would be awesome if there were a checkbox that toggled deletion of text that isn't in code format. alot of times I make notes on the ASM routine in notepad and then c/p it to masshex, but then I have to erase each line of notes. If possible, thanks but it's requested at your liesure :P

Glain

You mean for notes being added to the end of ASM lines without any separator at all?  Any text following # is treated as a comment and will be ignored (I'm also adding ; to that for the next iteration).

Without some kind of character as a separator for a comment, I'm not sure if I can come up with a rule to determine where the ASM ends and where the comment begins.  There are a few special characters (for example, the comma character, which separates the parameters for an instruction), and if a comment includes one of those characters, it's going to mess up the parsing of the instruction.  If I have a separator character like #, I can just ignore that character and everything after it (which is what it currently does).
  • Modding version: Other/Unknown

Choto

Oh crap! that # key is magical! That's perfect, life just got much more convenient lol thanks Glain!