Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
2b918cd
Add remote syncing
Zarithya Mar 16, 2025
60df481
Async
Zarithya Mar 18, 2025
b1b84fd
Almost finished replicating Wii menu pairing functionality
Zarithya Mar 19, 2025
ccfe267
Final pairing implementation (cleanup WIP)
Zarithya Mar 25, 2025
e096919
Cleanup
Zarithya Mar 26, 2025
d0d0191
Fix some race conditions
Zarithya Apr 2, 2025
57f2921
Stop sharing sockets!
Zarithya Apr 2, 2025
3cb9d09
Properly wait for USB to close
Zarithya Apr 2, 2025
4d5665a
Remove listen PCB when opening new connection
Zarithya Apr 2, 2025
56bda29
Correctly free socket on wiimote disconnect
Zarithya May 7, 2025
eea5f61
Start making it act like SM
Zarithya May 8, 2025
86704a6
TRs work
Zarithya May 24, 2025
7e34671
Reconnect after pair works
Zarithya May 24, 2025
545eeeb
TRs can reconnect after pairing
Zarithya May 28, 2025
4406038
Fix balance board
Zarithya Jun 2, 2025
caedcc1
Begin final cleanup
Zarithya Jun 9, 2025
aa35f0e
Guest mode pairing works
Zarithya Jun 10, 2025
46a5496
Continue cleanup
Zarithya Jun 10, 2025
ad5b3d7
Cleanup from review
Zarithya Jun 13, 2025
6fed5dc
Move bte_free calls to more logical places
Zarithya Jun 14, 2025
2322b93
General disconnect CB
Zarithya Jun 17, 2025
b7cd820
Clear critical battery state on disconnect
Zarithya Jun 24, 2025
ddb380d
Clear sock on shutdown
Zarithya Jun 24, 2025
4f8f311
Cleanup
Zarithya Jun 25, 2025
d10c65b
Disambiguate front panel power button from auth'd Wiimote power button
Zarithya Aug 3, 2025
9590478
Improve power button disable/throttle code
Zarithya Aug 3, 2025
5221304
rename inquiry_res
DacoTaco Aug 8, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions gc/bte/bd_addr.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@
extern "C" {
#endif /* __cplusplus */

#define BD_ADDR_LEN 6

struct bd_addr {
u8 addr[6];
u8 addr[BD_ADDR_LEN];
};

#define BD_ADDR_LEN 6

#define BD_ADDR_ANY (&(struct bd_addr){{0,0,0,0,0,0}})
#define BD_ADDR_LOCAL (&(struct bd_addr){{0,0,0,0xff,0xff,0xff}})

Expand Down
7 changes: 2 additions & 5 deletions gc/bte/bte.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
#define HIDP_PROTO_BOOT 0x00
#define HIDP_PROTO_REPORT 0x01

#define BD_LINK_KEY_LEN 16
Comment thread
WinterMute marked this conversation as resolved.
Outdated
#define BD_NAME_LEN 248
#define BD_MAX_INQUIRY_DEVS 255

Expand Down Expand Up @@ -105,7 +106,7 @@ struct inquiry_res
struct linkkey_info
{
struct bd_addr bdaddr;
u8 key[16];
u8 key[BD_LINK_KEY_LEN];
};

struct pad_name_info
Expand Down Expand Up @@ -172,12 +173,8 @@ void bte_disconnected(struct bte_pcb *pcb,s32 (disconn_cfm)(void *arg,struct bte

s32 bte_disconnect(struct bte_pcb *pcb);

//s32 bte_listen(struct bte_pcb *pcb,struct bd_addr *bdaddr,u8 psm);
//s32 bte_accept(struct bte_pcb *pcb,s32 (*recv)(void *arg,void *buffer,u16 len));
s32 bte_listenasync(struct bte_pcb *pcb,struct bd_addr *bdaddr,s32 (*conn_cfm)(void *arg,struct bte_pcb *pcb,u8 err));
s32 bte_listenasync_step2(struct bte_pcb *pcb,s32 (*conn_cfm)(void *arg,struct bte_pcb *pcb,u8 err));
//s32 bte_connect(struct bte_pcb *pcb,struct bd_addr *bdaddr,u8 psm,s32 (*recv)(void *arg,void *buffer,u16 len));
//s32 bte_connect_ex(struct bte_pcb *pcb,struct inquiry_info_ex *info,u8 psm,s32 (*recv)(void *arg,void *buffer,u16 len));
s32 bte_connectasync(struct bte_pcb *pcb,struct bd_addr *bdaddr,s32 (*conn_cfm)(void *arg,struct bte_pcb *pcb,u8 err));
s32 bte_connectasync_step2(struct bte_pcb *pcb,s32 (*conn_cfm)(void *arg,struct bte_pcb *pcb,u8 err));
s32 bte_senddata(struct bte_pcb *pcb,void *message,u16 len);
Expand Down
7 changes: 3 additions & 4 deletions gc/ogc/conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ struct _conf_pad_guests {
} ATTRIBUTE_PACKED;

s32 CONF_Init(void);
s32 CONF_SaveChanges(void);
s32 CONF_GetLength(const char *name);
s32 CONF_GetType(const char *name);
s32 CONF_Get(const char *name, void *buffer, u32 length);
Expand All @@ -182,7 +183,9 @@ s32 CONF_GetCounterBias(u32 *bias);
s32 CONF_GetScreenSaverMode(void);
s32 CONF_GetDisplayOffsetH(s8 *offset);
s32 CONF_GetPadDevices(conf_pads *pads);
s32 CONF_SetPadDevices(const conf_pads *pads);
s32 CONF_GetPadGuestDevices(conf_pad_guests *pads);
s32 CONF_SetPadGuestDevices(const conf_pad_guests *pads);
s32 CONF_GetNickName(u8 *nickname);
s32 CONF_GetAspectRatio(void);
s32 CONF_GetEULA(void);
Expand All @@ -193,10 +196,6 @@ s32 CONF_GetRegion(void);
s32 CONF_GetArea(void);
s32 CONF_GetVideo(void);

s32 CONF_SetPadDevices(const conf_pads *pads);
s32 CONF_SetPadGuestDevices(const conf_pad_guests *pads);
s32 CONF_SaveChanges(void);

#ifdef __cplusplus
}
#endif /* __cplusplus */
Expand Down
1 change: 0 additions & 1 deletion gc/wiiuse/wiiuse.h
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,6 @@ WIIUSE_EXPORT extern int wiiuse_write_streamdata(struct wiimote_t *wm,ubyte *dat

/* connect.c */
WIIUSE_EXPORT extern int wiiuse_find(struct wiimote_t** wm, int max_wiimotes, int timeout);
//WIIUSE_EXPORT extern int wiiuse_connect(struct wiimote_t** wm, int wiimotes);
WIIUSE_EXPORT extern void wiiuse_disconnect(struct wiimote_t* wm);

/* events.c */
Expand Down
45 changes: 22 additions & 23 deletions libogc/conf.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
/*-------------------------------------------------------------

conf.c -- SYSCONF support
conf.c -- SYSCONF & setting.txt support

Copyright (C) 2008
Copyright (C) 2008-2025
Hector Martin (marcan)
tona
Zarithya

This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any
Expand Down Expand Up @@ -31,17 +33,18 @@ distribution.
#include <stdio.h>
#include <string.h>
#include <malloc.h>
#include <gcbool.h>
#include "ipc.h"
#include "asm.h"
#include "processor.h"
#include "conf.h"

#define CONF_FILE_SIZE 0x4000
#define CONF_TXT_FILE_SIZE 0x100

static int __conf_inited = 0;
static u8 __conf_buffer[0x4000] ATTRIBUTE_ALIGN(32);
static char __conf_txt_buffer[0x101] ATTRIBUTE_ALIGN(32);
static int __conf_buffer_dirty = FALSE;
static u8 __conf_buffer[CONF_FILE_SIZE] ATTRIBUTE_ALIGN(32);
static char __conf_txt_buffer[CONF_TXT_FILE_SIZE + 1] ATTRIBUTE_ALIGN(32);
static int __conf_buffer_dirty = false;

static const char __conf_file[] ATTRIBUTE_ALIGN(32) = "/shared2/sys/SYSCONF";
static const char __conf_txt_file[] ATTRIBUTE_ALIGN(32) = "/title/00000001/00000002/data/setting.txt";
Expand All @@ -51,7 +54,7 @@ void __CONF_DecryptTextBuffer(void)
u32 key = 0x73B5DBFA;
int i;

for(i=0; i<0x100; i++) {
for(i=0; i<CONF_TXT_FILE_SIZE; i++) {
__conf_txt_buffer[i] ^= key & 0xff;
key = (key<<1) | (key>>31);
}
Expand All @@ -67,19 +70,19 @@ s32 CONF_Init(void)
fd = IOS_Open(__conf_file,1);
if(fd < 0) return fd;

memset(__conf_buffer,0,0x4000);
memset(__conf_txt_buffer,0,0x101);
memset(__conf_buffer,0,CONF_FILE_SIZE);
memset(__conf_txt_buffer,0,CONF_TXT_FILE_SIZE + 1);

ret = IOS_Read(fd, __conf_buffer, 0x4000);
ret = IOS_Read(fd, __conf_buffer, CONF_FILE_SIZE);
IOS_Close(fd);
if(ret != 0x4000) return CONF_EBADFILE;
if(ret != CONF_FILE_SIZE) return CONF_EBADFILE;

fd = IOS_Open(__conf_txt_file,1);
if(fd < 0) return fd;

ret = IOS_Read(fd, __conf_txt_buffer, 0x100);
ret = IOS_Read(fd, __conf_txt_buffer, CONF_TXT_FILE_SIZE);
IOS_Close(fd);
if(ret != 0x100) return CONF_EBADFILE;
if(ret != CONF_TXT_FILE_SIZE) return CONF_EBADFILE;

if(memcmp(__conf_buffer, "SCv0", 4)) return CONF_EBADFILE;

Expand All @@ -98,7 +101,7 @@ int __CONF_GetTxt(const char *name, char *buf, int length)

if(!__conf_inited) return CONF_ENOTINIT;

while(line < (__conf_txt_buffer+0x100) ) {
while(line < (__conf_txt_buffer+CONF_TXT_FILE_SIZE) ) {
delim = strchr(line, '=');
if(delim && ((delim - line) == nlen) && !memcmp(name, line, nlen)) {
delim++;
Expand All @@ -117,7 +120,7 @@ int __CONF_GetTxt(const char *name, char *buf, int length)
}

// skip to line end
while(line < (__conf_txt_buffer+0x100) && *line++ != '\n');
while(line < (__conf_txt_buffer+CONF_TXT_FILE_SIZE) && *line++ != '\n');
}
return CONF_ENOENT;
}
Expand Down Expand Up @@ -238,7 +241,7 @@ s32 CONF_Set(const char *name, const void *buffer, u32 length)
default:
return CONF_ENOTIMPL;
}
__conf_buffer_dirty = TRUE;
__conf_buffer_dirty = true;
return len;
}

Expand All @@ -256,12 +259,12 @@ int __CONF_WriteBuffer(void)
if (fd < 0)
return fd;

ret = IOS_Write(fd, __conf_buffer, 0x4000);
ret = IOS_Write(fd, __conf_buffer, CONF_FILE_SIZE);
IOS_Close(fd);
if (ret != 0x4000)
if (ret != CONF_FILE_SIZE)
return CONF_EBADFILE;

__conf_buffer_dirty = FALSE;
__conf_buffer_dirty = false;
return 0;
}

Expand All @@ -274,10 +277,6 @@ s32 CONF_SaveChanges(void)
if (ret < 0)
return ret;

/*ret = __CONF_WriteTxtBuffer();
if (ret < 0)
return ret;*/

return CONF_ERR_OK;
}

Expand Down
Loading