Phantasy Star Disassemblies

Discuss anything related to the Phantasy Star series

Re: Phantasy Star Disassemblies

Postby Parma Ham » Sun Jan 11, 2015 1:06 pm

.
Last edited by Parma Ham on Thu Feb 12, 2015 10:00 pm, edited 1 time in total.
Parma Ham
 

Re: Phantasy Star Disassemblies

Postby lorenzo » Mon Jan 12, 2015 1:05 am

Thanks a lot, Parma Ham! Enjoy your hacking. If you or anyone else have trouble doing something, feel free to ask questions. It can be a little intimidating for first timers...
lorenzo
Blastoid
Blastoid
 
Posts: 92
Joined: Thu Dec 25, 2014 12:57 am
Location: Italy

Re: Phantasy Star Disassemblies

Postby Parma Ham » Mon Jan 12, 2015 3:13 pm

.
Last edited by Parma Ham on Thu Feb 12, 2015 10:01 pm, edited 1 time in total.
Parma Ham
 

Re: Phantasy Star Disassemblies

Postby lorenzo » Mon Jan 12, 2015 5:35 pm

Parma Ham wrote:How do I disable random battles?


Search for the line that calls the ProcessRandomBattle routine. Here's a code snippet below for reference:

Code: Select all
   bsr.w   loc_5F74
   jsr   (RenderCharSprites).l
   bsr.w   loc_809C
   jsr   (ProcessRandomBattle).l     ; <--
   bsr.w   loc_6430
   btst   #6, ($FFFFF712).w
   beq.s   loc_7DCE


See the line indicated by the arrow? Comment out that jump instruction. Just put a semicolon before jsr

Parma Ham wrote:Is it easy to increase walking speed? If not, that's not a big deal.


An easy way would be to use the fast forward feature of the emulators. For Kega Fusion and Regen, just press the backspace key to toggle between on and off; if you use other emulators, you need to see how to do it, if fast forward is supported for those.

Parma Ham wrote:Are the boss battles easy to skip?


You'd better change the stats for the bosses. Change the agility value other than HP so that you can act first (ideally set both stats to 1). Look for the EnemyData label where all properties for the enemies are stored. Right above it, I typed out what most of the data represents for a single enemy. Also check the data for Fire Ant to see an example.

Parma Ham wrote:Let me know if I'm asking too much; I don't want you to feel burdened. You've already done a LOT.


Don't worry! ;) I wouldn't have even bothered creating this topic if I didn't want you to ask questions.

EDIT: Let me elaborate a bit on the walking speed as I provided a poor explanation: the fast forward feature is just for emulators obviously, but if you wanna change the speed of your characters by tweaking code, it won't be straightforward. Not only do you need to change the properties of the sprites, but you also need to update the scrolling routine. Not very easy and you need to track how the values in RAM are used. I think that for your purpose you can just go with the fast forward feature
lorenzo
Blastoid
Blastoid
 
Posts: 92
Joined: Thu Dec 25, 2014 12:57 am
Location: Italy

Re: Phantasy Star Disassemblies

Postby Parma Ham » Fri Jan 16, 2015 5:24 pm

.
Last edited by Parma Ham on Thu Feb 12, 2015 10:01 pm, edited 1 time in total.
Parma Ham
 

Re: Phantasy Star Disassemblies

Postby lorenzo » Sat Jan 17, 2015 1:35 pm

For the naming window, you need to change a few things. First of all go to the label WindowArt_NameInput: this is where you change the content of the window. Look at the "border" macro or function I created... It basically writes the character (2nd parameter) a number of times (1st parameter). Make sure that all rows are the same length. So if it's 19 for the name input window, make sure all rows are 19 characters long. Experiment with it a little.

Then you need to tweak the functionality according to how you want the letters laid out. There's an object or element which appears and disappears (blinking effect) and is placed over the letters. This is so that you see which character is selected. The object is called Obj_InputWindowBlinkCursor in the disassembly. You'll see properties and behaviors defined for this object (the same goes for the other object of course). Inside this section of code a table is used to determine which letter gets selected and put in memory. It's called InputCharacterMap and it's the range of characters you can select and choose when using the joypad. The index of the character to select is stored in d1 so check the code and see how it handles the logic of moving the "blinking" cursor. Of course to read and understand what's going on, you need to know some m68k assembly. Did you start learning it?

For patches, here are a couple of programs you can use:

- LunarIps - for IPS
- XdeltaUI - for xdelta

You can find these on romhacking.net. To make a patch, select "Create Patch" option, then choose the original ROM file. After that select the hacked ROM which contains the differences compared to the original one, then choose the name for the patch. When you distribute the patch, you need to tell what version of the original ROM you created the patch from, so that people know for sure which ROM to apply the patch to. If you plan to distribute your hacks, romhacking.net doesn't allow full ROM's so patches are the only way to go. I don't know about pscave though. I see the full original ROM, so I don't it's a problem submitting a full hacked ROM here.

Just out of curiosity, did you already start editing the script, or are you just asking questions in advance?
lorenzo
Blastoid
Blastoid
 
Posts: 92
Joined: Thu Dec 25, 2014 12:57 am
Location: Italy

Re: Phantasy Star Disassemblies

Postby Parma Ham » Sat Jan 17, 2015 6:57 pm

.
Last edited by Parma Ham on Thu Feb 12, 2015 10:01 pm, edited 1 time in total.
Parma Ham
 

Re: Phantasy Star Disassemblies

Postby lorenzo » Sat Jan 17, 2015 10:04 pm

I created a patch which fixes some bugs in the game. I also expanded some windows to remove some abbreviations and use full words. I also took some text from the Japanese version and replaces some awkward or poorly translated lines. Check this link if you're curious:

http://www.romhacking.net/hacks/2132/

I also asked Missagh to upload it on this website. I didn't even know that translation existed to be honest. It would be awesome if you could use a more faithful translation than the official one. I'm curious now, I wanna play the game in Japanese and see if the lines are more or less the same (don't worry, I know Japanese).

For the bug fixes I left some notes in the comments, so it should be relatively easy to make some changes, like the cut-off lines, sound bug in the Esper Mansion, etc...
lorenzo
Blastoid
Blastoid
 
Posts: 92
Joined: Thu Dec 25, 2014 12:57 am
Location: Italy

Re: Phantasy Star Disassemblies

Postby Parma Ham » Sat Jan 17, 2015 11:27 pm

.
Last edited by Parma Ham on Thu Feb 12, 2015 10:02 pm, edited 1 time in total.
Parma Ham
 

Re: Phantasy Star Disassemblies

Postby lorenzo » Sun Jan 18, 2015 11:14 am

I can send you item, technique and monster names from the Japanese version. I can check the script, but for the missing ones on the fan-translated page, I need to play the game and read the dialogues. To be honest I'm in the middle of doing other stuff, so I probably will not get to that soon. For the names of items and the rest I can send you a PM with a list if you're interested.
lorenzo
Blastoid
Blastoid
 
Posts: 92
Joined: Thu Dec 25, 2014 12:57 am
Location: Italy

Re: Phantasy Star Disassemblies

Postby Parma Ham » Sun Jan 18, 2015 5:54 pm

.
Last edited by Parma Ham on Thu Feb 12, 2015 10:02 pm, edited 1 time in total.
Parma Ham
 

Re: Phantasy Star Disassemblies

Postby BenoitRen » Mon Jan 19, 2015 1:15 am

You could get a save file for the English version, and use it for the Japanese version. Failing that, I had success with taking a save state for PSIV in English, then using it in the Japanese version. (I didn't try using a save file from the JP version first, so that might work, too)
Get Xenoblade Chronicles!
User avatar
BenoitRen
Moderator
Moderator
 
Posts: 3115
Joined: Fri Jul 27, 2007 5:19 pm
Location: Belgium

Re: Phantasy Star Disassemblies

Postby lorenzo » Mon Jan 19, 2015 8:39 am

Thank you, BenoitRen. :) I managed to load a save file in the Japanese version from the English one.
lorenzo
Blastoid
Blastoid
 
Posts: 92
Joined: Thu Dec 25, 2014 12:57 am
Location: Italy

Re: Phantasy Star Disassemblies

Postby dee_ehn » Thu Jan 22, 2015 8:19 pm

I'm presently attempting to expand technic strings, and seem to be running into issues.

I've expanded the TechNameLength to 7, as well as the TechniqueData+5s to TechiniqueData+7, and the lone TechniqueData+6 to TechniqueData+8
This unfortunately does not seem to cover everything as the game still does not seem to process the now-larger tech struct properly, causing Nei's "Res" spell at the beginning of the game to render as gibberish, and causing it to not function.

Any idea what I'm missing, or where to start looking for it? I'm only marginally familiar with 68k, and am using this partially as an excercise in learning and partially as a serious potential project. If I can figure this out I could probably also expand inventory names, and possibly even monster names with some window manipulation.
dee_ehn
Pinchant
Pinchant
 
Posts: 7
Joined: Thu Jan 22, 2015 7:48 pm

Re: Phantasy Star Disassemblies

Postby lorenzo » Fri Jan 23, 2015 10:16 am

First of all, did you change the code so that the new size is taken into account when jumping to the desired technique? Originally every technique has size 8, so after loading the TechniqueData, it gets the index of the technique and multiplies this index by 8 (shift left by 3). So the code looks like this:

Code: Select all
   lea   (TechniqueData).l, a3
   move.b   (technique_index).w, d0
   andi.w   #$3F, d0
   lsl.w   #3, d0                 
   adda.w   d0, a3


Now your size has become 10, so obviously you need to change that part of code a bit. You can change the lsl.w #3 instruction into

Code: Select all
   mulu.w   #$A, d0   <-- multiply d0 by 10 (unsigned multiplication)


However a single multiplication instruction takes many clock cycles to execute; to make it faster you can store the original index in another register, multiply that by 2, multiply the original index by 8 (shift by 3) and then sum the results of both registers to get a multiplication of 10. So it should be like this:

Code: Select all
    lea   (TechniqueData).l, a3
    move.b   (technique_index).w, d0
    andi.w   #$3F, d0
    move.w   d0, d1      ; move original index
    add.w   d1, d1      ; multiply this by 2
    lsl.w   #3, d0              ; multiply original index by 8
    add.w   d1, d0      ; add the results of both register (multiply by 10)
    adda.w   d0, a3


This technique uses more instructions and requires another register which must be unused in the current part of code, otherwise you'll break the functionality. If you don't feel comfortable doing this, just use the mulu instruction... The game won't lag anyway, since the code doesn't do many calculations in one frame (at least relatively).

The other thing you need to do is expand the windows and make sure that the code writes all 7 characters. The pointers and art data for the windows are right below the TechniqueData; I typed some notes so explain what that data represents. There's data like coordinates, the pointer to art data, and the length of the rows and columns of each window. We can see one easy example: the USE/GIV/TOS window. Go to the label WindowArt_ItemDecideAction; you can see by the border macro that the length of a row must be 5, so it fills the top border ($B9) and the bottom border ($B9). The cursorbox macro already prints $B4 and $B5 so you need to print the remaining 3 characters. The other empty rows must have 5 spaces. So if we change the strings to read USE/GIVE/TOSS, we need to make the length 6. So change the 5 to 6 and make sure every other row is 6 bytes long. However you need to define this length, so in the WindowArtLayoutPtrs go to the definition of the WindowArt_ItemDecideAction window. Under the dc.l you will see the first byte which has value $06: that defines the number of bytes to draw in a single row. It's 1 byte longer than the content can hold because it's most likely taking the left border into account. Anyway change that $06 to $07 and now your window will allow 6 characters inside your window. Try it out.

You will need to do the same for every window that holds the technique names. The technique art data is defined in the section I labelled DynamicWindowsStart. I called them "dynamic" because the content changes according to the values stored in RAM. So when changing the dynamic windows, you need to change code instructions as well.

Go to the WindowsIndexTable label: this holds every routine that processes every window that you open. I also put the index for every window so that it's easier to refer to the desired window when looking at the code, and the indices are the same as those of the WindowArtLayoutPtrs so you can map them easily. To see which window deals with technique strings, just search for the word technique in the range of the start of the WindowsIndexTable and the end of this table. When you see technique_data or TechniqueData, you'll know that these windows deal with techniques. Try looking for them yourself first, if you have trouble I can help you locate them, but not in this post as I realized it's very long and typed lots of info. You might have gotten a little confused so I'll just stop here for now =)
lorenzo
Blastoid
Blastoid
 
Posts: 92
Joined: Thu Dec 25, 2014 12:57 am
Location: Italy

PreviousNext

Return to Phantasy Star

Who is online

Users browsing this forum: Google [Bot] and 3 guests

cron