Project

General

Profile

Actions

Emulator Issues #1008

closed

Tales of Symphonia DotNW Wii starting new game memory loops (and possible fix)

Added by har.gallant over 15 years ago.

Status:
Invalid
Priority:
Normal
Assignee:
% Done:

0%

Operating system:
N/A
Issue type:
Bug
Milestone:
Regression:
No
Relates to usability:
No
Relates to performance:
No
Easy:
No
Relates to maintainability:
No
Regression start:
Fixed in:

Description

What steps will reproduce the problem?

  1. Starting new game, the game will ask for ToS GC cleared data
  2. Answer yes or no will result for asking the memory card data again
  3. And can't go back to main menu

What is the expected output? What do you see instead?
The game should started with the prolog of the game, instead of keeps
asking for ToS cleared memory card data.

What version of the product are you using? On what operating system?
Windows Vista SP1 32bit on r3110++

Please provide any additional information below.
I tried this on r3109 and no problem yet, on r3110 upper the problem appeared.

Possible fix:
dolphin-emu\Source\Core\Core\Src\PowerPC\Interpreter\Interpreter_FloatingPoint.cpp

void fcmpu(UGeckoInstruction _inst)
{
......
// normalize if conversion to float gives denormalized number
if ((riPS0(_inst.FA) & 0x7ff0000000000000ULL) < 0x3800000000000000ULL)
riPS0(_inst.FA) &= 0x8000000000000000ULL;

delete the upper codes and the game can start a new game.

Actions #2

Updated by hrydgard over 15 years ago

  • Status changed from New to Accepted

What do you mean "the upper code"? Do you mean the "....." or the two code lines that
deal with normalization?

Either way, interesting. Maybe we need yet another setting....

Actions #3

Updated by hrydgard over 15 years ago

Btw, those two lines were a fix for Sonic Unleashed, I think.

Actions #4

Updated by har.gallant over 15 years ago

Sorry, I meant those two lines. Yeah, I know that, since I checked the rev almost one
by one. lol
Tried to change the code, but got an error instead.
Changing 0x3800000000000000ULL to 0x8000000000000000ULL, and the game crashed in the
opening movie. :P

Actions #5

Updated by har.gallant over 15 years ago

Changing 0x8000000000000000ULL to 0x7ff0000000000000ULL solved the problem on
ToS:DotNW (at least it will pass the memory card loop screen)
Wondering how it is on Sonic Unleashed....

Edited wrong one :P

Actions #6

Updated by death2droid over 15 years ago

Hmm we need someone with Sonic Unleashed to test it out :P

Actions #7

Updated by itsnotmailmail over 15 years ago

all of those lines should be deleted - not only do they flush numbers to zero when
the original console doesn't, it flushes the arguments to zero - not the destination.
It's surprising that it works at all.

A better fix for sonic unleashed would be to look at the "non-IEEE" bit of the FPSCR
(FPSCR.NI). when that's enabled, dolphin should enable flush to zero (and
denormals-are-zero, if supported by the PC). Otherwise - dolphin should disable it.

I think there are traces of this being once done (incorrectly, maybe?), but anyway -
it is correct and if beyond good & evil has issues when the NI bit is emulated, then
this is the bug that should be figured out.

Actions #8

Updated by hrydgard over 15 years ago

Agreed, itsnotmailmail.

I had this semi-done for a while. I should give it another shot and as you say,
investigate Beyond Good & Evil.

As a side note, I've been trying to get F-Zero to work by making the FPU emulation
more accurate but haven't gotten much closer. Removing these hacks doesn't help. I
can get the ship to stop falling through the floor by forcing division by 0 to 0
instead of inf (which I've verified is a wrong thing to do), but it still won't move.

Actions #9

Updated by itsnotmailmail over 15 years ago

Well one thing I noticed is that frsqrte isn't emulated correctly.

If the argument is strictly negative, it should return a QNAN (with a VXSQRT exception)
If it is a zero, it should return infinity or a clamped value (no idea which,
certainly not zero, though.) as well as set the VX exception.

Also, there's a bug in fdiv: FB may be the same as FD and then the wrong value is
checked for zero.

Actions #10

Updated by itsnotmailmail over 15 years ago

And the bug in fdiv(x) also exists in fres(x)

Actions #11

Updated by hrydgard over 15 years ago

If FB == FD, surely it doesn't matter which one is checked for zero? it'll be a
zero/zero = NaN either way ..

You're completely right about the issues with frsqrte - I'll fix that tonight unless
you do it first.

Actions #12

Updated by itsnotmailmail over 15 years ago

of course it matters. if FA contains 0, FB contains 1 and FD == FB, then ZX will be
set even though no division by zero occured.

This bug also exists in ps_rsqrte and ps_div.

Actions #13

Updated by hrydgard over 15 years ago

Eh oops. Mixed the regs together. Will fix.

Actions #14

Updated by hrydgard over 15 years ago

I've improved all the div/sqrt-ish instructions.

No improvement in F-Zero...

To simulate GC denormals behaviour, I think DAZ is the one we need, not FTZ. But either
or both of those break Beyond Good & Evil and I can't figure out why...

Actions #15

Updated by itsnotmailmail over 15 years ago

  1. Gekko uses both FTZ and DAZ when NI is on, says so in the manual (section 2.2.3)

  2. The manual (same section) also seems to claim that when NI is on, convert to int
    instructions return 0x80000000 for all too-large floats (presumably instead of
    clamping). This looks a bit suspecious, though (at least to me). Has this been tested
    on the real hardware?

  3. Beyond good and evil works when FTZ & DAZ are enabled for all instructions except
    load & store single-precision instructions. It is likely that those operate with
    FTZ/DAZ "off" regardless of the NI bit.

Actions #16

Updated by itsnotmailmail over 15 years ago

  1. according to the comment after the little pseudo code in the same section,
    quantized load & store might zero denormals even if NI is off (Or it might just be a
    mistake)

  2. according to section 2.3.4.3.12, NANs would be clamped the same as +Infs in
    quantized stores. (Dolphin doesn't seem to handle this)

Actions #17

Updated by itsnotmailmail over 15 years ago

  1. actually, according to section 2.3.4.3.12, quantize loads denormals while quantize
    stores store a zero instead of a denormal.
Actions #18

Updated by hrydgard over 15 years ago

Thank you, very nice observations, I'll try to implement them (and check that
suspicious one on real hw) later this week, unless you do it first (hint hint :)

Actions #20

Updated by LinesPrower about 15 years ago

Is it fixed now? Could someone check it?

Actions #21

Updated by hafizmml89 almost 15 years ago

no.. not fixed yet.. btw.. the rev im using is r4738

Actions #22

Updated by chuuey almost 15 years ago

i tried with 4877, still no go, loops all the time ;) but interpreter works fine, i
just used that to bypass that problem ;)

Actions #23

Updated by Anonymous almost 14 years ago

Please respond if this issue is still valid, or it will be closed.

Actions #24

Updated by Anonymous almost 14 years ago

  • Status changed from Accepted to Invalid
Actions

Also available in: Atom PDF