Skip to content

Commit

Permalink
Add new graphic for empty card slot...
Browse files Browse the repository at this point in the history
* Add new graphics for when slot1 is empty when in stage2 menu.
* Stage2 laucnhers I had previously made for 3DS are now included in
nitrofs. Code is added to have program automatically copy them to
SD:\NTR_Launcher if they aren't present.
* Provided no bugs are found during testing this will likely be the 3.0
release.
  • Loading branch information
ApacheThunder committed Apr 11, 2024
1 parent 247dc9b commit d9cfe83
Show file tree
Hide file tree
Showing 23 changed files with 327 additions and 175 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ SCFGUNLOCK = 0
ANIMATEDSPLASH = 0
NTRSPLASH = 0
HEALTHSAFETYSPLASH = 1
AUTOBOOT = 1
DEBUGMODE = 0
LANGUAGE = -1

5 changes: 4 additions & 1 deletion arm9/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ IMAGES := graphics
SOURCES := source common hbmenu $(IMG_DATA)
INCLUDES := include common hbmenu
DATA := ../data
MUSIC := music
MUSIC := audio

#---------------------------------------------------------------------------------
# options for code generation
Expand Down Expand Up @@ -861,6 +861,9 @@ hbmenu_banner.s : ../$(IMAGES)/hbmenu_banner.bmp

hbmenu_banner_cartSelected.s : ../$(IMAGES)/hbmenu_banner_cartSelected.bmp
grit $< -W3 -gT! -gzl -gB16 -o $@ -q

hbmenu_banner_noCart.s : ../$(IMAGES)/hbmenu_banner_noCart.bmp
grit $< -W3 -gT! -gzl -gB16 -o $@ -q

hbmenu_consolebg.s : ../$(IMAGES)/hbmenu_consolebg.bmp
grit $< -gB8 -gb -o $@ -q
Expand Down
Binary file added arm9/audio/back.wav
Binary file not shown.
File renamed without changes.
File renamed without changes.
Binary file added arm9/audio/launch.wav
Binary file not shown.
Binary file added arm9/audio/select.wav
Binary file not shown.
Binary file added arm9/audio/wrong.wav
Binary file not shown.
124 changes: 124 additions & 0 deletions arm9/common/audio.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
/*
NitroHax -- Cheat tool for the Nintendo DS
Copyright (C) 2008 Michael "Chishm" Chisholm
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#include <stddef.h>
#include <nds.h>
#include <maxmod9.h>

#include "soundbank.h"
#include "soundbank_bin.h"

static mm_sound_effect dsboot;
static mm_sound_effect dsiboot;
static mm_sound_effect sfxBack;
static mm_sound_effect sfxLaunch;
static mm_sound_effect sfxSelect;
static mm_sound_effect sfxWrong;

static bool audioReady = false;

void InitAudio() {
mmInitDefaultMem((mm_addr)soundbank_bin);

mmLoadEffect( SFX_DSBOOT );
mmLoadEffect( SFX_DSIBOOT );
mmLoadEffect( SFX_BACK );
mmLoadEffect( SFX_LAUNCH );
mmLoadEffect( SFX_SELECT );
mmLoadEffect( SFX_WRONG );

dsiboot = {
{ SFX_DSIBOOT } , // id
(int)(1.0f * (1<<10)), // rate
0, // handle
255, // volume
128, // panning
};

dsboot = {
{ SFX_DSBOOT } , // id
(int)(1.0f * (1<<10)), // rate
0, // handle
255, // volume
128, // panning
};

sfxBack = {
{ SFX_BACK } , // id
(int)(1.0f * (1<<10)), // rate
0, // handle
255, // volume
128, // panning
};

sfxLaunch = {
{ SFX_LAUNCH } , // id
(int)(1.0f * (1<<10)), // rate
0, // handle
255, // volume
128, // panning
};

sfxSelect = {
{ SFX_SELECT } , // id
(int)(1.0f * (1<<10)), // rate
0, // handle
255, // volume
128, // panning
};

sfxWrong = {
{ SFX_WRONG } , // id
(int)(1.0f * (1<<10)), // rate
0, // handle
255, // volume
128, // panning
};
audioReady = true;
}

void PlayBootJingle() {
if (!audioReady)InitAudio();
mmEffectEx(&dsboot);
}

void PlayBootJingleDSi() {
if (!audioReady)InitAudio();
mmEffectEx(&dsiboot);
}

void PlayLaunchSFX() {
if (!audioReady)InitAudio();
mmEffectEx(&sfxLaunch);
}

void PlayWrongSFX() {
if (!audioReady)InitAudio();
mmEffectEx(&sfxWrong);
}

void PlaySelectSFX() {
if (!audioReady)InitAudio();
mmEffectEx(&sfxSelect);
}

void PlayBackSFX() {
if (!audioReady)InitAudio();
mmEffectEx(&sfxBack);
}

16 changes: 16 additions & 0 deletions arm9/common/audio.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#ifndef AUDIO_H
#define AUDIO_H

void InitAudio(void);

void PlayBootJingle(void);
void PlayBootJingleDSi(void);

void PlayLaunchSFX(void);
void PlayWrongSFX(void);
void PlaySelectSFX(void);
void PlayBackSFX(void);
void PlayLaunchSFX(void);

#endif // AUDIO_H

Binary file added arm9/graphics/hbmenu_banner_noCart.bmp
Binary file not shown.
93 changes: 22 additions & 71 deletions arm9/hbmenu/file_browse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@
#include "hbmenu.h"
#include "iconTitle.h"
#include "read_card.h"

#include <maxmod9.h>
#include "soundbank.h"
#include "soundbank_bin.h"
#include "audio.h"

#define SCREEN_COLS 30
#define ENTRIES_PER_SCREEN 20
Expand All @@ -46,60 +43,13 @@

using namespace std;

static ALIGN(4) sNDSHeaderExt ntrHeader;
ALIGN(4) sNDSHeaderExt ntrHeader;

struct DirEntry {
string name;
bool isDirectory;
};

static mm_sound_effect sfxBack;
static mm_sound_effect sfxLaunch;
static mm_sound_effect sfxSelect;
static mm_sound_effect sfxWrong;
static bool audioReady = false;

void InitAudio() {
mmInitDefaultMem((mm_addr)soundbank_bin);

mmLoadEffect( SFX_BACK );
mmLoadEffect( SFX_LAUNCH );
mmLoadEffect( SFX_SELECT );
mmLoadEffect( SFX_WRONG );

sfxBack = {
{ SFX_BACK } , // id
(int)(1.0f * (1<<10)), // rate
0, // handle
255, // volume
128, // panning
};

sfxLaunch = {
{ SFX_LAUNCH } , // id
(int)(1.0f * (1<<10)), // rate
0, // handle
255, // volume
128, // panning
};

sfxSelect = {
{ SFX_SELECT } , // id
(int)(1.0f * (1<<10)), // rate
0, // handle
255, // volume
128, // panning
};

sfxWrong = {
{ SFX_WRONG } , // id
(int)(1.0f * (1<<10)), // rate
0, // handle
255, // volume
128, // panning
};
audioReady = true;
}

static bool cardInserted = false;
static bool cardLoaded = false;
Expand Down Expand Up @@ -132,10 +82,10 @@ static void cartCheck() {
clearCartIcon(true);
cardLoaded = false;
if (cartSelected)cartSelected = false;
ToggleBackground();
}
if (cartInsertedOnBoot)cartInsertedOnBoot = false;
if (cartSelected)cartSelected = false;
ToggleBackground(true);
return;
}
if (cardInserted && initialLoad) {
Expand All @@ -144,10 +94,12 @@ static void cartCheck() {
initialLoad = false;
cardLoaded = true;
cartInsertedOnBoot = true;
ToggleBackground(false);
} else if (cardInserted && !cardLoaded){
cardInit(&ntrHeader);
for (int i = 0; i < 25; i++)swiWaitForVBlank();
cartIconUpdate(ntrHeader.bannerOffset, false);
ToggleBackground(false);
cardLoaded = true;
}
}
Expand Down Expand Up @@ -251,7 +203,6 @@ void showDirectoryContents (const vector<DirEntry>& dirContents, int startRow) {
}

string browseForFile (const vector<string>& extensionList) {
if (!audioReady)InitAudio();
int pressed = 0;
int screenOffset = 0;
int fileOffset = 0;
Expand All @@ -278,10 +229,10 @@ string browseForFile (const vector<string>& extensionList) {
swiWaitForVBlank();
} while (!pressed);
if (!cartSelected) {
if (pressed & KEY_UP) { fileOffset -= 1; mmEffectEx(&sfxSelect); }
if (pressed & KEY_DOWN) { fileOffset += 1; mmEffectEx(&sfxSelect); }
if (pressed & KEY_LEFT) { fileOffset -= ENTRY_PAGE_LENGTH; mmEffectEx(&sfxSelect); }
if (pressed & KEY_RIGHT) { fileOffset += ENTRY_PAGE_LENGTH; mmEffectEx(&sfxSelect); }
if (pressed & KEY_UP) { fileOffset -= 1; PlaySelectSFX(); }
if (pressed & KEY_DOWN) { fileOffset += 1; PlaySelectSFX(); }
if (pressed & KEY_LEFT) { fileOffset -= ENTRY_PAGE_LENGTH; PlaySelectSFX(); }
if (pressed & KEY_RIGHT) { fileOffset += ENTRY_PAGE_LENGTH; PlaySelectSFX(); }

if (fileOffset < 0)fileOffset = dirContents.size() - 1; // Wrap around to bottom of list
if (fileOffset > ((int)dirContents.size() - 1)) fileOffset = 0; // Wrap around to top of list
Expand All @@ -298,40 +249,40 @@ string browseForFile (const vector<string>& extensionList) {
}
if ((pressed & KEY_X)) {
if (cardLoaded) {
mmEffectEx(&sfxSelect);
PlaySelectSFX();
if (cartSelected) {
cartSelected = false;
ToggleBackground();
ToggleBackground(false);
} else if (cardLoaded) {
cartSelected = true;
ToggleBackground();
ToggleBackground(false);
}
} else {
mmEffectEx(&sfxWrong);
PlayWrongSFX();
}
}

if (cartSelected) {
if (pressed & KEY_UP)mmEffectEx(&sfxWrong);
if (pressed & KEY_DOWN)mmEffectEx(&sfxWrong);
if (pressed & KEY_LEFT)mmEffectEx(&sfxWrong);
if (pressed & KEY_RIGHT)mmEffectEx(&sfxWrong);
if (pressed & KEY_UP)PlayWrongSFX();
if (pressed & KEY_DOWN)PlayWrongSFX();
if (pressed & KEY_LEFT)PlayWrongSFX();
if (pressed & KEY_RIGHT)PlayWrongSFX();

if ((pressed & KEY_A)) {
if (cardLoaded) {
mmEffectEx(&sfxLaunch);
PlayLaunchSFX();
// Clear the screen
consoleClear();
return "CARTBOOT";
} else {
mmEffectEx(&sfxWrong);
PlayWrongSFX();
}
}
} else {
if (pressed & KEY_A) {
DirEntry* entry = &dirContents.at(fileOffset);
if (entry->isDirectory) {
mmEffectEx(&sfxSelect);
PlaySelectSFX();
iprintf("Entering directory\n");
// Enter selected directory
chdir (entry->name.c_str());
Expand All @@ -340,7 +291,7 @@ string browseForFile (const vector<string>& extensionList) {
fileOffset = 0;
showDirectoryContents (dirContents, screenOffset);
} else {
mmEffectEx(&sfxLaunch);
PlayLaunchSFX();
// Clear the screen
consoleClear();
// Return the chosen file
Expand All @@ -349,7 +300,7 @@ string browseForFile (const vector<string>& extensionList) {
}

if (pressed & KEY_B) {
mmEffectEx(&sfxBack);
if (cartSelected) { PlayWrongSFX(); } else { PlayBackSFX(); }
// Go up a directory
chdir ("..");
getDirectoryContents (dirContents, extensionList);
Expand Down
3 changes: 3 additions & 0 deletions arm9/hbmenu/file_browse.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@

#include <string>
#include <vector>
#include "read_card.h"


extern bool cartInsertedOnBoot;
extern sNDSHeaderExt ntrHeader;

std::string browseForFile (const std::vector<std::string>& extensionList);

Expand Down
Loading

0 comments on commit d9cfe83

Please sign in to comment.