OpenXcom Forum

OpenXcom => Offtopic => Topic started by: sergioreynel on January 10, 2015, 10:26:42 pm

Title: openxcom wii ?
Post by: sergioreynel on January 10, 2015, 10:26:42 pm
Has anyone tried to port openxcom to wii since I think its made with sdl and I found this https://wiibrew.org/wiki/SDL_Wii   

 :)

also star control 2 has been ported to wii and it uses sdl https://wiibrew.org/wiki/The_Ur-Quan_Masters
Title: Re: openxcom wii ?
Post by: sergioreynel on January 29, 2015, 01:47:50 am
so no comments :(
Title: Re: openxcom wii ?
Post by: volutar on January 29, 2015, 05:34:28 am
I guess. There are no people here interested in that and having skills in WII homebrew development. I don't know if it's possible since wii has too few memory.
Title: Re: openxcom wii ?
Post by: nebiun on February 04, 2016, 07:21:32 pm
Well, I'm trying.
Found sources and compile SDL library for wii.
Found sources and compile libyaml-cpp for wii

Set the environ for run configure:

export SDL_LIBS="-lSDL_net -lSDL_ttf -lSDL_gfx -lSDL_mixer -lSDL_image -lsmpeg -lSDL -ljpeg -lpng -lfreetype -lvorbisidec -lz -lfat -lwiiuse -lbte -lwiikeyboard -logc -lm"
export SDL_CFLAGS="-I/C/devkitPro/libogc/include/SDL -D__WII__"

export YAML_LIBS="-lyaml-cpp"
export YAML_CFLAGS="-std=gnu++11 -I/C/devkitPro/libogc/include"

and run it:

configure --host=powerpc-eabi

Then: now I have the Makefile, but when I run make I have this (first) error.

  CXX    src/Basescape/openxcom-BaseInfoState.o
src/Basescape/BaseInfoState.cpp: In member function 'virtual void OpenXcom::Base
InfoState::init()':
src/Basescape/BaseInfoState.cpp:302:49: error: 'floor' was not declared in this
scope
  ss5 << (int)floor(_base->getUsedStores() + 0.05) << ":" << _base->getAvailable
Stores();
                                                 ^
make[1]: *** [src/Basescape/openxcom-BaseInfoState.o] Error 1
make[1]: Leaving directory `/c/Users/Utente1/Downloads/WIIdev/OpenXcom-master'
make: *** [all-recursive] Error 1

I think that something is missing in my environ.
I'm a C programmer, not a C++ programmer, and now I need a BIG help to continue...
Title: Re: openxcom wii ?
Post by: yrizoud on February 04, 2016, 07:32:45 pm
In this case, floor is just the basic floor() function from the standard library, so a #include <math.h> should solve this one error. But you may find many other problems...
Title: Re: openxcom wii ?
Post by: winterheart on February 04, 2016, 08:31:42 pm
Do you use yaml-cpp from git HEAD? If so, you forced to compile openxcom with c++11 features. Currently openxcom source code is not ready to it. These error can be easly fixed in code (I even have local branch for it), but i'm not sure for backward compatibility. If you like, I can provide my branch for testing.
Title: Re: openxcom wii ?
Post by: Yankes on February 04, 2016, 09:21:30 pm
He already doing that.

Overall yaml-cpp purge lot of unused headers from it source code causing breaking OXC because many files depend on yaml headers to include it. Simply adding `#include <math.h>` or `#include <algorithm>` should fix most of this errors.

[ps]
wrong header name: "algorithm" without "s".
Title: Re: openxcom wii ?
Post by: nebiun on February 05, 2016, 07:24:30 pm
In this case, floor is just the basic floor() function from the standard library, so a #include <math.h> should solve this one error. But you may find many other problems...

Perfect!
Include <math.h> solve the error.
Now I've some problems with missing SDL header files...
Title: Re: openxcom wii ?
Post by: Yankes on February 05, 2016, 07:34:41 pm
Perfect!
Include <math.h> solve the error.
Now I've some problems with missing SDL header files...
Then probably `SDL_CFLAGS` is not used by build script. I would suggest to place this value manually to script. In long run it isn't proper solution but it could save you lot of time in fighting with strange error caused by not properly configured environment.

Another casue could be that headers and nested deeper in directory (like `/SDL/SDL/` or something like that).
Title: Re: openxcom wii ?
Post by: nebiun on February 05, 2016, 08:12:51 pm
Then probably `SDL_CFLAGS` is not used by build script. I would suggest to place this value manually to script. In long run it isn't proper solution but it could save you lot of time in fighting with strange error caused by not properly configured environment.

Another casue could be that headers and nested deeper in directory (like `/SDL/SDL/` or something like that).

Not so easy  :(
Problem was OpenGL headers needed by SDL.
I found this https://wiibrew.org/wiki/Gl2gx, compile (there was few errors, "Development is currently on hold until a new maintainer is found") then I install it in my environ.

Now, build stops with the error in the attached file.
Title: Re: openxcom wii ?
Post by: Yankes on February 05, 2016, 09:08:41 pm
add `#include <algorithm>`.
Title: Re: openxcom wii ?
Post by: nebiun on February 05, 2016, 10:33:08 pm
add `#include <algorithm>`.
Done.
Same problem in 2 other sources.
And we have complete the Basescape folder  :D
Title: Re: openxcom wii ?
Post by: nebiun on February 05, 2016, 10:36:22 pm
An after a cast problem solved by myself:

src/Battlescape/BattlescapeGenerator.cpp: In member function 'void OpenXcom::Bat
tlescapeGenerator::loadRMP(OpenXcom::MapBlock*, int, int, int)':
src/Battlescape/BattlescapeGenerator.cpp:1672:30: error: comparison between sign
ed and unsigned integer expressions [-Werror=sign-compare]
      if (*k - (int)nodeOffset == *i)
                              ^
This is the next:

src/Battlescape/DebriefingState.cpp: In member function 'void OpenXcom::Debriefi
ngState::prepareDebriefing()':
src/Battlescape/DebriefingState.cpp:863:5: error: 'for_each' is not a member of
'std'
     std::for_each(save->getAlienMissions().begin(), save->getAlienMissions().en
d(),
     ^
make[1]: *** [src/Battlescape/openxcom-DebriefingState.o] Error 1
make[1]: Leaving directory `/c/Users/Utente1/Downloads/WIIdev/OpenXcom-master'
make: *** [all-recursive] Error 1



Solved with google:
added #include <algorithm>    :)
Title: Re: openxcom wii ?
Post by: Yankes on February 05, 2016, 10:51:35 pm
This is still error caused by lack of algorithms header: https://en.cppreference.com/w/cpp/algorithm/for_each
You should add this two headers (math too) until you get error that is not fix by this change.
Another suggestion is reduce error level in compiler. Right now I see that you have makefile with very aggressive setting (-Werror) that probably will not allow compiling OXC. In long run all this warnings should be fixed but is not your job to do this. Ignore it and try get AFAP working binary.
Title: Re: openxcom wii ?
Post by: nebiun on February 05, 2016, 11:13:39 pm
This is still error caused by lack of algorithms header: https://en.cppreference.com/w/cpp/algorithm/for_each
You should add this two headers (math too) until you get error that is not fix by this change.
Another suggestion is reduce error level in compiler. Right now I see that you have makefile with very aggressive setting (-Werror) that probably will not allow compiling OXC. In long run all this warnings should be fixed but is not your job to do this. Ignore it and try get AFAP working binary.

Thanks for the tip.

But now I have a big problem: no execinfo.h and no *backtrace* function in devKitPro environ.
Must i stub them?

  CXX    src/Engine/openxcom-CrossPlatform.o
src/Engine/CrossPlatform.cpp: In function 'void OpenXcom::CrossPlatform::stackTr
ace(void*)':
src/Engine/CrossPlatform.cpp:997:49: error: 'backtrace' was not declared in this
 scope
  size_t size = backtrace(array, MAX_STACK_FRAMES);
                                                 ^
src/Engine/CrossPlatform.cpp:998:48: error: 'backtrace_symbols' was not declared
 in this scope
  char **strings = backtrace_symbols(array, size);
                                                ^
make[1]: *** [src/Engine/openxcom-CrossPlatform.o] Error 1
make[1]: Leaving directory `/c/Users/Utente1/Downloads/WIIdev/OpenXcom-master'
make: *** [all-recursive] Error 1


Title: Re: openxcom wii ?
Post by: Yankes on February 05, 2016, 11:46:03 pm
You can completely remove it for now, this is for debugging purposes.
Title: Re: openxcom wii ?
Post by: nebiun on February 06, 2016, 07:25:25 pm
At the end, all source was compiled, but...
I have a problem loading the final elf.
I think that I need a complete porting of OpenGL for WII... :(
Title: Re: openxcom wii ?
Post by: Yankes on February 06, 2016, 08:03:19 pm
Then simply drop it. OpenGL is only bonus feature. Define macro `__NO_OPENGL` to get ride of it.
Title: Re: openxcom wii ?
Post by: nebiun on February 07, 2016, 12:53:39 pm
Well.
At the end we have a .dol to load on dolphin emulator.
But it is too big.
$ powerpc-eabi-size openxcom.dol
   text    data     bss     dec     hex filename
6742955  399516 70797632        77940103        4a54587 openxcom.dol

Original DOS version requires only 2 Mb of RAM.
Why openxcom is so "fatty"?
Title: Re: openxcom wii ?
Post by: Yankes on February 07, 2016, 03:19:27 pm
do you compile it with debug symbols? Usually on windows my working copy of exe have 200MiB but when I create final version then it have only 3MiB.
Most of this is debug information that used for debugging and not need for normal usage.
Title: Re: openxcom wii ?
Post by: nebiun on February 09, 2016, 06:42:29 pm
do you compile it with debug symbols? Usually on windows my working copy of exe have 200MiB but when I create final version then it have only 3MiB.
Most of this is debug information that used for debugging and not need for normal usage.

Removed -g and recompile all sources, but results are the same.
Title: Re: openxcom wii ?
Post by: Yankes on February 09, 2016, 08:35:24 pm
Removed -g and recompile all sources, but results are the same.
try add `-s` and maybe `-Os`: https://stackoverflow.com/questions/6687630/how-to-remove-unused-c-c-symbols-with-gcc-and-ld
Title: Re: openxcom wii ?
Post by: nebiun on February 13, 2016, 05:06:13 pm
It's too hard optimize this...

src/Engine/Scalers/init.cpp:uint32_t   RGBtoYUV[16777216];
Title: Re: openxcom wii ?
Post by: Yankes on February 13, 2016, 06:28:50 pm
I don't touch that code but if I recall correctly you can drop some scalar out without any big consequences. Basic scalars don't use it.
Title: Re: openxcom wii ?
Post by: nebiun on April 16, 2023, 08:04:28 pm
After long time I go back to this project.
Finally I can start OpenXcom on a real Wii, but it stops during initial menu print.
I think that problem is that the game load all data files in memory at startup.
There is a way to load only needed file and free resource when they are not needed?

Title: Re: openxcom wii ?
Post by: Yankes on April 17, 2023, 02:10:26 am
"free" is impossible, but "load" is already controlled by "lazyLoadResources" configure.
Another question what you try to load? if its base game that mean it would be hard to make it more slim. If some big mod, then load on demand loading will have big impact
Title: Re: openxcom wii ?
Post by: nebiun on May 14, 2023, 05:05:02 pm
It is works  :D
Problem is a poor porting of SDL libraries on WII. I had to modify SDL libraries to see  results.
Now I can see the main menu, can chose the level and can see Geoscape. To move the cursor for positioning thefirst base and stop: I need to emulate keyboard for the input phases  ::)
Not sounds (for now).

A question: there is a way to completly replace original graphic and sounds? I can't (eventually) release the Wii version without graphics and sounds... ;D
Title: Re: openxcom wii ?
Post by: Yankes on May 15, 2023, 01:49:20 am
In theory yes but we did not try do this as this could awake some ancients lawyers that would lay destruction on their path :)