Skip to content
/ fxpak Public

Programmatic access to FXPak/FXPak Pro USB functionality

License

Notifications You must be signed in to change notification settings

wuest/fxpak

Repository files navigation

FXPak Hackage version

This provides an interface to serial communication over USB with FXPak and FXPak Pro devices using the USB-enabled firmware. Commands generated by this library are expected to be valid; invalid packets should be impossible to encode with this library.

Usage

The FXPak module exposes all of the logic needed to work with an FXPak. The following code will generate and send send a packet to reset a running SNES/Super Famicom:

reset :: FXPak.FXPak -> IO ()
reset device =
    let emptyFlags = []
        packet = FXPak.packet FXPak.SNES FXPak.Reset emptyFlags FXPak.None
    in FXPak.send dev packet >> return ()

and the following code will fetch the game's title portion of the SNES header in most titles:

title :: FXPak.FXPak -> IO (Maybe ByteString)
title dev =
    let emptyFlags = []
        headerTitleAddress = 0xFFC0
	headerTitleLength = 21
        packet = FXPak.packet FXPak.SNES FXPak.Get emptyFlags $ FXPak.GetBytes $ FXPak.AddressGet headerTitleAddress headerTitleLength
    in FXPak.send dev packet

Acknowledgements

The understanding of what constitutes a "valid" packet is based on usb2snesw.

License

This library is released under a BSD 3-clause license.

About

Programmatic access to FXPak/FXPak Pro USB functionality

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published