mirror of
https://github.com/coderkei/akmenu-next.git
synced 2025-06-18 08:55:46 -04:00
Start DSiWare Support
- Added DSiWare detection - Start INI Work for DSiWare. PUB and PRV save creation not added yet. - Only modify VRAM if running on a flashcart (resolved Giana Sisters DS regression) - Remove Card DMA configuration to align with nds-bootstrap removing it as a configurable value - Show a message to the user if using akmenu-next for the first time
This commit is contained in:
parent
935497e4a0
commit
3d3ca0abf7
4
.vscode/settings.json
vendored
4
.vscode/settings.json
vendored
@ -53,6 +53,8 @@
|
|||||||
"format": "cpp",
|
"format": "cpp",
|
||||||
"span": "cpp",
|
"span": "cpp",
|
||||||
"text_encoding": "cpp",
|
"text_encoding": "cpp",
|
||||||
"variant": "cpp"
|
"variant": "cpp",
|
||||||
|
"nds.h": "c",
|
||||||
|
"maxmod9.h": "c"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -47,6 +47,10 @@ bool DSRomInfo::loadDSRomInfo(const std::string& filename, bool loadBanner) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (header.unitCode == 0x03) {
|
||||||
|
_isDSiWare = ETrue;
|
||||||
|
}
|
||||||
|
|
||||||
///////// ROM Header /////////
|
///////// ROM Header /////////
|
||||||
u16 crc = swiCRC16(0xFFFF, &header, 0x15E);
|
u16 crc = swiCRC16(0xFFFF, &header, 0x15E);
|
||||||
if (crc != header.headerCRC16) // 锟侥硷拷头 CRC 锟斤拷锟襟,诧拷锟斤拷nds锟斤拷戏
|
if (crc != header.headerCRC16) // 锟侥硷拷头 CRC 锟斤拷锟襟,诧拷锟斤拷nds锟斤拷戏
|
||||||
@ -204,6 +208,7 @@ bool DSRomInfo::loadGbaRomInfo(const std::string& filename) {
|
|||||||
void DSRomInfo::load(void) {
|
void DSRomInfo::load(void) {
|
||||||
if (_isDSRom == EMayBe) loadDSRomInfo(_fileName, true);
|
if (_isDSRom == EMayBe) loadDSRomInfo(_fileName, true);
|
||||||
if (_isGbaRom == EMayBe) loadGbaRomInfo(_fileName);
|
if (_isGbaRom == EMayBe) loadGbaRomInfo(_fileName);
|
||||||
|
if (_isDSiWare == EMayBe) loadDSRomInfo(_fileName, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
tNDSBanner& DSRomInfo::banner(void) {
|
tNDSBanner& DSRomInfo::banner(void) {
|
||||||
@ -226,6 +231,11 @@ bool DSRomInfo::isDSRom(void) {
|
|||||||
return (_isDSRom == ETrue) ? true : false;
|
return (_isDSRom == ETrue) ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool DSRomInfo::isDSiWare(void) {
|
||||||
|
load();
|
||||||
|
return (_isDSiWare == ETrue) ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
bool DSRomInfo::isHomebrew(void) {
|
bool DSRomInfo::isHomebrew(void) {
|
||||||
load();
|
load();
|
||||||
return (_isHomebrew == ETrue) ? true : false;
|
return (_isHomebrew == ETrue) ? true : false;
|
||||||
|
@ -22,6 +22,7 @@ class DSRomInfo {
|
|||||||
tNDSBanner _banner;
|
tNDSBanner _banner;
|
||||||
SAVE_INFO_EX _saveInfo;
|
SAVE_INFO_EX _saveInfo;
|
||||||
TBool _isDSRom;
|
TBool _isDSRom;
|
||||||
|
TBool _isDSiWare;
|
||||||
TBool _isHomebrew;
|
TBool _isHomebrew;
|
||||||
TBool _isGbaRom;
|
TBool _isGbaRom;
|
||||||
std::string _fileName;
|
std::string _fileName;
|
||||||
@ -35,7 +36,7 @@ class DSRomInfo {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
DSRomInfo()
|
DSRomInfo()
|
||||||
: _isDSRom(EFalse), _isHomebrew(EFalse), _isGbaRom(EFalse), _extIcon(-1), _romVersion(0) {
|
: _isDSRom(EFalse), _isDSiWare(EFalse), _isHomebrew(EFalse), _isGbaRom(EFalse), _extIcon(-1), _romVersion(0) {
|
||||||
// memcpy(&_banner,unknown_banner_bin,unknown_banner_bin_size);
|
// memcpy(&_banner,unknown_banner_bin,unknown_banner_bin_size);
|
||||||
memset(&_banner, 0, sizeof(_banner));
|
memset(&_banner, 0, sizeof(_banner));
|
||||||
memset(&_saveInfo, 0, sizeof(_saveInfo));
|
memset(&_saveInfo, 0, sizeof(_saveInfo));
|
||||||
@ -50,12 +51,14 @@ class DSRomInfo {
|
|||||||
void setExtIcon(const std::string& aValue);
|
void setExtIcon(const std::string& aValue);
|
||||||
inline bool isExtIcon(void) { return _extIcon >= 0; };
|
inline bool isExtIcon(void) { return _extIcon >= 0; };
|
||||||
bool isDSRom(void);
|
bool isDSRom(void);
|
||||||
|
bool isDSiWare(void);
|
||||||
bool isHomebrew(void);
|
bool isHomebrew(void);
|
||||||
bool isGbaRom(void);
|
bool isGbaRom(void);
|
||||||
DSRomInfo& operator=(const DSRomInfo& src);
|
DSRomInfo& operator=(const DSRomInfo& src);
|
||||||
void MayBeDSRom(const std::string& filename) {
|
void MayBeDSRom(const std::string& filename) {
|
||||||
_isDSRom = EMayBe;
|
_isDSRom = EMayBe;
|
||||||
_isHomebrew = EMayBe;
|
_isHomebrew = EMayBe;
|
||||||
|
_isDSiWare = EMayBe;
|
||||||
_fileName = filename;
|
_fileName = filename;
|
||||||
};
|
};
|
||||||
void MayBeGbaRom(const std::string& filename) {
|
void MayBeGbaRom(const std::string& filename) {
|
||||||
|
@ -40,7 +40,6 @@ cGlobalSettings::cGlobalSettings() {
|
|||||||
saveExt = true;
|
saveExt = true;
|
||||||
saveDir = false;
|
saveDir = false;
|
||||||
nightly = false;
|
nightly = false;
|
||||||
cardDma = true;
|
|
||||||
safeMode = false;
|
safeMode = false;
|
||||||
show12hrClock = false;
|
show12hrClock = false;
|
||||||
autorunWithLastRom = false;
|
autorunWithLastRom = false;
|
||||||
@ -72,7 +71,6 @@ void cGlobalSettings::loadSettings() {
|
|||||||
saveDir = ini.GetInt("system", "savedir", saveDir);
|
saveDir = ini.GetInt("system", "savedir", saveDir);
|
||||||
nightly = ini.GetInt("system", "nightly", nightly);
|
nightly = ini.GetInt("system", "nightly", nightly);
|
||||||
dma = ini.GetInt("system", "dma", dma);
|
dma = ini.GetInt("system", "dma", dma);
|
||||||
cardDma = ini.GetInt("system", "carddma", cardDma);
|
|
||||||
sdsave = ini.GetInt("system", "sdsave", sdsave);
|
sdsave = ini.GetInt("system", "sdsave", sdsave);
|
||||||
safeMode = ini.GetInt("system", "safemode", safeMode);
|
safeMode = ini.GetInt("system", "safemode", safeMode);
|
||||||
show12hrClock = ini.GetInt("system", "Show12hrClock", show12hrClock);
|
show12hrClock = ini.GetInt("system", "Show12hrClock", show12hrClock);
|
||||||
@ -121,7 +119,6 @@ void cGlobalSettings::saveSettings() {
|
|||||||
ini.SetInt("system", "cheats", cheats);
|
ini.SetInt("system", "cheats", cheats);
|
||||||
ini.SetInt("system", "softreset", softreset);
|
ini.SetInt("system", "softreset", softreset);
|
||||||
ini.SetInt("system", "dma", dma);
|
ini.SetInt("system", "dma", dma);
|
||||||
ini.SetInt("system", "carddma", cardDma);
|
|
||||||
ini.SetInt("system", "sdsave", sdsave);
|
ini.SetInt("system", "sdsave", sdsave);
|
||||||
ini.SetInt("system", "safemode", safeMode);
|
ini.SetInt("system", "safemode", safeMode);
|
||||||
ini.SetInt("system", "savedir", saveDir);
|
ini.SetInt("system", "savedir", saveDir);
|
||||||
|
@ -53,7 +53,6 @@ class cGlobalSettings {
|
|||||||
bool Animation;
|
bool Animation;
|
||||||
bool cheats;
|
bool cheats;
|
||||||
bool softreset;
|
bool softreset;
|
||||||
bool cardDma;
|
|
||||||
bool sdsave;
|
bool sdsave;
|
||||||
bool cheatDB;
|
bool cheatDB;
|
||||||
int slot2mode;
|
int slot2mode;
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <fat.h>
|
||||||
|
|
||||||
#include <nds/ndstypes.h>
|
#include <nds/ndstypes.h>
|
||||||
|
|
||||||
@ -25,6 +26,7 @@
|
|||||||
#include "ILauncher.h"
|
#include "ILauncher.h"
|
||||||
#include "NdsBootstrapLauncher.h"
|
#include "NdsBootstrapLauncher.h"
|
||||||
#include "nds_loader_arm9.h"
|
#include "nds_loader_arm9.h"
|
||||||
|
#include "fat_ext.h"
|
||||||
|
|
||||||
bool NdsBootstrapLauncher::prepareCheats() {
|
bool NdsBootstrapLauncher::prepareCheats() {
|
||||||
u32 gameCode, crc32;
|
u32 gameCode, crc32;
|
||||||
@ -67,16 +69,34 @@ cheat_failed:
|
|||||||
|
|
||||||
bool NdsBootstrapLauncher::prepareIni() {
|
bool NdsBootstrapLauncher::prepareIni() {
|
||||||
CIniFile ini;
|
CIniFile ini;
|
||||||
|
tDSiHeader header;
|
||||||
|
char sfnSrl[62];
|
||||||
|
char sfnPub[62];
|
||||||
|
char sfnPrv[62];
|
||||||
|
_romInfo.MayBeDSRom(mRomPath);
|
||||||
|
bool dsiWare = _romInfo.isDSiWare();
|
||||||
|
|
||||||
ini.SetString("NDS-BOOTSTRAP", "NDS_PATH", mRomPath);
|
ini.SetString("NDS-BOOTSTRAP", "NDS_PATH", mRomPath);
|
||||||
ini.SetString("NDS-BOOTSTRAP", "SAV_PATH", mSavePath);
|
// check for DSiWare
|
||||||
if(gs().cardDma){
|
if(dsiWare){
|
||||||
ini.SetInt("NDS-BOOTSTRAP", "CARD_READ_DMA", 1);
|
//TODO create pub & prv savwe
|
||||||
|
#ifdef __DSIMODE__
|
||||||
|
fatGetAliasPath("sd:/", mRomPath, sfnSrl);
|
||||||
|
fatGetAliasPath("sd:/", pubPath, sfnPub);
|
||||||
|
fatGetAliasPath("sd:/", prvPath, sfnPrv);
|
||||||
|
ini.SetString("NDS-BOOTSTRAP", "APP_PATH", sfnSrl);
|
||||||
|
ini.SetString("NDS-BOOTSTRAP", "SAV_PATH", sfnPub);
|
||||||
|
ini.SetString("NDS-BOOTSTRAP", "PRV_PATH", sfnPrv);
|
||||||
|
#else
|
||||||
|
//TODO flashcart
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
ini.SetInt("NDS-BOOTSTRAP", "CARD_READ_DMA", 0);
|
ini.SetString("NDS-BOOTSTRAP", "SAV_PATH", mSavePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
ini.SaveIniFile("/_nds/nds-bootstrap.ini");
|
ini.SaveIniFile("/_nds/nds-bootstrap.ini");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,7 +104,14 @@ bool NdsBootstrapLauncher::launchRom(std::string romPath, std::string savePath,
|
|||||||
u32 cheatOffset, u32 cheatSize) {
|
u32 cheatOffset, u32 cheatSize) {
|
||||||
const char ndsBootstrapPath[] = SD_ROOT_0 "/_nds/nds-bootstrap-release.nds";
|
const char ndsBootstrapPath[] = SD_ROOT_0 "/_nds/nds-bootstrap-release.nds";
|
||||||
const char ndsBootstrapPathNightly[] = SD_ROOT_0 "/_nds/nds-bootstrap-nightly.nds";
|
const char ndsBootstrapPathNightly[] = SD_ROOT_0 "/_nds/nds-bootstrap-nightly.nds";
|
||||||
|
const char ndsBootstrapCheck[] = SD_ROOT_0 "/_nds/pagefile.sys";
|
||||||
bool useNightly = false;
|
bool useNightly = false;
|
||||||
|
|
||||||
|
//has the user used nds-bootstrap before?
|
||||||
|
if(access(ndsBootstrapCheck, F_OK) != 0){
|
||||||
|
akui::messageBox(NULL, LANG("nds bootstrap", "firsttimetitle"), LANG("nds bootstrap", "firsttime"), MB_OK);
|
||||||
|
}
|
||||||
|
|
||||||
progressWnd().setTipText("Initializing nds-bootstrap...");
|
progressWnd().setTipText("Initializing nds-bootstrap...");
|
||||||
progressWnd().show();
|
progressWnd().show();
|
||||||
progressWnd().setPercent(0);
|
progressWnd().setPercent(0);
|
||||||
|
@ -22,4 +22,5 @@ class NdsBootstrapLauncher : public ILauncher {
|
|||||||
std::string mRomPath;
|
std::string mRomPath;
|
||||||
std::string mSavePath;
|
std::string mSavePath;
|
||||||
u32 mFlags;
|
u32 mFlags;
|
||||||
|
DSRomInfo _romInfo;
|
||||||
};
|
};
|
||||||
|
@ -281,8 +281,14 @@ eRunNdsRetCode runNds (const void* loader, u32 loaderSize, u32 cluster, bool ini
|
|||||||
|
|
||||||
// Direct CPU access to VRAM bank C
|
// Direct CPU access to VRAM bank C
|
||||||
VRAM_C_CR = VRAM_ENABLE | VRAM_C_LCD;
|
VRAM_C_CR = VRAM_ENABLE | VRAM_C_LCD;
|
||||||
|
|
||||||
//Fix VRAM because for some reason some homebrew screws up without it
|
//Fix VRAM because for some reason some homebrew screws up without it
|
||||||
memset (LCDC_BANK_C, 0x00, 128 * 1024);
|
#ifdef __DSIMODE__
|
||||||
|
//do nothing because this breaks on DSi/3DS mode
|
||||||
|
#else
|
||||||
|
memset (LCDC_BANK_C, 0x00, 128 * 1024);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Load the loader/patcher into the correct address
|
// Load the loader/patcher into the correct address
|
||||||
vramcpy (LCDC_BANK_C, loader, loaderSize);
|
vramcpy (LCDC_BANK_C, loader, loaderSize);
|
||||||
|
|
||||||
|
@ -550,10 +550,6 @@ void cMainWnd::setParam(void) {
|
|||||||
_values.push_back(LANG("switches", "Disable"));
|
_values.push_back(LANG("switches", "Disable"));
|
||||||
_values.push_back(LANG("switches", "Enable"));
|
_values.push_back(LANG("switches", "Enable"));
|
||||||
settingWnd.addSettingItem(LANG("patches", "cheating system"), _values, gs().cheats);
|
settingWnd.addSettingItem(LANG("patches", "cheating system"), _values, gs().cheats);
|
||||||
_values.clear();
|
|
||||||
_values.push_back(LANG("switches", "Disable"));
|
|
||||||
_values.push_back(LANG("switches", "Enable"));
|
|
||||||
settingWnd.addSettingItem(LANG("patches", "carddma"), _values, gs().cardDma);
|
|
||||||
#ifdef __KERNEL_LAUNCHER_SUPPORT__
|
#ifdef __KERNEL_LAUNCHER_SUPPORT__
|
||||||
_values.clear();
|
_values.clear();
|
||||||
_values.push_back("Kernel");
|
_values.push_back("Kernel");
|
||||||
@ -607,9 +603,8 @@ void cMainWnd::setParam(void) {
|
|||||||
|
|
||||||
// page 4: patches
|
// page 4: patches
|
||||||
gs().cheats = settingWnd.getItemSelection(3, 0);
|
gs().cheats = settingWnd.getItemSelection(3, 0);
|
||||||
gs().cardDma = settingWnd.getItemSelection(3, 1);
|
gs().softreset = settingWnd.getItemSelection(3, 1);
|
||||||
gs().softreset = settingWnd.getItemSelection(3, 2);
|
gs().homebrewreset = settingWnd.getItemSelection(3, 2);
|
||||||
gs().homebrewreset = settingWnd.getItemSelection(3, 3);
|
|
||||||
|
|
||||||
// page 5: gba
|
// page 5: gba
|
||||||
gs().gbaSleepHack = settingWnd.getItemSelection(4, 0);
|
gs().gbaSleepHack = settingWnd.getItemSelection(4, 0);
|
||||||
|
@ -140,12 +140,15 @@ TLaunchResult launchRom(const std::string& aFullPath, DSRomInfo& aRomInfo, bool
|
|||||||
std::string saveName;
|
std::string saveName;
|
||||||
std::string useSavesPath;
|
std::string useSavesPath;
|
||||||
ILauncher* launcher = nullptr;
|
ILauncher* launcher = nullptr;
|
||||||
|
bool isDsiWare;
|
||||||
if (!aRomInfo.isHomebrew()) {
|
if (!aRomInfo.isHomebrew()) {
|
||||||
u32 gameCode;
|
u32 gameCode;
|
||||||
memcpy(&gameCode, aRomInfo.saveInfo().gameCode, sizeof(gameCode)); // because alignment
|
memcpy(&gameCode, aRomInfo.saveInfo().gameCode, sizeof(gameCode)); // because alignment
|
||||||
bool isBigSave = false;
|
bool isBigSave = false;
|
||||||
u32 bigSaveSize = 8 * 1024 * 1024;
|
u32 bigSaveSize = 8 * 1024 * 1024;
|
||||||
u32 bigSaveMask = 14;
|
u32 bigSaveMask = 14;
|
||||||
|
// check for DSiWare
|
||||||
|
isDsiWare = aRomInfo.isDSiWare();
|
||||||
// reading speed setting
|
// reading speed setting
|
||||||
std::string disk = aFullPath.substr(0, 5);
|
std::string disk = aFullPath.substr(0, 5);
|
||||||
// bool dma = false, protection = aRomInfo.saveInfo().isProtection();
|
// bool dma = false, protection = aRomInfo.saveInfo().isProtection();
|
||||||
@ -209,13 +212,16 @@ TLaunchResult launchRom(const std::string& aFullPath, DSRomInfo& aRomInfo, bool
|
|||||||
saveManager().updateCustomSaveList(aRomInfo.saveInfo());
|
saveManager().updateCustomSaveList(aRomInfo.saveInfo());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (cSaveManager::initializeSaveFile(useSavesPath, aRomInfo.saveInfo().getSlot(),
|
if(!isDsiWare){
|
||||||
SaveSize(st))) {
|
if (cSaveManager::initializeSaveFile(useSavesPath, aRomInfo.saveInfo().getSlot(),
|
||||||
|
SaveSize(st))) {
|
||||||
flags |= PATCH_SD_SAVE | (SaveMask(st) << PATCH_SAVE_SHIFT);
|
flags |= PATCH_SD_SAVE | (SaveMask(st) << PATCH_SAVE_SHIFT);
|
||||||
saveManager().saveLastInfo(aFullPath);
|
saveManager().saveLastInfo(aFullPath);
|
||||||
} else {
|
} else {
|
||||||
return ELaunchNoFreeSpace;
|
return ELaunchNoFreeSpace;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
__NDSHeader->cardControl13 = 0x00406000 | speed;
|
__NDSHeader->cardControl13 = 0x00406000 | speed;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user