Homebrew Homebrew Development

yerWizard

Active Member
Newcomer
Joined
Oct 21, 2016
Messages
32
Trophies
0
Age
25
XP
225
Country
I modified the textured cube example to make a simple move camera using the circlepad to learn citro3d and picasso and i'm having a lot of trouble with the view and model matrices.
The cube just doesn't show up on the screen when i add the view matrix to the main file and shader file.
Here's the main.c and the v.pica shader.
 
Last edited by yerWizard,

catlover007

Developer
Developer
Joined
Oct 23, 2015
Messages
720
Trophies
1
XP
3,922
Country
Germany
I think you moved the cube into the wrong direction. Instead of:
Code:
Mtx_Translate(&model, 0.0, 0.0, 2.0f, true);
try:
Code:
Mtx_Translate(&model, 0.0, 0.0, -2.0f, true);

Although modelview and projection are already split up in the original example, (atleast I think) it's smarter to premultiply projection * view * model to a MVP matrix. This makes the shader much less complex.
 

yerWizard

Active Member
Newcomer
Joined
Oct 21, 2016
Messages
32
Trophies
0
Age
25
XP
225
Country
Code:
Mtx_Translate(&model, 0.0, 0.0, -2.0f, true);

This didn't work. Also i'll have to look into the premultiplying of the matrices, i still don't understand much of this.
 

MRJPGames

Pretty great guy
Member
Joined
Aug 17, 2013
Messages
1,199
Trophies
1
Location
The Netherlands
Website
fizazy.com
XP
1,674
Country
Netherlands
Hi, I have this really weird problem. My game save to an XML file, which used to work fine. But for some reason stopped working. The weirdest thing is that when testing in citra it works just fine. It is only on real hardware that it doesn't work. However the weirdest thing is that it USED to work just fine. And I didn't change any code involving saving. Now I did change other code, one of which also loads the XML file. But in earlier testing this worked fine, now however it reads nothing at all, just like the save code. Does anyone know what could cause a program to stop being able to read files?

The way I read the files currently is:
Code:
std::ifstream t(fileLocation);
std::stringstream buffer;
buffer << t.rdbuf();

The code that is meant to create/update the file is this:
Code:
xml_doc.SaveFile(fileLocation.c_str());

And again this exact code USED to work, but has stopped working for whatever reason.
The only thing I could think of is that there might be a memory issue, where if too little ram is available the file will fail to load or write? But at the very least linearFreeMem() gives me ~16MB of free space, which should be more than enough for the small XML file...
 

catlover007

Developer
Developer
Joined
Oct 23, 2015
Messages
720
Trophies
1
XP
3,922
Country
Germany
This didn't work. Also i'll have to look into the premultiplying of the matrices, i still don't understand much of this.
Ah, I found another error in your code:
Code:
uLoc_model        = shaderInstanceGetUniformLocation(program.vertexShader, "modelView");
you renamed the uniform from modelView to model. Maybe it works after changes this.

Also instead of writing a = a + b or a = a - b you can simply write a += b or a -= b(this works with almost every operator, e.g. *=, |= or %=)
 
Last edited by catlover007,
  • Like
Reactions: yerWizard

Kartik

Well-Known Member
Member
Joined
Jun 6, 2015
Messages
653
Trophies
0
Location
github
XP
2,747
Country
India
Hi, I have this really weird problem. My game save to an XML file, which used to work fine. But for some reason stopped working. The weirdest thing is that when testing in citra it works just fine. It is only on real hardware that it doesn't work. However the weirdest thing is that it USED to work just fine. And I didn't change any code involving saving. Now I did change other code, one of which also loads the XML file. But in earlier testing this worked fine, now however it reads nothing at all, just like the save code. Does anyone know what could cause a program to stop being able to read files?

The way I read the files currently is:
Code:
std::ifstream t(fileLocation);
std::stringstream buffer;
buffer << t.rdbuf();

The code that is meant to create/update the file is this:
Code:
xml_doc.SaveFile(fileLocation.c_str());

And again this exact code USED to work, but has stopped working for whatever reason.
The only thing I could think of is that there might be a memory issue, where if too little ram is available the file will fail to load or write? But at the very least linearFreeMem() gives me ~16MB of free space, which should be more than enough for the small XML file...
Are you sure you don't have memory leaks in your code?Also try using a different SD card.
 

yerWizard

Active Member
Newcomer
Joined
Oct 21, 2016
Messages
32
Trophies
0
Age
25
XP
225
Country
Ah, I found another error in your code:
Code:
uLoc_model        = shaderInstanceGetUniformLocation(program.vertexShader, "modelView");
you renamed the uniform from modelView to model. Maybe it works after changes this.

Also instead of writing a = a + b or a = a - b you can simply write a += b or a -= b(this works with almost every operator, e.g. *=, |= or %=)

This along with the previous fix did it! Thanks!
 

MRJPGames

Pretty great guy
Member
Joined
Aug 17, 2013
Messages
1,199
Trophies
1
Location
The Netherlands
Website
fizazy.com
XP
1,674
Country
Netherlands
Are you sure you don't have memory leaks in your code?Also try using a different SD card.
I'm not sure I don't leak memory. However linearFreeMem() reports as much free memory before as after file load/online load so if this reporting is accurate it doesn't leak any memory. As for using another SD card, though it shouldn't make a diffrence as I'm able to read and write from it just fine using ftpd, I did try it and as expected it changed nothing. Just for the sake of it I also tried it on my o3DS (with of course yet another SD card) this also did not work.

So the question still stands, WHY did it suddenly stop working... And why does it work in emulator, meaning the code should in theory be fine?

Of course I tried some other things as well. As the Online object was what I was working on around the time it stopped working I though it might be useful to try to see what happens when I remove this class completely, essentially reverting back to the last working version. However this still does not work...

So essentially I have no idea what the problem could possibly be...
Here is the code involving loading/saving of files (fileLocation is always requested with "3ds/AoTHISave.xml"):
Code:
inline bool AoTHISaveManager::file_exists(const std::string& name) {
    ifstream f(name.c_str());
    return f.good();
}

void AoTHISaveManager::loadSaveDataFromFile(string fileLocation){
    //Load local username!
    cfguInit();
    u8 * outdata = (u8*)malloc(0x1C);
    u8 * outdata2 = (u8*)malloc(0x1C);
    CFGU_GetConfigInfoBlk2 (0x1C, 0x000A0000, outdata);
    utf16_to_utf8(outdata2,(u16*)outdata,0x1C);
    string str((char*)outdata2, 0x1C);
    localUsername = str;
    free(outdata);
    free(outdata2);
    cfguExit();

    if (file_exists(fileLocation)){
        //Load file
        std::ifstream t(fileLocation);
        std::stringstream buffer;
        buffer << t.rdbuf();

        tinyxml2::XMLDocument xml_doc;

        tinyxml2::XMLError eResult = xml_doc.Parse(buffer.str().c_str());
        if (eResult == tinyxml2::XML_SUCCESS){
            tinyxml2::XMLNode* root = xml_doc.FirstChild();
            if (root != nullptr){
                tinyxml2::XMLElement* element = root->FirstChildElement("easy");
                if (element != nullptr){
                    name[0]=element->FirstChildElement("name")->GetText();
                    element->FirstChildElement("score")->QueryIntText(&score[0]);
                    element->FirstChildElement("itemsDestroyed")->QueryIntText(&itemsDestroyed[0]);
                }
                element = root->FirstChildElement("normal");
                if (element != nullptr){
                    name[1]=element->FirstChildElement("name")->GetText();
                    element->FirstChildElement("score")->QueryIntText(&score[1]);
                    element->FirstChildElement("itemsDestroyed")->QueryIntText(&itemsDestroyed[1]);
                }
                element = root->FirstChildElement("hard");
                if (element != nullptr){
                    name[2]=element->FirstChildElement("name")->GetText();
                    element->FirstChildElement("score")->QueryIntText(&score[2]);
                    element->FirstChildElement("itemsDestroyed")->QueryIntText(&itemsDestroyed[2]);
                }
            }
        }
    }else{
        name[0]=(string)"This is a TEST";
        name[1]=localUsername;
        name[2]=localUsername;
        storeSaveData(fileLocation);
    }
}

void AoTHISaveManager::storeSaveData(string fileLocation){
    tinyxml2::XMLDocument xml_doc;
    //Create root element
    tinyxml2::XMLNode * pRoot = xml_doc.NewElement("save");
    xml_doc.InsertFirstChild(pRoot);

    //Create difficulty elements
    tinyxml2::XMLNode * pEasyNode = xml_doc.NewElement("easy");
    pRoot->InsertEndChild(pEasyNode);
    tinyxml2::XMLNode * pNormalNode = xml_doc.NewElement("normal");
    pRoot->InsertEndChild(pNormalNode);
    tinyxml2::XMLNode * pHardNode = xml_doc.NewElement("hard");
    pRoot->InsertEndChild(pHardNode);

    //Insert save data
    tinyxml2::XMLElement * pEasyNameElement = xml_doc.NewElement("name");
    pEasyNameElement->SetText(name[0].c_str());
    pEasyNode->InsertEndChild(pEasyNameElement);
    tinyxml2::XMLElement * pEasyScoreElement = xml_doc.NewElement("score");
    pEasyScoreElement->SetText(score[0]);
    pEasyNode->InsertEndChild(pEasyScoreElement);
    tinyxml2::XMLElement * pEasyItemsDestroyedElement = xml_doc.NewElement("itemsDestroyed");
    pEasyItemsDestroyedElement->SetText(itemsDestroyed[0]);
    pEasyNode->InsertEndChild(pEasyItemsDestroyedElement);

    tinyxml2::XMLElement * pNormalNameElement = xml_doc.NewElement("name");
    pNormalNameElement->SetText(name[1].c_str());
    pNormalNode->InsertEndChild(pNormalNameElement);
    tinyxml2::XMLElement * pNormalScoreElement = xml_doc.NewElement("score");
    pNormalScoreElement->SetText(score[1]);
    pNormalNode->InsertEndChild(pNormalScoreElement);
    tinyxml2::XMLElement * pNormalItemsDestroyedElement = xml_doc.NewElement("itemsDestroyed");
    pNormalItemsDestroyedElement->SetText(itemsDestroyed[1]);
    pNormalNode->InsertEndChild(pNormalItemsDestroyedElement);

    tinyxml2::XMLElement * pHardNameElement = xml_doc.NewElement("name");
    pHardNameElement->SetText(name[2].c_str());
    pHardNode->InsertEndChild(pHardNameElement);
    tinyxml2::XMLElement * pHardScoreElement = xml_doc.NewElement("score");
    pHardScoreElement->SetText(score[2]);
    pHardNode->InsertEndChild(pHardScoreElement);
    tinyxml2::XMLElement * pHardItemsDestroyedElement = xml_doc.NewElement("itemsDestroyed");
    pHardItemsDestroyedElement->SetText(itemsDestroyed[2]);
    pHardNode->InsertEndChild(pHardItemsDestroyedElement);

    //Actually save
    xml_doc.SaveFile(fileLocation.c_str());
}
I'll push the version which still includes Online etc. to GitHub soon the repo is: https://github.com/MrJPGames/AoTHI3D
I really hope someone can tell me what I'm doing wrong and where. (except for the terrible coding practices of course I'm well aware of those)
 

catlover007

Developer
Developer
Joined
Oct 23, 2015
Messages
720
Trophies
1
XP
3,922
Country
Germany
I'm not sure I don't leak memory. However linearFreeMem() reports as much free memory before as after file load/online load so if this reporting is accurate it doesn't leak any memory. As for using another SD card, though it shouldn't make a diffrence as I'm able to read and write from it just fine using ftpd, I did try it and as expected it changed nothing. Just for the sake of it I also tried it on my o3DS (with of course yet another SD card) this also did not work.

So the question still stands, WHY did it suddenly stop working... And why does it work in emulator, meaning the code should in theory be fine?

Of course I tried some other things as well. As the Online object was what I was working on around the time it stopped working I though it might be useful to try to see what happens when I remove this class completely, essentially reverting back to the last working version. However this still does not work...

So essentially I have no idea what the problem could possibly be...
Here is the code involving loading/saving of files (fileLocation is always requested with "3ds/AoTHISave.xml"):
Code:
inline bool AoTHISaveManager::file_exists(const std::string& name) {
    ifstream f(name.c_str());
    return f.good();
}

void AoTHISaveManager::loadSaveDataFromFile(string fileLocation){
    //Load local username!
    cfguInit();
    u8 * outdata = (u8*)malloc(0x1C);
    u8 * outdata2 = (u8*)malloc(0x1C);
    CFGU_GetConfigInfoBlk2 (0x1C, 0x000A0000, outdata);
    utf16_to_utf8(outdata2,(u16*)outdata,0x1C);
    string str((char*)outdata2, 0x1C);
    localUsername = str;
    free(outdata);
    free(outdata2);
    cfguExit();

    if (file_exists(fileLocation)){
        //Load file
        std::ifstream t(fileLocation);
        std::stringstream buffer;
        buffer << t.rdbuf();

        tinyxml2::XMLDocument xml_doc;

        tinyxml2::XMLError eResult = xml_doc.Parse(buffer.str().c_str());
        if (eResult == tinyxml2::XML_SUCCESS){
            tinyxml2::XMLNode* root = xml_doc.FirstChild();
            if (root != nullptr){
                tinyxml2::XMLElement* element = root->FirstChildElement("easy");
                if (element != nullptr){
                    name[0]=element->FirstChildElement("name")->GetText();
                    element->FirstChildElement("score")->QueryIntText(&score[0]);
                    element->FirstChildElement("itemsDestroyed")->QueryIntText(&itemsDestroyed[0]);
                }
                element = root->FirstChildElement("normal");
                if (element != nullptr){
                    name[1]=element->FirstChildElement("name")->GetText();
                    element->FirstChildElement("score")->QueryIntText(&score[1]);
                    element->FirstChildElement("itemsDestroyed")->QueryIntText(&itemsDestroyed[1]);
                }
                element = root->FirstChildElement("hard");
                if (element != nullptr){
                    name[2]=element->FirstChildElement("name")->GetText();
                    element->FirstChildElement("score")->QueryIntText(&score[2]);
                    element->FirstChildElement("itemsDestroyed")->QueryIntText(&itemsDestroyed[2]);
                }
            }
        }
    }else{
        name[0]=(string)"This is a TEST";
        name[1]=localUsername;
        name[2]=localUsername;
        storeSaveData(fileLocation);
    }
}

void AoTHISaveManager::storeSaveData(string fileLocation){
    tinyxml2::XMLDocument xml_doc;
    //Create root element
    tinyxml2::XMLNode * pRoot = xml_doc.NewElement("save");
    xml_doc.InsertFirstChild(pRoot);

    //Create difficulty elements
    tinyxml2::XMLNode * pEasyNode = xml_doc.NewElement("easy");
    pRoot->InsertEndChild(pEasyNode);
    tinyxml2::XMLNode * pNormalNode = xml_doc.NewElement("normal");
    pRoot->InsertEndChild(pNormalNode);
    tinyxml2::XMLNode * pHardNode = xml_doc.NewElement("hard");
    pRoot->InsertEndChild(pHardNode);

    //Insert save data
    tinyxml2::XMLElement * pEasyNameElement = xml_doc.NewElement("name");
    pEasyNameElement->SetText(name[0].c_str());
    pEasyNode->InsertEndChild(pEasyNameElement);
    tinyxml2::XMLElement * pEasyScoreElement = xml_doc.NewElement("score");
    pEasyScoreElement->SetText(score[0]);
    pEasyNode->InsertEndChild(pEasyScoreElement);
    tinyxml2::XMLElement * pEasyItemsDestroyedElement = xml_doc.NewElement("itemsDestroyed");
    pEasyItemsDestroyedElement->SetText(itemsDestroyed[0]);
    pEasyNode->InsertEndChild(pEasyItemsDestroyedElement);

    tinyxml2::XMLElement * pNormalNameElement = xml_doc.NewElement("name");
    pNormalNameElement->SetText(name[1].c_str());
    pNormalNode->InsertEndChild(pNormalNameElement);
    tinyxml2::XMLElement * pNormalScoreElement = xml_doc.NewElement("score");
    pNormalScoreElement->SetText(score[1]);
    pNormalNode->InsertEndChild(pNormalScoreElement);
    tinyxml2::XMLElement * pNormalItemsDestroyedElement = xml_doc.NewElement("itemsDestroyed");
    pNormalItemsDestroyedElement->SetText(itemsDestroyed[1]);
    pNormalNode->InsertEndChild(pNormalItemsDestroyedElement);

    tinyxml2::XMLElement * pHardNameElement = xml_doc.NewElement("name");
    pHardNameElement->SetText(name[2].c_str());
    pHardNode->InsertEndChild(pHardNameElement);
    tinyxml2::XMLElement * pHardScoreElement = xml_doc.NewElement("score");
    pHardScoreElement->SetText(score[2]);
    pHardNode->InsertEndChild(pHardScoreElement);
    tinyxml2::XMLElement * pHardItemsDestroyedElement = xml_doc.NewElement("itemsDestroyed");
    pHardItemsDestroyedElement->SetText(itemsDestroyed[2]);
    pHardNode->InsertEndChild(pHardItemsDestroyedElement);

    //Actually save
    xml_doc.SaveFile(fileLocation.c_str());
}
I'll push the version which still includes Online etc. to GitHub soon the repo is: https://github.com/MrJPGames/AoTHI3D
I really hope someone can tell me what I'm doing wrong and where. (except for the terrible coding practices of course I'm well aware of those)
As far as I know the linear memory is a different heap, than the standard heap. It's a smaller special memory region, which other hardware components can access. So you aren't getting the amount of free memory in the heap, your're allocating from with malloc(or C++ new) with linearFreeMem.
But I think it's really unlikely that the error is a result of a full heap.
 

Kartik

Well-Known Member
Member
Joined
Jun 6, 2015
Messages
653
Trophies
0
Location
github
XP
2,747
Country
India
I'm not sure I don't leak memory. However linearFreeMem() reports as much free memory before as after file load/online load so if this reporting is accurate it doesn't leak any memory. As for using another SD card, though it shouldn't make a diffrence as I'm able to read and write from it just fine using ftpd, I did try it and as expected it changed nothing. Just for the sake of it I also tried it on my o3DS (with of course yet another SD card) this also did not work.

So the question still stands, WHY did it suddenly stop working... And why does it work in emulator, meaning the code should in theory be fine?

Of course I tried some other things as well. As the Online object was what I was working on around the time it stopped working I though it might be useful to try to see what happens when I remove this class completely, essentially reverting back to the last working version. However this still does not work...

So essentially I have no idea what the problem could possibly be...
Here is the code involving loading/saving of files (fileLocation is always requested with "3ds/AoTHISave.xml"):
Code:
inline bool AoTHISaveManager::file_exists(const std::string& name) {
    ifstream f(name.c_str());
    return f.good();
}

void AoTHISaveManager::loadSaveDataFromFile(string fileLocation){
    //Load local username!
    cfguInit();
    u8 * outdata = (u8*)malloc(0x1C);
    u8 * outdata2 = (u8*)malloc(0x1C);
    CFGU_GetConfigInfoBlk2 (0x1C, 0x000A0000, outdata);
    utf16_to_utf8(outdata2,(u16*)outdata,0x1C);
    string str((char*)outdata2, 0x1C);
    localUsername = str;
    free(outdata);
    free(outdata2);
    cfguExit();

    if (file_exists(fileLocation)){
        //Load file
        std::ifstream t(fileLocation);
        std::stringstream buffer;
        buffer << t.rdbuf();

        tinyxml2::XMLDocument xml_doc;

        tinyxml2::XMLError eResult = xml_doc.Parse(buffer.str().c_str());
        if (eResult == tinyxml2::XML_SUCCESS){
            tinyxml2::XMLNode* root = xml_doc.FirstChild();
            if (root != nullptr){
                tinyxml2::XMLElement* element = root->FirstChildElement("easy");
                if (element != nullptr){
                    name[0]=element->FirstChildElement("name")->GetText();
                    element->FirstChildElement("score")->QueryIntText(&score[0]);
                    element->FirstChildElement("itemsDestroyed")->QueryIntText(&itemsDestroyed[0]);
                }
                element = root->FirstChildElement("normal");
                if (element != nullptr){
                    name[1]=element->FirstChildElement("name")->GetText();
                    element->FirstChildElement("score")->QueryIntText(&score[1]);
                    element->FirstChildElement("itemsDestroyed")->QueryIntText(&itemsDestroyed[1]);
                }
                element = root->FirstChildElement("hard");
                if (element != nullptr){
                    name[2]=element->FirstChildElement("name")->GetText();
                    element->FirstChildElement("score")->QueryIntText(&score[2]);
                    element->FirstChildElement("itemsDestroyed")->QueryIntText(&itemsDestroyed[2]);
                }
            }
        }
    }else{
        name[0]=(string)"This is a TEST";
        name[1]=localUsername;
        name[2]=localUsername;
        storeSaveData(fileLocation);
    }
}

void AoTHISaveManager::storeSaveData(string fileLocation){
    tinyxml2::XMLDocument xml_doc;
    //Create root element
    tinyxml2::XMLNode * pRoot = xml_doc.NewElement("save");
    xml_doc.InsertFirstChild(pRoot);

    //Create difficulty elements
    tinyxml2::XMLNode * pEasyNode = xml_doc.NewElement("easy");
    pRoot->InsertEndChild(pEasyNode);
    tinyxml2::XMLNode * pNormalNode = xml_doc.NewElement("normal");
    pRoot->InsertEndChild(pNormalNode);
    tinyxml2::XMLNode * pHardNode = xml_doc.NewElement("hard");
    pRoot->InsertEndChild(pHardNode);

    //Insert save data
    tinyxml2::XMLElement * pEasyNameElement = xml_doc.NewElement("name");
    pEasyNameElement->SetText(name[0].c_str());
    pEasyNode->InsertEndChild(pEasyNameElement);
    tinyxml2::XMLElement * pEasyScoreElement = xml_doc.NewElement("score");
    pEasyScoreElement->SetText(score[0]);
    pEasyNode->InsertEndChild(pEasyScoreElement);
    tinyxml2::XMLElement * pEasyItemsDestroyedElement = xml_doc.NewElement("itemsDestroyed");
    pEasyItemsDestroyedElement->SetText(itemsDestroyed[0]);
    pEasyNode->InsertEndChild(pEasyItemsDestroyedElement);

    tinyxml2::XMLElement * pNormalNameElement = xml_doc.NewElement("name");
    pNormalNameElement->SetText(name[1].c_str());
    pNormalNode->InsertEndChild(pNormalNameElement);
    tinyxml2::XMLElement * pNormalScoreElement = xml_doc.NewElement("score");
    pNormalScoreElement->SetText(score[1]);
    pNormalNode->InsertEndChild(pNormalScoreElement);
    tinyxml2::XMLElement * pNormalItemsDestroyedElement = xml_doc.NewElement("itemsDestroyed");
    pNormalItemsDestroyedElement->SetText(itemsDestroyed[1]);
    pNormalNode->InsertEndChild(pNormalItemsDestroyedElement);

    tinyxml2::XMLElement * pHardNameElement = xml_doc.NewElement("name");
    pHardNameElement->SetText(name[2].c_str());
    pHardNode->InsertEndChild(pHardNameElement);
    tinyxml2::XMLElement * pHardScoreElement = xml_doc.NewElement("score");
    pHardScoreElement->SetText(score[2]);
    pHardNode->InsertEndChild(pHardScoreElement);
    tinyxml2::XMLElement * pHardItemsDestroyedElement = xml_doc.NewElement("itemsDestroyed");
    pHardItemsDestroyedElement->SetText(itemsDestroyed[2]);
    pHardNode->InsertEndChild(pHardItemsDestroyedElement);

    //Actually save
    xml_doc.SaveFile(fileLocation.c_str());
}
I'll push the version which still includes Online etc. to GitHub soon the repo is: https://github.com/MrJPGames/AoTHI3D
I really hope someone can tell me what I'm doing wrong and where. (except for the terrible coding practices of course I'm well aware of those)
I think this error is being caused due to a single missing "/". In your main.cpp try changing save.storeSaveData("3ds/AoTHISave.xml") to save.storeSaveData("/3ds/AoTHISave.xml") & save.loadSaveDataFromFile("3ds/AoTHISave.xml") to save.loadSaveDataFromFile("/3ds/AoTHISave.xml");
BTW:Nice Game!
 
Last edited by Kartik,
  • Like
Reactions: MRJPGames

MRJPGames

Pretty great guy
Member
Joined
Aug 17, 2013
Messages
1,199
Trophies
1
Location
The Netherlands
Website
fizazy.com
XP
1,674
Country
Netherlands
I think this error is being caused due to a single missing "/". In your main.cpp try changing save.storeSaveData("3ds/AoTHISave.xml") to save.storeSaveData("/3ds/AoTHISave.xml") & save.loadSaveDataFromFile("3ds/AoTHISave.xml") to save.loadSaveDataFromFile("/3ds/AoTHISave.xml");
BTW:Nice Game!
Thanks and thanks. But sadly enough it still doesn't work. Though it does still work in the emulator. I will be doing more debugging any suggestions are of course welcome!
 

Kartik

Well-Known Member
Member
Joined
Jun 6, 2015
Messages
653
Trophies
0
Location
github
XP
2,747
Country
India
Thanks and thanks. But sadly enough it still doesn't work. Though it does still work in the emulator. I will be doing more debugging any suggestions are of course welcome!
Well that's weird.I tried it and it was working for me on my 3ds...(A file named AoTHISave.xml should exist in the 3ds directory, right?)
 
Last edited by Kartik,
  • Like
Reactions: MRJPGames

Coto

-
Member
Joined
Jun 4, 2010
Messages
2,979
Trophies
2
XP
2,565
Country
Chile
As far as I know the linear memory is a different heap, than the standard heap. It's a smaller special memory region, which other hardware components can access. So you aren't getting the amount of free memory in the heap, your're allocating from with malloc(or C++ new) with linearFreeMem.
But I think it's really unlikely that the error is a result of a full heap.

well I don't know if that linear memory description context is what i will describe but at least for gnu LD (linker) the virtual memory address is the intended memory region (IO mapped) a section should be pointed at, while the linear memory address is the physical memory (linear) the LD expects for contiguous relocated sections.

malloc actually uses a heap approach, which is: the (physical memory end - linear address end pointer, or LMA ) as free space. messing with LMA end will certainly break newlib's malloc

edit: typo, I meant linear memory address / virtual memory address, not allocation.
 
Last edited by Coto,

MRJPGames

Pretty great guy
Member
Joined
Aug 17, 2013
Messages
1,199
Trophies
1
Location
The Netherlands
Website
fizazy.com
XP
1,674
Country
Netherlands
Hi people. Any ideas for doing a Python interpreter?
You could look at lpp a lua intrepeter for the 3DS.
Original post with opinions:
Why?
But for actual ideas, you could look at lpp a lua intrepeter for the 3DS.
But really I don't see the point tbh. Python really isn't a good programming language anyways, and if anyone wants to script instead of use c/c++ lua with lpp is fine.
 

catlover007

Developer
Developer
Joined
Oct 23, 2015
Messages
720
Trophies
1
XP
3,922
Country
Germany
Hi people. Any ideas for doing a Python interpreter?
I think someone already ported a Python interpreter to the 3DS, but never heared again of it. Later added: I was sniped, yes the primary scripting language on the 3DS is Lua.
well I don't know if that linear memory description context is what i will describe but at least for gnu LD (linker) the virtual memory allocation is the intended region memory a section should be pointed at, while the linear memory allocation is the physical memory (linear) the LD expects for contiguous relocated sections.

malloc actually uses a heap approach, which is: the (physical memory end - linear allocation end pointer, or LMA ) as free space. messing with LMA end will certainly break newlib's malloc
I'm not an expert in this stuff, but the linear memory I'm talking about, is a special memory region found in the architecture of the 3DS(https://www.3dbrew.org/wiki/Memory_layout#NATIVE_FIRM.2FSAFE_MODE_FIRM_Userland_Memory). It's managed in as heap by ctrulib(see the relevant code here: https://github.com/smealum/ctrulib/blob/master/libctru/source/allocator/linear.cpp). So I think we're talking about different "linear heaps", but I'm not exactly sure
 
Last edited by catlover007,

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    cearp @ cearp: HBD 2U