diff --git a/.gitignore b/.gitignore index 35ce465..214c218 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ build +themes +package data/load.bin *.elf *.nds diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..31c5044 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,52 @@ +{ + "files.associations": { + "array": "cpp", + "atomic": "cpp", + "bit": "cpp", + "*.tcc": "cpp", + "cctype": "cpp", + "clocale": "cpp", + "cmath": "cpp", + "compare": "cpp", + "concepts": "cpp", + "cstdarg": "cpp", + "cstddef": "cpp", + "cstdint": "cpp", + "cstdio": "cpp", + "cstdlib": "cpp", + "cstring": "cpp", + "cwchar": "cpp", + "cwctype": "cpp", + "deque": "cpp", + "list": "cpp", + "map": "cpp", + "set": "cpp", + "string": "cpp", + "unordered_map": "cpp", + "vector": "cpp", + "exception": "cpp", + "algorithm": "cpp", + "functional": "cpp", + "iterator": "cpp", + "memory": "cpp", + "memory_resource": "cpp", + "numeric": "cpp", + "optional": "cpp", + "random": "cpp", + "string_view": "cpp", + "system_error": "cpp", + "tuple": "cpp", + "type_traits": "cpp", + "utility": "cpp", + "initializer_list": "cpp", + "iosfwd": "cpp", + "limits": "cpp", + "new": "cpp", + "numbers": "cpp", + "ostream": "cpp", + "stdexcept": "cpp", + "streambuf": "cpp", + "cinttypes": "cpp", + "typeinfo": "cpp" + } +} \ No newline at end of file diff --git a/Makefile b/Makefile index c5e72bd..0d2049e 100644 --- a/Makefile +++ b/Makefile @@ -9,26 +9,27 @@ export TARGET := $(shell basename $(CURDIR)) export TOPDIR := $(CURDIR) # GMAE_ICON is the image used to create the game icon, leave blank to use default rule -GAME_ICON := +GAME_ICON := icon.bmp # specify a directory which contains the nitro filesystem # this is relative to the Makefile NITRO_FILES := # These set the information text in the nds file -GAME_TITLE := acekard -GAME_SUBTITLE1 := Real Play Gear -GAME_SUBTITLE2 := www.acekard.com +GAME_TITLE := akmenu-next +GAME_SUBTITLE1 := nds-bootstrap +GAME_SUBTITLE2 := github.com/coderkei include $(DEVKITARM)/ds_rules -.PHONY: checkarm7 checkarm9 checkarm9_ak2 checkarm9_dsi checkarm9_m3 checkarm9_tt clean +#.PHONY: checkarm7 checkarm9 checkarm9_ak2 checkarm9_dsi checkarm9_m3 checkarm9_tt clean +.PHONY: checkarm7 checkarm9 checkarm9_dsi clean #--------------------------------------------------------------------------------- # main targets #--------------------------------------------------------------------------------- -all: checkarm7 checkarm9 checkarm9_ak2 checkarm9_dsi checkarm9_m3 checkarm9_tt \ - $(TARGET).nds $(TARGET)_ak2.nds $(TARGET)_m3.nds $(TARGET)_tt.nds $(TARGET).dsi +all: checkarm7 checkarm9 checkarm9_dsi \ + $(TARGET).nds $(TARGET).dsi #--------------------------------------------------------------------------------- checkarm7: @@ -38,49 +39,16 @@ checkarm7: checkarm9: $(MAKE) -C arm9 -#--------------------------------------------------------------------------------- -checkarm9_ak2: - $(MAKE) -C arm9_ak2 - #--------------------------------------------------------------------------------- checkarm9_dsi: $(MAKE) -C arm9_dsi -#--------------------------------------------------------------------------------- -checkarm9_m3: - $(MAKE) -C arm9_m3 - -#--------------------------------------------------------------------------------- -checkarm9_tt: - $(MAKE) -C arm9_tt - #--------------------------------------------------------------------------------- $(TARGET).nds : $(NITRO_FILES) arm7/$(TARGET).elf arm9/$(TARGET).elf ndstool -c $(TARGET).nds -7 arm7/$(TARGET).elf -9 arm9/$(TARGET).elf \ -b $(GAME_ICON) "$(GAME_TITLE);$(GAME_SUBTITLE1);$(GAME_SUBTITLE2)" \ $(_ADDFILES) -#--------------------------------------------------------------------------------- -$(TARGET)_ak2.nds : $(NITRO_FILES) arm7/$(TARGET).elf arm9_ak2/$(TARGET).elf - ndstool -c $@ -7 arm7/$(TARGET).elf -9 arm9_ak2/$(TARGET).elf \ - -b $(GAME_ICON) "$(GAME_TITLE);$(GAME_SUBTITLE1);$(GAME_SUBTITLE2)" \ - $(_ADDFILES) - dlditool DLDI/ak2_sd.dldi $@ - -#--------------------------------------------------------------------------------- -$(TARGET)_m3.nds : $(NITRO_FILES) arm7/$(TARGET).elf arm9_m3/$(TARGET).elf - ndstool -c $@ -7 arm7/$(TARGET).elf -9 arm9_m3/$(TARGET).elf \ - -b $(GAME_ICON) "$(GAME_TITLE);$(GAME_SUBTITLE1);$(GAME_SUBTITLE2)" \ - $(_ADDFILES) - dlditool DLDI/m3ds.dldi $@ - -#--------------------------------------------------------------------------------- -$(TARGET)_tt.nds : $(NITRO_FILES) arm7/$(TARGET).elf arm9_tt/$(TARGET).elf - ndstool -c $@ -7 arm7/$(TARGET).elf -9 arm9_tt/$(TARGET).elf \ - -b $(GAME_ICON) "$(GAME_TITLE);$(GAME_SUBTITLE1);$(GAME_SUBTITLE2)" \ - $(_ADDFILES) - dlditool DLDI/ttio.dldi $@ - #--------------------------------------------------------------------------------- $(TARGET).dsi : $(NITRO_FILES) arm7/$(TARGET).elf arm9_dsi/$(TARGET).elf ndstool -c $@ -7 arm7/$(TARGET).elf -9 arm9_dsi/$(TARGET).elf \ @@ -95,28 +63,13 @@ arm7/$(TARGET).elf: arm9/$(TARGET).elf: $(MAKE) -C arm9 -#--------------------------------------------------------------------------------- -arm9_ak2/$(TARGET).elf: - $(MAKE) -C arm9_ak2 - #--------------------------------------------------------------------------------- arm9_dsi/$(TARGET).elf: $(MAKE) -C arm9_dsi -#--------------------------------------------------------------------------------- -arm9_m3/$(TARGET).elf: - $(MAKE) -C arm9_m3 - -#--------------------------------------------------------------------------------- -arm9_tt/$(TARGET).elf: - $(MAKE) -C arm9_tt - #--------------------------------------------------------------------------------- clean: $(MAKE) -C arm9 clean - $(MAKE) -C arm9_ak2 clean $(MAKE) -C arm9_dsi clean - $(MAKE) -C arm9_m3 clean - $(MAKE) -C arm9_tt clean $(MAKE) -C arm7 clean rm -f *.nds *.dsi diff --git a/README.md b/README.md new file mode 100644 index 0000000..8a5d7b7 --- /dev/null +++ b/README.md @@ -0,0 +1,18 @@ +# akmenu-next + +Frontend for nds-bootstrap based upon lifehansolhacker's akmenu4 port [https://github.com/lifehackerhansol/akmenu4](https://github.com/lifehackerhansol/akmenu4). + +## Getting Started + +Requires devkitarm to be installed. Build the repository with `build.sh`. + + +### Configuration + +The system directory is `_nds` where the akmenu system files should be placed, along with a copy of nds-bootstrap as `nds-bootstrap-release.nds`. +For cheats, put a copy of `usrcheat.dat` into the `_nds/cheats` folder. Themes go into `_nds/ui`. + +## License + +This project is comprimised of various sources and is collectively licensed under the GPL-3.0-or-later license. +Please check [the license section](https://github.com/coderkei/akmenu-next/tree/main/licenses) for more information as well as a copy of all applicable licenses. diff --git a/arm9/source/helpwnd.cpp b/arm9/source/helpwnd.cpp index 1a37a53..738a758 100644 --- a/arm9/source/helpwnd.cpp +++ b/arm9/source/helpwnd.cpp @@ -47,7 +47,7 @@ cHelpWnd::cHelpWnd(s32 x, s32 y, u32 w, u32 h, cWindow* parent, const std::strin // u8 nandDriverVer = getNandDriverVer(); _helpText += '\n'; - _helpText += formatString("LHS akmenu %s.%s ", AKMENU_VERSION_MAIN, AKMENU_VERSION_SUB); + _helpText += formatString("coderkei akmenu-next %s.%s ", AKMENU_VERSION_MAIN, AKMENU_VERSION_SUB); _helpText += formatString("\n%s %s ", AKMENU_LOADER_NAME, AKMENU_LOADER_VERSION); } diff --git a/arm9/source/launcher/NdsBootstrapLauncher.cpp b/arm9/source/launcher/NdsBootstrapLauncher.cpp index ebb0248..2d20d9e 100644 --- a/arm9/source/launcher/NdsBootstrapLauncher.cpp +++ b/arm9/source/launcher/NdsBootstrapLauncher.cpp @@ -19,6 +19,9 @@ #include "../inifile.h" #include "../mainlist.h" #include "../systemfilenames.h" +#include "../language.h" +#include "../ui/msgbox.h" +#include "../ui/progresswnd.h" #include "ILauncher.h" #include "NdsBootstrapLauncher.h" #include "nds_loader_arm9.h" @@ -74,8 +77,12 @@ bool NdsBootstrapLauncher::prepareIni() { bool NdsBootstrapLauncher::launchRom(std::string romPath, std::string savePath, u32 flags, u32 cheatOffset, u32 cheatSize) { const char ndsBootstrapPath[] = SD_ROOT_0 "/_nds/nds-bootstrap-release.nds"; + progressWnd().setTipText("Initializing nds-bootstrap..."); + progressWnd().show(); + progressWnd().setPercent(0); if (access(ndsBootstrapPath, F_OK) != 0) { + progressWnd().hide(); printLoaderNotFound(ndsBootstrapPath); return false; } @@ -90,20 +97,29 @@ bool NdsBootstrapLauncher::launchRom(std::string romPath, std::string savePath, if (access("/_nds/nds-bootstrap/", F_OK) != 0) { mkdir("/_nds/nds-bootstrap/", 0777); } + progressWnd().setPercent(25); // Setup argv to launch nds-bootstrap argv.push_back(ndsBootstrapPath); + progressWnd().setTipText("Loading usrcheat.dat..."); + progressWnd().setPercent(50); // Prepare cheat codes if enabled if (flags & PATCH_CHEATS) { - if (!prepareCheats()) return false; + if (!prepareCheats()) { + return false; + } } + progressWnd().setTipText("Initializing nds-bootstrap..."); + progressWnd().setPercent(75); // Setup nds-bootstrap INI parameters if (!prepareIni()) return false; + progressWnd().setPercent(100); // Launch eRunNdsRetCode rc = runNdsFile(argv[0], argv.size(), &argv[0]); + progressWnd().hide(); if (rc == RUN_NDS_OK) return true; return false; diff --git a/arm9/source/mainwnd.cpp b/arm9/source/mainwnd.cpp index 884d889..2a60bcb 100644 --- a/arm9/source/mainwnd.cpp +++ b/arm9/source/mainwnd.cpp @@ -380,6 +380,7 @@ void cMainWnd::onKeyAPressed() { void cMainWnd::launchSelected() { std::string fullPath = _mainList->getSelectedFullPath(); + std::string romName = _mainList->getSelectedShowName(); if (fullPath[fullPath.size() - 1] == '/') { _mainList->enterDir(fullPath); @@ -402,9 +403,12 @@ void cMainWnd::launchSelected() { dbg_printf("%d\n", fullPath[fullPath.size() - 1]); std::string title, text; - bool show = true; + bool show = true;; + progressWnd().setTipText("Loading " + romName + "..."); + progressWnd().show(); + progressWnd().setPercent(0); switch (launchRom(fullPath, rominfo, - rominfo.isHomebrew() && "akmenu4.nds" == _mainList->getSelectedShowName())) { + rominfo.isHomebrew() && "BOOT.NDS" == _mainList->getSelectedShowName())) { case ELaunchNoFreeSpace: title = LANG("no free space", "title"); text = LANG("no free space", "text"); @@ -413,7 +417,9 @@ void cMainWnd::launchSelected() { show = false; break; } + progressWnd().setPercent(100); if (show) messageBox(this, title, text, MB_OK); + progressWnd().hide(); } void cMainWnd::onKeyBPressed() { diff --git a/arm9/source/systemfilenames.h b/arm9/source/systemfilenames.h index 1d63254..e27505e 100644 --- a/arm9/source/systemfilenames.h +++ b/arm9/source/systemfilenames.h @@ -10,9 +10,9 @@ #pragma once #ifndef __DSIMODE__ -#define SFN_SYSTEM_DIR "fat:/__rpg/" +#define SFN_SYSTEM_DIR "fat:/_nds/" #else -#define SFN_SYSTEM_DIR "sd:/__rpg/" +#define SFN_SYSTEM_DIR "sd:/_nds/" #endif #define SFN_OFFICIAL_SAVELIST SFN_SYSTEM_DIR "savelist.bin" #define SFN_CUSTOM_SAVELIST SFN_SYSTEM_DIR "gamedata.bin" diff --git a/arm9/source/ui/form.cpp b/arm9/source/ui/form.cpp index 3d17fad..6612cce 100644 --- a/arm9/source/ui/form.cpp +++ b/arm9/source/ui/form.cpp @@ -180,6 +180,19 @@ u32 cForm::doModal() { return modalRet(); } +u32 cForm::doStatic() { + windowManager().addWindow(this); + show(); + + timer().updateFps(); + INPUT& inputs = updateInput(); + processInput(inputs); + windowManager().update(); + gdi().present(GE_MAIN); + + return modalRet(); +} + void cForm::onOK() { _modalRet = 1; } diff --git a/arm9/source/ui/form.h b/arm9/source/ui/form.h index 0f7d8d4..b102e09 100644 --- a/arm9/source/ui/form.h +++ b/arm9/source/ui/form.h @@ -25,6 +25,8 @@ class cForm : public cWindow { public: u32 doModal(); + u32 doStatic(); + cForm& addChildWindow(cWindow* aWindow); cForm& removeChildWindow(cWindow* aWindow); diff --git a/arm9/source/ui/msgbox.cpp b/arm9/source/ui/msgbox.cpp index 6115634..7be4ae5 100644 --- a/arm9/source/ui/msgbox.cpp +++ b/arm9/source/ui/msgbox.cpp @@ -131,6 +131,13 @@ cMessageBox::cMessageBox(s32 x, s32 y, u32 w, u32 h, cWindow* parent, const std: _buttonOK->show(); } + if (_style & MB_NONE) { + buttonPitch = _buttonCANCEL->size().x + 8; + nextButtonX -= buttonPitch; + _buttonOK->setRelativePosition(cPoint(nextButtonX, buttonY)); + //_buttonOK->show(); + } + arrangeChildren(); loadAppearance(""); @@ -215,4 +222,12 @@ u32 messageBox(cWindow* parent, const std::string& title, const std::string& msg return msgbox.doModal(); } +u32 messageBoxStatic(cWindow* parent, const std::string& title, const std::string& msg, u32 style) { + // check point 如果出现奇怪的对话框消失问题就检查这里 + cMessageBox msgbox(12, 36, 232, 120, parent, title, msg, style); + // cMessageBox msgbox( 0, 0, 256, 192, parent, text, style ); + + return msgbox.doStatic(); +} + } // namespace akui diff --git a/arm9/source/ui/msgbox.h b/arm9/source/ui/msgbox.h index a01d1cd..0e77e7b 100644 --- a/arm9/source/ui/msgbox.h +++ b/arm9/source/ui/msgbox.h @@ -22,6 +22,7 @@ namespace akui { #define MB_YES 4 #define MB_NO 8 #define MB_YES_NO 12 +#define MB_NONE 16 #define ID_OK 1 #define ID_CANCEL 0 @@ -77,4 +78,8 @@ class cMessageBox : public cForm { u32 messageBox(cWindow* parent, const std::string& title, const std::string& msg, u32 style); + // namespace akui + +u32 messageBoxStatic(cWindow* parent, const std::string& title, const std::string& msg, u32 style); + } // namespace akui diff --git a/icon.bmp b/icon.bmp index f2aff21..c5a571c 100644 Binary files a/icon.bmp and b/icon.bmp differ