Homebrew 3dJS: JavaScript interpreter for 3DS systems

XorTroll

Switching between my 2DS and my Switch
OP
Developer
Joined
Dec 28, 2017
Messages
643
Trophies
1
Location
Nowhere
Website
github.com
XP
4,270
Country
Spain
console.log is just plain JavaScript though. All Node code can be directly ported to the browser (minus it's use of CommonJS module loading, which can be worked around with webpack or RequireJS). Node is JavaScript, they are the same language. Node even runs off the same engine that Chrome uses for it's JavaScript.
Yep, that's true, but I'm not using the engine Chrome or even Node use. They use Google's v8 engine, while 3dJS uses duktape, which is not as powerful and complete as v8, but building a specific v8 source for ARM processor is quite difficult, because v8 is a very big engine. duktape is way easier to use and to include on your projects, and it still supports a very big part of JS, so it's quite good.
BTW, it would be difficult to port some node libraries and elements to 3DS or NDS, because the amount of libraries that can be used with them is not very big.
 
Last edited by XorTroll,

RedDucks

Well-Known Member
Newcomer
Joined
Apr 28, 2017
Messages
95
Trophies
0
Age
25
XP
731
Country
United States
I'm not using the engine Chrome or even Node use. They use Google's v8 engine, while 3dJS uses duktape
I'm aware of this. I was correcting your statement where you said "console.log" was a "node element" (which while we're at it, "node elements" aren't a thing). "console.log" is not Node specific, it's part of the common JS spec. If the engine being used doesn't support something as standard as console.log, that's pretty worrying.
 

XorTroll

Switching between my 2DS and my Switch
OP
Developer
Joined
Dec 28, 2017
Messages
643
Trophies
1
Location
Nowhere
Website
github.com
XP
4,270
Country
Spain
I'm aware of this. I was correcting your statement where you said "console.log" was a "node element" (which while we're at it, "node elements" aren't a thing). "console.log" is not Node specific, it's part of the common JS spec. If the engine being used doesn't support something as standard as console.log, that's pretty worrying.
Yes, console.log is part of plain JS, but as you said duktape engine does not support it.
AFAIK, it's based on ECMAScript 5 and only has a few elements of ECMAScript 6, and not all common functions and elements, like console, are supported.
But, luckily, I can add my own functions which run native C or C++ code (that's how I made custom JS for 3DS), so it's way easy to add a print or read function or whatever.
 
Last edited by XorTroll,
  • Like
Reactions: Coto

RedDucks

Well-Known Member
Newcomer
Joined
Apr 28, 2017
Messages
95
Trophies
0
Age
25
XP
731
Country
United States
AFAIK, it's based on ECMAScript 5 and only has a few elements of ECMAScript 6
Are you trying to say the console is ES6??? Because it very much isn't. Not even every modern browser supports ES6, nor does Node out of the box. The console spec has existed for many years, way before ES6. If Duktape is based on ES5 it should be able to support console.

Don't get me wrong, I like the idea here (building homebrew with JavaScript, reminds me of PyNX). I'm a web developer by trade and work extensively in JavaScript, so this obviously has my support if done right.

My concern here is the use of what seems like an under powered engine (with lacking support for even the most basic parts of the JS spec). It concerns me because if it is that under powered and lacks even the most basic features, then in the long run it won't be that useful. I'd like to point out that there is an existing project called CTRJS (which is extremely outdated and unmaintained) which uses the v7 engine to do this same thing.

It might be useful to take a look as to how CTRJS handles using the v7 engine, since you said you had issues with it before and v7 is more complete than Duktape.
https://gbatemp.net/threads/3ds-javascript-interpreter.484496/
https://github.com/Symbitic/CTRJS

Again, don't get me wrong. I'm all for this project and it has my full support. Just the use of Duktape seems like it's hindering the project. If Duktape really is the only way (I won't claim to be an expert on the 3DS or what it can handle, I'm a WiiU/Switch guy), then I guess I'll just deal with it, but if possible I'd like to see this project use something with better compatibility.
 
Last edited by RedDucks,

Coto

-
Member
Joined
Jun 4, 2010
Messages
2,979
Trophies
2
XP
2,565
Country
Chile
Are you trying to say the console is ES6??? Because it very much isn't. Not even every modern browser supports ES6, nor does Node out of the box. The console spec has existed for many years, way before ES6. If Duktape is based on ES5 it should be able to support console.

Don't get me wrong, I like the idea here (building homebrew with JavaScript, reminds me of PyNX). I'm a web developer by trade and work extensively in JavaScript, so this obviously has my support if done right.

My concern here is the use of what seems like an under powered engine (with lacking support for even the most basic parts of the JS spec). It concerns me because if it is that under powered and lacks even the most basic features, then in the long run it won't be that useful. I'd like to point out that there is an existing project called CTRJS (which is extremely outdated and unmaintained) which uses the v7 engine to do this same thing.

It might be useful to take a look as to how CTRJS handles using the v7 engine, since you said you had issues with it before and v7 is more complete than Duktape.
https://gbatemp.net/threads/3ds-javascript-interpreter.484496/
https://github.com/Symbitic/CTRJS

Again, don't get me wrong. I'm all for this project and it has my full support. Just the use of Duktape seems like it's hindering the project. If Duktape really is the only way (I won't claim to be an expert on the 3DS or what it can handle, I'm a WiiU/Switch guy), then I guess I'll just deal with it, but if possible I'd like to see this project use something with better compatibility.
then you could help him by forking his repo, and replacing the engine you are suggesting, if you have the know how then?
 

XorTroll

Switching between my 2DS and my Switch
OP
Developer
Joined
Dec 28, 2017
Messages
643
Trophies
1
Location
Nowhere
Website
github.com
XP
4,270
Country
Spain
Are you trying to say the console is ES6??? Because it very much isn't. Not even every modern browser supports ES6, nor does Node out of the box. The console spec has existed for many years, way before ES6. If Duktape is based on ES5 it should be able to support console.

Don't get me wrong, I like the idea here (building homebrew with JavaScript, reminds me of PyNX). I'm a web developer by trade and work extensively in JavaScript, so this obviously has my support if done right.

My concern here is the use of what seems like an under powered engine (with lacking support for even the most basic parts of the JS spec). It concerns me because if it is that under powered and lacks even the most basic features, then in the long run it won't be that useful. I'd like to point out that there is an existing project called CTRJS (which is extremely outdated and unmaintained) which uses the v7 engine to do this same thing.

It might be useful to take a look as to how CTRJS handles using the v7 engine, since you said you had issues with it before and v7 is more complete than Duktape.
https://gbatemp.net/threads/3ds-javascript-interpreter.484496/
https://github.com/Symbitic/CTRJS

Again, don't get me wrong. I'm all for this project and it has my full support. Just the use of Duktape seems like it's hindering the project. If Duktape really is the only way (I won't claim to be an expert on the 3DS or what it can handle, I'm a WiiU/Switch guy), then I guess I'll just deal with it, but if possible I'd like to see this project use something with better compatibility.
Thank you for that @RedDucks. I'm almost a newbie in JS, so don't expect me to know everything about it. I'm way better using C++.
v7 seemed to work, but I had some problems with some libraries it required and which I wasn't able to find. I'll see if I can do anything.
 

RedDucks

Well-Known Member
Newcomer
Joined
Apr 28, 2017
Messages
95
Trophies
0
Age
25
XP
731
Country
United States
then you could help him by forking his repo, and replacing the engine you are suggesting, if you have the know how then?
I would if I had the time do dedicate to this projects core, which I don't. It's not a simple matter of just slapping on a new engine, nor did I suggest that. This project is still early enough in development though that taking the time to move the core to a new engine wouldn't be that cumbersome. Hence why I suggested moving to the v7 engine and even provided a working example of it being implemented on the 3DS.

I'm almost a newbie in JS, so don't expect me to know everything about it
Fair, I may have been a bit hard. As I said this project has my support and I'd like to see it come to fruition in the same way projects like PyNX have. I'll probably be working in it regardless of what engine is being used anyway.
 

Coto

-
Member
Joined
Jun 4, 2010
Messages
2,979
Trophies
2
XP
2,565
Country
Chile
I would if I had the time do dedicate to this projects core, which I don't. It's not a simple matter of just slapping on a new engine, nor did I suggest that. This project is still early enough in development though that taking the time to move the core to a new engine wouldn't be that cumbersome. Hence why I suggested moving to the v7 engine and even provided a working example of it being implemented on the 3DS.

you seem to talk too much for a simple suggestion, again, not trying to be rude, but the backend work you are asking for
"It's not a simple matter of just slapping on a new engine"
 

RedDucks

Well-Known Member
Newcomer
Joined
Apr 28, 2017
Messages
95
Trophies
0
Age
25
XP
731
Country
United States
you seem to talk too much for a simple suggestion
How is:
It might be useful to take a look as to how CTRJS handles using the v7 engine, since you said you had issues with it before and v7 is more complete than Duktape.
https://gbatemp.net/threads/3ds-javascript-interpreter.484496/
https://github.com/Symbitic/CTRJS
"talking too much"? This is where I suggested moving to v7. Every other one of my messages was just correcting a wrong assumption on the JS spec.

but the backend work you are asking for
"It's not a simple matter of just slapping on a new engine"
I'm not sure what you're saying here? Are you trying to say I'm suggesting it's that easy? Because I literally never said that, in fact I said the exact opposite. I'm aware it isn't that easy. That's why I said I don't have time to dedicate to this projects core, so I suggested it to the person who is actually maintaining this project. Otherwise I would do it myself.
 
  • Like
Reactions: Nightwish

Coto

-
Member
Joined
Jun 4, 2010
Messages
2,979
Trophies
2
XP
2,565
Country
Chile
How is:
"talking too much"? This is where I suggested moving to v7. Every other one of my messages was just correcting a wrong assumption on the JS spec.


I'm not sure what you're saying here? Are you trying to say I'm suggesting it's that easy? Because I literally never said that, in fact I said the exact opposite. I'm aware it isn't that easy. That's why I said I don't have time to dedicate to this projects core, so I suggested it to the person who is actually maintaining this project. Otherwise I would do it myself.

My point is:

1) if you suggest, well a suggestion could be "please, i'd really appreciate if you could add X feature", "I may have an idea how to do it but I can't code that"

2) If you can't code something by yourself you can't ask the devs to do it better. lol
 

RedDucks

Well-Known Member
Newcomer
Joined
Apr 28, 2017
Messages
95
Trophies
0
Age
25
XP
731
Country
United States
if you suggest, well a suggestion could be "please, i'd really appreciate if you acoul add X feature", "I may have an idea how to do it but I can't code that"
You make it sound like my suggestion was phrased in an asshole-y way, or that I'm someone who can't code asking for too much. The suggestion itself was written in a perfectly respectful way, and the suggestion I made has been implemented already by someone else. Hence why I linked directly to it. And again, the reason I'm not forking the repo and doing itself is because I just don't have time to spend on another project.

2) If you can't code something by yourself you can't ask the devs to do it better. lol
In what world does me not having time to dedicate to a project's core mean I can't make a suggestion? So what, are you saying that the only people who are allowed to make suggestions about a project have to first implement it themselves? 10/10 logic, guess only project maintainers are allowed to make suggestions now.
 
  • Like
Reactions: Nightwish

Coto

-
Member
Joined
Jun 4, 2010
Messages
2,979
Trophies
2
XP
2,565
Country
Chile
You make it sound like my suggestion was phrased in an asshole-y way, or that I'm someone who can't code asking for too much. The suggestion itself was written in a perfectly respectful way, and the suggestion I made has been implemented already by someone else. Hence why I linked directly to it. And again, the reason I'm not forking the repo and doing itself is because I just don't have time to spend on another project.


In what world does me not having time to dedicate to a project's core mean I can't make a suggestion? So what, are you saying that the only people who are allowed to make suggestions about a project have to first implement it themselves? 10/10 logic, guess only project maintainers are allowed to make suggestions now.

Problem is you fail at logic right now, i will split them in groups:

1)
by logic a feature should be added if:

a) the dev requesting the feature is able to actually code it, or
b) if the dev can't, then a pull request could be added from another dev.

2)
now to the request part:
a) an user request could be taken only if the request was, at least doable. You are asking a favor here, because it is not your time that is going to be wasted.


they way you write, I read it as you belong to group 1), when in fact you can't even code such request. Thus, it falls back to group 2)
It's his time that's going to be invested/wasted, so at least be polite about it? is it that hard?

lol
 
Last edited by Coto,

RedDucks

Well-Known Member
Newcomer
Joined
Apr 28, 2017
Messages
95
Trophies
0
Age
25
XP
731
Country
United States
1)
by logic a feature should be added if:

a) the dev requesting the feature is able to actually code it, or
b) if the dev can't, then a pull request could be added from another dev.

A feature should be added if the feature has a use that will benefit the project as a whole. What you're trying to say here is whether or not a feature will be added, not if it should be added.

the dev requesting the feature is able to actually code it
I can, so can OP (I assume, given that they have already made this project), and so can the person who actually did it before. I'm not doing it because of a lack of time, not lack of ability.

if the dev can't, then a pull request could be added from another dev
Are you seriously just ignoring every instance of where I'm saying that what I suggested has already been implemented by someone else? There is an existing project already that uses the engine I am suggesting. I linked directly to it, but you clearly missed it so here it is again https://github.com/Symbitic/CTRJS


an user request could be taken only if the request was, at least doable
It is doable. It has been done. It exists. It's right there.

at least be polite about it? is is that hard?
I was polite to OP, when making the suggestion. Please, tell me where I was rude in this statement:
It might be useful to take a look as to how CTRJS handles using the v7 engine, since you said you had issues with it before and v7 is more complete than Duktape.
https://gbatemp.net/threads/3ds-javascript-interpreter.484496/
https://github.com/Symbitic/CTRJS
 

Coto

-
Member
Joined
Jun 4, 2010
Messages
2,979
Trophies
2
XP
2,565
Country
Chile
All right, time to go since this non productive chat is eating my valuable dev time lol

@XorTroll
Sorry OP for the offtopic, as I said earlier, you did a good job. Add the features you require or need.
I think perhaps if you could add TLS1.2 as there was a library for it somewhere I might test some code I had years ago when I did front end dev. Because
ISO/IEC 20648:2016 requires TLS for object storage handles.

I know ISO/IEC 16262:2011 support can be a pain to add back in legacy browsers. In fact when this works I might merge it to DSOrganize lol if the memory fits. Because DSOrganize is bare metal, and very few DOM objects aren't even standard there. (because the way DSOrganize treats these aren't even standard lol).
 
Last edited by Coto,

XorTroll

Switching between my 2DS and my Switch
OP
Developer
Joined
Dec 28, 2017
Messages
643
Trophies
1
Location
Nowhere
Website
github.com
XP
4,270
Country
Spain
All right, time to go since this non productive chat is eating my valuable dev time lol

@XorTroll
Sorry OP for the offtopic, as I said earlier, you did a good job. Add the features you require or need.
I think perhaps if you could add TLS1.2 as there was a library for it somewhere I might test some code I had years ago when I did front end dev. Because
ISO/IEC 20648:2016 requires TLS for object storage handles.

I know ISO/IEC 16262:2011 support can be a pain to add back in legacy browsers. In fact when this works I might merge it to DSOrganize lol if the memory fits. Because DSOrganize is bare metal, and very few DOM objects aren't even standard there. (because the way DSOrganize treats these aren't even standard lol).
What an argument you two had here, lol.
Well, nevermind. @RedDucks just wanted to give ideas.
Basically thank you all for the ideas and opinions, and I'll try to see on what aspects I can improve this project.
 

RedDucks

Well-Known Member
Newcomer
Joined
Apr 28, 2017
Messages
95
Trophies
0
Age
25
XP
731
Country
United States
@XorTroll Apologies for flooding your thread with that. Like I said, I do like this project and it has my full support. If I had more spare time I would totally contribute to the core. Best of luck
 
  • Like
Reactions: XorTroll

Ooka

Active Member
Newcomer
Joined
Sep 12, 2014
Messages
30
Trophies
0
Age
31
XP
212
Country
United States
console.log is just plain JavaScript though. All Node code can be directly ported to the browser (minus it's use of CommonJS module loading, which can be worked around with webpack or RequireJS). Node is JavaScript, they are the same language. Node even runs off the same engine that Chrome uses for it's JavaScript.

I'm aware of this. I was correcting your statement where you said "console.log" was a "node element" (which while we're at it, "node elements" aren't a thing). "console.log" is not Node specific, it's part of the common JS spec. If the engine being used doesn't support something as standard as console.log, that's pretty worrying.

The console object is not a default Javascript object, it's provided by browsers for developers to interact with browser functionality:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects

https://developer.mozilla.org/en-US/docs/Web/JavaScript/JavaScript_technologies_overview

While we're at it, there are Node specific objects:

https://nodejs.org/api/globals.html

-----

@XorTroll I'm glad someone is working on this! I'll try to stay updated with progress and good luck. :)
 
Last edited by Ooka,

XorTroll

Switching between my 2DS and my Switch
OP
Developer
Joined
Dec 28, 2017
Messages
643
Trophies
1
Location
Nowhere
Website
github.com
XP
4,270
Country
Spain
Well, thank you all for your comments, and I must tell you that the new project's development goes quite well, and I don't think you'll have to wait much time for it. I'm working on some extended JS libraries for managing Homebrew under Nintendo DS and 3DS.

Bad news: the graphics libraries I'm using right now for the 3DS JS API don't work on Citra, but the other stuff does.

For those who have curiosity about the succesor of 3dJS (Brew.js), info here: https://github.com/XorTroll/3dJS/issues/1
Organisation's repositories on GitHub, empty for the moment: https://github.com/BrewJS
 
Last edited by XorTroll,

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    Psionic Roshambo @ Psionic Roshambo: https://m.youtube.com/watch?v=SFpbRlIfowM&pp=ygUnQW5kIG5vIExpdHRsZSB0aW1teSBnbHVlZCB0byBoaXMgY3Jp...