Refactor codebase and complete implementation

- Consolidate development files into final implementation
- Replace basic prototypes with full feature implementations
- Add complete hash-based save data access system
- Implement advanced map pin management algorithms
- Add comprehensive error handling and user feedback
- Complete Korok seed database with all 908 locations
This commit is contained in:
badblocks 2023-05-24 09:08:09 -07:00
parent 07db2a4d8d
commit 6bff4b6fcd
No known key found for this signature in database
20 changed files with 2011 additions and 281 deletions

View file

@ -1,42 +1,82 @@
#include <string.h>
#include <stdio.h>
#include <dirent.h>
#include <stdlib.h>
#include <math.h>
#include <switch.h>
#include "save_basic.h"
#include "ui_basic.h"
#include "save.h"
#include "ui.h"
int main(int argc, char **argv)
{
setvbuf(stdout, NULL, _IONBF, BUFSIZ);
setvbuf(stdout, NULL, _IONBF, BUFSIZ); //do not line-buffer stdout
Result rc=0;
bool exit = false;
AccountUid uid={0};
u64 application_id=0x01007ef00011e000;//ApplicationId of the save to mount, in this case BOTW.
consoleInit(NULL);
// Configure input
// Configure our supported input layout: a single player with standard controller styles
padConfigureInput(1, HidNpadStyleSet_NpadStandard);
// Initialize the default gamepad (which reads handheld mode inputs as well as the first connected controller)
PadState pad;
padInitializeDefault(&pad);
//draw main screen and menu
initUI();
//Get the userID for save mounting. To mount common savedata, use an all-zero userID.
//Try to find savedata to use with the above hard-coded TID + the userID from accountGetPreselectedUser(). Note that you can use either method.
//See the account example for getting account info for an userID.
//See also the app_controldata example for getting info for an application_id.
rc = accountInitialize(AccountServiceType_Application);
if (R_FAILED(rc)) {
printMessage("accountInitialize() failed: 0x%x\n", rc);
exit = true;
}
rc = accountGetPreselectedUser(&uid);
accountExit();
if (R_FAILED(rc)) {
printMessage("accountGetPreselectedUser() failed: 0x%x\n", rc);
exit = true;
}
//You can use any device-name. If you want multiple saves mounted at the same time, you must use different device-names for each one.
rc = fsdevMountSaveData("save", application_id, uid);//See also libnx fs.h/fs_dev.h
if (R_FAILED(rc)) {
printMessage("fsdevMountSaveData() failed: 0x%x\n", rc);
exit = true;
}
//At this point you can use the mounted device with standard stdio.
//After modifying savedata, in order for the changes to take affect you must use: rc = fsdevCommitDevice("save");
//See also libnx fs_dev.h for fsdevCommitDevice.
// Initialize save system
openSave();
processSave();
// Initialize UI
initUI();
bool exit = false;
// Main loop
while(appletMainLoop() && !exit)
{
// Scan the gamepad. This should be done once for each frame
padUpdate(&pad);
// padGetButtonsDown returns the set of buttons that have been newly pressed in this frame compared to the previous one
u64 kDown = padGetButtonsDown(&pad);
exit = handleButtonPress(kDown);
consoleUpdate(NULL);
}
// Unmount save data before exit
fsdevUnmountDevice("save");
consoleExit(NULL);
return 0;
}
}