jorio / OttoMatic

Pangea Software’s Otto Matic 🤖
https://pangeasoft.net/otto
Other
141 stars 13 forks source link

Big Endian port #23

Closed kas1e closed 1 year ago

kas1e commented 1 year ago

Hi Jorio !

Thanks a bunch for fixing it for Big Endian, it works ! Through, i see that in all the menus , and "help" phrases, everything is like too much blue. See on the video:

https://youtu.be/ZvhwfaYtiNE

But in others as you can see on video everything fine. Thanks a bunch !

jorio commented 1 year ago

Great!

Oh, this is definitely an endianness issue. BGRA data is interpreted backwards, so the alpha and blue channels are swapped. Try changing GL_UNSIGNED_INT_8_8_8_8 to GL_UNSIGNED_INT_8_8_8_8_REV in OGL_TextureMap_LoadTGA.

Also, it looks like multitextured animated models are shaded incorrectly. The main character, the brian alien, and the mantis are too bright in the main menu. They're supposed to look like this:

image

kas1e commented 1 year ago

Yeah ! Swap of GL_UNSIGNED_INT_8_8_8_8 to GL_UNSIGNED_INT_8_8_8_8_REV in OGL_TextureMap_LoadTGA did the trick !

As for shading : is there shadows in use ? Why i ask about, because GL4ES do not support shadows at all at the moment, so that can explain the thing. But i will ask GL4ES author about as well.

kas1e commented 1 year ago

Btw, forgot to ask : we do have little problems with the place where "prefs" and "scoreboard" files are saved : on amigaos4 we do have PROGDIR: (as local current dir, i.e. it's kind of HOME for linux), and the root of volumes are name of volume with : after. So for example full path looks like this now: work:games/ottoMattic. Now, to make all data and stuff loads fine, i just replace this part of code in Pomme's files.cpp , in FindFolder()

...
    case kPreferencesFolderType:
    {
#ifdef _WIN32
        path = Pomme::Platform::Windows::GetPreferencesFolder();
#elif defined(__amigaos4__)
        const char *home = "PROGDIR:";
        path = fs::path(home);
#elif defined(__APPLE__)
        const char *home = getenv("HOME");
        if (!home) {
            return fnfErr;
        }
        path = fs::path(home) / "Library" / "Preferences";
#else
...

So far all runs, works ,etc, but when i am about to save preferences or scoreboard, it did create in the root volume "croMagRally" directory, and put prefs/scroreboard files there.

Can you point out me plz where i should change the things correctly, so it will save/load prefs/scoreboard in the game's directory (i.e. in PROGDIR:)

ps. Will try BillyFrontier for now :)

jorio commented 1 year ago

Re: shading:

The three multitextured models in the main menu (robot, alien, mantis) have standard texture mapping with standard Gouraud shading + a sphere mapping effect with an extra texture to achieve a "shiny" look.

The sphere mapping looks fine (the alien looks shiny). However, the Gouraud shading is missing, so those models aren't affected by lighting.

Objects that are not multitextured are correctly Gouraud-shaded in your video: the humans, the clown, the planet's central sphere, etc.

This problem affects all multitextured objects in your video.


Re: PROGDIR:

I'm not sure I fully understand what's going on because I have never used AmigaOS. Is PROGDIR akin to an environment variable that should be resolved (à la getenv("HOME"))?

Something you can try: in PommeDebug.hpp, #define POMME_DEBUG_FILES true. It'll log most file operations to the console and you can check if the paths look correct.

kas1e commented 1 year ago

About progdir : yeah, it't the same as "HOME" on linux, just we have PROGDIR: instead mean "current directory from which we run game". So if we run for example game being in the work:games/game/, then PROGDIR: will mean exactly that path. But something going wrong, and instead of that full path, it write/read prefs file form the work: ,so i think that this semicolon in the path broke something.

Anyway, added #define POMME_DEBUG_FILES true and that what i have when run game:

[HOST] GetDirectoryID:  directory 1: ":"
[HOST] FSMakeFSSpec:    ":BillyFrontier/Prefs"
[HOST] GetDirectoryID:  directory 2: ":BillyFrontier/"
[FILE] OpenFork:    Failed to open Prefs
[HOST] GetDirectoryID:  directory 3: "Data/"
[HOST] GetDirectoryID:  directory 4: "Data/System/"
[FILE] OpenFork:    Stream #1 opened: Application, rsrc
[HOST] GetDirectoryID:  directory 5: ":BillyFrontier"
[HOST] DirCreate:   DirCreate: created ":BillyFrontier"
[HOST] FSMakeFSSpec:    ":BillyFrontier/Prefs"
[FILE] OpenFork:    Failed to open Prefs  

And on exit:

[HOST] DirCreate:   DirCreate: directory already exists: ":BillyFrontier"
[HOST] FSMakeFSSpec:    ":BillyFrontier/Prefs"
[FILE] OpenFork:    Stream #2 opened: Prefs, data
[FILE] CloseStream: Stream #2 closed
Wrote Prefs

All i do for the moment it just add to Pomme/src/files.cpp that in FindFolder():

#ifdef _WIN32
        path = Pomme::Platform::Windows::GetPreferencesFolder();
#elif defined(__amigaos4__)
        const char *home = "PROGDIR:";
        path = fs::path(home);
#elif defined(__APPLE__)
        const char *home = getenv("HOME"); 

And seems that latest : in PROGDIR: broke things.

kas1e commented 1 year ago

Well, i think i fixed it, by just replaced PROGDIR: on .userdata and create directory .userdata in the dir of game, so code looks like this:

#elif defined(__amigaos4__)
        const char *home = ".userdata";
        path = fs::path(home);

And it seems to work as expected.

kas1e commented 1 year ago

Ok we fixed issue with shading in gl4es, now everything works as expected, check this out:

https://youtu.be/16IACnuCtxU

jorio commented 1 year ago

Great to see the game running on Amiga!

If you're still interested, @kas1e, Bugdom is now big-endian ready.