Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/openttd.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ musicdriver =
sounddriver =
blitter =
language = english.lng
resolution = 480,272
resolution = 960,544
screenshot_format =
savegame_format =
rightclick_emulate = false
Expand Down
2 changes: 1 addition & 1 deletion config.lib
Original file line number Diff line number Diff line change
Expand Up @@ -1589,7 +1589,7 @@ make_cflags_and_ldflags() {
CFLAGS="-Wl,-q $CFLAGS -mfpu=neon -mcpu=cortex-a9 -march=armv7-a -mfloat-abi=hard -Wl,-q"
CXXFLAGS="$CXXFLAGS -Wl,-q"
# TODO: This needs to be autoconfigured properly (mostly SDL)
LIBS="$LIBS -Wl,--whole-archive -lpthread -Wl,--no-whole-archive -lSDL2 -lvita2d -lSceAppMgr_stub -lSceGxm_stub -lSceSysmodule_stub -lSceCtrl_stub -lSceDisplay_stub -lSceCommonDialog_stub -lSceAudio_stub -ldebugnet -lSceNetCtl_stub -lSceTouch_stub"
LIBS="$LIBS -Wl,--whole-archive -lpthread -Wl,--no-whole-archive -lSDL2 -lvita2d -lSceAppMgr_stub -lSceGxm_stub -lSceSysmodule_stub -lSceCtrl_stub -lSceDisplay_stub -lSceCommonDialog_stub -lSceAudio_stub -ldebugnet -lSceNetCtl_stub -lSceTouch_stub -lSceHid_stub -lScePower_stub"
LDFLAGS="$LDFLAGS -Wl,-z,nocopyreloc -Wl,-q"
fi

Expand Down
18 changes: 9 additions & 9 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
# OpenTTD port for PS Vita

## Extra Dependencies on top of base OpenTTD
- [SDL Vita](https://github.com/angguss/SDL-Vita) with touch support. SDL 1.2 is not required for vita build
- [debugnet](https://github.com/psxdev/debugnet)
- A recent SDL2 Vita version with touch support. This comes pre-installed with current VitaSDK.

## Building
Configure with

```
PKG_CONFIG_PATH=$VITASDK/arm-vita-eabi/lib/pkgconfig ./configure --os=PSVITA --host arm-vita-eabi --enable-static --prefix=/usr/local/vitasdk --with-sdl="pkg-config sdl2" --without-fontconfig --disable-strip --enable-network=0
PKG_CONFIG_PATH=$VITASDK/arm-vita-eabi/lib/pkgconfig ./configure --os=PSVITA --host arm-vita-eabi --enable-static --prefix=/usr/local/vitasdk --with-sdl="pkg-config sdl2" --without-fontconfig --disable-strip --enable-network=0 --without-liblzo2
```

Then build
Expand All @@ -25,17 +24,18 @@ OpenTTD will attempt to load everything from ux0:/data/openttd/
The easiest way to populate this is to install the PC version and copy the files across. In the future when network support is re-enabled the content downloader should be functional and this step will be skippable.

### Controls
- The touch screen is currently mouse input, press and hold for dragging.
- Use the D-Pad for panning.
- Circle for right-click (hold while tapping)
- Triggers for zoom (right trigger zoom-in, left trigger zoom-out)
- The touch screen is currently indirect mouse input, like on a laptop touchpad style. Short tap for left click, single finger plus second finger short tap for right click. Drag with two fingers to drag and drop.
- Use the D-Pad or right analog stick for panning the map.
- Circle or right trigger for right-click
- Cross or left trigger for left-click
- Square zoom-in
- Triangle zoom-out

### Current Limitations
- The game is set to run at 480x272 scaled to the screen size for the sake of speed. It will run at 960x544 or 720x408 but don't expect more than ~10-15 FPS
- No sound
- No network support

### Other
An initial openttd.cfg can be found in [bin/openttd.cfg](https://github.com/angguss/OpenTTD-vita/blob/master/bin/openttd.cfg), the important parts performance-wise are
- `resolution = 480,272`
- `resolution = 960,544`
- `sprite_cache_size_px = 8`
1 change: 1 addition & 0 deletions source.list
Original file line number Diff line number Diff line change
Expand Up @@ -1081,6 +1081,7 @@ video/null_v.cpp
#if SDL
#if PSVITA
video/sdl_vita_v.cpp
video/vita_touch.cpp
#else
video/sdl_v.cpp
#end
Expand Down
2 changes: 1 addition & 1 deletion src/debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ static void debug_print(const char *dbg, const char *buf)
#elif defined(WIN32) || defined(WIN64)
_fputts(OTTD2FS(buffer, true), stderr);
#elif defined(PSVITA)
sceClibPrintf("%s\n", buf);
//sceClibPrintf("%s\n", buf);
#else
fputs(buffer, stderr);
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#define DEBUG_H

#if defined(PSVITA)
#include <psp2/kernel/clib.h>
//#include <psp2/kernel/clib.h>
#endif

#include "cpu.h"
Expand Down
15 changes: 12 additions & 3 deletions src/openttd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@

#include "safeguards.h"

#if defined(PSVITA)
// overclocking features
#include <psp2/power.h>
#endif

void CallLandscapeTick();
void IncreaseDate();
void DoPaletteAnimations();
Expand Down Expand Up @@ -100,7 +105,7 @@ void CDECL usererror(const char *s, ...)
vseprintf(buf, lastof(buf), s, va);
va_end(va);

sceClibPrintf("usererror: %s\n", buf);
//sceClibPrintf("usererror: %s\n", buf);
}

void CDECL error(const char *s, ...)
Expand All @@ -112,7 +117,7 @@ void CDECL error(const char *s, ...)
vseprintf(buf, lastof(buf), s, va);
va_end(va);

sceClibPrintf("error: %s\n", buf);
//sceClibPrintf("error: %s\n", buf);
}

void CDECL ShowInfoF(const char *s, ...)
Expand All @@ -124,7 +129,7 @@ void CDECL ShowInfoF(const char *s, ...)
vseprintf(buf, lastof(buf), s, va);
va_end(va);

sceClibPrintf("ShowInfoF: %s\n", buf);
//sceClibPrintf("ShowInfoF: %s\n", buf);
}

#else
Expand Down Expand Up @@ -744,6 +749,10 @@ int openttd_main(int argc, char *argv[])
// TODO: Use shared paths here instead of hardcoded.
// argv[0] is NULL on vita, will crash
DeterminePaths("ux0:/data/openttd/");
scePowerSetArmClockFrequency(444);
scePowerSetGpuClockFrequency(222);
scePowerSetBusClockFrequency(222);
scePowerSetGpuXbarClockFrequency(222);
#else
DeterminePaths(argv[0]);
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/sound/sdl_vita_s.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

/** @file sdl_s.cpp Playing sound via SDL. */

#if defined(SDL) && defined(__vita__)
#if defined(WITH_SDL) && defined(PSVITA)

#include "../stdafx.h"

Expand Down
Loading