1
0
mirror of https://github.com/raphnet/gc_n64_usb-v3 synced 2024-12-21 23:08:53 -05:00

tool to tools

This commit is contained in:
Raphael Assenat 2015-12-06 23:10:27 -05:00
parent 6a2c109ee8
commit 4178ca2e52
45 changed files with 69 additions and 33 deletions

64
README.md Normal file
View File

@ -0,0 +1,64 @@
# Gamecube/N64 to USB adapter
## Introduction
This is the source code for a Gamecube/N64 controller to USB adapter firmware
meant to run on [raphnet.net Multiuse PCB-X](http://www.raphnet.net/electronique/multiuse_pcbX/index_en.php).
The project homepage is located at: http://www.raphnet.net/electronique/multiuse_pcbX/index.php
## License
The project is released under the General Public License version 3.
## Directories
* / : The firmware source code
* tool/ : This directory contains utilities to configure and update an adapter, manipulate mempak
image files, etc.
* scripts/ : Scripts and/or useful files
## Compiling the firmware
You will need a working avr-gcc toolchain with avr-libc and standard utilities such as make. Just
type 'make' and it should build just fine. Under Linux at least.
## Programming the firmware
The makefile has a convenient 'flash' target which sends a command to the firmware to enter
the bootloader and then executes dfu-programmer (it must of course be installed) with the
correct arguments.
Note that the tool must be compiled first and your permissions must also be set so that your
user may access the device. See 'Using the tools' below for more information.
## Compiling the tools
In the tool/ directory, just type make.
There are a few dependencies:
- libhidapi-dev
- libhidapi-hidraw0
- pkg-config
- gtk3 (for the gui only)
Provided you have all the dependencies installed, under Linux at least, it should
compile without errors. For other environments such has MinGW, there are provisions
in the makefile to auto-detect and tweak the build accordingly, but it if fails, be
prepared to hack the makefile.
## Using the tools
Under Linux, you should configure udev to give the proper permissions to your user,
otherwise communicating with the device won't be possible. The same requirement
also applies to dfu-programmer.
An easy way to do this is to copy the two files below to /etc/udev/rules.d, restart
udev and reconnect the devices.
scripts/99-atmel-dfu.rules
scripts/99-raphnet.rules
For information on how to actually /use/ the tools, try --help. Ex:
$ ./gcn64ctl --help

View File

@ -1 +0,0 @@
SUBSYSTEM=="hidraw", ATTRS{idVendor}=="289b", ATTRS{idProduct}=="0017", MODE="0664", GROUP="plugdev"

View File

@ -1,26 +0,0 @@
CC=gcc
LD=$(CC)
CFLAGS=-Wall -g
LDFLAGS=-lsetupapi
PREFIX=/usr/local
PROG=gcn64ctl
OBJS=main.o gcn64.o mempak.o gcn64lib.o hexdump.o gc2n64_adapter.o ihex.o delay.o hid.o sleep.o memmem.o
.PHONY : clean install
all: $(OBJS)
$(LD) $(OBJS) $(LDFLAGS) -o $(PROG)
%.o: %.c %.h
$(CC) $(CFLAGS) -c $<
clean:
rm -f *.o $(PROG)
install:
@echo "Install not done yet. Sorry"

View File

@ -1,4 +0,0 @@
libhidapi-dev
pkg-config

View File

@ -26,7 +26,7 @@ MEMPAKLIB_OBJS=mempak.o mempak_fs.o $(COMPAT_OBJS)
.PHONY : clean install .PHONY : clean install
all: $(PROGS) all: $(PROGS) gui.xml
gcn64ctl_gui: gcn64ctl_gui.o gcn64ctl_gui_mpkedit.o gcn64.o gcn64lib.o hexdump.o ihex.o mempak_gcn64usb.o $(MEMPAKLIB_OBJS) gcn64ctl_gui: gcn64ctl_gui.o gcn64ctl_gui_mpkedit.o gcn64.o gcn64lib.o hexdump.o ihex.o mempak_gcn64usb.o $(MEMPAKLIB_OBJS)
$(LD) $^ $(LDFLAGS) $(GTK_LDFLAGS) -o $@ $(LD) $^ $(LDFLAGS) $(GTK_LDFLAGS) -o $@
@ -37,6 +37,9 @@ gcn64ctl: main.o gcn64.o gcn64lib.o hexdump.o gc2n64_adapter.o ihex.o delay.o me
gcn64ctl_gui.o: gcn64ctl_gui.c gcn64ctl_gui.h gcn64ctl_gui.o: gcn64ctl_gui.c gcn64ctl_gui.h
$(CC) $(CFLAGS) $(GTK_CFLAGS) -c $< $(CC) $(CFLAGS) $(GTK_CFLAGS) -c $<
gui.xml: gcn64cfg.glade
grep -v requires gcn64cfg.glade > gui.xml
gcn64ctl_gui_mpkedit.o: gcn64ctl_gui_mpkedit.c gcn64ctl_gui_mpkedit.h gcn64ctl_gui_mpkedit.o: gcn64ctl_gui_mpkedit.c gcn64ctl_gui_mpkedit.h
$(CC) $(CFLAGS) $(GTK_CFLAGS) -c $< $(CC) $(CFLAGS) $(GTK_CFLAGS) -c $<

View File

@ -815,7 +815,7 @@ main( int argc,
app.builder = gtk_builder_new(); app.builder = gtk_builder_new();
/* Load UI from file. If error occurs, report it and quit application. /* Load UI from file. If error occurs, report it and quit application.
* Replace "tut.glade" with your saved project. */ * Replace "tut.glade" with your saved project. */
if( ! gtk_builder_add_from_file( app.builder, "gcn64cfg.glade", &error ) ) if( ! gtk_builder_add_from_file( app.builder, "gui.xml", &error ) )
{ {
g_warning( "%s", error->message ); g_warning( "%s", error->message );
g_free( error ); g_free( error );