New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MorphOS and AmigaOS4 port #1415

Merged
merged 2 commits into from Oct 4, 2018

Conversation

Projects
None yet
4 participants
@BSzili
Contributor

BSzili commented Sep 10, 2018

I created a separate Makefile for simplicity, and also included an OS4-style icon, which is supported by all the Amiga-NG flavors.

@@ -92,6 +92,7 @@ namespace Utils {
*/
std::string EncodeUTF(const std::u32string& str);
#ifndef __amigaos4__

This comment has been minimized.

@Ghabry

Ghabry Sep 10, 2018

Member

no wstring support?

This comment has been minimized.

@BSzili

BSzili Sep 10, 2018

Contributor

Not yet, and I didn't feel like hacking around, because these functions are only used on Windows.

@@ -419,6 +419,90 @@ bool SdlUi::ShowCursor(bool flag) {
void SdlUi::Blit2X(Bitmap const& src, SDL_Surface* dst_surf) {
if (SDL_MUSTLOCK(dst_surf)) SDL_LockSurface(dst_surf);
#if defined(__MORPHOS__) || defined(__amigaos4__)
// Quick & dirty big endian 2x zoom blitter

This comment has been minimized.

@Ghabry

Ghabry Sep 10, 2018

Member

May I ask what the problem with the normal Blit2x code is?

This comment has been minimized.

@BSzili

BSzili Sep 10, 2018

Contributor

It's slow, I barely got 20-25 fps on a Mac Mini G4 with it. With this one I'm getting a relatively stable 50 fps on the same machine. It's also fast enough to get 50 fps in WinUAE in the 2x zoom mode.

This comment has been minimized.

@20kdc

20kdc Sep 10, 2018

Contributor

Player/src/bitmap.cpp

Lines 1081 to 1094 in 4bebc3d

void Bitmap::Blit2x(Rect const& dst_rect, Bitmap const& src, Rect const& src_rect) {
Transform xform = Transform::Scale(0.5, 0.5);
pixman_image_set_transform(src.bitmap, &xform.matrix);
pixman_image_composite32(PIXMAN_OP_SRC,
src.bitmap, (pixman_image_t*) NULL, bitmap,
src_rect.x, src_rect.y,
0, 0,
dst_rect.x, dst_rect.y,
dst_rect.width, dst_rect.height);
pixman_image_set_transform(src.bitmap, nullptr);
}

...could be why (arbitrary matrix transform? theoretically fastpathable but at some point the fastpath checks outweigh the benefits)
There doesn't seem to be anything in pixman to do such stretching - at best one could copy columns twice, then rows within the target buffer starting from the bottom (so it'll only overwrite already handled stuff)

This comment has been minimized.

@Ghabry

Ghabry Sep 10, 2018

Member

Is the system running with 16 bit color scheme?
For some reason the blitting code of Pixman is extremely slow (at least twice) when operating on 16bit (also on little encian). Is probably our fault because this makes no real sense but nobody really understands the undocumented pixman API ^^'.
On the Wii we use a custom SDL build which forces a 32bit surface and this gives a gigantic speedup, maybe is the same problem here.

This comment has been minimized.

@20kdc

20kdc Sep 10, 2018

Contributor

Ghabry: For that particular case: Is it possible the source image surfaces are 32-bit but the destinations are 16 (necessitating conversion)?

This comment has been minimized.

@Ghabry

Ghabry Sep 10, 2018

Member

In my tests even 16-16 was slow according to the profiler.
There are many non-obvious snail-paths in pixman, e.g. when you use ARGB instead of RGBA the code is suddenly 50% slower (could remember this wrong but at least some 32-bit pixel formats are much slower than others).

This comment has been minimized.

@carstene1ns

carstene1ns Sep 22, 2018

Member

Not really happy with this either, however, is SDL1.2 only → does not really matter.
Maybe we could even use this under Wii in the meanwhile...

This comment has been minimized.

@carstene1ns

carstene1ns Sep 27, 2018

Member

Also, maybe we should hide this stuff deeply in some src/platform/amiga/port.cpp... :P

@@ -23,6 +23,10 @@
#include "color.h"
#include "rpg_moveroute.h"
#ifdef __MORPHOS__
#undef Wait

This comment has been minimized.

@Ghabry

Ghabry Sep 10, 2018

Member

Where is all that namespace pollution coming from?
Is there a way to solve this in EasyRPG or is the system library the problem?

This comment has been minimized.

@BSzili

BSzili Sep 10, 2018

Contributor

It's coming from a system header for exec.library. Shared library functions are defined as macros, and they often end up included by C library headers, causing namespace clashes like this.

@Ghabry

This comment has been minimized.

Member

Ghabry commented Sep 10, 2018

Thanks for your PR.

We plan to get rid of all these Makefiles someday and replace everything with autotools or CMake.
Therefore this will probably need work again later in a few months.

@BSzili

This comment has been minimized.

Contributor

BSzili commented Sep 10, 2018

Well, that's my luck. I guess I'll wait to see which one will be kept, and then I'll try to get it to build with that one.

LIBS = -llcf -lexpat \
$(PIXMAN_LIBS) $(PNG_LIBS) \
-lfreetype -lfreetype -lmpg123 \

This comment has been minimized.

@carstene1ns

carstene1ns Sep 22, 2018

Member

overlinking freetype here ;-)

@@ -83,7 +83,7 @@ void Main_Data::Init() {
// first set to current directory for all platforms
project_path = ".";
#ifdef GEKKO
#if defined(GEKKO) || defined(__MORPHOS__) || defined(__amigaos4__)
// Working directory not correctly handled under Wii

This comment has been minimized.

@carstene1ns

carstene1ns Sep 22, 2018

Member

This part should probably be rewritten, as is not Wii-specific anymore.

@@ -419,6 +419,90 @@ bool SdlUi::ShowCursor(bool flag) {
void SdlUi::Blit2X(Bitmap const& src, SDL_Surface* dst_surf) {
if (SDL_MUSTLOCK(dst_surf)) SDL_LockSurface(dst_surf);
#if defined(__MORPHOS__) || defined(__amigaos4__)
// Quick & dirty big endian 2x zoom blitter

This comment has been minimized.

@carstene1ns

carstene1ns Sep 22, 2018

Member

Not really happy with this either, however, is SDL1.2 only → does not really matter.
Maybe we could even use this under Wii in the meanwhile...

@Ghabry

This comment has been minimized.

Member

Ghabry commented Sep 22, 2018

Not really happy with this either, however, is SDL1.2 only → does not really matter.
Maybe we could even use this under Wii in the meanwhile...

(don't have a reply button under your review comment o.O)

The Wii version does not use the 2x blitter because we set the screen resolution to 320x240 and let SDL do the magic.

@carstene1ns

This comment has been minimized.

Member

carstene1ns commented Sep 22, 2018

I do not think there is a special case for Wii resolution.

EDIT: nevermind, this was done by not enabling SUPPORT_ZOOM.

@carstene1ns

This comment has been minimized.

Member

carstene1ns commented Sep 30, 2018

(squashed and rebased)

@carstene1ns carstene1ns added this to the 0.5.4 milestone Sep 30, 2018

@carstene1ns carstene1ns merged commit 50fc262 into EasyRPG:master Oct 4, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment