Former player
Joined: 11/25/2009
Posts: 77
Dang, well, okay. I went to work at it again. Cutting the MC file in half did the trick. To my surprise I was able to reproduce it in Mednafen now (on the first try even, hahah). But I've experienced the issue with multiple saves on Bizhawk, so I'm not exactly sure what to think of all this. Guess I'll keep testing Mednafen to see if it maybe it has to do with the saving procedure?
Editor, Emulator Coder
Joined: 8/7/2008
Posts: 1156
You should be thinking "this is a bug in mednafen, not bizhawk. I just need to prove it"
Former player
Joined: 11/25/2009
Posts: 77
Well, I think you're right. Made a couple of new saves with Mednafen and tested loading them a few times and I can still reproduce it. Sorry I wasted your time.
Editor, Emulator Coder
Joined: 8/7/2008
Posts: 1156
write up the most concise and short mednafen-only repro steps you can and maybe ryphecha will take a look. You just die and reload repeatedly til it hangs?
Former player
Joined: 11/25/2009
Posts: 77
No, actually - as I mentioned in the edits in a previous post, it turns out it happens at random. Getting game over first is not necessary to reproduce it after all. Just: - Use Mednafen version 0.9.38.7 - Make sure you have a save on a memory card - Go to "load game" and load a save - The screen should fade to black once the "now loading..." text goes away. It may hang either before any further text appears or after the text "good luck..." goes away - If it loaded properly, press Select and go to "reset" to reset the game and try again
Editor, Emulator Coder
Joined: 8/7/2008
Posts: 1156
just to be clear, you can close mednafen and reopen it, or use the in-game reset option; both could result in it hanging? can you possibly get a savestate (in mednafen) after your last button press before it hangs? it shouldnt take many tries, right? The goal is to get a savestate that's doomed to hang, but before the screen stops fading out. Which mednafen version?
Former player
Joined: 11/25/2009
Posts: 77
I simplified the steps, check the previous post again please. I was able to reproduce it in the main hall now, too.
zeromus wrote:
it shouldnt take many tries, right?
It can take up to 10-20 tries. Although, since it's appears to be totally random, maybe 50, maybe 100. But in my attempts it's happened typically at least once within 20 tries I'd say.
zeromus wrote:
Which mednafen version?
Still Mednafen version 0.9.38.7.
zeromus wrote:
just to be clear, you can close mednafen and reopen it, or use the in-game reset option; both could result in it hanging?
Yes, both methods can result in hanging.
Editor, Emulator Coder
Joined: 8/7/2008
Posts: 1156
eh, sorry. sounds good, this seems like an actionable bug report. thanks for tracking it down.
Former player
Joined: 11/25/2009
Posts: 77
zeromus wrote:
can you possibly get a savestate (in mednafen) after your last button press before it hangs? it shouldnt take many tries, right? The goal is to get a savestate that's doomed to hang, but before the screen stops fading out.
I was on the verge of giving up after trying to get a save state for nearly an entire hour, but at last I managed!! It felt much harder to reproduce now because making save states directly after loading (confirming) seemed to interfere with the natural order, so to speak. Anyway, I sure hope this will be of some use. Memory Card: Resident Evil 2 (USA) (Disc 1).f671973b24cf4387bc42a59af197f134.0.mcr Save state: Resident Evil 2 (USA) (Disc 1).f671973b24cf4387bc42a59af197f134.mc0
ehw
Other
Joined: 4/22/2016
Posts: 6
Hope this is the right place to put this. I don't see many posts about BizHawk's CDL (Code Data Logger). But I found a few bugs with it, as far as Megadrive games go. All these bugs were caused with version 1.11.6. Certain Megadrive games crash BizHawk when CDL is Active. Here are some games that were giving me problems and the conditions for causing the crashes. Sonic the Hedgehog 3 (U): While in a level, press start to pause the game, then press start again to unpause. This will cause BizHawk to instantly crash with the following message:
System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at BizHawk.Emulation.Cores.Consoles.Sega.gpgx.GPGX.CDCallbackProc(Int32 addr, CDLog_AddrType addrtype, CDLog_Flags flags)
   at BizHawk.Emulation.Cores.Consoles.Sega.gpgx.LibGPGX.gpgx_advance()
   at BizHawk.Emulation.Cores.Consoles.Sega.gpgx.GPGX.FrameAdvance(Boolean render, Boolean rendersound)
   at BizHawk.Client.EmuHawk.MainForm.StepRunLoop_Core(Boolean force)
   at BizHawk.Client.EmuHawk.MainForm.ProgramRunLoop()
   at BizHawk.Client.EmuHawk.Program.SubMain(String[] args)
When CDL is deactivated, BizHawk will not crash if you pause/unpause. Sonic 3D Blast (UE): While in a level, pause and unpause the game with the start button and BizHawk will crash with the following error:
System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at BizHawk.Emulation.Cores.Consoles.Sega.gpgx.GPGX.CDCallbackProc(Int32 addr, CDLog_AddrType addrtype, CDLog_Flags flags)
   at BizHawk.Emulation.Cores.Consoles.Sega.gpgx.LibGPGX.gpgx_advance()
   at BizHawk.Emulation.Cores.Consoles.Sega.gpgx.GPGX.FrameAdvance(Boolean render, Boolean rendersound)
   at BizHawk.Client.EmuHawk.MainForm.StepRunLoop_Core(Boolean force)
   at BizHawk.Client.EmuHawk.MainForm.ProgramRunLoop()
   at BizHawk.Client.EmuHawk.Program.SubMain(String[] args)
(coincidentally, these two games use the same sound driver) Mickey Mania: Activate CDL when the game is launched. As soon as the Title Screen appears and the music begins to play, BizHawk will crash with the following message:
System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at BizHawk.Emulation.Cores.Consoles.Sega.gpgx.GPGX.CDCallbackProc(Int32 addr, CDLog_AddrType addrtype, CDLog_Flags flags)
   at BizHawk.Emulation.Cores.Consoles.Sega.gpgx.LibGPGX.gpgx_advance()
   at BizHawk.Emulation.Cores.Consoles.Sega.gpgx.GPGX.FrameAdvance(Boolean render, Boolean rendersound)
   at BizHawk.Client.EmuHawk.MainForm.StepRunLoop_Core(Boolean force)
   at BizHawk.Client.EmuHawk.MainForm.ProgramRunLoop()
   at BizHawk.Client.EmuHawk.Program.SubMain(String[] args)
Some other things about the CDL that I noticed weren't quite right: -Some games use Z80 sound drivers to play music and sound. In the event that they do, the CDL doesn't identify data that's parsed by the Z80 processor. Examples of games that use Z80 sound drivers are Castle of Illusion, World of Illusion, Quackshot, etc. Games that use 68k sound drivers like Sonic 1, Moonwalker, and Streets of Rage parse the sound data with the 68000 and will be identified by BizHawk when CDL is activated. BizHawk should attempt to identify any data that's accessed by the Z80 processor if possible. -The "Disassemble" option doesn't produce a working output for any system. I noticed the code for the feature was marked "TODO" in the source, so hopefully someone gets around to supporting this someday. A great feature would be to export CDL files right to .idc scripts for IDA Pro. I wrote a python script to do this for me, but it'd be a nice BizHawk feature too. -While on the topic of new features, it'd be great if BizHawk could "predict" possible code/data paths or when things are specifically used as offsets or jump tables like Exodus Emulator can.
Editor, Emulator Coder
Joined: 8/7/2008
Posts: 1156
Regarding the bug, I just fixed it, but it will take some time to get released. Games which accessed z80 address 2xxx and 3xxx crashed it due to a typo on the C side. Regarding z80 sound drivers in CDL, I don't understand. I just ran castle of illusion and watched it log a bunch of Z80 data and code. You'll have to explain in more detail what's wrong. Oh, wait, do you mean that you can't see it accessing MD Cart through the main bus window?? I expected that to work but I didn't know how to test it. But I did write "special memory maps are hard to support here" and abort in case the game is using an unusual memory mapper, maybe that accidentally takes place all the time. There's a guy working on an .idc script for gameboy at least. I think he'd like to do it for other platforms. That's what motivated this work on the CDL in bizhawk. It's a long term project. I'm not real eager to do something in bizhawk that youve already dont yourself with a script, it's a more efficient use of time to do things you can't do yourself easily. From what I understand, using CDL data to get something setup in idapro is a bit of a creative process, but at any rate, I'll be glad to integrate any c# code you have to do it. The disassemble option is there and marked todo I think because originally it was implemented for the one platform we had CDL for, which was.. gameboy I think. Anyway it's obviously junk compared to the idapro solution. Finally regarding advanced code flow analysis... don't expect any of us to ever do that. It's too detailed. You can dive into the C code and work on it yourself.
ehw
Other
Joined: 4/22/2016
Posts: 6
Thanks for fixing the bug. :P Yep, that's what I meant. BizHawk identifies Z80 data in Z80 RAM understandably, but the actual sound data isn't being identified in the MD CART segment. Sound data seems to usually only be identified in games that use the 68k processor itself to play the sound data. I'm not really great in C#, so I do most of my stuff with Python. I can share the scripts I made for MD and SMS/GG .CDL files. Grab them here (excuse the bad code, never intended to share this so most of it is experimental but it does what it needs to do): http://pastebin.com/vTuFtUJT <- md_cdl2idc.py http://pastebin.com/23VjEGUW <- smsgg_cdl2idc.py The concept is pretty simple. I first start off the idc script with "init_idc", which adds the include and main function necessary for the idc script to work (I also add some lines that create the necessary segments in IDA, but some of this is not necessary). Then it calls "parse_cdl", which calculates the size of the first segment (the "MD CART" segment) by using the size of the CDL file header (which seems to be always fixed) as the start position of the loop and the string of the next segment as my stopper. After getting the size of the MD CART segment, I can just use the size of each segment header and the max size of the RAM segments to go through the other segments. For each segment, I compare each byte of the CDL file with the flags BizHawk uses to denote code/data and depending on what the flag is, adds a "MakeCode" or "MakeData" command in the output file idc script for the current address in the file. When I reach the end of the segment, I move on to the next. When I go through all the segments in the CDL file, I add the closing bracket to the idc output file stream and end the program. I added a counter just to see how many bytes were code/data/z80 etc. There are probably a million different ways that are better, but this was the most obvious one for me personally. Although I'm not sure if the SMSGG one is working correctly due to the fact I hadn't thought about how IDA Pro treats ROM banks. But I know the Megadrive one is working great. EDIT: I tested the new commit and BizHawk is still crashing in the same spots but without an error.
Editor, Emulator Coder
Joined: 8/7/2008
Posts: 1156
ehw wrote:
BizHawk identifies Z80 data in Z80 RAM understandably, but the actual sound data isn't being identified in the MD CART segment.
Fixed. You should visit #fceu on freenode where cah4e3 lurks, perhaps you two can collaborate on cdl -< ida scripts
NhatNM
He/Him
Experienced player (719)
Joined: 6/17/2009
Posts: 600
Location: Vietnam
my friend got error when try run BizHawk http://i.imgur.com/MEnJBjj.png What should he do?
A man come from Vietnam My YouTube: https://www.youtube.com/c/NhatNM/playlists
Editor, Expert player (2372)
Joined: 5/15/2007
Posts: 3940
Location: Germany
My experience was that you need to get more windows updates.
Editor, Emulator Coder
Joined: 8/7/2008
Posts: 1156
install the visual c++ 2015 redistributable (x86) instead of x64 only. It would have come with our redistributable installer and been installed automatically. I suppose now that I see this, I should have written x64 in the Prerequisites Missing! dialog. I'll do that soon. Mugg, the more windowsupdates you had to get when we added the msvcrt 2015 dep have since been added to the prereq installer
NhatNM
He/Him
Experienced player (719)
Joined: 6/17/2009
Posts: 600
Location: Vietnam
Thanks zeromus, it's work on my friend
A man come from Vietnam My YouTube: https://www.youtube.com/c/NhatNM/playlists
Alyosha
He/Him
Editor, Emulator Coder, Expert player (3828)
Joined: 11/30/2014
Posts: 2834
Location: US
https://github.com/TASVideos/BizHawk/issues/487 I believe I solved this issue with Little Ninja Brothers (E) cpu_sequence_PAL in NES.CORE.cs should be 3,3,3,3,4 not 4,3,3,3,3 The clock on PAL NES is divided into 3.2 PPU clocks per CPU clock, so we would expect the extra full PPU cycle to appear on the last CPU cycle, not the first. With this change there is no shaking. This also has impact on Corvette ZR-1 Challenge but looks like other timing issues are still effecting that one. EDIT: The other cart mentioned in that issue report, Pro Action Replay (E), appears to not be properly recognized as PAL. When I use the manual override to set it to PAL there is no shaking in that one, even in the current version of BizHawk.
Alyosha
He/Him
Editor, Emulator Coder, Expert player (3828)
Joined: 11/30/2014
Posts: 2834
Location: US
Hurray! After staring at the code for way longer then it should have taken, I finally found the fix to Corvette zr1 Challenge. It turns out the culprit is this bit of code right here (line 304 in NES.Core.cs)
cpu_step &= 31;
This does not properly cycle through the CPU timing sequence. The correct code should be:
if(cpu_step == 5) cpu_step=0;
This also means you only need 1 iteration of the sequence. (3,3,3,3,4) , not the current 40 long one. Making this change fixes the graphics.
ALAKTORN
He/Him
Former player
Joined: 10/19/2009
Posts: 2527
Location: Italy
How do you not have the “Emulator coder” title yet?
Editor, Skilled player (1825)
Joined: 8/25/2013
Posts: 1200
ALAKTORN wrote:
How do you not have the “Emulator coder” title yet?
^
effort on the first draft means less effort on any draft thereafter - some loser
Site Admin, Skilled player (1255)
Joined: 4/17/2010
Posts: 11495
Location: Lake Char­gogg­a­gogg­man­chaugg­a­gogg­chau­bun­a­gung­a­maugg
Steps required: having commits in the official release <- making commits <- getting commit ability <- hanging on IRC.
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
Editor
Joined: 3/31/2010
Posts: 1466
Location: Not playing Puyo Tetris
feos wrote:
Steps required: having commits in the official release <- making commits <- getting commit ability <- hanging on IRC.
Give my title then! I honestly, don't think I have earned that title myself. But, I have met the requirements for said title.
When TAS does Quake 1, SDA will declare war. The Prince doth arrive he doth please.
Site Admin, Skilled player (1255)
Joined: 4/17/2010
Posts: 11495
Location: Lake Char­gogg­a­gogg­man­chaugg­a­gogg­chau­bun­a­gung­a­maugg
Not up to me, even though I technically can. The point though is not "everyone who goes through these steps automatically gets the rank", but "you can't get it without them".
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
Joined: 4/22/2014
Posts: 59
Location: United Kingdom
Found a bug with save states; in Sonic the Hedgehog 2, the 2 Player VS mode split-screen completely messes up when you save a state during the mode and then reload. This also happens with rewinding. Before: After:

1734980043