Skip to content

Commit

Permalink
Cleanup. Change _3DS to __3DS__ and PSP2 to __vita__
Browse files Browse the repository at this point in the history
  • Loading branch information
carstene1ns committed Aug 31, 2021
1 parent 295e0ac commit 25643f9
Show file tree
Hide file tree
Showing 41 changed files with 88 additions and 123 deletions.
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,17 @@ local.properties

# libretro
easyrpg_libretro.*

# switch
*.nacp
*.nro

# 3ds
*.3dsx
*.smdh
*.cia

# psvita
eboot.bin
*.vpk
*.velf
12 changes: 0 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -549,18 +549,6 @@ if(${PLAYER_TARGET_PLATFORM} MATCHES "^(3ds|psvita|switch)$")
set(PLAYER_ENABLE_TESTS OFF)
endif()

# These are shared by libretro and native builds
if(N3DS)
# fixme: libretro
target_compile_definitions(${PROJECT_NAME} PUBLIC __3DS__)
elseif(VITA)
# fixme: better use __vita__, as defined by preprocessor
target_compile_definitions(${PROJECT_NAME} PUBLIC PSP2)
elseif(NSWITCH)
# fixme: libretro
target_compile_definitions(${PROJECT_NAME} PUBLIC __SWITCH__)
endif()

if(NOT PLAYER_BUILD_EXECUTABLE AND BUILD_SHARED_LIBS)
# Need fPIC when compiling a shared library (e.g. libretro.so)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
Expand Down

This file was deleted.

File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>

<livearea style="a1" format-ver="01.00" content-rev="1">
<livearea-background>
<image>bg.png</image>
</livearea-background>

<gate>
<startup-image>startup.png</startup-image>
</gate>

<frame id="frame3">
<liveitem>
<text valign="bottom" text-valign="bottom" align="right" text-align="right" line-space="3" ellipsis="on">
<str color="#ffffff" size="16" bold="on" shadow="on">powered by EasyRPG</str>
</text>
</liveitem>
</frame>

</livearea>
2 changes: 1 addition & 1 deletion src/audio_midi.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class AudioDecoderMidi;

#include "audio_decoder_base.h"

#if defined(GEKKO) || defined(_3DS)
#if defined(GEKKO) || defined(__3DS__)
# define EP_MIDI_FREQ 22050
#else
# define EP_MIDI_FREQ 44100
Expand Down
8 changes: 4 additions & 4 deletions src/baseui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
# include "sdl_ui.h"
#elif USE_LIBRETRO
# include "platform/libretro/libretro_ui.h"
#elif defined(_3DS)
#elif defined(__3DS__)
# include "platform/3ds/3ds_ui.h"
#elif defined(PSP2)
#elif defined(__vita__)
# include "platform/psvita/psp2_ui.h"
#elif defined(__SWITCH__)
# include "platform/switch/switch_ui.h"
Expand All @@ -42,9 +42,9 @@ std::shared_ptr<BaseUi> BaseUi::CreateUi(long width, long height, const Game_Con
return std::make_shared<SdlUi>(width, height, cfg);
#elif defined(USE_LIBRETRO)
return std::make_shared<LibretroUi>(width, height, cfg);
#elif defined(_3DS)
#elif defined(__3DS__)
return std::make_shared<CtrUi>(width, height, cfg);
#elif defined(PSP2)
#elif defined(__vita__)
return std::make_shared<Psp2Ui>(width, height, cfg);
#elif defined(__SWITCH__)
return std::make_shared<NxUi>(width, height, cfg);
Expand Down
4 changes: 2 additions & 2 deletions src/decoder_wildmidi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ bool WildMidiDecoder::Initialize(std::string& error_message) {
config_file = "timidity.cfg";
found = FileFinder::Root().Exists(config_file);
}
#elif defined(_3DS)
#elif defined(__3DS__)
// Only wildmidi paths, no timidity because there was never timidity used on 3DS

// Shipped in a romfs (for CIA and newer 3dsx files)
Expand Down Expand Up @@ -200,7 +200,7 @@ bool WildMidiDecoder::Initialize(std::string& error_message) {
config_file = path + "/timidity.cfg";
found = FileFinder::Root().Exists(config_file);
}
#elif defined(PSP2)
#elif defined(__vita__)
// Only wildmidi paths, no timidity because it was never used on PSVita

// Shipped
Expand Down
2 changes: 1 addition & 1 deletion src/decoder_xmp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ bool XMPDecoder::Open(Filesystem_Stream::InputStream stream) {

int player_interpolation = 0;
int player_effects = 0;
#if defined(PSP) || defined(_3DS) || defined(GEKKO)
#if defined(PSP) || defined(__3DS__) || defined(GEKKO)
// disable filtering and use low quality interpolation
player_interpolation = XMP_INTERP_NEAREST;
#else
Expand Down
4 changes: 2 additions & 2 deletions src/filefinder_rtp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ FileFinder_RTP::FileFinder_RTP(bool no_rtp, bool no_rtp_warnings, std::string rt
#elif defined(__SWITCH__)
AddPath("./rtp/" + version_str);
AddPath("/switch/easyrpg-player/rtp/" + version_str);
#elif defined(_3DS)
#elif defined(__3DS__)
AddPath("romfs:/data/rtp/" + version_str);
AddPath("sdmc:/data/rtp/" + version_str);
#elif defined(PSP2)
#elif defined(__vita__)
AddPath("ux0:/data/easyrpg-player/rtp/" + version_str);
#elif defined(USE_LIBRETRO)
const char* dir = nullptr;
Expand Down
8 changes: 4 additions & 4 deletions src/main_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@
#if defined(USE_SDL) && defined(__ANDROID__)
# include <jni.h>
# include <SDL_system.h>
#elif defined(_3DS)
#elif defined(__3DS__)
# include <3ds.h>
# include <cstdio>
#elif defined(PSP2)
#elif defined(__vita__)
# include <cstdio>
# include <psp2/io/stat.h>
#elif defined(__APPLE__) && TARGET_OS_OSX
Expand Down Expand Up @@ -92,7 +92,7 @@ void Main_Data::Init() {
char working_dir[256];
getcwd(working_dir, 255);
project_path = std::string(working_dir);
#elif defined(PSP2)
#elif defined(__vita__)
// Check if app0 filesystem contains the title id reference file
FILE* f = fopen("app0:/titleid.txt","r");
if (f == NULL)
Expand All @@ -113,7 +113,7 @@ void Main_Data::Init() {
}
FileFinder::SetSaveFilesystem(savefs);
}
#elif defined(_3DS)
#elif defined(__3DS__)
// Check if romFs has some files inside or not
FILE* testfile = fopen("romfs:/RPG_RT.lmt","r");
if (testfile != NULL) {
Expand Down
2 changes: 1 addition & 1 deletion src/output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ void Output::ErrorStr(std::string const& err) {
std::cout << err << std::endl;
std::cout << std::endl;
std::cout << "EasyRPG Player will close now.";
#if defined (GEKKO) || defined(__SWITCH__) || defined(_3DS)
#if defined (GEKKO) || defined(__SWITCH__) || defined(__3DS__)
// stdin is non-blocking
Game_Clock::SleepFor(5s);
#elif defined (EMSCRIPTEN)
Expand Down
24 changes: 12 additions & 12 deletions src/platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ Platform::File::File(std::string name) :
bool Platform::File::Exists() const {
#ifdef _WIN32
return ::GetFileAttributesW(filename.c_str()) != (DWORD)-1;
#elif (defined(GEKKO) || defined(_3DS) || defined(__SWITCH__))
#elif (defined(GEKKO) || defined(__3DS__) || defined(__SWITCH__))
struct stat sb;
return ::stat(filename.c_str(), &sb) == 0;
#elif defined(PSP2)
#elif defined(__vita__)
struct SceIoStat sb;
return (::sceIoGetstat(filename.c_str(), &sb) >= 0);
#else
Expand Down Expand Up @@ -77,7 +77,7 @@ Platform::FileType Platform::File::GetType(bool follow_symlinks) const {
return FileType::Directory;
}
return FileType::Other;
#elif defined(PSP2)
#elif defined(__vita__)
(void)follow_symlinks;
struct SceIoStat sb = {};
if (::sceIoGetstat(filename.c_str(), &sb) >= 0) {
Expand All @@ -88,7 +88,7 @@ Platform::FileType Platform::File::GetType(bool follow_symlinks) const {
return FileType::Unknown;
#else
struct stat sb = {};
# if (defined(GEKKO) || defined(_3DS) || defined(__SWITCH__))
# if (defined(GEKKO) || defined(__3DS__) || defined(__SWITCH__))
(void)follow_symlinks;
auto fn = ::stat;
# else
Expand All @@ -114,7 +114,7 @@ int64_t Platform::File::GetSize() const {
}

return ((int64_t)data.nFileSizeHigh << 32) | (int64_t)data.nFileSizeLow;
#elif defined(PSP2)
#elif defined(__vita__)
struct SceIoStat sb = {};
int result = ::sceIoGetstat(filename.c_str(), &sb);
return (result >= 0) ? (int64_t)sb.st_size : (int64_t)-1;
Expand Down Expand Up @@ -155,7 +155,7 @@ bool Platform::File::MakeDirectory(bool follow_symlinks) const {
return false;
}
#else
# if defined(PSP2)
# if defined(__vita__)
int res = sceIoMkdir(cur_path.c_str(), 0777);
# else
int res = mkdir(cur_path.c_str(), 0777);
Expand All @@ -172,7 +172,7 @@ bool Platform::File::MakeDirectory(bool follow_symlinks) const {
Platform::Directory::Directory(const std::string& name) {
#if defined(_WIN32)
dir_handle = ::_wopendir(Utils::ToWideString(name.empty() ? "." : name).c_str());
#elif defined(PSP2)
#elif defined(__vita__)
dir_handle = ::sceIoDopen(name.empty() ? "." : name.c_str());
#else
dir_handle = ::opendir(name.empty() ? "." : name.c_str());
Expand All @@ -184,7 +184,7 @@ Platform::Directory::~Directory() {
}

bool Platform::Directory::Read() {
#if defined(PSP2)
#if defined(__vita__)
assert(dir_handle >= 0);

valid_entry = ::sceIoDread(dir_handle, &entry) > 0;
Expand All @@ -206,7 +206,7 @@ bool Platform::Directory::Read() {
std::string Platform::Directory::GetEntryName() const {
assert(valid_entry);

#if defined(PSP2)
#if defined(__vita__)
return entry.d_name;
#elif defined(_WIN32)
return Utils::FromWideString(entry->d_name);
Expand All @@ -215,7 +215,7 @@ std::string Platform::Directory::GetEntryName() const {
#endif
}

#ifndef PSP2
#ifndef __vita__
static inline Platform::FileType GetEntryType(...) {
return Platform::FileType::Unknown;
}
Expand All @@ -231,7 +231,7 @@ static inline Platform::FileType GetEntryType(T* entry) {
Platform::FileType Platform::Directory::GetEntryType() const {
assert(valid_entry);

#if defined(PSP2)
#if defined(__vita__)
return SCE_S_ISREG(entry.d_stat.st_mode) ? FileType::File :
SCE_S_ISDIR(entry.d_stat.st_mode) ? FileType::Directory : FileType::Other;
#else
Expand All @@ -244,7 +244,7 @@ void Platform::Directory::Close() {
#if defined(_WIN32)
::_wclosedir(dir_handle);
dir_handle = nullptr;
#elif defined(PSP2)
#elif defined(__vita__)
::sceIoDclose(dir_handle);
dir_handle = -1;
#else
Expand Down
6 changes: 3 additions & 3 deletions src/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
# include "dirent_win.h"
# endif
#else
# ifdef PSP2
# ifdef __vita__
# include <psp2/io/dirent.h>
# include <psp2/io/stat.h>
# else
Expand Down Expand Up @@ -149,7 +149,7 @@ namespace Platform {
#if defined(_WIN32)
_WDIR* dir_handle = nullptr;
struct _wdirent* entry = nullptr;
#elif defined(PSP2)
#elif defined(__vita__)
int dir_handle = -1;
struct SceIoDirent entry = {};
#else
Expand All @@ -160,7 +160,7 @@ namespace Platform {
};

inline Directory::operator bool() const noexcept {
#ifdef PSP2
#ifdef __vita__
return dir_handle >= 0;
#else
return dir_handle != nullptr;
Expand Down
2 changes: 1 addition & 1 deletion src/platform/3ds/3ds_audio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* along with EasyRPG Player. If not, see <http://www.gnu.org/licenses/>.
*/

#if defined(_3DS) && defined(SUPPORT_AUDIO)
#ifdef SUPPORT_AUDIO

#include <cstring>

Expand Down
3 changes: 0 additions & 3 deletions src/platform/3ds/3ds_audio.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

#include "audio.h"

#ifdef _3DS
#include <3ds.h>
#include <3ds/synchronization.h>
#include <memory>
Expand Down Expand Up @@ -65,5 +64,3 @@ class CtrAudio : public AudioInterface {
}; // class CtrAudio

#endif

#endif
3 changes: 1 addition & 2 deletions src/platform/3ds/3ds_clock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@
* You should have received a copy of the GNU General Public License
* along with EasyRPG Player. If not, see <http://www.gnu.org/licenses/>.
*/

#include "3ds_clock.h"

#ifdef _3DS
constexpr bool CtrClock::is_steady;
constexpr int64_t CtrClock::ticks_per_sec;
#endif
3 changes: 0 additions & 3 deletions src/platform/3ds/3ds_clock.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
#ifndef EP_PLATFORM_3DS_CLOCK_H
#define EP_PLATFORM_3DS_CLOCK_H

#ifdef _3DS

#include <3ds.h>
#include <cstdint>
#include <chrono>
Expand Down Expand Up @@ -58,4 +56,3 @@ constexpr const char* CtrClock::Name() {
}

#endif
#endif
4 changes: 0 additions & 4 deletions src/platform/3ds/3ds_ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
* along with EasyRPG Player. If not, see <http://www.gnu.org/licenses/>.
*/

#ifdef _3DS

// Headers
#include "3ds_ui.h"
#include "color.h"
Expand Down Expand Up @@ -333,5 +331,3 @@ void CtrUi::SetTitle(const std::string& /* title */) {
bool CtrUi::ShowCursor(bool /* flag */) {
return true;
}

#endif
4 changes: 0 additions & 4 deletions src/platform/3ds/3ds_ui.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
#ifndef EP_PLATFORM_3DS_UI_H
#define EP_PLATFORM_3DS_UI_H

#ifdef _3DS

// Headers
#include "baseui.h"
#include "color.h"
Expand Down Expand Up @@ -79,5 +77,3 @@ class CtrUi : public BaseUi {
};

#endif

#endif
Loading

0 comments on commit 25643f9

Please sign in to comment.