Skip to content

Commit

Permalink
Upstream changes with GUI, screen glitch fixes and more!
Browse files Browse the repository at this point in the history
- System version now displays region ID:

U = USA/CAN
E = EUR/AUS
J = JPN
C = CHN
K = KOR
T = TWN

- Minor code clean up + consistency.

- Now displays home menu ID in misc tab.

- WiFi information, SSID and password. Thanks to LiquidFenrir for his WiFi manager's network struct.

- New colours:

- Displays Homemenu ID
- Displays IP address
- Displays brightness

Cyan for misc info.
Purple for NNID.
Green for WiFi slots.

- Fixed buffer overflows thanks to GCC  7.1.0.
  • Loading branch information
joel16 committed Jul 16, 2017
1 parent b288fd5 commit f8769ed
Show file tree
Hide file tree
Showing 12 changed files with 284 additions and 138 deletions.
2 changes: 1 addition & 1 deletion include/misc.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <3ds.h>

u32 titleCount(FS_MediaType mediaType);
bool detectSD();
bool detectSD(void);
u64 getFreeStorage(FS_SystemMediaType mediaType);
u64 getTotalStorage(FS_SystemMediaType mediaType);
u64 getUsedStorage(FS_SystemMediaType mediaType);
Expand Down
2 changes: 1 addition & 1 deletion include/power.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@

#include <3ds.h>

const char * batteryStatus();
const char * batteryStatus(void);

#endif
17 changes: 9 additions & 8 deletions include/system.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,20 @@

#include <3ds.h>

const char * getModel();
const char * getRegion();
const char * getLang();
char * getMacAddress();
char * getScreenType();
u64 getLocalFriendCodeSeed();
const char * getModel(void);
const char * getRegion(void);
const char getFirmRegion(void);
const char * getLang(void);
char * getMacAddress(void);
char * getScreenType(void);
u64 getLocalFriendCodeSeed(void);
char * getSerialNum(void);
u32 getDeviceId(void);
u64 getSoapId(void);
char * getDeviceCert(void);
char * getNNIDInfo(u32 size, u32 blkId);
char * isDebugModeEnabled();
char * isDebugModeEnabled(void);
char * getBrightness(u32 screen);
char * getCardSlotStatus();
char * getCardSlotStatus(void);

#endif
2 changes: 1 addition & 1 deletion include/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@

void getSizeString(char *string, uint64_t size);
void utf2ascii(char* dst, u16* src);
char * base64Encode(u8 const * input);
char * base64Encode(u8 const * bytesToEnc, size_t bufLen);

#endif
72 changes: 72 additions & 0 deletions include/wifi.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#ifndef WIFI_H
#define WIFI_H

#include <3ds.h>

/*
The things below here were found by LiquidFenrir and his Wifi Manager. (https://github.com/LiquidFenrir/WifiManager)
*/

#define CFG_WIFI_BLKID (u32)0x00080000
#define CFG_WIFI_SLOT_SIZE (u32)0xC00

typedef struct {
bool exists;
bool use;
bool second;
u8 padding1;
char SSID[0x20];
u8 SSID_length;
u8 AP_encryption_type;
u16 padding2;
char password[0x40]; //plaintext, blank for a network set up with WPS
u8 passwordPSK[0x20];
} networkStruct;

typedef struct {
bool exists;
u8 padding1;
u16 checksum; //crc-16 of the next 0x410 bytes, with initval 0: https://github.com/lammertb/libcrc/blob/v2.0/src/crc16.c#L43-L76
//if the network is set "normally", 'use' is 1
//if the network is set by WPS, 'use' is 0
//'second' is 0
//if setting multiple networks with WPS in the same session, only the last set will have this. others will have completely 0x00 except for 'exists'
networkStruct network;
u8 padding2[0x20];
//completely 0x00 if the network was set "normally", otherwise (set by WPS) normal but 'use' and 'second' are 1
networkStruct network_WPS;
u8 padding3[0x20C];

bool auto_obtain_IP; //defaults to 1
bool auto_obtain_DNS; //defaults to 1
u16 padding4;

u8 IP_address[4];
u8 gateway_address[4];
u8 subnet_mask[4];

u8 primary_DNS[4];
u8 secondary_DNS[4];

// if setting multiple networks in the same session, only the last set will have these. others will have completely 0x00
u8 unk1[4];
u8 IP_to_use[4];
u8 MAC_address[6];
u8 channel;
u8 padding5;

bool use_proxy; //defaults to 0
bool basic_authentication; //defaults to 0
u16 port_number; //defaults to 1
char proxy_address[0x30]; //including ending nullbyte
u8 padding6[0x34];
char proxy_username[0x20]; //including ending nullbyte
char proxy_password[0x20]; //including ending nullbyte
u16 padding7;
u16 MTU_value; //defaults to 1400, range [576;1500]

//nothing beyond this point (0x414), but each slot is 0xC00 big...
u8 padding8[0x7EC];
} wifiBlock;

#endif
1 change: 1 addition & 0 deletions resources/cia.rsf
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ AccessControlInfo:
- cecd:u
- cfg:nor
- cfg:u
- cfg:i
- cfg:s
- csnd:SND
- dsp::DSP
Expand Down
2 changes: 1 addition & 1 deletion source/kernel.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ char * getCID(int type)
else if (type == 1) //NAND
FSUSER_GetNandCid(buf, 0x10);

sprintf(cid, "%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X",
snprintf(cid, 33, "%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X",
buf[0], buf[1], buf[2], buf[3], buf[4], buf[5],
buf[6], buf[7], buf[8], buf[9], buf[10], buf[11],
buf[12], buf[13], buf[14], buf[15]);
Expand Down
Loading

0 comments on commit f8769ed

Please sign in to comment.