Homebrew Feedback Homebrew app WIP - Jermus 3DS Web Browser

AliceCE

Rookie 3DS Homebrew Dev
OP
Member
Joined
Aug 7, 2019
Messages
203
Trophies
0
Location
Amogus World Theme Park, BR
XP
479
Country
United States
Anyone know how to match a character in a C-Style char array?? I can't seem to get my function that's supposed to shift the line down by one working because it's not detecting characters properly.


if((int(text[c])=10) { yoffs=yoffs+6; xoffs=0; }
 

Pk11

A catgirl with a DSi
Member
Joined
Jun 26, 2019
Messages
826
Trophies
1
Age
20
Location
米国
Website
pk11.us
XP
2,749
Country
United States
Anyone know how to match a character in a C-Style char array?? I can't seem to get my function that's supposed to shift the line down by one working because it's not detecting characters properly.


if((int(text[c])=10) { yoffs=yoffs+6; xoffs=0; }
I assume you're trying to find newlines? You need == not =, = is assignment so you're setting text[c] to 10 there. Also, casting to int isn't needed because char and int are both just numbers in C so you can just compare directly. You can also do '\n' instead of 10 for the newline, like:
C:
if(text[c] == '\n') // '\n', '\x0A', '\12', 0xA, 10, 012, and 0b1010 are all equivalent
{
    yoffs += 6; // can also do += instead of i = i + #
    yoffs = 0;
}

Alternatively you can also do strchr(text, '\n') and it will return a char pointer to the position of the first newline if found or nullptr if not.
 

AliceCE

Rookie 3DS Homebrew Dev
OP
Member
Joined
Aug 7, 2019
Messages
203
Trophies
0
Location
Amogus World Theme Park, BR
XP
479
Country
United States
I assume you're trying to find newlines? You need == not =, = is assignment so you're setting text[c] to 10 there. Also, casting to int isn't needed because char and int are both just numbers in C so you can just compare directly. You can also do '\n' instead of 10 for the newline, like:
C:
if(text[c] == '\n') // '\n', '\x0A', '\12', 0xA, 10, 012, and 0b1010 are all equivalent
{
    yoffs += 6; // can also do += instead of i = i + #
    yoffs = 0;
}

Alternatively you can also do strchr(text, '\n') and it will return a char pointer to the position of the first newline if found or nullptr if not.
The "==" worked, Thanks! i can now safely say i've began the graphical portion of the program, although i will likely still have to continue doing some stuff under the hood, such as implementing touch after i get the text and controls fully implemented, and then after that, i guess that'd be a good time for a test release, as well as a source code release too.

Also, i decided to use a binary stored font in a char array, along with 3 for loops to draw the characters to the screen, it's probably an incredibly shit way to do it, but i found returning to my BASIC roots easier than burning myself out for 3 weeks trying to implement it using files or citro2d (^ ^;
 

AliceCE

Rookie 3DS Homebrew Dev
OP
Member
Joined
Aug 7, 2019
Messages
203
Trophies
0
Location
Amogus World Theme Park, BR
XP
479
Country
United States
I can't seem to get my program to recognize a character to use as an ending to the text variable, I'm trying to do this because i'm using a dynamic character array for the text that gets written to the screen, without (and as of right now, still with) the escape character, it just reads garbage data outside the buffer, which doesn't look good.

Is there either 1, a way to properly get the size of a dynamic character array? or 2, a fix to the fact that it wont pick up the character (214) as the ending character to stop writing text to the screen?


the solution was to match it with the null character, i thought the null character was unreadable. >_<
 
Last edited by AliceCE,

Eveldee

Well-Known Member
Member
Joined
Aug 16, 2019
Messages
210
Trophies
0
Age
21
XP
817
Country
France
I can't seem to get my program to recognize a character to use as an ending to the text variable, I'm trying to do this because i'm using a dynamic character array for the text that gets written to the screen, without (and as of right now, still with) the escape character, it just reads garbage data outside the buffer, which doesn't look good.

Is there either 1, a way to properly get the size of a dynamic character array? or 2, a fix to the fact that it wont pick up the character (214) as the ending character to stop writing text to the screen?


the solution was to match it with the null character, i thought the null character was unreadable. >_<
Yes, strlen does exactly that, it reads the string till it find the '\0' character because strings (character arrays) are delimited by this character in C. Be careful to make sure your char array contains this delimiter, otherwise you'll read out of bounds memory and you'll most likely get a segfault.
 

AliceCE

Rookie 3DS Homebrew Dev
OP
Member
Joined
Aug 7, 2019
Messages
203
Trophies
0
Location
Amogus World Theme Park, BR
XP
479
Country
United States
How do i join two c strings together? i try strcat with constant strings (i.e strcat("Hello!",bar);), and it always complains about the constants, i make one of them a constant too, and suddenly the other variable isn't a constant anymore. Is there just, a better, more versatile way to combine C strings?
 

Brawl345

Well-Known Member
Member
Joined
Jan 14, 2012
Messages
726
Trophies
1
Website
wiidatabase.de
XP
2,431
Country
Germany
Not trying to sound rude, but I think you should start with some basic programs and learning the basics about C programming before announcing something ambitious. Loading the source code via cURL is of course faster than rendering it and this is also the hardest part.
You would have to port a browser engine to the 3DS which is impossible (well, nearly but yeah) or code one from scratch (just no).
 

AliceCE

Rookie 3DS Homebrew Dev
OP
Member
Joined
Aug 7, 2019
Messages
203
Trophies
0
Location
Amogus World Theme Park, BR
XP
479
Country
United States
error page screenshot.png
splashscreen.png
https-www-amogus-org.png
exitscreen.png

I think i'm doing quite well, though. Just needs a lot more of the other features implemented, as well as a fix for everything dissapearing after a certain point in the scrolling.

(image 2 is the splash screen, not an actually loaded external image)
 
  • Like
Reactions: peteruk

AliceCE

Rookie 3DS Homebrew Dev
OP
Member
Joined
Aug 7, 2019
Messages
203
Trophies
0
Location
Amogus World Theme Park, BR
XP
479
Country
United States
https://github.com/Ghost-Bit/Shanghai
Test release is up. Controls should be in the opening screen.
It's not done, this is just for feedback and suggestions.
Keep in mind this is my first C++ program, so you might see a mishmash of my Basic experience in this code. Sorry... (^ ^;

This current version cannot handle large websites, try smaller ones like the GNU site or Example.com. Also, the full URL is needed, this.com will not work, https://www.this.com will.
 
  • Like
  • Love
Reactions: I pwned U! and Wavy

KleinesSinchen

GBAtemp's Backup Reminder + Fearless Testing Sina
Member
GBAtemp Patron
Joined
Mar 28, 2018
Messages
3,062
Trophies
2
XP
8,052
Country
Germany
You would have to port a browser engine to the 3DS which is impossible (well, nearly but yeah)
Why should that be (nearly) impossible? The existence of the (outdated, unusable by now) integrated browser applet is more than enough proof that it is very well possible. Many pages fail on old type consoles with out of memory – which is no surprise when running in applet mode. 80MB extended memory mode should be enough to process and render a single site (no tabs), possibly a mobile version of the site if available.

I guess the reason why it never happened is the "Use your phone! Don't you have a phone?"-attitude. Developers had no interest.

I do get the problem here: A full-blown web browser is a very complex application¹ (even a half operating system on its own²). Even a text-only browser for 3DS (with the ability to download files) would be very, very helpful. A homebrew web browser on 3DS is not gonna compete with the desktop version of a modern browser. I'd really appreciate something like this (and would have tried on my own if I was able to develop stuff – which I can't thanks to my concentration issues)

Not trying to sound rude,
Yes. There is no reason to be/sound rude in the first place…
but I think you should start with some basic programs and learning the basics about C programming before announcing something ambitious.
Ah.





__________________________
¹ No wonder there are always errors/security loop holes leading to exploits – we've had many on 3DS
¹ Given the fact that moderns browsers can run full, old operating systems or emulators in Javascript
 

Modular511

Well-Known Member
Member
Joined
Sep 12, 2009
Messages
256
Trophies
0
XP
757
Country
United States
Even the New 3DS Doesn't have enough horsepower to be as good as even a ten year old cell phone, very ambitious, I wish you luck in this pursuit!
 

Brawl345

Well-Known Member
Member
Joined
Jan 14, 2012
Messages
726
Trophies
1
Website
wiidatabase.de
XP
2,431
Country
Germany
The existence of the (outdated, unusable by now) integrated browser applet is more than enough proof that it is very well possible
If you are a company with the size of Nintendo.
80MB extended memory mode should be enough to process and render a single site
I think you underestimate the ressources required to run a usable browser. Not to mention stuff like handling TLS.

text-only browser
OP said "advanced web browser".
There is no reason to be/sound rude in the first place
It is a figure of speech.
 

AliceCE

Rookie 3DS Homebrew Dev
OP
Member
Joined
Aug 7, 2019
Messages
203
Trophies
0
Location
Amogus World Theme Park, BR
XP
479
Country
United States
1. There's already a homebrew web browser for the DS. Why can't i make one on my own? Just because i'm one person doesn't mean i can't make something.
2. I've made some conceptual browsers in JS that parse web pages pretty well without conventional means. Keep in mind that this isn't finished yet.
3. i didn't say it wasn't going to be a text only browser, admittedly, though, it was my bad for not stating that before stating that it would be an advanced web browser. If i can figure it out, i'll probably implement images, but i have no guarantee on the point in time this will be added. Downloading files and visiting other pages will absolutely be implemented, that was the initial goal of this browser.

All in all, it's not finished yet, and i'm not going to drop development, especially since this is the first programming project i've ever done that's actually gotten me hooked on coding it, Programming this is both really fun and a really great test of the skill i've accumulated over the years in programming in different languages, and a good way to keep myself busy when there's nothing else to do at home. I have no guarantees about the sequence or time each feature will be added, but everyone here can rest easy knowing this browser is in daily, active development.
 

KleinesSinchen

GBAtemp's Backup Reminder + Fearless Testing Sina
Member
GBAtemp Patron
Joined
Mar 28, 2018
Messages
3,062
Trophies
2
XP
8,052
Country
Germany
@Brawl345
I stand by my assessment that basic web browsing, even beyond text, should be within range of the old 3DS models. What I can agree on, is that porting a full browser engine is an enormous task. What I don't agree on, is denying the possibility.

Sadly this goes off-topic here, but instead of not answering, I'll put my reply in a spoiler to not clutter the thread.
If you are a company with the size of Nintendo.
🤦‍♀️
Yeah, the big company put all their capabilities and resources into creating that lazy applet. I guess a team of 100 developers must have been busy for at least three years.

I think you underestimate the ressources required to run a usable browser. Not to mention stuff like handling TLS.
Good to know at least you are fully in the know.

Interestingly all the people shouting "N64 emulation isn't possible on (New) 3DS! There will NEVER be an N64 emulator, not even a proof of concept one!" became very silent at some point.

Now… Rather than just pondering what amount of computer resources is needed for running a usable browser (however "usable" is defined here; will surely depend on person, preference and use-case), I'll just run a browser on a weak computer.

Test machine: Celeron 433MHz Laptop from 1999 (originally came with Windows 98SE), now running the very modern Windows XP SP3. This laptop was weak even for the time. The processor is too old to have SSE2 instruction set. This prevents the latest Windows XP compatible Firefox 52.9.0ESR from starting. The last one that works is 45.9.0ESR from April 2017. Not too bad for a year 1999 budget computer with 192MB RAM (I've expanded the memory at some point)
This PC is overall weaker than the Old 3DS.

Result:
screenshot.png
Browser running slowly (surprise), but can open desktop GBAtemp just fine (not that I would login with Windows XP running such an old browser). Memory usage about 120MB. Full scripts active, full desktop mode, zero optimization, just a full-blown (old) browser running with all the bells and whistles.
If the 3DS was able to browse the web like this laptop, I personally accept this as usable for reading news, checking GBAtemp (without login) and downloading files.

OP said "advanced web browser".
Didn't even notice that. Exaggerated and maybe boastful when not having anything ready yet(?)

It is a figure of speech.
And an unfriendly one. "I don't want to sound rude… but do your homework and start with the basics."
If I wanted to place any comments in the direction: "Learn walking before trying to run.", I'd choose the PM system for that – not the public discussion – but hey, that's me.


@AliceCE Good luck with your project.
 
  • Like
Reactions: Alexander1970

AliceCE

Rookie 3DS Homebrew Dev
OP
Member
Joined
Aug 7, 2019
Messages
203
Trophies
0
Location
Amogus World Theme Park, BR
XP
479
Country
United States
Jesus, a browser that decrepit can still load GBAtemp and the machine it's on is WORSE than the old3ds in terms of specs?
I mean, i've seen a shitty Alcatel Go Flip (512 Megs of ram) run a web browser, so it wouldn't be too unreasonable to go for a browser with half, or later, a quarter of the power to run on either a New3DS or an Old3DS, right? I mean, even the DSI has a web browser that renders elements, and that's closer to a GBA than a 3DS, so...
And thanks. I'm trying my hardest (for once in my time as a programmer) on this project.
 
  • Like
Reactions: I pwned U!

AliceCE

Rookie 3DS Homebrew Dev
OP
Member
Joined
Aug 7, 2019
Messages
203
Trophies
0
Location
Amogus World Theme Park, BR
XP
479
Country
United States
Broke text rendering while trying to implement text selecting. Can't tell what part of the code is screwing up the text drawing, but now it stops everything while attempting to draw text... Hm...

Also, i plan on doing this in place of making the browser itself pluck out urls for now. The goal is to make it so that the user can use the touchscreen to select text, and then press A to go to the selected text as a URL or to download it as a file once it's all fixed up and ready for the next test release.

also, sound effects! And in tandem with this, i figured out how RomFS works! So now i can store stuff like prefab pages such as the start and error page, launch splash, as well as the font data in the RomFS instead of in the main.cpp itself, and then i can load it from the RomFS like a file!

I'm certainly learning more and more with each day of programming. I love this project, and can't wait to see what i can do with it in the final stages.
 

cracker

Nyah!
Member
Joined
Aug 24, 2005
Messages
3,597
Trophies
0
XP
2,084
Country
United States
If I might add a critique... You should practice better code formatting for easier readability. It would make it easier to catch mistakes such as "=" vs "==".
 
General chit-chat
Help Users
  • No one is chatting at the moment.
    DEMONGreninjaPG @ DEMONGreninjaPG: kennies your honry