Skip to content

Commit

Permalink
Merge pull request #1100 from FlagBrew/NewAPI
Browse files Browse the repository at this point in the history
New GPSS API
  • Loading branch information
piepie62 authored Jan 22, 2020
2 parents 50af899 + 445c41e commit 3ff5ddf
Show file tree
Hide file tree
Showing 84 changed files with 11,847 additions and 8,868 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ common/EventsGalleryPacker/EventsGallery
common/EventsGalleryPacker/out
common/EventsGalleryPacker/__pycache__
common/include/revision.h
external/tools/*
!external/tools/*.cpp
build.log
5 changes: 3 additions & 2 deletions 3ds/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ FORMATSOURCES := ../common/source \
../common/source/sound \
../common/source/sound/decoder \
../common/source/utils \
../core/source \
../core/source/i18n \
../core/source/personal \
../core/source/pkx \
Expand Down Expand Up @@ -93,6 +92,7 @@ FORMATINCLUDES := ../common/include \
INCLUDES := $(FORMATINCLUDES) \
../common/include/picoc \
../common/include/quirc \
../core/fmt \
../core/memecrypto \
../core/include
GRAPHICS := ../assets/gfx/ui
Expand Down Expand Up @@ -125,6 +125,7 @@ CFLAGS := -g -Wall -Wextra -Wno-psabi -O3 -mword-relocations \
-DUNIQUE_ID=${UNIQUE_ID} \
-DCITRA_DEBUG=${CITRA_DEBUG} \
-DPKSM_PORT=34567 \
-DFMT_HEADER_ONLY \
`arm-none-eabi-pkg-config libmpg123 --cflags` \
`curl-config --cflags`

Expand Down Expand Up @@ -250,7 +251,7 @@ ifeq ($(OS),Windows_NT)
else
@cd $(PACKER) && python3 packer.py
endif
@cd $(PACKER) && mv out/*.bin.bz2 out/*.json.bz2 ../../assets/romfs/mg
@cd $(PACKER) && cp out/*.bin.bz2 out/*.json.bz2 ../../assets/romfs/mg
ifeq ($(OS),Windows_NT)
@cd $(SCRIPTS) && py -3 genScripts.py
else
Expand Down
2 changes: 0 additions & 2 deletions 3ds/include/gui/screen/CloudScreen.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ class PKX;

class CloudScreen : public Screen
{
friend class StorageViewOverlay;

public:
CloudScreen(int storageBox, std::shared_ptr<PKFilter> filter = nullptr);

Expand Down
79 changes: 79 additions & 0 deletions 3ds/include/gui/screen/GroupCloudScreen.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/*
* This file is part of PKSM
* Copyright (C) 2016-2019 Bernardo Giordano, Admiral Fish, piepie62
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
* * Requiring preservation of specified reasonable legal notices or
* author attributions in that material or in the Appropriate Legal
* Notices displayed by works containing it.
* * Prohibiting misrepresentation of the origin of that material,
* or requiring that modified versions of such material be marked in
* reasonable ways as different from the original version.
*/

#ifndef GROUPCLOUDSCREEN_HPP
#define GROUPCLOUDSCREEN_HPP

#include "GroupCloudAccess.hpp"
#include "Screen.hpp"

class Button;
class PKX;
class PKFilter;

class GroupCloudScreen : public Screen
{
public:
GroupCloudScreen(int storageBox, std::shared_ptr<PKFilter> filter);

void update(touchPosition* touch) override;
void drawTop() const override;
void drawBottom() const override;

private:
bool showViewer();
bool releasePkm();
bool dumpPkm();
bool backButton();
// Have to basically reimplement Hid because two Hids don't go well together
bool prevBox(bool forceBottom = false);
bool nextBox(bool forceBottom = false);
bool prevBoxTop();
bool nextBoxTop();
bool clickBottomIndex(int index);

void pickup();

// Will send Pokémon in toSend as a group, then clear it
void shareSend();
// If toSend is empty and groupPkm is empty, grabs the group and sticks it in groupPkm
void shareReceive();

std::array<std::unique_ptr<Button>, 7> mainButtons;
std::array<std::unique_ptr<Button>, 31> clickButtons;
std::shared_ptr<PKX> infoMon = nullptr;
std::vector<std::shared_ptr<PKX>> groupPkm;
// box-index pairs
std::vector<std::pair<int, int>> toSend;
std::shared_ptr<PKFilter> filter;
GroupCloudAccess access;
int cursorIndex = 0;
int storageBox = 0;
bool justSwitched = true;
bool cloudChosen = false;
};

#endif
46 changes: 46 additions & 0 deletions 3ds/include/gui/screen/LegalInfoScreen.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* This file is part of PKSM
* Copyright (C) 2016-2019 Bernardo Giordano, Admiral Fish, piepie62
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
* * Requiring preservation of specified reasonable legal notices or
* author attributions in that material or in the Appropriate Legal
* Notices displayed by works containing it.
* * Prohibiting misrepresentation of the origin of that material,
* or requiring that modified versions of such material be marked in
* reasonable ways as different from the original version.
*/

#ifndef LEGALINFOSCREEN_HPP
#define LEGALINFOSCREEN_HPP

#include "ScrollingTextScreen.hpp"

class Button;

class LegalInfoScreen : public ScrollingTextScreen
{
public:
LegalInfoScreen(const std::string& text, std::shared_ptr<PKX> pk);
void update(touchPosition* touch) override;
void drawBottom() const override;

private:
void attemptLegalization();
std::unique_ptr<Button> legalButton;
};

#endif
4 changes: 3 additions & 1 deletion 3ds/include/gui/screen/ScrollingTextScreen.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,11 @@ class ScrollingTextScreen : public Screen
void drawTop() const override;
void drawBottom() const override;

protected:
std::shared_ptr<PKX> pkm;

private:
std::shared_ptr<TextParse::Text> text;
std::shared_ptr<PKX> pkm;
size_t lineOffset = 0;
static constexpr size_t SHOWN_LINES = 15;
};
Expand Down
3 changes: 3 additions & 0 deletions 3ds/source/Bank.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "Configuration.hpp"
#include "FSStream.hpp"
#include "PB7.hpp"
#include "PK3.hpp"
#include "PK4.hpp"
#include "PK5.hpp"
#include "PK6.hpp"
Expand Down Expand Up @@ -294,6 +295,8 @@ std::shared_ptr<PKX> Bank::pkm(int box, int slot) const
int index = box * 30 + slot;
switch (entries[index].gen)
{
case Generation::THREE:
return std::make_shared<PK3>(entries[index].data, false);
case Generation::FOUR:
return std::make_shared<PK4>(entries[index].data, false);
case Generation::FIVE:
Expand Down
Loading

0 comments on commit 3ff5ddf

Please sign in to comment.