-
-
Notifications
You must be signed in to change notification settings - Fork 387
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
Add platform "MorphOS" #9294
base: master
Are you sure you want to change the base?
Add platform "MorphOS" #9294
Conversation
Specific to Amiga (MorphOS in my case)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi all,
@BeWorld2018 first of all, thanks for your contribution efforts. Personally, I think that the proposed platform is quite exotic and have significant differences from POSIX in terms of filesystem structure, for instance. I'm not sure if it's worth adding support for such exotic platforms to the main codebase, because there will be issues with supporting this code - MorphOS is a proprietary platform for specific hardware, and I suspect that there are very few people who will be able to, say, test new code or changes in the existing code. The matter is complicated by the fact that, as far as I can see, the proposed changes are not "universal" changes, they are rather "ad hoc" changes.
Alternatively, if MorphOS has its own package manager, I would suggest the author to make and maintain a package (or a separate port) that will contain the necessary patches without integrating them into main codebase.
@ihhub what do you think?
#if defined( _WIN32 ) || defined( __MORPHOS__ ) | ||
if ( fheroes2::cursor().isSoftwareEmulation() ) { | ||
flags |= SDL_WINDOW_FULLSCREEN_DESKTOP; | ||
} | ||
else { | ||
flags |= SDL_WINDOW_FULLSCREEN; | ||
} | ||
#else | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is wrong and breaks platforms other than Windows or MorphOS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @BeWorld2018 , please address this comment.
@@ -1090,7 +1090,7 @@ namespace | |||
|
|||
uint32_t flags = SDL_WINDOW_SHOWN; | |||
if ( isFullScreen ) { | |||
#if defined( _WIN32 ) | |||
#if defined( _WIN32 ) || defined( __MORPHOS__ ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why use SDL_WINDOW_FULLSCREEN
on MorphOS and not SDL_WINDOW_FULLSCREEN_DESKTOP
? SDL_WINDOW_FULLSCREEN
tends to alter the video card settings and does not work well with multimonitor configurations. On the contrary, we would like to throw the SDL_WINDOW_FULLSCREEN
out some day.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SDL_WINDOW_FULLSCREEN on MorphOS use a real new screen, fullscreen desktop use window with no borderless and fullsize...
@@ -105,6 +116,10 @@ | |||
|
|||
#include "math_base.h" | |||
|
|||
#ifdef __MORPHOS__ | |||
#undef tell |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Macros of this kind are always "nice", yeah :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it done? o_O
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @ihhub that's because somewhere inside the system headers of this platform, there is a preprocessor macro with the name tell
. Macros have no idea about scopes, namespaces or class methods, which will break the build if your class has its own method with the same name, for instance. Of course, it cannot be said that this is a plus for the platform.
@@ -29,6 +29,10 @@ | |||
#include <zconf.h> | |||
#include <zlib.h> | |||
|
|||
#ifdef __MORPHOS__ | |||
#undef bind |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah... not nice :-) releated with zlib.h from system headers (shared library)
#define STRINGIFY( x ) #x | ||
#define TOSTRING( x ) STRINGIFY( x ) | ||
#define __AMIGAVER__ TOSTRING( MAJOR_VERSION ) "." TOSTRING( MINOR_VERSION ) "." TOSTRING( INTERMEDIATE_VERSION ) | ||
unsigned long __stack = 1024 * 1024; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this some sort of "service variable"?
#define TOSTRING( x ) STRINGIFY( x ) | ||
#define __AMIGAVER__ TOSTRING( MAJOR_VERSION ) "." TOSTRING( MINOR_VERSION ) "." TOSTRING( INTERMEDIATE_VERSION ) | ||
unsigned long __stack = 1024 * 1024; | ||
static const std::string morphos_versions_tag = "$VER: fheroes2 " __AMIGAVER__ " (" __AMIGADATE__ ")"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where exactly is this variable used and for what?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Specific MorphOS to put version string into executable
COUT( GetCaption() ) | ||
|
||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the issue with this call on MorphOS?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
open shell directly with title :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BeWorld2018 , is it true that logging just opens a shell command?
Hi @oleg-derevenetz , we are open to expand the range of supported platforms but as you noted it has to be done in a proper way that someone must maintain the code in a proper shape and up to date to avoid any issues and subsequent blame of the core team if a platform fails to support the engine. @BeWorld2018 , could you please address the given comments. In order to accept the changes for the new platform we should have approved source code changes. Other things are missing in this pull request:
I would recommend to expand the first message in this pull request to include a comprehensive description as well as all steps mentioned by me as tasks, so it would be easier to address them. I will review this pull request in a while as well. As of now I am marking it as "Draft". |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @BeWorld2018 , I also put several comment here. Please take a look once you have time.
src/Makefile
Outdated
@@ -104,7 +107,12 @@ CPPFLAGS := $(CPPFLAGS) $(CPPFLAGS_FH2) | |||
ifdef FHEROES2_WITH_SYSTEM_SMACKER | |||
LIBS := $(LIBS) -lsmacker | |||
endif | |||
|
|||
ifeq ($(PLATFORM),morphos) | |||
LIBS := $(LIBS) -lz_shared $(LDLIBS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please explain why we need to use a shared variant of lz? Can we avoid it? Could you please point to a place where this is the only option available for this platform?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lz_shared use specific shared z library into us SDK. so specific to MorphOS.
src/Makefile.morphos
Outdated
@@ -0,0 +1,43 @@ | |||
########################################################################### | |||
# fheroes2: https://github.com/ihhub/fheroes2 # | |||
# Copyright (C) 2022 - 2024 # |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please include only 2024 year.
src/Makefile.morphos
Outdated
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # | ||
########################################################################### | ||
|
||
AR = ppc-morphos-gcc-ar-11 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it a default gcc version for MorphOS? Can we use the default one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes it's a last GCC available. but you right we can use ppc-morphos-gcc-ar (default)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use the default one. We want to avoid forcing people to install any other packages just to compile the engine.
src/Makefile.morphos
Outdated
LDFLAGS := -L/gg/usr/local/lib $(LDFLAGS) | ||
# Common flags (for both C and C++ compilers) for fheroes2 only | ||
CCFLAGS_FH2 := -DTARGET_MORPHOS | ||
# -DNDEBUG |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this line as it is not in use anywhere. We have a specific flag for this matter.
src/Makefile.morphos
Outdated
LIBS := $(LIBS) -latomic | ||
|
||
ifdef FHEROES2_WITH_IMAGE | ||
LIBS := $(LIBS) -ljpeg -lwebp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't shell
command exist for Makefile on MorphOS? Why we do need to include JPEG and WEBJ libraries here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
worse, i dont build with this flags... FHEROES2_WITH_IMAGE:-) so i dont test this part... need to do.
@@ -105,6 +116,10 @@ | |||
|
|||
#include "math_base.h" | |||
|
|||
#ifdef __MORPHOS__ | |||
#undef tell |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it done? o_O
@ihhub the issue mostly is that fheroes2 expects the target platform to be more or less POSIX-compatible, especially in terms of filesystem structure and file names, and this platform is not POSIX-compatible (at least if it has the same filesystem structure principles as the original Amiga has at the time). |
Hi, you certaintly right, MorphOS is little platform :-) and exotic |
Hi @BeWorld2018 let's try to implement some improvements step-by-step. I just made a few changes to this PR to implement some "generalization" of the filesystem interaction logic to support non-quite-POSIX-compliant filesystems (which exactly correspond to the changes from #9296). Could you please pull out these changes of mine in your PR and check if everything is working on your device (loading the original game resources, music playback, saving, loading and removing savefiles, map editor, and so on)? |
Yeah it's just perfect, just need to exclude MorphOS form GetCaseInsensitibePath, all datas are find with your changes. Load/Save game = ok |
Hi @BeWorld2018
OK, that's good, thank you. The next release will be any day now, after it comes out, we can merge #9296 and #9297 into the |
Nice, thanks you ! |
OK, the file system is more or less sorted out. Now the question about fullscreen mode - what exactly is the problem with |
No problem here.... |
So the real issue here is that |
The engine has FPS counter for this matter. Please enable it and see how it affects. Also, do it only on release build. |
MorphOS is PPC 32bit bigendian machine (like AmigaOS system)
To build it : make PLATFORM=morphos