на Главную Форума - back to Forum Indexна Главную Форума - back to Forum Indexна Главную Форума - back to Forum Index
на Главную Форума - back to Forum Index
Эадор.Сотворение - Eador.The Genesis на Главную Форума - back to Forum Indexна Главную Форума - back to Forum Indexна Главную Форума - back to Forum Index
на Главную Форума - back to Forum Index
Автор / Сообщение

Eador Genesis GNU/Linux port

   Boon947

 
 
 }↑↑ Великий Лучник
Ветеран



Свитков: 655
С нами с: 24.09.2014
Цитировать
СообщениеДобавлено: Вт Ноя 17, 2020 0:55     Заголовок сообщения:

Hello NovHak,

It is likely that the same bug exists in the Windows binary.
Depends which compilation flags Alexey used (for MSVC, I suppose).

The code is written in C++
int Loot [9][2]; defines an array of 9 pairs of integers.
Loot[9][0] is invalid (out-of-bound access).

In the expression Loot[k][0] == 0) && (k < 9)
the compiler considers that k < 9 is "unnecessary" since the code already accesses Loot[9][0]

Not sure how to test the quest reward hypothesis.
There might be a "test mode" to force specific events.

FWIW, New Horizons works in wine64 Wink

Regards.
Посмотреть профиль Отправить личное сообщение
   NovHak

 
 
 Охотник

Свитков: 10
С нами с: 19.01.2020
Цитировать
СообщениеДобавлено: Пт Ноя 20, 2020 19:08     Заголовок сообщения:

Hi Boon !

It's interesting that now, the Linux version may be more bug-proof than the Windows version ! Too often, it's quite the contrary...

I didn't try the new version yet, but you can be assured I will (right now I'm trying a game that's called Dungeon Crawl Stone Soup, that's part of most Linux distributions (package name in Debian is crawl-tiles)). And I will try a game where my treasury is always full until I get a new item from a quest, and we'll see... but it will probably take some time.

Best regards !
Посмотреть профиль Отправить личное сообщение
   misz_hawk

 
 
 Охотник

Свитков: 5
С нами с: 14.01.2022
Цитировать
СообщениеДобавлено: Пт Янв 14, 2022 17:10     Заголовок сообщения:

Thank you for great Linux version it works better than windows one, except one problem, that I encountered.

If I try to move my save files from my WIN10 PC it is crashing when I try to load the game. If I start new campaign everything is perfect.

Do you know what could be a problem?
Посмотреть профиль Отправить личное сообщение
   Boon947

 
 
 }↑↑ Великий Лучник
Ветеран



Свитков: 655
С нами с: 24.09.2014
Цитировать
СообщениеДобавлено: Пт Янв 14, 2022 18:46     Заголовок сообщения:

misz_hawk писал(а):
Thank you for great Linux version it works better than windows one, except one problem, that I encountered.

If I try to move my save files from my WIN10 PC it is crashing when I try to load the game. If I start new campaign everything is perfect.

Do you know what could be a problem?

Hello fellow Linux gamer Smile

Just to be sure: this is not a "New Horizons" save game?

Could you zip your "save" folder and share it somewhere so I can take a look?

Regards.
Посмотреть профиль Отправить личное сообщение
   misz_hawk

 
 
 Охотник

Свитков: 5
С нами с: 14.01.2022
Цитировать
СообщениеДобавлено: Пт Янв 14, 2022 19:09     Заголовок сообщения:

Thanks for fast reply. It's vanilla.

my save folder
https://we.tl/t-2owAeg3NAF
Посмотреть профиль Отправить личное сообщение
   Boon947

 
 
 }↑↑ Великий Лучник
Ветеран



Свитков: 655
С нами с: 24.09.2014
Цитировать
СообщениеДобавлено: Пт Янв 14, 2022 22:26     Заголовок сообщения:

I think I see the problem.
On Linux, I built a 64-bit executable.
But on Windows, it's a 32-bit executable.
The format of structs is not compatible between the two binaries.
(If you loaded a Linux save game on Windows, Windows binary would probably crash)

I see two options.
1) compile a 32-bit executable
2) make a compatibility layer for loading save games

What do you think?

Regards.
Посмотреть профиль Отправить личное сообщение
   misz_hawk

 
 
 Охотник

Свитков: 5
С нами с: 14.01.2022
Цитировать
СообщениеДобавлено: Пт Янв 14, 2022 22:42     Заголовок сообщения:

Boon947 писал(а):
I think I see the problem.
On Linux, I built a 64-bit executable.
But on Windows, it's a 32-bit executable.
The format of structs is not compatible between the two binaries.
(If you loaded a Linux save game on Windows, Windows binary would probably crash)

I see two options.
1) compile a 32-bit executable
2) make a compatibility layer for loading save games

What do you think?



Unfortunately my programming (or rather "programming") ended with writing hello world when young and dice rolling php app for university project...

So with my knowledge I generally understand what the problem is, but unfortunately I cannot do or say anything about this options.

PS. There was also my third biggest "programming" achievement. I wrote a .bs file today that runs eador, just because my Mint File Manager sees binary as shared library Wink

Once again thank you for all your help.
Посмотреть профиль Отправить личное сообщение
   NovHak

 
 
 Охотник

Свитков: 10
С нами с: 19.01.2020
Цитировать
СообщениеДобавлено: Пн Янв 17, 2022 3:01     Заголовок сообщения:

Boon947 писал(а):
I see two options.
1) compile a 32-bit executable
2) make a compatibility layer for loading save games

What do you think?

Imho, we've reached a point where 32-bit programs should be avoided whenever possible : in the future, it may become increasingly difficult to run them. On the other hand, I feel adding a layer that detects Windows savegames may bring additional bugs to Eador on Linux. Ultimately, the solution would be to have a 64-bit build of Eador on Windows, but that doesn't solve misz_hawk's current problem... maybe a separate 32-bit to 64-bit savegame conversion utility ? Or maybe even better, a utility that works both ways, 32->64 and 64->32 ?

Another advantage of the utility solution is that maybe it could be open source, so that people could improve it or create other utilities from it, and possibly port it to Windows, which could prove useful if Eador on Windows becomes 64-bit in the future.

Код:
$ ./eador-conv -h
Usage : ./eador-conv [option]... original_save converted_save
Converts Eador : Genesis savegames between 32-bit and 64-bit formats

  -h, --help  this help message
  --64        convert from 32-bit to 64-bit (default)
  --32        convert from 64-bit to 32-bit


But honestly, that's only my opinion and I don't have this problem, since I don't intend to run Eador games across platforms.

Последний раз редактировалось: NovHak (Пн Янв 17, 2022 3:31), всего редактировалось 1 раз
Посмотреть профиль Отправить личное сообщение
   Boon947

 
 
 }↑↑ Великий Лучник
Ветеран



Свитков: 655
С нами с: 24.09.2014
Цитировать
СообщениеДобавлено: Пн Янв 17, 2022 3:14     Заголовок сообщения:

NovHak писал(а):
Boon947 писал(а):
I see two options.
1) compile a 32-bit executable
2) make a compatibility layer for loading save games

Imho, we've reached a point where 32-bit programs should be avoided whenever possible : in the future, it may become increasingly difficult to run them. On the other hand, I feel adding a layer that detects Windows savegames may bring additional bugs to Eador on Linux. Ultimately, the solution would be to have a 64-bit build of Eador on Windows, but that doesn't solve misz_hawk's current problem... maybe a separate 32-bit to 64-bit savegame conversion utility? Or maybe even better, a utility that works both ways, 32->64 and 64->32?

Another advantage of the utility solution is that maybe it could be open source, so that people could improve it or create other utilities from it, and possibly port it to Windows, which could prove useful if Eador on Windows becomes 64-bit in the future.

But honestly, that's only my opinion and I don't have this problem, since I don't intend to run Eador games across platforms.

Building a 32-bit executable is not as straight-forward as I had first thought:
I would need to find 32-bit versions of the libraries (or build them myself).
Plus, the new 32-bit executable would not be able to read 64-bit savegames.

A version that works both ways might have been possible (with a little work)
*if* I had anticipated the need, and changed the format version. Doh!

In the end, we're on the same page: I wrote a 32->64 conversion util Smile

It only works when the player is in the Astral, because there's much less info
to save (so less info to convert).

misz_hawk, would that work for you?

Regards.
Посмотреть профиль Отправить личное сообщение
   NovHak

 
 
 Охотник

Свитков: 10
С нами с: 19.01.2020
Цитировать
СообщениеДобавлено: Пн Янв 17, 2022 3:42     Заголовок сообщения:

Boon947 писал(а):
I wrote a 32->64 conversion util Smile

Nice !

We're really lucky to have you on the Linux platform.

Let's hope misz_hawk is on the Astral already, or (s)he will have to boot Windows again Laughing
Посмотреть профиль Отправить личное сообщение
   Boon947

 
 
 }↑↑ Великий Лучник
Ветеран



Свитков: 655
С нами с: 24.09.2014
Цитировать
СообщениеДобавлено: Пн Янв 17, 2022 4:21     Заголовок сообщения:

I used several magic constants, so I'm not sure how useful it might be.
Any comments before I push it to github?

Код:
#include <allegro>

#define CMP_PFX_32 12628
#define CMP_PFX_64 12632
#define PLAYER_32 4148
#define PLAYER_64 4160
#define SHARD_32 212
#define SHARD_64 224
#define MASK_32 28
#define MASK_64 40
#define TUTORIAL 288

int main(int argc, char **argv)
{
   char buf[12800];

   if (argc != 3)
      return 1;

   PACKFILE *in  = pack_fopen(argv[1], F_READ_PACKED);
   PACKFILE *out = pack_fopen(argv[2], F_WRITE_PACKED);

   if (!in || !out)
      return 2;

   if (pack_getc(in) != 'o' || pack_getc(in) != 'k' || pack_getc(in) != 2)
      return 3;

   pack_fwrite("ok\002", 3, out);

   pack_fread (buf, CMP_PFX_32, in);
   memset(buf + CMP_PFX_32, 0, CMP_PFX_64 - CMP_PFX_32);
   pack_fwrite(buf, CMP_PFX_64, out);

   int shard_count = ((int *)buf)[3];

   for (int i = 0; i < 33; ++i)
   {
      pack_fread (buf, PLAYER_32, in);
      memset(buf + PLAYER_32 - 8, 0, PLAYER_64 - PLAYER_32 + 8);
      pack_fwrite(buf, PLAYER_64, out);
   }

   for (int i = 0; i < shard_count; ++i)
   {
      pack_fread (buf, SHARD_32, in);
      memset(buf + SHARD_32 - 12, 0, SHARD_64 - SHARD_32 + 12);
      pack_fwrite(buf, SHARD_64, out);

      pack_fread (buf, MASK_32, in);
      memset(buf + MASK_32 - 12, 0, MASK_64 - MASK_32 + 12);
      pack_fwrite(buf, MASK_64, out);
   }

   pack_fread (buf, TUTORIAL, in);
   pack_fwrite(buf, TUTORIAL, out);

   pack_fclose(in);
   pack_fclose(out);

   return 0;
}

Regards.
Посмотреть профиль Отправить личное сообщение
   NovHak

 
 
 Охотник

Свитков: 10
С нами с: 19.01.2020
Цитировать
СообщениеДобавлено: Пн Янв 17, 2022 5:16     Заголовок сообщения:

Boon947 писал(а):
I used several magic constants, so I'm not sure how useful it might be.
Any comments before I push it to github?

It still can give an idea about how the save files are organised. And additionally, other people may be able to improve it, e.g. adding 64->32 conversion, and maybe other cosmetic changes, so it is useful imho.

Frankly I'm not an expert programmer, I did program in several languages but not very often, so I'm probably not the one who would give sound advices here, but anyway your program looks very much readable to me, I understand the "padding with zeroes" logic to make up for 64-bit structures, so everything looks fine !
Посмотреть профиль Отправить личное сообщение
   misz_hawk

 
 
 Охотник

Свитков: 5
С нами с: 14.01.2022
Цитировать
СообщениеДобавлено: Пн Янв 17, 2022 20:12     Заголовок сообщения:

Only thing I can say is thank you Boon.You are great human being. It will work for me I cannot be more happy.

Regards.
Посмотреть профиль Отправить личное сообщение
   Boon947

 
 
 }↑↑ Великий Лучник
Ветеран



Свитков: 655
С нами с: 24.09.2014
Цитировать
СообщениеДобавлено: Вт Янв 18, 2022 1:57     Заголовок сообщения:

misz_hawk,
(Just to be sure) are you aware that it is possible to play the Windows binary on Linux, using wine64?
Maybe, like NovHak, you prefer a native application?

If you want to convert your campaign savegame for the native app, you'll have to conquer the current shard,
and exit while in the Astral.

Regards.
Посмотреть профиль Отправить личное сообщение
   misz_hawk

 
 
 Охотник

Свитков: 5
С нами с: 14.01.2022
Цитировать
СообщениеДобавлено: Вт Янв 18, 2022 15:26     Заголовок сообщения:

Yes, unfortunately I have problems with getting wine working smooth on my computer. I have some games working, but most don't. Eador is among them.
Посмотреть профиль Отправить личное сообщение
   Boon947

 
 
 }↑↑ Великий Лучник
Ветеран



Свитков: 655
С нами с: 24.09.2014
Цитировать
СообщениеДобавлено: Ср Янв 19, 2022 19:14     Заголовок сообщения:

Hello misz_hawk,

Here's your save in the Astral BEFORE you attack the current shard:
http://eador.online.fr/game0.cmp
(Turn 22 in the Astral)

Your Shard save is up to Turn 72, that's a lot of work to throw away!
If you can finish the shard (on Windows, or in wine) then I can convert your next Astral save.

Or you can convert it yourself:
https://github.com/Boon947/eador/commit/ae1265636080

Regards.
Посмотреть профиль Отправить личное сообщение
Часовой пояс: GMT +3:00
На страницу Пред.  1, 2

 


Ты не можешь начинать темы
Ты не можешь отвечать на сообщения
Ты не можешь редактировать свои сообщения
Ты не можешь удалять свои сообщения
Ты не можешь голосовать в опросах
на Главную Форума - back to Forum Indexна Главную Форума - back to Forum Indexна Главную Форума - back to Forum Indexна Главную Форума - back to Forum Index Eador. The Genesis. Encyclopedia на Главную Форума - back to Forum Indexна Главную Форума - back to Forum Indexна Главную Форума - back to Forum Index