Homebrew Development

Discussion in '3DS - Homebrew Development and Emulators' started by aliak11, Jan 16, 2014.

  1. spinal_cord

    spinal_cord Knows his stuff

    Member
    3,022
    598
    Jul 21, 2007
    somewhere
    Does anyone know if there are any current issues with accessing the sd card in the latest (or any) versions of devkitpro/libctru? I'm checking my path and filename before loading, but unless I reset citra (same with real hardware) I can't access files.
    I'm checking the current path with
    Code:
                        char cwd[64];
                        getcwd(cwd, sizeof(cwd));
    
    and testing the file with
    Code:
                    FILE *file;
                    if (file = fopen(ThePrefs.DrivePath[0], "r")){
                        // file OK
                        fclose(file);
                    }else{
                        // file NOT OK
                    }
    
    When ever I try to change the file path I can't read the new file, even though the path and filename are 100% correct.
    Any ideas?
     
  2. elhobbs

    elhobbs GBAtemp Advanced Fan

    Member
    811
    299
    Jul 28, 2008
    United States
    The console window in citra should display information about the file you are trying to open and the reason it failed. You can use this to confirm it is trying to open the correct file.

    — Posts automatically merged - Please don't double post! —

    what is this -
    ThePrefs.DrivePath[0]? It looks like it is the first character of DrivePath. Or is DrivePath an array of file names?
     
  3. spinal_cord

    spinal_cord Knows his stuff

    Member
    3,022
    598
    Jul 21, 2007
    somewhere
    It's an array of filenames...
    Drivepath [4][256]
    Citra is just giving me unmapped read32 if I try to access a file that it thinks isn't there.
     
  4. elhobbs

    elhobbs GBAtemp Advanced Fan

    Member
    811
    299
    Jul 28, 2008
    United States
    So the file is there but the app fails to open it? if you look above the read32 errors you will see the file name it tried to open. If the file does not exist or fopen returns null then trying to use the file pointer could lead to errors if you do not handle it properly.
     
  5. spinal_cord

    spinal_cord Knows his stuff

    Member
    3,022
    598
    Jul 21, 2007
    somewhere
    Code:
    [   4.362703] Audio <Debug> audio_core\time_stretch.cpp:Process:58: Dropping frames!
    [   4.765376] Service.FS <Debug> core\hle\service\fs\fs_user.cpp:OpenDirectory:389: type=4 size=4 data=[Wchar: /]
    [   4.768898] Service.FS <Debug> core\hle\service\fs\fs_user.cpp:OpenDirectory:389: type=4 size=6 data=[Wchar: /.]
    [   6.606436] Service.FS <Debug> core\hle\service\fs\fs_user.cpp:OpenFile:68: path=[Wchar: /mayhem.d64], mode=1 attrs=0
    [   6.607042] Service.FS <Debug> core\file_sys\archive_sdmc.cpp:OpenFileBase:33: called path=[Wchar: /mayhem.d64] mode=1
    [   6.608363] Service.FS <Critical> core\file_sys\archive_sdmc.cpp:OpenFileBase:79: (unreachable) Unknown error opening C:\devkitPro\citra_emulator/user/sdmc/mayhem.d64
    [   6.609500] Service.FS <Error> core\hle\service\fs\fs_user.cpp:OpenFile:76: failed to get a handle for file [Wchar: /mayhem.d64]
    [   6.610448] Service.FS <Debug> core\hle\service\fs\fs_user.cpp:OpenDirectory:389: type=4 size=24 data=[Wchar: /mayhem.d64]
    [   6.611903] Service.FS <Error> core\file_sys\archive_sdmc.cpp:OpenDirectory:279: C:\devkitPro\citra_emulator/user/sdmc/mayhem.d64 not found
    [   6.612954] Service.FS <Error> core\hle\service\fs\fs_user.cpp:OpenDirectory:397: failed to get a handle for directory type=4 size=24 data=[Wchar: /mayhem.d64]
    [   6.614260] Service.FS <Debug> core\hle\service\fs\fs_user.cpp:OpenFile:68: path=[Wchar: /mayhem.d64], mode=1 attrs=0
    [   6.614680] Service.FS <Debug> core\file_sys\archive_sdmc.cpp:OpenFileBase:33: called path=[Wchar: /mayhem.d64] mode=1
    [   6.617241] Service.FS <Critical> core\file_sys\archive_sdmc.cpp:OpenFileBase:79: (unreachable) Unknown error opening C:\devkitPro\citra_emulator/user/sdmc/mayhem.d64
    [   6.618078] Service.FS <Error> core\hle\service\fs\fs_user.cpp:OpenFile:76: failed to get a handle for file [Wchar: /mayhem.d64]
    [   6.619065] HW.Memory <Error> core\memory.cpp:Read:184: unmapped Read32 @ 0x00000070
    [   6.619426] HW.Memory <Error> core\memory.cpp:Read:184: unmapped Read16 @ 0x0000000C
    [   6.620341] HW.Memory <Error> core\memory.cpp:Read:184: unmapped Read32 @ 0x00000060
    [   6.621279] HW.Memory <Error> core\memory.cpp:Read:184: unmapped Read32 @ 0x0000005C
    [   6.622198] HW.Memory <Error> core\memory.cpp:Write:224: unmapped Write32 0x00000000 @ 0x0000005C
    [   6.622839] HW.Memory <Error> core\memory.cpp:Write:224: unmapped Write32 0x1FF82000 @ 0x00000060
    
    I can't understand why I'm getting "C:\devkitPro\citra_emulator/user/sdmc/mayhem.d64 not found" when I'm browsing and selecting the file within my program. The file is 100% there because I'm able to find it and select it.
     
  6. elhobbs

    elhobbs GBAtemp Advanced Fan

    Member
    811
    299
    Jul 28, 2008
    United States
    Is the file open by another process or marked as read-only? Try to open the file with notepad and see if you get an error?
     
  7. spinal_cord

    spinal_cord Knows his stuff

    Member
    3,022
    598
    Jul 21, 2007
    somewhere
    That sounds reasonable. I'll give that a check when I get a chance.
     
  8. elhobbs

    elhobbs GBAtemp Advanced Fan

    Member
    811
    299
    Jul 28, 2008
    United States
  9. spinal_cord

    spinal_cord Knows his stuff

    Member
    3,022
    598
    Jul 21, 2007
    somewhere
  10. elhobbs

    elhobbs GBAtemp Advanced Fan

    Member
    811
    299
    Jul 28, 2008
    United States
    Most likely the file was locked by another process.
     
  11. spinal_cord

    spinal_cord Knows his stuff

    Member
    3,022
    598
    Jul 21, 2007
    somewhere
    It was doing it with most files both in citra and on hardware. I did disable double buffering, maybe it was a memory issue...
     
  12. Traiver

    Traiver GBAtemp Maniac

    Member
    1,199
    1,294
    Aug 1, 2014
    Germany
    Pew! *Out of the bag*
    Hey,

    I need some help on linux with creating something.

    The story (short): One of my friends left speaker is broken and he's tired off chaging it everytime from mono to stereo when he's listening with headphones through the system settings. He wants that an option is implemented in the Rosalina menu, where you can change from mono to stereo and vise versa.

    I already researched the 11.5.2 SDK and the "config SDK app" and found the files that matters (cfg_Sound.h, config savegame
    0x00070001 0x1 0xE sound output mode (mono/stereo/surround)).

    It's quite simple what I want to do. Like the config SDK app, I want to implement a simple option chaging the sound output mode. But what exact options should I write to it since the cfg_sound.h isn't clear enough for me and doesn't say that much? Here is the code:
    Code:
    #ifndef NN_CFG_CTR_CFG_SOUND_H_
    #define NN_CFG_CTR_CFG_SOUND_H_
    
    namespace nn {
    namespace cfg {
    namespace CTR {
    
    /*!
    @brief Enumerated type that represents sound output modes.
    */
    enum CfgSoundOutputMode
    {
        CFG_SOUND_OUTPUT_MODE_MONO,     //!< Mono.
        CFG_SOUND_OUTPUT_MODE_STEREO,   //!< Stereo.
        CFG_SOUND_OUTPUT_MODE_SURROUND  //!< 3D Surround Sound.
    };
    
    } // end of namespace CTR
    } // end of namespace cfg
    } // end of namespace nn
    
    #endif      // NN_CFG_CTR_CFG_SOUND_H_
     
  13. tgaiu

    tgaiu Member

    Newcomer
    28
    3
    Sep 10, 2017
    Japan
    Is there a way to play ogg files?
     
  14. nop90

    nop90 GBAtemp Maniac

    Member
    1,437
    2,138
    Jan 11, 2014
    Italy
    Rome
    Libtremor, you can install it using the DevkitArm portlibs makefile on github.

    Or you can use the SDL_mixer lib.
     
  15. tgaiu

    tgaiu Member

    Newcomer
    28
    3
    Sep 10, 2017
    Japan
    I downloaded Libtremor, but the make command does not work.
    Did I make a mistake somewhere?
     
  16. nop90

    nop90 GBAtemp Maniac

    Member
    1,437
    2,138
    Jan 11, 2014
    Italy
    Rome
    Exactly wat are you doing? Ar you using the makefile here?

    With this one you should type "make tremor" from a unix shell (or from msys on windows) to download and compile the lib.

    Than typing "make install" will setup it in your toolchain.

    On windows you need to have wget.exe in a folder declared in your PATH enviroment variable, or in the same folder of the makefile.

    Hope this helps.
     
  17. tgaiu

    tgaiu Member

    Newcomer
    28
    3
    Sep 10, 2017
    Japan
    I was able to use the make command, but I got an error.

    Generating configuration files for vorbisidec, please wait....
    aclocal -I /c/devkitPro/portlibs/3ds/share/aclocal -I /c/devkitPro/portlibs/armv6k/share/aclocal
    aclocal: couldn't open directory `/c/devkitPro/portlibs/3ds/share/aclocal': No such file or directory
     
  18. nop90

    nop90 GBAtemp Maniac

    Member
    1,437
    2,138
    Jan 11, 2014
    Italy
    Rome
    If you are on linux maybe you are running make with an user without permissions for creating that folder.

    A quick fix could be to create the folder manually (remember to set write permission to the folder).

    Setting portlibs for the fist time is always problematic in my experience. I spent a lot of time to setup the VITA toolchain and last week I had problems with the Switch enviroment too (that is just a minimal enviroment at the moment).
     
  19. tgaiu

    tgaiu Member

    Newcomer
    28
    3
    Sep 10, 2017
    Japan
    I am working on windows.
    I started Msys with administrator's privileges, but I got an error as well.
     
  20. elhobbs

    elhobbs GBAtemp Advanced Fan

    Member
    811
    299
    Jul 28, 2008
    United States
    You need to manually create the missing folder structure. It does not appear to get used but it wants it there. Appears to be a glitch with the build process, but a harmless one.