It is currently Thu Aug 22, 2019 2:56 pm

All times are UTC - 7 hours



Forum rules





Post new topic Reply to topic  [ 252 posts ]  Go to page Previous  1 ... 8, 9, 10, 11, 12, 13, 14 ... 17  Next
Author Message
PostPosted: Thu Jul 04, 2019 2:23 pm 
Offline

Joined: Mon Jul 01, 2019 9:00 pm
Posts: 20
Sour wrote:
klurey wrote:
And this behaves like expected:
So you're saying adding a printf statement fixes the problem? That's never a good sign... FYI I have not tested the 32-bit builds of Mesen-S at all (libretro or not) - the way I setup the configuration between the UI and the core doesn't like the 32-bit builds, and I haven't had the time to either find a solution or implement a workaround. That being said, I don't see why this would fail in x86 but not x64...


Yeah. It's weird because I had this and it broke:
Code:
      case 0x4219: case 0x421B: case 0x421D: case 0x421F:
         printf("4129: %04x %04x %04x = %04x %04x %04xn",
            (addr & 0x0E), (addr & 0x0E) - 8, ((addr & 0x0E) - 8) >> 1,
            _controllerData[((addr & 0x0E) - 8) >> 1], _controllerData[((addr & 0x0E) - 8) >> 1] >> 8,
            (uint8_t) (_controllerData[((addr & 0x0E) - 8) >> 1] >> 8)
            );

         return (uint8_t)(_controllerData[((addr & 0x0E) - 8) >> 1] >> 8);


but adding the addr then cleared the problem.

Code:
      case 0x4219: case 0x421B: case 0x421D: case 0x421F:
         printf("%04x: %04x %04x %04x = %04x %04x %04xn",
            addr,
            (addr & 0x0E), (addr & 0x0E) - 8, ((addr & 0x0E) - 8) >> 1,
            _controllerData[((addr & 0x0E) - 8) >> 1], _controllerData[((addr & 0x0E) - 8) >> 1] >> 8,
            (uint8_t) (_controllerData[((addr & 0x0E) - 8) >> 1] >> 8)
            );

         return (uint8_t)(_controllerData[((addr & 0x0E) - 8) >> 1] >> 8);


What's even more evil is the printf logs always show the expected correct values. But not when actual returning.


I also tried splitting the values and it still failed:
Code:
addr = ((addr & 0x0E) - 8) >> 1;
return (uint8_t)(_controllerData[addr] >> 8);


Wondering if it's the MS LTCG, as I've heard it can be buggy often enough. I did try mingw 8.1 32-bit but the thing just hanged on me for an hour on the TraceLogger file and I aborted.

If the buildbot had a 32-bit build, I could've just tried that since it's gcc built.


Top
 Profile  
 
PostPosted: Thu Jul 04, 2019 2:56 pm 
Offline

Joined: Sun Feb 07, 2016 6:16 pm
Posts: 724
klurey wrote:
Wondering if it's the MS LTCG, as I've heard it can be buggy often enough. I did try mingw 8.1 32-bit but the thing just hanged on me for an hour on the TraceLogger file and I aborted.
At the very least, I've never had any instances of the MSVC compiler screwing up so far - could be the case here, I'll try x86 on my end when I get a chance (might also try updating to VS2019 soon).

RE: TraceLogger, I'm not sure what GCC doesn't like about that file - GCC 8.x (not sure which one it was) freezes, even with all optimizations off. GCC 9.1 compiles it just fine (clang & MSVC are fine too)


Top
 Profile  
 
PostPosted: Thu Jul 04, 2019 3:08 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 8533
Location: Seattle
Sour wrote:
lidnariq wrote:
A random walk, as long as it's slow enough and bounded, is probably more useful.
Could probably just do something like +1 per X seconds, until you hit +32, then -1 per X seconds until you hit -32, or something akin.
That makes sense to me.

I was thinking about this in terms of APU instruction cycles per (NTSC) vsync, which turns out to be a comparably small range. 16814 ±17


Top
 Profile  
 
PostPosted: Thu Jul 04, 2019 4:24 pm 
Offline

Joined: Mon Jul 01, 2019 9:00 pm
Posts: 20
https://github.com/SourMesen/Mesen-S/bl ... efile#L262

Played around with the Makefile (windows_msvc2017_desktop_x86).
Od = okay
O1 = bad
O2 = bad
Os = bad
Ot = bad
ltcg:off = no effect other than massive slowdown

I wonder what the asm is generating...


Top
 Profile  
 
PostPosted: Thu Jul 04, 2019 5:43 pm 
Offline

Joined: Mon Jul 01, 2019 9:00 pm
Posts: 20
Kinda strange but here's what happens with msvc2017.

Code:
O2

return (uint8_t)_controllerData[((addr & 0x0E) - 8) >> 1];

mesen-s_libretro.dll+3A2E9 - 83 E2 0E              - and edx,0E { 14 }
mesen-s_libretro.dll+3A2EC - 83 EA 07              - sub edx,07 { 7 }
mesen-s_libretro.dll+3A2EF - D1 FA                 - sar edx,1
mesen-s_libretro.dll+3A2F1 - 8A 44 56 2C           - mov al,[esi+edx*2+2C]
mesen-s_libretro.dll+3A2F5 - E9 B3000000           - jmp mesen-s_libretro.dll+3A3AD



return (uint8_t)(_controllerData[((addr & 0x0E) - 8) >> 1] >> 8);

mesen-s_libretro.dll+3A318 - 8B 45 CC              - mov eax,[ebp-34]
mesen-s_libretro.dll+3A31B - 83 E0 0E              - and eax,0E { 14 }
mesen-s_libretro.dll+3A31E - 83 E8 06              - sub eax,06 { 6 }
mesen-s_libretro.dll+3A321 - D1 F8                 - sar eax,1
mesen-s_libretro.dll+3A323 - 8A 44 46 2D           - mov al,[esi+eax*2+2D]
mesen-s_libretro.dll+3A327 - E9 81000000           - jmp mesen-s_libretro.dll+3A3AD



O2 - printf

return (uint8_t)(_controllerData[((addr & 0x0E) - 8) >> 1] >> 8);

mesen-s_libretro.dll+3A368 - 8B 75 CC              - mov esi,[ebp-34]
mesen-s_libretro.dll+3A36B - 83 E6 0E              - and esi,0E { 14 }
mesen-s_libretro.dll+3A36E - 8D 56 F9              - lea edx,[esi-07]
mesen-s_libretro.dll+3A371 - D1 FA                 - sar edx,1
mesen-s_libretro.dll+3A373 - 0FB7 44 57 2C         - movzx eax,word ptr [edi+edx*2+2C]



Od

return (uint8_t)_controllerData[((addr & 0x0E) - 8) >> 1];

mesen-s_libretro.dll+58463 - 0FB7 45 7C            - movzx eax,word ptr [ebp+7C]
mesen-s_libretro.dll+58467 - 83 E0 0E              - and eax,0E { 14 }
mesen-s_libretro.dll+5846A - 83 E8 08              - sub eax,08 { 8 }
mesen-s_libretro.dll+5846D - D1 F8                 - sar eax,1
mesen-s_libretro.dll+5846F - 8B 4D 54              - mov ecx,[ebp+54]
mesen-s_libretro.dll+58472 - 8A 44 41 2C           - mov al,[ecx+eax*2+2C]
mesen-s_libretro.dll+58476 - E9 E0000000           - jmp mesen-s_libretro.dll+5855B



return (uint8_t)(_controllerData[((addr & 0x0E) - 8) >> 1] >> 8);

mesen-s_libretro.dll+58491 - 0FB7 55 7C            - movzx edx,word ptr [ebp+7C]
mesen-s_libretro.dll+58495 - 83 E2 0E              - and edx,0E { 14 }
mesen-s_libretro.dll+58498 - 83 EA 08              - sub edx,08 { 8 }
mesen-s_libretro.dll+5849B - D1 FA                 - sar edx,1
mesen-s_libretro.dll+5849D - 8B 45 54              - mov eax,[ebp+54]
mesen-s_libretro.dll+584A0 - 0FB7 44 50 2C         - movzx eax,word ptr [eax+edx*2+2C]
mesen-s_libretro.dll+584A5 - C1 F8 08              - sar eax,08 { 8 }
mesen-s_libretro.dll+584A8 - E9 AE000000           - jmp mesen-s_libretro.dll+5855B


Don't know why compiler is so clumsy about that line. :???:


Top
 Profile  
 
PostPosted: Thu Jul 04, 2019 6:12 pm 
Offline

Joined: Sun Feb 07, 2016 6:16 pm
Posts: 724
Well, I guess it was a compiler bug after all! It only happens in 32-bits, too.
I changed the code to simplify it, which should run just a tiny bit faster (not that it really matters) and avoids the compiler bug.

Hopefully things should be working properly on your end now.


Top
 Profile  
 
PostPosted: Thu Jul 04, 2019 6:23 pm 
Offline

Joined: Mon Jul 01, 2019 9:00 pm
Posts: 20
Yes - Thank you for working around all those problems! And I see you've fixed ExHiROM save games. :)

I'll start testing some oddball games and see how it goes.


Top
 Profile  
 
PostPosted: Thu Jul 04, 2019 7:03 pm 
Offline

Joined: Mon Jul 01, 2019 9:00 pm
Posts: 20
Found one.

Kaite Tsukutte Asoberu Dezaemon
-- error = "sram breakdown"


Some searching of byuu's old board
https://151.236.14.55/byuubackup2/viewt ... art=0.html

Code:
board region=ntsc
  rom name=program%26%2346%3Brom size=0x80000
    map address=00-7d,80-ff:8000-ffff mask=0x8000
    map address=40-6f,c0-ef:0000-7fff mask=0x8000
  ram name=save%26%2346%3Bram size=0x20000
    map address=70-7d,f0-ff:0000-7fff mask=0x8000

information
  region: NTSC
  title:  Kaite Tsukutte Asoberu Dezaemon (Japan)
  sha256: 3ddf81cee32dcf7c8df4367bdae5ea1b0af50b7baab54be1c01f6ae6c3e308a6
  note:   heuristically generated by icarus


Top
 Profile  
 
PostPosted: Thu Jul 04, 2019 7:56 pm 
Offline

Joined: Mon Jul 01, 2019 9:00 pm
Posts: 20
Ongaku Tsukuru Kanadeeru (Japan)
-- error: boots at 00:8000 (rom 0x7ffc?). Should be 00:FF00 (rom 0xfffc)??


note: Deleted old post because I thought it was (32-bit compiler) false-positive. But not so sure anymore.

Code:
[libretro INFO] -----------------------------
[libretro INFO] Game: µÝ¶Þ¸Â¸°Ù           
[libretro INFO] Type: HiROM
[libretro INFO] FastROM
[libretro INFO] Map Mode: $31
[libretro INFO] Rom Type: $02
[libretro INFO] File size: 1024 KB
[libretro INFO] ROM size: 1024 KB
[libretro INFO] SRAM size: 32 KB
[libretro INFO] -----------------------------

[libretro INFO] Map [$00:8xxx] to page number 00
[libretro INFO] Map [$00:9xxx] to page number 01
[libretro INFO] Map [$00:Axxx] to page number 02
[libretro INFO] Map [$00:Bxxx] to page number 03
[libretro INFO] Map [$00:Cxxx] to page number 04
[libretro INFO] Map [$00:Dxxx] to page number 05
[libretro INFO] Map [$00:Exxx] to page number 06
[libretro INFO] Map [$00:Fxxx] to page number 07



edit:
I think it's hitting an override? Game's name = B1ZMCJ.

Code:
bool BaseCartridge::MapSpecificCarts(MemoryManager &mm)
{
   string name = GetCartName();
   if(_cartInfo.GameCode[0] == 'Z' && _cartInfo.GameCode[3] == 'J') {
      //BSC-1A5M-02, BSC-1A7M-01
      //Games: Sound Novel Tsukuuru, RPG Tsukuuru, Derby Stallion 96
      MapBanks(mm, _prgRomHandlers, 0x00, 0x3F, 0x08, 0x0F, 0, true);
      MapBanks(mm, _prgRomHandlers, 0x80, 0x9F, 0x08, 0x0F, 0, true, 0x200);
      MapBanks(mm, _prgRomHandlers, 0xA0, 0xBF, 0x08, 0x0F, 0, true, 0x100);
      if(_saveRamSize > 0) {
         MapBanks(mm, _saveRamHandlers, 0x70, 0x7D, 0x00, 0x07, 0, true);
         MapBanks(mm, _saveRamHandlers, 0xF0, 0xFF, 0x00, 0x07, 0, true);
      }
      return true;
   }
   return false;
}


Top
 Profile  
 
PostPosted: Thu Jul 04, 2019 8:47 pm 
Offline

Joined: Mon Jul 01, 2019 9:00 pm
Posts: 20
Dekitate High School (Japan)
-- error: Mash through all the New Game prompts. After you pick the girl, it'll go into story mode. You'll see a black bar flicker on top of the screen after every text box reset.

Looks like 15 pixels for 1 frame with v-crop on. I think it's some dma at 00:9b3d but wouldn't know why.


Top
 Profile  
 
PostPosted: Fri Jul 05, 2019 5:09 pm 
Offline

Joined: Mon Jul 01, 2019 9:00 pm
Posts: 20
Here's few more games but no debugging info.

Battle Grand Prix (USA) = black screen of death after title

-- edit: I guess it's kinda random. Sometimes happens after main menu but after load state sometimes works.



Super Famista 5 (Japan) = there's some "Tokyo Yomiuri Giants" logo screen on boot that doesn't show up on snes9x or bsnes. Don't know what the message says.

-- edit: There's some sram check at 89:806F (lda $701B9E). It's supposed to be 0xFFFF. But it fails the check and shows the (piracy?) splash screen.

What's more hilarious is the sram file saved by Retroarch. It reads:
Code:
0.$.. ..archconfigremapsMesen-S__0.rmp. (Japan).opt.........


which looks nowhere near sram produced by other emus for this game.


Top
 Profile  
 
PostPosted: Fri Jul 05, 2019 7:13 pm 
Offline
User avatar

Joined: Sun Sep 19, 2004 9:28 pm
Posts: 4208
Location: A world gone mad
Screenshots of said messages; we can translate it.


Top
 Profile  
 
PostPosted: Fri Jul 05, 2019 7:15 pm 
Offline

Joined: Sun Feb 07, 2016 6:16 pm
Posts: 724
Alright, so I've re-fixed the IRQ/NMI delay after DMA thing, after realizing I had broken wild guns again.
Turns out I suck at assembly and the test I had written for this was flawed - so edited that to fix it, and implemented the 1 cycle "irq lock" like byuu said and now both games work properly.

Kaite Tsukutte should be fixed - it was a sram mapping issue (added an exception for this one)
Ongaku Tsukuru should also be fixed - changed the code for the exception on the other 3 games to avoid using it for this one.

Super Famista 5 -> The screen says "This cassette is a special version for Yomiuri Giants fans". Which is awfully weird, considering it only seems to show up in the libretro core, not the standalone build. Must be something that's not being initialized properly? (or initialized differently, at least). I'll take a closer look tomorrow.

Battle Grand Prix appears to lock up on a loop reading the hblank/vblank flags in $4212. If I change the timing the flags are set/cleared, it fixes it, but I'm assuming the real issue might be elsewhere since the flags should already be getting set and cleared at the right timing - will have to investigate more.


Top
 Profile  
 
PostPosted: Fri Jul 05, 2019 7:26 pm 
Offline

Joined: Mon Jul 01, 2019 9:00 pm
Posts: 20
Maybe related to Battle Grand Prix? Mesen-S dma timings are slightly off compared to bsnes. And BGP likes to dma during v-blank while that 4212 bpl / bmi loop is running.

Code:
0088d3 php                    A:8000 X:0003 Y:0220 S:1fe2 D:0000 DB:00 nvMxdIZc V:228 H:1286 F:30
0088d4 sep #$20               A:8000 X:0003 Y:0220 S:1fe1 D:0000 DB:00 nvMxdIZc V:228 H:1308 F:30
0088d6 rep #$10               A:8000 X:0003 Y:0220 S:1fe1 D:0000 DB:00 nvMxdIZc V:228 H:1330 F:30
0088d8 lda $55       [000055] A:8000 X:0003 Y:0220 S:1fe1 D:0000 DB:00 nvMxdIZc V:228 H:1352 F:30
0088da and #$04               A:8017 X:0003 Y:0220 S:1fe1 D:0000 DB:00 nvMxdIzc V:229 H:  12 F:30
0088dc beq $8903     [008903] A:8004 X:0003 Y:0220 S:1fe1 D:0000 DB:00 nvMxdIzc V:229 H:  28 F:30
0088de lda #$80               A:8004 X:0003 Y:0220 S:1fe1 D:0000 DB:00 nvMxdIzc V:229 H:  44 F:30
0088e0 sta $2115     [002115] A:8080 X:0003 Y:0220 S:1fe1 D:0000 DB:00 NvMxdIzc V:229 H:  60 F:30
0088e3 ldy #$5000             A:8080 X:0003 Y:0220 S:1fe1 D:0000 DB:00 NvMxdIzc V:229 H:  90 F:30
0088e6 sty $2116     [002116] A:8080 X:0003 Y:5000 S:1fe1 D:0000 DB:00 nvMxdIzc V:229 H: 114 F:30
0088e9 ldy #$1801             A:8080 X:0003 Y:5000 S:1fe1 D:0000 DB:00 nvMxdIzc V:229 H: 150 F:30
0088ec sty $4300     [004300] A:8080 X:0003 Y:1801 S:1fe1 D:0000 DB:00 nvMxdIzc V:229 H: 174 F:30
0088ef ldy #$1700             A:8080 X:0003 Y:1801 S:1fe1 D:0000 DB:00 nvMxdIzc V:229 H: 210 F:30
0088f2 sty $4302     [004302] A:8080 X:0003 Y:1700 S:1fe1 D:0000 DB:00 nvMxdIzc V:229 H: 234 F:30
0088f5 stz $4304     [004304] A:8080 X:0003 Y:1700 S:1fe1 D:0000 DB:00 nvMxdIzc V:229 H: 270 F:30
0088f8 ldy #$0800             A:8080 X:0003 Y:1700 S:1fe1 D:0000 DB:00 nvMxdIzc V:229 H: 300 F:30
0088fb sty $4305     [004305] A:8080 X:0003 Y:0800 S:1fe1 D:0000 DB:00 nvMxdIzc V:229 H: 324 F:30


0088fe lda #$01               A:8080 X:0003 Y:0800 S:1fe1 D:0000 DB:00 nvMxdIzc V:229 H: 360 F:30
008900 sta $420b     [00420b] A:8001 X:0003 Y:0800 S:1fe1 D:0000 DB:00 nvMxdIzc V:229 H: 376 F:30
008903 plp                    A:8001 X:0003 Y:0800 S:1fe1 D:0000 DB:00 nvMxdIzc V:229 H: 406 F:30
008904 rts                    A:8001 X:0003 Y:0800 S:1fe2 D:0000 DB:00 nvMxdIZc V:241 H: 990 F:30


-- Mesen-S:
360, 376, 406, 1002 [-12 = 990]


Top
 Profile  
 
PostPosted: Sat Jul 06, 2019 7:17 am 
Offline

Joined: Mon Jul 01, 2019 9:00 pm
Posts: 20
Super Famista 5: sram is not initialized and has random values.

bsnes default inits 0xff = okay. If you memset with 0x00, you get the special screen.


edit:
For Dekitate High School, I think the screen should be drawing during dma transfer? Mesen-S maybe doesn't do this?

Code:
009b3d sta $420b     [00420b] A:1802 X:0084 Y:efda S:01c1 D:0000 DB:00 nvMxdizc V:240 H: 870 F:42
009b40 rep #$30               A:1802 X:0084 Y:efda S:01c1 D:0000 DB:00 nvMxdizc V:240 H: 900 F:42

009b42 ldx #$1000             A:1802 X:0084 Y:efda S:01c1 D:0000 DB:00 nvmxdizc V: 16 H:  34 F:43
009b45 dex                    A:1802 X:1000 Y:efda S:01c1 D:0000 DB:00 nvmxdizc V: 16 H:  58 F:43


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 252 posts ]  Go to page Previous  1 ... 8, 9, 10, 11, 12, 13, 14 ... 17  Next

All times are UTC - 7 hours


Who is online

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


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group