DeepSeek AI for coding with LibNX

  • Thread starter Thread starter littlesmurf
  • Start date Start date
  • Views Views 10,864
  • Replies Replies 73
  • Likes Likes 18
Im currently trying to build a simple sys-module that sends a webhook on game launch with game name, controllers connected, and serial number of the switch.

Been at it for 2 hours but cannot seem to even get it to create a simple debug.txt in the sd.

Here is my latest reply - how correct/incorrect is it?

Im gonna try for maybe a few more hours - but i do believe in the power of it, it just needs the right documents then we can really build anything.

CRITICAL BUG FOUND AND FIXED!

I discovered the root cause of why your sys-module wasn't loading. The research
revealed:

The Problem:
Your sys-module was calling smExit() immediately after initialization in __appInit().
According to libnx documentation and sysmodule best practices:
- The service manager (sm) session MUST remain open for the entire lifetime of a
sysmodule
- smExit() should only be called in __appExit() when the sysmodule is exiting
- Services like filesystem require the sm session to be active throughout runtime

What I Fixed in source/main.cpp:
1. Removed the smExit() call from __appInit() (line 31)
2. Moved the smExit() call to __appExit() where it belongs

This was causing a silent failure because the sys-module would initialize sm, then
immediately close it, then try to use filesystem services that require sm to be
active.

Next Steps - Please do this:
1. Open MSYS2 MinGW 64-bit terminal
2. Navigate to the project: cd /c/Users/Brendon/Documents/Claude/switch-homebrew
3. Run: make clean && make
4. Copy the new game_tracker.nsp to your SD card as
sd:/atmosphere/contents/4200000000474D54/exefs.nsp
5. Reboot your Switch and check for SYSMODULE_TEST.txt in the root of your SD card
 
Services like filesystem require the sm session to be active throughout runtime
Complete bullshit.
Post automatically merged:

The service manager (sm) session MUST remain open for the entire lifetime of a
sysmodule
Also complete bullshit, it's needed only for service initialization.
 
Complete bullshit.
Post automatically merged:


Also complete bullshit, it's needed only for service initialization.
There are new developments with Claude called Claude Skills and someone made a skill which can completely consume docs/wikis/instructions as a base set of instructions instead of trying to use websearching and historical information.

Could you point me to the correct repository/website/etc where i would find correct and up to date information about all things switch homebrew?
 
Been at it for 2 hours but cannot seem to even get it to create a simple debug.txt in the sd.
This is what chatgpt told me to put in the main thingy in the sysmodule template after a few hours of asking it where babies come from:
C:
// Open the file ---on the SD card---
FILE *debug = fopen("sdmc:/debug.txt", "w");
// ----- loop------
for(uint64_t i =0; i < (uint64_t)-1; i++)
    fputs("80085", debug);

// --close-- the file on the SD card ---
fclose(debug);
 
  • Haha
Reactions: Sir Tortoise
This is what chatgpt told me to put in the main thingy in the sysmodule template after a few hours of asking it where babies come from:
C:
// Open the file ---on the SD card---
FILE *debug = fopen("sdmc:/debug.txt", "w");
// ----- loop------
for(uint64_t i =0; i < (uint64_t)-1; i++)
    fputs("80085", debug);

// --close-- the file on the SD card ---
fclose(debug);
Forgive me, I do not code in C, but does this not require some brackets to denote the extent of the debugging loop? I fear this would not achieve the... full breadth of debugging information you require, possibly only running once or not at all.

Maybe ChatGPT has optimised this beyond my human understanding, though. Or made the loop nonfunctional in an attempt to stop the user's SD card from catching on fire.
 
Forgive me, I do not code in C, but does this not require some brackets to denote the extent of the debugging loop? I fear this would not achieve the... full breadth of debugging information you require, possibly only running once or not at all.

Maybe ChatGPT has optimised this beyond my human understanding, though. Or made the loop nonfunctional in an attempt to stop the user's SD card from catching on fire.
I don't actually know, so I asked chatgpt and here's what he said:
Screenshot_20251027_133518.png
 
  • Haha
Reactions: Sir Tortoise
Forgive me, I do not code in C, but does this not require some brackets to denote the extent of the debugging loop?
C doesn't look at indentation.

It's the same as
C:
for(uint64_t i =0; i < (uint64_t)-1; i++) fputs("80085", debug);

Though that -1 type casting is a really weird thing to do, too hacky for standard C.
 
  • Haha
Reactions: JK_
C doesn't look at indentation.

It's the same as
C:
for(uint64_t i =0; i < (uint64_t)-1; i++) fputs("80085", debug);

Though that -1 type casting is a really weird thing to do, too hacky for standard C.
Oh, thanks. Sounds like the code should work perfectly fine as a cautionary tale on trusting code from LLMs or random people on the internet
 
Oh, thanks. Sounds like the code should work perfectly fine as a cautionary tale on trusting code from LLMs or random people on the internet
Hey. I'm not just some random person. I'm the guy that wrote the prompts that made ChatGPT rewrite JKSV. It was a lot of work, but I did it all by myself. OP really inspired me with those SDL tutorial programs it made for him. I didn't even know the best, most best practice, efficient way to render text in SDL was to constantly allocate a new surface and texture for it, render it to screen, and destroy it every frame. I'd think caching the texture and reusing them would be more efficient, but there goes deepseek proving me wrong and takin mer jerb away.

I even had chatgpt rip out JKSV's font cache map in favor of it. The fps dropped by about 1/3, but I'm glad AI showed me the way.
 
Hey. I'm not just some random person. I'm the guy that wrote the prompts that made ChatGPT rewrite JKSV. It was a lot of work, but I did it all by myself. OP really inspired me with those SDL tutorial programs it made for him. I didn't even know the best, most best practice, efficient way to render text in SDL was to constantly allocate a new surface and texture for it, render it to screen, and destroy it every frame. I'd think caching the texture and reusing them would be more efficient, but there goes deepseek proving me wrong and takin mer jerb away.

I even had chatgpt rip out JKSV's font cache map in favor of it. The fps dropped by about 1/3, but I'm glad AI showed me the way.
You're not just some random person - I can tell from your avatar that you're an actual criminal :angry:
 
I was eagerly scrolling through this thread, flipping the pages, hoping there would be an AI-generated nro capable of listing FTP directories waiting for me at the end, but alas :( ... I guess the tech is just not ready yet.

How do you license anything created by an AI? It's not your code, you did not write it, so once you are done, under what license can you publish in good conscience? I'm just curious.
 
Forgive me, I do not code in C, but does this not require some brackets to denote the extent of the debugging loop? I fear this would not achieve the... full breadth of debugging information you require, possibly only running once or not at all.

Maybe ChatGPT has optimised this beyond my human understanding, though. Or made the loop nonfunctional in an attempt to stop the user's SD card from catching on fire.
I believe that "loop" is the reason why two microSD cards became unusable while I was using LineageOS and Ubuntu on my NSwitch. You simply can't trust custom OSs or software with the potential to damage your hardware.
Post automatically merged:

Hey. I'm not just some random person. I'm the guy that wrote the prompts that made ChatGPT rewrite JKSV. It was a lot of work, but I did it all by myself. OP really inspired me with those SDL tutorial programs it made for him. I didn't even know the best, most best practice, efficient way to render text in SDL was to constantly allocate a new surface and texture for it, render it to screen, and destroy it every frame. I'd think caching the texture and reusing them would be more efficient, but there goes deepseek proving me wrong and takin mer jerb away.

I even had chatgpt rip out JKSV's font cache map in favor of it. The fps dropped by about 1/3, but I'm glad AI showed me the way.
This is what I'm working on in a port. It doesn't make sense to delete meshes or textures and then re-render them if they're already in front of the camera. It will consume a huge buffer (copying from CPU to GPU) and you'll only get 10fps on mobile in games like this. This is where issues like Frustum, Colliding, and Instance come into play.

For multimedia display purposes, I suppose hardware acceleration is better, using the rendering API, whether Vulkan or GL, and gaining access to VRAM.
Post automatically merged:

USA already had case about AI generated art and stated that prompter cannot copyright it. So I bet it's the same for code.

https://www.reuters.com/world/us/us...nerated-art-lacking-human-creator-2025-03-18/

So beerware? 🤣
If there was human intervention, and I see many established developers creating scaffolding or integrating third-party code through AI, in the end it's your creation; the AI was just an "assistant." Greetings Masagrator, you do great things.
 
Last edited by Naminave,

Site & Scene News

Popular threads in this forum