Coder Social home page Coder Social logo

vbe0201 / 3ds.py Goto Github PK

View Code? Open in Web Editor NEW
124.0 11.0 7.0 3.42 MB

Python on your Nintendo 3DS

License: Apache License 2.0

Shell 0.24% Makefile 50.87% Python 1.24% C++ 4.53% C 43.13%
homebrew nintendo-3ds nintendo-homebrew 3ds python3 python-port 3ds-homebrew devkitpro devkitarm

3ds.py's Introduction

3DS.py

Build Status

3DS.py is a WIP port of the Python 3.6.9 interpreter to the Nintendo 3DS. It allows you to run your Python scripts directly on the 3DS by having the interpreter embedded into a homebrew application that launches a main.py script from the same directory.

3DS.py in action

Installation & Usage

Just grab one of the releases over here and unzip it. Copy the entire 3DS.py folder to the 3ds directory of your SD card and navigate into it. You should see a 3DS.py.3dsx application.

The same directory also contains the entire Python standard library and a main.py file. To run your own projects, copy all source files into the 3DS.py directory and "start" your application from within the main.py file as this is the entry point to any Python homebrew.

Compiling

If you want to compile from source, it is required to set up a devkitARM development environment first. Next, you need to install the zlib portlib by running (dkp-)pacman -S 3ds-zlib. Otherwise you will get linker errors for the zlib module. Then cd into the 3DS.py directory and run make to build the binaries and a statically linked Python library with the corresponding header files for building Python C modules.

If you're on macOS, make sure to have gnu-sed installed. brew install gnu-sed

Homebrew that uses 3DS.py

A list of cool homebrew projects that make use of 3DS.py. Want yours to be listed here? PR them.

Development & Support

Need help? Or want to have an active voice in development of and around this project? Then join our Discord guild which focusses on homebrew development for the Nintendo 3DS in Python.

This way, things can be discussed more directly and you'll likely get answfers to your questions faster than through GitHub issues.

Special thanks

In no particular order, I want to credit these amazing people for their contributions.

  • 3DBrew for their extensive documentation and research pertaining to the 3DS.

  • devkitPro for their devkitARM toolchain.

  • smea for the ctrulib project.

  • David Buchanan for troubleshooting assistance.

  • Fenrir for his support and the ctru-rs project that helped me out with the condition variables implementation.

  • Richard Caseres for the awesome app icon he designed.

3ds.py's People

Contributors

ihaveamac avatar luigoalma avatar vbe0201 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

3ds.py's Issues

3DS.py only outputs text to touchscreen

Most likely it's just

consoleInit(GFX_TOP, NULL);
consoleInit(GFX_BOTTOM, NULL);

where the second consoleInit overwrites the first one.

The expected behavior would be to start outputting text on the topscreen, continue to the touchscreen once the topscreen is "full" and then start scrolling over both screens.

Support questions

Alright. I wanna know if this library supports the following:

  • Tkinter
  • The option to download files from the internet
  • Multiple python files

Thanks for a response, I'm working on a sorta Homebrew Store.

Pygame?

Any chance you could get pygame working? That would open up a lot of games for the 3ds

Would this work with Nuitka?

https://nuitka.net/

I'd be interested to know if the runtime provided by 3DS.py would work with Nuitka. If so, it would provide a mechanism to run python with better performance. I'd be interested in implementing this so that python could be used to speed up development on things that don't require as tight an integration as C/C++.

_socket import error

When I run a script using network, I've this error message :
File "/3ds/3ds.py/lib/python3.6/socket.py", line 49, in <module> import _socket ModuleNotFoundError: No module named '_socket'`

Is it normal ?

OSError on script load. (time package error?)

Here is the code that I put in main.py:

import time
import random

while True:
    print(random.random())
    time.sleep(1)

While this works in the normal Python interpreter on my PC, 3DS.py throws this error:
20200428_195406

Can't Import using "import discord"

The Program just spits out "ModuleNotFoundErroe: No module named 'discord'

Please fix when possible as I'm trying to run a discord bot from my 3ds.

Input() doesn't work

I want to make a Python interpreter for the 3DS, but the "Function not implemented" error is stopping me. Maybe add a check for input() and if so pop up the 3DS keyboard?

Fatal Python error: Py_Initialize: Unable to get the locale encoding

Copying text from inside an emulator is hard, so here's a screenshot.
image

Here are the logs Citra provides.

From what I can tell, this line is most likely returning NULL which causes the interpreter to output the Unable to get the locale encoding error. Hence there's an issue with importing the encodings module. It is either just me being dumb and placing the libraries at a wrong location or some filesystem functions might be failing.

OSError: [Error 108] Socket operation on non-socket is a strange one. I have to investigate into this one as I'm not sure what's exactly causing it.

As encodings is the first non-builtin module that gets imported, this might also affect any other modules so just stubbing this out or hacking some solution isn't an option.

_ctru inputs not working

I was attempting to run the code in #11 on my 3DS:

import _ctru

# Bitmasks of all the keys.
A = 1 << 0
B = 1 << 1

while True:
    input = _ctru.hid_keys_down()
    if input & A == A:
        print("A pressed!")

However, when run the code outputs the following error:

Traceback (most recent call last):
  File "main.py", line 1, in <module>
    import _ctru
ModuleNotFoundError: No module named '_ctru'

Does the _ctru module need to be built separately or am I doing something wrong?

Tkinter error

I can see that tkinter is installed to this python client but when run I get the error below (program worked fine on widows pc)
WIN_20230702_18_44_25_Pro
this is my code:

import time
from tkinter import *
from tkinter import ttk

if name == 'main':
print('3DS.py brings Python to your Nintendo 3DS!')

print('starting up program in 3')
time.sleep(1)
print('2')
time.sleep(1)
print('1')
time.sleep(1)

root = Tk()
frm = ttk.Frame(root, padding=10)
frm.grid()
ttk.Label(frm, text="Hello World!").grid(column=0, row=0)
ttk.Button(frm, text="Quit", command=root.destroy).grid(column=1, row=0)
root.mainloop()

Does not support web sockets.

It has socket.py in the libraries but _socket, part of the interpreter, is missing and thus it will not run, it will only crash.

syntax error in discord.py module

Trying to run a discord bot, but after making sure to include every library needed i get this error
1650205457600
I'm guessing it has to do with 3ds.py running an old version of python, but either way can it be fixed?

Py 3.6.9 updated?

3.6 has been deprecated for a while now. Can we expect any updates to the python version or this program in general?

New logo

3DS.py should have a new icon which really combines "3DS" and "Python" instead of just having the Python logo. I'm thinking about something like a 3DS console in Python colors.

This is primarily addressed to myself so I won't forget about it. I would however be glad to review submissions. Just hit me up on Discord (Vale#5252).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.