Posts for Alyosha

Alyosha
He/Him
Editor, Emulator Coder, Experienced Forum User, Published Author, Expert player (3830)
Joined: 11/30/2014
Posts: 2834
Location: US
By mGBA suite I mean this one: https://github.com/mgba-emu/suite which has many many tests in one ROM, testing many aspects of the GBA. More generally, there are many suites of GBA tests scattered around. Some of them are represented here: https://emulation.gametechwiki.com/index.php/GBA_Tests but there are others. By running them manually I assume you mean as opposed to some automated process, then yes. I'm also aware that my documentation of any of this is poor to non-existent, but there's always just too much to do.
Alyosha
He/Him
Editor, Emulator Coder, Experienced Forum User, Published Author, Expert player (3830)
Joined: 11/30/2014
Posts: 2834
Location: US
I've been pretty busy lately, but I'm still trying to make progress where I can. Recently I became aware of some relatively new tests: https://github.com/hades-emu/Hades-Tests Turns out GBAHawk was failing several of them, but for relatively simple reasons. I fixed those up (but one of them fails on hardware, dma latch test 4, so that one will remain failing, I opened an issue about it.) Also recently many new tests were added to the mGBA test suite, mainly focused on the serial port. I fail most of those for some reason, I think for them to work I need to have a link cable plugged in but not connected to a second GBA, maybe, I haven't had time to look into any of the details. Serial port is still low priority (its good enough for pokemon coop diploma, and that's probably one of the only use cases), so I'll kick that can down the road. More interestingly, there is a ppu background display test that fails. I thought I had that pretty well nailed down so I was pretty surprised it wasn't quite right. Anyway always more to do.
Alyosha
He/Him
Editor, Emulator Coder, Experienced Forum User, Published Author, Expert player (3830)
Joined: 11/30/2014
Posts: 2834
Location: US
CDRomatron wrote:
Was not sure, so I've gone through and checked. I've tried clearing the save ram on both, copying the cart save to GBAHawk, copying the GBAHawk save to the cart, and 0xFF the whole save on both, neither seem to change the seed I reach the minigame at.
Interesting. Can you send me the movie file and the time stamps you use?
Alyosha
He/Him
Editor, Emulator Coder, Experienced Forum User, Published Author, Expert player (3830)
Joined: 11/30/2014
Posts: 2834
Location: US
CDRomatron wrote:
Thanks for the quick response and suggestion. I've so far tried setting it to 10000, 20000, and 32000, none of which seem to change the frame it arrives at as the RNG is the same across all three. It's just the option titled "EEPROM Offset"? (I've been changing it manually in the SyncSettings.json to get to the point where I can test it.)
Does your movie start from cleared cart RAM? If so, do you clear cart RAM on your cartridge to 0xFF before replaying on console? Yeah the EEPROM Offset is the only setting you should need to change.
Alyosha
He/Him
Editor, Emulator Coder, Experienced Forum User, Published Author, Expert player (3830)
Joined: 11/30/2014
Posts: 2834
Location: US
CDRomatron wrote:
Hi, was recommended coming along here from Discord. I'm trying to start on a little project to do some learning. A big goal for me was being able to run the TAS on console, since I had all the hardware I would need to run through GBI. The game is Spyro Fusion, saves with EEPROM. I've been using GBAHawk 2.2.0, and have verified that my dumps match what they should be in terms of the bios and game. The game rarely advances RNG, which makes manipulation trivial in most instances, except for a singular minigame that appears approx. 3 mins into gameplay. The RNG function uses the current frame count to seed it when starting the minigame, so I need to know what frame I've entered the minigame. On GBAHawk, I've seen the value I get, and the starting position of the enemy (which gives me an idea of where I am). On console, the same inputs give me a different starting position. After playing around on GBAHawk, it appears like the console is entering 4 frames later than emulator. My suspicion at the moment is due to the game doing occasional auto-saves with EEPROM. I understand that there is a sync option for tuning, which might solve my problem. But I'm unsure where to start with it (as the range is ~64k possible options). Does anyone have any suggestions based on the situation? Thanks in advance.
I would start around 10000. Unfortunately EEPROM timings vary widely, it's a bit of a process to tune them.
Alyosha
He/Him
Editor, Emulator Coder, Experienced Forum User, Published Author, Expert player (3830)
Joined: 11/30/2014
Posts: 2834
Location: US
It may be possible to significantly improve the run in the future when subframe resets become possible.
If you are interested, subframe resetting is available in GBAHawk, though I haven't tested it in a while, but I'm pretty sure it's in working order.
Alyosha
He/Him
Editor, Emulator Coder, Experienced Forum User, Published Author, Expert player (3830)
Joined: 11/30/2014
Posts: 2834
Location: US
GoddessMaria wrote:
Do you need an authentic Emerald or LeafGreen cart to do testing?
Well as long as the run doesn't save I don't need it, the run should work for any cart as long as no saves or autosaves happen. But otherwise yes I would need one (I don't have one and I'm not willing to pay ~$200 for one to buy it myself, what's with these crazy prices?) Although with 2.2.0, people can tune runs to their personal carts, so there isn't a need for me in particular to do it, and I think emulation is otherwise accurate enough for a new run to sync on console (of course, testing as you go is recommended.) Pokemon is probably the last run of interest for console verification, so I'm willing to help in whatever way is needed for it to happen. Side note: I heard back from Epilogue and they say Mario Kart save loading will be supported in an upcoming software patch, so eventually that one will be done too.
Alyosha
He/Him
Editor, Emulator Coder, Experienced Forum User, Published Author, Expert player (3830)
Joined: 11/30/2014
Posts: 2834
Location: US
With GBAHawk 2.2.0 released, I added check marks to DKC 2 and Super Metroid GBA. At the moment there are no remaining runs to check for games that I have carts for, so, I guess that's all for now.
Alyosha
He/Him
Editor, Emulator Coder, Experienced Forum User, Published Author, Expert player (3830)
Joined: 11/30/2014
Posts: 2834
Location: US
GBAHawk 2.2.0 is released, with implementation of Flash chip type selection and manual timings. This also includes the accuracy improvements for DKC 2 and Super Metroid GBA. Next thing to work on is GBP detection / emulation, which is disabled in this release, but all the wiring is done, I just need to understand the commands. Aside from that the only major upgrade I want to make is finishing implementing the LDM^ glitch. Just bug fixing after that.
Alyosha
He/Him
Editor, Emulator Coder, Experienced Forum User, Published Author, Expert player (3830)
Joined: 11/30/2014
Posts: 2834
Location: US
No luck resyncing Gunstar Super Heroes or Lady Sia to GBAHawk.
Alyosha
He/Him
Editor, Emulator Coder, Experienced Forum User, Published Author, Expert player (3830)
Joined: 11/30/2014
Posts: 2834
Location: US
Not sure about emerald, but on saphire the order goes : timer start Flash chip check halt is sued on copyright screen So, as long as RNG isn't used before the copyright screen, the chip check shouldn't matter if it takes less than a frame. And it seems the check doesn't do much more than check the ID, so halt should be able to sync everything up. At least in Sapphire
Alyosha
He/Him
Editor, Emulator Coder, Experienced Forum User, Published Author, Expert player (3830)
Joined: 11/30/2014
Posts: 2834
Location: US
CasualPokePlayer wrote:
Makes more sense. Starting at 225 means it takes 163 scanlines to get to the second frame, 65 scanlines less than the typical 228 total scanlines. I would assume me offsetting by an entire frame more just worked due to how Pokemon polls inputs (once at the start of the main loop, which normally at the beginning of vblank).
Correct. And even though timing tests give 65, I do occasionally have to apply -1 to the GBI inputs if inputs are being polled really close to the start of vblank, so maybe there is a slight offset to when GBi applies inputs and the original -83776 is closer to the precise value that should be used.
Alyosha
He/Him
Editor, Emulator Coder, Experienced Forum User, Published Author, Expert player (3830)
Joined: 11/30/2014
Posts: 2834
Location: US
CasualPokePlayer wrote:
That still doesn't make much sense? Startup timing tests indicate that input would be polled sooner on console than emulator? Is it GBI somehow being late with its internal timestamp tracking? (by ~20 PWM frames???) Keep in mind by "1 frame back" I meant I just set the starting cycle from 0 to -CYCLES_PER_FRAME.
Based on my testing, the first frame after power up is shorter. A test called music4.gba, show that the ppu must start either at scanline 161 or 225 (GBAHawk starts at 225, which is where the 65 comes from.) With this timestamps for GBI line up (roughly) with vblank boundaries, which is noticeable when testing games that sample input close to the start of vblank. I imagine this was noticed by whoever put -83776 in the original script as well (1232*65 = 80080 which is pretty close.)
Alyosha
He/Him
Editor, Emulator Coder, Experienced Forum User, Published Author, Expert player (3830)
Joined: 11/30/2014
Posts: 2834
Location: US
CasualPokePlayer wrote:
I already had the cycles per frame add set to the end of the movie. The subtraction of the frame is after that change. (in fact, you have some weird -1232 * 65 offset already? Which doesn't make much sense)
Interesting, well I'll eventually get to Pokemon but I doubt it got the right RNG by chance. That value comes from start up timing tests. Similar to how the tas.bot script has cycle = -83776.
Alyosha
He/Him
Editor, Emulator Coder, Experienced Forum User, Published Author, Expert player (3830)
Joined: 11/30/2014
Posts: 2834
Location: US
Here's the current loop I use, which is also a modified version of that script:
cycle = -1232 * 65
#cycle = 0
with open("GBItimestamps.txt", "w") as f:
  for line in inputs:
    sline = line.decode().rstrip()
    if sline[0] == "|":
      data = sline[:-1]
      data = data[1:]
      #data = data[25:]
      if data != lastInput:
        if cycle < 0:
          f.write(f"{0:08X} {convert_frame(data):04X}\n")
        else:
          #sometimes need a -1 here, depends on timing of inputs per game
          f.write(f"{cycle//4096:08X} {convert_frame(data):04X}\n")
      lastInput = data
      cycle += CYCLES_PER_FRAME
The most important difference is that cycle_per_frame are added last, which explains why you had to subtract one frame worth of timing. I don't remember actually making that change, but I think it is correct since input should occur at the start of the current frame.
Alyosha
He/Him
Editor, Emulator Coder, Experienced Forum User, Published Author, Expert player (3830)
Joined: 11/30/2014
Posts: 2834
Location: US
What script did you use to dump the inputs?
Alyosha
He/Him
Editor, Emulator Coder, Experienced Forum User, Published Author, Expert player (3830)
Joined: 11/30/2014
Posts: 2834
Location: US
jlun2 wrote:
I'm not sure if it was asked here, but are the Pokemon runs console verifiable? I'm especially interestested in the ACE ones.
I don't see why not, it should be just a matter of characterizing cart timings.
Alyosha
He/Him
Editor, Emulator Coder, Experienced Forum User, Published Author, Expert player (3830)
Joined: 11/30/2014
Posts: 2834
Location: US
jlun2 wrote:
Wow, that's incredible! How hard was it to resync it? Was it mostly add/remove frames?
It was easy, just adding frames for loading times, which is trivial with RetroEdit's resync script. It seems most GBA games are merciful when it comes to RNG, most runs even from VBA are resyncable.
Alyosha
He/Him
Editor, Emulator Coder, Experienced Forum User, Published Author, Expert player (3830)
Joined: 11/30/2014
Posts: 2834
Location: US
Cool run. I admire your dedication in being able to keep redoing things and still finish the TAS. After dialing in EEPROM timing and resyncing to GBAHawk I was able to console verify this: Link to video
Alyosha
He/Him
Editor, Emulator Coder, Experienced Forum User, Published Author, Expert player (3830)
Joined: 11/30/2014
Posts: 2834
Location: US
Thank you Alyosha, that's great! What did you have to do to resync the video for console verification?
I just changed the console mode in the sync settings in the bk2 to GBA mode, then deleted frames until it synced.
Alyosha
He/Him
Editor, Emulator Coder, Experienced Forum User, Published Author, Expert player (3830)
Joined: 11/30/2014
Posts: 2834
Location: US
I was able to console verify this: Link to video
Alyosha
He/Him
Editor, Emulator Coder, Experienced Forum User, Published Author, Expert player (3830)
Joined: 11/30/2014
Posts: 2834
Location: US
I tried console verifying this but I am unable to load SRAM to my cart for some reason (even though it saves fine on console.) I was at least able to verify the first cup with clean SRAM: Link to video It seems flash timings are wrong at the saving part, so only the first cup worked. I don't want to damage my cart so I won't do any more testing until I can access the SRAM properly. Anyway cool run.
Alyosha
He/Him
Editor, Emulator Coder, Experienced Forum User, Published Author, Expert player (3830)
Joined: 11/30/2014
Posts: 2834
Location: US
CasualPokePlayer wrote:
Flash ID checking would end up taking differing amounts of time depending on flash ID returned, so that could be useful for letting the user select it regardless.
Oh yeah, I forgot about that. Why can't it just be simple.
Alyosha
He/Him
Editor, Emulator Coder, Experienced Forum User, Published Author, Expert player (3830)
Joined: 11/30/2014
Posts: 2834
Location: US
CasualPokePlayer wrote:
By "same chip as in Pokemon" do you mean you checked by unscrewing your own cartridge? Flash 1MB chips come from potentially 2 different manufacturers, Sanyo and Macronix (the latter being more common iirc?). The Pokemon RTA community has noted Sanyo chips apparently are much faster than Macronix chips.
Yes I unscrewed them and I have Macronix in both my carts. I don't know how much effort I should put (or want to put) into characterizing flash timings my manufacturer vs just having a user settable range big enough to cover the possibilities. It seems like the latter option is probably better, knowledgeable users can fill in the correct values.
Alyosha
He/Him
Editor, Emulator Coder, Experienced Forum User, Published Author, Expert player (3830)
Joined: 11/30/2014
Posts: 2834
Location: US
Link to video After carefully tuning Flash timing parameters to match my cart, I was able to verify a resync of SMB3. I did not have to otherwise add any lag frames, and I starrted from clear SRAM, so emulation seems correct there. I also disabled GBP detection. I had to use very large parameters for flash timing, 1500000 cycles for a sector erase compared to ~350000 I used for Sonic. The chip in SMB3 is the same one as in pokemon, so maybe I need different defaults for those but I can't seem to find a data sheet that is an exact match. Anyway the sync settings for manual flash timing will be included in the next release. I'll try to do all levels this weekend.