DiztinGUIsh icon indicating copy to clipboard operation
DiztinGUIsh copied to clipboard

get tracelog import working for other CPUs (like SA-1)

Open binary1230 opened this issue 3 years ago • 0 comments

tracelog file import and, separately, tracelog capture (bsnes --> Diz over a socket) work and are well tested for the main SNES CPU, but not really implemented for the other CPUs (like SA-1)

Here's what we'd need to do to fix that:

  1. Add the SA-1 CPU to the list of CPUs in the Architecture enum here: https://github.com/Dotsarecool/DiztinGUIsh/blob/master/Diz.Core/model/Enums.cs#L61

  2. Each line of a tracelog file is parsed by BsnesTraceLogImporte.ParseLine() https://github.com/Dotsarecool/DiztinGUIsh/blob/master/Diz.Core/import/BsnesTraceLogImporter.Parsers.cs#L55

For SA-1, we'd need to verify that it's capturing the same data, or build an SA-1 specific parser (should be pretty easy)

That parser is populating a ModificationData object (it's one object per line in the tracelog). The only thing that would need to be changed is adding the Architecture enum in there and marking it as from SA-1 like this:

// something like...
modData.arch = CPU_SA1; // add the 'arch' field there, set it to the new enum

That 'arch' field would need to be added here: https://github.com/Dotsarecool/DiztinGUIsh/blob/master/Diz.Core/import/BsnesTraceLogImporter.ModificationsList.cs#L15

That's pretty straightforward though there's a little bit of extra checking/etc to pay attention to since ModificationData is heavily optimized for doing the tracelog network capturing.

  1. unit tests If anything's different, grab a couple lines from a tracelog from SA-1, and write a unit test or two to cover it: https://github.com/Dotsarecool/DiztinGUIsh/blob/862e32f93d27bf9c545f147b4ed0c43c3a38bc81/Diz.Test/Tests/TracelogTests/TraceLogTests.cs#L8

  2. UI: Probably add a new option to the Import menu so it has separate items for 'import SA1 tracelog' vs 'import 65816 main cpu tracelog'. If we wanted to get fancier we could setup a dialog box that has some nicer looking options. eh, later.

Somewhere on the BSNES tracelog import class is where we can stash which type of byte we're capturing.

It can all be traced pretty easily by looking at the on click handler in importBsnesTracelogText_Click()

  1. UI: this is optional but, it might be a good idea to change the background color (or whatever) for bytes marked as SA1 so it's obvious visually. Easiest place is in here: https://github.com/Dotsarecool/DiztinGUIsh/blob/master/DiztinGUIsh/window/MainWindow.MainTable.cs#L228

That function takes a (hardcoded...woof) column number and the index of the row (i.e. the snes byte address).

You can get to the arch like this:

// in there, something vaguely like....
style.ForeColor = Data.GetArchitecture(offset) == Architecture.SA1 ? Color.Gray : Color.Black;
  1. test : )

I haven't tested Diz when it has different architectures in there. theoretically should be OK, but, might be worth doing some CPU step operations, mark operations, etc especially on boundaries of bytes where things go from one CPU into another.

binary1230 avatar May 15 '21 17:05 binary1230