mirror of
https://github.com/raphnet/gc_n64_usb-v3
synced 2024-12-22 07:18:52 -05:00
Add expansionWrite command
This commit is contained in:
parent
f09c77689d
commit
4374cd879a
@ -2,6 +2,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "gcn64lib.h"
|
#include "gcn64lib.h"
|
||||||
#include "../requests.h"
|
#include "../requests.h"
|
||||||
|
#include "../gcn64_protocol.h"
|
||||||
#include "hexdump.h"
|
#include "hexdump.h"
|
||||||
|
|
||||||
int gcn64lib_getConfig(gcn64_hdl_t hdl, unsigned char param, unsigned char *rx, unsigned char rx_max)
|
int gcn64lib_getConfig(gcn64_hdl_t hdl, unsigned char param, unsigned char *rx, unsigned char rx_max)
|
||||||
@ -201,3 +202,25 @@ int gcn64lib_bootloader(gcn64_hdl_t hdl)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int gcn64lib_expansionWrite(gcn64_hdl_t hdl, unsigned short addr, unsigned char data[32])
|
||||||
|
{
|
||||||
|
unsigned char cmd[40];
|
||||||
|
int cmdlen;
|
||||||
|
int n;
|
||||||
|
|
||||||
|
cmd[0] = N64_EXPANSION_WRITE;
|
||||||
|
cmd[1] = addr>>8; // Address high byte
|
||||||
|
cmd[2] = addr&0xff; // Address low byte
|
||||||
|
memcpy(cmd + 3, data, 0x20);
|
||||||
|
cmdlen = 3 + 0x20;
|
||||||
|
|
||||||
|
n = gcn64lib_rawSiCommand(hdl, 0, cmd, cmdlen, cmd, sizeof(cmd));
|
||||||
|
if (n != 1) {
|
||||||
|
printf("write block returned != 1 (%d)\n", n);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return cmd[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,6 +18,8 @@ int gcn64lib_getControllerType(gcn64_hdl_t hdl, int chn);
|
|||||||
const char *gcn64lib_controllerName(int type);
|
const char *gcn64lib_controllerName(int type);
|
||||||
int gcn64lib_bootloader(gcn64_hdl_t hdl);
|
int gcn64lib_bootloader(gcn64_hdl_t hdl);
|
||||||
|
|
||||||
|
int gcn64lib_n64_expansionWrite(gcn64_hdl_t hdl, unsigned short addr, unsigned char data[32]);
|
||||||
|
|
||||||
int gcn64lib_8bit_scan(gcn64_hdl_t hdl, unsigned char min, unsigned char max);
|
int gcn64lib_8bit_scan(gcn64_hdl_t hdl, unsigned char min, unsigned char max);
|
||||||
int gcn64lib_16bit_scan(gcn64_hdl_t hdl, unsigned short min, unsigned short max);
|
int gcn64lib_16bit_scan(gcn64_hdl_t hdl, unsigned short min, unsigned short max);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user