INL FlashCart - New Host App (RELEASED)

Discussion of hardware and software development for Super NES and Super Famicom. See the SNESdev wiki for more information.

Moderator: Moderators

Forum rules
  • For making cartridges of your Super NES games, see Reproduction.
Danin
Posts: 56
Joined: Sat Feb 15, 2014 10:23 pm

INL FlashCart - New Host App (RELEASED)

Post by Danin »

Hello folks. Welcome to the thread. First, a brief introduction. I go by Danin, even though my real name is Skylar. Call me whichever. I'm also very verbose. I bought one of the wonderful InfiniteNesLives flashcarts (the SNES version) and a Kazzo programmer, but the software left me feeling a little uncomfortable. I got ahold of INL, and he graciously agreed to provide me with what was required to write a new host app for it. We're taking the typical two-headed approach here. For the most part, INL does the firmware, I do the host app.

I started from the ground up, and I've been banging on it with bits and bytes to see just how much I can stuff into one app. As of right now, it ONLY supports SNES ROMs and the SNES flashcart. If you somehow manage to figure out a way to throw an NES rom at it and make it talk to the NES flashcart, it won't work and I'll be fairly impressed.

I am not a professional dev. There will be bugs. I've provided what I consider to be extensive log messages that should help me troubleshoot issues, if they're encountered, and that brings us to...

...no more disappointment. Release downloads here, info below. RTFM, it's just down there. Seriously, like four lines down TOPS.




CORONA WORLD TOUR UPDATE: Crap what a ride, eh? Since I made this post I lost everything, literally had to bail on the home town I grew up in and the job I never wanted to leave because my business collapsed. Moved to another state, found old Bitcoin, lived it up a few months, coasted, now Corona and someone wants to use my software still? What a world! Anyway here's an updated link for anyone who's still around. Contact me however if you have/need whatever, not particularly busy these days. ;p (Also the project mentioned below never happened, my world kind of exploded. It might happen still, I have the environment and the interest just not the time or motivation. I might get around to it, leaving it all for historical accuracy or something.)

https://drive.google.com/open?id=15G3Uj ... pG-8zvv0He


Changes:
- Fixed bug with drag-drop IPS + ROM causing crash
- Added drop-on-exe/drop-on-shortcut and command line filenames (ex. SNES-Flasher.exe "C:\ROMS\SNES\Super Mario World.smc" to load on start)
- Added right-click menu entry to ROM Data view to copy text to clipboard, for sending to me to debug potential issues
- Remembered that app supports .rar and .7z formats as well. Added to description.

I'll try to keep this short. The SNES Flasher app only supports SNES ROMs. No NES support now, or ever. Why? Because I've begun work on a new project upon which Paul and I will collaborate that will replace this one, allowing SNES support, NES support, and we'll see where it goes from there.

First off, update your drivers. Unplug the Kazzo, download the driver package, install it.
Second, update your firmware. You will LOSE NES SUPPORT. Sorry. Switch the Kazzo to BL mode, plug it in, run the update-mod.bat file within the Firmware directory.


Basic Usage: Run the flasher app. You need .Net 4.5.1 for this. If you don't know what all the buttons do, don't touch them, just drag-and-drop a ROM onto the window, and wait for it to be done. Pay attention, it'll tell you what it judges is the right position for your HiLo switch on the cart. It's almost never wrong. (Star Ocean DeInterleaved S-DD1 Hack comes to mind.) DO NOT waste your time removing the header, DO NOT try using pre-mangled (remapped, mirrored, etc) ROMs, this app handles it all for you. Drop, flash, done. There are Load/Open buttons on the form, and an Execute button. If you drop files, the program will act on them immediately - if you need an IPS patch, drop it WITH THE ROM or load them with the buttons. Button loads = manual Execute/Apply. Drop = Automatic Execute/Apply. Got it? Cool.

Intermediate usage: The window supports drop targets for three major types; Archive files (Zip, Rar, 7z), SNES Roms, and IPS patches. You need at least an SNES ROM (either in an archive or by itself) OR an IPS patch (Either in an archive or by itself.) per drag. If you try to drop more than one ROM, or more than one IPS patch, it will not allow the drop.
If you wish, you can drop an archive that includes a mix of multiple ROMs, multiple IPS patches, or a mix of both. If there's only one of whatever type, it'll load it. If there's multiple, it will PROMPT you. (Yeah, I thought that was pretty badass too, haha.)
If you drop an IPS patch, it will ATTEMPT to decide how to handle it. (AKA, does the IPS need a headered ROM or not? It'll run the patch both ways, as well as against a non-headered ROM and a headered ROM in-memory, and attempt to decide which one "makes sense" to it. It's not perfect, so if you have problems, try manually setting the "Patch Needs ROM Header" yourself and re-flashing.)

Advanced usage info:
Data Type: Kazzo-internal firmware values and write patterning depend on this being right. It's automatically handled based on several ROM criteria - assume it's right.
Cart Size: Determines erase size and maximum write length. Manually pick this if it's not automatically picked - the program will halt a write if it's not picked. Proper firmware should set this properly as you start to write the ROM.
Auto-Erase Cart: Duh. Untick this if your cart's already erased, though. Or don't.

Write/Read ROM: Obvious, but Read ROM is in a very very very (VERY) early (BROKEN) state. You might get a good ROM. You might get garbage. Don't count on this working.
Buffer Only (For Patching): If you want to mangle your ROM (apply IPS patches, mirror, etc) and use it in an external tool for whatever reason, pick this. Also good for troubleshooting.

Execute: The GO button. click it when you're ready.

Enable Patcher: Click it, load a Patch file, optionally play with the Patch Needs ROM Header option, then apply it.

Enable Internal IPS Patches: This will attempt to remove ROM copy protections, so you can try patching things like Earthbound or Donkey Kong country. This is buggy. If you have problems, disable this and use an external tool like UCON64.
Auto-Mirror ROM: Typically not required, but enabled for compatibility. Automatically mirrors ROM data into unused banks to compensate for having a larger board and a smaller ROM, for ROMs that actually check this. Not many do. R-Type 3, for example, does.
Auto-Select Write Buffer: The program stores a buffer of each ROM you load, every time it mangles the data. This way, if it screws up the data (or you do) you can take a step back and re-apply whatever you/it just tried to do. Typically, this is safe to leave enabled.
Auto-Detect Cart Size: No clue why you'd turn this off. It reads your Kazzo cart's Flash ID values (using the Kazzo's firmware) and selects the right size of cart automatically. Only disable this if your cart has (somehow) a modified Flash, or an unsupported Flash, or...I really don't know. Just leave it on.
Auto-Select Data Type: Automatically picks the Data Type (Kazzo Firmware-related stuff) to flash. Unless you're using a mangled buffer intentionally, this is already right. Leave it be.
Allow Advanced Write Modes: Enabled automatically when your Kazzo has the right firmware version. Disabled manually if you think the Advanced Write Mapping (for speed improvements and "intelligent" mirroring and so on) is causing a write problem. Disable the ROM Protection patcher first, then this, if you have problems.
Protect Vectors in Patch (BETA): This attempts to stop IPS patches from changing the Vectors in the ROM. This disables Trainers and such in ROM patches, as well as allowing patches written for certain emulator workarounds to work on actual hardware. This only works if the patch data begins within the Vector table. Disable it if you get unexpected behavior.

Log data should indicate what a problem is, if you can't figure something out let me know, but I'll likely need the last dozen (or two) lines of your log! Probably also a copy of your ROM/IPS files.

Again, I tried to make this as "drag, drop, done" as possible. It provides way more information than you need. Ignore it unless it's red or has the red "!" sign on it. The info (and control) is there for advanced users, the simplicity (and automation) is there for beginners. Start by flashing something simple, like Super Mario World, then move on to a ROM hack or something, and eventually all the way up to your translated original Japanese copy protected ROM. My initial goal here was "if you need another program I've done something wrong" and in 99% of cases, that fits. The only failing there (that I'm aware of) is that some ROMs use copy protection that I didn't patch out, so you might need a patcher for that.

Sadly, SRAM stuff didn't make it, but it'll be in the next project. I'm done with this app (UNLESS SOMEONE FINDS A MAJOR BUG) but NOT with INL's hardware. There will be more, and this time it'll support SNES, NES, and the SRAM functions everyone wants.

One final note that I hesitate to mention. This took a LOT of time, and while I did it expecting no payment, fully for free, to be released to the public at NO CHARGE, I have been approached regarding donations. If you really feel the need to donate to me, ask me in a PM. I'm not going to put the link public here because I don't want anyone to feel obligated or pressured. If you pulled a TL;DR and don't see this, I'm fine with that. If you want to use it free forever and that's it, I'm literally pleased that I could help you, and that's enough. If you feel the need to donate, I'm going to ask that you contact me privately for the details, and I want you to know that I appreciate it, but I'm NOT asking for a cent.
Last edited by Danin on Fri May 01, 2020 5:16 pm, edited 37 times in total.
Danin
Posts: 56
Joined: Sat Feb 15, 2014 10:23 pm

Re: INL FlashCart - New Host App

Post by Danin »

I guess a note regarding my future project, since this space is now open.

I'm working on a new project. I don't want to discuss details, but at the very minimum, my initial MUST-PASS goals are:
- Full NES Writing Support
- Full SNES Writing Support
- SNES SRAM Read/Write support
- IPS Patching
- Archive Loading (Zip)

You may notice that my existing application ticks three of those boxes already. Additionally, my "optional" goals are:
- Cross-Platform with Native UI
- Full NES/SNES Read Support (from Flash and Original carts both)
- UPS Patching (and other formats)
- Archive Loading (Other)
- Some big surprises. Seriously. Big.
- Fully plugin-based design, allowing replacement UI, File/ROM Format, Interface, Device, Patcher plugins to be written.

I've never written a heavily plugin-based system before, so this will be a challenge, among the other things I've listed. It's a big project, but it's already underway. Probably won't be any updates until I need testers though.
Last edited by Danin on Sat Mar 12, 2016 9:53 pm, edited 17 times in total.
hyarion
Posts: 163
Joined: Tue May 05, 2009 6:12 pm
Contact:

Re: INL FlashCart - New Host App

Post by hyarion »

Have you concidered making it open source instead? That way others could help you with issues on other operating systems.
Danin
Posts: 56
Joined: Sat Feb 15, 2014 10:23 pm

Re: INL FlashCart - New Host App

Post by Danin »

hyarion wrote:Have you concidered making it open source instead? That way others could help you with issues on other operating systems.
I've certainly considered open-sourceing it, but I'll only do so when I'm comfortable with its features. I feel that when highly-beta software is open-sourced, it's not "others will help" but more "others will fork it and do their own thing". Especially when it comes to other operating systems - they can't "help me" because I can't touch it. They'd have to make their own version that works on their operating system, and tell me what they changed - which might break the operating system it was designed for - and I'd have no way to test if my changes broke other operating systems again.

It WILL be open-source - you have my guarantee on that - but not until it's in a stable, sensible state. Also, I WILL work on porting it to OSX/Linux, once I have a suitable base setup going.
hyarion
Posts: 163
Joined: Tue May 05, 2009 6:12 pm
Contact:

Re: INL FlashCart - New Host App

Post by hyarion »

Danin wrote:I feel that when highly-beta software is open-sourced, it's not "others will help" but more "others will fork it and do their own thing". Especially when it comes to other operating systems - they can't "help me" because I can't touch it.
You are using .net, with cross platform libraries, so I wouldn't be surprised if it would only need minor changes to get it running on mono on osx and/or linux.
You should also checkout github or bitbucket. It makes it dead simple to compare forks and branches.
Danin
Posts: 56
Joined: Sat Feb 15, 2014 10:23 pm

Re: INL FlashCart - New Host App

Post by Danin »

hyarion wrote:You are using .net, with cross platform libraries, so I wouldn't be surprised if it would only need minor changes to get it running on mono on osx and/or linux.
You should also checkout github or bitbucket. It makes it dead simple to compare forks and branches.
I am very much using the items you mentioned, so it should be that easy. It may even "just work" on non-Windows environments depending on the status of their Mono and Windows.Forms implementation. libUsbDotNet has a separate section of its library for Mono versus Windows so it may not be quite click-and-go.

However, I still cannot implement even minor changes for an OS I don't have available to test with, and my previous reasons for not open-sourcing at this juncture stand. Github and Bitbucket are useless for one-person collaboration. (I say one-person collaboration because while I'm working hand-in-hand with INL, he has expressed no interest in directly coding on the host app, and prefers to stick to firmware - I am certainly not trying to slight him, or undervalue his end of it. Without his efforts, there is very little more I can do on my end, and without his help up to here, this project never would have gotten started.)

I appreciate your input, but the project WILL NOT be open-sourced at this point in its development. I greatly value open source, and cross-platform equally so - that's why I chose the language I did, and kept the same library for the communication core. Those of you not on Windows will not be forgotten or ignored, but I'm uninterested in discussing it further at this point.

I had considered delaying release until a time that I was prepared to address concerns like this, but I felt there was greater value in refining it further, and allowing those who could use it access just that much sooner. For now, I rather want to focus on improving and expanding it. Let's move on from cross-platform and open-source - for now. It won't be long before I'm ready to address this topic.
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: INL FlashCart - New Host App

Post by tepples »

You can dual boot Linux on an existing Windows PC, and you may be able to work around the broken display of the MacBook by connecting an external display such as an HDTV.

Most copier detection, as I understand it, is performed by making sure battery RAM is correctly mirrored and PRG ROM is not writable. Earthbound/Mother 2 will be a mother-fornicator to get working because it also periodically checks whether the copier detection has been patched out.
User avatar
thefox
Posts: 3134
Joined: Mon Jan 03, 2005 10:36 am
Location: 🇫🇮
Contact:

Re: INL FlashCart - New Host App

Post by thefox »

Danin wrote:Github and Bitbucket are useless for one-person collaboration.
I strongly disagree. BTW, you can create private repositories for free at Bitbucket.
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: fo.aspekt.fi
Danin
Posts: 56
Joined: Sat Feb 15, 2014 10:23 pm

Re: INL FlashCart - New Host App

Post by Danin »

tepples wrote:You can dual boot Linux on an existing Windows PC, and you may be able to work around the broken display of the MacBook by connecting an external display such as an HDTV.
You have a point. I CAN technically reach those operating systems right now. I have enough spare hardware that if I wanted, I could set up two more systems on my desk, crowd out my existing work, and splinter my focus. I'm not going to. As I've stated, I want to focus on other things right now. Please respect that.
thefox wrote:I strongly disagree. BTW, you can create private repositories for free at Bitbucket.
While that is true, what is the point of creating a repo for a project that is worked on solely on one computer that already has periodic remote-copy refreshing on a backup server? Regardless, I want to focus on other things right now. I like your name, by the way.
tepples wrote:Most copier detection, as I understand it, is performed by making sure battery RAM is correctly mirrored and PRG ROM is not writable. Earthbound/Mother 2 will be a mother-fornicator to get working because it also periodically checks whether the copier detection has been patched out.
Since this is my first actual comment that relates to something I haven't expressed a direct desire not to discuss, I'm going to give it some special attention.

The hardware doesn't support automatic limitation to below a certain amount right now, nor RAM-mirroring. I hear INL's new carts will support it better, but as of right now that leaves the previous-gen users out unless they want to solder a row of DIP switches to the top of the cart. I'm working on software-patching these issues, in the mean time.

For example, both SMAS and SMAS+SMW write to memory that should be mirrored and reads back a different mirror, locking you out if it's not the same value AKA has too much memory. I fix that by patching the read and compare opcodes to access the same address. So far as I can see, that address is not used for gameplay, so it doesn't matter which address you pick. For what it's worth, each of them has this check in two pairs near eachother 1+<the number of games> times, and all instances in both games can be caught by the same pattern. If someone expresses interest, I can disclose this information.

DKC2 copies a string to a location in memory if it detects too much RAM or some such other issue, I fix that by copying the "everything is okay" type string over the "i am a hacked copy" type string, so it can't tell.

As for Earthbound, my intention is to patch out the protection, then see what they're expecting for a checksum, see how they calculate it, and where they store the expected checksum, and patch that as well. It's not difficult, I just need to get around to it. My SNES disassembly skills are poor, but I doubt I'll hear anyone suggesting I don't bother with it at all.

I'm sure there are other games out there that do these sorts of things, so if anyone knows exactly how they work - as in, "look for a write to memory address X followed by a read at memory address Y and a jump statement to Q" - please let me know, and I'll patch that too.
Danin
Posts: 56
Joined: Sat Feb 15, 2014 10:23 pm

Re: INL FlashCart - New Host App (Release 7)

Post by Danin »

New update with significant changes in usability and functionality. Details above. Still no 8MByte fix, sorry guys. I've tried everything I can think of from my end to solve it.

(02-22-14, Release 8) Yes, another major update. This one represents a HUGE overhaul in code, adding Threading, asynchronous events, the beginnings of NES support (mostly internal/structural right now) and a huge quantity of minor updates, changes, and patches to streamline and simplify code. No known regressions, just that log window updates will be out-of-order during high-speed Test operations (IE; Test-Write) and as such, I don't care enough to fix it right now, especially since it would slow down all operations just a fraction.

(02-24-14, Release 9) And another update. Smaller this time, but includes new firmware. Users must upgrade to this version to fix >8MByte writes. Firmware is provided in the Firmware directory, upgrade by running Update.bat
SNgamer
Posts: 44
Joined: Tue Feb 11, 2014 7:12 am

Re: INL FlashCart - New Host App (Release 9)

Post by SNgamer »

Your newest releases seem to have a startup bug, at least on my computer :(
If I try to start Release 8 or 9 they won't even start, windows outputs an error after some time that there might be files useful to find out whats up:
C:\Users\SNgamer\AppData\Local\Temp\WER6B21.tmp.WERInternalMetadata.xml
C:\Users\SNgamer\AppData\Local\Temp\WER83F0.tmp.appcompat.txt
C:\Users\SNgamer\AppData\Local\Temp\WER8400.tmp.mdmp

Release 7 just work fine as before. I hope you can fix it :D
Danin
Posts: 56
Joined: Sat Feb 15, 2014 10:23 pm

Re: INL FlashCart - New Host App (Release 9)

Post by Danin »

SNgamer wrote:Your newest releases seem to have a startup bug, at least on my computer :(
If I try to start Release 8 or 9 they won't even start, windows outputs an error after some time that there might be files useful to find out whats up:
C:\Users\SNgamer\AppData\Local\Temp\WER6B21.tmp.WERInternalMetadata.xml
C:\Users\SNgamer\AppData\Local\Temp\WER83F0.tmp.appcompat.txt
C:\Users\SNgamer\AppData\Local\Temp\WER8400.tmp.mdmp

Release 7 just work fine as before. I hope you can fix it :D
Adorable. Well, if you can post the .xml and .txt files someplace for me that might help. I haven't had any issues on my test machines, but there's no way for me to cover every test case reliably - that's why it's a Beta. I apologize for the issues, but I'll get right on a fix if you can provide me with that info. More info would be nice as well - what OS you're on, wether it's 32- or 64-bit, processor info, etc.. Get me that info and I'll do my best to have a fix released tonight.
satashi26
Posts: 29
Joined: Sat Feb 22, 2014 7:22 am

Re: INL FlashCart - New Host App (Release 10)

Post by satashi26 »

release 10 is giving me some problems. I can't seem to erase to write to my carts, as it says they're not seated properly. I've used this at least 30-40 times and know how to seat them correctly, and it works on lower versions. When I go to rlease 10, I get this again:

[MainFormShown=>checkFirmwareVersion] Current firmware does not support Read operations. Disabling.
[checkFirmwareVersion=>TestConnection] Testing connection.
[checkFirmwareVersion=>TestConnection] Connection test passed. Status code (49)
[checkFirmwareVersion=>TestConnection] Version code [2, 1, 1])
[MainFormShown=>checkFirmwareVersion] Firmware core version 2 indicates OK/BUSY support. Auto-Erase enabled.
[MainFormShown=>checkFirmwareVersion] Firmware core version 2 supports fixed write support for read/write exceeding 8MBytes.
[OnCheckedChanged=>chkAutoEraseCheckedChanged] Auto-erase enabled.
[btnEraseClick=>handleEraseThreaded] Erasing cart.
[ThreadStart_Context=>EraseCart] Erasing single-chip SNES Cart.
[EraseCart=>EraseCart] Sending erase header to cart. Header index:0
[EraseCart=>WriteHeaderToKazzo] Called with HeaderID 0.
[WriteHeaderToKazzo=>WriteBufferToKazzo] dataType 1, pageSize 16, pageCount 1, Buffer[16]
[WriteHeaderToKazzo=>WriteBufferToKazzo] Device is open.
[WriteHeaderToKazzo=>WriteBufferToKazzo] Writing page 0 of 1.
[WriteHeaderToKazzo=>WriteBufferToKazzo] <WriteBufferToKazzo:0,0> Could not load type 'System.Runtime.CompilerServices.IAsyncStateMachine' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
[EraseCart=>EraseCart] Failed to send Erase header. Cart may not be inserted or Kazzo may not be ready. Reseat/Reset and try again!
[handleEraseThreaded=>EraseCart_Threaded] Operation time: 0.09 seconds.

UPDATE: I updated my .NET to 4.5 and now it works perfectly
Last edited by satashi26 on Tue Mar 04, 2014 5:38 pm, edited 1 time in total.
Danin
Posts: 56
Joined: Sat Feb 15, 2014 10:23 pm

Re: INL FlashCart - New Host App (Release 10)

Post by Danin »

satashi26 wrote:it says they're not seated properly.
Almost. It says 'may' not be seated, OR Kazzo 'may' not be ready in the error message...however, this line is more important:
satashi26 wrote:Could not load type 'System.Runtime.CompilerServices.IAsyncStateMachine' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
It's having a problem loading the Asynchronous State Machine, according to that. Which is odd, because Release 8 and onwards use the same Async/Threading operation.. I don't have an exact answer for you right now (and I'm at work so I can't do more intense diagnostics) but I have a guess. What version of Windows are you using? My instinct says pre-Windows 7, as there's only one change that I know of that might effect non-Windows 7...
satashi26
Posts: 29
Joined: Sat Feb 22, 2014 7:22 am

Re: INL FlashCart - New Host App (Release 10)

Post by satashi26 »

Danin wrote: Almost. It says 'may' not be seated, OR Kazzo 'may' not be ready in the error message...however, this line is more important:

It's having a problem loading the Asynchronous State Machine, according to that. Which is odd, because Release 8 and onwards use the same Async/Threading operation.. I don't have an exact answer for you right now (and I'm at work so I can't do more intense diagnostics) but I have a guess. What version of Windows are you using? My instinct says pre-Windows 7, as there's only one change that I know of that might effect non-Windows 7...
You are most correct there with the 'may' part :) My bad!

Windows 7 is what I'm using actually...Is there any information I can give you to help with this problem? (Also thanks for the help too, I really appreciate you using time for me.)

UPDATE: I updated my .NET to 4.5 and now it works perfectly
Last edited by satashi26 on Wed Mar 05, 2014 6:32 am, edited 1 time in total.
Post Reply