mirror of
https://github.com/DarkStore-3DS/DarkStore.git
synced 2026-07-02 16:49:05 +00:00
Switch over to Universal-Core. (#18)
* Don't build here. * WIP: Switch to Universal-Core. * Update Submodule repo & azure-pipelines.
This commit is contained in:
+3
-116
@@ -24,122 +24,9 @@
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#include "gui.hpp"
|
||||
#include "logging.hpp"
|
||||
#include "init.hpp"
|
||||
|
||||
#include "lang/lang.hpp"
|
||||
|
||||
#include "screens/mainMenu.hpp"
|
||||
#include "screens/screenCommon.hpp"
|
||||
|
||||
#include "utils/config.hpp"
|
||||
#include "utils/sound.h"
|
||||
#include "utils/structs.hpp"
|
||||
|
||||
#include <3ds.h>
|
||||
#include <dirent.h>
|
||||
#include <unistd.h>
|
||||
|
||||
bool exiting = false;
|
||||
bool dspFound = false;
|
||||
touchPosition touch;
|
||||
sound *bgm = NULL;
|
||||
bool songIsFound = false;
|
||||
|
||||
// If button Position pressed -> Do something.
|
||||
bool touching(touchPosition touch, Structs::ButtonPos button) {
|
||||
if (touch.px >= button.x && touch.px <= (button.x + button.w) && touch.py >= button.y && touch.py <= (button.y + button.h))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void loadSoundEffects(void) {
|
||||
if (dspFound == true) {
|
||||
if( access( Config::MusicPath.c_str(), F_OK ) != -1 ) {
|
||||
bgm = new sound(Config::MusicPath, 1, true);
|
||||
songIsFound = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void playMusic(void) {
|
||||
if (songIsFound == true) {
|
||||
bgm->play();
|
||||
}
|
||||
}
|
||||
|
||||
void stopMusic(void) {
|
||||
if (songIsFound == true) {
|
||||
bgm->stop();
|
||||
}
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
gfxInitDefault();
|
||||
romfsInit();
|
||||
Gui::init();
|
||||
sdmcInit();
|
||||
cfguInit();
|
||||
acInit();
|
||||
// Create Folder if missing.
|
||||
mkdir("sdmc:/3ds", 0777);
|
||||
mkdir("sdmc:/3ds/Universal-Updater", 0777);
|
||||
mkdir("sdmc:/3ds/Universal-Updater/scripts", 0777);
|
||||
mkdir("sdmc:/3ds/Universal-Updater/stores", 0777);
|
||||
|
||||
// We need to make sure, the file exist.
|
||||
if(access("sdmc:/3ds/Universal-Updater/Settings.json", F_OK) == -1 ) {
|
||||
Config::initializeNewConfig();
|
||||
}
|
||||
Config::load();
|
||||
Lang::load(Config::lang);
|
||||
|
||||
if (Config::Logging == true) {
|
||||
Logging::createLogFile();
|
||||
}
|
||||
|
||||
Screen::set(std::make_unique<MainMenu>());
|
||||
osSetSpeedupEnable(true); // Enable speed-up for New 3DS users
|
||||
|
||||
if( access( "sdmc:/3ds/dspfirm.cdc", F_OK ) != -1 ) {
|
||||
ndspInit();
|
||||
dspFound = true;
|
||||
loadSoundEffects();
|
||||
playMusic();
|
||||
}
|
||||
|
||||
// Loop as long as the status is not exit
|
||||
while (aptMainLoop() && !exiting)
|
||||
{
|
||||
hidScanInput();
|
||||
u32 hHeld = hidKeysHeld();
|
||||
u32 hDown = hidKeysDown();
|
||||
hidTouchRead(&touch);
|
||||
C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
|
||||
C2D_TargetClear(top, BLACK);
|
||||
C2D_TargetClear(bottom, BLACK);
|
||||
Gui::clearTextBufs();
|
||||
Screen::loop(hDown, hHeld, touch);
|
||||
C3D_FrameEnd(0);
|
||||
gspWaitForVBlank();
|
||||
}
|
||||
|
||||
if (songIsFound == true) {
|
||||
stopMusic();
|
||||
}
|
||||
delete bgm;
|
||||
if (dspFound == true) {
|
||||
ndspExit();
|
||||
}
|
||||
Config::save();
|
||||
Gui::exit();
|
||||
gfxExit();
|
||||
cfguExit();
|
||||
acExit();
|
||||
romfsExit();
|
||||
sdmcExit();
|
||||
int main() {
|
||||
Init::MainLoop(); // Init::MainLoop() has the whole logic already. ;P
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user