3DS-RPC icon indicating copy to clipboard operation
3DS-RPC copied to clipboard

[Misc]: Add setup instructions and database python script

Open HotaruBlaze opened this issue 4 months ago • 11 comments

When checking out https://github.com/3DS-RPC/3DS-RPC/pull/68 i noticed we didn't actually have a clean setup guide anymore apart from a sh script, so it didn't really work for windows etc.

  • Added a SETUP.md that should help people get started when working on PR's
  • Added a reset.py script in sqlite, so just running the python script will bootstrap the DB instead of depending on a sh file.

HotaruBlaze avatar Aug 20 '25 04:08 HotaruBlaze

The thing is that some dependencies just seem not to work or something when I run pip install -r requirements.txt.

 gcc -fno-strict-overflow -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -fexceptions -fcf-protection -fexceptions -fcf-protection -fexceptions -fcf-protection -O3 -fPIC -DNETIFACES_VERSION=0.11.0 -DHAVE_GETIFADDRS=1 -DHAVE_GETNAMEINFO=1 -DHAVE_NETASH_ASH_H=1 -DHAVE_NETATALK_AT_H=1 -DHAVE_NETAX25_AX25_H=1 -DHAVE_NETECONET_EC_H=1 -DHAVE_NETIPX_IPX_H=1 -DHAVE_NETPACKET_PACKET_H=1 -DHAVE_NETROSE_ROSE_H=1 -DHAVE_LINUX_ATM_H=1 -DHAVE_LINUX_LLC_H=1 -DHAVE_LINUX_TIPC_H=1 -DHAVE_SOCKADDR_AT=1 -DHAVE_SOCKADDR_AX25=1 -DHAVE_SOCKADDR_IN=1 -DHAVE_SOCKADDR_IN6=1 -DHAVE_SOCKADDR_IPX=1 -DHAVE_SOCKADDR_UN=1 -DHAVE_SOCKADDR_ROSE=1 -DHAVE_SOCKADDR_ASH=1 -DHAVE_SOCKADDR_EC=1 -DHAVE_SOCKADDR_LL=1 -DHAVE_SOCKADDR_ATMPVC=1 -DHAVE_SOCKADDR_ATMSVC=1 -DHAVE_SOCKADDR_LLC=1 -DHAVE_PF_NETLINK=1 -I/home/mayachen/Dev/3DS-RPC/.venv/include -I/usr/include/python3.13 -c netifaces.c -o build/temp.linux-x86_64-cpython-313/netifaces.o
      netifaces.c:1:10: fatal error: Python.h: No such file or directory
          1 | #include <Python.h>
            |          ^~~~~~~~~~
      compilation terminated.
      error: command '/usr/lib64/ccache/gcc' failed with exit code 1
      [end of output]

Also, I'm gonna be honest, as I'm not sure where to find every information I need and that are going to work for private.py, I feel like this can kinda discourage people to contribute.

MayaChen350 avatar Aug 20 '25 16:08 MayaChen350

The thing is that some dependencies just seem not to work or something when I run pip install -r requirements.txt.

 gcc -fno-strict-overflow -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -fexceptions -fcf-protection -fexceptions -fcf-protection -fexceptions -fcf-protection -O3 -fPIC -DNETIFACES_VERSION=0.11.0 -DHAVE_GETIFADDRS=1 -DHAVE_GETNAMEINFO=1 -DHAVE_NETASH_ASH_H=1 -DHAVE_NETATALK_AT_H=1 -DHAVE_NETAX25_AX25_H=1 -DHAVE_NETECONET_EC_H=1 -DHAVE_NETIPX_IPX_H=1 -DHAVE_NETPACKET_PACKET_H=1 -DHAVE_NETROSE_ROSE_H=1 -DHAVE_LINUX_ATM_H=1 -DHAVE_LINUX_LLC_H=1 -DHAVE_LINUX_TIPC_H=1 -DHAVE_SOCKADDR_AT=1 -DHAVE_SOCKADDR_AX25=1 -DHAVE_SOCKADDR_IN=1 -DHAVE_SOCKADDR_IN6=1 -DHAVE_SOCKADDR_IPX=1 -DHAVE_SOCKADDR_UN=1 -DHAVE_SOCKADDR_ROSE=1 -DHAVE_SOCKADDR_ASH=1 -DHAVE_SOCKADDR_EC=1 -DHAVE_SOCKADDR_LL=1 -DHAVE_SOCKADDR_ATMPVC=1 -DHAVE_SOCKADDR_ATMSVC=1 -DHAVE_SOCKADDR_LLC=1 -DHAVE_PF_NETLINK=1 -I/home/mayachen/Dev/3DS-RPC/.venv/include -I/usr/include/python3.13 -c netifaces.c -o build/temp.linux-x86_64-cpython-313/netifaces.o
      netifaces.c:1:10: fatal error: Python.h: No such file or directory
          1 | #include <Python.h>
            |          ^~~~~~~~~~
      compilation terminated.
      error: command '/usr/lib64/ccache/gcc' failed with exit code 1
      [end of output]

Also, I'm gonna be honest, as I'm not sure where to find every information I need and that are going to work for private.py, I feel like this can kinda discourage people to contribute.

This error is purely because its trying to compile a python module without having python-dev (this contains the headers for python that gcc needs), nothing directly to do with 3DS-RPC.

HotaruBlaze avatar Aug 21 '25 03:08 HotaruBlaze

Hmm.. ideally we'd have Flask-SQLAlchemy initialize the database on their behalf; this older schema should ideally be removed.

However, I notice that using flask --app server.py db directly currently fails due to a dependency on the database via start_db_time... this is not ideal. I've created #70 to track this.

Would you be willing to invest time into adapting the existing SQLite3 schema to match that of our definitions? We should do better going forward, but this would help in the meantime.

I barely understand SQL normally, let alone the weird SQLAlchemy stuff. So im probably not the right person for the job

HotaruBlaze avatar Aug 21 '25 03:08 HotaruBlaze

@MayaChen350

The thing is that some dependencies just seem not to work or something when I run pip install -r requirements.txt.

It's very likely you may need to install libpython3-dev (Debian/Ubuntu) or python3-devel (RHEL/Fedora)! We may want to briefly document this.

Also, I'm gonna be honest, as I'm not sure where to find every information I need and that are going to work for private.py, I feel like this can kinda discourage people to contribute.

I certainly agree - we note some regarding HMAC/whatnot, but we could certainly do better. Are there any aspects you're struggling to obtain? This would help to know for documentation going forward!

spotlightishere avatar Aug 21 '25 03:08 spotlightishere

So im probably not the right person for the job

No worries at all :) Assigning this to myself for when I have some free time this weekend to properly investigate.

In the meantime, this setup guide certainly is quite helpful - thank you so much! I'm going to merge this once understanding more what we need for setup, and we can elaborate in subsequent commits.

spotlightishere avatar Aug 21 '25 03:08 spotlightishere

I certainly agree - we note some regarding HMAC/whatnot, but we could certainly do better. Are there any aspects you're struggling to obtain? This would help to know for documentation going forward!

I'll be sure to check further about this in the next days also to help with the documentation if possible

MayaChen350 avatar Aug 21 '25 03:08 MayaChen350

Installing python3-devel successfully fixed the dependencies issues thank you!

MayaChen350 avatar Aug 21 '25 16:08 MayaChen350

So there's something that have confused me a bit.

In private.py, you need console information? Does that mean part of this code is running on a real 3ds or it's emulated? I'm not that sure about running python on a 3DS, as its hardware is quite limited (few mb of ram, dual core ARM11 (MPCore) processor) so if it is somehow, I'll change my approach for the asynchronous PR

I have knowledge in C, the 3ds and assembly for armv6 (3ds uses ARM11 which is an armv6 processor) so at worst I'll try to speed things up with that as I don't want to accidentally create issues with python

MayaChen350 avatar Aug 28 '25 17:08 MayaChen350

So there's something that have confused me a bit.

In private.py, you need console information? Does that mean part of this code is running on a real 3ds or it's emulated? I'm not that sure about running python on a 3DS, as its hardware is quite limited (few mb of ram, dual core ARM11 (MPCore) processor) so if it is somehow, I'll change my approach for the asynchronous PR

I have knowledge in C, the 3ds and assembly for armv6 (3ds uses ARM11 which is an armv6 processor) so at worst I'll try to speed things up with that as I don't want to accidentally create issues with python

You strip special keys unique to the console and "emulate" being the 3ds on a desktop/server, you dont actually run anything physically on the 3ds

HotaruBlaze avatar Aug 28 '25 17:08 HotaruBlaze

You strip special keys unique to the console and "emulate" being the 3ds on a desktop, you dont actually run anything physically on the 3ds

Oh okay that's reassuring. Do I need to take real keys from my own 3DS or I should generate them somewhere?

MayaChen350 avatar Aug 28 '25 17:08 MayaChen350

You strip special keys unique to the console and "emulate" being the 3ds on a desktop, you dont actually run anything physically on the 3ds

Oh okay that's reassuring. Do I need to take real keys from my own 3DS or I should generate them somewhere?

Yeah you have to use real keys, u cant just use dummy ones.

I remember having issues getting a working set of all my keys, i believe i kept having issues with one of them working correctly. So I'd highly recommend hopping into the #Development channel for help getting working keys if you get stuck. As far as I'm aware theirs no good guide around.

HotaruBlaze avatar Aug 28 '25 18:08 HotaruBlaze