Apply formatting for files

This commit is contained in:
Fijxu 2025-01-30 01:40:38 -03:00
parent 048d4e8289
commit 28adbd583a
Signed by: Fijxu
GPG key ID: 32C1DDF333EDA6A4
10 changed files with 685 additions and 583 deletions

View file

@ -1,8 +1,9 @@
#pragma once
#include "3ds/types.h"
#include <stdbool.h>
#include "3ds/types.h"
struct settings {
char IPString[16];
int port;

View file

@ -1,12 +1,13 @@
#pragma once
#include <string.h>
#include <3ds.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <fcntl.h>
#include <netdb.h>
#include <netinet/in.h>
#include <string.h>
#include <sys/socket.h>
#include "3ds/services/hid.h"
#include "inet_pton.h"
#include "sys/_types.h"
@ -42,31 +43,31 @@ struct packet {
// KEYS
union {
struct keysPacket {
//Keys
// Keys
unsigned int keys;
//Cirle Pad
// Cirle Pad
struct {
short x;
short y;
} circlePad;
//Touchpad
// Touchpad
struct {
unsigned short x;
unsigned short y;
} touch;
//cStick
// cStick
struct {
short x;
short y;
} cStick;
//Volume
unsigned int volume; //way longer than needed, but it works.
// Volume
unsigned int volume; // way longer than needed, but it works.
//Gyroscope
// Gyroscope
struct {
short x;
short y;
@ -75,7 +76,7 @@ struct packet {
unsigned char padding;
//Accelerometer
// Accelerometer
struct {
short x;
short y;

View file

@ -1,108 +1,203 @@
#include <string.h>
#include <stdio.h>
#include <stdarg.h>
#include <3ds.h>
#include "drawing.h"
static const char fonts[] = { //Fonte 8x8 1BPP
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 //tile:0
, 0x18, 0x18, 0x18, 0x18, 0x18, 0x0, 0x18, 0x0 //tile:1
, 0x6c, 0x6c, 0x6c, 0x0, 0x0, 0x0, 0x0, 0x0 //tile:2
, 0x6c, 0x6c, 0xfe, 0x6c, 0xfe, 0x6c, 0x6c, 0x0 //tile:3
, 0x18, 0x7e, 0xc0, 0x7c, 0x6, 0xfc, 0x18, 0x0 //tile:4
, 0x0, 0xc6, 0xcc, 0x18, 0x30, 0x66, 0xc6, 0x0 //tile:5
, 0x38, 0x6c, 0x38, 0x76, 0xdc, 0xcc, 0x76, 0x0 //tile:6
, 0x30, 0x30, 0x60, 0x0, 0x0, 0x0, 0x0, 0x0 //tile:7
, 0xc, 0x18, 0x30, 0x30, 0x30, 0x18, 0xc, 0x0 //tile:8
, 0x30, 0x18, 0xc, 0xc, 0xc, 0x18, 0x30, 0x0 //tile:9
, 0x0, 0x66, 0x3c, 0xff, 0x3c, 0x66, 0x0, 0x0 //tile:10
, 0x0, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x0, 0x0 //tile:11
, 0x0, 0x0, 0x0, 0x0, 0x0, 0x18, 0x18, 0x30 //tile:12
, 0x0, 0x0, 0x0, 0x7e, 0x0, 0x0, 0x0, 0x0 //tile:13
, 0x0, 0x0, 0x0, 0x0, 0x0, 0x18, 0x18, 0x0 //tile:14
, 0x6, 0xc, 0x18, 0x30, 0x60, 0xc0, 0x80, 0x0 //tile:15
, 0x7c, 0xce, 0xde, 0xf6, 0xe6, 0xc6, 0x7c, 0x0 //tile:16
, 0x18, 0x38, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x0 //tile:17
, 0x7c, 0xc6, 0x6, 0x7c, 0xc0, 0xc0, 0xfe, 0x0 //tile:18
, 0xfc, 0x6, 0x6, 0x3c, 0x6, 0x6, 0xfc, 0x0 //tile:19
, 0xc, 0xcc, 0xcc, 0xcc, 0xfe, 0xc, 0xc, 0x0 //tile:20
, 0xfe, 0xc0, 0xfc, 0x6, 0x6, 0xc6, 0x7c, 0x0 //tile:21
, 0x7c, 0xc0, 0xc0, 0xfc, 0xc6, 0xc6, 0x7c, 0x0 //tile:22
, 0xfe, 0x6, 0x6, 0xc, 0x18, 0x30, 0x30, 0x0 //tile:23
, 0x7c, 0xc6, 0xc6, 0x7c, 0xc6, 0xc6, 0x7c, 0x0 //tile:24
, 0x7c, 0xc6, 0xc6, 0x7e, 0x6, 0x6, 0x7c, 0x0 //tile:25
, 0x0, 0x18, 0x18, 0x0, 0x0, 0x18, 0x18, 0x0 //tile:26
, 0x0, 0x18, 0x18, 0x0, 0x0, 0x18, 0x18, 0x30 //tile:27
, 0xc, 0x18, 0x30, 0x60, 0x30, 0x18, 0xc, 0x0 //tile:28
, 0x0, 0x0, 0x7e, 0x0, 0x7e, 0x0, 0x0, 0x0 //tile:29
, 0x30, 0x18, 0xc, 0x6, 0xc, 0x18, 0x30, 0x0 //tile:30
, 0x3c, 0x66, 0xc, 0x18, 0x18, 0x0, 0x18, 0x0 //tile:31
, 0x7c, 0xc6, 0xde, 0xde, 0xde, 0xc0, 0x7e, 0x0 //tile:32
, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0x0 //tile:33
, 0xfc, 0xc6, 0xc6, 0xfc, 0xc6, 0xc6, 0xfc, 0x0 //tile:34
, 0x7c, 0xc6, 0xc0, 0xc0, 0xc0, 0xc6, 0x7c, 0x0 //tile:35
, 0xf8, 0xcc, 0xc6, 0xc6, 0xc6, 0xcc, 0xf8, 0x0 //tile:36
, 0xfe, 0xc0, 0xc0, 0xf8, 0xc0, 0xc0, 0xfe, 0x0 //tile:37
, 0xfe, 0xc0, 0xc0, 0xf8, 0xc0, 0xc0, 0xc0, 0x0 //tile:38
, 0x7c, 0xc6, 0xc0, 0xc0, 0xce, 0xc6, 0x7c, 0x0 //tile:39
, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x0 //tile:40
, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x0 //tile:41
, 0x6, 0x6, 0x6, 0x6, 0x6, 0xc6, 0x7c, 0x0 //tile:42
, 0xc6, 0xcc, 0xd8, 0xf0, 0xd8, 0xcc, 0xc6, 0x0 //tile:43
, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xfe, 0x0 //tile:44
, 0xc6, 0xee, 0xfe, 0xfe, 0xd6, 0xc6, 0xc6, 0x0 //tile:45
, 0xc6, 0xe6, 0xf6, 0xde, 0xce, 0xc6, 0xc6, 0x0 //tile:46
, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x0 //tile:47
, 0xfc, 0xc6, 0xc6, 0xfc, 0xc0, 0xc0, 0xc0, 0x0 //tile:48
, 0x7c, 0xc6, 0xc6, 0xc6, 0xd6, 0xde, 0x7c, 0x6 //tile:49
, 0xfc, 0xc6, 0xc6, 0xfc, 0xd8, 0xcc, 0xc6, 0x0 //tile:50
, 0x7c, 0xc6, 0xc0, 0x7c, 0x6, 0xc6, 0x7c, 0x0 //tile:51
, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x0 //tile:52
, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xfe, 0x0 //tile:53
, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x38, 0x0 //tile:54
, 0xc6, 0xc6, 0xc6, 0xc6, 0xd6, 0xfe, 0x6c, 0x0 //tile:55
, 0xc6, 0xc6, 0x6c, 0x38, 0x6c, 0xc6, 0xc6, 0x0 //tile:56
, 0xc6, 0xc6, 0xc6, 0x7c, 0x18, 0x30, 0xe0, 0x0 //tile:57
, 0xfe, 0x6, 0xc, 0x18, 0x30, 0x60, 0xfe, 0x0 //tile:58
, 0x3c, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3c, 0x0 //tile:59
, 0xc0, 0x60, 0x30, 0x18, 0xc, 0x6, 0x2, 0x0 //tile:60
, 0x3c, 0xc, 0xc, 0xc, 0xc, 0xc, 0x3c, 0x0 //tile:61
, 0x10, 0x38, 0x6c, 0xc6, 0x0, 0x0, 0x0, 0x0 //tile:62
, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff //tile:63
, 0x18, 0x18, 0xc, 0x0, 0x0, 0x0, 0x0, 0x0 //tile:64
, 0x0, 0x0, 0x7c, 0x6, 0x7e, 0xc6, 0x7e, 0x0 //tile:65
, 0xc0, 0xc0, 0xc0, 0xfc, 0xc6, 0xc6, 0xfc, 0x0 //tile:66
, 0x0, 0x0, 0x7c, 0xc6, 0xc0, 0xc6, 0x7c, 0x0 //tile:67
, 0x6, 0x6, 0x6, 0x7e, 0xc6, 0xc6, 0x7e, 0x0 //tile:68
, 0x0, 0x0, 0x7c, 0xc6, 0xfe, 0xc0, 0x7c, 0x0 //tile:69
, 0x1c, 0x36, 0x30, 0x78, 0x30, 0x30, 0x78, 0x0 //tile:70
, 0x0, 0x0, 0x7e, 0xc6, 0xc6, 0x7e, 0x6, 0xfc //tile:71
, 0xc0, 0xc0, 0xfc, 0xc6, 0xc6, 0xc6, 0xc6, 0x0 //tile:72
, 0x18, 0x0, 0x38, 0x18, 0x18, 0x18, 0x3c, 0x0 //tile:73
, 0x6, 0x0, 0x6, 0x6, 0x6, 0x6, 0xc6, 0x7c //tile:74
, 0xc0, 0xc0, 0xcc, 0xd8, 0xf8, 0xcc, 0xc6, 0x0 //tile:75
, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x0 //tile:76
, 0x0, 0x0, 0xcc, 0xfe, 0xfe, 0xd6, 0xd6, 0x0 //tile:77
, 0x0, 0x0, 0xfc, 0xc6, 0xc6, 0xc6, 0xc6, 0x0 //tile:78
, 0x0, 0x0, 0x7c, 0xc6, 0xc6, 0xc6, 0x7c, 0x0 //tile:79
, 0x0, 0x0, 0xfc, 0xc6, 0xc6, 0xfc, 0xc0, 0xc0 //tile:80
, 0x0, 0x0, 0x7e, 0xc6, 0xc6, 0x7e, 0x6, 0x6 //tile:81
, 0x0, 0x0, 0xfc, 0xc6, 0xc0, 0xc0, 0xc0, 0x0 //tile:82
, 0x0, 0x0, 0x7e, 0xc0, 0x7c, 0x6, 0xfc, 0x0 //tile:83
, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x18, 0xe, 0x0 //tile:84
, 0x0, 0x0, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x0 //tile:85
, 0x0, 0x0, 0xc6, 0xc6, 0xc6, 0x7c, 0x38, 0x0 //tile:86
, 0x0, 0x0, 0xc6, 0xc6, 0xd6, 0xfe, 0x6c, 0x0 //tile:87
, 0x0, 0x0, 0xc6, 0x6c, 0x38, 0x6c, 0xc6, 0x0 //tile:88
, 0x0, 0x0, 0xc6, 0xc6, 0xc6, 0x7e, 0x6, 0xfc //tile:89
, 0x0, 0x0, 0xfe, 0xc, 0x38, 0x60, 0xfe, 0x0 //tile:90
, 0xe, 0x18, 0x18, 0x70, 0x18, 0x18, 0xe, 0x0 //tile:91
, 0x18, 0x18, 0x18, 0x0, 0x18, 0x18, 0x18, 0x0 //tile:92
, 0x70, 0x18, 0x18, 0xe, 0x18, 0x18, 0x70, 0x0 //tile:93
, 0x76, 0xdc, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 //tile:94
, 0x0, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0x0 //tile:95
#include <3ds.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
static const char fonts[] = {
// Fonte 8x8 1BPP
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 // tile:0
,
0x18, 0x18, 0x18, 0x18, 0x18, 0x0, 0x18, 0x0 // tile:1
,
0x6c, 0x6c, 0x6c, 0x0, 0x0, 0x0, 0x0, 0x0 // tile:2
,
0x6c, 0x6c, 0xfe, 0x6c, 0xfe, 0x6c, 0x6c, 0x0 // tile:3
,
0x18, 0x7e, 0xc0, 0x7c, 0x6, 0xfc, 0x18, 0x0 // tile:4
,
0x0, 0xc6, 0xcc, 0x18, 0x30, 0x66, 0xc6, 0x0 // tile:5
,
0x38, 0x6c, 0x38, 0x76, 0xdc, 0xcc, 0x76, 0x0 // tile:6
,
0x30, 0x30, 0x60, 0x0, 0x0, 0x0, 0x0, 0x0 // tile:7
,
0xc, 0x18, 0x30, 0x30, 0x30, 0x18, 0xc, 0x0 // tile:8
,
0x30, 0x18, 0xc, 0xc, 0xc, 0x18, 0x30, 0x0 // tile:9
,
0x0, 0x66, 0x3c, 0xff, 0x3c, 0x66, 0x0, 0x0 // tile:10
,
0x0, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x0, 0x0 // tile:11
,
0x0, 0x0, 0x0, 0x0, 0x0, 0x18, 0x18, 0x30 // tile:12
,
0x0, 0x0, 0x0, 0x7e, 0x0, 0x0, 0x0, 0x0 // tile:13
,
0x0, 0x0, 0x0, 0x0, 0x0, 0x18, 0x18, 0x0 // tile:14
,
0x6, 0xc, 0x18, 0x30, 0x60, 0xc0, 0x80, 0x0 // tile:15
,
0x7c, 0xce, 0xde, 0xf6, 0xe6, 0xc6, 0x7c, 0x0 // tile:16
,
0x18, 0x38, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x0 // tile:17
,
0x7c, 0xc6, 0x6, 0x7c, 0xc0, 0xc0, 0xfe, 0x0 // tile:18
,
0xfc, 0x6, 0x6, 0x3c, 0x6, 0x6, 0xfc, 0x0 // tile:19
,
0xc, 0xcc, 0xcc, 0xcc, 0xfe, 0xc, 0xc, 0x0 // tile:20
,
0xfe, 0xc0, 0xfc, 0x6, 0x6, 0xc6, 0x7c, 0x0 // tile:21
,
0x7c, 0xc0, 0xc0, 0xfc, 0xc6, 0xc6, 0x7c, 0x0 // tile:22
,
0xfe, 0x6, 0x6, 0xc, 0x18, 0x30, 0x30, 0x0 // tile:23
,
0x7c, 0xc6, 0xc6, 0x7c, 0xc6, 0xc6, 0x7c, 0x0 // tile:24
,
0x7c, 0xc6, 0xc6, 0x7e, 0x6, 0x6, 0x7c, 0x0 // tile:25
,
0x0, 0x18, 0x18, 0x0, 0x0, 0x18, 0x18, 0x0 // tile:26
,
0x0, 0x18, 0x18, 0x0, 0x0, 0x18, 0x18, 0x30 // tile:27
,
0xc, 0x18, 0x30, 0x60, 0x30, 0x18, 0xc, 0x0 // tile:28
,
0x0, 0x0, 0x7e, 0x0, 0x7e, 0x0, 0x0, 0x0 // tile:29
,
0x30, 0x18, 0xc, 0x6, 0xc, 0x18, 0x30, 0x0 // tile:30
,
0x3c, 0x66, 0xc, 0x18, 0x18, 0x0, 0x18, 0x0 // tile:31
,
0x7c, 0xc6, 0xde, 0xde, 0xde, 0xc0, 0x7e, 0x0 // tile:32
,
0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0x0 // tile:33
,
0xfc, 0xc6, 0xc6, 0xfc, 0xc6, 0xc6, 0xfc, 0x0 // tile:34
,
0x7c, 0xc6, 0xc0, 0xc0, 0xc0, 0xc6, 0x7c, 0x0 // tile:35
,
0xf8, 0xcc, 0xc6, 0xc6, 0xc6, 0xcc, 0xf8, 0x0 // tile:36
,
0xfe, 0xc0, 0xc0, 0xf8, 0xc0, 0xc0, 0xfe, 0x0 // tile:37
,
0xfe, 0xc0, 0xc0, 0xf8, 0xc0, 0xc0, 0xc0, 0x0 // tile:38
,
0x7c, 0xc6, 0xc0, 0xc0, 0xce, 0xc6, 0x7c, 0x0 // tile:39
,
0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x0 // tile:40
,
0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x0 // tile:41
,
0x6, 0x6, 0x6, 0x6, 0x6, 0xc6, 0x7c, 0x0 // tile:42
,
0xc6, 0xcc, 0xd8, 0xf0, 0xd8, 0xcc, 0xc6, 0x0 // tile:43
,
0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xfe, 0x0 // tile:44
,
0xc6, 0xee, 0xfe, 0xfe, 0xd6, 0xc6, 0xc6, 0x0 // tile:45
,
0xc6, 0xe6, 0xf6, 0xde, 0xce, 0xc6, 0xc6, 0x0 // tile:46
,
0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x0 // tile:47
,
0xfc, 0xc6, 0xc6, 0xfc, 0xc0, 0xc0, 0xc0, 0x0 // tile:48
,
0x7c, 0xc6, 0xc6, 0xc6, 0xd6, 0xde, 0x7c, 0x6 // tile:49
,
0xfc, 0xc6, 0xc6, 0xfc, 0xd8, 0xcc, 0xc6, 0x0 // tile:50
,
0x7c, 0xc6, 0xc0, 0x7c, 0x6, 0xc6, 0x7c, 0x0 // tile:51
,
0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x0 // tile:52
,
0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xfe, 0x0 // tile:53
,
0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x38, 0x0 // tile:54
,
0xc6, 0xc6, 0xc6, 0xc6, 0xd6, 0xfe, 0x6c, 0x0 // tile:55
,
0xc6, 0xc6, 0x6c, 0x38, 0x6c, 0xc6, 0xc6, 0x0 // tile:56
,
0xc6, 0xc6, 0xc6, 0x7c, 0x18, 0x30, 0xe0, 0x0 // tile:57
,
0xfe, 0x6, 0xc, 0x18, 0x30, 0x60, 0xfe, 0x0 // tile:58
,
0x3c, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3c, 0x0 // tile:59
,
0xc0, 0x60, 0x30, 0x18, 0xc, 0x6, 0x2, 0x0 // tile:60
,
0x3c, 0xc, 0xc, 0xc, 0xc, 0xc, 0x3c, 0x0 // tile:61
,
0x10, 0x38, 0x6c, 0xc6, 0x0, 0x0, 0x0, 0x0 // tile:62
,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff // tile:63
,
0x18, 0x18, 0xc, 0x0, 0x0, 0x0, 0x0, 0x0 // tile:64
,
0x0, 0x0, 0x7c, 0x6, 0x7e, 0xc6, 0x7e, 0x0 // tile:65
,
0xc0, 0xc0, 0xc0, 0xfc, 0xc6, 0xc6, 0xfc, 0x0 // tile:66
,
0x0, 0x0, 0x7c, 0xc6, 0xc0, 0xc6, 0x7c, 0x0 // tile:67
,
0x6, 0x6, 0x6, 0x7e, 0xc6, 0xc6, 0x7e, 0x0 // tile:68
,
0x0, 0x0, 0x7c, 0xc6, 0xfe, 0xc0, 0x7c, 0x0 // tile:69
,
0x1c, 0x36, 0x30, 0x78, 0x30, 0x30, 0x78, 0x0 // tile:70
,
0x0, 0x0, 0x7e, 0xc6, 0xc6, 0x7e, 0x6, 0xfc // tile:71
,
0xc0, 0xc0, 0xfc, 0xc6, 0xc6, 0xc6, 0xc6, 0x0 // tile:72
,
0x18, 0x0, 0x38, 0x18, 0x18, 0x18, 0x3c, 0x0 // tile:73
,
0x6, 0x0, 0x6, 0x6, 0x6, 0x6, 0xc6, 0x7c // tile:74
,
0xc0, 0xc0, 0xcc, 0xd8, 0xf8, 0xcc, 0xc6, 0x0 // tile:75
,
0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x0 // tile:76
,
0x0, 0x0, 0xcc, 0xfe, 0xfe, 0xd6, 0xd6, 0x0 // tile:77
,
0x0, 0x0, 0xfc, 0xc6, 0xc6, 0xc6, 0xc6, 0x0 // tile:78
,
0x0, 0x0, 0x7c, 0xc6, 0xc6, 0xc6, 0x7c, 0x0 // tile:79
,
0x0, 0x0, 0xfc, 0xc6, 0xc6, 0xfc, 0xc0, 0xc0 // tile:80
,
0x0, 0x0, 0x7e, 0xc6, 0xc6, 0x7e, 0x6, 0x6 // tile:81
,
0x0, 0x0, 0xfc, 0xc6, 0xc0, 0xc0, 0xc0, 0x0 // tile:82
,
0x0, 0x0, 0x7e, 0xc0, 0x7c, 0x6, 0xfc, 0x0 // tile:83
,
0x18, 0x18, 0x7e, 0x18, 0x18, 0x18, 0xe, 0x0 // tile:84
,
0x0, 0x0, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x0 // tile:85
,
0x0, 0x0, 0xc6, 0xc6, 0xc6, 0x7c, 0x38, 0x0 // tile:86
,
0x0, 0x0, 0xc6, 0xc6, 0xd6, 0xfe, 0x6c, 0x0 // tile:87
,
0x0, 0x0, 0xc6, 0x6c, 0x38, 0x6c, 0xc6, 0x0 // tile:88
,
0x0, 0x0, 0xc6, 0xc6, 0xc6, 0x7e, 0x6, 0xfc // tile:89
,
0x0, 0x0, 0xfe, 0xc, 0x38, 0x60, 0xfe, 0x0 // tile:90
,
0xe, 0x18, 0x18, 0x70, 0x18, 0x18, 0xe, 0x0 // tile:91
,
0x18, 0x18, 0x18, 0x0, 0x18, 0x18, 0x18, 0x0 // tile:92
,
0x70, 0x18, 0x18, 0xe, 0x18, 0x18, 0x70, 0x0 // tile:93
,
0x76, 0xdc, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 // tile:94
,
0x0, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0x0 // tile:95
};
inline void clearScreen(void) {
@ -116,13 +211,13 @@ void drawPixelRGBFramebuffer(u8 *fb, int x, int y, u8 r, u8 g, u8 b) {
u32 v = (y + x * 240) * 3;
u8 *topLeftFB = fb ? fb : gfxGetFramebuffer(GFX_BOTTOM, GFX_LEFT, NULL, NULL);
topLeftFB[v] = (b >> 3) + ((g & 0x1C) << 3);
topLeftFB[v+1] = ((g & 0xE0) >> 5) + (r & 0xF8);
topLeftFB[v + 1] = ((g & 0xE0) >> 5) + (r & 0xF8);
}
inline void drawBoxFramebuffer(u8 *fb, int x, int y, int width, int height, u8 r, u8 g, u8 b) {
int lx, ly;
for(lx = x; lx < x + width; lx++) {
for(ly = y; ly < y + height; ly++) {
for (lx = x; lx < x + width; lx++) {
for (ly = y; ly < y + height; ly++) {
drawPixelRGBFramebuffer(fb, lx, ly, r, g, b);
}
}
@ -136,18 +231,18 @@ void drawStringFramebuffer(u8 *fb, int sx, int sy, char *text, ...) {
va_end(args);
int i;
for(i = 0; i < strlen(str); i++) {
for (i = 0; i < strlen(str); i++) {
int fntnum = (str[i] - 32) & 0xFF;
int y;
for(y = 0; y < 8; y++) {
for (y = 0; y < 8; y++) {
int currbyte = fonts[(fntnum * 8) + y];
//Desenha sprite de 1BPP
// Desenha sprite de 1BPP
int x;
int mult = 0x80;
for(x = 0; x < 8; x++) {
if((currbyte & mult) == mult) {
for (x = 0; x < 8; x++) {
if ((currbyte & mult) == mult) {
drawPixelRGBFramebuffer(fb, sx + x, sy + y, 0xFF, 0xFF, 0xFF);
drawPixelRGBFramebuffer(fb, sx + x, sy + y + 1, 0, 0, 0); //Sombra
drawPixelRGBFramebuffer(fb, sx + x, sy + y + 1, 0, 0, 0); // Sombra
}
mult /= 2;
}
@ -169,8 +264,6 @@ void disableBacklight() {
GSPGPU_WriteHWRegs(REG_LCDBACKLIGHTSUB, &off, 4);
}
void enableBacklight() {
GSPGPU_WriteHWRegs(REG_LCDBACKLIGHTMAIN, &brightnessMain, 4);
GSPGPU_WriteHWRegs(REG_LCDBACKLIGHTSUB, &brightnessSub, 4);

View file

@ -1,7 +1,7 @@
#include "wireless.h"
#include "inet_pton.h"
#include "wireless.h"
int inet_pton4(const char *src, unsigned char *dst) {
static const char digits[] = "0123456789";
int saw_digit, octets, ch;
@ -11,33 +11,31 @@ int inet_pton4(const char *src, unsigned char *dst) {
octets = 0;
tp = tmp;
*tp = 0;
while((ch = *src++) != '\0') {
while ((ch = *src++) != '\0') {
const char *pch;
if((pch = strchr(digits, ch)) != NULL) {
if ((pch = strchr(digits, ch)) != NULL) {
unsigned int val = *tp * 10 + (unsigned int)(pch - digits);
if(saw_digit && *tp == 0)
if (saw_digit && *tp == 0)
return (0);
if(val > 255)
if (val > 255)
return (0);
*tp = (unsigned char)val;
if(! saw_digit) {
if(++octets > 4)
if (!saw_digit) {
if (++octets > 4)
return (0);
saw_digit = 1;
}
}
else if(ch == '.' && saw_digit) {
if(octets == 4)
} else if (ch == '.' && saw_digit) {
if (octets == 4)
return (0);
*++tp = 0;
saw_digit = 0;
}
else
} else
return (0);
}
if(octets < 4)
if (octets < 4)
return (0);
memcpy(dst, tmp, INADDRSZ);
return (1);

View file

@ -1,58 +1,68 @@
#include <stdlib.h>
#include <string.h>
#include <malloc.h>
#include "input.h"
#include <3ds.h>
#include <malloc.h>
#include <stdlib.h>
#include <string.h>
#include "drawing.h"
#include "input.h"
int inputIP(void) {
touchPosition touch;
hidTouchRead(&touch);
//Draw Keypad
drawString(160-20,50, "1");
// Draw Keypad
drawString(160 - 20, 50, "1");
drawString(160, 50, "2");
drawString(160+20, 50, "3");
drawString(160 + 20, 50, "3");
drawString(160-20, 50+20, "4");
drawString(160, 50+20, "5");
drawString(160+20, 50+20, "6");
drawString(160 - 20, 50 + 20, "4");
drawString(160, 50 + 20, "5");
drawString(160 + 20, 50 + 20, "6");
drawString(160-20, 50+40, "7");
drawString(160, 50+40, "8");
drawString(160+20, 50+40, "9");
drawString(160 - 20, 50 + 40, "7");
drawString(160, 50 + 40, "8");
drawString(160 + 20, 50 + 40, "9");
drawString(160-10, 50+60, ".");
drawString(160+10, 50+60, "0");
drawString(160 - 10, 50 + 60, ".");
drawString(160 + 10, 50 + 60, "0");
//Bottom Strip
if(touch.py > 50+50 && touch.py < 50+70) {
if(touch.px < 160 && touch.px > 160-20) return 11; // Dot
else if(touch.px < 160+20 && touch.px > 160) return 0; // Zero
// Bottom Strip
if (touch.py > 50 + 50 && touch.py < 50 + 70) {
if (touch.px < 160 && touch.px > 160 - 20)
return 11; // Dot
else if (touch.px < 160 + 20 && touch.px > 160)
return 0; // Zero
}
//First Column
else if(touch.px < 160-10 && touch.px > 160-30) {
if(touch.py < 50+10 && touch.py > 50-10) return 1; // One
else if(touch.py < 50+30 && touch.py > 50+10) return 4; // Four
else if(touch.py < 50+50 && touch.py > 50+30) return 7; // Seven
// First Column
else if (touch.px < 160 - 10 && touch.px > 160 - 30) {
if (touch.py < 50 + 10 && touch.py > 50 - 10)
return 1; // One
else if (touch.py < 50 + 30 && touch.py > 50 + 10)
return 4; // Four
else if (touch.py < 50 + 50 && touch.py > 50 + 30)
return 7; // Seven
}
// Second Column
else if(touch.px < 160+10 && touch.px > 160-10) {
if(touch.py < 50+10 && touch.py > 50-10) return 2; // Two
else if(touch.py < 50+30 && touch.py > 50+10) return 5; // Five
else if(touch.py < 50+50 && touch.py > 50+30) return 8; // Eight
else if (touch.px < 160 + 10 && touch.px > 160 - 10) {
if (touch.py < 50 + 10 && touch.py > 50 - 10)
return 2; // Two
else if (touch.py < 50 + 30 && touch.py > 50 + 10)
return 5; // Five
else if (touch.py < 50 + 50 && touch.py > 50 + 30)
return 8; // Eight
}
// Third Column
else if(touch.px < 160+30 && touch.px > 160+10) {
if(touch.py < 50+10 && touch.py > 50-10) return 3; // Three
else if(touch.py < 50+30 && touch.py > 50+10) return 6; // Six
else if(touch.py < 50+50 && touch.py > 50+30) return 9; // Nine
else if (touch.px < 160 + 30 && touch.px > 160 + 10) {
if (touch.py < 50 + 10 && touch.py > 50 - 10)
return 3; // Three
else if (touch.py < 50 + 30 && touch.py > 50 + 10)
return 6; // Six
else if (touch.py < 50 + 50 && touch.py > 50 + 30)
return 9; // Nine
}
return 10;

View file

@ -1,11 +1,11 @@
#include "keyboard.h"
#include <3ds.h>
#include <math.h>
#include <string.h>
#include "drawing.h"
#include "keyboard.h"
const char keyboardChars[60] = "!1234567890\x08QWERTYUIOP\13\13ASDFGHJKL-\13\13ZXCVBNM,.?\13\13\0\0\0 \0\0\0\0";
unsigned char keyboardActive = false;
@ -17,19 +17,19 @@ void preRenderKeyboard(void) {
const char chars[60] = "!1234567890\x08QWERTYUIOP\13\13ASDFGHJKL-\13\13ZXCVBNM,.?\13\13\0\0\0 \0\0\0\0";
int x, y;
for(x = 0; x < 12; x++) {
for(y = 0; y < 4; y++) {
for (x = 0; x < 12; x++) {
for (y = 0; y < 4; y++) {
// Not enter
if(chars[x + y * 12] != '\13') {
if (chars[x + y * 12] != '\13') {
drawBoxFramebuffer(keyboardGfx, (int)((float)x * 320.0f / 12.0f), (int)(78.0f + (float)y * 320.0f / 12.0f), 25, 25, 31, 31, 31);
drawBoxFramebuffer(keyboardGfx, (int)((float)x * 320.0f / 12.0f) + 1, (int)(78.0f + (float)y * 320.0f / 12.0f) + 1, 24, 24, 31, 0, 0);
// Backspace
if(chars[x + y * 12] == '\x08') {
if (chars[x + y * 12] == '\x08') {
drawStringFramebuffer(keyboardGfx, (int)((float)x * 320.0f / 12.0f) + 10, (int)(78.0f + (float)y * 320.0f / 12.0f) + 9, "-");
drawStringFramebuffer(keyboardGfx, (int)((float)x * 320.0f / 12.0f) + 8, (int)(78.0f + (float)y * 320.0f / 12.0f) + 9, "<");
}
else drawStringFramebuffer(keyboardGfx, (int)((float)x * 320.0f / 12.0f) + 9, (int)(78.0f + (float)y * 320.0f / 12.0f) + 9, "%c", chars[x + y * 12]);
} else
drawStringFramebuffer(keyboardGfx, (int)((float)x * 320.0f / 12.0f) + 9, (int)(78.0f + (float)y * 320.0f / 12.0f) + 9, "%c", chars[x + y * 12]);
}
}
}

View file

@ -1,13 +1,12 @@
#include <3ds.h>
#include <malloc.h>
#include <setjmp.h>
#include <stdlib.h>
#include <string.h>
#include <3ds.h>
#include "3ds/services/gsplcd.h"
#include "3ds/services/hid.h"
#include "3ds/services/soc.h"
#include "drawing.h"
#include "input.h"
// #include "keyboard.h"
@ -84,7 +83,7 @@ int main(void) {
openSocket(settings.port);
sendConnectionRequest();
// clearScreen();
// clearScreen();
drawString(10, 10, "Sending data to %s on port %d...", settings.IPString,
settings.port);
gfxFlushBuffers();

View file

@ -1,18 +1,17 @@
#include <stdio.h>
#include <malloc.h>
#include "settings.h"
#include <3ds.h>
#include <malloc.h>
#include <stdio.h>
#include "3ds/services/fs.h"
#include "wireless.h"
#include "settings.h"
struct settings settings;
struct settings defaultSettings = {
.IPString = "",
.port= DEFAULT_PORT,
.port = DEFAULT_PORT,
};
Handle fileHandle;
@ -20,11 +19,11 @@ Handle fileHandle;
static bool getSetting(char *name, char *src, char *dest) {
char *start = strstr(src, name);
if(start) {
if (start) {
start += strlen(name);
char *end = start + strlen(start);
if(strstr(start, "\n") - 1 < end) end = strstr(start, "\n") - 1;
if (strstr(start, "\n") - 1 < end) end = strstr(start, "\n") - 1;
size_t size = (size_t)end - (size_t)start;
strncpy(dest, start, size);
@ -47,34 +46,33 @@ bool readSettings(void) {
FS_Path filePath = fsMakePath(PATH_ASCII, "/3DSController.ini");
Result ret = FSUSER_OpenFileDirectly(&fileHandle, sdmcArchiveID, fileArchive, filePath, FS_OPEN_READ, FS_ATTRIBUTE_HIDDEN);
if(ret) return false;
if (ret) return false;
ret = FSFILE_GetSize(fileHandle, &size);
if(ret) return false;
if (ret) return false;
buffer = malloc(size);
if(!buffer) return false;
if (!buffer) return false;
ret = FSFILE_Read(fileHandle, &bytesRead, 0x0, buffer, size);
if(ret || size != bytesRead) return false;
if (ret || size != bytesRead) return false;
ret = FSFILE_Close(fileHandle);
if(ret) return false;
if (ret) return false;
memcpy(&settings, &defaultSettings, sizeof(struct settings));
char setting[64] = { '\0' };
char setting[64] = {'\0'};
if(getSetting("IP: ", buffer, settings.IPString)) {
//inet_pton(AF_INET, settings.IPString, &(saout.sin_addr));
if (getSetting("IP: ", buffer, settings.IPString)) {
// inet_pton(AF_INET, settings.IPString, &(saout.sin_addr));
inet_pton4(settings.IPString, (unsigned char *)&(saout.sin_addr));
}
else {
} else {
free(buffer);
return false;
}
if(getSetting("Port: ", buffer, setting)) {
if (getSetting("Port: ", buffer, setting)) {
sscanf(setting, "%d", &settings.port);
}

View file

@ -1,8 +1,10 @@
#include "wireless.h"
#include <stddef.h>
#include <string.h>
#include "keyboard.h"
#include "sys/_types.h"
#include "wireless.h"
int sock;
struct sockaddr_in sain, saout;