NVRAM questions

Discussion in 'NDS - Emulation and Homebrew' started by ground, Jun 28, 2015.

  1. ground
    OP

    ground GBAtemp Advanced Fan

    Member
    909
    281
    Mar 22, 2007
    Netherlands
    Hello,

    Today i started making my own NDS tool for NVRAM writing& editing. But i ran into a problem, and now I am hoping somebody can help me here.

    First off all, I got NVRAM dumping working with this code:
    read code
    This code works fine, and i got the same result when i use this tool : https://github.com/44670/NVReader
    , except for the first 4 bytes, which are off (they are always 00 in nvreader).

    But writing the exact same .bin file back to the NVRAM results in a dsmode brick for me. I am using the following code for it:
    writing NVRAM
    does anybody have an idea what i am missing here?
     
  2. Coto

    Coto GBAtemp Addict

    Member
    2,365
    416
    Jun 4, 2010
    Chile
    there may be a fread missing in the nvram write.

    you need to extract the nvram binary from the SD controller first, and then use that one to write it anywhere

    that's what i believe
     
  3. zoogie

    zoogie simple pimp tool

    Member
    6,342
    8,029
    Nov 30, 2014
    United States
    FILE* file=fopen("nvram.bin", "w");

    should be "wb"
    i don't know if that fixes it but it's a start.

    you can also check out wintermute's tool that does the same thing for a reference/second opinion whatever you want to call it.
    https://github.com/WinterMute/nintendo-ds-tools/tree/master/firmware/nds/fwTool
    the libnds functions for nvram writing have changed recently, it's all done from the arm9 alone now.

    you can also read/write nvram from 3ds mode now. it may be more stable. here's an example.
    https://github.com/Steveice10/FBI/commit/95c6ce3f832ee3d929e154ea728e0733f1d55310
     
    Last edited by zoogie, Jun 28, 2015
    ground likes this.
  4. drwhojan

    drwhojan GBAtemp Psycho!

    Member
    3,543
    618
    Jul 14, 2009
    United Kingdom
    Where I Am!
    The fwtool was already compiled .
     

    Attached Files:

  5. ground
    OP

    ground GBAtemp Advanced Fan

    Member
    909
    281
    Mar 22, 2007
    Netherlands
    of course, that was it! thank you. it is working now.
    for the ones who want to see the code:

    writing nvram
     
    Coto likes this.
  6. Coto

    Coto GBAtemp Addict

    Member
    2,365
    416
    Jun 4, 2010
    Chile
    isn't great when something works?

    cool it's working!