works for some reason but cpp weirdness happening

This commit is contained in:
jonko0493 2025-05-06 13:05:36 -07:00
parent 593a4ba58c
commit 2b2de41769
4 changed files with 19 additions and 10 deletions

View File

@ -1,6 +1,9 @@
{
"files.associations": {
"memory": "cpp",
"unistd.h": "c"
"unistd.h": "c",
"new": "cpp",
"string": "cpp",
"cstdlib": "cpp"
}
}

View File

@ -25,8 +25,10 @@ namespace Loader
void loadExampleLib()
{
exampleLib = dlopen("nitro:/dsl/example.dsl", RTLD_NOW | RTLD_LOCAL);
printf("Example lib loaded to %x\n", (u32)exampleLib);
isFlagSetFn = (fnIsFlagSet *)dlsym(exampleLib, "isFlagSet");
isFlagSetFn = (fnIsFlagSet *)dlsym(exampleLib, "isFlagSet(Save*, unsi");
printf("isFlagSet loaded to %x\n", (u32)isFlagSetFn);
setFlagFn = (fnSetFlag *)dlsym(exampleLib, "setFlag");
clearFlagFn = (fnClearFlag *)dlsym(exampleLib, "clearFlag");
getGlobalFn = (fnGetGlobal *)dlsym(exampleLib, "getGlobal");

View File

@ -24,6 +24,7 @@ int main()
consoleSelect(&topScreen);
bool init_ok = nitroFSInit(NULL);
if (!init_ok)
{
@ -41,20 +42,24 @@ int main()
printf("Creating save file...\n");
save = new Save();
printf("Loading example library...");
// use necessary functions here so we can include them in dynlibs
save->getSaveSlot();
mallinfo();
printf("Loading example library...\n");
Loader::loadExampleLib();
SaveExtensions::setFlag(save, 5);
if (SaveExtensions::isFlagSet(save, 5))
{
printf("Flag 5 was set.");
printf("Flag 5 was set.\n");
}
SaveExtensions::setGlobal(save, 5, 20);
printf("Global 5 was set to %d", SaveExtensions::getGlobal(save, 5));
printf("Global 5 was set to %d\n", SaveExtensions::getGlobal(save, 5));
printf("Mem used: %d\nMem free: %d", Debug::getMemUsed(), Debug::getMemFree());
printf("Mem used: %d\nMem free: %d\n", Debug::getMemUsed(), Debug::getMemFree());
printf("Unloading example lib...");
printf("Unloading example lib...\n");
Loader::unloadExmapleLib();
printf("Press START to exit to loader\n");

View File

@ -9,6 +9,7 @@
#include <iostream>
#include <regex>
#include <malloc.h>
#include <fat.h>
#include <filesystem.h>
#include <nds.h>
@ -19,6 +20,4 @@
Save *save;
int main();
void update();
void render();
int main();