Homebrew Homebrew Development

TheCruel

Developer
Banned
Joined
Dec 6, 2013
Messages
1,350
Trophies
2
XP
3,130
Country
United States
Out of curiosity, can you somehow use SQL databases with ctrulib? I'd like to make an online leaderboard for the Snake game I've coded
ctrulib exposes sockets, so you can do almost any networked communication you want: send files to local printer, VoIP communication, HTTP, FTP, VNC, RDP, etc.

You just have to implement the protocol used. SQL databases all have pretty complicated protocols, and I wouldn't recommend putting that in your homebrew, it's unnecessary and would bloat your homebrew filesize. Just expose database access using some web API, like a simple PHP script you can query.
 

shinyquagsire23

SALT/Sm4sh Leak Guy
Member
Joined
Nov 18, 2012
Messages
1,977
Trophies
2
Age
26
Location
Las Vegas
XP
3,765
Country
United States
ctrulib exposes sockets, so you can do almost any networked communication you want: send files to local printer, VoIP communication, HTTP, FTP, VNC, RDP, etc.

You just have to implement the protocol used. SQL databases all have pretty complicated protocols, and I wouldn't recommend putting that in your homebrew, it's unnecessary and would bloat your homebrew filesize. Just expose database access using some web API, like a simple PHP script you can query.
This, I'd personally have an online server (maybe something RESTful, idk) which takes input for a name and a score and have the server end handle adding the values into a SQL table, and also a webpage to GET and display those high scores. Plus it'd be more secure that way, since you wouldn't have your credentials sitting in your 3dsx.
 
  • Like
Reactions: MichiS97

MichiS97

"Leftist snowflake milennial"
Member
Joined
Jun 14, 2011
Messages
1,815
Trophies
2
Age
26
Location
Munich
XP
3,597
Country
Germany
This, I'd personally have an online server (maybe something RESTful, idk) which takes input for a name and a score and have the server end handle adding the values into a SQL table, and also a webpage to GET and display those high scores. Plus it'd be more secure that way, since you wouldn't have your credentials sitting in your 3dsx.
Well...then I guess I'll have to learn to code in PHP and look for a free server :glare:
 

Tjessx

Well-Known Member
Member
Joined
Dec 3, 2014
Messages
1,160
Trophies
0
Age
27
XP
952
Country
Belgium
This, I'd personally have an online server (maybe something RESTful, idk) which takes input for a name and a score and have the server end handle adding the values into a SQL table, and also a webpage to GET and display those high scores. Plus it'd be more secure that way, since you wouldn't have your credentials sitting in your 3dsx.
I've been doubting to make something like this but a lot of people advised me to not do it because of server costs, and that it isn't worth the effort since not a lot of people would use it.

I've been giving this a lot of thought though, and you can't use this in an open source application.
I've also thought of a way to identify a 3DS, this way people could create user accounts, only get access to update their own stats, friendlist, ....
 

yodamerlin

Bok bok.
Member
Joined
Apr 1, 2014
Messages
322
Trophies
0
XP
1,050
Country
United Kingdom
I've been doubting to make something like this but a lot of people advised me to not do it because of server costs, and that it isn't worth the effort since not a lot of people would use it.

I've been giving this a lot of thought though, and you can't use this in an open source application.
I've also thought of a way to identify a 3DS, this way people could create user accounts, only get access to update their own stats, friendlist, ....
You should, despite the server costs.
 

MichiS97

"Leftist snowflake milennial"
Member
Joined
Jun 14, 2011
Messages
1,815
Trophies
2
Age
26
Location
Munich
XP
3,597
Country
Germany
My problem is that I know how to write a php script which interacts with a SQL database but what I don't know is how to make a C++ code interact with the PHP script. Like, for example, how would you let the user choose a username and then add it to the database? I mean you can't simply pass a variable or anything to a "website"....right?
 

yodamerlin

Bok bok.
Member
Joined
Apr 1, 2014
Messages
322
Trophies
0
XP
1,050
Country
United Kingdom
My problem is that I know how to write a php script which interacts with a SQL database but what I don't know is how to make a C++ code interact with the PHP script. Like, for example, how would you let the user choose a username and then add it to the database? I mean you can't simply pass a variable or anything to a "website"....right?
Well, you can request the webpage, placing all the fields in the url as GET requests.
 

Coto

-
Member
Joined
Jun 4, 2010
Messages
2,979
Trophies
2
XP
2,565
Country
Chile
My problem is that I know how to write a php script which interacts with a SQL database but what I don't know is how to make a C++ code interact with the PHP script. Like, for example, how would you let the user choose a username and then add it to the database? I mean you can't simply pass a variable or anything to a "website"....right?

you may want to take a look at SOAP spec
 

TheCruel

Developer
Banned
Joined
Dec 6, 2013
Messages
1,350
Trophies
2
XP
3,130
Country
United States
My problem is that I know how to write a php script which interacts with a SQL database but what I don't know is how to make a C++ code interact with the PHP script. Like, for example, how would you let the user choose a username and then add it to the database? I mean you can't simply pass a variable or anything to a "website"....right?
Users pass variables to websites all the time. Right now on gbatemp, I'm submitting this comment form which is POSTing in several values to: https://gbatemp.net/threads/homebrew-development.360646/add-reply

Go read some tutorials on basic web dev with databases.
 

yodamerlin

Bok bok.
Member
Joined
Apr 1, 2014
Messages
322
Trophies
0
XP
1,050
Country
United Kingdom

Rinnegatamante

Well-Known Member
Member
Joined
Nov 24, 2014
Messages
3,162
Trophies
2
Age
29
Location
Bologna
Website
rinnegatamante.it
XP
4,857
Country
Italy
You must be talking about HTTP:C which I've never used. I guess luckily I have HTTP implemented with TCP sockets.

Socketing is also broken for big homebrews ( https://github.com/smealum/ctrulib/issues/171 ) and if you try to call it on big homebrews you'll get also other bad side-effects like random crashes using GPU, crash on homebrew exiting and similar.
 

Technicmaster0

Well-Known Member
Member
Joined
Oct 22, 2011
Messages
4,406
Trophies
2
Website
www.flashkarten.tk
XP
3,497
Country
Gambia, The
I've been doubting to make something like this but a lot of people advised me to not do it because of server costs, and that it isn't worth the effort since not a lot of people would use it.

I've been giving this a lot of thought though, and you can't use this in an open source application.
I've also thought of a way to identify a 3DS, this way people could create user accounts, only get access to update their own stats, friendlist, ....
I can host small pages for you as well. But they wouldn't have a nice domain, more something like "myurl.com/homebrew/Tjessx".
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    K3Nv2 @ K3Nv2: Least they got head in the end