Skip to content

Commit

Permalink
Preserve the PSP port for future reference
Browse files Browse the repository at this point in the history
  • Loading branch information
carstene1ns committed Nov 22, 2015
1 parent 62d559e commit 5d9ca72
Show file tree
Hide file tree
Showing 9 changed files with 87 additions and 21 deletions.
Binary file added builds/psp/144x80.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added builds/psp/480x272.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 42 additions & 0 deletions builds/psp/Makefile
@@ -0,0 +1,42 @@
TARGET = EasyRPG
SOURCES = ../../src ../../lib/liblcf/src ../../lib/liblcf/src/generated ../../lib/shinonome
_CPPFILES = $(foreach dir,$(SOURCES), $(wildcard $(dir)/*.cpp))
_CXXFILES = $(foreach dir,$(SOURCES), $(wildcard $(dir)/*.cxx))
CPPFILES = $(_CXXFILES) $(_CPPFILES)
OBJS = $(_CPPFILES:.cpp=.o) $(_CXXFILES:.cxx=.o)
INCLUDES = $(SOURCES)

INCDIR = $(foreach dir,$(INCLUDES), $(CURDIR)/$(dir))
CFLAGS = -G0 -O2 -Wall -Wextra -DPSP -DUSE_SDL -DNDEBUG
CXXFLAGS = $(CFLAGS) -std=c++0x -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)

PSP_EBOOT_TITLE = EasyRPG
PSP_EBOOT_ICON = "144x80.png"
PSP_EBOOT_PIC1 = "480x272.png"

EXTRA_TARGETS = EBOOT.PBP

PSPSDK=$(shell psp-config --pspsdk-path)
PSPBIN = $(PSPSDK)/../bin

CFLAGS += -I$(shell psp-config --psp-prefix)/include/pixman-1 \
$(shell $(PSPBIN)/freetype-config --cflags) \
-I/opt/psp/psp/include/SDL
LIBS = -lpixman-1 -lpng -lz \
$(shell $(PSPBIN)/freetype-config --libs) \
-lSDL -lGL -lpspvfpu -lpspdebug -lpspgu -lpspctrl -lpspge \
-lpspdisplay -lpsphprm -lpspsdk -lpsprtc -lpspaudio -lpsputility \
-lpspnet_inet -lpspirkeyb -lpsppower -lc -lpspuser \
-lstdc++ -lm
# -lexpat

%.o: %.cxx
$(CXX) $(CXXFLAGS) -c $< -o $@

#BUILD_PRX = 1
#PSP_FW_VERSION = 330
#PSP_LARGE_MEMORY = 1
#ENCRYPT = 1

include $(PSPSDK)/lib/build.mak
8 changes: 7 additions & 1 deletion src/filefinder.cpp
Expand Up @@ -340,6 +340,8 @@ void FileFinder::InitRtpPaths() {

assert(!version_str.empty());

// disable registry check on some platforms
#if !(defined(GEKKO) || defined(__ANDROID__) || defined(PSP))
if (Player::IsRPG2k()) {
// Prefer original 2000 RTP over Kadokawa, because there is no
// reliable way to detect these engine and much more 2k games
Expand All @@ -359,6 +361,7 @@ void FileFinder::InitRtpPaths() {
read_rtp_registry("KADOKAWA", version_str, "RuntimePackagePath");
read_rtp_registry("Enterbrain", version_str, "RUNTIMEPACKAGEPATH");
}
#endif

#ifdef GEKKO
add_rtp_path("sd:/data/rtp/" + version_str + "/");
Expand All @@ -379,6 +382,9 @@ void FileFinder::InitRtpPaths() {
env->DeleteLocalRef(cls);

add_rtp_path(cs + "/" + version_str + "/");
#elif PSP
add_rtp_path("ms0:/data/rtp/" + version_str + "/");
add_rtp_path("ms0:/PSP/EasyRPG/data/rtp/" + version_str + "/");
#else
add_rtp_path("/data/rtp/" + version_str + "/");
#endif
Expand Down Expand Up @@ -517,7 +523,7 @@ bool FileFinder::IsDirectory(std::string const& dir) {
== FILE_ATTRIBUTE_DIRECTORY;
#else
struct stat sb;
# ifdef GEKKO
# if (defined(GEKKO) || defined(PSP))
BOOST_VERIFY(::stat(dir.c_str(), &sb) != -1);
# else
BOOST_VERIFY(::lstat(dir.c_str(), &sb) != -1);
Expand Down
2 changes: 1 addition & 1 deletion src/input_buttons_desktop.cpp
Expand Up @@ -15,7 +15,7 @@
* along with EasyRPG Player. If not, see <http://www.gnu.org/licenses/>.
*/

#if !(defined(OPENDINGUX) || defined(GEKKO))
#if !(defined(OPENDINGUX) || defined(GEKKO) || defined(PSP))

// Headers
#include "input_buttons.h"
Expand Down
9 changes: 9 additions & 0 deletions src/output.cpp
Expand Up @@ -37,6 +37,11 @@
#include <emscripten.h>
#endif

#ifdef PSP
#include <unistd.h>
#include <pspkernel.h>
#endif

#include "filefinder.h"
#include "font.h"
#include "graphics.h"
Expand Down Expand Up @@ -199,6 +204,10 @@ void Output::ErrorStr(std::string const& err) {
#if defined (GEKKO)
// Wii stdin is non-blocking
sleep(5);
#elif defined (PSP)
// run cleanup function
sleep(5);
sceKernelExitGame();
#elif defined (EMSCRIPTEN)
// Don't show JavaScript Window.prompt from stdin call
std::cout << " Process finished.";
Expand Down
17 changes: 17 additions & 0 deletions src/player.cpp
Expand Up @@ -66,6 +66,16 @@
#ifdef EMSCRIPTEN
#include <emscripten.h>
#endif
#ifdef PSP
#include <pspsdk.h>
#include <psppower.h>
#include <pspkernel.h>
#include <pspdebug.h>
#include <pspthreadman.h>

PSP_MODULE_INFO("EasyRPG Player", 0, 0, 32);
PSP_HEAP_SIZE_MAX();
#endif

namespace Player {
bool exit_flag;
Expand Down Expand Up @@ -111,6 +121,13 @@ void Player::Init(int argc, char *argv[]) {
}
#endif

#if defined PSP
pspDebugScreenInit();
atexit(sceKernelExitGame);
// Set processor frequency to maximum
scePowerSetClockFrequency(333, 333, 166);
#endif

#if (defined(_WIN32) && defined(NDEBUG) && defined(WINVER) && WINVER >= 0x0600)
InitMiniDumpWriter();
#endif
Expand Down
18 changes: 4 additions & 14 deletions src/sdl_ui.cpp
Expand Up @@ -96,18 +96,12 @@ SdlUi::SdlUi(long width, long height, const std::string& title, bool fs_flag) :
flags |= SDL_INIT_NOPARACHUTE;
#endif

// Set some SDL env. variables before starting
// These are platform dependent, so every port
// needs to set them manually

// Set window position to the middle of the
// screen
#ifndef GEKKO
// Set some SDL env. variables before starting. These are platform
// dependent, so every port needs to set them manually.
#if !(defined(GEKKO) || defined(PSP))
// Set window position to the middle of the screen
putenv(const_cast<char *>("SDL_VIDEO_WINDOW_POS=center"));
#endif
#if defined(PSP)
putenv(const_cast<char *>("SDL_ASPECT_RATIO=4:3"));
#endif

if (SDL_Init(flags) < 0) {
Output::Error("Couldn't initialize SDL.\n%s\n", SDL_GetError());
Expand Down Expand Up @@ -208,11 +202,7 @@ bool SdlUi::RequestVideoMode(int width, int height, bool fullscreen) {
if (modes == (SDL_Rect **)-1) {
// All modes available
// If we have a high res, turn zoom on
// FIXME: Detect SDL version for this. current_h and current_w are only available in >1.2.10
// PSP SDL port is older than this, lol
#ifndef PSP
current_display_mode.zoom = (vinfo->current_h > height*2 && vinfo->current_w > width*2);
#endif
#if defined(SUPPORT_ZOOM)
zoom_available = current_display_mode.zoom;
#else
Expand Down
12 changes: 7 additions & 5 deletions src/system.h
Expand Up @@ -58,11 +58,6 @@
#ifdef USE_SDL
# define USE_SDL_MIXER

# ifdef PSP
# undef USE_SDL_MIXER
# define NO_SDL_MIXER
# endif

# if defined(GEKKO) || defined(OPENDINGUX) || defined(EMSCRIPTEN)
# undef SUPPORT_ZOOM
# endif
Expand Down Expand Up @@ -95,4 +90,11 @@
# endif
#endif

#ifdef PSP
# undef SUPPORT_AUDIO
# undef SUPPORT_ZOOM
# undef SUPPORT_KEYBOARD
# undef SUPPORT_MOUSE
#endif

#endif

0 comments on commit 5d9ca72

Please sign in to comment.