mirror of
https://github.com/rvtr/TwlNandTool.git
synced 2025-10-31 06:01:08 -04:00
Added TWL EVA sound effects
This commit is contained in:
parent
da2ae15e7c
commit
1c88010927
@ -37,7 +37,7 @@ ASFLAGS := -g $(ARCH)
|
||||
LDFLAGS = -specs=ds_arm7.specs -g $(ARCH) -Wl,--nmagic -Wl,-Map,$(notdir $*).map
|
||||
|
||||
#LIBS := -ldswifi7 -lmm7 -lnds7
|
||||
LIBS := -lnds7
|
||||
LIBS := -lmm7 -lnds7
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
|
||||
@ -28,7 +28,7 @@
|
||||
|
||||
---------------------------------------------------------------------------------*/
|
||||
#include "my_sdmmc.h"
|
||||
|
||||
#include <maxmod7.h>
|
||||
#include <nds.h>
|
||||
#include <string.h>
|
||||
|
||||
@ -117,6 +117,12 @@ int main()
|
||||
fifoInit();
|
||||
touchInit();
|
||||
|
||||
mmInstall(FIFO_MAXMOD);
|
||||
SetYtrigger(202);
|
||||
|
||||
installSoundFIFO();
|
||||
installSystemFIFO();
|
||||
|
||||
if (isDSiMode() /*|| ((REG_SCFG_EXT & BIT(17)) && (REG_SCFG_EXT & BIT(18)))*/)
|
||||
{
|
||||
u8 *out=(u8*)0x02300000;
|
||||
@ -164,10 +170,6 @@ int main()
|
||||
|
||||
SetYtrigger(80);
|
||||
|
||||
installSoundFIFO();
|
||||
|
||||
installSystemFIFO();
|
||||
|
||||
irqSet(IRQ_VCOUNT, VcountHandler);
|
||||
|
||||
irqEnable( IRQ_VBLANK | IRQ_VCOUNT | IRQ_NETWORK);
|
||||
|
||||
@ -43,6 +43,7 @@ SOURCES := src src/nand src/nand/polarssl src/nand/twltool src/lib/libfat/sourc
|
||||
INCLUDES := include src/nand src/lib/libfat/include
|
||||
DATA := ../data
|
||||
GRAPHICS := fonts
|
||||
MUSIC := ../sounds
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
@ -63,7 +64,7 @@ LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with the project
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := -lfilesystem -lnds9
|
||||
LIBS := -lmm9 -lfilesystem -lnds9
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
# include and lib
|
||||
@ -89,8 +90,9 @@ CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
|
||||
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
||||
BMPFILES := $(foreach dir,$(GRAPHICS),$(notdir $(wildcard $(dir)/*.bmp)))
|
||||
PNGFILES := $(foreach dir,$(GRAPHICS),$(notdir $(wildcard $(dir)/*.png)))
|
||||
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
|
||||
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) soundbank.bin
|
||||
|
||||
export AUDIOFILES := $(foreach dir,$(notdir $(wildcard $(MUSIC)/*.*)),$(CURDIR)/$(MUSIC)/$(dir))
|
||||
#---------------------------------------------------------------------------------
|
||||
# use CXX for linking C++ projects, CC for standard C
|
||||
#---------------------------------------------------------------------------------
|
||||
@ -140,6 +142,12 @@ else
|
||||
$(ARM9ELF) : $(OFILES)
|
||||
@echo linking $(notdir $@)
|
||||
@$(LD) $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o $@
|
||||
#---------------------------------------------------------------------------------
|
||||
# rule to build soundbank from music files
|
||||
#---------------------------------------------------------------------------------
|
||||
soundbank.bin soundbank.h : $(AUDIOFILES)
|
||||
#---------------------------------------------------------------------------------
|
||||
@mmutil $^ -d -osoundbank.bin -hsoundbank.h
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# you need a rule like this for each extension you use as binary data
|
||||
|
||||
79
arm9/src/audio.c
Normal file
79
arm9/src/audio.c
Normal file
@ -0,0 +1,79 @@
|
||||
#include <nds.h>
|
||||
#include <maxmod9.h>
|
||||
#include <stdio.h>
|
||||
#include "audio.h"
|
||||
#include "soundbank.h"
|
||||
#include "soundbank_bin.h"
|
||||
|
||||
mm_sound_effect STARTUP = {
|
||||
{ SFX_STARTUP } , // id
|
||||
(int)(1.0f * (1<<10)), // rate
|
||||
0, // handle
|
||||
255, // volume
|
||||
127, // panning
|
||||
};
|
||||
mm_sound_effect SELECT = {
|
||||
{ SFX_SELECT } , // id
|
||||
(int)(1.0f * (1<<10)), // rate
|
||||
0, // handle
|
||||
255, // volume
|
||||
127, // panning
|
||||
};
|
||||
mm_sound_effect BACK = {
|
||||
{ SFX_BACK } , // id
|
||||
(int)(1.0f * (1<<10)), // rate
|
||||
0, // handle
|
||||
255, // volume
|
||||
127, // panning
|
||||
};
|
||||
mm_sound_effect OK = {
|
||||
{ SFX_OK } , // id
|
||||
(int)(1.0f * (1<<10)), // rate
|
||||
0, // handle
|
||||
255, // volume
|
||||
127, // panning
|
||||
};
|
||||
mm_sound_effect NG = {
|
||||
{ SFX_NG } , // id
|
||||
(int)(1.0f * (1<<10)), // rate
|
||||
0, // handle
|
||||
255, // volume
|
||||
127, // panning
|
||||
};
|
||||
mm_sound_effect CHIME = {
|
||||
{ SFX_CHIME } , // id
|
||||
(int)(1.0f * (1<<10)), // rate
|
||||
0, // handle
|
||||
255, // volume
|
||||
127, // panning
|
||||
};
|
||||
|
||||
void soundInit() {
|
||||
|
||||
mmInitDefaultMem((mm_addr)soundbank_bin);
|
||||
mmLoadEffect( SFX_STARTUP );
|
||||
mmLoadEffect( SFX_SELECT );
|
||||
mmLoadEffect( SFX_BACK );
|
||||
mmLoadEffect( SFX_OK );
|
||||
mmLoadEffect( SFX_NG );
|
||||
|
||||
}
|
||||
|
||||
void soundPlayStartup() {
|
||||
mmEffectEx(&STARTUP);
|
||||
}
|
||||
void soundPlaySelect() {
|
||||
mmEffectEx(&SELECT);
|
||||
}
|
||||
void soundPlayBack() {
|
||||
mmEffectEx(&BACK);
|
||||
}
|
||||
void soundPlayPass() {
|
||||
mmEffectEx(&OK);
|
||||
}
|
||||
void soundPlayFail() {
|
||||
mmEffectEx(&NG);
|
||||
}
|
||||
void soundPlayChime() {
|
||||
mmEffectEx(&CHIME);
|
||||
}
|
||||
13
arm9/src/audio.h
Normal file
13
arm9/src/audio.h
Normal file
@ -0,0 +1,13 @@
|
||||
#include <nds.h>
|
||||
#include <maxmod9.h>
|
||||
#include <stdio.h>
|
||||
#include "soundbank.h"
|
||||
#include "soundbank_bin.h"
|
||||
|
||||
void soundInit();
|
||||
void soundPlayStartup();
|
||||
void soundPlaySelect();
|
||||
void soundPlayBack();
|
||||
void soundPlayPass();
|
||||
void soundPlayFail();
|
||||
void soundPlayChime();
|
||||
@ -12,6 +12,7 @@
|
||||
#include "nand/sysfile.h"
|
||||
#include "nand/hwinfo.h"
|
||||
#include "video.h"
|
||||
#include "audio.h"
|
||||
#include "nitrofs.h"
|
||||
#include "font.h"
|
||||
#include <stdlib.h>
|
||||
@ -21,14 +22,12 @@
|
||||
|
||||
TODO:
|
||||
- LESS NAND WRITES!!!!!
|
||||
- Write good NAND read routine
|
||||
- Detect debugger vs dev (less important currently)
|
||||
- Recover HWInfo byte by byte
|
||||
- HWInfo verify
|
||||
- HWInfo sign (can wait for a very long time)
|
||||
- Why doesn't unmounting NAND get reflected in the file test?
|
||||
- NandFirm hash checking <-- very very very important!
|
||||
- Wipe TWLCFG, launcher saves, etc
|
||||
- Make dummy TWLCFG, launcher saves, etc
|
||||
- product.log reading and writing
|
||||
- TAD stuff
|
||||
- Title verification (exception for HNAG)
|
||||
@ -165,6 +164,7 @@ int main(int argc, char **argv)
|
||||
*/
|
||||
|
||||
videoInit();
|
||||
soundInit();
|
||||
|
||||
srand(time(0));
|
||||
keysSetRepeat(25, 5);
|
||||
@ -205,12 +205,16 @@ int main(int argc, char **argv)
|
||||
|
||||
if (keysDown() & KEY_START || keysDown() & KEY_SELECT) {
|
||||
} else {
|
||||
recoverHWInfoDeep();
|
||||
//recoverHWInfoDeep();
|
||||
//debug3();
|
||||
}
|
||||
|
||||
clearScreen(cSUB);
|
||||
clearScreen(cMAIN);
|
||||
|
||||
soundPlayStartup();
|
||||
wait(10);
|
||||
|
||||
int cursor = 0;
|
||||
|
||||
while (!programEnd)
|
||||
@ -221,47 +225,55 @@ int main(int argc, char **argv)
|
||||
{
|
||||
|
||||
case STARTMENU_FS_MENU:
|
||||
soundPlaySelect();
|
||||
fsMain();
|
||||
break;
|
||||
|
||||
case STARTMENU_NF_MENU:
|
||||
soundPlaySelect();
|
||||
nfMain();
|
||||
break;
|
||||
|
||||
case STARTMENU_SYSFILE_MENU:
|
||||
soundPlaySelect();
|
||||
sysfileMain();
|
||||
break;
|
||||
|
||||
case STARTMENU_CHIP_MENU:
|
||||
soundPlaySelect();
|
||||
chipMain();
|
||||
break;
|
||||
|
||||
case STARTMENU_NULL:
|
||||
soundPlaySelect();
|
||||
break;
|
||||
|
||||
case STARTMENU_TEST:
|
||||
soundPlaySelect();
|
||||
debug1();
|
||||
break;
|
||||
|
||||
case STARTMENU_TEST2:
|
||||
soundPlaySelect();
|
||||
debug2();
|
||||
break;
|
||||
|
||||
case STARTMENU_TEST3:
|
||||
soundPlaySelect();
|
||||
debug3();
|
||||
break;
|
||||
|
||||
case STARTMENU_EXIT:
|
||||
soundPlaySelect();
|
||||
programEnd = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
clearScreen(cSUB);
|
||||
printf("Unmounting NAND...\n");
|
||||
if(nandMounted) {
|
||||
fatUnmount("nand");
|
||||
}
|
||||
agingMode = true;
|
||||
unmountNAND(false);
|
||||
unmountNAND(true);
|
||||
// I think this was some safety thing but it wants to re-write the entire NAND...
|
||||
// I'm the one person always saying "NANDs aren't that weak", so you know it's excessive when I comment it out.
|
||||
|
||||
@ -316,82 +328,58 @@ int debug2(void) {
|
||||
}
|
||||
|
||||
int debug3(void) {
|
||||
success = true;
|
||||
bool agingSuccess = false;
|
||||
agingMode = true;
|
||||
clearScreen(cSUB);
|
||||
|
||||
iprintf("\n>> NAND AGING tester ");
|
||||
iprintf("\n--------------------------------");
|
||||
|
||||
if (success == true && !cpuPrintInfo()) {
|
||||
success = false;
|
||||
}
|
||||
if (success == true && !nandPrintInfo()) {
|
||||
success = false;
|
||||
}
|
||||
if (success == true && !importNandFirm(true)) {
|
||||
success = false;
|
||||
}
|
||||
if (success == true && !readNandFirm()) {
|
||||
success = false;
|
||||
}
|
||||
if (success == true && !repairMbr(true)) {
|
||||
success = false;
|
||||
}
|
||||
if (success == true && !readMbr()) {
|
||||
success = false;
|
||||
}
|
||||
if (success == true && !mountNAND(false)) {
|
||||
if (!formatMain() && !mountNAND(false)) {
|
||||
success = false;
|
||||
if (cpuPrintInfo()) {
|
||||
if (nandPrintInfo()) {
|
||||
if (importNandFirm(1)) {
|
||||
if (readNandFirm()) {
|
||||
if (repairMbr(true)) {
|
||||
if (readMbr()) {
|
||||
if (mountNAND(false) || (formatMain() && mountNAND(false))) {
|
||||
if (mountNAND(true) || (formatPhoto() && mountNAND(true))) {
|
||||
if (recoverHWInfo(false) || recoverHWInfoDeep()) {
|
||||
if (filetestNAND(false)) {
|
||||
if (filetestNAND(true)) {
|
||||
if (makeSystemFolders()) {
|
||||
if (makeCertChain()) {
|
||||
if (makeFontTable()) {
|
||||
if (unmountNAND(false)) {
|
||||
if (unmountNAND(true)) {
|
||||
if (filetestNitro()) {
|
||||
agingSuccess = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (success == true && !mountNAND(true)) {
|
||||
if (!formatPhoto() && !mountNAND(true)) {
|
||||
success = false;
|
||||
}
|
||||
}
|
||||
if (success == true && !recoverHWInfo(false)) {
|
||||
if (success == true && !recoverHWInfoDeep()) {
|
||||
success = false;
|
||||
}
|
||||
}
|
||||
if (success == true && !filetestNAND(false)) {
|
||||
success = false;
|
||||
}
|
||||
if (success == true && !filetestNAND(true)) {
|
||||
success = false;
|
||||
}
|
||||
if (success == true && !makeSystemFolders()) {
|
||||
success = false;
|
||||
}
|
||||
if (success == true && !makeCertChain()) {
|
||||
success = false;
|
||||
}
|
||||
if (success == true && !makeFontTable()) {
|
||||
success = false;
|
||||
}
|
||||
if (success == true && !unmountNAND(false)) {
|
||||
success = false;
|
||||
}
|
||||
if (success == true && !unmountNAND(true)) {
|
||||
success = false;
|
||||
}
|
||||
if (success == true && !filetestNitro()) {
|
||||
success = false;
|
||||
}
|
||||
|
||||
agingMode = false;
|
||||
clearScreen(cSUB);
|
||||
iprintf("\n>> NAND AGING tester result ");
|
||||
iprintf("\n--------------------------------");
|
||||
|
||||
success = agingSuccess;
|
||||
if (success == true) {
|
||||
iprintf("\nAll tests passed okay.");
|
||||
setBackdropColorSub(0x1FE0);
|
||||
} else {
|
||||
iprintf("\nTests failed!");
|
||||
setBackdropColorSub(0x00FF);
|
||||
}
|
||||
|
||||
exitFunction();
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
#include "menu.h"
|
||||
#include "main.h"
|
||||
#include "video.h"
|
||||
#include "audio.h"
|
||||
#include "version.h"
|
||||
#include "nand/nandio.h"
|
||||
|
||||
@ -343,20 +344,24 @@ bool moveCursor(Menu* m)
|
||||
|
||||
u32 down = keysDownRepeat();
|
||||
|
||||
if (down & KEY_DOWN)
|
||||
if (down & KEY_DOWN) {
|
||||
soundPlaySelect();
|
||||
_moveCursor(m, 1);
|
||||
|
||||
else if (down & KEY_UP)
|
||||
} else if (down & KEY_UP) {
|
||||
soundPlaySelect();
|
||||
_moveCursor(m, -1);
|
||||
}
|
||||
|
||||
if (down & KEY_RIGHT)
|
||||
{
|
||||
soundPlaySelect();
|
||||
repeat(10)
|
||||
_moveCursor(m, 1);
|
||||
}
|
||||
|
||||
else if (down & KEY_LEFT)
|
||||
{
|
||||
soundPlaySelect();
|
||||
repeat(10)
|
||||
_moveCursor(m, -1);
|
||||
}
|
||||
@ -382,15 +387,25 @@ char downloadPlayLoading(int number) {
|
||||
|
||||
void exitFunction() {
|
||||
if (agingMode == false) {
|
||||
wait(25);
|
||||
if (success == true) {
|
||||
setBackdropColorSub(0x1FE0);
|
||||
soundPlayPass();
|
||||
} else {
|
||||
setBackdropColorSub(0x00FF);
|
||||
soundPlayFail();
|
||||
}
|
||||
iprintf("\n\n Please Push Select To Return ");
|
||||
while (true)
|
||||
{
|
||||
swiWaitForVBlank();
|
||||
scanKeys();
|
||||
|
||||
if (keysDown() & KEY_SELECT )
|
||||
if (keysDown() & KEY_SELECT ) {
|
||||
soundPlayBack();
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
wait(50);
|
||||
}
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
#include "../message.h"
|
||||
#include "../main.h"
|
||||
#include "../video.h"
|
||||
#include "../audio.h"
|
||||
|
||||
static size_t i;
|
||||
|
||||
@ -47,9 +48,11 @@ static int _chipMenu(int cursor)
|
||||
if (keysDown() & KEY_A)
|
||||
break;
|
||||
|
||||
if (keysDown() & KEY_B)
|
||||
if (keysDown() & KEY_B) {
|
||||
soundPlayBack();
|
||||
programEnd = true;
|
||||
}
|
||||
}
|
||||
|
||||
int result = m->cursor;
|
||||
freeMenu(m);
|
||||
@ -71,10 +74,12 @@ int chipMain(void)
|
||||
{
|
||||
|
||||
case CHIPMENU_NAND_INFO:
|
||||
soundPlaySelect();
|
||||
nandPrintInfo();
|
||||
break;
|
||||
|
||||
case CHIPMENU_CPU_INFO:
|
||||
soundPlaySelect();
|
||||
cpuPrintInfo();
|
||||
break;
|
||||
}
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
#include "../main.h"
|
||||
#include "../video.h"
|
||||
#include "../menu.h"
|
||||
#include "../audio.h"
|
||||
#include "../lib/libfat/include/fat.h"
|
||||
|
||||
extern bool nand_Startup();
|
||||
@ -111,9 +112,11 @@ static int _fsMenu(int cursor)
|
||||
if (keysDown() & KEY_A)
|
||||
break;
|
||||
|
||||
if (keysDown() & KEY_B)
|
||||
if (keysDown() & KEY_B) {
|
||||
soundPlayBack();
|
||||
programEnd = true;
|
||||
}
|
||||
}
|
||||
|
||||
int result = m->cursor;
|
||||
freeMenu(m);
|
||||
@ -135,56 +138,70 @@ int fsMain(void)
|
||||
{
|
||||
|
||||
case FSMENU_READ_MBR:
|
||||
soundPlaySelect();
|
||||
readMbr();
|
||||
break;
|
||||
|
||||
case FSMENU_REPAIR_MBR:
|
||||
soundPlaySelect();
|
||||
repairMbr(false);
|
||||
break;
|
||||
|
||||
case FSMENU_FORMAT_MAIN:
|
||||
soundPlaySelect();
|
||||
formatMain();
|
||||
break;
|
||||
|
||||
case FSMENU_FORMAT_PHOTO:
|
||||
soundPlaySelect();
|
||||
formatPhoto();
|
||||
break;
|
||||
|
||||
case FSMENU_NULL:
|
||||
soundPlaySelect();
|
||||
break;
|
||||
|
||||
case FSMENU_MOUNT_MAIN:
|
||||
soundPlaySelect();
|
||||
mountNAND(false);
|
||||
break;
|
||||
|
||||
case FSMENU_UNMOUNT_MAIN:
|
||||
soundPlaySelect();
|
||||
unmountNAND(false);
|
||||
break;
|
||||
|
||||
case FSMENU_MOUNT_PHOTO:
|
||||
soundPlaySelect();
|
||||
mountNAND(true);
|
||||
break;
|
||||
|
||||
case FSMENU_UNMOUNT_PHOTO:
|
||||
soundPlaySelect();
|
||||
unmountNAND(true);
|
||||
break;
|
||||
|
||||
case FSMENU_MOUNT_NITRO:
|
||||
soundPlaySelect();
|
||||
mountNitroFS();
|
||||
break;
|
||||
|
||||
case FSMENU_NULL2:
|
||||
soundPlaySelect();
|
||||
break;
|
||||
|
||||
case FSMENU_FILETEST_MAIN:
|
||||
soundPlaySelect();
|
||||
filetestNAND(false);
|
||||
break;
|
||||
|
||||
case FSMENU_FILETEST_PHOTO:
|
||||
soundPlaySelect();
|
||||
filetestNAND(true);
|
||||
break;
|
||||
|
||||
case FSMENU_FILETEST_NITRO:
|
||||
soundPlaySelect();
|
||||
filetestNitro();
|
||||
break;
|
||||
}
|
||||
@ -485,7 +502,7 @@ bool filetestNAND(bool isPhoto) {
|
||||
char partition_path[10];
|
||||
snprintf(partition_path, 10, isPhoto ? "photo" : "nand");
|
||||
|
||||
iprintf("\n>> Read %s file", partition_name);
|
||||
iprintf("\n>> Read %s file\n", partition_name);
|
||||
iprintf("\n--------------------------------");
|
||||
|
||||
if (isPhoto ? nandPhotoMounted : nandMounted) {
|
||||
|
||||
@ -27,16 +27,19 @@ bool clearHWInfoStruct() {
|
||||
}
|
||||
hwsData.HWS_HEADER = 0x01000000;
|
||||
hwsData.HWS_SIZE = 0x1C000000;
|
||||
hwsData.HWS_LANG = 0x01000000;
|
||||
hwsData.HWS_LANG = (LANG_BITMAP_JAPAN << 24);
|
||||
hwsData.HWS_LANG &= 0xFF000000;
|
||||
//hwsData.HWS_LANG = 0x01000000;
|
||||
hwsData.HWS_PAD = 0x00000000;
|
||||
hwsData.HWS_REGION = 0x00;
|
||||
hwsData.HWS_REGION = LANG_JAPANESE;
|
||||
strcpy(hwsData.HWS_SERIAL, "AAAMP1234567"); // You're a real one if you understand this serial.
|
||||
hwsData.HWS_TID = 0x50414E48;
|
||||
hwsData.HWS_TID = 0x4A414E48;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool loadHWInfoStruct() {
|
||||
return true;
|
||||
bool loadHWInfoStruct(u8 *hwinfo_buf) {
|
||||
// 0xA4 is the HWInfo size (trimmed)
|
||||
memcpy(&hwsData, hwinfo_buf, 0xA4);
|
||||
}
|
||||
|
||||
bool recoverHWInfo(bool simple) {
|
||||
@ -67,6 +70,7 @@ bool recoverHWInfo(bool simple) {
|
||||
}
|
||||
|
||||
if (simple == false) {
|
||||
if (!agingMode) {
|
||||
agingMode = true;
|
||||
if (recoverHWInfoOffset(HWS_OFFSET_OTHER)) {
|
||||
hwinfofound = true;
|
||||
@ -76,6 +80,15 @@ bool recoverHWInfo(bool simple) {
|
||||
hwinfofound = true;
|
||||
}
|
||||
agingMode = false;
|
||||
} else {
|
||||
if (recoverHWInfoOffset(HWS_OFFSET_OTHER)) {
|
||||
hwinfofound = true;
|
||||
} else if (recoverHWInfoOffset(HWS_OFFSET_BOX)) {
|
||||
hwinfofound = true;
|
||||
} else if (recoverHWInfoOffset(HWS_OFFSET_HANDHELD)) {
|
||||
hwinfofound = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
clearScreen(cSUB);
|
||||
@ -179,7 +192,9 @@ bool recoverHWInfoOffset(int address) {
|
||||
memset(sector_buf, 0, 0xA4);
|
||||
iprintf("\nLoading HWInfo...");
|
||||
good_nandio_read(address, 0xA4, file_buf, true);
|
||||
memcpy(&hwsData, file_buf, 0xA4);
|
||||
|
||||
loadHWInfoStruct(file_buf);
|
||||
|
||||
success = saveHWInfoSDMC();
|
||||
|
||||
clearScreen(cSUB);
|
||||
@ -232,9 +247,10 @@ bool recoverHWInfoDeep(void) {
|
||||
}
|
||||
iprintf("\nDone.");
|
||||
if (success == true) { // also if (verify)
|
||||
memset(sector_buf, 0, SECTOR_SIZE);
|
||||
good_nandio_read(0x10EE00 + (i * SECTOR_SIZE), SECTOR_SIZE, sector_buf, true);
|
||||
printf("\n%02X%02X%02X", sector_buf[0 + 0xA1], sector_buf[1 + 0xA1], sector_buf[2 + 0xA1]);
|
||||
memset(file_buf, 0, SECTOR_SIZE);
|
||||
good_nandio_read(0x10EE00 + (i * SECTOR_SIZE), SECTOR_SIZE, file_buf, true);
|
||||
printf("\n%02X%02X%02X", file_buf[0 + 0xA1], file_buf[1 + 0xA1], file_buf[2 + 0xA1]);
|
||||
loadHWInfoStruct(file_buf);
|
||||
if (!agingMode) {
|
||||
agingMode = true;
|
||||
success = saveHWInfoSDMC();
|
||||
@ -266,7 +282,13 @@ bool saveHWInfoSDMC(void) {
|
||||
iprintf("\n>> Save HWInfo Secure to SDMC ");
|
||||
iprintf("\n--------------------------------");
|
||||
|
||||
printf("\nClearing HWInfo buffer...");
|
||||
memset(file_buf, 0, 0x4000);
|
||||
|
||||
|
||||
|
||||
// I need to do region checking (world/korea/china)
|
||||
// ^^^^ huh??? What for? Regions shouldn't be needed HWInfo R/W.
|
||||
printf("\nRemoving old HWInfo...");
|
||||
remove(HWS_PATH_SD);
|
||||
printf("\nWriting HWInfo...");
|
||||
|
||||
@ -14,12 +14,14 @@
|
||||
#include "../message.h"
|
||||
#include "../main.h"
|
||||
#include "../video.h"
|
||||
#include "../audio.h"
|
||||
|
||||
static size_t i;
|
||||
|
||||
enum {
|
||||
NFMENU_CHECK_VER,
|
||||
NFMENU_IMPORT,
|
||||
NFMENU_IMPORT_OLD,
|
||||
NFMENU_IMPORT_SDMC
|
||||
};
|
||||
|
||||
@ -31,7 +33,8 @@ static int _nfMenu(int cursor)
|
||||
setListHeader(m, "NandFirm");
|
||||
|
||||
addMenuItem(m, "Check NandFirm", NULL, 0, "Check the stage2 (bootloader)\n version and type.");
|
||||
addMenuItem(m, "Import NandFirm", NULL, 0, "Install the standard stage2\n (bootloader).\n\n This stage2 works normally,\n but it is an updated version:\n - v2265-9336 (prod)\n - v2725-9336 (dev)");
|
||||
addMenuItem(m, "Import NandFirm", NULL, 0, "Install the standard stage2\n (bootloader).\n\n This stage2 works normally,\n but it is an updated version:\n\n - v2265-9336 (prod)\n - v2725-9336 (dev)");
|
||||
addMenuItem(m, "Import NandFirm (old)", NULL, 0, "Install the standard stage2\n (bootloader).\n\n This is the release version,\n but it is not the latest ver:\n\n - v2435-8325 (dev/prod)\n\n The updated NandFirm should\n be used instead.");
|
||||
addMenuItem(m, "Import NandFirm (SDMC)", NULL, 0, "Install the SDMC Launcher\n stage2 (bootloader).\n\n SDMC will remove access to\n the firmware and SHOULD NOT\n BE USED unless otherwise\n told to do so.");
|
||||
|
||||
m->cursor = cursor;
|
||||
@ -50,9 +53,11 @@ static int _nfMenu(int cursor)
|
||||
if (keysDown() & KEY_A)
|
||||
break;
|
||||
|
||||
if (keysDown() & KEY_B)
|
||||
if (keysDown() & KEY_B) {
|
||||
soundPlayBack();
|
||||
programEnd = true;
|
||||
}
|
||||
}
|
||||
|
||||
int result = m->cursor;
|
||||
freeMenu(m);
|
||||
@ -74,15 +79,23 @@ int nfMain(void)
|
||||
{
|
||||
|
||||
case NFMENU_CHECK_VER:
|
||||
soundPlaySelect();
|
||||
readNandFirm();
|
||||
break;
|
||||
|
||||
case NFMENU_IMPORT:
|
||||
importNandFirm(false);
|
||||
soundPlaySelect();
|
||||
importNandFirm(0);
|
||||
break;
|
||||
|
||||
case NFMENU_IMPORT_OLD:
|
||||
soundPlaySelect();
|
||||
importNandFirm(2);
|
||||
break;
|
||||
|
||||
case NFMENU_IMPORT_SDMC:
|
||||
importNandFirm(true);
|
||||
soundPlaySelect();
|
||||
importNandFirm(1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -105,7 +118,7 @@ bool readNandFirm(void) {
|
||||
printf("\n Ver: ");
|
||||
for (i = 0; i < 10; i++) {
|
||||
|
||||
if (sector_buf[i] == 0x0A) {
|
||||
if (sector_buf[i] == 0x0A && i < 8) {
|
||||
printf("-");
|
||||
} else if (sector_buf[i] == 0x0D) {
|
||||
// Print nothing
|
||||
@ -119,17 +132,34 @@ bool readNandFirm(void) {
|
||||
return success;
|
||||
}
|
||||
|
||||
bool importNandFirm(bool sdmc) {
|
||||
bool importNandFirm(int firmtype) {
|
||||
success = true;
|
||||
clearScreen(cSUB);
|
||||
|
||||
iprintf("\n>> Import NandFirm (%s) ", sdmc ? "sdmc" : "menu");
|
||||
if (firmtype > 2 || firmtype < 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
char firmname[10];
|
||||
switch (firmtype) {
|
||||
case 0:
|
||||
snprintf(firmname, 10, "menu");
|
||||
break;
|
||||
case 1:
|
||||
snprintf(firmname, 10, "sdmc");
|
||||
break;
|
||||
case 2:
|
||||
snprintf(firmname, 10, "old");
|
||||
break;
|
||||
}
|
||||
|
||||
iprintf("\n>> Import NandFirm (%s)\n", firmname);
|
||||
iprintf("\n--------------------------------");
|
||||
|
||||
printf("\nOpening NandFirm...\n");
|
||||
|
||||
char file_path[100];
|
||||
snprintf(file_path, 100, "nitro:/import/%s/%s-launcher.nand", consoleSignName, sdmc ? "sdmc" : "menu");
|
||||
snprintf(file_path, 100, "nitro:/import/%s/%s-launcher.nand", consoleSignName, firmname);
|
||||
FILE *file = fopen(file_path, "r");
|
||||
|
||||
printf("\n%s\n\n", file_path);
|
||||
|
||||
@ -18,4 +18,4 @@ void wait(int ticks);
|
||||
int nfMain(void);
|
||||
|
||||
bool readNandFirm(void);
|
||||
bool importNandFirm(bool sdmc);
|
||||
bool importNandFirm(int firmtype);
|
||||
@ -97,8 +97,7 @@ int parse_mbr(const uint8_t sector0[SECTOR_SIZE], const int is3DS)
|
||||
return -1;
|
||||
}
|
||||
ref_ptable = is3DS?ptable_3DS:ptable_DSi;
|
||||
// only test the 1st partition now, we've seen variations on the 3rd partition
|
||||
// and after all we only care about the 1st partition
|
||||
|
||||
if (memcmp(&ref_ptable[0], &m->partitions[0], sizeof(mbr_partition_t)))
|
||||
{
|
||||
return -2;
|
||||
@ -109,37 +108,3 @@ int parse_mbr(const uint8_t sector0[SECTOR_SIZE], const int is3DS)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
// return 0 for valid MBR
|
||||
int parse_mbr(const uint8_t sector0[SECTOR_SIZE], int is3DS, int verbose) {
|
||||
const mbr_t *m = (mbr_t*)sector0;
|
||||
const mbr_partition_t *ref_ptable; // reference partition table
|
||||
int ret = 0;
|
||||
if (m->boot_signature_0 != 0x55 || m->boot_signature_1 != 0xaa) {
|
||||
//printf("invalid boot signature(0x55, 0xaa)\n");
|
||||
ret = -1;
|
||||
}
|
||||
if (!is3DS) {
|
||||
for (unsigned i = 0; i < sizeof(m->bootstrap); ++i) {
|
||||
if (m->bootstrap[i]) {
|
||||
//printf("bootstrap on DSi should be all zero\n");
|
||||
ret = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
ref_ptable = ptable_DSi;
|
||||
} else {
|
||||
ref_ptable = ptable_3DS;
|
||||
}
|
||||
// Only check the first two as those are the only ones we mount
|
||||
// There's some variation in the 3rd
|
||||
for(int i = 0; i < 2; i++) {
|
||||
if (memcmp(&ref_ptable[i], &m->partitions[i], sizeof(mbr_partition_t))) {
|
||||
//printf("invalid partition table\n");
|
||||
ret = -2;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
*/
|
||||
@ -16,6 +16,7 @@
|
||||
#include "../main.h"
|
||||
#include "../video.h"
|
||||
#include "../storage.h"
|
||||
#include "../audio.h"
|
||||
|
||||
//static size_t i;
|
||||
|
||||
@ -62,9 +63,11 @@ static int _sysfileMenu(int cursor)
|
||||
if (keysDown() & KEY_A)
|
||||
break;
|
||||
|
||||
if (keysDown() & KEY_B)
|
||||
if (keysDown() & KEY_B) {
|
||||
soundPlayBack();
|
||||
programEnd = true;
|
||||
}
|
||||
}
|
||||
|
||||
int result = m->cursor;
|
||||
freeMenu(m);
|
||||
@ -86,31 +89,39 @@ int sysfileMain(void)
|
||||
{
|
||||
|
||||
case SYSFILEMENU_RECOVER:
|
||||
soundPlaySelect();
|
||||
recoverHWInfo(false);
|
||||
break;
|
||||
|
||||
case SYSFILEMENU_RECOVER2:
|
||||
soundPlaySelect();
|
||||
recoverHWInfoDeep();
|
||||
break;
|
||||
|
||||
case SYSFILEMENU_NULL:
|
||||
soundPlaySelect();
|
||||
break;
|
||||
|
||||
case SYSFILEMENU_INIT_FOLDER:
|
||||
soundPlaySelect();
|
||||
makeSystemFolders();
|
||||
break;
|
||||
|
||||
case SYSFILEMENU_INIT_S:
|
||||
soundPlaySelect();
|
||||
break;
|
||||
|
||||
case SYSFILEMENU_INIT_N:
|
||||
soundPlaySelect();
|
||||
break;
|
||||
|
||||
case SYSFILEMENU_INIT_CERT:
|
||||
soundPlaySelect();
|
||||
makeCertChain();
|
||||
break;
|
||||
|
||||
case SYSFILEMENU_INIT_FONT:
|
||||
soundPlaySelect();
|
||||
makeFontTable();
|
||||
break;
|
||||
}
|
||||
|
||||
BIN
sounds/BACK.wav
Normal file
BIN
sounds/BACK.wav
Normal file
Binary file not shown.
BIN
sounds/CHIME.wav
Normal file
BIN
sounds/CHIME.wav
Normal file
Binary file not shown.
BIN
sounds/NG.wav
Normal file
BIN
sounds/NG.wav
Normal file
Binary file not shown.
BIN
sounds/OK.wav
Normal file
BIN
sounds/OK.wav
Normal file
Binary file not shown.
BIN
sounds/SELECT.wav
Normal file
BIN
sounds/SELECT.wav
Normal file
Binary file not shown.
BIN
sounds/STARTUP.wav
Normal file
BIN
sounds/STARTUP.wav
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user