Skip to content

Ability to manually edit Wiimote/CC mappings#1240

Open
smdstudios wants to merge 2 commits into
FIX94:masterfrom
smdstudios:master
Open

Ability to manually edit Wiimote/CC mappings#1240
smdstudios wants to merge 2 commits into
FIX94:masterfrom
smdstudios:master

Conversation

@smdstudios

Copy link
Copy Markdown

This changes the Wiimote/Classic Controller loader (BT.c) to attempt to load user-defined button mappings from an ircc.ini file located on the root of the USB/SD card; if this file is not found, then Nintendont will proceed with the default bindings undisturbed.

That said, I am unsure which file in the code defines all the bindings. As we know, by default the motion controls operate the C-stick, but BT.h didn't seem to control this. If I could find the relevant file(s), I could provide an example ircc.ini file pronto!

Provides ability to load Wiimote/CC mappings from .ini file on USB/SD card
Comment thread kernel/BT.c
// Try to load Wiimote/Classic Controller bindings from ircc.ini
const char *filenames[2] = {
file_sd, file_usb,
"sd:/ircc.ini",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not in the app directory?
Cluttering up the root directory with all kinds of files is not nice.

Comment thread kernel/BT.c
// File found, read the configuration
size_t fsize = f.obj.objsize;
UINT read;
f_read(&f, (void*)IR_CFG_FILE, fsize, &read);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might want to check return value?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, IR_CFG_FILE and IR_CFG_SIZE still need to be defined first with addresses. HID.c of course defines its equivalent terms, but I still need applicable addresses for Wiimotes/CC's: https://github.com/FIX94/Nintendont/blob/master/mem_map.txt

For now I've allocated 0x93005180 and 0x93005184 respectively.

Comment thread kernel/BT.c
FIL f;
FRESULT res = FR_DISK_ERR;
for (i = 0; i < 2; i++) {
res = f_open_char(&f, filenames[i], FA_READ | FA_OPEN_EXISTING);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about stat()?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

define IR_CFG_FILE and IR_CFG_SIZE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants