mirror of
https://github.com/RocketRobz/SuperAllStarPhotoStudio.git
synced 2025-06-19 01:25:35 -04:00
Save selected music, and have 3DS version require relaunch to load selected music
This commit is contained in:
parent
bf3d209e0e
commit
75f92f0d58
@ -6,6 +6,7 @@
|
||||
extern sound *music;
|
||||
extern sound *music_loop;
|
||||
extern bool dspfirmfound;
|
||||
extern bool musicStartLoaded;
|
||||
|
||||
void loadMusic(int num) {
|
||||
if (!dspfirmfound) return;
|
||||
@ -225,6 +226,7 @@ void loadMusic(int num) {
|
||||
|
||||
if (access(startName, F_OK) == 0) {
|
||||
music = new sound(startName, 0, false);
|
||||
musicStartLoaded = true;
|
||||
}
|
||||
if (access(loopName, F_OK) == 0) {
|
||||
music_loop = new sound(loopName, 1, true);
|
||||
|
@ -29,6 +29,7 @@ char verText[32];
|
||||
int studioBg = 0;
|
||||
bool cinemaWide = false;
|
||||
int iFps = 60;
|
||||
int savedMusicId = 27;
|
||||
|
||||
u8 consoleModel = 0;
|
||||
|
||||
@ -43,6 +44,7 @@ bool horiHd = true;
|
||||
bool dspfirmfound = false;
|
||||
bool exiting = false;
|
||||
bool musicPlayStarted = false;
|
||||
bool musicStartLoaded = false;
|
||||
static bool musicPlaying = false;
|
||||
static bool musicLoopPlaying = false;
|
||||
static int musicLoopDelay = 0;
|
||||
@ -60,6 +62,7 @@ void loadSettings(void) {
|
||||
if (setting > 0) cinemaWide = true;
|
||||
iFps = settingsini.GetInt("SuperPhotoStudio", "FRAME_RATE", iFps);
|
||||
horiHd = settingsini.GetInt("SuperPhotoStudio", "HORI_HD", horiHd);
|
||||
savedMusicId = settingsini.GetInt("SuperPhotoStudio", "MUSIC_ID", savedMusicId);
|
||||
}
|
||||
|
||||
void saveSettings(void) {
|
||||
@ -68,6 +71,7 @@ void saveSettings(void) {
|
||||
//settingsini.SetInt("SuperPhotoStudio", "STUDIO_BG", studioBg);
|
||||
settingsini.SetInt("SuperPhotoStudio", "CINEMA_WIDE", (cinemaWide) ? true : false);
|
||||
settingsini.SetInt("SuperPhotoStudio", "FRAME_RATE", iFps);
|
||||
savedMusicId = settingsini.GetInt("SuperPhotoStudio", "MUSIC_ID", savedMusicId);
|
||||
|
||||
settingsini.SaveIniFileModified(settingsIni);
|
||||
}
|
||||
@ -86,16 +90,19 @@ void Play_Music(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void Stop_Music(void) {
|
||||
/* void Stop_Music(void) {
|
||||
if (dspfirmfound) {
|
||||
music->~sound();
|
||||
if (musicStartLoaded) {
|
||||
music->~sound();
|
||||
musicStartLoaded = false;
|
||||
}
|
||||
music_loop->~sound();
|
||||
}
|
||||
musicPlayStarted = false;
|
||||
musicPlaying = false;
|
||||
musicLoopPlaying = false;
|
||||
musicLoopDelay = 0;
|
||||
}
|
||||
} */
|
||||
|
||||
/*void musLogos(void) {
|
||||
if (!dspfirmfound) return;
|
||||
@ -337,7 +344,10 @@ int main()
|
||||
|
||||
saveSettings();
|
||||
|
||||
//delete music;
|
||||
if (musicStartLoaded) {
|
||||
delete music;
|
||||
}
|
||||
delete music_loop;
|
||||
//delete mus_logos;
|
||||
delete sfx_select;
|
||||
delete sfx_back;
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "nitrofs.h"
|
||||
#include "sound.h"
|
||||
#include "photoStudio.hpp"
|
||||
#include "inifile.h"
|
||||
#include "productIdent.hpp"
|
||||
#include "rocketRobz.hpp"
|
||||
#include "screen.hpp"
|
||||
@ -25,9 +26,12 @@ bool exiting = false;
|
||||
bool rocketRobzScreen = false;
|
||||
int delay = 0;
|
||||
|
||||
#define settingsIni "sd:/_nds/SuperPhotoStudio/settings.ini"
|
||||
|
||||
char verText[32];
|
||||
int studioBg = 0;
|
||||
int iFps = 60;
|
||||
int savedMusicId = 27;
|
||||
|
||||
extern int bg3Main;
|
||||
extern bool ditherlaceOnVBlank;
|
||||
@ -35,6 +39,20 @@ extern bool secondFrame;
|
||||
bool renderTop = true; // Disable to prevent second character from flickering
|
||||
bool doScreenshot = false;
|
||||
|
||||
void loadSettings(void) {
|
||||
CIniFile settingsini(settingsIni);
|
||||
|
||||
savedMusicId = settingsini.GetInt("SuperPhotoStudio", "MUSIC_ID", savedMusicId);
|
||||
}
|
||||
|
||||
void saveSettings(void) {
|
||||
CIniFile settingsini(settingsIni);
|
||||
|
||||
savedMusicId = settingsini.GetInt("SuperPhotoStudio", "MUSIC_ID", savedMusicId);
|
||||
|
||||
settingsini.SaveIniFileModified(settingsIni);
|
||||
}
|
||||
|
||||
static bool streamStarted = false;
|
||||
void Play_Music(void) {
|
||||
streamStarted ? snd().updateStream() : snd().beginStream();
|
||||
@ -106,6 +124,7 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
|
||||
mkdir("/_nds", 0777);
|
||||
mkdir("/_nds/SuperPhotoStudio", 0777);
|
||||
|
||||
if (!dsiFeatures()) {
|
||||
sysSetCartOwner (BUS_OWNER_ARM9); // Allow arm9 to access GBA ROM (or in this case, the DS Memory Expansion Pak)
|
||||
|
@ -72,8 +72,6 @@ static void Screenshot_GenerateFilename(int count, char *file_name) {
|
||||
int month = localtime(&t)->tm_mon + 1;
|
||||
int year = localtime(&t)->tm_year + 1900;
|
||||
|
||||
mkdir("/_nds", 0777);
|
||||
mkdir("/_nds/SuperPhotoStudio", 0777);
|
||||
mkdir("/_nds/SuperPhotoStudio/photos", 0777);
|
||||
|
||||
sprintf(file_name, "/_nds/SuperPhotoStudio/photos/Screenshot_%02d%02d%02d-%i.bmp", year, month, day, count);
|
||||
|
@ -45,6 +45,7 @@
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
extern int savedMusicId;
|
||||
static bool musicLoaded = false;
|
||||
extern void loadMusic(int num);
|
||||
|
||||
@ -1024,7 +1025,7 @@ void PhotoStudio::loadChrImage(void) {
|
||||
|
||||
void PhotoStudio::Draw(void) const {
|
||||
if (!musicLoaded) {
|
||||
loadMusic(27);
|
||||
loadMusic(savedMusicId);
|
||||
musicLoaded = true;
|
||||
}
|
||||
|
||||
@ -1432,7 +1433,8 @@ void PhotoStudio::Draw(void) const {
|
||||
}
|
||||
i2 += 48;
|
||||
GFX::DrawSprite(sprites_item_button_idx, 18, i2-20);
|
||||
Gui::DrawString(32, i2, 0.65, WHITE, "Change Music");
|
||||
Gui::DrawString(32, i2-8, 0.65, WHITE, "Change Music");
|
||||
Gui::DrawString(32, i2+12, 0.50, WHITE, "Relaunch to take effect.");
|
||||
}
|
||||
|
||||
if (subScreenMode != 0) {
|
||||
@ -1671,14 +1673,17 @@ void PhotoStudio::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
||||
if (hDown & KEY_A) {
|
||||
sndSelect();
|
||||
subScreenMode = 0;
|
||||
savedMusicId = getBgmNum();
|
||||
#ifdef NDS
|
||||
redrawText = true;
|
||||
Gui::DrawScreen();
|
||||
ditherlaceOnVBlank = true;
|
||||
#endif
|
||||
extern void Stop_Music(void);
|
||||
Stop_Music();
|
||||
loadMusic(getBgmNum());
|
||||
loadMusic(savedMusicId);
|
||||
extern void saveSettings(void);
|
||||
saveSettings();
|
||||
#endif
|
||||
#ifdef NDS
|
||||
ditherlaceOnVBlank = false;
|
||||
#else
|
||||
|
Loading…
Reference in New Issue
Block a user