Page 1 of 1

Can C# access USB2SNES WRAM?

Posted: Mon Feb 04, 2019 5:12 pm
by Eatitup86
I am wondering if the USB2SNES interface allows for direct access to the WRAM on a running game?

I know you can read and alter the data within the included Memory Viewer application but everything I have seen that interfaces with it uses some janky web connection socket that often results in erratic behavior from the application itself.

Ideally directly accessing the WRAM during runtime using C# would be wonderful.

I am hoping to create an auto-updating A Link to the Super Metroid tracker but I want to make sure it doesn't crash any time it is moved (like the one included with Magic2SNES) and that it is fairly responsive.

Additionally I would love to work on an implementation with RetroAchievements to allow players to use real hardware to do the achievements bypassing the emulator issues I have seen many complain about in the past.

Re: Can C# access USB2SNES WRAM?

Posted: Mon Feb 04, 2019 8:11 pm
by koitsu
I wish I could help, but I don't quite understand what USB2SNES is. I'm wanting to assume it's client software for the USB interface on an SD2SNES, but I'm unsure. I'm having a hard time comprehending it because:

https://github.com/saturnu/usb2snes seems to be called USB2SNES, except,
https://krikzz.com/forum/index.php?topi ... 0#msg50820 indicates a guy named RedGuy came along and improved on it, calling it usb2snesw, based on this post, which is centred around firmware updating and not so much the debugger (maybe I'm wrong?)

If it is the USB interface to the SD2SNES, then think it's more a question as to whether or not the SD2SNES supports snooping on WRAM regions.

Have you tried contacting RedGuy directly? Or possibly filing a GitHub Issue to ask? If not, why not? If so, what'd he say?

You might also try asking Krizz himself, since he's the SD2SNES inventor and could certainly tell you what types of debugger features are possible.

I own an SD2SNES, but I never bothered with the USB interface because I was told it was one of those in-flux-development type of features.

Finally, when you say WRAM, are you talking about:

a) Literal work RAM, i.e. $0000-1FFF of bank $00 (and some other banks (depends on mode 20 vs. 21)),
b) Region $7E0000-7FFFFF as a whole (of which Item (a) is part of),
c) Battery-backed SRAM (e.g. $6000-7FFF)?

Sadly the acronyms are sometimes misused, so it's always best to clarify.

Re: Can C# access USB2SNES WRAM?

Posted: Tue Feb 05, 2019 1:42 am
by calima
Just noting, Krikzz did not invent the sd2snes, he's just manufacturing it.

Re: Can C# access USB2SNES WRAM?

Posted: Tue Feb 05, 2019 2:03 am
by koitsu
calima wrote:Just noting, Krikzz did not invent the sd2snes, he's just manufacturing it.
Oh, I didn't know that. I was under the impression he designed/invented it, and offloaded manufacturing of the works onto whomever took up the job (for example I think mine was assembled somewhere in Russia or Ukraine). Sorry for getting this piece of information wrong.

Re: Can C# access USB2SNES WRAM?

Posted: Wed Feb 06, 2019 2:52 pm
by qwertymodo
Yes, the USB2SNES interface can access the entire SNES memory map. Check out https://github.com/KatDevsGames/connectorlib for a C# library that interfaces with it (through the WebSocket tray app, so you need to have that running, it doesn't interface directly with the virtual serial port).