Author Topic: dink's FBN Development & Fixes thread  (Read 1320602 times)

Offline iq_132

  • Administrator
  • *****
  • Posts: 3732
  • Karma: +411/-0
  • Definitely not Dink!
    • NeoSource
It doesn't look like there is really much hooked up in the save states for m62. Give this a shot. There is still stuff to be hooked up (bank switches), but it's a start at least.

Code: [Select]
static INT32 M62Scan(INT32 nAction, INT32 *pnMin)
{
    struct BurnArea ba;

    if (pnMin != NULL) {
        *pnMin = 0x029709;
    }

    if (nAction & ACB_MEMORY_RAM) {
        memset(&ba, 0, sizeof(ba));
        ba.Data      = RamStart;
        ba.nLen      = RamEnd-RamStart;
        ba.szName = "All Ram";
        BurnAcb(&ba);
    }

    if (nAction & ACB_DRIVER_DATA) {
ZetScan(nAction);
M6803Scan(nAction);

AY8910Scan(nAction, pnMin);
MSM5205Scan(nAction, pnMin));

SCAN_VAR(M62BackgroundHScroll);
SCAN_VAR(M62BackgroundVScroll);
SCAN_VAR(M62CharHScroll);
SCAN_VAR(M62CharVScroll);
SCAN_VAR(M62FlipScreen);
SCAN_VAR(M62SoundLatch);
SCAN_VAR(M62Port1);
SCAN_VAR(M62Port2);
SCAN_VAR(M62SlaveMSM5205VClckReset);
SCAN_VAR(M62BankControl[0]);
SCAN_VAR(M62BankControl[1]);
SCAN_VAR(Ldrun2BankSwap);
SCAN_VAR(Ldrun3TopBottomMask);
SCAN_VAR(KidnikiBackgroundBank);
SCAN_VAR(SpelunkrPaletteBank);
    }

    return 0;
}

I would start moving the bank switches to be routines rather than built in to the writes.

Code: [Select]
        case 0x85: {
            INT32 BankAddress = 0x8000 + ((d & 0x0f) * 0x2000);
            ZetMapArea(0x8000, 0x9fff, 0, M62Z80Rom + BankAddress);
            ZetMapArea(0x8000, 0x9fff, 2, M62Z80Rom + BankAddress);
            return;
        }

to something more like this

Code: [Select]
static void KidnikiBankswitch(int bank)
{
            M62BankAddress0 = 0x8000 + ((bank & 0x0f) * 0x2000);
            ZetMapArea(0x8000, 0x9fff, 0, M62Z80Rom + M62BankAddress0);
            ZetMapArea(0x8000, 0x9fff, 2, M62Z80Rom + M62BankAddress0);

}

...

        case 0x85: {
            KidnikiBankswitch(d);
            return;
        }

that way you can call it later in the scan function
« Last Edit: March 31, 2014, 11:16:24 AM by iq_132 »


Offline dink

  • Administrator
  • *****
  • Posts: 5151
  • Karma: +461/-1
  • pie? I nearly bought one!
Hi iq_132,
Thanks for the input.  I got to that point yesterday, but there is still a problem every couple savestate loads where the sound hangs.  I tried saving even more variables, but no dice... which leads me to believe that something is possibly hung on an irq perhaps?  I found something in pre90s/d_ddragon.cpp's DrvScan that I might look into later today.  I've been thinking about this so much it's been driving me nuts, so I really should take a break before I lose my mind  :eek:  hehe..

best regards,
- dink

Offline dink

  • Administrator
  • *****
  • Posts: 5151
  • Karma: +461/-1
  • pie? I nearly bought one!
Savestate support added for all NMK16 games & the ones I personally tested so far:
Bombjack Twin
Thunder Dragon 2
Twin Action
US AAF Mustang (no music)
Stagger (RedHawk)
Guardian Storm
Fire Hawk
GunNail (no music)
Saboten Bombers
Super Spacefortress Macross

..that's it for today!
best regards,
- dink

Offline dink

  • Administrator
  • *****
  • Posts: 5151
  • Karma: +461/-1
  • pie? I nearly bought one!
Hi guys,
Here's some progress I made this morning before I go out:
Fixed savestate-load crash with Raiden (d_raiden.cpp)
Fixed savestate-load crash with Aero Fighters/Sonic Wings, Turbo Force, Spinal Break & Karate Blazers (d_aerofgt.cpp)
Added savestate capability to the game Kangaroo (for a friend)

I'm aiming for no crashing in any games (guru meditation errors) by the next release of FB Alpha, whenever that might be :)

p.s. starting 2 days ago, patches will be uploaded to the svn instead of linked here as attachments.  If someone outside of the svn wants the patches, let me know and I'll post them here.

best regards,
- dink
« Last Edit: April 01, 2014, 08:56:18 AM by dink »

Offline kenshiro

  • Expert
  • *****
  • Posts: 145
  • Karma: +21/-0
Cool work Dink :)

Offline JacKc

  • FBNeo Dev
  • ******
  • Posts: 1677
  • Karma: +56/-0
  • Hasta la vista, Baby !
Great job Dink !!!


Offline iq_132

  • Administrator
  • *****
  • Posts: 3732
  • Karma: +411/-0
  • Definitely not Dink!
    • NeoSource
Definitely agree!

I really want to overhaul the save state system at some point. I want to start from scratch, but keeping compatibility with the in-driver structures. A target for me is to have the cpu and sound cores automatically register to the save system.
« Last Edit: April 01, 2014, 01:24:41 PM by iq_132 »


Offline dink

  • Administrator
  • *****
  • Posts: 5151
  • Karma: +461/-1
  • pie? I nearly bought one!
Thanks guys :)

Offline dink

  • Administrator
  • *****
  • Posts: 5151
  • Karma: +461/-1
  • pie? I nearly bought one!
Hi guys,
Here's what I've been up to yesterday and today regarding FB Alpha:
The good:
* Fixed the ability to uncheck the Hardware tree under filters (needs more testing before checking in)
* Fixed palette issues in the game Act Fancer (DataEast) on savestate load.  For example, if you die and the screen starts to fade out, and a savestate is loaded while its fading out - the loaded savestate will be faded out -or- you die in level 2 (which uses a different palette) and load a savestate from level1, or vice versa, things will look bad.
...The bad and the ugly:
* Worked some more on the M62 savestate issue, and have come to the following conclusions (using Youjyuden as an example game), on restore of savestate, things go horribly wrong, stuck sound, no sound, resets to the title screen, or the game prints "ROM NG" in the middle of the screen.  At this point I almost rewrote most of the driver, and its driving me bonkers trying to figure it out.  Oh yea, I almost forgot about the conclusions: possible protection in the rom is triggering, M6803Scan() isn't saving everything that it should be saving, maybe a stuck irq issue, and maybe theres a bug or issue in the memory layout. 

Thats it for today :)
best regards,
- dink
« Last Edit: April 03, 2014, 04:01:17 AM by dink »

Offline iq_132

  • Administrator
  • *****
  • Posts: 3732
  • Karma: +411/-0
  • Definitely not Dink!
    • NeoSource
Hi guys,
Here's what I've been up to yesterday and today regarding FB Alpha:
The good:
* Fixed the ability to uncheck the Hardware tree under filters (needs more testing before checking in)
Nice!

Quote
* Fixed palette issues in the game Act Fancer (DataEast) on savestate load.  For example, if you die and the screen starts to fade out, and a savestate is loaded while its fading out - the loaded savestate will be faded out -or- you die in level 2 (which uses a different palette) and load a savestate from level1, or vice versa, things will look bad.

This one may need a revisit.  I would call DrvRecalc = 1; from the save state rather than saving the calculated palette. This doesn't work well if you switch color depths -- say you save the game when using a 32-bit depth and then loading it using a 16-bit depth. If that doesn't work... there may be something else weird going on.


Quote
...The bad and the ugly:
* Worked some more on the M62 savestate issue, and have come to the following conclusions (using Youjyuden as an example game), on restore of savestate, things go horribly wrong, stuck sound, no sound, resets to the title screen, or the game prints "ROM NG" in the middle of the screen.  At this point I almost rewrote most of the driver, and its driving me bonkers trying to figure it out.  Oh yea, I almost forgot about the conclusions: possible protection in the rom is triggering, M6803Scan() isn't saving everything that it should be saving, maybe a stuck irq issue, and maybe theres a bug or issue in the memory layout. 

Thats it for today :)
best regards,
- dink

Nasty... I should take a look tonight.


Offline dink

  • Administrator
  • *****
  • Posts: 5151
  • Karma: +461/-1
  • pie? I nearly bought one!
Hi iq_132,
Thanks for the input on Act Fancer, I checked in a revised patch using your suggestion after testing it a bit :)

re: M62, it usually takes between 1 and 5 state loads before the weirdness happens.

best regards,
- dink

Offline iq_132

  • Administrator
  • *****
  • Posts: 3732
  • Karma: +411/-0
  • Definitely not Dink!
    • NeoSource
Hi iq_132,
Thanks for the input on Act Fancer, I checked in a revised patch using your suggestion after testing it a bit :)

re: M62, it usually takes between 1 and 5 state loads before the weirdness happens.

best regards,
- dink

I'm actually surprised it doesn't automatically set *recalc = 1; on (nAction & ACB_WRITE) in the burn core... :| This may have to change. I really need to get git set up on my pc again (new windows install...)


Offline dink

  • Administrator
  • *****
  • Posts: 5151
  • Karma: +461/-1
  • pie? I nearly bought one!
Things are looking good... :)
Tonight I started working on improving the savestates of the sample-hack Toaplan games - Vimana, FireShark/SameSameSame! etc, and also set the loading status to "Loading samples..." while the game is loading the samples, as it takes a few seconds.
EDIT:
Cleaned up the strange noises / ringing noises at the end of short samples.  (listen closely and insert a coin in ghox, or FireShark with the samples present in support/samples/ to hear what I mean)

EDIT: after doing a ton of playtesting, Toaplan samples hack improvements checked in!  :biggrin:

best regards,
- dink
« Last Edit: April 04, 2014, 11:01:57 AM by dink »

Offline dink

  • Administrator
  • *****
  • Posts: 5151
  • Karma: +461/-1
  • pie? I nearly bought one!
Just a bit of blurb... *I figure its at least worth documenting. :) *
Last night I played a game of FixedEight (Toaplan GP9001) and got to level 2 and a half, saved the state and quit.
Today I tried loading the state, and it hangs after drawing the screen & playing 1 note - investigating....  Going to try scanning a couple extra variables, like v25_reset, perhaps (if I can reproduce it again).  The only problem is, I've tried to reproduce it 3 times now, and it won't hang.  ...and I accidentally overwrote the state that hung while testing/etc.   :redface:

best regards,
- dink
« Last Edit: April 04, 2014, 05:36:03 PM by dink »

Offline dink

  • Administrator
  • *****
  • Posts: 5151
  • Karma: +461/-1
  • pie? I nearly bought one!
Blurb part 2, but different emulation:
Theres another intermittent issue that has been bugging me (pun intended) is with the NeoGeo emulation, today it happened twice - I'll be playing a game, say, Strikers 1945 Plus or Sengoku and saving states every minute or so (incase I screw up).  So, I screw up for maybe the 10th time, and all is going well so far, but this time, it crashes with a Guru Meditation error when loading the state.  I fire up gdb and get a backtrace and the crash is in LoadRoms(), which is somehow being called during the state-loading process..  The backtrace is almost useless, and I can't find the path taken to get to LoadRoms() when loading the savestate.  Any ideas?
Code: [Select]
Program received signal SIGSEGV, Segmentation fault.
0x008ea928 in LoadRoms() ()
(gdb) bt
#0  0x008ea928 in LoadRoms() ()
#1  0x007fd416 in SekReset() ()
#2  0x004201e4 in m68ki_write_16_fc (value=0, fc=<optimized out>,
    address=<optimized out>) at src/cpu/m68k/m68kcpu.h:1098
#3  m68k_op_move_16_ai_i () at obj/47/3s/dep/generated/m68kopdm.c:7144
#4  0x00401f1c in m68k_execute (num_cycles=18381)
    at src/cpu/m68k/m68kcpu.c:715
#5  0x007fce88 in SekRun(int) ()
#6  0x008ef917 in NeoFrame() ()
#7  0x007c7958 in BurnDrvFrame ()
#8  0x009df188 in RunFrame(int, int) ()
#9  0x009df274 in RunGetNextSound(int) ()
#10 0x009df354 in RunIdle() ()
#11 0x00a6f875 in DxSoundCheck() ()
#12 0x00a066e6 in AudSoundCheck() ()
#13 0x009df35e in RunIdle() ()
#14 0x009dfbf7 in RunMessageLoop() ()
#15 0x009cefcc in WinMain@16 ()
#16 0x00af282e in main (argc=Cannot access memory at address 0x6c0
) at ../mingw/main.c:73
(gdb) q

I attached the said savestate for Strikers 1945Plus, hoping that someone with a better debugger can try loading it and try to get a little more info as to where/why this crash is happening.

best regards,
- dink