Dolphin, the GameCube and Wii emulator - Forums

Full Version: NTSC/JP Xenoblade 60fps and other mods
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
Just got around to this. There's a 2-frame window normally, but a 0 frame window with your code. I assumed the number would be the same, giving half the window there should be in real-time, but no. Strange.
Thanks, that's probably enough info for me to track it down.
That might not be right, actually. I need to test more. /edit nvm, that's correct. Wasn't keeping my save-states straight, got confused.

If it helps, I found a visual cue for perfect that applies universally (including the much more easily tested battle start b-prompt): the red flash that goes from bottom to top is noticeably brighter on a perfect.
The code for the controls was needlessly complicated. I had to settle on what felt right. Could use a second opinion. Battle Menu and Pop-Up Menu.
$controls
C24497D4 00000002
7D084214 7CE83A14
60000000 00000000
C24497FC 00000002
7D084214 7CE83850
60000000 00000000
Feels perfect to me. If there actually is a difference, I can't tell. Thanks!

Though, looking at it, you included 9 digits in that last line. An extra 0, I'm guessing? That's how Dolphin treated it anyway.

Edit: I just noticed the more in-depth post on the cutscene math you posted a week ago. Sorry to keep bringing this up when it's so complicated. I follow everything pretty well, but... you're 100% sure the difference between -176 and 4 is 0, and not 8? Have you manually tested that? As far as I can tell, it should be 8... I'd try this myself, but I know nothing of assembly.
Extra 1, no idea how it got there. Fixed.

The burst B is tricky, I don't know if I'm looking at the code for it or if it's only the animation's code.

I can try a value of 8 when I'm not fixing stuff. Assembly math isn't too difficult, I'll show you my current code:
f# = variable like X,Y,etc
lfs = load value from address (in this case 180)
fcmpo = compare
After a compare: bne = branch if not equal, beq = if equal, blt = if less than. ble = if less than or equal
fmr = copy value
f0 is frame2 and f31 is frame1
f0 at the bottom is the output difference. It is multiplied by 0.5 and added to f31 after this code.

movieanim: (Show Spoiler)

I had two previous codes that seemed to do better, but still buggy.
Thinking about it more - the fact that 4 is anywhere close to -176 is actually totally weird. Does 180 do a complete rotation instead of 360?

Either way, this code does in fact take the difference between sine aligned angles, but I don't think that's actually correct for this situation.
Code:
loc_0x0:
lfs f18, 0(r2)
fsubs f17, f18, f18 ; 0
fdivs f23, f18, f18
fadds f23, f23, f23 ; make 2
fmuls f20, f18, f23 ; make 360
fdivs f21, f18, f23 ; make 90

loc_0x18:
fabs f19, f0
fcmpo cr0, f0, f17  ; check for 0
fdivs f16, f19, f0  ; sign of f0
bne+ loc_0x2C
fdivs f16, f18, f18 ; force sign to 1 if it was 0

loc_0x2C:
fcmpo cr0, f19, f18 ; f19 abs compare 180
ble+ loc_0x44
fmuls f22, f20, f16 ; 360 with same sign as f0
fsubs f0, f0, f22   ; subtract 360 if above 180, add 360 if below -180
fabs f19, f0        ; abs tracking

loc_0x44:
fcmpo cr0, f19, f21 ; f19 abs compare 90
ble+ loc_0x50
fneg f16, f16       ; sign tracking
fmuls f22, f18, f16
fsubs f0, f22, f0

loc_0x50:
fcmpo cr0, f21, f24 ; loop once
beq+ loc_0x68       ; skip on first loop
fmr f24, f21        ; copy
fmr f25, f0         ; copy result
fmr f0,  f31        ; set f0 to frame 1
b loc_0x18          ; loops back

loc_0x68:
fsubs f0, f0, f25   ; difference

I used f21-f23, in addition to f25. No idea if you were using those.

If you could give me instructions on how to set this up to test myself, it'd be much appreciated. I don't have any prior experience with assembly (or even gecko, for that matter) but this doesn't seem over my head. If I could just directly see what my code is doing to various values and what the actual on-screen results are, it'd go a long way.
It's rather easy. I'll write some instructions and if it's not clear I can make a short video.
- Download Codewrite to convert the asm to gecko. https://github.com/TheGag96/CodeWrite/releases
- Make a shortcut to dolphin and add a " -d " to the target line at the end
- Open the shortcut and you should see developer mode. Turn off dual core and any other threading options, as it can mess it up.
- Start game. Probably pause it. Turn on View -> Registers and Breakpoints.
- Set Break Points for 803e1954, 803e19e4, 803e17a4. = f31, f30, f29
- It gets a bit annoying here. The code needs to run for three values, f31, then f30, then f29. I usually just copy/paste the code 3 times and change the f31 value and the address. If you think you'll be working on it, I could try to feed each value into the same code, so you don't need to worry about that.
- Also you need to define the 180 in the gecko code with 0466daa0 43340000 (don't put in codewrite)
- The register tab shows you the values and you hit Step to go forward by one in the code.

That might not be enough to get you going, but if you can see and work with it that much, you're almost there.

I'm not sure your loop at the end is right. Also, I think you're using f31 as frame 2, but it should be 1. You can use fmsubs fa, fb, fc, fd becomes fa = fb * fc - fd.
I should run an investigation on if any f##'s shouldn't be used. Maybe set them all to 100 and see if it breaks anything.

/edit 16 to 28 should be free. An easier way to determine the sign of a number, especially if you have to do it in multiple places: if you have a 1 (say f27) and a -1 (say f28), then: fsel f16, f0, f27, f28. Will make f16 equal the sign (-1 or 1) of f0, 0 is 1.
Thanks. Should've put Xenoblade onto my laptop, would've given me something to do on my hour long commute.

Yup, mixed f0 and f31. Reading is hard. I'm not sure the loop is right either (though I might've just commented it oddly).

Also, if my hunch on what's actually going on mathematically here is correct, the remainder of an int divide may be useful. Do you know if there is a PowerPC instruction for this?
https://www.ibm.com/support/knowledgecenter/en/ssw_aix_71/com.ibm.aix.alangref/idalangref_fdiv_fd_instrs.htm

I haven't tried it, maybe fctidz followed by fcfid. You'd get the number rounded down then subtract it from the real value. I know a way that writes to an address, but I try to avoid that.

The normal game uses the same code movie code to render stuff without problems.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31