Add Screen classes for SavvyManager. (#6)

* Add Screen classes for SavvyManager.

* This should fix the character change.
This commit is contained in:
StackZ 2020-05-27 11:06:52 +02:00 committed by GitHub
parent 647b7204e6
commit 24b818c2b1
27 changed files with 2068 additions and 2040 deletions

View File

@ -51,9 +51,9 @@ VERSION_MICRO := 0
TARGET := SavvyManager
BUILD := build
UNIVCORE := Universal-Core
SOURCES := $(UNIVCORE) source source/utils
SOURCES := $(UNIVCORE) source source/screens source/utils
DATA := data
INCLUDES := $(UNIVCORE) include include/utils
INCLUDES := $(UNIVCORE) include include/screens include/utils
GRAPHICS := assets/gfx assets/gfx_chars assets/gfx_charprevbg assets/gfx_gamesel assets/gfx_gameshots
ROMFS := romfs
GFXBUILD := $(ROMFS)/gfx
@ -74,9 +74,9 @@ CFLAGS := -g -Wall -O2 -mword-relocations \
$(ARCH)
CFLAGS += $(INCLUDE) -DARM11 -D_3DS -DVERSION_MAJOR=$(VERSION_MAJOR) \
-DVERSION_MINOR=$(VERSION_MINOR) -DVERSION_MICRO=$(VERSION_MICRO)
-DVERSION_MINOR=$(VERSION_MINOR) -DVERSION_MICRO=$(VERSION_MICRO)
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=c++11 -std=gnu++11
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++17
ASFLAGS := -g $(ARCH)
LDFLAGS = -specs=3dsx.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)

@ -1 +1 @@
Subproject commit c82ad8d6e11e4842c6099b53595aa3692f24910b
Subproject commit 95b3161f30c57474d572e8a90ac9a9243af2cf82

View File

@ -22,13 +22,12 @@
typedef u32 Color;
namespace GFX
{
namespace GFX {
// Load & Unload default sheets.
Result loadSheets();
Result unloadSheets();
// Sprirte Functions.
// Sprite Functions.
bool loadCharSprite(const char* t3xPathAllSeasons, const char* t3xPathOneSeason);
void loadBgSprite(void);
void showBgSprite(int zoomIn);
@ -39,7 +38,7 @@ namespace GFX
void DrawSpriteBlend(int key, float x, float y, u32 color, float ScaleX = 1, float ScaleY = 1);
// Draw Cursor.
void drawCursor(void);
void drawCursor(int cX, int cY);
}
#endif

View File

@ -0,0 +1,83 @@
#ifndef _SAVVY_MANAGER_CHARACTER_CHANGE_HPP
#define _SAVVY_MANAGER_CHARACTER_CHANGE_HPP
#include "common.hpp"
#include <memory>
#include <vector>
class CharacterChange : public Screen {
public:
void Draw(void) const override;
void Logic(u32 hDown, u32 hHeld, touchPosition touch) override;
CharacterChange();
private:
void preview() const;
void getList();
void getMaxChars();
const char* seasonName(void) const;
const char* characterName(bool showPlayerName) const;
const char* import_characterName(void) const;
const char* import_SS2CharacterNames(int i) const;
const char* import_characterNameDisplay(void) const;
const char* ss1Title(void) const;
const char* ss2Title(void) const;
const char* ss3Title(void) const;
const char* ss4Title(void) const;
void drawMsg(void) const;
void loadChrImage(bool Robz);
void addEveryone(void);
int subScreenMode = 0;
/*
0: Character list
1: What to change
2: Body change
3: Outfit change (Currently bow placement change)
4: Import character
*/
mutable int cursorX, cursorY;
int import_highlightedGame = 0;
int seasonNo = 0;
char chrFilePath[256];
char chrFilePath2[256];
bool displayNothing = false;
mutable int charFadeAlpha = 0;
bool previewCharacter = false;
bool previewCharacterFound = false;
bool showMessage = false;
int messageNo = 0;
char chararacterImported[48];
bool removeBags = false;
int zoomIn = 0;
int cheatKeys[10] = {0};
int cheatKeyPosition = 0;
u16 totalCharacters = 0;
u16 import_totalCharacters = 0;
int characterList_cursorPosition = 0;
int characterList_cursorPositionOnScreen = 0;
int characterChangeMenu_cursorPosition = 0;
int characterChangeMenu_cursorPositionOnScreen = 0;
int characterChangeMenu_optionShownFirst = 0;
int characterChangeMenuOps[4] = {0};
int characterChangeMenuOptions = 2;
int importCharacterList_cursorPosition = 0;
int importCharacterList_cursorPositionOnScreen = 0;
int characterShownFirst = 0;
int import_characterShownFirst = 0;
bool exportedCharListGotten[4] = {false};
};
#endif

View File

@ -0,0 +1,49 @@
#ifndef _SAVVY_MANAGER_EMBLEM_CHANGE_HPP
#define _SAVVY_MANAGER_EMBLEM_CHANGE_HPP
#include "common.hpp"
#include <memory>
#include <vector>
class EmblemChange : public Screen {
public:
void Draw(void) const override;
void Logic(u32 hDown, u32 hHeld, touchPosition touch) override;
EmblemChange();
private:
void getMaxEmblems();
//int getPalNumber(u8 byte, bool secondPixel);
//u32 emblemPixel(int pixel, bool secondPixel);
//u32 emblemImage[64*64];
//void renderEmblem(void);
//bool emblemHalf = false;
//void drawEmblem(int x, int y, bool big);
void drawMsg(void) const;
int subScreenMode = 0;
/*
0: Emblem list
1: What to change
2: Import emblem
*/
mutable int cursorX, cursorY;
int importPage = 0;
char embFilePath[256];
bool displayNothing = false;
int cursorPosition = 0;
int emblemChangeMenu_cursorPosition = 0;
int importEmblemList_cursorPosition = 0;
int importEmblemList_cursorPositionOnScreen = 0;
int totalEmblems = 0;
int import_emblemShownFirst = 0;
bool modeInited = false;
bool showMessage = false;
int messageNo = 0;
char emblemImported[48];
};
#endif

View File

@ -0,0 +1,12 @@
#ifndef _SAVVY_MANAGER_EXITING_HPP
#define _SAVVY_MANAGER_EXITING_HPP
#include "common.hpp"
class Exiting : public Screen {
public:
void Draw(void) const override;
void Logic(u32 hDown, u32 hHeld, touchPosition touch) override;
};
#endif

View File

@ -0,0 +1,20 @@
#ifndef _SAVVY_MANAGER_GAMESELECT_HPP
#define _SAVVY_MANAGER_GAMESELECT_HPP
#include "common.hpp"
#include <memory>
#include <vector>
class GameSelect : public Screen {
public:
void Draw(void) const override;
void Logic(u32 hDown, u32 hHeld, touchPosition touch) override;
private:
void drawCannotEditMsg(void) const;
int messageNo = 0;
bool showMessage = false;
int cursorAlpha = 0;
};
#endif

View File

@ -0,0 +1,30 @@
#ifndef _SAVVY_MANAGER_MUSIC_CHANGE_HPP
#define _SAVVY_MANAGER_MUSIC_CHANGE_HPP
#include "common.hpp"
#include <memory>
#include <vector>
class MusicChange : public Screen {
public:
void Draw(void) const override;
void Logic(u32 hDown, u32 hHeld, touchPosition touch) override;
MusicChange();
private:
void drawMsg(void) const;
mutable int cursorX, cursorY;
//int screenmode = 0;
//int subScreenMode = 0;
int cursorPosition = 0;
int cursorPositionOnScreen = 0;
int musicPackShownFirst = 0;
bool modeInited = false;
bool showMessage = false;
int messageNo = 0;
};
#endif

View File

@ -0,0 +1,16 @@
#ifndef _SAVVY_MANAGER_ROCKETROBZ_HPP
#define _SAVVY_MANAGER_ROCKETROBZ_HPP
#include "common.hpp"
class RocketRobz : public Screen {
public:
void Draw(void) const override;
void Logic(u32 hDown, u32 hHeld, touchPosition touch) override;
private:
int text_width = 0;
const char* yeartext = "2019-2020 RocketRobz";
//const char* yeartext2 = "Games 2008-2017 Nintendo & syn Sophia";
};
#endif

View File

@ -0,0 +1,27 @@
#ifndef _SAVVY_MANAGER_SETTINGS_HPP
#define _SAVVY_MANAGER_SETTINGS_HPP
#include "common.hpp"
#include <memory>
#include <vector>
class Settings : public Screen {
public:
void Draw(void) const override;
void Logic(u32 hDown, u32 hHeld, touchPosition touch) override;
private:
const char* studioBgName(void) const;
bool displayStudioBg = true;
mutable int cursorX, cursorY;
int numberOfSettings = 1;
int cursorPosition = 0;
int cursorPositionOnScreen = 0;
int settingShownFirst = 0;
//bool modeInited = false;
//int screenmode = 0;
//int subScreenMode = 0;
};
#endif

View File

@ -0,0 +1,24 @@
#ifndef _SAVVY_MANAGER_WHAT_TO_DO_HPP
#define _SAVVY_MANAGER_WHAT_TO_DO_HPP
#include "common.hpp"
#include <memory>
#include <vector>
class WhatToDo : public Screen {
public:
void Draw(void) const override;
void Logic(u32 hDown, u32 hHeld, touchPosition touch) override;
WhatToDo();
private:
void initialize();
void cursorChange();
bool runSelection = false;
int whatToChange_cursorPosition = 0;
bool showMessage = false;
int messageNo = 0;
int cursorX, cursorY;
};
#endif

21
include/screenvars.h Normal file
View File

@ -0,0 +1,21 @@
#ifndef SCREEN_VARS_H
#define SCREEN_VARS_H
// List all common screen variables here.
extern u8 sysRegion;
extern bool showCursor;
extern float bg_xPos;
extern float bg_yPos;
extern int cursorAlpha;
extern int studioBg;
extern int iFps;
extern std::string currentMusicPack;
extern int highlightedGame;
// List all common screen functions here.
extern void sndBack(void);
extern void sndSelect(void);
extern void sndHighlight(void);
extern bool touchingBackButton(void);
#endif // SCREEN_VARS_H

View File

@ -1,20 +0,0 @@
#ifndef SETTINGS_H
#define SETTINGS_H
#ifdef __cplusplus
extern "C" {
#endif
#include <string>
extern int iFps;
extern std::string currentMusicPack;
extern void loadSettings(void);
extern void saveSettings(void);
#ifdef __cplusplus
}
#endif
#endif // SETTINGS_H

View File

@ -1,36 +1,12 @@
#pragma once
#ifndef COMMON_HPP
#define COMMON_HPP
#include <3ds.h>
#ifdef __cplusplus
extern "C" {
#endif
#include <malloc.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#ifdef __cplusplus
}
#include "gfx.hpp"
#include "gui.hpp"
#include "screenCommon.hpp"
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <regex>
#include <curl/curl.h>
#endif
extern char * arg0;
#define WORKING_DIR "/3ds/"
#define HBL_FILE_NAME APP_TITLE ".3dsx"
#define HBL_FILE_PATH WORKING_DIR "/" HBL_FILE_NAME
extern std::unique_ptr<Screen> usedScreen, tempScreen;
#endif

View File

@ -1,939 +0,0 @@
#include <stdio.h>
#include <dirent.h>
#include <string.h>
#include <3ds.h>
#include <malloc.h>
#include <unistd.h> // access
#include <sys/stat.h>
#include "common.hpp"
#include "screenMode.h"
#include "savedata.h"
#include "file_browse.h"
#include "ss3charnames.h"
#include "ss4charnames.h"
#include "import_ss1charnames.h"
#include "import_ss2charnames.h"
#include "import_ss3charnames.h"
#include "import_ss4charnames.h"
#include "import_everycharnames.h"
extern int iFps;
extern void sndSelect(void);
extern void sndBack(void);
extern void sndHighlight(void);
//static int screenmode = 0;
extern int screenmodebuffer;
static int subScreenMode = 0;
/*
0: Character list
1: What to change
2: Body change
3: Outfit change (Currently bow placement change)
4: Import character
*/
static int import_highlightedGame = 0;
static int seasonNo = 0;
static const char* seasonName(void) {
switch (seasonNo) {
case 0:
return "Spring";
case 1:
return "Summer";
case 2:
return "Fall";
case 3:
return "Winter";
}
return "null";
}
static char chrFilePath[256];
static char chrFilePath2[256];
extern u8 sysRegion;
extern int highlightedGame;
extern bool saveWritten;
extern int fadealpha;
extern int fadecolor;
extern bool fadein;
extern bool fadeout;
extern float bg_xPos;
extern float bg_yPos;
extern bool showCursor;
extern int cursorX;
extern int cursorY;
extern int cursorAlpha;
extern u32 hDown;
extern touchPosition touch;
extern bool touchingBackButton(void);
static bool displayNothing = false;
static int charFadeAlpha = 0;
static bool previewCharacter = false;
static bool previewCharacterFound = false;
static int zoomIn = 0;
static int cheatKeys[10] = {0};
static int cheatKeyPosition = 0;
static u16 totalCharacters = 0;
static u16 import_totalCharacters = 0;
static int characterList_cursorPosition = 0;
static int characterList_cursorPositionOnScreen = 0;
static int characterChangeMenu_cursorPosition = 0;
static int characterChangeMenu_cursorPositionOnScreen = 0;
static int characterChangeMenu_optionShownFirst = 0;
static int characterChangeMenuOps[4] = {0};
static int characterChangeMenuOptions = 2;
static int importCharacterList_cursorPosition = 0;
static int importCharacterList_cursorPositionOnScreen = 0;
static int characterShownFirst = 0;
static int import_characterShownFirst = 0;
static bool exportedCharListGotten[4] = {false};
static const char* characterName(bool showPlayerName) {
if (characterList_cursorPosition == 0) {
if (showPlayerName) {
switch (highlightedGame) {
case 1:
return ss2PlayerName;
case 2:
return ss3PlayerName;
case 3:
return ss4PlayerName;
}
} else {
return "Player";
}
}
switch (highlightedGame) {
case 2:
return ss3CharacterNames[characterList_cursorPosition];
case 3:
return ss4CharacterNames[characterList_cursorPosition];
}
return "null";
}
static const char* import_characterName(void) {
switch (import_highlightedGame) {
case 0:
return import_ss1CharacterNames[importCharacterList_cursorPosition];
case 1:
return import_ss2CharacterNames[importCharacterList_cursorPosition];
case 2:
return import_ss3CharacterNames[importCharacterList_cursorPosition];
case 3:
return import_ss4CharacterNames[importCharacterList_cursorPosition];
}
return "null";
}
static const char* import_SS2CharacterNames(int i) {
switch (sysRegion) {
default:
return import_ss2CharacterNames[i];
case CFG_REGION_EUR:
case CFG_REGION_AUS:
return import_nsbCharacterNames[i];
}
}
static const char* import_characterNameDisplay(void) {
switch (import_highlightedGame) {
case 0:
return import_ss1CharacterNames[importCharacterList_cursorPosition];
case 1:
return import_SS2CharacterNames(importCharacterList_cursorPosition);
case 2:
return import_ss3CharacterNames[importCharacterList_cursorPosition];
case 3:
return import_ss4CharacterNames[importCharacterList_cursorPosition];
}
return "null";
}
static const char* ss1Title(void) {
switch (sysRegion) {
default:
return "Style Savvy";
case CFG_REGION_EUR:
case CFG_REGION_AUS:
return "Style Boutique";
case CFG_REGION_JPN:
return "Wagamama Fashion: Girls Mode";
case CFG_REGION_KOR:
return "Namanui Collection: Girls Style";
}
}
static const char* ss2Title(void) {
switch (sysRegion) {
default:
return "Style Savvy: Trendsetters";
case CFG_REGION_EUR:
case CFG_REGION_AUS:
return "New Style Boutique";
case CFG_REGION_JPN:
return "Girls Mode: Yokubari Sengen";
case CFG_REGION_KOR:
return "Girls Style: Paesyeon Lideo Seon-eon!";
}
}
static const char* ss3Title(void) {
switch (sysRegion) {
default:
return "Style Savvy: Fashion Forward";
case CFG_REGION_EUR:
case CFG_REGION_AUS:
return "New Style Boutique 2: Fashion Forward";
case CFG_REGION_JPN:
return "Girls Mode 3: Kirakira * Code";
case CFG_REGION_KOR:
return "Girls Style: Kirakira * Code";
}
}
static const char* ss4Title(void) {
switch (sysRegion) {
default:
return "Style Savvy: Styling Star";
case CFG_REGION_EUR:
case CFG_REGION_AUS:
return "New Style Boutique 3: Styling Star";
case CFG_REGION_JPN:
return "Girls Mode 4: Star Stylist";
case CFG_REGION_KOR:
return "Girls Style: Star Stylist";
}
}
static bool showMessage = false;
static int messageNo = 0;
static char chararacterImported[48];
static void drawMsg(void) {
GFX::DrawSprite(sprites_msg_idx, 0, 8, 1, 1);
GFX::DrawSprite(sprites_msg_idx, 160, 8, -1, 1);
GFX::DrawSprite(messageNo==4 ? sprites_icon_question_idx : sprites_icon_msg_idx, 132, -2);
if (messageNo == 5) {
Gui::DrawStringCentered(0, 68, 0.60, BLACK, "Everyone is now in Fashion Forward!");
Gui::DrawStringCentered(0, 88, 0.60, BLACK, "(Except for customers and reps.)");
Gui::DrawStringCentered(0, 114, 0.60, BLACK, "Invite them over for photo shoots,");
Gui::DrawStringCentered(0, 134, 0.60, BLACK, "as well as AR photo shoots!");
} else if (messageNo == 4) {
Gui::DrawStringCentered(0, 58, 0.60, BLACK, "Characters from the 1st, 2nd, and");
Gui::DrawStringCentered(0, 78, 0.60, BLACK, "4th games, will be added to the 3rd.");
Gui::DrawStringCentered(0, 104, 0.60, BLACK, "Characters part of downloaded");
Gui::DrawStringCentered(0, 124, 0.60, BLACK, "Caprice Chalet rooms will be");
Gui::DrawStringCentered(0, 144, 0.60, BLACK, "overwritten. Is this OK?");
} else if (messageNo == 3) {
Gui::DrawStringCentered(0, 94, 0.60, BLACK, "Failed to import character.");
} else if (messageNo == 2) {
Gui::DrawStringCentered(0, 58, 0.60, BLACK, "Character exported successfully.");
Gui::DrawStringCentered(0, 94, 0.60, BLACK, "You can go to \"Import Characters\"");
Gui::DrawStringCentered(0, 114, 0.60, BLACK, "and restore the exported character");
Gui::DrawStringCentered(0, 134, 0.60, BLACK, "at any time.");
} else if (messageNo == 1) {
Gui::DrawStringCentered(0, 94, 0.60, BLACK, chararacterImported);
} else {
Gui::DrawStringCentered(0, 84, 0.60, BLACK, "This feature is not available yet.");
//Gui::DrawStringCentered(0, 104, 0.60, BLACK, "yet.");
}
if (messageNo == 4) {
GFX::DrawSprite(sprites_button_msg_shadow_idx, 52, 197);
GFX::DrawSprite(sprites_button_msg_idx, 53, 188);
GFX::DrawSprite(sprites_button_msg_shadow_idx, 176, 197);
GFX::DrawSprite(sprites_button_msg_idx, 177, 188);
Gui::DrawString(72, 196, 0.70, MSG_BUTTONTEXT, " No");
Gui::DrawString(196, 196, 0.70, MSG_BUTTONTEXT, " Yes");
} else {
GFX::DrawSprite(sprites_button_msg_shadow_idx, 114, 197);
GFX::DrawSprite(sprites_button_msg_idx, 115, 188);
Gui::DrawString(134, 196, 0.70, MSG_BUTTONTEXT, " OK!");
}
}
void loadChrImage(bool Robz) {
previewCharacter = false;
gspWaitForVBlank();
if (import_highlightedGame == 4) {
if (numberOfExportedCharacters > 0) {
sprintf(chrFilePath, "sdmc:/3ds/SavvyManager/SS%i/characters/previews/%s.t3x", highlightedGame+1, getExportedCharacterName(importCharacterList_cursorPosition)); // All Seasons
} else {
sprintf(chrFilePath, "romfs:/gfx/null.t3x"); // All Seasons
}
previewCharacterFound = GFX::loadCharSprite(chrFilePath, chrFilePath);
} else {
sprintf(chrFilePath, "romfs:/gfx/ss%i_%s.t3x", highlightedGame+1, (Robz ? "Robz" : import_characterName())); // All Seasons
sprintf(chrFilePath2, "romfs:/gfx/ss%i_%s%i.t3x", highlightedGame+1, (Robz ? "Robz" : import_characterName()), seasonNo); // One Season
previewCharacterFound = GFX::loadCharSprite(chrFilePath, chrFilePath2);
}
previewCharacter = true;
}
static bool removeBags = false;
void addEveryone(void) {
// if (highlightedGame != 2) return;
for (int i = 0; i < 49; i++) {
sprintf(chrFilePath, "romfs:/character/Fashion Forward/All Seasons/%s.chr", import_everyCharacterNames[i]);
if (access(chrFilePath, F_OK) != 0) {
sprintf(chrFilePath, "romfs:/character/Fashion Forward/%s/%s.chr", seasonName(), import_everyCharacterNames[i]);
}
readSS3CharacterFile(0x0BB9+i, chrFilePath);
if (removeBags) {
removeSS3CharacterBag(0x0BB9+i);
}
sprintf(chrFilePath, "romfs:/character/Fashion Forward/Profiles/%s.cprf", sysRegion==CFG_REGION_EUR||sysRegion==CFG_REGION_AUS ? import_everyCharacterProfileNamesEUR[i] : import_everyCharacterNames[i]);
readSS3ProfileFile(0x0BB9+i, chrFilePath);
toggleSS3Character(0x0BB9+i, true);
}
writeSS3Save();
}
void changeCharacterGraphics(void) {
if (highlightedGame == 3) {
characterChangeMenuOps[0] = 0;
characterChangeMenuOps[1] = 0;
characterChangeMenuOps[2] = 4;
characterChangeMenuOps[3] = 10;
characterChangeMenuOptions = 3;
totalCharacters = 0x20;
readSS4Save();
} else if (highlightedGame == 2) {
characterChangeMenuOps[0] = 0;
characterChangeMenuOps[1] = 4;
characterChangeMenuOps[2] = 10;
characterChangeMenuOptions = 2;
totalCharacters = 0xE;
readSS3Save();
} else if (highlightedGame == 1) {
characterChangeMenuOps[0] = 0;
characterChangeMenuOps[1] = 4;
characterChangeMenuOps[2] = 10;
characterChangeMenuOptions = 2;
totalCharacters = 0;
readSS2Save();
}
if (import_highlightedGame == 4) {
import_totalCharacters = numberOfExportedCharacters-1;
} else if (import_highlightedGame == 3) {
import_totalCharacters = 0xD;
} else if (import_highlightedGame == 2) {
import_totalCharacters = 0x10;
} else if (import_highlightedGame == 1) {
import_totalCharacters = 0xF;
} else if (import_highlightedGame == 0) {
import_totalCharacters = 0x7;
}
C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
C2D_TargetClear(Top, TRANSPARENT);
C2D_TargetClear(Bottom, TRANSPARENT);
Gui::clearTextBufs();
Gui::ScreenDraw(Top);
GFX::showBgSprite(zoomIn);
if (previewCharacter) {
if (previewCharacterFound) {
GFX::showCharSprite(zoomIn, charFadeAlpha);
} else {
Gui::DrawStringCentered(0, 104, 0.65, WHITE, (import_highlightedGame==4 ? "Preview not found." : "Preview unavailable."));
}
switch (iFps) {
default:
charFadeAlpha += 20;
break;
case 30:
charFadeAlpha += 40;
break;
case 24:
charFadeAlpha += 55;
break;
}
if (charFadeAlpha > 255) charFadeAlpha = 255;
} else {
charFadeAlpha = 0;
}
if (showMessage && messageNo == 4) {
Gui::DrawString(8, 210, 0.50, WHITE, removeBags ? " Keep bags" : " Remove bags");
// Selected season
Gui::DrawString(160, 208, 0.65, WHITE, "L");
Gui::DrawStringCentered(0, 210, 0.50, WHITE, seasonName());
Gui::DrawString(232, 208, 0.65, WHITE, "R");
}
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
Gui::ScreenDraw(Bottom);
Gui::Draw_Rect(0, 0, 320, 240, WHITE); // Fill gaps of BG
for(int w = 0; w < 7; w++) {
for(int h = 0; h < 3; h++) {
GFX::DrawSprite(sprites_phone_bg_idx, -76+bg_xPos+w*72, bg_yPos+h*136);
}
}
cursorX = 248;
if (subScreenMode == 4) {
cursorY = 64+(48*importCharacterList_cursorPositionOnScreen);
// Game name
switch (import_highlightedGame) {
case 4:
Gui::DrawStringCentered(0, 8, 0.50, BLACK, "Your character files");
break;
case 3:
Gui::DrawStringCentered(0, 8, 0.50, BLACK, ss4Title());
break;
case 2:
Gui::DrawStringCentered(0, 8, 0.50, BLACK, ss3Title());
break;
case 1:
Gui::DrawStringCentered(0, 8, 0.50, BLACK, ss2Title());
break;
case 0:
Gui::DrawStringCentered(0, 8, 0.50, BLACK, ss1Title());
break;
}
Gui::DrawString(8, 8, 0.50, BLACK, "<");
Gui::DrawString(304, 8, 0.50, BLACK, ">");
if (import_highlightedGame != 4) {
// Selected season
Gui::DrawString(120, 208, 0.65, BLACK, "L");
Gui::DrawStringCentered(0, 210, 0.50, BLACK, seasonName());
Gui::DrawString(192, 208, 0.65, BLACK, "R");
}
if (!displayNothing) {
int i2 = 48;
for (int i = import_characterShownFirst; i < import_characterShownFirst+3; i++) {
if (import_highlightedGame == 4) {
if (i >= numberOfExportedCharacters) break;
GFX::DrawSprite(sprites_item_button_idx, 16, i2-20);
GFX::DrawSprite((getExportedCharacterGender(i) ? sprites_icon_male_idx : sprites_icon_female_idx), 12, i2-8);
Gui::DrawString(64, i2, 0.65, BLACK, getExportedCharacterName(i));
} else if (import_highlightedGame == 3) {
GFX::DrawSprite(sprites_item_button_idx, 16, i2-20);
GFX::DrawSprite((import_ss4CharacterGenders[i] ? sprites_icon_male_idx : sprites_icon_female_idx), 12, i2-8);
Gui::DrawString(64, i2, 0.65, BLACK, import_ss4CharacterNames[i]);
} else if (import_highlightedGame == 2) {
GFX::DrawSprite(sprites_item_button_idx, 16, i2-20);
GFX::DrawSprite((import_ss3CharacterGenders[i] ? sprites_icon_male_idx : sprites_icon_female_idx), 12, i2-8);
Gui::DrawString(64, i2, 0.65, BLACK, import_ss3CharacterNames[i]);
} else if (import_highlightedGame == 1) {
GFX::DrawSprite(sprites_item_button_idx, 16, i2-20);
GFX::DrawSprite((import_ss2CharacterGenders[i] ? sprites_icon_male_idx : sprites_icon_female_idx)/*+import_ss2CharacterTieColors[i]*/, 12, i2-8);
Gui::DrawString(64, i2, 0.65, BLACK, import_SS2CharacterNames(i));
} else if (import_highlightedGame == 0) {
GFX::DrawSprite(sprites_item_button_idx, 16, i2-20);
GFX::DrawSprite((import_ss1CharacterGenders[i] ? sprites_icon_male_idx : sprites_icon_female_idx), 12, i2-8);
Gui::DrawString(64, i2, 0.65, BLACK, import_ss1CharacterNames[i]);
}
i2 += 48;
}
}
} else if (subScreenMode == 1) {
cursorY = 64+(48*characterChangeMenu_cursorPositionOnScreen);
Gui::DrawString(8, 8, 0.50, BLACK, characterName(true));
int i2 = 0;
if (characterChangeMenu_optionShownFirst == 0) {
i2 += 48;
GFX::DrawSprite(sprites_item_button_idx, 16, i2-20);
Gui::DrawString(32, i2, 0.65, BLACK, "Change attributes");
}
if (highlightedGame == 3) {
i2 += 48;
GFX::DrawSprite(sprites_item_button_idx, 16, i2-20);
Gui::DrawString(32, i2, 0.65, BLACK, "Change bow placement");
}
i2 += 48;
GFX::DrawSprite(sprites_item_button_idx, 16, i2-20);
Gui::DrawString(32, i2, 0.65, BLACK, "Import character");
if (highlightedGame < 3 || characterChangeMenu_optionShownFirst == 1) {
i2 += 48;
GFX::DrawSprite(sprites_item_button_idx, 16, i2-20);
Gui::DrawString(32, i2, 0.65, BLACK, "Export character");
}
} else {
cursorY = 64+(48*characterList_cursorPositionOnScreen);
Gui::DrawString(8, 8, 0.50, BLACK, "Select the character you want to change.");
if (highlightedGame == 2) {
Gui::DrawString(116, 210, 0.50, BLACK, "START: Expand contacts");
}
if (!displayNothing) {
int i2 = 48;
for (int i = characterShownFirst; i < characterShownFirst+3; i++) {
GFX::DrawSprite(sprites_item_button_idx, 16, i2-20);
if (highlightedGame == 3) {
if (i==0) {
GFX::DrawSprite((getSS4CharacterGender(i) ? sprites_icon_male_idx : sprites_icon_female_idx), 12, i2-8);
Gui::DrawString(64, i2, 0.65, BLACK, ss4PlayerName);
} else {
GFX::DrawSprite((getSS4CharacterGender(i) ? sprites_icon_male_idx : sprites_icon_female_idx), 12, i2-8);
Gui::DrawString(64, i2, 0.65, BLACK, ss4CharacterNames[i]);
}
} else if (highlightedGame == 2) {
if (i==0) {
GFX::DrawSprite((getSS3CharacterGender(i) ? sprites_icon_male_idx : sprites_icon_female_idx), 12, i2-8);
Gui::DrawString(64, i2, 0.65, BLACK, ss3PlayerName);
} else {
GFX::DrawSprite((getSS3CharacterGender(i) ? sprites_icon_male_idx : sprites_icon_female_idx), 12, i2-8);
Gui::DrawString(64, i2, 0.65, BLACK, ss3CharacterNames[i]);
}
} else if (highlightedGame == 1) {
GFX::DrawSprite((getSS2CharacterGender() ? sprites_icon_male_idx : sprites_icon_female_idx), 12, i2-8);
Gui::DrawString(64, i2, 0.65, BLACK, ss2PlayerName);
break;
}
i2 += 48;
}
}
}
GFX::DrawSprite(sprites_button_shadow_idx, 5, 199);
GFX::DrawSprite(sprites_button_red_idx, 5, 195);
GFX::DrawSprite(sprites_arrow_back_idx, 19, 195);
GFX::DrawSprite(sprites_button_b_idx, 44, 218);
GFX::drawCursor();
if (showMessage) {
drawMsg();
}
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
C3D_FrameEnd(0);
if (hDown & KEY_CPAD_UP) {
zoomIn++;
if (zoomIn > 2) zoomIn = 2;
}
if (hDown & KEY_CPAD_DOWN) {
zoomIn--;
if (zoomIn < 0) zoomIn = 0;
}
}
void changeCharacter(void) {
if (!fadein && !fadeout) {
if (showMessage) {
if (messageNo == 4) {
if ((hDown & KEY_A) || ((hDown & KEY_TOUCH) && touch.px >= 176 && touch.px < 176+90 && touch.py >= 188 && touch.py < 188+47)) {
sndSelect();
addEveryone();
messageNo = 5;
}
if ((hDown & KEY_B) || ((hDown & KEY_TOUCH) && touch.px >= 52 && touch.px < 52+90 && touch.py >= 188 && touch.py < 188+47)) {
sndBack();
showMessage = false;
}
if (hDown & KEY_Y) {
sndHighlight();
removeBags = !removeBags;
}
if ((hDown & KEY_L) || (hDown & KEY_ZL)) {
sndHighlight();
seasonNo--;
if (seasonNo < 0) seasonNo = 3;
}
if ((hDown & KEY_R) || (hDown & KEY_ZR)) {
sndHighlight();
seasonNo++;
if (seasonNo > 3) seasonNo = 0;
}
} else {
if ((hDown & KEY_A) || ((hDown & KEY_TOUCH) && touch.px >= 115 && touch.px < 115+90 && touch.py >= 188 && touch.py < 188+47)) {
sndSelect();
if (messageNo == 5) {
messageNo = 1;
sprintf(chararacterImported, "Characters imported successfully.");
} else {
if (subScreenMode == 1) {
previewCharacter = false;
}
showMessage = false;
}
}
}
} else if (subScreenMode == 4) {
bool robzAction = false;
if (hDown) {
cheatKeys[cheatKeyPosition] = hDown;
cheatKeyPosition++;
}
robzAction = ((cheatKeys[0] & KEY_DUP)
&& (cheatKeys[1] & KEY_DUP)
&& (cheatKeys[2] & KEY_DDOWN)
&& (cheatKeys[3] & KEY_DDOWN)
&& (cheatKeys[4] & KEY_DLEFT)
&& (cheatKeys[5] & KEY_DRIGHT)
&& (cheatKeys[6] & KEY_DLEFT)
&& (cheatKeys[7] & KEY_DRIGHT)
&& (cheatKeys[8] & KEY_B)
&& (cheatKeys[9] & KEY_A));
if (cheatKeyPosition==10
|| ((cheatKeys[0] != 0) && !(cheatKeys[0] & KEY_DUP))
|| ((cheatKeys[1] != 0) && !(cheatKeys[1] & KEY_DUP))
|| ((cheatKeys[2] != 0) && !(cheatKeys[2] & KEY_DDOWN))
|| ((cheatKeys[3] != 0) && !(cheatKeys[3] & KEY_DDOWN))
|| ((cheatKeys[4] != 0) && !(cheatKeys[4] & KEY_DLEFT))
|| ((cheatKeys[5] != 0) && !(cheatKeys[5] & KEY_DRIGHT))
|| ((cheatKeys[6] != 0) && !(cheatKeys[6] & KEY_DLEFT))
|| ((cheatKeys[7] != 0) && !(cheatKeys[7] & KEY_DRIGHT))
|| ((cheatKeys[8] != 0) && !(cheatKeys[8] & KEY_B))
|| ((cheatKeys[9] != 0) && !(cheatKeys[9] & KEY_A))) {
for (int i= 0; i < 10; i++) {
cheatKeys[i] = 0;
}
cheatKeyPosition = 0;
}
if (showCursor) {
if (hDown & KEY_DUP) {
sndHighlight();
importCharacterList_cursorPosition--;
importCharacterList_cursorPositionOnScreen--;
if (importCharacterList_cursorPosition < 0) {
importCharacterList_cursorPosition = 0;
import_characterShownFirst = 0;
} else if (importCharacterList_cursorPosition < import_characterShownFirst) {
import_characterShownFirst--;
}
if (importCharacterList_cursorPositionOnScreen < 0) {
importCharacterList_cursorPositionOnScreen = 0;
}
loadChrImage(false);
}
if (hDown & KEY_DDOWN) {
sndHighlight();
importCharacterList_cursorPosition++;
importCharacterList_cursorPositionOnScreen++;
if (importCharacterList_cursorPosition > import_totalCharacters) {
importCharacterList_cursorPosition = import_totalCharacters;
import_characterShownFirst = import_totalCharacters-2;
if (import_characterShownFirst < 0) import_characterShownFirst = 0;
if (importCharacterList_cursorPositionOnScreen > import_totalCharacters) {
importCharacterList_cursorPositionOnScreen = import_totalCharacters;
}
} else if (importCharacterList_cursorPosition > import_characterShownFirst+2) {
import_characterShownFirst++;
}
if (importCharacterList_cursorPositionOnScreen > 2) {
importCharacterList_cursorPositionOnScreen = 2;
}
loadChrImage(false);
}
}
if (hDown & KEY_A) {
if (robzAction) {
sndSelect();
switch (highlightedGame) {
case 3:
sprintf(chrFilePath, "romfs:/character/Styling Star/All Seasons/%s.chr", "Robz");
if (access(chrFilePath, F_OK) != 0) {
sprintf(chrFilePath, "romfs:/character/Styling Star/%s/%s.chr", seasonName(), "Robz");
}
readSS4CharacterFile(characterList_cursorPosition, chrFilePath);
writeSS4Save();
break;
case 2:
sprintf(chrFilePath, "romfs:/character/Fashion Forward/All Seasons/%s.chr", "Robz");
if (access(chrFilePath, F_OK) != 0) {
sprintf(chrFilePath, "romfs:/character/Fashion Forward/%s/%s.chr", seasonName(), "Robz");
}
readSS3CharacterFile(characterList_cursorPosition, chrFilePath);
writeSS3Save();
break;
case 1:
sprintf(chrFilePath, "romfs:/character/Trendsetters/All Seasons/%s.chr", "Robz");
if (access(chrFilePath, F_OK) != 0) {
sprintf(chrFilePath, "romfs:/character/Trendsetters/%s/%s.chr", seasonName(), "Robz");
}
readSS2CharacterFile(chrFilePath);
writeSS2Save();
break;
}
loadChrImage(true);
sprintf(chararacterImported, "Imported %s successfully.", "Robz");
messageNo = 1;
subScreenMode = 1;
showMessage = true;
} else if (import_highlightedGame == 4 && numberOfExportedCharacters > 0) {
bool exportFound = false;
switch (highlightedGame) {
case 3:
sprintf(chrFilePath, "sdmc:/3ds/SavvyManager/SS4/characters/%s.chr", getExportedCharacterName(importCharacterList_cursorPosition));
if (access(chrFilePath, F_OK) == 0) {
sndSelect();
readSS4CharacterFile(characterList_cursorPosition, chrFilePath);
writeSS4Save();
exportFound = true;
}
break;
case 2:
sprintf(chrFilePath, "sdmc:/3ds/SavvyManager/SS3/characters/%s.chr", getExportedCharacterName(importCharacterList_cursorPosition));
if (access(chrFilePath, F_OK) == 0) {
sndSelect();
readSS3CharacterFile(characterList_cursorPosition, chrFilePath);
writeSS3Save();
exportFound = true;
}
break;
case 1:
sprintf(chrFilePath, "sdmc:/3ds/SavvyManager/SS2/characters/%s.chr", getExportedCharacterName(importCharacterList_cursorPosition));
if (access(chrFilePath, F_OK) == 0) {
sndSelect();
readSS2CharacterFile(chrFilePath);
writeSS2Save();
exportFound = true;
}
break;
}
if (exportFound) {
sprintf(chararacterImported, "Imported %s successfully.", getExportedCharacterName(importCharacterList_cursorPosition));
messageNo = 1;
subScreenMode = 1;
} else {
sndBack();
messageNo = 3;
}
showMessage = true;
} else if (import_highlightedGame != 4) {
sndSelect();
switch (highlightedGame) {
case 3:
sprintf(chrFilePath, "romfs:/character/Styling Star/All Seasons/%s.chr", import_characterName());
if (access(chrFilePath, F_OK) != 0) {
sprintf(chrFilePath, "romfs:/character/Styling Star/%s/%s.chr", seasonName(), import_characterName());
}
readSS4CharacterFile(characterList_cursorPosition, chrFilePath);
writeSS4Save();
break;
case 2:
sprintf(chrFilePath, "romfs:/character/Fashion Forward/All Seasons/%s.chr", import_characterName());
if (access(chrFilePath, F_OK) != 0) {
sprintf(chrFilePath, "romfs:/character/Fashion Forward/%s/%s.chr", seasonName(), import_characterName());
}
readSS3CharacterFile(characterList_cursorPosition, chrFilePath);
writeSS3Save();
break;
case 1:
sprintf(chrFilePath, "romfs:/character/Trendsetters/All Seasons/%s.chr", import_characterName());
if (access(chrFilePath, F_OK) != 0) {
sprintf(chrFilePath, "romfs:/character/Trendsetters/%s/%s.chr", seasonName(), import_characterName());
}
readSS2CharacterFile(chrFilePath);
writeSS2Save();
break;
}
sprintf(chararacterImported, "Imported %s successfully.", import_characterNameDisplay());
messageNo = 1;
subScreenMode = 1;
showMessage = true;
}
}
if (hDown & KEY_DLEFT) {
sndHighlight();
import_highlightedGame--;
if (import_highlightedGame < 0) import_highlightedGame = 4;
}
if (hDown & KEY_DRIGHT) {
sndHighlight();
import_highlightedGame++;
if (import_highlightedGame > 4) import_highlightedGame = 0;
}
if ((hDown & KEY_DLEFT) || (hDown & KEY_DRIGHT)) {
importCharacterList_cursorPosition = 0;
importCharacterList_cursorPositionOnScreen = 0;
import_characterShownFirst = 0;
if (import_highlightedGame == 4) {
previewCharacter = false;
if (!exportedCharListGotten[highlightedGame]) {
displayNothing = true;
gspWaitForVBlank();
getExportedCharacterContents();
exportedCharListGotten[highlightedGame] = true;
displayNothing = false;
}
}
loadChrImage(false);
}
if (import_highlightedGame != 4) {
if ((hDown & KEY_L) || (hDown & KEY_ZL)) {
sndHighlight();
seasonNo--;
if (seasonNo < 0) seasonNo = 3;
loadChrImage(false);
}
if ((hDown & KEY_R) || (hDown & KEY_ZR)) {
sndHighlight();
seasonNo++;
if (seasonNo > 3) seasonNo = 0;
loadChrImage(false);
}
}
if (((hDown & KEY_B) && !(cheatKeys[8] & KEY_B))
|| ((hDown & KEY_TOUCH) && touchingBackButton())) {
sndBack();
subScreenMode = 1;
previewCharacter = false;
}
} else if (subScreenMode == 1) {
if (showCursor) {
if (hDown & KEY_DUP) {
sndHighlight();
characterChangeMenu_cursorPosition--;
characterChangeMenu_cursorPositionOnScreen--;
if (characterChangeMenu_cursorPosition < 0) {
characterChangeMenu_cursorPosition = 0;
characterChangeMenu_optionShownFirst = 0;
} else if (characterChangeMenu_cursorPosition < characterChangeMenu_optionShownFirst) {
characterChangeMenu_optionShownFirst--;
}
if (characterChangeMenu_cursorPositionOnScreen < 0) {
characterChangeMenu_cursorPositionOnScreen = 0;
}
}
if (hDown & KEY_DDOWN) {
sndHighlight();
characterChangeMenu_cursorPosition++;
characterChangeMenu_cursorPositionOnScreen++;
if (characterChangeMenu_cursorPosition > characterChangeMenuOptions) {
characterChangeMenu_cursorPosition = characterChangeMenuOptions;
characterChangeMenu_optionShownFirst = characterChangeMenuOptions-2;
} else if (characterChangeMenu_cursorPosition > characterChangeMenu_optionShownFirst+2) {
characterChangeMenu_optionShownFirst++;
}
if (characterChangeMenu_cursorPositionOnScreen > 2) {
characterChangeMenu_cursorPositionOnScreen = 2;
}
}
}
if (hDown & KEY_A) {
if (characterChangeMenuOps[characterChangeMenu_cursorPosition] == 0) {
sndBack();
messageNo = 0;
showMessage = true;
} else if (characterChangeMenuOps[characterChangeMenu_cursorPosition] == 10) {
// Export character
sndSelect();
switch (highlightedGame) {
case 3:
sprintf(chrFilePath, "sdmc:/3ds/SavvyManager/SS4/characters/%s.chr", characterName(false));
writeSS4CharacterFile(characterList_cursorPosition, chrFilePath);
break;
case 2:
sprintf(chrFilePath, "sdmc:/3ds/SavvyManager/SS3/characters/%s.chr", characterName(false));
writeSS3CharacterFile(characterList_cursorPosition, chrFilePath);
break;
case 1:
sprintf(chrFilePath, "sdmc:/3ds/SavvyManager/SS2/characters/%s.chr", characterName(false));
writeSS2CharacterFile(chrFilePath);
break;
}
exportedCharListGotten[highlightedGame] = false;
messageNo = 2;
showMessage = true;
} else {
sndSelect();
displayNothing = true;
subScreenMode = characterChangeMenuOps[characterChangeMenu_cursorPosition];
if ((subScreenMode == 4) && (import_highlightedGame == 4) && !exportedCharListGotten[highlightedGame]) {
gspWaitForVBlank();
getExportedCharacterContents();
exportedCharListGotten[highlightedGame] = true;
}
displayNothing = false;
loadChrImage(false);
}
}
if ((hDown & KEY_B) || ((hDown & KEY_TOUCH) && touchingBackButton())) {
sndBack();
subScreenMode = 0;
}
} else {
if (showCursor) {
if ((hDown & KEY_DUP) && (highlightedGame > 1)) {
sndHighlight();
characterList_cursorPosition--;
characterList_cursorPositionOnScreen--;
if (characterList_cursorPosition < 0) {
characterList_cursorPosition = 0;
characterShownFirst = 0;
} else if (characterList_cursorPosition < characterShownFirst) {
characterShownFirst--;
}
if (characterList_cursorPositionOnScreen < 0) {
characterList_cursorPositionOnScreen = 0;
}
}
if ((hDown & KEY_DDOWN) && (highlightedGame > 1)) {
sndHighlight();
characterList_cursorPosition++;
characterList_cursorPositionOnScreen++;
if (characterList_cursorPosition > totalCharacters) {
characterList_cursorPosition = totalCharacters;
characterShownFirst = totalCharacters-2;
} else if (characterList_cursorPosition > characterShownFirst+2) {
characterShownFirst++;
}
if (characterList_cursorPositionOnScreen > 2) {
characterList_cursorPositionOnScreen = 2;
}
}
}
if (hDown & KEY_A) {
sndSelect();
subScreenMode = 1;
}
if ((hDown & KEY_B) || ((hDown & KEY_TOUCH) && touchingBackButton())) {
sndBack();
characterList_cursorPosition = 0;
characterList_cursorPositionOnScreen = 0;
characterShownFirst = 0;
characterChangeMenu_cursorPosition = 0;
characterChangeMenu_cursorPositionOnScreen = 0;
characterChangeMenu_optionShownFirst = 0;
screenmodebuffer = SCREEN_MODE_WHAT_TO_DO;
fadeout = true;
}
if ((hDown & KEY_START) && (highlightedGame == 2)) {
sndSelect();
messageNo = 4;
showMessage = true;
}
}
}
}

View File

@ -18,9 +18,9 @@ extern int cursorY;
extern int cursorAlpha;
Result GFX::loadSheets() {
sprites = C2D_SpriteSheetLoad("romfs:/gfx/sprites.t3x");
gameSelSprites = C2D_SpriteSheetLoad("romfs:/gfx/gameSelSprites.t3x");
gameShotSprites = C2D_SpriteSheetLoad("romfs:/gfx/gameShotSprites.t3x");
sprites = C2D_SpriteSheetLoad("romfs:/gfx/sprites.t3x");
gameSelSprites = C2D_SpriteSheetLoad("romfs:/gfx/gameSelSprites.t3x");
gameShotSprites = C2D_SpriteSheetLoad("romfs:/gfx/gameShotSprites.t3x");
GFX::loadBgSprite();
return 0;
}
@ -55,8 +55,8 @@ void GFX::loadBgSprite(void) {
bgPath = "romfs:/gfx/bgNight_bougainville.t3x";
break;
}
bgSprite = C2D_SpriteSheetLoad(bgPath);
doBgSpriteFree = true;
bgSprite = C2D_SpriteSheetLoad(bgPath);
doBgSpriteFree = true;
}
bool GFX::loadCharSprite(const char* t3xPathAllSeasons, const char* t3xPathOneSeason) {
@ -118,10 +118,10 @@ void GFX::DrawSpriteBlend(int key, float x, float y, u32 color, float ScaleX, fl
C2D_DrawImageAt(C2D_SpriteSheetGetImage(sprites, key), x, y, 0.5f, &tint, ScaleX, ScaleY);
}
void GFX::drawCursor(void) {
void GFX::drawCursor(int cX, int cY) {
if (cursorAlpha == 255) {
DrawSprite(sprites_cursor_idx, cursorX, cursorY);
DrawSprite(sprites_cursor_idx, cX, cY);
} else if (cursorAlpha > 0) {
DrawSpriteBlend(sprites_cursor_idx, cursorX, cursorY, C2D_Color32(255, 255, 255, cursorAlpha));
DrawSpriteBlend(sprites_cursor_idx, cX, cY, C2D_Color32(255, 255, 255, cursorAlpha));
}
}

View File

@ -9,25 +9,25 @@
#include "common.hpp"
#include "screenMode.h"
#include "dumpdsp.h"
#include "gameSelect.hpp"
#include "inifile.h"
#include "rocketRobz.hpp"
#include "savedata.h"
//#include "settings.h"
#include "screen.hpp"
#include "sound.h"
#include "thread.h"
bool isInit = true;
int delay = 0;
Handle threadRequest;
#define settingsIni "sdmc:/3ds/SavvyManager/settings.ini"
#define CONFIG_3D_SLIDERSTATE (*(float *)0x1FF81080)
static char verText[32];
extern int iFps;
extern void loadSettings(void);
extern void saveSettings(void);
static int screenmode = 0; // Current screen mode.
int screenmodebuffer = 0;
static int screenDelay = 0;
char verText[32];
int studioBg = 0;
int iFps = 60;
std::string currentMusicPack = "";
//sound *music = NULL;
sound *sfx_select = NULL;
@ -35,10 +35,31 @@ sound *sfx_back = NULL;
sound *sfx_highlight = NULL;
bool dspfirmfound = false;
bool exiting = false;
//static bool musicPlaying = false;
static bool screenoff_ran = false;
static bool screenon_ran = true;
void loadSettings(void) {
CIniFile settingsini(settingsIni);
studioBg = settingsini.GetInt("SAVVY-MANAGER", "STUDIO_BG", studioBg);
iFps = settingsini.GetInt("SAVVY-MANAGER", "FRAME_RATE", iFps);
currentMusicPack = settingsini.GetString("SS2", "CURRENT_MUSIC_PACK", currentMusicPack);
}
void saveSettings(void) {
CIniFile settingsini(settingsIni);
settingsini.SetInt("SAVVY-MANAGER", "STUDIO_BG", studioBg);
settingsini.SetInt("SAVVY-MANAGER", "FRAME_RATE", iFps);
settingsini.SetString("SS2", "CURRENT_MUSIC_PACK", currentMusicPack);
settingsini.SaveIniFileModified(settingsIni);
}
/*static void Play_Music(void) {
if (!musicPlaying && dspfirmfound) {
music->play();
@ -81,7 +102,7 @@ void screenoff(void)
void screenon(void)
{
screenoff_ran = false;
screenoff_ran = false;
if(!screenon_ran) {
if (R_SUCCEEDED(gspLcdInit())) {
GSPLCD_PowerOnBacklight(GSPLCD_SCREEN_BOTH);
@ -94,229 +115,37 @@ void screenon(void)
u8 sysRegion = CFG_REGION_USA;
int highlightedGame = 1;
int fadealpha = 255;
int fadecolor = 0;
bool fadein = true;
bool fadeout = false;
int text_width = 0;
const char* yeartext = "2019-2020 RocketRobz";
//const char* yeartext2 = "Games 2008-2017 Nintendo & syn Sophia";
float bg_xPos = 0.0f;
float bg_yPos = 0.0f;
bool showCursor = false;
int cursorX = 0;
int cursorY = 0;
static int whatToChange_cursorPosition = 0;
int cursorAlpha = 0;
static bool showMessage = false;
static int messageNo = 0;
static void drawCannotEditMsg(void) {
GFX::DrawSprite(sprites_msg_idx, 0, 8, 1, 1);
GFX::DrawSprite(sprites_msg_idx, 160, 8, -1, 1);
GFX::DrawSprite(sprites_icon_msg_idx, 132, -2);
if (messageNo == 2) {
Gui::DrawStringCentered(0, 58, 0.60, BLACK, "This game's title ID");
Gui::DrawStringCentered(0, 78, 0.60, BLACK, "is not known.");
Gui::DrawStringCentered(0, 112, 0.60, BLACK, "As a result, the save data");
Gui::DrawStringCentered(0, 132, 0.60, BLACK, "cannot be edited.");
} else if (messageNo == 1) {
if (highlightedGame == 0) {
Gui::DrawStringCentered(0, 58, 0.60, BLACK, "Save data not found.");
Gui::DrawStringCentered(0, 90, 0.60, BLACK, /*highlightedGame==3 ? "Please back up the extra data using" :*/ "Please back it up using");
Gui::DrawStringCentered(0, 110, 0.60, BLACK, "Checkpoint, and name the backup:");
Gui::DrawStringCentered(0, 134, 0.60, BLACK, "SavvyManager");
} else {
Gui::DrawStringCentered(0, 94, 0.60, BLACK, "Save data not found.");
}
} else {
switch (sysRegion) {
default:
Gui::DrawStringCentered(0, 92, 0.60, BLACK, "Cannot edit Style Savvy's");
break;
case CFG_REGION_EUR:
case CFG_REGION_AUS:
Gui::DrawStringCentered(0, 92, 0.60, BLACK, "Cannot edit Style Boutique's");
break;
case CFG_REGION_JPN:
Gui::DrawStringCentered(0, 92, 0.60, BLACK, "Cannot edit Girls Mode's");
case CFG_REGION_KOR:
Gui::DrawStringCentered(0, 92, 0.60, BLACK, "Cannot edit Girls Style's");
break;
}
Gui::DrawStringCentered(0, 112, 0.60, BLACK, "save data yet.");
}
GFX::DrawSprite(sprites_button_msg_shadow_idx, 114, 197);
GFX::DrawSprite(sprites_button_msg_idx, 115, 188);
Gui::DrawString(134, 196, 0.70, MSG_BUTTONTEXT, " OK!");
}
int ss1Logo = gameSelSprites_title1_idx;
int ss2Screenshot = gameShotSprites_title2_screenshot_idx;
int ss2Logo = gameSelSprites_title2_idx;
int ss1LogoXpos = 0;
int ssLogoXpos = 0;
int ss3Logo = gameSelSprites_title3_idx;
int ss4Logo = gameSelSprites_title4_idx;
u32 hDown = 0;
u32 hHeld = 0;
touchPosition touch;
bool touchingBackButton(void) {
return (touch.px >= 7 && touch.px < 7+40 && touch.py >= 197 && touch.py < 197+44);
}
static bool runSelection = false;
static bool ss2SaveFound = false;
static bool ss3SaveFound = false;
static bool ss4SaveFound = false;
bool ss2SaveFound = false;
bool ss3SaveFound = false;
bool ss4SaveFound = false;
static bool runThreads = true;
void controlThread(void) {
while (runThreads) {
svcWaitSynchronization(threadRequest, U64_MAX);
if (screenmode == SCREEN_MODE_GAME_SELECT) {
//Play_Music();
if (showMessage) {
if ((hDown & KEY_A) || ((hDown & KEY_TOUCH) && touch.px >= 115 && touch.px < 115+90 && touch.py >= 188 && touch.py < 188+47)) {
sndSelect();
showMessage = false;
}
} else if (!fadein && !fadeout) {
if ((hDown & KEY_LEFT) || ((hDown & KEY_TOUCH) && touch.px >= 0 && touch.px < 32 && touch.py >= 104 && touch.py < 104+32)) {
sndHighlight();
highlightedGame--;
if (highlightedGame < 0) highlightedGame = (sysRegion==CFG_REGION_KOR ? 1 : 3);
} else if ((hDown & KEY_RIGHT) || ((hDown & KEY_TOUCH) && touch.px >= 320-32 && touch.px < 320 && touch.py >= 104 && touch.py < 104+32)) {
sndHighlight();
highlightedGame++;
if (highlightedGame > (sysRegion==CFG_REGION_KOR ? 1 : 3)) highlightedGame = 0;
}
if ((hDown & KEY_A) || ((hDown & KEY_TOUCH) && touch.px >= 32 && touch.px < 320-32 && touch.py >= 56 && touch.py < 56+128)) {
if (highlightedGame==0) {
sndBack();
messageNo = 0;
showMessage = true;
} else if (highlightedGame==1 && sysRegion==CFG_REGION_KOR) {
sndBack();
messageNo = 2;
showMessage = true;
} else if ((highlightedGame==1 && ss2SaveFound)
|| (highlightedGame==2 && ss3SaveFound)
|| (highlightedGame==3 && ss4SaveFound))
{
sndSelect();
screenmodebuffer = SCREEN_MODE_WHAT_TO_DO;
fadeout = true;
} else {
sndBack();
messageNo = 1;
showMessage = true;
}
}
if (hDown & KEY_START) {
sndBack();
screenmodebuffer = SCREEN_MODE_EXIT;
fadecolor = 0;
fadeout = true;
}
if (hDown & KEY_SELECT) {
sndSelect();
screenmodebuffer = SCREEN_MODE_SETTINGS;
fadeout = true;
}
}
} else if (screenmode == SCREEN_MODE_SETTINGS) {
extern void settingsMenu(void);
settingsMenu();
} else if (screenmode == SCREEN_MODE_WHAT_TO_DO) {
if (showMessage) {
if ((hDown & KEY_A) || ((hDown & KEY_TOUCH) && touch.px >= 115 && touch.px < 115+90 && touch.py >= 188 && touch.py < 188+47)) {
sndSelect();
showMessage = false;
}
} else if (!fadein && !fadeout) {
if (highlightedGame > 0 && showCursor) {
if (hDown & KEY_LEFT) {
sndHighlight();
if (highlightedGame > 1) {
if (whatToChange_cursorPosition == 2) whatToChange_cursorPosition = 0;
else if (whatToChange_cursorPosition == 0) whatToChange_cursorPosition = 2;
} else {
whatToChange_cursorPosition--;
if (whatToChange_cursorPosition < 0) whatToChange_cursorPosition = 1;
}
} else if (hDown & KEY_RIGHT) {
sndHighlight();
if (highlightedGame > 1) {
if (whatToChange_cursorPosition == 0) whatToChange_cursorPosition = 2;
else if (whatToChange_cursorPosition == 2) whatToChange_cursorPosition = 0;
} else {
whatToChange_cursorPosition++;
if (whatToChange_cursorPosition > 1) whatToChange_cursorPosition = 0;
}
}
}
if (hDown & KEY_A) {
runSelection = true;
}
if ((hDown & KEY_TOUCH) && touch.px >= 71 && touch.px <= 248 && touch.py >= 91 && touch.py <= 136) {
if (touch.px < 120) {
whatToChange_cursorPosition = 0;
runSelection = true;
}
if ((touch.px > 134) && (touch.px < 185) && highlightedGame==1) {
whatToChange_cursorPosition = 1;
runSelection = true;
}
if ((touch.px > 198) && highlightedGame > 1) {
whatToChange_cursorPosition = 2;
runSelection = true;
}
}
if (runSelection) {
sndSelect();
switch (whatToChange_cursorPosition) {
case 0:
if ((highlightedGame==1 && ss2SaveFound)
|| (highlightedGame==2 && ss3SaveFound)
|| (highlightedGame==3 && ss4SaveFound))
{
screenmodebuffer = SCREEN_MODE_CHANGE_CHARACTER;
} else {
sndBack();
messageNo = 1;
showMessage = true;
}
break;
case 1:
screenmodebuffer = SCREEN_MODE_CHANGE_MUSIC;
break;
case 2:
screenmodebuffer = SCREEN_MODE_CHANGE_EMBLEM;
break;
}
fadeout = true;
runSelection = false;
}
if ((hDown & KEY_B) || ((hDown & KEY_TOUCH) && touchingBackButton())) {
sndBack();
screenmodebuffer = SCREEN_MODE_GAME_SELECT;
fadeout = true;
}
}
} else if (screenmode == SCREEN_MODE_CHANGE_CHARACTER) {
extern void changeCharacter(void);
changeCharacter();
} else if (screenmode == SCREEN_MODE_CHANGE_MUSIC) {
extern void changeMusic(void);
changeMusic();
} else if (screenmode == SCREEN_MODE_CHANGE_EMBLEM) {
extern void changeEmblem(void);
changeEmblem();
}
Gui::ScreenLogic(hDown, hHeld, touch, true); // Call the logic of the current screen here.
svcClearEvent(threadRequest);
}
}
@ -324,12 +153,8 @@ void controlThread(void) {
int main()
{
screenoff();
aptInit();
amInit();
romfsInit();
srvInit();
hidInit();
Result res = cfguInit();
if (R_SUCCEEDED(res)) {
CFGU_SecureInfoGetRegion(&sysRegion);
@ -337,11 +162,12 @@ int main()
}
gfxInitDefault();
loadSettings();
Gui::init();
GFX::loadSheets();
fadein = true;
fadealpha = 255;
// make folders if they don't exist
mkdir("sdmc:/3ds", 0777);
@ -387,17 +213,17 @@ int main()
// Style Savvy: Fashion Forward folders
//mkdir("sdmc:/luma/titles/0004000000196500", 0777);
if( access( "sdmc:/3ds/dspfirm.cdc", F_OK ) != -1 ) {
if ( access( "sdmc:/3ds/dspfirm.cdc", F_OK ) != -1 ) {
ndspInit();
dspfirmfound = true;
}else{
} else {
C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
Gui::ScreenDraw(Bottom);
Gui::DrawString(12, 16, 0.5f, WHITE, "Dumping DSP firm...");
C3D_FrameEnd(0);
screenon();
dumpDsp();
if( access( "sdmc:/3ds/dspfirm.cdc", F_OK ) != -1 ) {
if ( access( "sdmc:/3ds/dspfirm.cdc", F_OK ) != -1 ) {
ndspInit();
dspfirmfound = true;
} else {
@ -425,14 +251,6 @@ int main()
u32 ss3Id = 0x00196500;
u32 ss4Id = 0x00001C25;
int ss1Logo = gameSelSprites_title1_idx;
int ss2Screenshot = gameShotSprites_title2_screenshot_idx;
int ss2Logo = gameSelSprites_title2_idx;
int ss1LogoXpos = 0;
int ssLogoXpos = 0;
int ss3Logo = gameSelSprites_title3_idx;
int ss4Logo = gameSelSprites_title4_idx;
switch (sysRegion) {
case CFG_REGION_EUR:
case CFG_REGION_AUS:
@ -498,8 +316,10 @@ int main()
screenon();
Gui::setScreen(std::make_unique<RocketRobz>(), false); // Set screen to RocketRobz's screen.
svcCreateEvent(&threadRequest,(ResetType)0);
createThread((ThreadFunc)controlThread);
//Play_Music();
// Loop as long as the status is not exit
while(aptMainLoop()) {
@ -507,214 +327,29 @@ int main()
hidScanInput();
hDown = hidKeysDown();
//const u32 hHeld = hidKeysHeld();
hHeld = hidKeysHeld();
hidTouchRead(&touch);
if (screenmode != SCREEN_MODE_ROCKETROBZ) {
screenDelay = 0;
// Here we draw the actual screen.
C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
C2D_TargetClear(Top, TRANSPARENT);
C2D_TargetClear(Bottom, TRANSPARENT);
Gui::clearTextBufs();
Gui::DrawScreen();
C3D_FrameEnd(0);
if (exiting) {
if (!fadeout) break;
}
if (screenmode == SCREEN_MODE_EXIT) {
C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
C2D_TargetClear(Top, TRANSPARENT);
C2D_TargetClear(Bottom, TRANSPARENT);
Gui::clearTextBufs();
Gui::ScreenDraw(Top);
Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, 255)); // Fade in/out effect
Gui::ScreenDraw(Bottom);
Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, 255)); // Fade in/out effect
C3D_FrameEnd(0);
break;
} else if (screenmode == SCREEN_MODE_ROCKETROBZ) {
C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
C2D_TargetClear(Top, TRANSPARENT);
C2D_TargetClear(Bottom, TRANSPARENT);
Gui::clearTextBufs();
Gui::ScreenDraw(Top);
GFX::DrawSprite(sprites_logo_rocketrobz_idx, 0, 0);
Gui::DrawString(8, 218, 0.50, BLACK, yeartext);
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
Gui::ScreenDraw(Bottom);
Gui::Draw_Rect(0, 0, 320, 240, WHITE);
/*text_width = 104;
Gui::DrawString(((320-text_width)/2), 100, 0.50, BLACK, yeartext);
text_width = 264;
Gui::DrawString(((320-text_width)/2), 116, 0.50, BLACK, yeartext2);*/
//GFX::DrawSprite(sprites_logo_SSanniversary_idx, 32, 24);
GFX::DrawSprite(sprites_logo_UniversalCore_idx, 0, 26);
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
C3D_FrameEnd(0);
screenDelay++;
if(screenDelay > iFps*3){
screenmodebuffer = SCREEN_MODE_GAME_SELECT;
fadeout = true;
if (isInit) {
delay++;
if (delay > iFps*3) {
Gui::setScreen(std::make_unique<GameSelect>(), true); // Set after delay to the GameSelect screen.
isInit = false;
}
} else if (screenmode == SCREEN_MODE_GAME_SELECT) {
C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
C2D_TargetClear(Top, TRANSPARENT);
C2D_TargetClear(Bottom, TRANSPARENT);
Gui::clearTextBufs();
Gui::ScreenDraw(Top);
/*for(int w = 0; w < 7; w++) {
for(int h = 0; h < 3; h++) {
Gui::sprite(sprites_phone_bg_idx, -72+bg_xPos+w*72, bg_yPos+h*136);
}
}*/
switch(highlightedGame) {
case 0:
default:
GFX::DrawGameShotSprite(gameShotSprites_title1_screenshot_idx, 0, 0);
break;
case 1:
GFX::DrawGameShotSprite(ss2Screenshot, 0, 0);
break;
case 2:
GFX::DrawGameShotSprite(gameShotSprites_title3_screenshot_idx, 0, 0);
break;
case 3:
GFX::DrawGameShotSprite(gameShotSprites_title4_screenshot_idx, 0, 0);
break;
}
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
Gui::ScreenDraw(Bottom);
Gui::Draw_Rect(0, 0, 320, 240, WHITE); // Fill gaps of BG
for(int w = 0; w < 7; w++) {
for(int h = 0; h < 3; h++) {
GFX::DrawSprite(sprites_phone_bg_idx, -76+bg_xPos+w*72, bg_yPos+h*136);
}
}
Gui::DrawString(8, 8, 0.50, BLACK, "Select a game to manage its save data.");
switch(highlightedGame) {
case 0:
default:
GFX::DrawGameSelSprite(ss1Logo, ss1LogoXpos, 56);
break;
case 1:
GFX::DrawGameSelSprite(ss2Logo, ssLogoXpos, 56);
break;
case 2:
GFX::DrawGameSelSprite(ss3Logo, 0, 56);
break;
case 3:
GFX::DrawGameSelSprite(ss4Logo, ssLogoXpos, 56);
break;
}
Gui::DrawString(8, 112, 0.55, BLACK, "<");
Gui::DrawString(304, 112, 0.55, BLACK, ">");
Gui::DrawString(8, 202, 0.50, BLACK, "START: Exit");
Gui::DrawString(8, 218, 0.50, BLACK, "SELECT: Settings");
Gui::DrawString(248, 218, 0.50, BLACK, verText);
if (showMessage) {
drawCannotEditMsg();
}
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
C3D_FrameEnd(0);
} else if (screenmode == SCREEN_MODE_SETTINGS) {
extern void settingsMenuGraphics(void);
settingsMenuGraphics();
} else if (screenmode == SCREEN_MODE_WHAT_TO_DO) {
if ((highlightedGame == 0)
|| (highlightedGame > 1 && whatToChange_cursorPosition == 1)
|| (highlightedGame < 2 && whatToChange_cursorPosition == 2)) {
whatToChange_cursorPosition = 0;
}
switch (whatToChange_cursorPosition) {
case 0:
default:
cursorX = 80;
cursorY = 104;
break;
case 1:
cursorX = 148;
cursorY = 104;
break;
case 2:
cursorX = 212;
cursorY = 104;
break;
}
C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
C2D_TargetClear(Top, TRANSPARENT);
C2D_TargetClear(Bottom, TRANSPARENT);
Gui::clearTextBufs();
Gui::ScreenDraw(Top);
Gui::Draw_Rect(0, 0, 400, 240, WHITE); // Fill gaps of BG
for(int w = 0; w < 7; w++) {
for(int h = 0; h < 3; h++) {
GFX::DrawSprite(sprites_phone_bg_idx, -72+bg_xPos+w*72, bg_yPos+h*136);
}
}
switch(highlightedGame) {
case 0:
default:
GFX::DrawGameSelSprite(ss1Logo, 40+ss1LogoXpos, 56);
break;
case 1:
GFX::DrawGameSelSprite(ss2Logo, 40+ssLogoXpos, 56);
break;
case 2:
GFX::DrawGameSelSprite(ss3Logo, 40, 56);
break;
case 3:
GFX::DrawGameSelSprite(ss4Logo, 40+ssLogoXpos, 56);
break;
}
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
Gui::ScreenDraw(Bottom);
Gui::Draw_Rect(0, 0, 320, 240, WHITE); // Fill gaps of BG
for(int w = 0; w < 7; w++) {
for(int h = 0; h < 3; h++) {
GFX::DrawSprite(sprites_phone_bg_idx, -76+bg_xPos+w*72, bg_yPos+h*136);
}
}
Gui::DrawString(8, 8, 0.50, BLACK, "What do you want to change?");
int iconXpos = 64;
GFX::DrawSpriteBlend(sprites_icon_shadow_idx, iconXpos, 86, C2D_Color32(0, 0, 0, 63));
GFX::DrawSprite(sprites_icon_profile_idx, iconXpos, 80);
Gui::DrawString(iconXpos-2, 140, 0.50, RED, "Characters");
iconXpos += 64;
if (highlightedGame == 1) {
// Show music pack option for Trendsetters
GFX::DrawSpriteBlend(sprites_icon_shadow_idx, iconXpos, 86, C2D_Color32(0, 0, 0, 63));
GFX::DrawSprite(sprites_icon_music_idx, iconXpos, 80);
Gui::DrawString(iconXpos+14, 140, 0.50, RED, "Music");
}
iconXpos += 64;
if (highlightedGame > 1) {
// Show emblem option for Fashion Forward and Styling Star
GFX::DrawSpriteBlend(sprites_icon_shadow_idx, iconXpos, 86, C2D_Color32(0, 0, 0, 63));
GFX::DrawSprite(sprites_icon_emblem_idx, iconXpos, 80);
Gui::DrawString(iconXpos+8, 140, 0.50, RED, "Emblem");
}
GFX::DrawSprite(sprites_button_shadow_idx, 5, 199);
GFX::DrawSprite(sprites_button_red_idx, 5, 195);
GFX::DrawSprite(sprites_arrow_back_idx, 19, 195);
GFX::DrawSprite(sprites_button_b_idx, 44, 218);
/*GFX::DrawSprite(sprites_button_shadow_idx, 251, 199);
GFX::DrawSprite(sprites_button_blue_idx, 251, 195);*/
GFX::drawCursor();
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
C3D_FrameEnd(0);
} else if (screenmode == SCREEN_MODE_CHANGE_CHARACTER) {
extern void changeCharacterGraphics(void);
changeCharacterGraphics();
} else if (screenmode == SCREEN_MODE_CHANGE_MUSIC) {
extern void changeMusicGraphics(void);
changeMusicGraphics();
} else if (screenmode == SCREEN_MODE_CHANGE_EMBLEM) {
extern void changeEmblemGraphics(void);
changeEmblemGraphics();
}
// Scroll background
switch (iFps) {
default:
@ -730,8 +365,9 @@ int main()
bg_yPos -= 0.9;
break;
}
if(bg_xPos >= 72) bg_xPos = 0.0f;
if(bg_yPos <= -136) bg_yPos = 0.0f;
if (bg_xPos >= 72) bg_xPos = 0.0f;
if (bg_yPos <= -136) bg_yPos = 0.0f;
if (hDown) {
svcSignalEvent(threadRequest);
@ -760,46 +396,20 @@ int main()
}
}
if (fadein) {
switch (iFps) {
default:
fadealpha -= 6;
break;
case 30:
fadealpha -= 12;
break;
case 24:
fadealpha -= 14;
break;
}
if (fadealpha < 0) {
fadealpha = 0;
fadecolor = 255;
fadein = false;
}
int fadeFPS;
switch (iFps) {
default:
fadeFPS = 6;
break;
case 30:
fadeFPS = 12;
break;
case 24:
fadeFPS = 14;
break;
}
if (fadeout) {
switch (iFps) {
default:
fadealpha += 6;
break;
case 30:
fadealpha += 12;
break;
case 24:
fadealpha += 14;
break;
}
if (fadealpha > 255) {
fadealpha = 255;
screenmode = screenmodebuffer;
if (screenmode != SCREEN_MODE_EXIT) {
fadein = true;
}
fadeout = false;
}
}
Gui::fadeEffects(fadeFPS, fadeFPS);
}
@ -829,10 +439,7 @@ int main()
GFX::unloadSheets();
gfxExit();
hidExit();
srvExit();
romfsExit();
aptExit();
amExit();
return 0;

View File

@ -0,0 +1,889 @@
#include "characterChange.hpp"
#include "screenvars.h"
#include "whatToDo.hpp"
#include "savedata.h"
#include "file_browse.h"
#include "ss3charnames.h"
#include "ss4charnames.h"
#include "import_ss1charnames.h"
#include "import_ss2charnames.h"
#include "import_ss3charnames.h"
#include "import_ss4charnames.h"
#include "import_everycharnames.h"
#include <unistd.h>
CharacterChange::CharacterChange() {
this->getList();
}
void CharacterChange::getList() {
if (highlightedGame == 3) {
characterChangeMenuOps[0] = 0;
characterChangeMenuOps[1] = 0;
characterChangeMenuOps[2] = 4;
characterChangeMenuOps[3] = 10;
characterChangeMenuOptions = 3;
totalCharacters = 0x20;
readSS4Save();
} else if (highlightedGame == 2) {
characterChangeMenuOps[0] = 0;
characterChangeMenuOps[1] = 4;
characterChangeMenuOps[2] = 10;
characterChangeMenuOptions = 2;
totalCharacters = 0xE;
readSS3Save();
} else if (highlightedGame == 1) {
characterChangeMenuOps[0] = 0;
characterChangeMenuOps[1] = 4;
characterChangeMenuOps[2] = 10;
characterChangeMenuOptions = 2;
totalCharacters = 0;
readSS2Save();
}
this->getMaxChars();
}
void CharacterChange::getMaxChars() {
if (import_highlightedGame == 4) {
import_totalCharacters = numberOfExportedCharacters-1;
} else if (import_highlightedGame == 3) {
import_totalCharacters = 0xD;
} else if (import_highlightedGame == 2) {
import_totalCharacters = 0x10;
} else if (import_highlightedGame == 1) {
import_totalCharacters = 0xF;
} else if (import_highlightedGame == 0) {
import_totalCharacters = 0x7;
}
}
const char* CharacterChange::seasonName(void) const {
switch (seasonNo) {
case 0:
return "Spring";
case 1:
return "Summer";
case 2:
return "Fall";
case 3:
return "Winter";
}
return "null";
}
const char* CharacterChange::characterName(bool showPlayerName) const {
if (characterList_cursorPosition == 0) {
if (showPlayerName) {
switch (highlightedGame) {
case 1:
return ss2PlayerName;
case 2:
return ss3PlayerName;
case 3:
return ss4PlayerName;
}
} else {
return "Player";
}
}
switch (highlightedGame) {
case 2:
return ss3CharacterNames[characterList_cursorPosition];
case 3:
return ss4CharacterNames[characterList_cursorPosition];
}
return "null";
}
const char* CharacterChange::import_characterName(void) const {
switch (import_highlightedGame) {
case 0:
return import_ss1CharacterNames[importCharacterList_cursorPosition];
case 1:
return import_ss2CharacterNames[importCharacterList_cursorPosition];
case 2:
return import_ss3CharacterNames[importCharacterList_cursorPosition];
case 3:
return import_ss4CharacterNames[importCharacterList_cursorPosition];
}
return "null";
}
const char* CharacterChange::import_SS2CharacterNames(int i) const {
switch (sysRegion) {
default:
return import_ss2CharacterNames[i];
case CFG_REGION_EUR:
case CFG_REGION_AUS:
return import_nsbCharacterNames[i];
}
}
const char* CharacterChange::import_characterNameDisplay(void) const {
switch (import_highlightedGame) {
case 0:
return import_ss1CharacterNames[importCharacterList_cursorPosition];
case 1:
return import_SS2CharacterNames(importCharacterList_cursorPosition);
case 2:
return import_ss3CharacterNames[importCharacterList_cursorPosition];
case 3:
return import_ss4CharacterNames[importCharacterList_cursorPosition];
}
return "null";
}
const char* CharacterChange::ss1Title(void) const {
switch (sysRegion) {
default:
return "Style Savvy";
case CFG_REGION_EUR:
case CFG_REGION_AUS:
return "Style Boutique";
case CFG_REGION_JPN:
return "Wagamama Fashion: Girls Mode";
case CFG_REGION_KOR:
return "Namanui Collection: Girls Style";
}
}
const char* CharacterChange::ss2Title(void) const {
switch (sysRegion) {
default:
return "Style Savvy: Trendsetters";
case CFG_REGION_EUR:
case CFG_REGION_AUS:
return "New Style Boutique";
case CFG_REGION_JPN:
return "Girls Mode: Yokubari Sengen";
case CFG_REGION_KOR:
return "Girls Style: Paesyeon Lideo Seon-eon!";
}
}
const char* CharacterChange::ss3Title(void) const {
switch (sysRegion) {
default:
return "Style Savvy: Fashion Forward";
case CFG_REGION_EUR:
case CFG_REGION_AUS:
return "New Style Boutique 2: Fashion Forward";
case CFG_REGION_JPN:
return "Girls Mode 3: Kirakira * Code";
case CFG_REGION_KOR:
return "Girls Style: Kirakira * Code";
}
}
const char* CharacterChange::ss4Title(void) const {
switch (sysRegion) {
default:
return "Style Savvy: Styling Star";
case CFG_REGION_EUR:
case CFG_REGION_AUS:
return "New Style Boutique 3: Styling Star";
case CFG_REGION_JPN:
return "Girls Mode 4: Star Stylist";
case CFG_REGION_KOR:
return "Girls Style: Star Stylist";
}
}
void CharacterChange::drawMsg(void) const {
GFX::DrawSprite(sprites_msg_idx, 0, 8, 1, 1);
GFX::DrawSprite(sprites_msg_idx, 160, 8, -1, 1);
GFX::DrawSprite(messageNo == 4 ? sprites_icon_question_idx : sprites_icon_msg_idx, 132, -2);
if (messageNo == 5) {
Gui::DrawStringCentered(0, 68, 0.60, BLACK, "Everyone is now in Fashion Forward!");
Gui::DrawStringCentered(0, 88, 0.60, BLACK, "(Except for customers and reps.)");
Gui::DrawStringCentered(0, 114, 0.60, BLACK, "Invite them over for photo shoots,");
Gui::DrawStringCentered(0, 134, 0.60, BLACK, "as well as AR photo shoots!");
} else if (messageNo == 4) {
Gui::DrawStringCentered(0, 58, 0.60, BLACK, "Characters from the 1st, 2nd, and");
Gui::DrawStringCentered(0, 78, 0.60, BLACK, "4th games, will be added to the 3rd.");
Gui::DrawStringCentered(0, 104, 0.60, BLACK, "Characters part of downloaded");
Gui::DrawStringCentered(0, 124, 0.60, BLACK, "Caprice Chalet rooms will be");
Gui::DrawStringCentered(0, 144, 0.60, BLACK, "overwritten. Is this OK?");
} else if (messageNo == 3) {
Gui::DrawStringCentered(0, 94, 0.60, BLACK, "Failed to import character.");
} else if (messageNo == 2) {
Gui::DrawStringCentered(0, 58, 0.60, BLACK, "Character exported successfully.");
Gui::DrawStringCentered(0, 94, 0.60, BLACK, "You can go to \"Import Characters\"");
Gui::DrawStringCentered(0, 114, 0.60, BLACK, "and restore the exported character");
Gui::DrawStringCentered(0, 134, 0.60, BLACK, "at any time.");
} else if (messageNo == 1) {
Gui::DrawStringCentered(0, 94, 0.60, BLACK, chararacterImported);
} else {
Gui::DrawStringCentered(0, 84, 0.60, BLACK, "This feature is not available yet.");
//Gui::DrawStringCentered(0, 104, 0.60, BLACK, "yet.");
}
if (messageNo == 4) {
GFX::DrawSprite(sprites_button_msg_shadow_idx, 52, 197);
GFX::DrawSprite(sprites_button_msg_idx, 53, 188);
GFX::DrawSprite(sprites_button_msg_shadow_idx, 176, 197);
GFX::DrawSprite(sprites_button_msg_idx, 177, 188);
Gui::DrawString(72, 196, 0.70, MSG_BUTTONTEXT, " No");
Gui::DrawString(196, 196, 0.70, MSG_BUTTONTEXT, " Yes");
} else {
GFX::DrawSprite(sprites_button_msg_shadow_idx, 114, 197);
GFX::DrawSprite(sprites_button_msg_idx, 115, 188);
Gui::DrawString(134, 196, 0.70, MSG_BUTTONTEXT, " OK!");
}
}
void CharacterChange::loadChrImage(bool Robz) {
this->previewCharacter = false;
gspWaitForVBlank();
if (import_highlightedGame == 4) {
if (numberOfExportedCharacters > 0) {
sprintf(this->chrFilePath, "sdmc:/3ds/SavvyManager/SS%i/characters/previews/%s.t3x", highlightedGame+1, getExportedCharacterName(this->importCharacterList_cursorPosition)); // All Seasons
} else {
sprintf(this->chrFilePath, "romfs:/gfx/null.t3x"); // All Seasons
}
this->previewCharacterFound = GFX::loadCharSprite(this->chrFilePath, this->chrFilePath);
} else {
sprintf(this->chrFilePath, "romfs:/gfx/ss%i_%s.t3x", highlightedGame+1, (Robz ? "Robz" : import_characterName())); // All Seasons
sprintf(this->chrFilePath2, "romfs:/gfx/ss%i_%s%i.t3x", highlightedGame+1, (Robz ? "Robz" : import_characterName()), this->seasonNo); // One Season
this->previewCharacterFound = GFX::loadCharSprite(this->chrFilePath, this->chrFilePath2);
}
this->previewCharacter = true;
}
void CharacterChange::addEveryone(void) {
// if (highlightedGame != 2) return;
for (int i = 0; i < 49; i++) {
sprintf(this->chrFilePath, "romfs:/character/Fashion Forward/All Seasons/%s.chr", import_everyCharacterNames[i]);
if (access(this->chrFilePath, F_OK) != 0) {
sprintf(this->chrFilePath, "romfs:/character/Fashion Forward/%s/%s.chr", this->seasonName(), import_everyCharacterNames[i]);
}
readSS3CharacterFile(0x0BB9+i, chrFilePath);
if (this->removeBags) {
removeSS3CharacterBag(0x0BB9+i);
}
sprintf(this->chrFilePath, "romfs:/character/Fashion Forward/Profiles/%s.cprf", sysRegion==CFG_REGION_EUR||sysRegion==CFG_REGION_AUS ? import_everyCharacterProfileNamesEUR[i] : import_everyCharacterNames[i]);
readSS3ProfileFile(0x0BB9+i, this->chrFilePath);
toggleSS3Character(0x0BB9+i, true);
}
writeSS3Save();
}
void CharacterChange::Draw(void) const {
Gui::ScreenDraw(Top);
GFX::showBgSprite(zoomIn);
if (this->previewCharacter) {
if (this->previewCharacterFound) {
GFX::showCharSprite(this->zoomIn, this->charFadeAlpha);
} else {
Gui::DrawStringCentered(0, 104, 0.65, WHITE, (this->import_highlightedGame==4 ? "Preview not found." : "Preview unavailable."));
}
}
this->preview();
if (this->showMessage && this->messageNo == 4) {
Gui::DrawString(8, 210, 0.50, WHITE, this->removeBags ? " Keep bags" : " Remove bags");
// Selected season
Gui::DrawString(160, 208, 0.65, WHITE, "L");
Gui::DrawStringCentered(0, 210, 0.50, WHITE, this->seasonName());
Gui::DrawString(232, 208, 0.65, WHITE, "R");
}
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
Gui::ScreenDraw(Bottom);
Gui::Draw_Rect(0, 0, 320, 240, WHITE); // Fill gaps of BG
for(int w = 0; w < 7; w++) {
for(int h = 0; h < 3; h++) {
GFX::DrawSprite(sprites_phone_bg_idx, -76+bg_xPos+w*72, bg_yPos+h*136);
}
}
this->cursorX = 248;
if (this->subScreenMode == 4) {
this->cursorY = 64+(48*this->importCharacterList_cursorPositionOnScreen);
// Game name
switch (this->import_highlightedGame) {
case 4:
Gui::DrawStringCentered(0, 8, 0.50, BLACK, "Your character files");
break;
case 3:
Gui::DrawStringCentered(0, 8, 0.50, BLACK, ss4Title());
break;
case 2:
Gui::DrawStringCentered(0, 8, 0.50, BLACK, ss3Title());
break;
case 1:
Gui::DrawStringCentered(0, 8, 0.50, BLACK, ss2Title());
break;
case 0:
Gui::DrawStringCentered(0, 8, 0.50, BLACK, ss1Title());
break;
}
Gui::DrawString(8, 8, 0.50, BLACK, "<");
Gui::DrawString(304, 8, 0.50, BLACK, ">");
if (import_highlightedGame != 4) {
// Selected season
Gui::DrawString(120, 208, 0.65, BLACK, "L");
Gui::DrawStringCentered(0, 210, 0.50, BLACK, this->seasonName());
Gui::DrawString(192, 208, 0.65, BLACK, "R");
}
if (!displayNothing) {
int i2 = 48;
for (int i = import_characterShownFirst; i < import_characterShownFirst+3; i++) {
if (import_highlightedGame == 4) {
if (i >= numberOfExportedCharacters) break;
GFX::DrawSprite(sprites_item_button_idx, 16, i2-20);
GFX::DrawSprite((getExportedCharacterGender(i) ? sprites_icon_male_idx : sprites_icon_female_idx), 12, i2-8);
Gui::DrawString(64, i2, 0.65, BLACK, getExportedCharacterName(i));
} else if (import_highlightedGame == 3) {
GFX::DrawSprite(sprites_item_button_idx, 16, i2-20);
GFX::DrawSprite((import_ss4CharacterGenders[i] ? sprites_icon_male_idx : sprites_icon_female_idx), 12, i2-8);
Gui::DrawString(64, i2, 0.65, BLACK, import_ss4CharacterNames[i]);
} else if (import_highlightedGame == 2) {
GFX::DrawSprite(sprites_item_button_idx, 16, i2-20);
GFX::DrawSprite((import_ss3CharacterGenders[i] ? sprites_icon_male_idx : sprites_icon_female_idx), 12, i2-8);
Gui::DrawString(64, i2, 0.65, BLACK, import_ss3CharacterNames[i]);
} else if (import_highlightedGame == 1) {
GFX::DrawSprite(sprites_item_button_idx, 16, i2-20);
GFX::DrawSprite((import_ss2CharacterGenders[i] ? sprites_icon_male_idx : sprites_icon_female_idx)/*+import_ss2CharacterTieColors[i]*/, 12, i2-8);
Gui::DrawString(64, i2, 0.65, BLACK, import_SS2CharacterNames(i));
} else if (import_highlightedGame == 0) {
GFX::DrawSprite(sprites_item_button_idx, 16, i2-20);
GFX::DrawSprite((import_ss1CharacterGenders[i] ? sprites_icon_male_idx : sprites_icon_female_idx), 12, i2-8);
Gui::DrawString(64, i2, 0.65, BLACK, import_ss1CharacterNames[i]);
}
i2 += 48;
}
}
} else if (subScreenMode == 1) {
this->cursorY = 64+(48*characterChangeMenu_cursorPositionOnScreen);
Gui::DrawString(8, 8, 0.50, BLACK, characterName(true));
int i2 = 0;
if (characterChangeMenu_optionShownFirst == 0) {
i2 += 48;
GFX::DrawSprite(sprites_item_button_idx, 16, i2-20);
Gui::DrawString(32, i2, 0.65, BLACK, "Change attributes");
}
if (highlightedGame == 3) {
i2 += 48;
GFX::DrawSprite(sprites_item_button_idx, 16, i2-20);
Gui::DrawString(32, i2, 0.65, BLACK, "Change bow placement");
}
i2 += 48;
GFX::DrawSprite(sprites_item_button_idx, 16, i2-20);
Gui::DrawString(32, i2, 0.65, BLACK, "Import character");
if (highlightedGame < 3 || characterChangeMenu_optionShownFirst == 1) {
i2 += 48;
GFX::DrawSprite(sprites_item_button_idx, 16, i2-20);
Gui::DrawString(32, i2, 0.65, BLACK, "Export character");
}
} else {
this->cursorY = 64+(48*characterList_cursorPositionOnScreen);
Gui::DrawString(8, 8, 0.50, BLACK, "Select the character you want to change.");
if (highlightedGame == 2) {
Gui::DrawString(116, 210, 0.50, BLACK, "START: Expand contacts");
}
if (!displayNothing) {
int i2 = 48;
for (int i = characterShownFirst; i < characterShownFirst+3; i++) {
GFX::DrawSprite(sprites_item_button_idx, 16, i2-20);
if (highlightedGame == 3) {
if (i==0) {
GFX::DrawSprite((getSS4CharacterGender(i) ? sprites_icon_male_idx : sprites_icon_female_idx), 12, i2-8);
Gui::DrawString(64, i2, 0.65, BLACK, ss4PlayerName);
} else {
GFX::DrawSprite((getSS4CharacterGender(i) ? sprites_icon_male_idx : sprites_icon_female_idx), 12, i2-8);
Gui::DrawString(64, i2, 0.65, BLACK, ss4CharacterNames[i]);
}
} else if (highlightedGame == 2) {
if (i==0) {
GFX::DrawSprite((getSS3CharacterGender(i) ? sprites_icon_male_idx : sprites_icon_female_idx), 12, i2-8);
Gui::DrawString(64, i2, 0.65, BLACK, ss3PlayerName);
} else {
GFX::DrawSprite((getSS3CharacterGender(i) ? sprites_icon_male_idx : sprites_icon_female_idx), 12, i2-8);
Gui::DrawString(64, i2, 0.65, BLACK, ss3CharacterNames[i]);
}
} else if (highlightedGame == 1) {
GFX::DrawSprite((getSS2CharacterGender() ? sprites_icon_male_idx : sprites_icon_female_idx), 12, i2-8);
Gui::DrawString(64, i2, 0.65, BLACK, ss2PlayerName);
break;
}
i2 += 48;
}
}
}
GFX::DrawSprite(sprites_button_shadow_idx, 5, 199);
GFX::DrawSprite(sprites_button_red_idx, 5, 195);
GFX::DrawSprite(sprites_arrow_back_idx, 19, 195);
GFX::DrawSprite(sprites_button_b_idx, 44, 218);
GFX::drawCursor(this->cursorX, this->cursorY);
if (showMessage) {
drawMsg();
}
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
}
void CharacterChange::preview() const {
if (this->previewCharacter) {
switch (iFps) {
default:
this->charFadeAlpha += 20;
break;
case 30:
this->charFadeAlpha += 40;
break;
case 24:
this->charFadeAlpha += 55;
break;
}
if (this->charFadeAlpha > 255) this->charFadeAlpha = 255;
} else {
this->charFadeAlpha = 0;
}
}
void CharacterChange::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
if (hDown & KEY_CPAD_UP) {
this->zoomIn++;
if (this->zoomIn > 2) this->zoomIn = 2;
}
if (hDown & KEY_CPAD_DOWN) {
this->zoomIn--;
if (this->zoomIn < 0) this->zoomIn = 0;
}
if (this->showMessage) {
if (this->messageNo == 4) {
if ((hDown & KEY_A) || ((hDown & KEY_TOUCH) && touch.px >= 176 && touch.px < 176+90 && touch.py >= 188 && touch.py < 188+47)) {
sndSelect();
this->addEveryone();
this->messageNo = 5;
}
if ((hDown & KEY_B) || ((hDown & KEY_TOUCH) && touch.px >= 52 && touch.px < 52+90 && touch.py >= 188 && touch.py < 188+47)) {
sndBack();
this->showMessage = false;
}
if (hDown & KEY_Y) {
sndHighlight();
this->removeBags = !this->removeBags;
}
if ((hDown & KEY_L) || (hDown & KEY_ZL)) {
sndHighlight();
this->seasonNo--;
if (this->seasonNo < 0) this->seasonNo = 3;
}
if ((hDown & KEY_R) || (hDown & KEY_ZR)) {
sndHighlight();
this->seasonNo++;
if (this->seasonNo > 3) this->seasonNo = 0;
}
} else {
if ((hDown & KEY_A) || ((hDown & KEY_TOUCH) && touch.px >= 115 && touch.px < 115+90 && touch.py >= 188 && touch.py < 188+47)) {
sndSelect();
if (this->messageNo == 5) {
this->messageNo = 1;
sprintf(this->chararacterImported, "Characters imported successfully.");
} else {
if (this->subScreenMode == 1) {
this->previewCharacter = false;
}
this->showMessage = false;
}
}
}
} else if (this->subScreenMode == 4) {
bool robzAction = false;
if (hDown) {
this->cheatKeys[cheatKeyPosition] = hDown;
this->cheatKeyPosition++;
}
robzAction = ((this->cheatKeys[0] & KEY_DUP)
&& (this->cheatKeys[1] & KEY_DUP)
&& (this->cheatKeys[2] & KEY_DDOWN)
&& (this->cheatKeys[3] & KEY_DDOWN)
&& (this->cheatKeys[4] & KEY_DLEFT)
&& (this->cheatKeys[5] & KEY_DRIGHT)
&& (this->cheatKeys[6] & KEY_DLEFT)
&& (this->cheatKeys[7] & KEY_DRIGHT)
&& (this->cheatKeys[8] & KEY_B)
&& (this->cheatKeys[9] & KEY_A));
if (this->cheatKeyPosition==10
|| ((this->cheatKeys[0] != 0) && !(this->cheatKeys[0] & KEY_DUP))
|| ((this->cheatKeys[1] != 0) && !(this->cheatKeys[1] & KEY_DUP))
|| ((this->cheatKeys[2] != 0) && !(this->cheatKeys[2] & KEY_DDOWN))
|| ((this->cheatKeys[3] != 0) && !(this->cheatKeys[3] & KEY_DDOWN))
|| ((this->cheatKeys[4] != 0) && !(this->cheatKeys[4] & KEY_DLEFT))
|| ((this->cheatKeys[5] != 0) && !(this->cheatKeys[5] & KEY_DRIGHT))
|| ((this->cheatKeys[6] != 0) && !(this->cheatKeys[6] & KEY_DLEFT))
|| ((this->cheatKeys[7] != 0) && !(this->cheatKeys[7] & KEY_DRIGHT))
|| ((this->cheatKeys[8] != 0) && !(this->cheatKeys[8] & KEY_B))
|| ((this->cheatKeys[9] != 0) && !(this->cheatKeys[9] & KEY_A))) {
for (int i= 0; i < 10; i++) {
this->cheatKeys[i] = 0;
}
this->cheatKeyPosition = 0;
}
if (showCursor) {
if (hDown & KEY_DUP) {
sndHighlight();
this->importCharacterList_cursorPosition--;
this->importCharacterList_cursorPositionOnScreen--;
if (this->importCharacterList_cursorPosition < 0) {
this->importCharacterList_cursorPosition = 0;
this->import_characterShownFirst = 0;
} else if (this->importCharacterList_cursorPosition < this->import_characterShownFirst) {
this->import_characterShownFirst--;
}
if (this->importCharacterList_cursorPositionOnScreen < 0) {
this->importCharacterList_cursorPositionOnScreen = 0;
}
this->loadChrImage(false);
}
if (hDown & KEY_DDOWN) {
sndHighlight();
this->importCharacterList_cursorPosition++;
this->importCharacterList_cursorPositionOnScreen++;
if (this->importCharacterList_cursorPosition > this->import_totalCharacters) {
this->importCharacterList_cursorPosition = this->import_totalCharacters;
this->import_characterShownFirst = this->import_totalCharacters-2;
if (this->import_characterShownFirst < 0) this->import_characterShownFirst = 0;
if (this->importCharacterList_cursorPositionOnScreen > this->import_totalCharacters) {
this->importCharacterList_cursorPositionOnScreen = this->import_totalCharacters;
}
} else if (this->importCharacterList_cursorPosition > this->import_characterShownFirst+2) {
this->import_characterShownFirst++;
}
if (this->importCharacterList_cursorPositionOnScreen > 2) {
this->importCharacterList_cursorPositionOnScreen = 2;
}
this->loadChrImage(false);
}
}
if (hDown & KEY_A) {
if (robzAction) {
sndSelect();
switch (highlightedGame) {
case 3:
sprintf(this->chrFilePath, "romfs:/character/Styling Star/All Seasons/%s.chr", "Robz");
if (access(this->chrFilePath, F_OK) != 0) {
sprintf(this->chrFilePath, "romfs:/character/Styling Star/%s/%s.chr", this->seasonName(), "Robz");
}
readSS4CharacterFile(this->characterList_cursorPosition, this->chrFilePath);
writeSS4Save();
break;
case 2:
sprintf(this->chrFilePath, "romfs:/character/Fashion Forward/All Seasons/%s.chr", "Robz");
if (access(this->chrFilePath, F_OK) != 0) {
sprintf(this->chrFilePath, "romfs:/character/Fashion Forward/%s/%s.chr", this->seasonName(), "Robz");
}
readSS3CharacterFile(this->characterList_cursorPosition, this->chrFilePath);
writeSS3Save();
break;
case 1:
sprintf(this->chrFilePath, "romfs:/character/Trendsetters/All Seasons/%s.chr", "Robz");
if (access(this->chrFilePath, F_OK) != 0) {
sprintf(this->chrFilePath, "romfs:/character/Trendsetters/%s/%s.chr", this->seasonName(), "Robz");
}
readSS2CharacterFile(this->chrFilePath);
writeSS2Save();
break;
}
this->loadChrImage(true);
sprintf(this->chararacterImported, "Imported %s successfully.", "Robz");
this->messageNo = 1;
this->subScreenMode = 1;
this->showMessage = true;
} else if (this->import_highlightedGame == 4 && numberOfExportedCharacters > 0) {
bool exportFound = false;
switch (highlightedGame) {
case 3:
sprintf(this->chrFilePath, "sdmc:/3ds/SavvyManager/SS4/characters/%s.chr", getExportedCharacterName(importCharacterList_cursorPosition));
if (access(chrFilePath, F_OK) == 0) {
sndSelect();
readSS4CharacterFile(this->characterList_cursorPosition, this->chrFilePath);
writeSS4Save();
exportFound = true;
}
break;
case 2:
sprintf(this->chrFilePath, "sdmc:/3ds/SavvyManager/SS3/characters/%s.chr", getExportedCharacterName(importCharacterList_cursorPosition));
if (access(this->chrFilePath, F_OK) == 0) {
sndSelect();
readSS3CharacterFile(this->characterList_cursorPosition, this->chrFilePath);
writeSS3Save();
exportFound = true;
}
break;
case 1:
sprintf(this->chrFilePath, "sdmc:/3ds/SavvyManager/SS2/characters/%s.chr", getExportedCharacterName(importCharacterList_cursorPosition));
if (access(this->chrFilePath, F_OK) == 0) {
sndSelect();
readSS2CharacterFile(this->chrFilePath);
writeSS2Save();
exportFound = true;
}
break;
}
if (exportFound) {
sprintf(this->chararacterImported, "Imported %s successfully.", getExportedCharacterName(importCharacterList_cursorPosition));
this->messageNo = 1;
this->subScreenMode = 1;
} else {
sndBack();
this->messageNo = 3;
}
this->showMessage = true;
} else if (this->import_highlightedGame != 4) {
sndSelect();
switch (highlightedGame) {
case 3:
sprintf(this->chrFilePath, "romfs:/character/Styling Star/All Seasons/%s.chr", import_characterName());
if (access(this->chrFilePath, F_OK) != 0) {
sprintf(this->chrFilePath, "romfs:/character/Styling Star/%s/%s.chr", this->seasonName(), import_characterName());
}
readSS4CharacterFile(this->characterList_cursorPosition, this->chrFilePath);
writeSS4Save();
break;
case 2:
sprintf(this->chrFilePath, "romfs:/character/Fashion Forward/All Seasons/%s.chr", import_characterName());
if (access(this->chrFilePath, F_OK) != 0) {
sprintf(this->chrFilePath, "romfs:/character/Fashion Forward/%s/%s.chr", this->seasonName(), import_characterName());
}
readSS3CharacterFile(this->characterList_cursorPosition, this->chrFilePath);
writeSS3Save();
break;
case 1:
sprintf(this->chrFilePath, "romfs:/character/Trendsetters/All Seasons/%s.chr", import_characterName());
if (access(this->chrFilePath, F_OK) != 0) {
sprintf(this->chrFilePath, "romfs:/character/Trendsetters/%s/%s.chr", this->seasonName(), import_characterName());
}
readSS2CharacterFile(this->chrFilePath);
writeSS2Save();
break;
}
sprintf(this->chararacterImported, "Imported %s successfully.", import_characterNameDisplay());
this->messageNo = 1;
this->subScreenMode = 1;
this->showMessage = true;
}
}
if (hDown & KEY_DLEFT) {
sndHighlight();
this->import_highlightedGame--;
if (this->import_highlightedGame < 0) this->import_highlightedGame = 4;
this->getMaxChars();
}
if (hDown & KEY_DRIGHT) {
sndHighlight();
this->import_highlightedGame++;
if (this->import_highlightedGame > 4) this->import_highlightedGame = 0;
this->getMaxChars();
}
if ((hDown & KEY_DLEFT) || (hDown & KEY_DRIGHT)) {
this->importCharacterList_cursorPosition = 0;
this->importCharacterList_cursorPositionOnScreen = 0;
this->import_characterShownFirst = 0;
if (this->import_highlightedGame == 4) {
this->previewCharacter = false;
if (!this->exportedCharListGotten[highlightedGame]) {
this->displayNothing = true;
gspWaitForVBlank();
getExportedCharacterContents();
this->exportedCharListGotten[highlightedGame] = true;
this->displayNothing = false;
}
}
this->getMaxChars();
this->loadChrImage(false);
}
if (this->import_highlightedGame != 4) {
if ((hDown & KEY_L) || (hDown & KEY_ZL)) {
sndHighlight();
this->seasonNo--;
if (this->seasonNo < 0) this->seasonNo = 3;
this->loadChrImage(false);
}
if ((hDown & KEY_R) || (hDown & KEY_ZR)) {
sndHighlight();
this->seasonNo++;
if (this->seasonNo > 3) this->seasonNo = 0;
this->loadChrImage(false);
}
}
if (((hDown & KEY_B) && !(this->cheatKeys[8] & KEY_B))
|| ((hDown & KEY_TOUCH) && touchingBackButton())) {
sndBack();
this->subScreenMode = 1;
this->previewCharacter = false;
}
} else if (this->subScreenMode == 1) {
if (showCursor) {
if (hDown & KEY_DUP) {
sndHighlight();
this->characterChangeMenu_cursorPosition--;
this->characterChangeMenu_cursorPositionOnScreen--;
if (this->characterChangeMenu_cursorPosition < 0) {
this->characterChangeMenu_cursorPosition = 0;
this->characterChangeMenu_optionShownFirst = 0;
} else if (this->characterChangeMenu_cursorPosition < this->characterChangeMenu_optionShownFirst) {
this->characterChangeMenu_optionShownFirst--;
}
if (this->characterChangeMenu_cursorPositionOnScreen < 0) {
this->characterChangeMenu_cursorPositionOnScreen = 0;
}
}
if (hDown & KEY_DDOWN) {
sndHighlight();
this->characterChangeMenu_cursorPosition++;
this->characterChangeMenu_cursorPositionOnScreen++;
if (this->characterChangeMenu_cursorPosition > this->characterChangeMenuOptions) {
this->characterChangeMenu_cursorPosition = this->characterChangeMenuOptions;
this->characterChangeMenu_optionShownFirst = this->characterChangeMenuOptions-2;
} else if (this->characterChangeMenu_cursorPosition > this->characterChangeMenu_optionShownFirst+2) {
this->characterChangeMenu_optionShownFirst++;
}
if (this->characterChangeMenu_cursorPositionOnScreen > 2) {
this->characterChangeMenu_cursorPositionOnScreen = 2;
}
}
}
if (hDown & KEY_A) {
if (this->characterChangeMenuOps[characterChangeMenu_cursorPosition] == 0) {
sndBack();
this->messageNo = 0;
this->showMessage = true;
} else if (this->characterChangeMenuOps[characterChangeMenu_cursorPosition] == 10) {
// Export character
sndSelect();
switch (highlightedGame) {
case 3:
sprintf(this->chrFilePath, "sdmc:/3ds/SavvyManager/SS4/characters/%s.chr", this->characterName(false));
writeSS4CharacterFile(this->characterList_cursorPosition, this->chrFilePath);
break;
case 2:
sprintf(this->chrFilePath, "sdmc:/3ds/SavvyManager/SS3/characters/%s.chr", characterName(false));
writeSS3CharacterFile(this->characterList_cursorPosition, this->chrFilePath);
break;
case 1:
sprintf(this->chrFilePath, "sdmc:/3ds/SavvyManager/SS2/characters/%s.chr", characterName(false));
writeSS2CharacterFile(this->chrFilePath);
break;
}
this->exportedCharListGotten[highlightedGame] = false;
this->messageNo = 2;
this->showMessage = true;
} else {
sndSelect();
this->displayNothing = true;
this->subScreenMode = this->characterChangeMenuOps[characterChangeMenu_cursorPosition];
if ((this->subScreenMode == 4) && (this->import_highlightedGame == 4) && !this->exportedCharListGotten[highlightedGame]) {
gspWaitForVBlank();
getExportedCharacterContents();
this->exportedCharListGotten[highlightedGame] = true;
}
this->displayNothing = false;
this->loadChrImage(false);
}
}
if ((hDown & KEY_B) || ((hDown & KEY_TOUCH) && touchingBackButton())) {
sndBack();
this->subScreenMode = 0;
}
} else {
if (showCursor) {
if ((hDown & KEY_DUP) && (highlightedGame > 1)) {
sndHighlight();
this->characterList_cursorPosition--;
this->characterList_cursorPositionOnScreen--;
if (this->characterList_cursorPosition < 0) {
this->characterList_cursorPosition = 0;
this->characterShownFirst = 0;
} else if (this->characterList_cursorPosition < this->characterShownFirst) {
this->characterShownFirst--;
}
if (this->characterList_cursorPositionOnScreen < 0) {
this->characterList_cursorPositionOnScreen = 0;
}
}
if ((hDown & KEY_DDOWN) && (highlightedGame > 1)) {
sndHighlight();
this->characterList_cursorPosition++;
this->characterList_cursorPositionOnScreen++;
if (this->characterList_cursorPosition > this->totalCharacters) {
this->characterList_cursorPosition = this->totalCharacters;
this->characterShownFirst = this->totalCharacters-2;
} else if (this->characterList_cursorPosition > this->characterShownFirst+2) {
this->characterShownFirst++;
}
if (this->characterList_cursorPositionOnScreen > 2) {
this->characterList_cursorPositionOnScreen = 2;
}
}
}
if (hDown & KEY_A) {
sndSelect();
this->subScreenMode = 1;
}
if ((hDown & KEY_B) || ((hDown & KEY_TOUCH) && touchingBackButton())) {
sndBack();
this->characterList_cursorPosition = 0;
this->characterList_cursorPositionOnScreen = 0;
this->characterShownFirst = 0;
this->characterChangeMenu_cursorPosition = 0;
this->characterChangeMenu_cursorPositionOnScreen = 0;
this->characterChangeMenu_optionShownFirst = 0;
Gui::setScreen(std::make_unique<WhatToDo>(), true);
}
if ((hDown & KEY_START) && (highlightedGame == 2)) {
sndSelect();
this->messageNo = 4;
this->showMessage = true;
}
}
}

View File

@ -1,65 +1,39 @@
#include <stdio.h>
#include <dirent.h>
#include <string.h>
#include <3ds.h>
#include <malloc.h>
#include <unistd.h> // access
#include <sys/stat.h>
#include "emblemChange.hpp"
#include "screenvars.h"
#include "whatToDo.hpp"
#include "common.hpp"
#include "screenMode.h"
#include "savedata.h"
#include "file_browse.h"
#include "import_emblemnames.h"
#include <unistd.h>
extern void sndSelect(void);
extern void sndBack(void);
extern void sndHighlight(void);
EmblemChange::EmblemChange() {
this->getMaxEmblems();
}
//static int screenmode = 0;
extern int screenmodebuffer;
void EmblemChange::getMaxEmblems() {
if (this->subScreenMode == 2) {
if (this->importPage == 1) {
this->totalEmblems = numberOfExportedEmblems-1;
} else {
this->totalEmblems = 10;
}
} else if (highlightedGame == 3) {
this->totalEmblems = 2;
readSS4Save();
//readSS4Emblem(cursorPosition);
} else {
this->totalEmblems = 0;
readSS3Save();
//readSS3Emblem();
}
static int subScreenMode = 0;
/*
0: Emblem list
1: What to change
2: Import emblem
*/
static int importPage = 0;
static char embFilePath[256];
extern int highlightedGame;
extern int fadealpha;
extern int fadecolor;
extern bool fadein;
extern bool fadeout;
extern float bg_xPos;
extern float bg_yPos;
extern bool showCursor;
extern int cursorX;
extern int cursorY;
extern int cursorAlpha;
extern u32 hDown;
extern touchPosition touch;
extern bool touchingBackButton(void);
static bool displayNothing = false;
static int cursorPosition = 0;
static int emblemChangeMenu_cursorPosition = 0;
static int importEmblemList_cursorPosition = 0;
static int importEmblemList_cursorPositionOnScreen = 0;
static int totalEmblems = 0;
static int import_emblemShownFirst = 0;
if (!this->modeInited) {
//renderEmblem();
this->modeInited = true;
}
}
/*static u32 emblemPalette[16] =
{
@ -81,7 +55,7 @@ static int import_emblemShownFirst = 0;
C2D_Color32(240, 240, 240, 255)
};
static int getPalNumber(u8 byte, bool secondPixel) {
int EmblemChange::getPalNumber(u8 byte, bool secondPixel) {
if (secondPixel) {
if ((byte & 0x0F) == 0x0) {
return 0;
@ -154,14 +128,12 @@ static int getPalNumber(u8 byte, bool secondPixel) {
return 0;
}
static u32 emblemPixel(int pixel, bool secondPixel) {
u32 EmblemChange::emblemPixel(int pixel, bool secondPixel) {
pixel = pixel/2;
return emblemPalette[getPalNumber(emblemData.sprite[pixel], secondPixel)];
}
static u32 emblemImage[64*64];
static void renderEmblem(void) {
void EmblemChange::renderEmblem(void) {
bool secondPixel = false;
for (int i = 0; i < 64*64; i++) {
emblemImage[i] = emblemPixel(i, secondPixel);
@ -169,9 +141,7 @@ static void renderEmblem(void) {
}
}
static bool emblemHalf = false;
static void drawEmblem(int x, int y, bool big) {
void EmblemChange::drawEmblem(int x, int y, bool big) {
for (int h = (emblemHalf ? 32: 0); h < (emblemHalf ? 64: 32); h++) {
for (int w = 0; w < 64; w++) {
Draw_Rect(x+(w*(big*2)), y+(h*(big*2)), 1+big, 1+big, emblemImage[(h*64)+w]);
@ -180,25 +150,18 @@ static void drawEmblem(int x, int y, bool big) {
emblemHalf = !emblemHalf;
}*/
static bool modeInited = false;
static bool showMessage = false;
static int messageNo = 0;
static char emblemImported[48];
static void drawMsg(void) {
void EmblemChange::drawMsg(void) const {
GFX::DrawSprite(sprites_msg_idx, 0, 8, 1, 1);
GFX::DrawSprite(sprites_msg_idx, 160, 8, -1, 1);
GFX::DrawSprite(sprites_icon_msg_idx, 132, -2);
if (messageNo == 3) {
if (this->messageNo == 3) {
Gui::DrawStringCentered(0, 94, 0.60, BLACK, "Failed to import emblem.");
} else if (messageNo == 2) {
} else if (this->messageNo == 2) {
Gui::DrawStringCentered(0, 58, 0.60, BLACK, "Emblem exported successfully.");
Gui::DrawStringCentered(0, 94, 0.60, BLACK, "You can go to \"Import Emblems\"");
Gui::DrawStringCentered(0, 114, 0.60, BLACK, "and restore the exported emblem");
Gui::DrawStringCentered(0, 134, 0.60, BLACK, "at any time.");
} else if (messageNo == 1) {
} else if (this->messageNo == 1) {
Gui::DrawStringCentered(0, 94, 0.60, BLACK, emblemImported);
} else {
Gui::DrawStringCentered(0, 94, 0.60, BLACK, "This feature is not available yet.");
@ -209,32 +172,7 @@ static void drawMsg(void) {
Gui::DrawString(134, 196, 0.70, MSG_BUTTONTEXT, " OK!");
}
void changeEmblemGraphics(void) {
if (subScreenMode == 2) {
if (importPage == 1) {
totalEmblems = numberOfExportedEmblems-1;
} else {
totalEmblems = 10;
}
} else if (highlightedGame == 3) {
totalEmblems = 2;
readSS4Save();
//readSS4Emblem(cursorPosition);
} else {
totalEmblems = 0;
readSS3Save();
//readSS3Emblem();
}
if (!modeInited) {
//renderEmblem();
modeInited = true;
}
C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
C2D_TargetClear(Top, TRANSPARENT);
C2D_TargetClear(Bottom, TRANSPARENT);
Gui::clearTextBufs();
void EmblemChange::Draw(void) const {
Gui::ScreenDraw(Top);
Gui::Draw_Rect(0, 0, 400, 240, WHITE); // Fill gaps of BG
@ -245,7 +183,6 @@ void changeEmblemGraphics(void) {
}
GFX::DrawSprite(sprites_emblem_back_idx, 100, 20, 2, 2);
//drawEmblem(136, 56, true);
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
Gui::ScreenDraw(Bottom);
@ -257,12 +194,12 @@ void changeEmblemGraphics(void) {
}
char emblemText[32];
cursorX = 248;
if (subScreenMode == 2) {
cursorY = 64+(48*importEmblemList_cursorPositionOnScreen);
this->cursorX = 248;
if (this->subScreenMode == 2) {
this->cursorY = 64+(48*this->importEmblemList_cursorPositionOnScreen);
// Game name
switch (importPage) {
switch (this->importPage) {
case 1:
Gui::DrawStringCentered(0, 8, 0.50, BLACK, "Your emblem files");
break;
@ -273,13 +210,13 @@ void changeEmblemGraphics(void) {
Gui::DrawString(8, 8, 0.50, BLACK, "<");
Gui::DrawString(304, 8, 0.50, BLACK, ">");
if (!displayNothing) {
if (!this->displayNothing) {
int i2 = 48;
for (int i = import_emblemShownFirst; i < import_emblemShownFirst+3; i++) {
if (importPage == 1) {
for (int i = this->import_emblemShownFirst; i < this->import_emblemShownFirst+3; i++) {
if (this->importPage == 1) {
if (i >= numberOfExportedEmblems) break;
} else {
if (i > totalEmblems) break;
if (i > this->totalEmblems) break;
}
GFX::DrawSprite(sprites_item_button_idx, 16, i2-20);
if (importPage == 1) {
@ -290,14 +227,14 @@ void changeEmblemGraphics(void) {
i2 += 48;
}
}
} else if (subScreenMode == 1) {
} else if (this->subScreenMode == 1) {
if (highlightedGame == 2) {
sprintf(emblemText, "Emblem");
} else {
sprintf(emblemText, "Emblem %i", cursorPosition+1);
sprintf(emblemText, "Emblem %i", this->cursorPosition+1);
}
cursorY = 64+(48*emblemChangeMenu_cursorPosition);
this->cursorY = 64+(48*this->emblemChangeMenu_cursorPosition);
Gui::DrawString(8, 8, 0.50, BLACK, emblemText);
@ -308,12 +245,12 @@ void changeEmblemGraphics(void) {
GFX::DrawSprite(sprites_item_button_idx, 16, i2-20);
Gui::DrawString(32, i2, 0.65, BLACK, "Export emblem");
} else {
cursorY = 64+(48*cursorPosition);
this->cursorY = 64+(48*this->cursorPosition);
Gui::DrawString(8, 8, 0.50, BLACK, "Select the emblem to change.");
int i2 = 48;
for (int i = 0; i <= totalEmblems; i++) {
for (int i = 0; i <= this->totalEmblems; i++) {
GFX::DrawSprite(sprites_item_button_idx, 16, i2-20);
if (highlightedGame == 2) {
sprintf(emblemText, "Emblem");
@ -330,214 +267,227 @@ void changeEmblemGraphics(void) {
GFX::DrawSprite(sprites_arrow_back_idx, 19, 195);
GFX::DrawSprite(sprites_button_b_idx, 44, 218);
GFX::drawCursor();
GFX::drawCursor(this->cursorX, this->cursorY);
if (showMessage) {
drawMsg();
}
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
C3D_FrameEnd(0);
}
void changeEmblem(void) {
if (!fadein && !fadeout) {
if (showMessage) {
if ((hDown & KEY_A) || ((hDown & KEY_TOUCH) && touch.px >= 115 && touch.px < 115+90 && touch.py >= 188 && touch.py < 188+47)) {
sndSelect();
showMessage = false;
}
} else if (subScreenMode == 2) {
void EmblemChange::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
if (this->showMessage) {
if ((hDown & KEY_A) || ((hDown & KEY_TOUCH) && touch.px >= 115 && touch.px < 115+90 && touch.py >= 188 && touch.py < 188+47)) {
sndSelect();
this->showMessage = false;
}
} else {
if (this->subScreenMode == 2) {
if (showCursor) {
if (hDown & KEY_UP) {
sndHighlight();
importEmblemList_cursorPosition--;
importEmblemList_cursorPositionOnScreen--;
if (importEmblemList_cursorPosition < 0) {
importEmblemList_cursorPosition = 0;
import_emblemShownFirst = 0;
} else if (importEmblemList_cursorPosition < import_emblemShownFirst) {
import_emblemShownFirst--;
this->importEmblemList_cursorPosition--;
this->importEmblemList_cursorPositionOnScreen--;
if (this->importEmblemList_cursorPosition < 0) {
this->importEmblemList_cursorPosition = 0;
this->import_emblemShownFirst = 0;
} else if (this->importEmblemList_cursorPosition < this->import_emblemShownFirst) {
this->import_emblemShownFirst--;
}
if (importEmblemList_cursorPositionOnScreen < 0) {
importEmblemList_cursorPositionOnScreen = 0;
if (this->importEmblemList_cursorPositionOnScreen < 0) {
this->importEmblemList_cursorPositionOnScreen = 0;
}
}
if (hDown & KEY_DOWN) {
sndHighlight();
importEmblemList_cursorPosition++;
importEmblemList_cursorPositionOnScreen++;
if (importEmblemList_cursorPosition > totalEmblems) {
importEmblemList_cursorPosition = totalEmblems;
import_emblemShownFirst = totalEmblems-2;
if (import_emblemShownFirst < 0) import_emblemShownFirst = 0;
if (importEmblemList_cursorPositionOnScreen > totalEmblems) {
importEmblemList_cursorPositionOnScreen = totalEmblems;
this->importEmblemList_cursorPosition++;
this->importEmblemList_cursorPositionOnScreen++;
if (this->importEmblemList_cursorPosition > this->totalEmblems) {
this->importEmblemList_cursorPosition = this->totalEmblems;
this->import_emblemShownFirst = this->totalEmblems-2;
if (this->import_emblemShownFirst < 0) this->import_emblemShownFirst = 0;
if (this->importEmblemList_cursorPositionOnScreen > this->totalEmblems) {
this->importEmblemList_cursorPositionOnScreen = this->totalEmblems;
}
} else if (importEmblemList_cursorPosition > import_emblemShownFirst+2) {
import_emblemShownFirst++;
} else if (this->importEmblemList_cursorPosition > this->import_emblemShownFirst+2) {
this->import_emblemShownFirst++;
}
if (importEmblemList_cursorPositionOnScreen > 2) {
importEmblemList_cursorPositionOnScreen = 2;
if (this->importEmblemList_cursorPositionOnScreen > 2) {
this->importEmblemList_cursorPositionOnScreen = 2;
}
}
}
if (hDown & KEY_A) {
bool exportFound = false;
if (importPage == 1 && totalEmblems > 0) {
if (this->importPage == 1 && this->totalEmblems > 0) {
switch (highlightedGame) {
case 3:
sprintf(embFilePath, "sdmc:/3ds/SavvyManager/emblems/%s.emb", getExportedEmblemName(importEmblemList_cursorPosition));
if (access(embFilePath, F_OK) == 0) {
sprintf(this->embFilePath, "sdmc:/3ds/SavvyManager/emblems/%s.emb", getExportedEmblemName(this->importEmblemList_cursorPosition));
if (access(this->embFilePath, F_OK) == 0) {
sndSelect();
readSS4EmblemFile(cursorPosition, embFilePath);
readSS4EmblemFile(this->cursorPosition, this->embFilePath);
writeSS4Save();
exportFound = true;
}
break;
case 2:
sprintf(embFilePath, "sdmc:/3ds/SavvyManager/emblems/%s.emb", getExportedEmblemName(importEmblemList_cursorPosition));
if (access(embFilePath, F_OK) == 0) {
sprintf(this->embFilePath, "sdmc:/3ds/SavvyManager/emblems/%s.emb", getExportedEmblemName(this->importEmblemList_cursorPosition));
if (access(this->embFilePath, F_OK) == 0) {
sndSelect();
readSS3EmblemFile(embFilePath);
readSS3EmblemFile(this->embFilePath);
writeSS3Save();
exportFound = true;
}
break;
}
if (exportFound) {
sprintf(emblemImported, "Imported %s successfully.", getExportedEmblemName(importEmblemList_cursorPosition));
messageNo = 1;
subScreenMode = 1;
sprintf(this->emblemImported, "Imported %s successfully.", getExportedEmblemName(this->importEmblemList_cursorPosition));
this->messageNo = 1;
this->subScreenMode = 1;
} else {
sndBack();
messageNo = 3;
this->messageNo = 3;
}
showMessage = true;
} else if (importPage == 0) {
this->showMessage = true;
} else if (importPage == 0) {
sndSelect();
switch (highlightedGame) {
case 3:
sprintf(embFilePath, "romfs:/emblems/%s.emb", import_emblemNames[importEmblemList_cursorPosition]);
if (access(embFilePath, F_OK) == 0) {
readSS4EmblemFile(cursorPosition, embFilePath);
sprintf(this->embFilePath, "romfs:/emblems/%s.emb", import_emblemNames[this->importEmblemList_cursorPosition]);
if (access(this->embFilePath, F_OK) == 0) {
readSS4EmblemFile(this->cursorPosition, this->embFilePath);
writeSS4Save();
exportFound = true;
}
break;
case 2:
sprintf(embFilePath, "romfs:/emblems/%s.emb", import_emblemNames[importEmblemList_cursorPosition]);
if (access(embFilePath, F_OK) == 0) {
readSS3EmblemFile(embFilePath);
sprintf(this->embFilePath, "romfs:/emblems/%s.emb", import_emblemNames[this->importEmblemList_cursorPosition]);
if (access(this->embFilePath, F_OK) == 0) {
readSS3EmblemFile(this->embFilePath);
writeSS3Save();
exportFound = true;
}
break;
}
if (exportFound) {
sprintf(emblemImported, "Imported %s successfully.", import_emblemNames[importEmblemList_cursorPosition]);
messageNo = 1;
subScreenMode = 1;
sprintf(emblemImported, "Imported %s successfully.", import_emblemNames[this->importEmblemList_cursorPosition]);
this->messageNo = 1;
this->subScreenMode = 1;
} else {
sndBack();
messageNo = 3;
this->messageNo = 3;
}
showMessage = true;
this->showMessage = true;
}
}
if (hDown & KEY_LEFT) {
sndHighlight();
importPage--;
if (importPage < 0) importPage = 1;
importEmblemList_cursorPosition = 0;
importEmblemList_cursorPositionOnScreen = 0;
import_emblemShownFirst = 0;
this->importPage--;
if (this->importPage < 0) this->importPage = 1;
this->importEmblemList_cursorPosition = 0;
this->importEmblemList_cursorPositionOnScreen = 0;
this->import_emblemShownFirst = 0;
this->getMaxEmblems();
}
if (hDown & KEY_RIGHT) {
sndHighlight();
importPage++;
if (importPage > 1) importPage = 0;
importEmblemList_cursorPosition = 0;
importEmblemList_cursorPositionOnScreen = 0;
import_emblemShownFirst = 0;
this->importPage++;
if (this->importPage > 1) this->importPage = 0;
this->importEmblemList_cursorPosition = 0;
this->importEmblemList_cursorPositionOnScreen = 0;
this->import_emblemShownFirst = 0;
this->getMaxEmblems();
}
if ((hDown & KEY_B) || ((hDown & KEY_TOUCH) && touchingBackButton())) {
sndBack();
subScreenMode = 1;
this->subScreenMode = 1;
}
} else if (subScreenMode == 1) {
} else if (this->subScreenMode == 1) {
if (showCursor) {
if (hDown & KEY_UP) {
sndHighlight();
emblemChangeMenu_cursorPosition--;
if (emblemChangeMenu_cursorPosition < 0) {
emblemChangeMenu_cursorPosition = 0;
this->emblemChangeMenu_cursorPosition--;
if (this->emblemChangeMenu_cursorPosition < 0) {
this->emblemChangeMenu_cursorPosition = 0;
}
}
if (hDown & KEY_DOWN) {
sndHighlight();
emblemChangeMenu_cursorPosition++;
if (emblemChangeMenu_cursorPosition > 1) {
emblemChangeMenu_cursorPosition = 1;
this->emblemChangeMenu_cursorPosition++;
if (this->emblemChangeMenu_cursorPosition > 1) {
this->emblemChangeMenu_cursorPosition = 1;
}
}
}
if (hDown & KEY_A) {
if (emblemChangeMenu_cursorPosition == 1) {
if (this->emblemChangeMenu_cursorPosition == 1) {
sndSelect();
switch (highlightedGame) {
case 3:
sprintf(embFilePath, "sdmc:/3ds/SavvyManager/emblems/Emblem %i.chr", cursorPosition);
writeSS4EmblemFile(cursorPosition, embFilePath);
sprintf(this->embFilePath, "sdmc:/3ds/SavvyManager/emblems/Emblem %i.chr", this->cursorPosition);
writeSS4EmblemFile(this->cursorPosition, this->embFilePath);
break;
case 2:
sprintf(embFilePath, "sdmc:/3ds/SavvyManager/emblems/Emblem.chr");
writeSS3EmblemFile(embFilePath);
sprintf(this->embFilePath, "sdmc:/3ds/SavvyManager/emblems/Emblem.chr");
writeSS3EmblemFile(this->embFilePath);
break;
}
messageNo = 2;
showMessage = true;
this->messageNo = 2;
this->showMessage = true;
} else {
sndSelect();
subScreenMode = 2;
displayNothing = true;
this->subScreenMode = 2;
this->displayNothing = true;
gspWaitForVBlank();
getExportedEmblemContents();
displayNothing = false;
this->getMaxEmblems();
this->displayNothing = false;
}
}
if ((hDown & KEY_B) || ((hDown & KEY_TOUCH) && touchingBackButton())) {
sndBack();
subScreenMode = 0;
this->subScreenMode = 0;
this->getMaxEmblems();
}
} else {
if (showCursor) {
if (hDown & KEY_UP) {
sndHighlight();
cursorPosition--;
if (cursorPosition < 0) {
cursorPosition = 0;
this->cursorPosition--;
if (this->cursorPosition < 0) {
this->cursorPosition = 0;
}
modeInited = false;
this->modeInited = false;
}
if (hDown & KEY_DOWN) {
sndHighlight();
cursorPosition++;
if (cursorPosition > totalEmblems) {
cursorPosition = totalEmblems;
this->cursorPosition++;
if (this->cursorPosition > this->totalEmblems) {
this->cursorPosition = this->totalEmblems;
}
modeInited = false;
this->modeInited = false;
}
if (hDown & KEY_A) {
sndSelect();
this->subScreenMode = 1;
}
if ((hDown & KEY_B) || ((hDown & KEY_TOUCH) && touchingBackButton())) {
sndBack();
Gui::setScreen(std::make_unique<WhatToDo>(), true);
}
}
if (hDown & KEY_A) {
sndSelect();
subScreenMode = 1;
}
if ((hDown & KEY_B) || ((hDown & KEY_TOUCH) && touchingBackButton())) {
sndBack();
screenmodebuffer = SCREEN_MODE_WHAT_TO_DO;
fadeout = true;
}
}
}
}
}

View File

@ -0,0 +1,13 @@
#include "exiting.hpp"
#include "screenvars.h"
void Exiting::Draw(void) const {
Gui::ScreenDraw(Top);
Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, 255)); // Fade in/out effect
Gui::ScreenDraw(Bottom);
Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, 255)); // Fade in/out effect
}
void Exiting::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
}

View File

@ -0,0 +1,176 @@
#include "exiting.hpp"
#include "gameSelect.hpp"
#include "screenvars.h"
#include "settings.hpp"
#include "whatToDo.hpp"
extern int ss1Logo;
extern int ss2Screenshot;
extern int ss2Logo;
extern int ss1LogoXpos;
extern int ssLogoXpos;
extern int ss3Logo;
extern int ss4Logo;
extern bool ss2SaveFound;
extern bool ss3SaveFound;
extern bool ss4SaveFound;
extern char verText[32];
extern bool exiting;
void GameSelect::drawCannotEditMsg(void) const {
GFX::DrawSprite(sprites_msg_idx, 0, 8, 1, 1);
GFX::DrawSprite(sprites_msg_idx, 160, 8, -1, 1);
GFX::DrawSprite(sprites_icon_msg_idx, 132, -2);
if (this->messageNo == 2) {
Gui::DrawStringCentered(0, 58, 0.60, BLACK, "This game's title ID");
Gui::DrawStringCentered(0, 78, 0.60, BLACK, "is not known.");
Gui::DrawStringCentered(0, 112, 0.60, BLACK, "As a result, the save data");
Gui::DrawStringCentered(0, 132, 0.60, BLACK, "cannot be edited.");
} else if (this->messageNo == 1) {
if (highlightedGame == 0) {
Gui::DrawStringCentered(0, 58, 0.60, BLACK, "Save data not found.");
Gui::DrawStringCentered(0, 90, 0.60, BLACK, /*highlightedGame==3 ? "Please back up the extra data using" :*/ "Please back it up using");
Gui::DrawStringCentered(0, 110, 0.60, BLACK, "Checkpoint, and name the backup:");
Gui::DrawStringCentered(0, 134, 0.60, BLACK, "SavvyManager");
} else {
Gui::DrawStringCentered(0, 94, 0.60, BLACK, "Save data not found.");
}
} else {
switch (sysRegion) {
default:
Gui::DrawStringCentered(0, 92, 0.60, BLACK, "Cannot edit Style Savvy's");
break;
case CFG_REGION_EUR:
case CFG_REGION_AUS:
Gui::DrawStringCentered(0, 92, 0.60, BLACK, "Cannot edit Style Boutique's");
break;
case CFG_REGION_JPN:
Gui::DrawStringCentered(0, 92, 0.60, BLACK, "Cannot edit Girls Mode's");
case CFG_REGION_KOR:
Gui::DrawStringCentered(0, 92, 0.60, BLACK, "Cannot edit Girls Style's");
break;
}
Gui::DrawStringCentered(0, 112, 0.60, BLACK, "save data yet.");
}
GFX::DrawSprite(sprites_button_msg_shadow_idx, 114, 197);
GFX::DrawSprite(sprites_button_msg_idx, 115, 188);
Gui::DrawString(134, 196, 0.70, MSG_BUTTONTEXT, " OK!");
}
void GameSelect::Draw(void) const {
Gui::ScreenDraw(Top);
/*for(int w = 0; w < 7; w++) {
for(int h = 0; h < 3; h++) {
Gui::sprite(sprites_phone_bg_idx, -72+bg_xPos+w*72, bg_yPos+h*136);
}
}*/
switch(highlightedGame) {
case 0:
default:
GFX::DrawGameShotSprite(gameShotSprites_title1_screenshot_idx, 0, 0);
break;
case 1:
GFX::DrawGameShotSprite(ss2Screenshot, 0, 0);
break;
case 2:
GFX::DrawGameShotSprite(gameShotSprites_title3_screenshot_idx, 0, 0);
break;
case 3:
GFX::DrawGameShotSprite(gameShotSprites_title4_screenshot_idx, 0, 0);
break;
}
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
Gui::ScreenDraw(Bottom);
Gui::Draw_Rect(0, 0, 320, 240, WHITE); // Fill gaps of BG
for(int w = 0; w < 7; w++) {
for(int h = 0; h < 3; h++) {
GFX::DrawSprite(sprites_phone_bg_idx, -76+bg_xPos+w*72, bg_yPos+h*136);
}
}
Gui::DrawString(8, 8, 0.50, BLACK, "Select a game to manage its save data.");
switch(highlightedGame) {
case 0:
default:
GFX::DrawGameSelSprite(ss1Logo, ss1LogoXpos, 56);
break;
case 1:
GFX::DrawGameSelSprite(ss2Logo, ssLogoXpos, 56);
break;
case 2:
GFX::DrawGameSelSprite(ss3Logo, 0, 56);
break;
case 3:
GFX::DrawGameSelSprite(ss4Logo, ssLogoXpos, 56);
break;
}
Gui::DrawString(8, 112, 0.55, BLACK, "<");
Gui::DrawString(304, 112, 0.55, BLACK, ">");
Gui::DrawString(8, 202, 0.50, BLACK, "START: Exit");
Gui::DrawString(8, 218, 0.50, BLACK, "SELECT: Settings");
Gui::DrawString(248, 218, 0.50, BLACK, verText);
if (this->showMessage) {
this->drawCannotEditMsg();
}
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
}
void GameSelect::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
if (this->showMessage) {
if ((hDown & KEY_A) || ((hDown & KEY_TOUCH) && touch.px >= 115 && touch.px < 115+90 && touch.py >= 188 && touch.py < 188+47)) {
sndSelect();
this->showMessage = false;
}
} else {
if ((hDown & KEY_LEFT) || ((hDown & KEY_TOUCH) && touch.px >= 0 && touch.px < 32 && touch.py >= 104 && touch.py < 104+32)) {
sndHighlight();
highlightedGame--;
if (highlightedGame < 0) highlightedGame = (sysRegion==CFG_REGION_KOR ? 1 : 3);
} else if ((hDown & KEY_RIGHT) || ((hDown & KEY_TOUCH) && touch.px >= 320-32 && touch.px < 320 && touch.py >= 104 && touch.py < 104+32)) {
sndHighlight();
highlightedGame++;
if (highlightedGame > (sysRegion==CFG_REGION_KOR ? 1 : 3)) highlightedGame = 0;
}
if ((hDown & KEY_A) || ((hDown & KEY_TOUCH) && touch.px >= 32 && touch.px < 320-32 && touch.py >= 56 && touch.py < 56+128)) {
if (highlightedGame == 0) {
sndBack();
this->messageNo = 0;
this->showMessage = true;
} else if (highlightedGame == 1 && sysRegion == CFG_REGION_KOR) {
sndBack();
this->messageNo = 2;
this->showMessage = true;
} else if ((highlightedGame == 1 && ss2SaveFound)
|| (highlightedGame == 2 && ss3SaveFound)
|| (highlightedGame == 3 && ss4SaveFound))
{
sndSelect();
Gui::setScreen(std::make_unique<WhatToDo>(), true);
} else {
sndBack();
this->messageNo = 1;
this->showMessage = true;
}
}
if (hDown & KEY_START) {
sndBack();
exiting = true;
fadecolor = 0;
Gui::setScreen(std::make_unique<Exiting>(), true);
}
if (hDown & KEY_SELECT) {
sndSelect();
Gui::setScreen(std::make_unique<Settings>(), true);
}
}
}

View File

@ -1,61 +1,18 @@
#include <stdio.h>
#include <dirent.h>
#include <string.h>
#include <3ds.h>
#include <malloc.h>
#include <sys/stat.h>
#include "common.hpp"
#include "screenMode.h"
#include "savedata.h"
//#include "settings.h"
#include "file_browse.h"
#include "musicChange.hpp"
#include "screenvars.h"
#include "whatToDo.hpp"
extern std::string currentMusicPack;
extern void saveSettings(void);
extern void sndSelect(void);
extern void sndBack(void);
extern void sndHighlight(void);
MusicChange::MusicChange() {
if (!modeInited) {
getMusicPackContents();
modeInited = true;
}
}
//static int screenmode = 0;
extern int screenmodebuffer;
//static int subScreenMode = 0;
/*
*/
extern u8 sysRegion;
extern int highlightedGame;
extern int fadealpha;
extern int fadecolor;
extern bool fadein;
extern bool fadeout;
extern float bg_xPos;
extern float bg_yPos;
extern bool showCursor;
extern int cursorX;
extern int cursorY;
extern int cursorAlpha;
extern u32 hDown;
extern touchPosition touch;
extern bool touchingBackButton(void);
static int cursorPosition = 0;
static int cursorPositionOnScreen = 0;
static int musicPackShownFirst = 0;
static bool modeInited = false;
static bool showMessage = false;
static int messageNo = 0;
static void drawMsg(void) {
void MusicChange::drawMsg(void) const {
GFX::DrawSprite(sprites_msg_idx, 0, 8, 1, 1);
GFX::DrawSprite(sprites_msg_idx, 160, 8, -1, 1);
GFX::DrawSprite(sprites_icon_msg_idx, 132, -2);
@ -69,16 +26,7 @@ static void drawMsg(void) {
Gui::DrawString(134, 196, 0.70, MSG_BUTTONTEXT, " OK!");
}
void changeMusicGraphics(void) {
if (!modeInited) {
getMusicPackContents();
modeInited = true;
}
C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
C2D_TargetClear(Top, TRANSPARENT);
C2D_TargetClear(Bottom, TRANSPARENT);
Gui::clearTextBufs();
void MusicChange::Draw(void) const {
Gui::ScreenDraw(Top);
Gui::Draw_Rect(0, 0, 400, 240, WHITE); // Fill gaps of BG
@ -101,8 +49,8 @@ void changeMusicGraphics(void) {
}
}
cursorX = 248;
cursorY = 64+(48*cursorPositionOnScreen);
this->cursorX = 248;
this->cursorY = 64+(48*cursorPositionOnScreen);
Gui::DrawString(8, 8, 0.50, BLACK, "Select the music pack you want to use.");
@ -124,24 +72,23 @@ void changeMusicGraphics(void) {
GFX::DrawSprite(sprites_arrow_back_idx, 19, 195);
GFX::DrawSprite(sprites_button_b_idx, 44, 218);
GFX::drawCursor();
GFX::drawCursor(this->cursorX, this->cursorY);
if (showMessage) {
drawMsg();
}
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
C3D_FrameEnd(0);
}
void changeMusic(void) {
if (!fadein && !fadeout) {
if (showMessage) {
if ((hDown & KEY_A) || ((hDown & KEY_TOUCH) && touch.px >= 115 && touch.px < 115+90 && touch.py >= 188 && touch.py < 188+47)) {
sndSelect();
showMessage = false;
}
} else {
void MusicChange::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
if (showMessage) {
if ((hDown & KEY_A) || ((hDown & KEY_TOUCH) && touch.px >= 115 && touch.px < 115+90 && touch.py >= 188 && touch.py < 188+47)) {
sndSelect();
showMessage = false;
}
} else {
if (showCursor) {
if (hDown & KEY_UP) {
sndHighlight();
@ -164,18 +111,18 @@ void changeMusic(void) {
if (cursorPosition > numberOfMusicPacks) {
cursorPosition = numberOfMusicPacks;
musicPackShownFirst = numberOfMusicPacks-2;
if (musicPackShownFirst < 0) musicPackShownFirst = 0;
if (cursorPositionOnScreen > numberOfMusicPacks) {
cursorPositionOnScreen = numberOfMusicPacks;
if (musicPackShownFirst < 0) musicPackShownFirst = 0;
if (cursorPositionOnScreen > numberOfMusicPacks) {
cursorPositionOnScreen = numberOfMusicPacks;
}
} else if (cursorPosition > musicPackShownFirst+2) {
musicPackShownFirst++;
}
if (cursorPositionOnScreen > 2) {
cursorPositionOnScreen = 2;
}
} else if (cursorPosition > musicPackShownFirst+2) {
musicPackShownFirst++;
}
if (cursorPositionOnScreen > 2) {
cursorPositionOnScreen = 2;
}
}
}
if ((hDown & KEY_A) && (cursorPosition <= numberOfMusicPacks)) {
sndSelect();
char prevMusicPackPath[256];
@ -186,32 +133,31 @@ void changeMusic(void) {
}
const char* romfsStreamPath = "sdmc:/luma/titles/00040000000A9100/romfs/Common/Sound/stream";
switch (sysRegion) {
case CFG_REGION_EUR:
case CFG_REGION_AUS:
romfsStreamPath = "sdmc:/luma/titles/00040000000A9000/romfs/Common/Sound/stream";
break;
case CFG_REGION_JPN:
romfsStreamPath = "sdmc:/luma/titles/000400000005D100/romfs/Common/Sound/stream";
break;
default:
break;
case CFG_REGION_EUR:
case CFG_REGION_AUS:
romfsStreamPath = "sdmc:/luma/titles/00040000000A9000/romfs/Common/Sound/stream";
break;
case CFG_REGION_JPN:
romfsStreamPath = "sdmc:/luma/titles/000400000005D100/romfs/Common/Sound/stream";
break;
default:
break;
}
rename(romfsStreamPath, prevMusicPackPath);
if (cursorPosition==0 || rename(musicPackPath, romfsStreamPath) == 0) {
messageNo = 0;
} else {
messageNo = 1;
}
showMessage = true;
currentMusicPack = (cursorPosition==0 ? "" : getMusicPackName(cursorPosition-1));
saveSettings();
modeInited = false;
}
rename(romfsStreamPath, prevMusicPackPath);
if (cursorPosition==0 || rename(musicPackPath, romfsStreamPath) == 0) {
messageNo = 0;
} else {
messageNo = 1;
}
showMessage = true;
currentMusicPack = (cursorPosition==0 ? "" : getMusicPackName(cursorPosition-1));
saveSettings();
modeInited = false;
}
if ((hDown & KEY_B) || ((hDown & KEY_TOUCH) && touchingBackButton())) {
sndBack();
screenmodebuffer = SCREEN_MODE_WHAT_TO_DO;
fadeout = true;
}
Gui::setScreen(std::make_unique<WhatToDo>(), true);
}
}
}
}

View File

@ -0,0 +1,24 @@
#include "gameSelect.hpp"
#include "rocketRobz.hpp"
#include "screenvars.h"
void RocketRobz::Draw(void) const {
Gui::ScreenDraw(Top);
GFX::DrawSprite(sprites_logo_rocketrobz_idx, 0, 0);
Gui::DrawString(8, 218, 0.50, BLACK, this->yeartext);
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
Gui::ScreenDraw(Bottom);
Gui::Draw_Rect(0, 0, 320, 240, WHITE);
/*this->text_width = 104;
Gui::DrawString(((320-this->text_width)/2), 100, 0.50, BLACK, this->yeartext);
this->text_width = 264;
Gui::DrawString(((320-this->text_width)/2), 116, 0.50, BLACK, this->yeartext2);*/
//GFX::DrawSprite(sprites_logo_SSanniversary_idx, 32, 24);
GFX::DrawSprite(sprites_logo_UniversalCore_idx, 0, 26);
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
}
void RocketRobz::Logic(u32 hDown, u32 hHeld, touchPosition touch) { }

162
source/screens/settings.cpp Normal file
View File

@ -0,0 +1,162 @@
#include "gameSelect.hpp"
#include "settings.hpp"
#include "screenvars.h"
char txt_studioBG[32];
char txt_frameRate[24];
const char* Settings::studioBgName(void) const {
switch (studioBg) {
case 0:
default:
return "Blue";
case 1:
return "Lover's Bell";
case 2:
return "Bougainville";
}
return "null";
}
void Settings::Draw(void) const {
Gui::ScreenDraw(Top);
if (this->displayStudioBg) {
GFX::showBgSprite(0);
} else {
Gui::Draw_Rect(0, 0, 400, 240, WHITE); // Fill gaps of BG
for(int w = 0; w < 7; w++) {
for(int h = 0; h < 3; h++) {
GFX::DrawSprite(sprites_phone_bg_idx, -72+bg_xPos+w*72, bg_yPos+h*136);
}
}
}
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
Gui::ScreenDraw(Bottom);
Gui::Draw_Rect(0, 0, 320, 240, WHITE); // Fill gaps of BG
for(int w = 0; w < 7; w++) {
for(int h = 0; h < 3; h++) {
GFX::DrawSprite(sprites_phone_bg_idx, -76+bg_xPos+w*72, bg_yPos+h*136);
}
}
this->cursorX = 248;
this->cursorY = 64+(48*cursorPositionOnScreen);
Gui::DrawStringCentered(0, 8, 0.55, BLACK, "Settings");
int i2 = 48;
for (int i = settingShownFirst; i < settingShownFirst+3; i++) {
if (i > numberOfSettings) break;
GFX::DrawSprite(sprites_item_button_idx, 16, i2-20);
switch (i) {
case 0:
sprintf(txt_studioBG, "Studio BG: %s", studioBgName());
Gui::DrawString(32, i2, 0.65, BLACK, txt_studioBG);
break;
case 1:
sprintf(txt_frameRate, "Frame Rate: %i", iFps);
Gui::DrawString(32, i2, 0.65, BLACK, txt_frameRate);
break;
default:
break;
}
i2 += 48;
}
GFX::DrawSprite(sprites_button_shadow_idx, 5, 199);
GFX::DrawSprite(sprites_button_red_idx, 5, 195);
GFX::DrawSprite(sprites_arrow_back_idx, 19, 195);
GFX::DrawSprite(sprites_button_b_idx, 44, 218);
GFX::drawCursor(this->cursorX, this->cursorY);
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
}
void Settings::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
if (showCursor) {
if (hDown & KEY_UP) {
sndHighlight();
cursorPosition--;
cursorPositionOnScreen--;
if (cursorPosition < 0) {
cursorPosition = 0;
settingShownFirst = 0;
} else if (cursorPosition < settingShownFirst) {
settingShownFirst--;
}
if (cursorPositionOnScreen < 0) {
cursorPositionOnScreen = 0;
}
}
if (hDown & KEY_DOWN) {
sndHighlight();
cursorPosition++;
cursorPositionOnScreen++;
if (cursorPosition > numberOfSettings) {
cursorPosition = numberOfSettings;
settingShownFirst = numberOfSettings-2;
if (settingShownFirst < 0) settingShownFirst = 0;
if (cursorPositionOnScreen > numberOfSettings) {
cursorPositionOnScreen = numberOfSettings;
}
} else if (cursorPosition > settingShownFirst+2) {
settingShownFirst++;
}
if (cursorPositionOnScreen > 2) {
cursorPositionOnScreen = 2;
}
}
}
if ((hDown & KEY_LEFT) && (cursorPosition <= numberOfSettings)) {
sndSelect();
switch (cursorPosition) {
case 0:
studioBg--;
if (studioBg < 0) studioBg = 2;
displayStudioBg = false;
gspWaitForVBlank();
GFX::loadBgSprite();
displayStudioBg = true;
break;
case 1:
if (iFps==30) iFps = 24;
else if (iFps==24) iFps = 60;
else if (iFps==60) iFps = 30;
C3D_FrameRate(iFps);
break;
}
}
if (((hDown & KEY_RIGHT) || (hDown & KEY_A)) && (cursorPosition <= numberOfSettings)) {
sndSelect();
switch (cursorPosition) {
case 0:
studioBg++;
if (studioBg > 2) studioBg = 0;
displayStudioBg = false;
gspWaitForVBlank();
GFX::loadBgSprite();
displayStudioBg = true;
break;
case 1:
if (iFps==60) iFps = 24;
else if (iFps==24) iFps = 30;
else if (iFps==30) iFps = 60;
C3D_FrameRate(iFps);
break;
}
}
if ((hDown & KEY_B) || ((hDown & KEY_TOUCH) && touchingBackButton())) {
sndBack();
Gui::setScreen(std::make_unique<GameSelect>(), true);
}
}

200
source/screens/whatToDo.cpp Normal file
View File

@ -0,0 +1,200 @@
#include "characterChange.hpp"
#include "emblemChange.hpp"
#include "gameSelect.hpp"
#include "musicChange.hpp"
#include "screenvars.h"
#include "whatToDo.hpp"
extern int ss1Logo;
extern int ss2Screenshot;
extern int ss2Logo;
extern int ss1LogoXpos;
extern int ssLogoXpos;
extern int ss3Logo;
extern int ss4Logo;
extern bool ss2SaveFound;
extern bool ss3SaveFound;
extern bool ss4SaveFound;
WhatToDo::WhatToDo() {
this->initialize();
}
void WhatToDo::initialize() {
if ((highlightedGame == 0)
|| (highlightedGame > 1 && this->whatToChange_cursorPosition == 1)
|| (highlightedGame < 2 && this->whatToChange_cursorPosition == 2)) {
this->whatToChange_cursorPosition = 0;
}
this->cursorChange();
}
void WhatToDo::Draw(void) const {
Gui::ScreenDraw(Top);
Gui::Draw_Rect(0, 0, 400, 240, WHITE); // Fill gaps of BG
for(int w = 0; w < 7; w++) {
for(int h = 0; h < 3; h++) {
GFX::DrawSprite(sprites_phone_bg_idx, -72+bg_xPos+w*72, bg_yPos+h*136);
}
}
switch(highlightedGame) {
case 0:
default:
GFX::DrawGameSelSprite(ss1Logo, 40+ss1LogoXpos, 56);
break;
case 1:
GFX::DrawGameSelSprite(ss2Logo, 40+ssLogoXpos, 56);
break;
case 2:
GFX::DrawGameSelSprite(ss3Logo, 40, 56);
break;
case 3:
GFX::DrawGameSelSprite(ss4Logo, 40+ssLogoXpos, 56);
break;
}
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
Gui::ScreenDraw(Bottom);
Gui::Draw_Rect(0, 0, 320, 240, WHITE); // Fill gaps of BG
for(int w = 0; w < 7; w++) {
for(int h = 0; h < 3; h++) {
GFX::DrawSprite(sprites_phone_bg_idx, -76+bg_xPos+w*72, bg_yPos+h*136);
}
}
Gui::DrawString(8, 8, 0.50, BLACK, "What do you want to change?");
int iconXpos = 64;
GFX::DrawSpriteBlend(sprites_icon_shadow_idx, iconXpos, 86, C2D_Color32(0, 0, 0, 63));
GFX::DrawSprite(sprites_icon_profile_idx, iconXpos, 80);
Gui::DrawString(iconXpos-2, 140, 0.50, RED, "Characters");
iconXpos += 64;
if (highlightedGame == 1) {
// Show music pack option for Trendsetters
GFX::DrawSpriteBlend(sprites_icon_shadow_idx, iconXpos, 86, C2D_Color32(0, 0, 0, 63));
GFX::DrawSprite(sprites_icon_music_idx, iconXpos, 80);
Gui::DrawString(iconXpos+14, 140, 0.50, RED, "Music");
}
iconXpos += 64;
if (highlightedGame > 1) {
// Show emblem option for Fashion Forward and Styling Star
GFX::DrawSpriteBlend(sprites_icon_shadow_idx, iconXpos, 86, C2D_Color32(0, 0, 0, 63));
GFX::DrawSprite(sprites_icon_emblem_idx, iconXpos, 80);
Gui::DrawString(iconXpos+8, 140, 0.50, RED, "Emblem");
}
GFX::DrawSprite(sprites_button_shadow_idx, 5, 199);
GFX::DrawSprite(sprites_button_red_idx, 5, 195);
GFX::DrawSprite(sprites_arrow_back_idx, 19, 195);
GFX::DrawSprite(sprites_button_b_idx, 44, 218);
/*GFX::DrawSprite(sprites_button_shadow_idx, 251, 199);
GFX::DrawSprite(sprites_button_blue_idx, 251, 195);*/
GFX::drawCursor(this->cursorX, this->cursorY);
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
}
void WhatToDo::cursorChange() {
switch (this->whatToChange_cursorPosition) {
case 0:
default:
this->cursorX = 80;
this->cursorY = 104;
break;
case 1:
this->cursorX = 148;
this->cursorY = 104;
break;
case 2:
this->cursorX = 212;
this->cursorY = 104;
break;
}
}
void WhatToDo::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
if (this->showMessage) {
if ((hDown & KEY_A) || ((hDown & KEY_TOUCH) && touch.px >= 115 && touch.px < 115+90 && touch.py >= 188 && touch.py < 188+47)) {
sndSelect();
this->showMessage = false;
}
} else {
if (highlightedGame > 0 && showCursor) {
if (hDown & KEY_LEFT) {
sndHighlight();
if (highlightedGame > 1) {
if (this->whatToChange_cursorPosition == 2) this->whatToChange_cursorPosition = 0;
else if (this->whatToChange_cursorPosition == 0) this->whatToChange_cursorPosition = 2;
this->cursorChange();
} else {
this->whatToChange_cursorPosition--;
if (this->whatToChange_cursorPosition < 0) this->whatToChange_cursorPosition = 1;
this->cursorChange();
}
} else if (hDown & KEY_RIGHT) {
sndHighlight();
if (highlightedGame > 1) {
if (this->whatToChange_cursorPosition == 0) this->whatToChange_cursorPosition = 2;
else if (this->whatToChange_cursorPosition == 2) this->whatToChange_cursorPosition = 0;
this->cursorChange();
} else {
whatToChange_cursorPosition++;
if (this->whatToChange_cursorPosition > 1) this->whatToChange_cursorPosition = 0;
this->cursorChange();
}
}
}
if (hDown & KEY_A) {
this->runSelection = true;
}
if ((hDown & KEY_TOUCH) && touch.px >= 71 && touch.px <= 248 && touch.py >= 91 && touch.py <= 136) {
if (touch.px < 120) {
this->whatToChange_cursorPosition = 0;
this->cursorChange();
this->runSelection = true;
}
if ((touch.px > 134) && (touch.px < 185) && highlightedGame==1) {
this->whatToChange_cursorPosition = 1;
this->cursorChange();
this->runSelection = true;
}
if ((touch.px > 198) && highlightedGame > 1) {
this->whatToChange_cursorPosition = 2;
this->cursorChange();
this->runSelection = true;
}
}
if (this->runSelection) {
sndSelect();
switch (this->whatToChange_cursorPosition) {
case 0:
if ((highlightedGame==1 && ss2SaveFound)
|| (highlightedGame==2 && ss3SaveFound)
|| (highlightedGame==3 && ss4SaveFound))
{
Gui::setScreen(std::make_unique<CharacterChange>(), true);
} else {
sndBack();
this->messageNo = 1;
this->showMessage = true;
}
break;
case 1:
Gui::setScreen(std::make_unique<MusicChange>(), true);
break;
case 2:
Gui::setScreen(std::make_unique<EmblemChange>(), true);
break;
}
}
if ((hDown & KEY_B) || ((hDown & KEY_TOUCH) && touchingBackButton())) {
sndBack();
Gui::setScreen(std::make_unique<GameSelect>(), true);
}
}
}

View File

@ -1,237 +0,0 @@
#include <3ds.h>
#include <string>
#define settingsIni "sdmc:/3ds/SavvyManager/settings.ini"
#include "common.hpp"
#include "screenMode.h"
#include "inifile.h"
int studioBg = 0;
int iFps = 60;
std::string currentMusicPack = "";
static const char* studioBgName(void) {
switch (studioBg) {
case 0:
default:
return "Blue";
case 1:
return "Lover's Bell";
case 2:
return "Bougainville";
}
return "null";
}
extern void sndSelect(void);
extern void sndBack(void);
extern void sndHighlight(void);
//static int screenmode = 0;
extern int screenmodebuffer;
//static int subScreenMode = 0;
/*
*/
extern u8 sysRegion;
extern int highlightedGame;
extern int fadealpha;
extern int fadecolor;
extern bool fadein;
extern bool fadeout;
extern float bg_xPos;
extern float bg_yPos;
extern bool showCursor;
extern int cursorX;
extern int cursorY;
extern int cursorAlpha;
extern u32 hDown;
extern touchPosition touch;
extern bool touchingBackButton(void);
static bool displayStudioBg = true;
#define numberOfSettings 1
static int cursorPosition = 0;
static int cursorPositionOnScreen = 0;
static int settingShownFirst = 0;
//static bool modeInited = false;
static char txt_studioBG[32];
static char txt_frameRate[24];
void settingsMenuGraphics(void) {
C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
C2D_TargetClear(Top, TRANSPARENT);
C2D_TargetClear(Bottom, TRANSPARENT);
Gui::clearTextBufs();
Gui::ScreenDraw(Top);
if (displayStudioBg) {
GFX::showBgSprite(0);
} else {
Gui::Draw_Rect(0, 0, 400, 240, WHITE); // Fill gaps of BG
for(int w = 0; w < 7; w++) {
for(int h = 0; h < 3; h++) {
GFX::DrawSprite(sprites_phone_bg_idx, -72+bg_xPos+w*72, bg_yPos+h*136);
}
}
}
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
Gui::ScreenDraw(Bottom);
Gui::Draw_Rect(0, 0, 320, 240, WHITE); // Fill gaps of BG
for(int w = 0; w < 7; w++) {
for(int h = 0; h < 3; h++) {
GFX::DrawSprite(sprites_phone_bg_idx, -76+bg_xPos+w*72, bg_yPos+h*136);
}
}
cursorX = 248;
cursorY = 64+(48*cursorPositionOnScreen);
Gui::DrawStringCentered(0, 8, 0.55, BLACK, "Settings");
int i2 = 48;
for (int i = settingShownFirst; i < settingShownFirst+3; i++) {
if (i > numberOfSettings) break;
GFX::DrawSprite(sprites_item_button_idx, 16, i2-20);
switch (i) {
case 0:
sprintf(txt_studioBG, "Studio BG: %s", studioBgName());
Gui::DrawString(32, i2, 0.65, BLACK, txt_studioBG);
break;
case 1:
sprintf(txt_frameRate, "Frame Rate: %i", iFps);
Gui::DrawString(32, i2, 0.65, BLACK, txt_frameRate);
break;
default:
break;
}
i2 += 48;
}
GFX::DrawSprite(sprites_button_shadow_idx, 5, 199);
GFX::DrawSprite(sprites_button_red_idx, 5, 195);
GFX::DrawSprite(sprites_arrow_back_idx, 19, 195);
GFX::DrawSprite(sprites_button_b_idx, 44, 218);
GFX::drawCursor();
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
C3D_FrameEnd(0);
}
void loadSettings(void) {
CIniFile settingsini(settingsIni);
studioBg = settingsini.GetInt("SAVVY-MANAGER", "STUDIO_BG", studioBg);
iFps = settingsini.GetInt("SAVVY-MANAGER", "FRAME_RATE", iFps);
currentMusicPack = settingsini.GetString("SS2", "CURRENT_MUSIC_PACK", currentMusicPack);
}
void saveSettings(void) {
CIniFile settingsini(settingsIni);
settingsini.SetInt("SAVVY-MANAGER", "STUDIO_BG", studioBg);
settingsini.SetInt("SAVVY-MANAGER", "FRAME_RATE", iFps);
settingsini.SetString("SS2", "CURRENT_MUSIC_PACK", currentMusicPack);
settingsini.SaveIniFileModified(settingsIni);
}
void settingsMenu(void) {
if (!fadein && !fadeout) {
if (showCursor) {
if (hDown & KEY_UP) {
sndHighlight();
cursorPosition--;
cursorPositionOnScreen--;
if (cursorPosition < 0) {
cursorPosition = 0;
settingShownFirst = 0;
} else if (cursorPosition < settingShownFirst) {
settingShownFirst--;
}
if (cursorPositionOnScreen < 0) {
cursorPositionOnScreen = 0;
}
}
if (hDown & KEY_DOWN) {
sndHighlight();
cursorPosition++;
cursorPositionOnScreen++;
if (cursorPosition > numberOfSettings) {
cursorPosition = numberOfSettings;
settingShownFirst = numberOfSettings-2;
if (settingShownFirst < 0) settingShownFirst = 0;
if (cursorPositionOnScreen > numberOfSettings) {
cursorPositionOnScreen = numberOfSettings;
}
} else if (cursorPosition > settingShownFirst+2) {
settingShownFirst++;
}
if (cursorPositionOnScreen > 2) {
cursorPositionOnScreen = 2;
}
}
}
if ((hDown & KEY_LEFT) && (cursorPosition <= numberOfSettings)) {
sndSelect();
switch (cursorPosition) {
case 0:
studioBg--;
if (studioBg < 0) studioBg = 2;
displayStudioBg = false;
gspWaitForVBlank();
GFX::loadBgSprite();
displayStudioBg = true;
break;
case 1:
if (iFps==30) iFps = 24;
else if (iFps==24) iFps = 60;
else if (iFps==60) iFps = 30;
C3D_FrameRate(iFps);
break;
}
}
if (((hDown & KEY_RIGHT) || (hDown & KEY_A)) && (cursorPosition <= numberOfSettings)) {
sndSelect();
switch (cursorPosition) {
case 0:
studioBg++;
if (studioBg > 2) studioBg = 0;
displayStudioBg = false;
gspWaitForVBlank();
GFX::loadBgSprite();
displayStudioBg = true;
break;
case 1:
if (iFps==60) iFps = 24;
else if (iFps==24) iFps = 30;
else if (iFps==30) iFps = 60;
C3D_FrameRate(iFps);
break;
}
}
if ((hDown & KEY_B) || ((hDown & KEY_TOUCH) && touchingBackButton())) {
sndBack();
screenmodebuffer = SCREEN_MODE_GAME_SELECT;
fadeout = true;
}
}
}