Skip to content
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

Attempting to port Raptor to PPC Linux 64-Bit #15

Open
sirbaratusii opened this issue Sep 17, 2022 · 9 comments
Open

Attempting to port Raptor to PPC Linux 64-Bit #15

sirbaratusii opened this issue Sep 17, 2022 · 9 comments

Comments

@sirbaratusii
Copy link

sirbaratusii commented Sep 17, 2022

Novice to programming but I attempted to port Raptor to PPC 64-Bit Linux (for fun) but I've run into a issue.

I managed to get the executable compiled after changing sys/io.h to sys/uio.h and recompiling textscreen.a but the application stops after "Registered EXE!" is printed.

Image : Image
Repo link : Link

Any help is welcome!

@RetroGamer02
Copy link

RetroGamer02 commented Sep 17, 2022

Have you tried commenting out parts of the code to see if it gets farther?
Also where is your makefile?

@sirbaratusii
Copy link
Author

Have you tried commenting out parts of the code to see if it gets farther? Also where is your makefile?

Might try that, and also I've used raptor.cbp (Codeblocks) to compile the 64-bit build. I originally was going to port it to Mac OS 10.5 but cmake has trouble with finding SDL (same on Linux too)

Image

@RetroGamer02
Copy link

RetroGamer02 commented Sep 17, 2022

Have you tried commenting out parts of the code to see if it gets farther? Also where is your makefile?

Might try that, and also I've used raptor.cbp (Codeblocks) to compile the 64-bit build. I originally was going to port it to Mac OS 10.5 but cmake has trouble with finding SDL (same on Linux too)

Image

Have you tried finding if SDL1.2 is available? It is possible to use SDL1.2 but you would have to change some things you could use my port for reference for video and audio but I'm not done input yet.
Edit: You might need to compile SDL for PPC Linux. See https://wiki.libsdl.org/Installation

@skynettx
Copy link
Owner

Even if I don't have a PPC environment available right now, I'll try to help you anyway.

I'm assuming that raptor will end with GLB_FetchItem: empty handle..
To check this, set a breakpoint in the glbapi.cpp:

char *GLB_FetchItem(int a1, int a2)
{
    int vb;
    meminfo_t *vd;
    char *m;
    fitem_t *fi;
    if (a1 == -1)
    {
        EXIT_Error("GLB_FetchItem: empty handle.");    //Set the breakpoint here
        return NULL;
    }
...

If the breakpoint is triggered, the problem is probably with the memory manager.
To test this you can turn off the memory manager in the glbapi.cpp as follows:

void GLB_UseVM(void)
{
    fVmem = 1;                  
}

to

void GLB_UseVM(void)
{
    fVmem = 0;                  
}

If the intro starts now, you have already identified the problem.
Try that first and then we'll see.

@sirbaratusii
Copy link
Author

sirbaratusii commented Sep 18, 2022

Even if I don't have a PPC environment available right now, I'll try to help you anyway.

I'm assuming that raptor will end with GLB_FetchItem: empty handle.. To check this, set a breakpoint in the glbapi.cpp:

char *GLB_FetchItem(int a1, int a2)
{
    int vb;
    meminfo_t *vd;
    char *m;
    fitem_t *fi;
    if (a1 == -1)
    {
        EXIT_Error("GLB_FetchItem: empty handle.");    //Set the breakpoint here
        return NULL;
    }
...

If the breakpoint is triggered, the problem is probably with the memory manager. To test this you can turn off the memory manager in the glbapi.cpp as follows:

void GLB_UseVM(void)
{
    fVmem = 1;                  
}

to

void GLB_UseVM(void)
{
    fVmem = 0;                  
}

If the intro starts now, you have already identified the problem. Try that first and then we'll see.

No dice. The breakpoint didn't get triggered and turning off the memory manager didn't work.

@sirbaratusii
Copy link
Author

sirbaratusii commented Sep 18, 2022

However I manage to trigger something relating to fullscreen. (in i_video.cpp)

Image

@skynettx
Copy link
Owner

skynettx commented Sep 19, 2022

This has nothing to do with VIDEO_LoadPrefs().
This function only loads the video settings from the SETUP.INI.

The problem is definitely in the glbapi.cpp.
Raptor does not crash, but is terminated cleanly via EXIT_Error.
The first call to the glbapi.cpp is GLB_InitSystem(argv[0], 6, 0); in the rap.cpp int main(int argc, char *argv[]).
Starting with this call, the execution ends somewhere in the glbapi.cpp.

Now to find out where, set breakpoints in all EXIT_Error functions in the glbapi.cpp.
If a breakpoint is triggered you have the function in which raptor is terminated.
I think this will be GLB_InitSystem, GLB_NumItems, GLB_OpenFile or GLB_FindFile.

Once you've found the function, the next step is to figure out why this is happening.
If you have an x86 environment running raptor, you can step through the code line by line and compare the values ​​between the two environments and see the difference that causes raptor to exit.

@sirbaratusii
Copy link
Author

sirbaratusii commented Sep 20, 2022

Good news is that I manage to trigger a breakpoint in glbapi.cpp somewhere in GLB_InitSystem

It was pointing at EXIT_Error("GLB_NumItems: memory ( init )");

I'll have to figure out why it's causing it.

@skynettx
Copy link
Owner

If you're still interested in getting Raptor running on a PPC64 platform, take a look at the endian branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants