Giter VIP home page Giter VIP logo

libctru's Introduction

libctru - CTR User Library

Build Status

Library for writing user mode ARM11 code for the 3DS (CTR)

This library aims to provide the foundations necessary to write 3DS Homebrew, and straightforwardly access the different functionalities provided by the 3DS operating system. It is not meant to provide higher level functions; to put things in perspective, the purpose of libctru would be to sit between the OS and a possible port of SDL rather than replace it.

(Originally located at github.com/smealum/ctrulib)

Setup

libctru is just a library and needs a toolchain to function. devkitARM (created by devkitPro) is the officially supported ARM cross compiling toolchain, which provides the framework necessary to supply a usable POSIX-like environment, with working C and C++ standard libraries; as well as the tools required to compile homebrew in the 3DSX format, and assemble GPU shaders. The use of other ARM toolchains is severely discouraged.

The most recent version of devkitARM is always recommended. The installers/setup scripts supplied by devkitPro install a prebuilt copy of the latest stable version of libctru, which is recommended for general use. Please note that devkitPro has a policy of keeping legacy code to a minimum, so a library upgrade may result in older code failing to compile or behave properly. Developers are encouraged to keep their code working with the latest versions of the tools and libraries.

You may find instructions on how to install devkitARM on the devkitPro Wiki.

Documentation

The documentation is automatically built upon release and can be found at the following url: https://devkitpro.github.io/libctru/

License

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
  2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
  3. This notice may not be removed or altered from any source distribution.

libctru's People

Contributors

archshift avatar arisotura avatar aurelio92 avatar cruel avatar endrift avatar fincs avatar hax0kartik avatar idunoe avatar javimadgit avatar joel16 avatar ksanislo avatar lectem avatar linkmauve avatar lioncash avatar liquidfenrir avatar megazig avatar minexew avatar mtheall avatar oreo639 avatar piepie62 avatar plutooo avatar profi200 avatar smealum avatar subv avatar thedax avatar turtlep avatar tuxsh avatar wintermute avatar yellows8 avatar yuriks 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  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

libctru's Issues

About the SSL Service (2)

Ok, it is switching to the SSL connection but httpcGetResponseStatusCode returns 0xd8a0a03c with statuscode c3460000, The request is on port 443 but I think the certificate is invalid, can you help me?

example header

totally unimportant but i was going through some examples and noticed this : https://github.com/smealum/ctrulib/blob/master/examples/graphics/printing/hello-world/source/main.c#L5-L12

basically i don't think that has anything to do in a source file and should be removed; imo that header should at most contain a description of the example, the author's name and last time modified. if someone wants to see a "big thanks to..." they should look in the readme file imo.

on a equally unimportant note, maybe switch that thing to use // comments rather than /* ?

GPU_SetScissorTest: function prototype misrepresents usage.

GPU_SetScissorTest(GPU_SCISSORMODE mode, u32 x, u32 y, u32 w, u32 h);
should be
GPU_SetScissorTest(GPU_SCISSORMODE mode, u32 x, u32 y, u32 x1, u32 y1);
The "w" and "h" are misleading as they imply width and height, but the format accepted by GPU_SetScissorTest are screen coordinates, thus
GPU_SetScissorTest(GPU_SCISSOR_NORMAL, x, y, x + width, y + height);
produces the desired result, otherwise if x == width or y == height, nothing is drawn.

ndsp incompatibility (?) issues

Another problem came with ndsp. After finishing adapting all my codes from csnd to dsp and checking all the functions work fine on a simple test script, i tried to use the new 3dsx file with Sunshell and this is the result: https://www.youtube.com/watch?v=MYZD5By1RUE

The issues came also on NH 1.1B:

  1. Flickering screen
  2. Slowed audio
  3. Crackling audio
  4. Crash (on NH 1.1b) / Freeze (on NH 2.5) after a bit

GPU example doesn't compile with latest aemstro

Last working version is smealum/aemstro@55bf505 . After that, trying to build yields these error messages:

~/devkitPro/ctrulib_refactor/examples/gpu> make
test.vsh
inconsisten uniform register assignment !
inconsisten uniform register assignment !
Traceback (most recent call last):
  File "aemstro/aemstro_as.py", line 503, in <module>
    parseLine(dvlb.getDVLP(), dvle, line, False)
  File "aemstro/aemstro_as.py", line 481, in parseLine
    dirList[name](dvlp, dvle, r.group(2))
  File "aemstro/aemstro_as.py", line 432, in parseUniform
    dvle.addInput((int(s[0][1:],0)+offset,int(s[1][1:],0)+offset,s[2]))
ValueError: invalid literal for int() with base 0: ''
examples/gpu/Makefile:158: recipe for target 'test.vsh.o' failed
make[1]: *** [test.vsh.o] Error 1
Makefile:122: recipe for target 'build' failed
make: *** [build] Error 2

SOC_Initialize fails always

Im trying to use SOC_Initialize but it fails always, is there a bug? I cant find memalign, it is used in all socket's examples, and Im using instead linearMemAlign. Can you help me, please?

GPU examples don't build

On the current version of ctrulib with the current version of picasso, none of the GPU examples can build because the output file needs to be specified with the current version of picasso.
But if you downgrade to a version of picasso that doesn't need that, you get an error along the lines of

gpu.c
arm-none-eabi-gcc -MMD -MP -MF /home/witheld/Downloads/ctrulib/examples/graphics/gpu/geoshader/build/gpu.d -g -Wall -O2 -mword-relocations -fomit-frame-pointer -ffast-math -march=armv6k -mtune=mpcore -mfloat-abi=hard -I/home/witheld/Downloads/ctrulib/examples/graphics/gpu/geoshader/include -I/home/witheld/devkitPro/libctru/include -I/home/witheld/Downloads/ctrulib/examples/graphics/gpu/geoshader/build -DARM11 -D_3DS -c /home/witheld/Downloads/ctrulib/examples/graphics/gpu/geoshader/source/gpu.c -o gpu.o 
/home/witheld/Downloads/ctrulib/examples/graphics/gpu/geoshader/source/gpu.c: In function 'gpuClearBuffers':
/home/witheld/Downloads/ctrulib/examples/graphics/gpu/geoshader/source/gpu.c:31:45: error: 'GX_FILL_TRIGGER' undeclared (first use in this function)
   colorBuf, clearColor, &colorBuf[240*400], GX_FILL_TRIGGER | GX_FILL_32BIT_DEPTH,
                                             ^
/home/witheld/Downloads/ctrulib/examples/graphics/gpu/geoshader/source/gpu.c:31:45: note: each undeclared identifier is reported only once for each function it appears in
/home/witheld/Downloads/ctrulib/examples/graphics/gpu/geoshader/source/gpu.c:31:63: error: 'GX_FILL_32BIT_DEPTH' undeclared (first use in this function)
   colorBuf, clearColor, &colorBuf[240*400], GX_FILL_TRIGGER | GX_FILL_32BIT_DEPTH,
                                                               ^
/home/witheld/Downloads/ctrulib/examples/graphics/gpu/geoshader/source/gpu.c: In function 'gpuFrameEnd':
/home/witheld/Downloads/ctrulib/examples/graphics/gpu/geoshader/source/gpu.c:76:3: warning: implicit declaration of function 'GX_TRANSFER_FLIP_VERT' [-Wimplicit-function-declaration]
   DISPLAY_TRANSFER_FLAGS);
   ^
/home/witheld/Downloads/ctrulib/examples/graphics/gpu/geoshader/source/gpu.c:76:3: warning: implicit declaration of function 'GX_TRANSFER_OUT_TILED' [-Wimplicit-function-declaration]
/home/witheld/Downloads/ctrulib/examples/graphics/gpu/geoshader/source/gpu.c:76:3: warning: implicit declaration of function 'GX_TRANSFER_RAW_COPY' [-Wimplicit-function-declaration]
/home/witheld/Downloads/ctrulib/examples/graphics/gpu/geoshader/source/gpu.c:76:3: warning: implicit declaration of function 'GX_TRANSFER_IN_FORMAT' [-Wimplicit-function-declaration]
/home/witheld/Downloads/ctrulib/examples/graphics/gpu/geoshader/source/gpu.c:5:24: error: 'GX_TRANSFER_FMT_RGBA8' undeclared (first use in this function)
  GX_TRANSFER_IN_FORMAT(GX_TRANSFER_FMT_RGBA8) | GX_TRANSFER_OUT_FORMAT(GX_TRANSFER_FMT_RGB8) | \
                        ^
/home/witheld/Downloads/ctrulib/examples/graphics/gpu/geoshader/source/gpu.c:76:3: note: in expansion of macro 'DISPLAY_TRANSFER_FLAGS'
   DISPLAY_TRANSFER_FLAGS);
   ^
/home/witheld/Downloads/ctrulib/examples/graphics/gpu/geoshader/source/gpu.c:76:3: warning: implicit declaration of function 'GX_TRANSFER_OUT_FORMAT' [-Wimplicit-function-declaration]
/home/witheld/Downloads/ctrulib/examples/graphics/gpu/geoshader/source/gpu.c:5:72: error: 'GX_TRANSFER_FMT_RGB8' undeclared (first use in this function)
  GX_TRANSFER_IN_FORMAT(GX_TRANSFER_FMT_RGBA8) | GX_TRANSFER_OUT_FORMAT(GX_TRANSFER_FMT_RGB8) | \
                                                                        ^
/home/witheld/Downloads/ctrulib/examples/graphics/gpu/geoshader/source/gpu.c:76:3: note: in expansion of macro 'DISPLAY_TRANSFER_FLAGS'
   DISPLAY_TRANSFER_FLAGS);
   ^
/home/witheld/Downloads/ctrulib/examples/graphics/gpu/geoshader/source/gpu.c:76:3: warning: implicit declaration of function 'GX_TRANSFER_SCALING' [-Wimplicit-function-declaration]
/home/witheld/Downloads/ctrulib/examples/graphics/gpu/geoshader/source/gpu.c:6:22: error: 'GX_TRANSFER_SCALE_NO' undeclared (first use in this function)
  GX_TRANSFER_SCALING(GX_TRANSFER_SCALE_NO))
                      ^
/home/witheld/Downloads/ctrulib/examples/graphics/gpu/geoshader/source/gpu.c:76:3: note: in expansion of macro 'DISPLAY_TRANSFER_FLAGS'
   DISPLAY_TRANSFER_FLAGS);
   ^
/home/witheld/devkitPro/devkitARM/base_rules:84: recipe for target 'gpu.o' failed
make[1]: *** [gpu.o] Error 1
Makefile:127: recipe for target 'build' failed
make: *** [build] Error 2

some files are missing

in the gpu example some files are missing. Just to read the sources

include "test_png_bin.h"

include "mdl.h"

Can u add them, please?

[Standalone titles] Blackscreen on app start

Launching a homebrew app build with ctrulib results sometimes in a blackscreen. The app itself works/responds to button presses in this state. The 3DS just displays nothing. Return to home menu and continuing the app fixes it and everything get's displayed properly.

This only happens with standalone titles directly installed to the 3DS system.

Camera Example not working O3DS/ThemeHax 2.5

When I compile and run the camera image example, no image is written to the top framebuffer after pressing 'R'. The console outputs tons of information, but the top framebuffer seems empty.

Screenshots included
scr_2_top_left
scr_2_top_right
scr_2_bottom

Linker script bug - crash with --gc-sections

So yeah, you'll probably hate me for spamming this issue tracker, as this is not really a bug in ctrulib, but I have no idea how to contact fincs so I'm just posting this here in hopes that somebody with the right contacts will notice.

The issue is this:
ld has this really nice flag, --gc-sections which, when used with the right compiler flags, does wonders to eliminate unreferenced functions and data. However, when used with the 3ds script linked in this repo's readme, the application crashes on exit.
This is because a section needed by the CRT is accidentally dropped and bad things happen.

The fix is so simple that even I was able to figure it out. In 3dsx.ld, the following 3 lines need to be added just before /* =========== RODATA section =========== */:

    .fini ALIGN(4) :
    {
        KEEP( *(.fini) )
    }

This preserves the required section and makes everybody happy.

Once again, sorry for opening this issue here, but I couldn't think of any better place.

Input not working

Building FTP-3DS with recent ctrulib versions yields a application which lacks input support. In particular, FTP-3DS doesn't detect any button presses, but still works fine other than that. From quick testing it seems this also affects (all?) other applications.

It was suggested on IRC that this is a regression from 9fe9493 . I did not specifically confirm this, but I can tell that c765e3b does not have the issue.

httpcCloseContext doesn't return on real 3DS

It seems that my 3DS (9.2.0-20, Ninjhax) freezes whenever a httpc context is closed with httpcCloseContext, even in the HTTP example in this repo. To make sure, I placed this code after the call and nothing came up:

printf("Closed context!");
gfxFlushBuffers();

On 3dmoo, it does not crash, however this is shown in the log:

>> svcSendSyncRequest (0x32)
http_c_SyncRequest (line 217): CloseContext 0dadbb17 --stub--

>> svcCloseHandle (0x23)
svcCloseHandle: svcCloseHandle undefined for handle-type "service".

Would be great if this could be solved.

RomFS not working for 3dsx files in subdir

  1. Build RomFS example
  2. Move romfs.3dsx to sdmc:/3ds/romfs.3dsx => Works
  3. Move romfs.3dsx to sdmc:/3ds/romfs/romfs.3dsx => Fails

Returns: 0xC92044FA

This is consistent for more than just the romfs example code.

Contributing guide

ctrulib is missing some contributing guide for coding style and rules.

A draft is available at https://gist.github.com/Lectem/8a418268912521c35a3e

This would be part of the great-refactor, but we need people to reach some kind of consensus.
Please comment/vote here but keep in mind that we need to roughly keep a style close to the current code base.
Please also include the gist revision when commenting so that it is easier to track comments and changes.

clang-format is not mandatory but would help to refactor and act as a reference for pull requests.

For archiving reasons, I'm adding the original draft in this post.

CONTRIBUTING.MD

Style guide

  • Indent with tabs
  • spaces after commas in function calls
  • braces in column one for functions and if else blocks
  • #pragma once for headers
  • Use void if a function doesn't take any parameters
  • Align trailing comments and enum values with spaces
  • define and enum members are in SNAKE_UPPER_CASE
  • Hexadecimal values use the
    • shortest representation in uppercase
    • Padding with 0 for addresses or structure fields to match the size
    • Padding for enum values to be consistent (if ends at 0x25F, you must use 3 characters)
  • Trailing commas for array initializers and enums
  • Services
    • SVC_CommandName for raw service commands
    • svcFunctionName for ctrulib helpers

Everything not mentioned here falls into the provided .clang-format style. See Clang Format Style Options.

Example

/**
 * @file file.h
 * @brief the @file is needed to expose the documentation in doxygen. Please document the headers
 * and not the source code
 */

// Use #pragma once instead of guards for headers
#pragma once

#define BIT(n) (1U << (n))
#define RGB8_to_565(r, g, b) \
    (((b) >> 3) & 0x1F) | ((((g) >> 2) & 0x3F) << 5) | ((((r) >> 3) & 0x1F) << 11)

typedef enum
{
    FIRST_VALUE   = 1, ///< This describes FIRST_VALUE
    SECOND_VALUE  = 2,
    VALUE_IS_FIVE = 5, // Note the trailing comma
} SomeEnum;

/// brief description uses c++ style comments if fits in one line
int foo(void);

/**
 * @brief Short description
 * @param param1 information about the 1st param
 * @param bool A pointer
 *
 * More information about this beautiful function.
 */
int tryit(int param1, bool *done);

static void bar(int hello, int folks)
{
    int var = 0;
    if(folks >= 1)
        foo();
    else if(somecond && (mustBeOne == 1))
    {
        sit();
        wait();
    }

    switch(var)
    {
        case 0: break;
        case 1:
            doSomething();
            doSomeMore();
            break;
        case 2: foo(); break;
        default: break;
    }

    u32 address     = (u32)ptr;
    ptr[offset]     = 0;
    ptr[offset + 1] = 0;
}

.clang-format


---

IndentWidth: 4
TabWidth: 4
UseTab: ForIndentation
IndentCaseLabels: true

AlignConsecutiveAssignments: true
AlignEscapedNewlinesLeft: true
AlignOperands: true
AlignTrailingComments: true

AllowShortBlocksOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: true
AllowShortFunctionsOnASingleLine: true
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: true

BinPackArguments: true
BinPackParameters: true

BreakBeforeBraces: Allman
ColumnLimit: 100

KeepEmptyLinesAtTheStartOfBlocks: false

MaxEmptyLinesToKeep: 3

SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: Never
SpaceInEmptyParentheses: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false

Standard C headers

Will patches implementing standard C libraries (stdlib, stdio, math etc) be accepted?
Is there already another project for that?

Thanks.

Different charsets support

Why not adding different charsets support (like UTF-8 and Latin1(ISO-8859-1)) to libctru functions? (Maybe using LC_COLLATE category returned by standard C setlocale function to interchange charset to use)

httpcOpenContext fails after exactly 8 times, consistently

When opening http contexts to perform file downloads, every attempt after the 8th fails consistently, with the same error code, somewhere during the call to httpcOpenContext.

To reproduce this, I modified the http download example, and got it to repeatedly download files in a loop. It's hosted here: http://darknovagames.com:1337/3ds/http_context_test.zip. This is fairly straightforward; run the code, press A repeatedly, and after the 8th call to httpcOpenContext(), it fails consistently.

I'm testing on a 3DS XL, using firmware version 9.2.0-20U. This is through Ninjhax; I lack the ability to test on anything else. This is pretty weird; it feels like a resource is not being released somewhere, but httpcCloseContext() is definitely being called.

CSND won't load audio from subdirectories that are lower than 1 level

For example, lets say I have a file called "audio.bin", that has already been tested and does indeed play correctly. If I were to load "audio.bin" from the root directory (/audio.bin), CSND would execute correctly. However, if I were to move it to a directory lower than 1 level (/folder1/folder2/audio.bin), it won't load at all, even if it is the same file. I've already checked the directory names against my code, and they do match up, so it has to be CSND.

GPU sample black screen

I tried GPU sample with different configurations and i still get black screen, i tried to boot it on:

  • old 3DS GW emuNand 9.4 as CIA
  • old 3DS 4.5 sysNand Ninjhax
  • old 3DS 6.1 sysNand as CIA with emuNand 9.5

Are there some limitations on compatible firmwares?

Make sure IPC getters are using mask for short/char/bool values

I saw a few places where values are not masked while nintendo uses STRB or STRH. We should also make sure that all bool types are masked using 0xFF.
Enum values should be masked depending on the smallest value (usually 0xFF or 0xFFFF). While gcc already stores most of those in bytes or halfwords, it is not guaranteed by the standard.

For example I spotted https://github.com/Steveice10/ctrulib/blob/service-cleanup/libctru/source/services/cam.c#L355 but there are probably many other services suffering from this issue.

Random APT signal stuff fail in refactor branch

Tested with yeti3DS (newest version from master branch).

When installed as app on the home menu launching works fine, but once it runs, it doesn't recive any signal anymore (pressing the Home or power button does nothing. It just runs as if nothing happened).

โ‚ฌ:
Launched with Home menu sleep mode works fine and repairs the broken signal stuff somehow (Home button and power off button are working again). Nevermind. Was luck. Return to home did work 2 times.

GPU_Reset seems to use the wrong GSP command buffer

https://github.com/smealum/ctrulib/blob/master/libctru/source/gpu/gpu.c#L218

void GPUCMD_Run(u32* gxbuf) wants gxbuf, i.e. the GSP command buffer, as argument but is given the GPU command buffer gpuBuf instead.

I have tracked down the use of this gxbuf argument until GX_SetCommandList_First and GSPGPU_SubmitGxCommand and it does not seem it is a misnamed variable.
#143 with 73e0267 tried a simple fix but it broke the gpu, see image (it was merged a bit too fast)

image1

audio/mic example behaves strangely

The mic example's README says it can record roughly 32 seconds of audio. But when I try it, it only plays back a couple seconds of audio, nothing at all, or some duration between the two.

This may not be a proper solution (I wouldn't know), but it turns out if you take line 58 of main.c:
audiobuf_pos+= MIC_ReadAudioData(&audiobuf[audiobuf_pos], audiobuf_size-audiobuf_pos, 1);
and change that final argument waitforevent from 1 to 0, it'll record and play back the full 32 seconds pretty much fine.

Example was compiled with devkitARM r44 with latest ctrulib and launched via TubeHax on a 3DS XL with firmware 10.0.0-27. (Same thing happened on 9.9.0-26 too.)

-

-wrong tab sorry

memalign fails for the first call, succeeds for subsequent calls

The first call to memalign returns a valid-looking value, but attempting to use the memory causes a crash. Subsequent calls to memalign return valid values, but using them succeeds as one might expect.

Here's an example function I am testing to initialize sockets on the system:

void initialize_sockets() {
  u32* first_bank = (u32*)memalign(0x1000, 0x100000);
  if (first_bank == nullptr) {
    debug_message("first memalign failed");
    return;
  }
  debug_message("first bank: " + string_from<unsigned int>((unsigned int)first_bank, true));

  u32* second_bank = (u32*)memalign(0x1000, 0x100000);
  if (second_bank == nullptr) {
    debug_message("second memalign failed");
    return;
  }
  debug_message("second bank: " + string_from<unsigned int>((unsigned int)second_bank, true));

  u32 ret = SOC_Initialize(second_bank, 0x100000);
  debug_message(string_from<unsigned int>(ret));
}

Sample output on my system:
first bank: 0x8001000
second bank: 0x8102000

Modifying the code to pass first_bank in to SOC_Initialize causes it to crash. This is built against ctrulib version 74c37b4

Not sure what's going on; I suspect this has something to do with the recent changes to handle executable data regions perhaps?

calling printf before consoleInit : undefined behavior

It seems to crash most of the time, but earlier I encountered a problem where it simply made the while *printf family not working with format specifiers.
I don't know if there is a quickfix for that but it'd be nice if using printf before redirecting stdout (with consoleInit or else) would do nothing.

Weird sound issue when quitting whilst a looped sound is playing with csnd

Having a looped sound playing with csnd when a homebrew application is quitting causes some funky behaviour.

When loading other homebrew, high pitched noises can be heard, and loading other homebrew that uses sound can cause distortion.

Loading the homebrew the looped sound originated from causes the sound to be played, even if it shouldn't be.

I don't have good footage, but @shutterbug2000 recorded a similar issue with BreadBox https://www.youtube.com/watch?v=BPf4AUWewqM

Even stopping all channels on exit doesn't fix it.

Broken socketing on Ninjhax 2.X with big sized homebrews

It seems socketing is corrupted if used with some other services on with NH 2.X and relative haxs.

The same code working fine on 1.1b report errors when sending for server-type sockets and connecting for client-type sockets for my LUA interpreter (for example FTP give ECONNREFUSED on NH 2.x and Socket.connect() gives "Failed connecting server" error when executing this piece of code:

int err = connect(my_socket->sock, (struct sockaddr*)&my_socket->addrTo, sizeof(my_socket->addrTo));
if (err < 0 ) return luaL_error(L, "Failed connecting server.");

Implement service call OutputDebugString

Cf. https://github.com/citra-emu/citra/issues/91.

Being able to print some debug string wouldn't just be useful for us to debug homebrew by citra, but it would also be useful for homebrew developers to debug homebrew applications as a simple mean to do "printf"-style debugging.

I don't think implementing this function has any drawbacks, so it would be greatly appreciated if this worked out of the box :)

I have a tentative patch (no idea if it's to any extent sensible or correct, but it worked well enough for the citra implementation - but no idea if citra emulates calls to this service in existing applications properly), but it's written against the master branch. I'll just throw my bits here anyway, maybe they spare some time for someone who is willing to finish it.

First off, the function signature to include in a header is Result svc_outputDebugString(const char* str, int foo) (I have no idea what "foo" is used for, but the parameter is said to exist on 3dbrew)

My implementation in libctru/source/svc.s looks like this:

.global svc_outputDebugString
.type svc_outputDebugString, %function
svc_outputDebugString:
   str r0, [sp,#-0x4]!
   svc 0x3D
   ldr r2, [sp], #4
   str r1, [r2]
   bx lr

chdir does not work with/crashes when given relative paths

While reworking my gpsp port's file code I found that chdir has a borked behavior in that it cannot chdir to relative file locations. As an example, doing a chdir("."); will actually cause ctrulib to crash to home. Same with chdir("..");. Even if you try to chdir to an exiting directory within the current working directory, it will crash. A simple test to check against this bug is just a chdir(".") after initializing sdmc.

Also, getcwd seems to return "/" initially rather than "sdmc:/", up until you explicitly chdir("sdmc:/"). Doesn't seem to affect anything, but it's there. I believe @mtheall is the one I should be talking with on this issue.

Issues with FS refactor

After updating to last commits which included the FS service refactor, something like 70% of the executive code of my lua interpreter got completely broken.

Examples: Pause & Closing a sound cause a system crash. (This never happened before and there weren't syntax changes in the code).

I wonder if it could be caused by the FS_ATTRIBUTE_NONE that now is not usable anymore cause deprecated (?).

AM structure naming

looking at https://github.com/smealum/ctrulib/blob/master/libctru/include/3ds/services/am.h currently and i don't like the name of the structure. two things :

  • it's not a list, it's a list entry, so I'd rather call it either Title, TitleEntry or TitleListEntry
  • it doesn't respect the naming conventions set by every other service; it should have AM_ prepended to it. sure that's mostly for service call functions, but there's precedent for structures also, cf FS and GSP headers

if noone objects I'll be making these changes pretty soon. mostly posting this issue in case someone has a preference regarding the name and so that there's a record of the change for people who already use that code.

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.